From 2cd26062d42584078d61a05e094500ecf9d458d4 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 27 Jul 2022 16:18:12 +0100 Subject: [PATCH 1/3] Fixing issue discovered in #6813 - versioning of query rows was not correct in automations, was using old broken method. --- .../server/src/automations/steps/queryRows.js | 6 ++-- .../server/src/automations/steps/utils.js | 14 +++++---- packages/server/yarn.lock | 30 +++++++++---------- packages/worker/yarn.lock | 30 +++++++++---------- 4 files changed, 43 insertions(+), 37 deletions(-) diff --git a/packages/server/src/automations/steps/queryRows.js b/packages/server/src/automations/steps/queryRows.js index d4bc5fe076..b6d1938995 100644 --- a/packages/server/src/automations/steps/queryRows.js +++ b/packages/server/src/automations/steps/queryRows.js @@ -96,12 +96,14 @@ exports.run = async function ({ inputs, appId }) { tableId, }, body: { - sortOrder, sortType, + limit, sort: sortColumn, query: filters || {}, - limit, + // default to ascending, like data tab + sortOrder: sortOrder || SortOrders.ASCENDING, }, + version: "1", }) try { await rowController.search(ctx) diff --git a/packages/server/src/automations/steps/utils.js b/packages/server/src/automations/steps/utils.js index 61f4a8080d..ed9a441499 100644 --- a/packages/server/src/automations/steps/utils.js +++ b/packages/server/src/automations/steps/utils.js @@ -17,7 +17,8 @@ exports.getFetchResponse = async fetched => { // need to make sure all ctx structures have the // throw added to them, so that controllers don't // throw a ctx.throw undefined when error occurs -exports.buildCtx = (appId, emitter, { body, params } = {}) => { +// opts can contain, body, params and version +exports.buildCtx = (appId, emitter, opts = {}) => { const ctx = { appId, user: { appId }, @@ -26,11 +27,14 @@ exports.buildCtx = (appId, emitter, { body, params } = {}) => { throw error }, } - if (body) { - ctx.request = { body } + if (opts.body) { + ctx.request = { body: opts.body } } - if (params) { - ctx.params = params + if (opts.params) { + ctx.params = opts.params + } + if (opts.version) { + ctx.version = opts.version } return ctx } diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 462361c7e8..38ee626c11 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.1.7": - version "1.1.7" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.7.tgz#371048be47828da1f13e03b6d808bccb7114cdb5" - integrity sha512-FZnGTQihKugHnaim5osfITwTfIeachtO3ZERRqU68CpoJVI52oyzPixK1oUP2HYFGCcttqIJN90XD/keC1LzQQ== +"@budibase/backend-core@1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.25.tgz#2ae3de9f2e49c8431de23bd1ce8f8040ab46b7d1" + integrity sha512-t95qEYuxLcl/kzZJ90/D9imuG63IpTPY1f2Wrex6JtvgBYh+jvFh1/t6XDPv0NuSWVd5/OILzX6322pq2ak5GQ== dependencies: - "@budibase/types" "^1.1.7" + "@budibase/types" "^1.1.25" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -1177,13 +1177,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.1.7": - version "1.1.7" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.7.tgz#b9120c60a38d4bbc87dc99ef219a8f23418b9d82" - integrity sha512-APMPIWbxPWzAWWKBglGa1csbVxllAsF5Lt7e5hrNVfN51rzJ3TvQ56iIUru0xGOWpelDQWd4FXe1/dpN0hSvEA== +"@budibase/pro@1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.25.tgz#a9fd58b6bd80b9bf523f4e21a32e537b26bb3c92" + integrity sha512-4QvlMW6nqaXIYzpU9iQH54LPFGxdjiQUZGoRfPSdNoj1tKB57iQe0Gz39PopGyzOfVdytAlpJdD22Wfdb378jQ== dependencies: - "@budibase/backend-core" "1.1.7" - "@budibase/types" "1.1.7" + "@budibase/backend-core" "1.1.25" + "@budibase/types" "1.1.25" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": @@ -1204,10 +1204,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@1.1.7", "@budibase/types@^1.1.7": - version "1.1.7" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.7.tgz#d1da67c6c6b09de639130775ed80290148434be0" - integrity sha512-WkR9bS4DdVAAzIgzHDsfMLPBcXs+RVwzOXp2eSFrun1fZQfkiAnMO7+EYhYx4+zF6RLBXiF6iYXPDJLzviufGQ== +"@budibase/types@1.1.25", "@budibase/types@^1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.25.tgz#4d52ac31368de37500a2ae8f8dc02a662d58d49a" + integrity sha512-K74BqAZiM+4URVvGPXhAVE3r+lLQoQ/LOFY30fAvAOv6WMJsw5r7NpF4m1l7bevPxZ6+ku1q/RnoI9aRGqdLlg== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index d4780b53de..54ea03d3b0 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.1.7": - version "1.1.7" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.7.tgz#371048be47828da1f13e03b6d808bccb7114cdb5" - integrity sha512-FZnGTQihKugHnaim5osfITwTfIeachtO3ZERRqU68CpoJVI52oyzPixK1oUP2HYFGCcttqIJN90XD/keC1LzQQ== +"@budibase/backend-core@1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.1.25.tgz#2ae3de9f2e49c8431de23bd1ce8f8040ab46b7d1" + integrity sha512-t95qEYuxLcl/kzZJ90/D9imuG63IpTPY1f2Wrex6JtvgBYh+jvFh1/t6XDPv0NuSWVd5/OILzX6322pq2ak5GQ== dependencies: - "@budibase/types" "^1.1.7" + "@budibase/types" "^1.1.25" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" bcrypt "5.0.1" @@ -324,19 +324,19 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@1.1.7": - version "1.1.7" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.7.tgz#b9120c60a38d4bbc87dc99ef219a8f23418b9d82" - integrity sha512-APMPIWbxPWzAWWKBglGa1csbVxllAsF5Lt7e5hrNVfN51rzJ3TvQ56iIUru0xGOWpelDQWd4FXe1/dpN0hSvEA== +"@budibase/pro@1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.1.25.tgz#a9fd58b6bd80b9bf523f4e21a32e537b26bb3c92" + integrity sha512-4QvlMW6nqaXIYzpU9iQH54LPFGxdjiQUZGoRfPSdNoj1tKB57iQe0Gz39PopGyzOfVdytAlpJdD22Wfdb378jQ== dependencies: - "@budibase/backend-core" "1.1.7" - "@budibase/types" "1.1.7" + "@budibase/backend-core" "1.1.25" + "@budibase/types" "1.1.25" node-fetch "^2.6.1" -"@budibase/types@1.1.7", "@budibase/types@^1.1.7": - version "1.1.7" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.7.tgz#d1da67c6c6b09de639130775ed80290148434be0" - integrity sha512-WkR9bS4DdVAAzIgzHDsfMLPBcXs+RVwzOXp2eSFrun1fZQfkiAnMO7+EYhYx4+zF6RLBXiF6iYXPDJLzviufGQ== +"@budibase/types@1.1.25", "@budibase/types@^1.1.25": + version "1.1.25" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-1.1.25.tgz#4d52ac31368de37500a2ae8f8dc02a662d58d49a" + integrity sha512-K74BqAZiM+4URVvGPXhAVE3r+lLQoQ/LOFY30fAvAOv6WMJsw5r7NpF4m1l7bevPxZ6+ku1q/RnoI9aRGqdLlg== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From ba1c5abf430c6087d5c75b5136663705f4ab4779 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 27 Jul 2022 16:47:19 +0100 Subject: [PATCH 2/3] Fixing an issue with test panel not updating when new test data comes in. --- .../automation/AutomationBuilder/TestPanel.svelte | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/TestPanel.svelte b/packages/builder/src/components/automation/AutomationBuilder/TestPanel.svelte index bdc39b74e1..4f09edf7c2 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/TestPanel.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/TestPanel.svelte @@ -5,9 +5,8 @@ import { ActionStepID } from "constants/backend/automations" export let automation - export let testResults - let blocks + let blocks, testResults $: { blocks = [] @@ -18,15 +17,11 @@ blocks = blocks .concat(automation.definition.steps || []) .filter(x => x.stepId !== ActionStepID.LOOP) - } else if (testResults) { - blocks = testResults.steps || [] - } - } - $: { - if (!testResults) { - testResults = $automationStore.selectedAutomation?.testResults + } else if ($automationStore.selectedAutomation) { + automation = $automationStore.selectedAutomation } } + $: testResults = $automationStore.selectedAutomation?.testResults
From b26d0b6f21f334619b267546c4dbc4c5393e3292 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 27 Jul 2022 17:15:01 +0100 Subject: [PATCH 3/3] Adding fix for issue in cloud with user password deletion causing undefined errors. --- packages/backend-core/src/middleware/authenticated.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/src/middleware/authenticated.js b/packages/backend-core/src/middleware/authenticated.js index 4e6e0b7ba2..d86af773c3 100644 --- a/packages/backend-core/src/middleware/authenticated.js +++ b/packages/backend-core/src/middleware/authenticated.js @@ -127,7 +127,7 @@ module.exports = ( } if (!user && tenantId) { user = { tenantId } - } else { + } else if (user) { delete user.password } // be explicit