From 8a03ca38ec1fcca48cc7483ce58a7958622df0ff Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 16 Jun 2022 13:04:25 +0100 Subject: [PATCH] Get all selected rows for external ds row export --- .../server/src/api/controllers/row/external.js | 9 ++------- packages/server/yarn.lock | 18 +++++++++--------- packages/worker/yarn.lock | 18 +++++++++--------- 3 files changed, 20 insertions(+), 25 deletions(-) diff --git a/packages/server/src/api/controllers/row/external.js b/packages/server/src/api/controllers/row/external.js index a8c8c0a627..29238f2678 100644 --- a/packages/server/src/api/controllers/row/external.js +++ b/packages/server/src/api/controllers/row/external.js @@ -155,27 +155,22 @@ exports.validate = async () => { } exports.exportRows = async ctx => { - const { datasourceId, tableName } = breakExternalTableId(ctx.params.tableId) + const { datasourceId } = breakExternalTableId(ctx.params.tableId) const db = getAppDB() let format = ctx.query.format const datasource = await db.get(datasourceId) if (!datasource || !datasource.entities) { ctx.throw(400, "Datasource has not been configured for plus API.") } - const tables = datasource.entities - const table = tables[tableName] ctx.request.body = { query: { oneOf: { - [table.primaryDisplay]: ctx.request.body.rows.map( - id => breakRowIdField(id)[0] - ), + _id: ctx.request.body.rows.map(row => JSON.parse(decodeURI(row))[0]), }, }, } let result = await exports.search(ctx) - let headers = Object.keys(result.rows[0]) const exporter = exporters[format] const filename = `export.${format}` diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 14dc041cfe..106747c982 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,10 +1094,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.200-alpha.0": - version "1.0.200-alpha.0" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.0.tgz#2fd1e1cc71c07891fd66e37ceaab2cffb0df1106" - integrity sha512-CZPPuj+WIDTxLVbrv/B4J4rQiNnkRBs3ZWK2AvlVlY9knWuM034MKHPK3YaeQdVofZqkTOfWKZp6KFRroC304g== +"@budibase/backend-core@1.0.200-alpha.3": + version "1.0.200-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.3.tgz#b21ba2bdb4f1de3e5f14161b8203a1a98f693e4d" + integrity sha512-zVy6bfg4yrtjva0MoBMqIbFrNwA+v76XvRgI3GesaSuJKspWCk4lKtV6I4cr6q9Rr2U+kUzK/4ho/0F/oZcfsg== dependencies: "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1175,12 +1175,12 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.0.200-alpha.0": - version "1.0.200-alpha.0" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.0.tgz#68adc9a61a1b975a990e1a4d4ddf5dba69fc038c" - integrity sha512-GxIxvBjCO7kQxFwASKtGC57C2cAN3oiHU+tTCb57qKtp63GdP1z+iqDLtUEOIXXume9bC1xxTD/LSBMziTrHKg== +"@budibase/pro@1.0.200-alpha.3": + version "1.0.200-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.3.tgz#c6bc4c6b335fb8eae973939efc16958022a45a99" + integrity sha512-YUUlfVJA2xhtjL3jXem7WtuqdshDWF8qm4xbEXgvlpgOxHtGrjSxf9WR4kir/F2UDDTgVNmttAS1oWVDMSGzug== dependencies: - "@budibase/backend-core" "1.0.200-alpha.0" + "@budibase/backend-core" "1.0.200-alpha.3" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 2c278dea6a..3c0fb2831b 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,10 +291,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.200-alpha.0": - version "1.0.200-alpha.0" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.0.tgz#2fd1e1cc71c07891fd66e37ceaab2cffb0df1106" - integrity sha512-CZPPuj+WIDTxLVbrv/B4J4rQiNnkRBs3ZWK2AvlVlY9knWuM034MKHPK3YaeQdVofZqkTOfWKZp6KFRroC304g== +"@budibase/backend-core@1.0.200-alpha.3": + version "1.0.200-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.200-alpha.3.tgz#b21ba2bdb4f1de3e5f14161b8203a1a98f693e4d" + integrity sha512-zVy6bfg4yrtjva0MoBMqIbFrNwA+v76XvRgI3GesaSuJKspWCk4lKtV6I4cr6q9Rr2U+kUzK/4ho/0F/oZcfsg== dependencies: "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -322,12 +322,12 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.0.200-alpha.0": - version "1.0.200-alpha.0" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.0.tgz#68adc9a61a1b975a990e1a4d4ddf5dba69fc038c" - integrity sha512-GxIxvBjCO7kQxFwASKtGC57C2cAN3oiHU+tTCb57qKtp63GdP1z+iqDLtUEOIXXume9bC1xxTD/LSBMziTrHKg== +"@budibase/pro@1.0.200-alpha.3": + version "1.0.200-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.200-alpha.3.tgz#c6bc4c6b335fb8eae973939efc16958022a45a99" + integrity sha512-YUUlfVJA2xhtjL3jXem7WtuqdshDWF8qm4xbEXgvlpgOxHtGrjSxf9WR4kir/F2UDDTgVNmttAS1oWVDMSGzug== dependencies: - "@budibase/backend-core" "1.0.200-alpha.0" + "@budibase/backend-core" "1.0.200-alpha.3" node-fetch "^2.6.1" "@cspotcode/source-map-consumer@0.8.0":