Skip to content

Commit 03d273a

Browse files
authored
feat: add configApi method (#874)
* feat: add configApi method * chore: publish 1.4.0 release * test: skip export in sqlite
1 parent b39c912 commit 03d273a

File tree

13 files changed

+119
-70
lines changed

13 files changed

+119
-70
lines changed

apps/nestjs-backend/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/backend",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "AGPL-3.0",
55
"private": true,
66
"main": "dist/index.js",

apps/nestjs-backend/test/table-export.e2e-spec.ts

Lines changed: 62 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import os from 'node:os';
33
import path from 'path';
44
import type { INestApplication } from '@nestjs/common';
55
import type { IFieldVo } from '@teable/core';
6-
import { FieldType, Colors, Relationship, ViewType } from '@teable/core';
6+
import { FieldType, Colors, Relationship, ViewType, DriverClient } from '@teable/core';
77
import type { INotifyVo } from '@teable/openapi';
88
import {
99
exportCsvFromTable as apiExportCsvFromTable,
@@ -257,70 +257,75 @@ const createRecordsWithLink = async (mainTableId: string, subTableId: string) =>
257257
});
258258
};
259259

260-
describe('/export/${tableId} OpenAPI ExportController (e2e) Get csv stream from table (Get) ', () => {
261-
it(`should return a csv stream from table and compatible all fields`, async () => {
262-
const { mainTable, subTable } = await createTables();
263-
264-
const exportRes = await apiExportCsvFromTable(mainTable.id);
265-
const disposition = exportRes?.headers[contentDispositionKey];
266-
const contentType = exportRes?.headers[contentTypeKey];
267-
const { data: csvData } = exportRes;
268-
269-
await apiDeleteTable(baseId, mainTable.id);
270-
await apiDeleteTable(baseId, subTable.id);
271-
272-
expect(disposition).toBe(`attachment; filename=${encodeURIComponent(mainTable.name)}.csv`);
273-
expect(contentType).toBe('text/csv');
274-
expect(csvData).toBe(
275-
`Text field,Number field,Checkbox field,Select field,Date field,Attachment field,User Field,Link field,Link field from lookups sub_Name,Link field from lookups sub_Number,Link field from lookups sub_Checkbox,Link field from lookups sub_SingleSelect\r\ntxt1,1.00,true,x,2022-11-28,test.txt ${txtFileData.presignedUrl},,Name1,Name1,1.00,true,sub_y\r\ntxt2,,,y,2022-11-28,,test,,,,,\r\n,,true,z,,,,,,,,`
276-
);
277-
});
260+
describe.skipIf(globalThis.testConfig.driver === DriverClient.Sqlite)(
261+
'/export/${tableId} OpenAPI ExportController (e2e) Get csv stream from table (Get) ',
262+
() => {
263+
it(`should return a csv stream from table and compatible all fields`, async () => {
264+
const { mainTable, subTable } = await createTables();
265+
266+
const exportRes = await apiExportCsvFromTable(mainTable.id);
267+
const disposition = exportRes?.headers[contentDispositionKey];
268+
const contentType = exportRes?.headers[contentTypeKey];
269+
const { data: csvData } = exportRes;
270+
271+
await apiDeleteTable(baseId, mainTable.id);
272+
await apiDeleteTable(baseId, subTable.id);
273+
274+
expect(disposition).toBe(`attachment; filename=${encodeURIComponent(mainTable.name)}.csv`);
275+
expect(contentType).toBe('text/csv');
276+
expect(csvData).toBe(
277+
`Text field,Number field,Checkbox field,Select field,Date field,Attachment field,User Field,Link field,Link field from lookups sub_Name,Link field from lookups sub_Number,Link field from lookups sub_Checkbox,Link field from lookups sub_SingleSelect\r\ntxt1,1.00,true,x,2022-11-28,test.txt ${txtFileData.presignedUrl},,Name1,Name1,1.00,true,sub_y\r\ntxt2,,,y,2022-11-28,,test,,,,,\r\n,,true,z,,,,,,,,`
278+
);
279+
});
278280

279-
it(`should return a csv stream from table with special character table name`, async () => {
280-
const { mainTable, subTable } = await createTables('测试😄', 'subTable');
281+
it(`should return a csv stream from table with special character table name`, async () => {
282+
const { mainTable, subTable } = await createTables('测试😄', 'subTable');
281283

282-
const exportRes = await apiExportCsvFromTable(mainTable.id);
283-
const disposition = exportRes?.headers['content-disposition'];
284-
const contentType = exportRes?.headers['content-type'];
285-
const { data: csvData } = exportRes;
284+
const exportRes = await apiExportCsvFromTable(mainTable.id);
285+
const disposition = exportRes?.headers['content-disposition'];
286+
const contentType = exportRes?.headers['content-type'];
287+
const { data: csvData } = exportRes;
286288

287-
await apiDeleteTable(baseId, mainTable.id);
288-
await apiDeleteTable(baseId, subTable.id);
289+
await apiDeleteTable(baseId, mainTable.id);
290+
await apiDeleteTable(baseId, subTable.id);
289291

290-
expect(disposition).toBe(`attachment; filename=${encodeURIComponent(mainTable.name)}.csv`);
291-
expect(contentType).toBe('text/csv');
292-
expect(csvData).toBe(
293-
`Text field,Number field,Checkbox field,Select field,Date field,Attachment field,User Field,Link field,Link field from lookups sub_Name,Link field from lookups sub_Number,Link field from lookups sub_Checkbox,Link field from lookups sub_SingleSelect\r\ntxt1,1.00,true,x,2022-11-28,test.txt ${txtFileData.presignedUrl},,Name1,Name1,1.00,true,sub_y\r\ntxt2,,,y,2022-11-28,,test,,,,,\r\n,,true,z,,,,,,,,`
294-
);
295-
});
292+
expect(disposition).toBe(`attachment; filename=${encodeURIComponent(mainTable.name)}.csv`);
293+
expect(contentType).toBe('text/csv');
294+
expect(csvData).toBe(
295+
`Text field,Number field,Checkbox field,Select field,Date field,Attachment field,User Field,Link field,Link field from lookups sub_Name,Link field from lookups sub_Number,Link field from lookups sub_Checkbox,Link field from lookups sub_SingleSelect\r\ntxt1,1.00,true,x,2022-11-28,test.txt ${txtFileData.presignedUrl},,Name1,Name1,1.00,true,sub_y\r\ntxt2,,,y,2022-11-28,,test,,,,,\r\n,,true,z,,,,,,,,`
296+
);
297+
});
296298

297-
it(`should return a csv stream from a particular view`, async () => {
298-
const { mainTable, subTable } = await createTables();
299+
it(`should return a csv stream from a particular view`, async () => {
300+
const { mainTable, subTable } = await createTables();
299301

300-
const numberField = mainTable?.fields?.find(
301-
(field) => field.name === 'Number field'
302-
) as IFieldVo;
302+
const numberField = mainTable?.fields?.find(
303+
(field) => field.name === 'Number field'
304+
) as IFieldVo;
303305

304-
const oldColumnMeta = mainTable?.views?.[0]?.columnMeta;
305-
const view2 = await createView(mainTable.id, {
306-
columnMeta: {
307-
...oldColumnMeta,
308-
[numberField.id]: {
309-
...oldColumnMeta?.[numberField.id],
310-
order: 0.5,
306+
const oldColumnMeta = mainTable?.views?.[0]?.columnMeta;
307+
const view2 = await createView(mainTable.id, {
308+
columnMeta: {
309+
...oldColumnMeta,
310+
[numberField.id]: {
311+
...oldColumnMeta?.[numberField.id],
312+
order: 0.5,
313+
},
311314
},
312-
},
313-
type: ViewType.Grid,
314-
});
315+
type: ViewType.Grid,
316+
});
315317

316-
const exportRes = await apiExportCsvFromTable(mainTable.id, view2.id);
317-
const { data: csvData } = exportRes;
318+
const exportRes = await apiExportCsvFromTable(mainTable.id, view2.id);
319+
const { data: csvData } = exportRes;
318320

319-
await apiDeleteTable(baseId, mainTable.id);
320-
await apiDeleteTable(baseId, subTable.id);
321+
console.log('exportRes', csvData);
321322

322-
expect(csvData).toBe(
323-
`Text field,Number field,Checkbox field,Select field,Date field,Attachment field,User Field,Link field,Link field from lookups sub_Name,Link field from lookups sub_Number,Link field from lookups sub_Checkbox,Link field from lookups sub_SingleSelect\r\ntxt1,1.00,true,x,2022-11-28,test.txt ${txtFileData.presignedUrl},,Name1,Name1,1.00,true,sub_y\r\ntxt2,,,y,2022-11-28,,test,,,,,\r\n,,true,z,,,,,,,,`
324-
);
325-
});
326-
});
323+
await apiDeleteTable(baseId, mainTable.id);
324+
await apiDeleteTable(baseId, subTable.id);
325+
326+
expect(csvData).toBe(
327+
`Text field,Number field,Checkbox field,Select field,Date field,Attachment field,User Field,Link field,Link field from lookups sub_Name,Link field from lookups sub_Number,Link field from lookups sub_Checkbox,Link field from lookups sub_SingleSelect\r\ntxt1,1.00,true,x,2022-11-28,test.txt ${txtFileData.presignedUrl},,Name1,Name1,1.00,true,sub_y\r\ntxt2,,,y,2022-11-28,,test,,,,,\r\n,,true,z,,,,,,,,`
328+
);
329+
});
330+
}
331+
);

apps/nextjs-app/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/app",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "AGPL-3.0",
55
"private": true,
66
"main": "main/index.js",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/teable",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "AGPL-3.0",
55
"private": true,
66
"homepage": "https://github.com/teableio/teable",

packages/common-i18n/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/common-i18n",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"homepage": "https://github.com/teableio/teable",
66
"private": false,

packages/core/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/core",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"homepage": "https://github.com/teableio/teable",
66
"publishConfig": {

packages/db-main-prisma/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/db-main-prisma",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"homepage": "https://github.com/teableio/teable",
66
"private": true,

packages/eslint-config-bases/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/eslint-config-bases",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"private": true,
66
"homepage": "https://github.com/teableio/teable",

packages/icons/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/icons",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"homepage": "https://github.com/teableio/teable",
66
"publishConfig": {

packages/openapi/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@teable/openapi",
3-
"version": "1.3.2",
3+
"version": "1.4.0",
44
"license": "MIT",
55
"homepage": "https://github.com/teableio/teable",
66
"publishConfig": {

0 commit comments

Comments
 (0)