diff --git a/lerna.json b/lerna.json index e75391dd48..feb4334e5e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.59", + "version": "0.9.63", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index bee9f365d3..b84d3384fd 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.59", + "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 7774d829ca..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.59", + "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 9c6a68f1e0..f5e95aebe8 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.59", + "version": "0.9.63", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.59", - "@budibase/client": "^0.9.59", + "@budibase/bbui": "^0.9.63", + "@budibase/client": "^0.9.63", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.59", + "@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/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/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/cli/package.json b/packages/cli/package.json index b274ff8ac7..5ad065921e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.59", + "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 88cccb2a4d..1b14a75d69 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.59", + "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.59", - "@budibase/standard-components": "^0.9.59", - "@budibase/string-templates": "^0.9.59", + "@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/__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/package.json b/packages/server/package.json index 0b109c23bf..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.59", + "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.59", - "@budibase/client": "^0.9.59", - "@budibase/string-templates": "^0.9.59", + "@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.59", + "@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/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: { diff --git a/packages/server/src/api/controllers/static/templates/app.hbs b/packages/server/src/api/controllers/static/templates/app.hbs index 60497a05df..1109b76cea 100644 --- a/packages/server/src/api/controllers/static/templates/app.hbs +++ b/packages/server/src/api/controllers/static/templates/app.hbs @@ -1,8 +1,8 @@ -
- {{{head}}} + + {{{head}}}