π₯ π₯ π₯ A Free & Self-hostable Airtable Alternative
TypeScript airtableairtable-alternativeautomatic-apihacktoberfestlow-codeno-codeno-code-databaseno-code-platformpostgresqlrest-apirestful-apispreadsheetsqliteswagger
lint & refactor to await
Fendy Heryanto0bc621100e6f
diff --git a/packages/nocodb/src/modules/jobs/jobs/data-export/data-export.processor.ts b/packages/nocodb/src/modules/jobs/jobs/data-export/data-export.processor.tsindex bea01a6d69..8886b27b3f 100644--- a/packages/nocodb/src/modules/jobs/jobs/data-export/data-export.processor.ts+++ b/packages/nocodb/src/modules/jobs/jobs/data-export/data-export.processor.ts@@ -37,7 +37,8 @@ export class DataExportProcessor {ncSiteUrl,} = job.data;- if (exportAs !== 'csv' && exportAs !== 'json') NcError.notImplemented(`Export as ${exportAs}`);+ if (exportAs !== 'csv' && exportAs !== 'json')+ NcError.notImplemented(`Export as ${exportAs}`);const hrTime = initTime();@@ -143,7 +144,7 @@ export class DataExportProcessor {// if url is not defined, it is local attachmentconst mimetype = exportAs === 'json' ? 'application/json' : 'text/csv';const filenameWithExt = `${filename}.${fileExtension}`;-+if (!url) {url = await PresignedUrl.getSignedUrl({pathOrUrl: path.join(destPath.replace('nc/uploads/', '')),diff --git a/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts b/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.tsindex d0d307c3a1..4be59260c1 100644--- a/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts+++ b/packages/nocodb/src/modules/jobs/jobs/export-import/export.service.ts@@ -1286,79 +1286,66 @@ export class ExportService {sortArrJson: any;},): Promise<void> {- return new Promise<void>((resolve, reject) => {- this.datasService- .dataList(context, {- model,- view,- query: {- limit,- offset,- fields,- filterArrJson: param?.filterArrJson,- sortArrJson: param?.sortArrJson,- },- baseModel,- ignoreViewFilterAndSort: false,- limitOverride: limit,- skipSortBasedOnOrderCol: true,- })- .then(async (result) => {- try {- if (result.list.length === 0 && offset === 0) {- // Empty result, just return empty array- stream.push('[]');- stream.push(null);- resolve();- return;- }+ const result = await this.datasService.dataList(context, {+ model,+ view,+ query: {+ limit,+ offset,+ fields,+ filterArrJson: param?.filterArrJson,+ sortArrJson: param?.sortArrJson,+ },+ baseModel,+ ignoreViewFilterAndSort: false,+ limitOverride: limit,+ skipSortBasedOnOrderCol: true,+ });- const { data } = await formatter(result.list);+ if (result.list.length === 0 && offset === 0) {+ // Empty result, just return empty array+ stream.push('[]');+ stream.push(null);+ return;+ }- if (isFirst) {- // Start JSON array- stream.push('[\n');- }+ const { data } = await formatter(result.list);- if (data.length > 0) {- // Add comma if not the first batch- if (offset > 0) {- stream.push(',\n');- }+ if (isFirst) {+ // Start JSON array+ stream.push('[\n');+ }- // Write JSON objects- const jsonRows = data.map(row => JSON.stringify(row)).join(',\n');- stream.push(jsonRows);- }+ if (data.length > 0) {+ // Add comma if not the first batch+ if (offset > 0) {+ stream.push(',\n');+ }- if (result.pageInfo.isLastPage) {- // Close JSON array- stream.push('\n]');- stream.push(null);- resolve();- } else {- this.recursiveReadForJson(- context,- formatter,- baseModel,- stream,- model,- view,- offset + limit,- limit,- fields,- false,- param,- )- .then(resolve)- .catch(reject);- }- } catch (e) {- reject(e);- }- })- .catch(reject);- });+ // Write JSON objects+ const jsonRows = data.map((row) => JSON.stringify(row)).join(',\n');+ stream.push(jsonRows);+ }++ if (result.pageInfo.isLastPage) {+ // Close JSON array+ stream.push('\n]');+ stream.push(null);+ } else {+ await this.recursiveReadForJson(+ context,+ formatter,+ baseModel,+ stream,+ model,+ view,+ offset + limit,+ limit,+ fields,+ false,+ param,+ );+ }}private filterOutCrossBaseColumns(model: Model) {