From c4cac4a0b1813c762f5985a257c281409ff72f00 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 23 Jun 2021 19:28:33 +0100 Subject: [PATCH 01/27] Fixing some issues discovered with POSTing JSON. --- .../src/automations/steps/outgoingWebhook.js | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/packages/server/src/automations/steps/outgoingWebhook.js b/packages/server/src/automations/steps/outgoingWebhook.js index f476d57ac5..3e56834d3f 100644 --- a/packages/server/src/automations/steps/outgoingWebhook.js +++ b/packages/server/src/automations/steps/outgoingWebhook.js @@ -77,14 +77,31 @@ module.exports.run = async function ({ inputs }) { requestBody.length !== 0 && BODY_REQUESTS.indexOf(requestMethod) !== -1 ) { - request.body = JSON.parse(requestBody) + request.body = requestBody + request.headers = { + "Content-Type": "application/json", + } } try { + // do a quick JSON parse if there is a body, to generate an error if its invalid + if (request.body) { + JSON.parse(request.body) + } const response = await fetch(url, request) + const contentType = response.headers.get("content-type") + const success = response.status === 200 + let resp + if (!success) { + resp = response.statusText + } else if (contentType && contentType.indexOf("application/json") !== -1) { + resp = await response.json() + } else { + resp = await response.text() + } return { - response: await response.json(), - success: response.status === 200, + response: resp, + success: success, } } catch (err) { /* istanbul ignore next */ From 2a0cfc949d183ab2605a2238c046477eb9b14cd6 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 23 Jun 2021 20:11:05 +0100 Subject: [PATCH 02/27] Fixing issue with automation webhook URL being undefined. --- .../Shared/CreateWebhookModal.svelte | 12 +++--- .../automation/Shared/WebhookDisplay.svelte | 3 ++ .../server/src/api/controllers/automation.js | 37 ++++++++++++------- 3 files changed, 33 insertions(+), 19 deletions(-) diff --git a/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte b/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte index 44e91efd50..04656c1e2e 100644 --- a/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte +++ b/packages/builder/src/components/automation/Shared/CreateWebhookModal.svelte @@ -16,11 +16,13 @@ $: automation = $automationStore.selectedAutomation?.automation onMount(async () => { - // save the automation initially - await automationStore.actions.save({ - instanceId, - automation, - }) + if (!automation?.definition?.trigger?.inputs.schemaUrl) { + // save the automation initially + await automationStore.actions.save({ + instanceId, + automation, + }) + } interval = setInterval(async () => { await automationStore.actions.fetch() const outputs = automation?.definition?.trigger.schema.outputs?.properties diff --git a/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte b/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte index e1f2fe78d8..fc5e20f241 100644 --- a/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte +++ b/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte @@ -9,6 +9,9 @@ $: appUrl = $hostingStore.appUrl function fullWebhookURL(uri) { + if (!uri) { + return "" + } if (production) { return `${appUrl}/${uri}` } else { diff --git a/packages/server/src/api/controllers/automation.js b/packages/server/src/api/controllers/automation.js index e1e721b347..2d164b415d 100644 --- a/packages/server/src/api/controllers/automation.js +++ b/packages/server/src/api/controllers/automation.js @@ -88,6 +88,8 @@ async function checkForCronTriggers({ appId, oldAuto, newAuto }) { async function checkForWebhooks({ appId, oldAuto, newAuto }) { const oldTrigger = oldAuto ? oldAuto.definition.trigger : null const newTrigger = newAuto ? newAuto.definition.trigger : null + const triggerChanged = + oldTrigger && newTrigger && oldTrigger.id !== newTrigger.id function isWebhookTrigger(auto) { return ( auto && @@ -98,25 +100,32 @@ async function checkForWebhooks({ appId, oldAuto, newAuto }) { // need to delete webhook if ( isWebhookTrigger(oldAuto) && - !isWebhookTrigger(newAuto) && + (!isWebhookTrigger(newAuto) || triggerChanged) && oldTrigger.webhookId ) { - let db = new CouchDB(appId) - // need to get the webhook to get the rev - const webhook = await db.get(oldTrigger.webhookId) - const ctx = { - appId, - params: { id: webhook._id, rev: webhook._rev }, + try { + let db = new CouchDB(appId) + // need to get the webhook to get the rev + const webhook = await db.get(oldTrigger.webhookId) + const ctx = { + appId, + params: { id: webhook._id, rev: webhook._rev }, + } + // might be updating - reset the inputs to remove the URLs + if (newTrigger) { + delete newTrigger.webhookId + newTrigger.inputs = {} + } + await webhooks.destroy(ctx) + } catch (err) { + // don't worry about not being able to delete, if it doesn't exist all good } - // might be updating - reset the inputs to remove the URLs - if (newTrigger) { - delete newTrigger.webhookId - newTrigger.inputs = {} - } - await webhooks.destroy(ctx) } // need to create webhook - else if (!isWebhookTrigger(oldAuto) && isWebhookTrigger(newAuto)) { + if ( + (!isWebhookTrigger(oldAuto) || triggerChanged) && + isWebhookTrigger(newAuto) + ) { const ctx = { appId, request: { From 2db995c90620bac70ba8c22557f642c1c9967c15 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 23 Jun 2021 20:18:21 +0100 Subject: [PATCH 03/27] Fixing test case and removing console.log. --- .../automation/AutomationBuilder/FlowChart/FlowItem.svelte | 1 - packages/server/__mocks__/node-fetch.js | 5 +++++ packages/server/src/automations/steps/outgoingWebhook.js | 5 ++++- .../server/src/automations/tests/outgoingWebhook.spec.js | 2 +- 4 files changed, 10 insertions(+), 3 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte index 45594c0f0d..439db62639 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowItem.svelte @@ -14,7 +14,6 @@ $: allowDeleteTrigger = !steps.length function deleteStep() { - console.log("Running") automationStore.actions.deleteAutomationBlock(block) } diff --git a/packages/server/__mocks__/node-fetch.js b/packages/server/__mocks__/node-fetch.js index dfca7fd379..a06d026f38 100644 --- a/packages/server/__mocks__/node-fetch.js +++ b/packages/server/__mocks__/node-fetch.js @@ -4,6 +4,11 @@ module.exports = async (url, opts) => { function json(body, status = 200) { return { status, + headers: { + get: () => { + return ["application/json"] + }, + }, json: async () => { return body }, diff --git a/packages/server/src/automations/steps/outgoingWebhook.js b/packages/server/src/automations/steps/outgoingWebhook.js index 3e56834d3f..269e075018 100644 --- a/packages/server/src/automations/steps/outgoingWebhook.js +++ b/packages/server/src/automations/steps/outgoingWebhook.js @@ -77,7 +77,10 @@ module.exports.run = async function ({ inputs }) { requestBody.length !== 0 && BODY_REQUESTS.indexOf(requestMethod) !== -1 ) { - request.body = requestBody + request.body = + typeof requestBody === "string" + ? requestBody + : JSON.stringify(requestBody) request.headers = { "Content-Type": "application/json", } diff --git a/packages/server/src/automations/tests/outgoingWebhook.spec.js b/packages/server/src/automations/tests/outgoingWebhook.spec.js index f1d8d25ba8..9f82fb7604 100644 --- a/packages/server/src/automations/tests/outgoingWebhook.spec.js +++ b/packages/server/src/automations/tests/outgoingWebhook.spec.js @@ -25,7 +25,7 @@ describe("test the outgoing webhook action", () => { expect(res.success).toEqual(true) expect(res.response.url).toEqual("http://www.test.com") expect(res.response.method).toEqual("POST") - expect(res.response.body.a).toEqual(1) + expect(JSON.parse(res.response.body).a).toEqual(1) }) it("should return an error if something goes wrong in fetch", async () => { From b63a901a475f53959509dc537be6dee1fd587ef8 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 23 Jun 2021 19:53:30 +0000 Subject: [PATCH 04/27] v0.9.61 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 940bc56d25..2f2d34f6d1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.60", + "version": "0.9.61", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 1c58cccd9f..30c3565d64 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.60", + "version": "0.9.61", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index ea85d20296..264a291c52 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.60", + "version": "0.9.61", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 727ad9edb1..8b067ba287 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.60", + "version": "0.9.61", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.60", - "@budibase/client": "^0.9.60", + "@budibase/bbui": "^0.9.61", + "@budibase/client": "^0.9.61", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.60", + "@budibase/string-templates": "^0.9.61", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 810cc05377..2da2c3da67 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.60", + "version": "0.9.61", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index dc1a717018..b810d256f0 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.60", + "version": "0.9.61", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.60", - "@budibase/standard-components": "^0.9.60", - "@budibase/string-templates": "^0.9.60", + "@budibase/bbui": "^0.9.61", + "@budibase/standard-components": "^0.9.61", + "@budibase/string-templates": "^0.9.61", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index 216f9b438c..ed77b961c7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.60", + "version": "0.9.61", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.60", - "@budibase/client": "^0.9.60", - "@budibase/string-templates": "^0.9.60", + "@budibase/auth": "^0.9.61", + "@budibase/client": "^0.9.61", + "@budibase/string-templates": "^0.9.61", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -110,7 +110,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.60", + "@budibase/standard-components": "^0.9.61", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 7697275e85..b52f9f8171 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.60", + "version": "0.9.61", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.60", + "@budibase/bbui": "^0.9.61", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 8b7be42ae3..7d49453a8c 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.60", + "version": "0.9.61", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 141dad5bb9..bce3b7a510 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.60", + "version": "0.9.61", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.60", - "@budibase/string-templates": "^0.9.60", + "@budibase/auth": "^0.9.61", + "@budibase/string-templates": "^0.9.61", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From 6857dc08e790e8145fe69823d5dda29cb703c86e Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 23 Jun 2021 23:15:16 +0100 Subject: [PATCH 05/27] string based keyProps not being parsed properly by handlebars --- packages/server/src/integrations/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/utils.js b/packages/server/src/integrations/utils.js index d3deb50963..1829ff4124 100644 --- a/packages/server/src/integrations/utils.js +++ b/packages/server/src/integrations/utils.js @@ -24,7 +24,7 @@ exports.generateRowIdField = (keyProps = []) => { keyProps = [keyProps] } // this conserves order and types - return encodeURIComponent(JSON.stringify(keyProps)) + return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, '')) } // should always return an array From 852691f75d75a9bf50a3b35ee1e3d3fdd4c0d0e5 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 23 Jun 2021 23:19:41 +0100 Subject: [PATCH 06/27] fix external data sources key parsing with double quote strings --- packages/server/src/integrations/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/utils.js b/packages/server/src/integrations/utils.js index 1829ff4124..cb2bbab365 100644 --- a/packages/server/src/integrations/utils.js +++ b/packages/server/src/integrations/utils.js @@ -24,7 +24,7 @@ exports.generateRowIdField = (keyProps = []) => { keyProps = [keyProps] } // this conserves order and types - return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, '')) + return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "")) } // should always return an array From 8d740bd199d85c76c64359ac0abb0fc6ff54975a Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 23 Jun 2021 22:27:33 +0000 Subject: [PATCH 07/27] v0.9.62 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 2f2d34f6d1..5f3f5e48d9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.61", + "version": "0.9.62", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 30c3565d64..5b8903bb2d 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.61", + "version": "0.9.62", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 264a291c52..a4ca564fb0 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.61", + "version": "0.9.62", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 8b067ba287..754f87627f 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.61", + "version": "0.9.62", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.61", - "@budibase/client": "^0.9.61", + "@budibase/bbui": "^0.9.62", + "@budibase/client": "^0.9.62", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.61", + "@budibase/string-templates": "^0.9.62", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 2da2c3da67..b6ade6987e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.61", + "version": "0.9.62", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index b810d256f0..46fd6cc0a4 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.61", + "version": "0.9.62", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.61", - "@budibase/standard-components": "^0.9.61", - "@budibase/string-templates": "^0.9.61", + "@budibase/bbui": "^0.9.62", + "@budibase/standard-components": "^0.9.62", + "@budibase/string-templates": "^0.9.62", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index ed77b961c7..8267ac59a4 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.61", + "version": "0.9.62", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.61", - "@budibase/client": "^0.9.61", - "@budibase/string-templates": "^0.9.61", + "@budibase/auth": "^0.9.62", + "@budibase/client": "^0.9.62", + "@budibase/string-templates": "^0.9.62", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -110,7 +110,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.61", + "@budibase/standard-components": "^0.9.62", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index b52f9f8171..1c2c58eb13 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.61", + "version": "0.9.62", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.61", + "@budibase/bbui": "^0.9.62", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 7d49453a8c..aecd289a60 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.61", + "version": "0.9.62", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index bce3b7a510..3888dfc3bb 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.61", + "version": "0.9.62", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.61", - "@budibase/string-templates": "^0.9.61", + "@budibase/auth": "^0.9.62", + "@budibase/string-templates": "^0.9.62", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From 1a6b46e67813573e9208631c88817736b08b3d7b Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 23 Jun 2021 23:35:53 +0100 Subject: [PATCH 08/27] strip double quotes and use single in ID --- packages/server/src/integrations/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/utils.js b/packages/server/src/integrations/utils.js index cb2bbab365..a643030397 100644 --- a/packages/server/src/integrations/utils.js +++ b/packages/server/src/integrations/utils.js @@ -24,7 +24,7 @@ exports.generateRowIdField = (keyProps = []) => { keyProps = [keyProps] } // this conserves order and types - return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "")) + return encodeURIComponent(JSON.stringify(keyProps).replace(/"/g, "'")) } // should always return an array From 01bd23f45e09ea0a5e4409cc4fb7e3c35aeb6bd5 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 23 Jun 2021 22:43:56 +0000 Subject: [PATCH 09/27] v0.9.63 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 5f3f5e48d9..feb4334e5e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.62", + "version": "0.9.63", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 5b8903bb2d..b84d3384fd 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.62", + "version": "0.9.63", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index a4ca564fb0..4164a2c212 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.62", + "version": "0.9.63", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 754f87627f..f5e95aebe8 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.62", + "version": "0.9.63", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.62", - "@budibase/client": "^0.9.62", + "@budibase/bbui": "^0.9.63", + "@budibase/client": "^0.9.63", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.62", + "@budibase/string-templates": "^0.9.63", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index b6ade6987e..5ad065921e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.62", + "version": "0.9.63", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 46fd6cc0a4..1b14a75d69 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.62", + "version": "0.9.63", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.62", - "@budibase/standard-components": "^0.9.62", - "@budibase/string-templates": "^0.9.62", + "@budibase/bbui": "^0.9.63", + "@budibase/standard-components": "^0.9.63", + "@budibase/string-templates": "^0.9.63", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index 8267ac59a4..6ef8c5e52c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.62", + "version": "0.9.63", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.62", - "@budibase/client": "^0.9.62", - "@budibase/string-templates": "^0.9.62", + "@budibase/auth": "^0.9.63", + "@budibase/client": "^0.9.63", + "@budibase/string-templates": "^0.9.63", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -110,7 +110,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.62", + "@budibase/standard-components": "^0.9.63", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 1c2c58eb13..867dddc9b6 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.62", + "version": "0.9.63", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.62", + "@budibase/bbui": "^0.9.63", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index aecd289a60..81d54ebe12 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.62", + "version": "0.9.63", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 3888dfc3bb..7b8d3f5f34 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.62", + "version": "0.9.63", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.62", - "@budibase/string-templates": "^0.9.62", + "@budibase/auth": "^0.9.63", + "@budibase/string-templates": "^0.9.63", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From a7ce3ada3f91ed05ddb767ee3a5a014986a5cebf Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 24 Jun 2021 11:37:26 +0100 Subject: [PATCH 10/27] Fixing issues discovered with hbs escaping. --- .../src/api/controllers/static/templates/app.hbs | 13 ------------- packages/string-templates/src/helpers/index.js | 9 ++++++--- packages/string-templates/test/helpers.spec.js | 11 +++++++++++ 3 files changed, 17 insertions(+), 16 deletions(-) delete mode 100644 packages/server/src/api/controllers/static/templates/app.hbs diff --git a/packages/server/src/api/controllers/static/templates/app.hbs b/packages/server/src/api/controllers/static/templates/app.hbs deleted file mode 100644 index 60497a05df..0000000000 --- a/packages/server/src/api/controllers/static/templates/app.hbs +++ /dev/null @@ -1,13 +0,0 @@ - - - - - {{{head}}} - - - - - {{{body}}} - \ No newline at end of file diff --git a/packages/string-templates/src/helpers/index.js b/packages/string-templates/src/helpers/index.js index 05145f7c7a..1ff729d187 100644 --- a/packages/string-templates/src/helpers/index.js +++ b/packages/string-templates/src/helpers/index.js @@ -20,10 +20,13 @@ const HELPERS = [ // this help is applied to all statements new Helper(HelperFunctionNames.ALL, value => { // null/undefined values produce bad results - if (value == null) { - return "" + if (value == null || typeof value !== "string") { + return value || "" } - let text = new SafeString(unescape(value).replace(/&/g, "&")) + if (value && value.string) { + value = value.string + } + let text = new SafeString(value.replace(/&/g, "&")) if (text == null || typeof text !== "string") { return text } diff --git a/packages/string-templates/test/helpers.spec.js b/packages/string-templates/test/helpers.spec.js index e43bb5fbe1..b380fd9315 100644 --- a/packages/string-templates/test/helpers.spec.js +++ b/packages/string-templates/test/helpers.spec.js @@ -442,4 +442,15 @@ describe("Cover a few complex use cases", () => { const output = await processObject(input, tableJson) expect(output.dataProvider).not.toBe("Invalid Binding") }) + + it("should be able to handle external ids", async () => { + const input = { + dataProvider: "{{ literal [_id] }}", + } + const context = { + _id: "%5B%221%22%2C%221%22%5D", + } + const output = await processObject(input, context) + expect(output.dataProvider).toBe("%5B%221%22%2C%221%22%5D") + }) }) From 9a28b19ee0f01b20cbe4af9affda2b1c3f079615 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 24 Jun 2021 11:40:31 +0100 Subject: [PATCH 11/27] Adding back app.hbs as it is still required. --- .../src/api/controllers/static/templates/app.hbs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 packages/server/src/api/controllers/static/templates/app.hbs diff --git a/packages/server/src/api/controllers/static/templates/app.hbs b/packages/server/src/api/controllers/static/templates/app.hbs new file mode 100644 index 0000000000..4a04054f21 --- /dev/null +++ b/packages/server/src/api/controllers/static/templates/app.hbs @@ -0,0 +1,13 @@ + + + + + {{{head}}} + + + + +{{{body}}} + \ No newline at end of file From 0ac8a0ffeb56b87b829c2899a8325ad0055ef430 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 24 Jun 2021 11:44:33 +0100 Subject: [PATCH 12/27] Add some container settings to repeaters to allow control of layout of children, and enable settings bar --- packages/standard-components/manifest.json | 88 +++++++++++++++++++ .../standard-components/src/Repeater.svelte | 10 ++- 2 files changed, 95 insertions(+), 3 deletions(-) diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index 450a0d823c..e214cfcdb7 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -242,6 +242,7 @@ "styleable": true, "illegalChildren": ["section"], "hasChildren": true, + "showSettingsBar": true, "settings": [ { "type": "dataProvider", @@ -258,6 +259,93 @@ "type": "filter", "label": "Filtering", "key": "filter" + }, + { + "type": "select", + "label": "Direction", + "key": "direction", + "showInBar": true, + "options": [ + { + "label": "Column", + "value": "column", + "barIcon": "ViewRow", + "barTitle": "Column layout" + }, + { + "label": "Row", + "value": "row", + "barIcon": "ViewColumn", + "barTitle": "Row layout" + } + ], + "defaultValue": "column" + }, + { + "type": "select", + "label": "Horiz. Align", + "key": "hAlign", + "showInBar": true, + "options": [ + { + "label": "Left", + "value": "left", + "barIcon": "AlignLeft", + "barTitle": "Align left" + }, + { + "label": "Center", + "value": "center", + "barIcon": "AlignCenter", + "barTitle": "Align center" + }, + { + "label": "Right", + "value": "right", + "barIcon": "AlignRight", + "barTitle": "Align right" + }, + { + "label": "Stretch", + "value": "stretch", + "barIcon": "MoveLeftRight", + "barTitle": "Align stretched horizontally" + } + ], + "defaultValue": "stretch" + }, + { + "type": "select", + "label": "Vert. Align", + "key": "vAlign", + "showInBar": "true", + "options": [ + { + "label": "Top", + "value": "top", + "barIcon": "AlignTop", + "barTitle": "Align top" + }, + { + "label": "Middle", + "value": "middle", + "barIcon": "AlignMiddle", + "barTitle": "Align middle" + }, + { + "label": "Bottom", + "value": "bottom", + "barIcon": "AlignBottom", + "barTitle": "Align bottom" + }, + { + "label": "Stretch", + "value": "stretch", + "barIcon": "MoveUpDown", + "barTitle": "Align stretched vertically" + } + ], + "defaultValue": "top" } ], "context": { diff --git a/packages/standard-components/src/Repeater.svelte b/packages/standard-components/src/Repeater.svelte index c53789afd6..97694303f5 100644 --- a/packages/standard-components/src/Repeater.svelte +++ b/packages/standard-components/src/Repeater.svelte @@ -1,18 +1,22 @@ -
+ {#if $component.empty} {:else if rows.length > 0} @@ -24,7 +28,7 @@ {:else if loaded && noRowsMessage}
{noRowsMessage}
{/if} -
+