From d65d3d21eba31852effa615a7bd9bbf8e7dd8866 Mon Sep 17 00:00:00 2001 From: DarkPhoenix2704 Date: Mon, 11 Nov 2024 10:41:46 +0530 Subject: [PATCH] fix: build --- packages/nocodb-sdk/src/lib/Api.ts | 118 +++++++++++++++++++++++ packages/nocodb/src/db/BaseModelSqlv2.ts | 2 +- 2 files changed, 119 insertions(+), 1 deletion(-) diff --git a/packages/nocodb-sdk/src/lib/Api.ts b/packages/nocodb-sdk/src/lib/Api.ts index 625144dd2c..53368059b2 100644 --- a/packages/nocodb-sdk/src/lib/Api.ts +++ b/packages/nocodb-sdk/src/lib/Api.ts @@ -5480,6 +5480,54 @@ export class Api< ...params, }), + /** + * @description Duplicate a shared base + * + * @tags Base + * @name DuplicateShared + * @summary Duplicate Shared Base + * @request POST:/api/v2/meta/duplicate/{workspaceId}/shared/{sharedBaseId} + * @response `200` `{ + name?: string, + id?: string, + +}` OK + * @response `400` `{ + \** @example BadRequest [Error]: *\ + msg: string, + +}` + */ + duplicateShared: ( + workspaceId: IdType, + sharedBaseId: any, + data: { + options?: { + excludeData?: boolean; + excludeViews?: boolean; + }; + base?: object; + }, + params: RequestParams = {} + ) => + this.request< + { + name?: string; + id?: string; + }, + { + /** @example BadRequest [Error]: */ + msg: string; + } + >({ + path: `/api/v2/meta/duplicate/${workspaceId}/shared/${sharedBaseId}`, + method: 'POST', + body: data, + type: ContentType.Json, + format: 'json', + ...params, + }), + /** * @description Synchronise the meta data difference between NC_DB and external data sources * @@ -8415,6 +8463,42 @@ export class Api< ...params, }), + /** + * @description Bulk upsert table rows in one go. + * + * @tags DB Table Row + * @name BulkUpsert + * @summary Bulk Upsert Table Rows + * @request POST:/api/v1/db/data/bulk/{orgs}/{baseName}/{tableName}/upsert + * @response `200` `(any)[]` OK + * @response `400` `{ + \** @example BadRequest [Error]: *\ + msg: string, + +}` + */ + bulkUpsert: ( + orgs: string, + baseName: string, + tableName: string, + data: object[], + params: RequestParams = {} + ) => + this.request< + any[], + { + /** @example BadRequest [Error]: */ + msg: string; + } + >({ + path: `/api/v1/db/data/bulk/${orgs}/${baseName}/${tableName}/upsert`, + method: 'POST', + body: data, + type: ContentType.Json, + format: 'json', + ...params, + }), + /** * @description Bulk insert table rows in one go. * @@ -9466,6 +9550,40 @@ export class Api< ...params, }), + /** + * @description Count how many rows in the given Table View + * + * @tags Public + * @name DbViewRowCount + * @summary Count Table View Rows + * @request GET:/api/v2/public/shared-view/{sharedViewUuid}/count + * @response `200` `{ + count?: number, + +}` OK + */ + dbViewRowCount: ( + sharedViewUuid: string, + query?: { + where?: string; + /** Query params for nested data */ + nested?: any; + }, + params: RequestParams = {} + ) => + this.request< + { + count?: number; + }, + any + >({ + path: `/api/v2/public/shared-view/${sharedViewUuid}/count`, + method: 'GET', + query: query, + format: 'json', + ...params, + }), + /** * @description Read bulk data from a given table with provided filters * diff --git a/packages/nocodb/src/db/BaseModelSqlv2.ts b/packages/nocodb/src/db/BaseModelSqlv2.ts index b422e9cc21..6f84791ebb 100644 --- a/packages/nocodb/src/db/BaseModelSqlv2.ts +++ b/packages/nocodb/src/db/BaseModelSqlv2.ts @@ -5501,7 +5501,7 @@ class BaseModelSqlv2 { ) { const { allowSystemColumn } = params; const cols = columns || (await this.model.getColumns(this.context)); - let insertObj; + let insertObj = {}; for (let i = 0; i < cols.length; ++i) { const col = cols[i];