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 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
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 }