From 1c1f9c950d771b0fd5080ce71f9166a86017822e Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 26 Apr 2024 15:51:53 +0100 Subject: [PATCH 1/2] Quick improvement to use the bulk import endpoint, we don't need to search for the type: row anymore. --- packages/server/src/api/routes/tests/search.spec.ts | 4 +--- packages/server/src/sdk/app/rows/search/sqs.ts | 5 ----- yarn.lock | 9 +-------- 3 files changed, 2 insertions(+), 16 deletions(-) diff --git a/packages/server/src/api/routes/tests/search.spec.ts b/packages/server/src/api/routes/tests/search.spec.ts index 931510a88f..cec686ba74 100644 --- a/packages/server/src/api/routes/tests/search.spec.ts +++ b/packages/server/src/api/routes/tests/search.spec.ts @@ -61,9 +61,7 @@ describe.each([ } async function createRows(rows: Record[]) { - for (const row of rows) { - await config.api.row.save(table._id!, row) - } + await config.api.row.bulkImport(table._id!, { rows }) } class SearchAssertion { diff --git a/packages/server/src/sdk/app/rows/search/sqs.ts b/packages/server/src/sdk/app/rows/search/sqs.ts index 10cc5aa6c6..dabccc4b55 100644 --- a/packages/server/src/sdk/app/rows/search/sqs.ts +++ b/packages/server/src/sdk/app/rows/search/sqs.ts @@ -131,11 +131,6 @@ export async function search( }, relationships, } - // make sure only rows returned - request.filters!.equal = { - ...request.filters?.equal, - type: "row", - } if (params.sort) { const sortField = table.schema[params.sort] diff --git a/yarn.lock b/yarn.lock index d833731db4..6e13122653 100644 --- a/yarn.lock +++ b/yarn.lock @@ -11612,7 +11612,7 @@ fs.realpath@^1.0.0: resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" integrity sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw== -fsevents@^2.3.2, fsevents@~2.3.1, fsevents@~2.3.2: +fsevents@^2.3.2, fsevents@~2.3.2: version "2.3.3" resolved "https://registry.yarnpkg.com/fsevents/-/fsevents-2.3.3.tgz#cac6407785d03675a2a5e1a5305c697b347d90d6" integrity sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw== @@ -19761,13 +19761,6 @@ rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.5.0, rollup-pluginutils@^2.8.1, dependencies: estree-walker "^0.6.1" -rollup@2.45.2: - version "2.45.2" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.45.2.tgz#8fb85917c9f35605720e92328f3ccbfba6f78b48" - integrity sha512-kRRU7wXzFHUzBIv0GfoFFIN3m9oteY4uAsKllIpQDId5cfnkWF2J130l+27dzDju0E6MScKiV0ZM5Bw8m4blYQ== - optionalDependencies: - fsevents "~2.3.1" - rollup@^2.36.2, rollup@^2.45.2: version "2.79.1" resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.79.1.tgz#bedee8faef7c9f93a2647ac0108748f497f081c7" From f670b75e13b6973b27035bd2a9c88057337c8060 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 26 Apr 2024 15:53:16 +0100 Subject: [PATCH 2/2] Adding bulk import type. --- packages/server/src/api/controllers/table/utils.ts | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/server/src/api/controllers/table/utils.ts b/packages/server/src/api/controllers/table/utils.ts index f496c686f3..8eac30e4df 100644 --- a/packages/server/src/api/controllers/table/utils.ts +++ b/packages/server/src/api/controllers/table/utils.ts @@ -128,6 +128,7 @@ export async function importToRows( for (let i = 0; i < data.length; i++) { let row = data[i] row._id = generateRowID(table._id!) + row.type = "row" row.tableId = table._id // We use a reference to table here and update it after input processing,