From 69eb873164a77bb7a229980dc69ecf9774db027c Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 20 Sep 2021 09:20:41 +0000 Subject: [PATCH 01/60] v0.9.133 --- 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 8a2b2ce747..205c85bb70 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.132", + "version": "0.9.133", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index cc8e635db1..0668deeecc 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.132", + "version": "0.9.133", "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 d9333a4919..a55ac66fc0 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.132", + "version": "0.9.133", "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 aab0d5ad17..8802c2e946 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.132", + "version": "0.9.133", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.132", - "@budibase/client": "^0.9.132", + "@budibase/bbui": "^0.9.133", + "@budibase/client": "^0.9.133", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.132", + "@budibase/string-templates": "^0.9.133", "@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 9f90b6f16c..cae7a9ea3b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.132", + "version": "0.9.133", "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 8bf10f71db..ccc32c3a86 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.132", + "version": "0.9.133", "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.132", - "@budibase/standard-components": "^0.9.132", - "@budibase/string-templates": "^0.9.132", + "@budibase/bbui": "^0.9.133", + "@budibase/standard-components": "^0.9.133", + "@budibase/string-templates": "^0.9.133", "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 405d580e1c..a5025cbaeb 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.132", + "version": "0.9.133", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.132", - "@budibase/client": "^0.9.132", - "@budibase/string-templates": "^0.9.132", + "@budibase/auth": "^0.9.133", + "@budibase/client": "^0.9.133", + "@budibase/string-templates": "^0.9.133", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.132", + "@budibase/standard-components": "^0.9.133", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 8f40d9842e..0af332bfaa 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.132", + "version": "0.9.133", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.132", + "@budibase/bbui": "^0.9.133", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index c457d9a06e..c6a32adbbe 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.132", + "version": "0.9.133", "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 f4b0911776..b4824bd171 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.132", + "version": "0.9.133", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.132", - "@budibase/string-templates": "^0.9.132", + "@budibase/auth": "^0.9.133", + "@budibase/string-templates": "^0.9.133", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 12a5428a6e5855a4276c226103a2762d8d06155d Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 20 Sep 2021 11:26:19 +0100 Subject: [PATCH 02/60] Move all session population to budibase (bug fix) --- packages/auth/src/cache/user.js | 11 +++++ packages/auth/src/cloud/accounts.js | 22 ++++++++++ packages/auth/src/cloud/api.js | 44 +++++++++++++++++++ packages/auth/src/environment.js | 2 + packages/server/src/environment.js | 2 +- packages/worker/scripts/dev/manage.js | 2 +- .../src/api/controllers/system/environment.js | 2 +- packages/worker/src/environment.js | 2 +- 8 files changed, 83 insertions(+), 4 deletions(-) create mode 100644 packages/auth/src/cloud/accounts.js create mode 100644 packages/auth/src/cloud/api.js diff --git a/packages/auth/src/cache/user.js b/packages/auth/src/cache/user.js index 2b2693ca01..51bed0210e 100644 --- a/packages/auth/src/cache/user.js +++ b/packages/auth/src/cache/user.js @@ -1,5 +1,7 @@ const redis = require("../redis/authRedis") const { getTenantId, lookupTenantId, getGlobalDB } = require("../tenancy") +const env = require("../environment") +const accounts = require("../cloud/accounts") const EXPIRY_SECONDS = 3600 @@ -9,6 +11,15 @@ const EXPIRY_SECONDS = 3600 const populateFromDB = async (userId, tenantId) => { const user = await getGlobalDB(tenantId).get(userId) user.budibaseAccess = true + + if (!env.SELF_HOSTED) { + const account = await accounts.getAccount(user.email) + if (account) { + user.account = account + user.accountPortalAccess = true + } + } + return user } diff --git a/packages/auth/src/cloud/accounts.js b/packages/auth/src/cloud/accounts.js new file mode 100644 index 0000000000..a102df8920 --- /dev/null +++ b/packages/auth/src/cloud/accounts.js @@ -0,0 +1,22 @@ +const API = require("./api") +const env = require("../environment") + +const api = new API(env.ACCOUNT_PORTAL_URL) + +// TODO: Authorization + +exports.getAccount = async email => { + const payload = { + email, + } + const response = await api.post(`/api/accounts/search`, { + body: payload, + }) + const json = await response.json() + + if (response.status !== 200) { + throw Error(`Error getting account by email ${email}`, json) + } + + return json[0] +} diff --git a/packages/auth/src/cloud/api.js b/packages/auth/src/cloud/api.js new file mode 100644 index 0000000000..ffa785d02a --- /dev/null +++ b/packages/auth/src/cloud/api.js @@ -0,0 +1,44 @@ +const fetch = require("node-fetch") +class API { + constructor(host) { + this.host = host + } + + apiCall = + method => + async (url = "", options = {}) => { + if (!options.headers) { + options.headers = {} + } + + if (!options.headers["Content-Type"]) { + options.headers = { + "Content-Type": "application/json", + Accept: "application/json", + ...options.headers, + } + } + + let json = options.headers["Content-Type"] === "application/json" + + const requestOptions = { + method: method, + body: json ? JSON.stringify(options.body) : options.body, + headers: options.headers, + // TODO: See if this is necessary + credentials: "include", + } + + const resp = await fetch(`${this.host}${url}`, requestOptions) + + return resp + } + + post = this.apiCall("POST") + get = this.apiCall("GET") + patch = this.apiCall("PATCH") + del = this.apiCall("DELETE") + put = this.apiCall("PUT") +} + +module.exports = API diff --git a/packages/auth/src/environment.js b/packages/auth/src/environment.js index 4d1453837c..51f24c2c4a 100644 --- a/packages/auth/src/environment.js +++ b/packages/auth/src/environment.js @@ -19,6 +19,8 @@ module.exports = { MINIO_URL: process.env.MINIO_URL, INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, MULTI_TENANCY: process.env.MULTI_TENANCY, + ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL, + SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED), isTest, _set(key, value) { process.env[key] = value diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 9e029e440a..c5739a37e1 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -26,7 +26,7 @@ module.exports = { COUCH_DB_URL: process.env.COUCH_DB_URL, MINIO_URL: process.env.MINIO_URL, WORKER_URL: process.env.WORKER_URL, - SELF_HOSTED: process.env.SELF_HOSTED, + SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED), AWS_REGION: process.env.AWS_REGION, ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS, MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, diff --git a/packages/worker/scripts/dev/manage.js b/packages/worker/scripts/dev/manage.js index f9a931110e..3df0beb23c 100644 --- a/packages/worker/scripts/dev/manage.js +++ b/packages/worker/scripts/dev/manage.js @@ -21,7 +21,7 @@ async function init() { COUCH_DB_PASSWORD: "budibase", // empty string is false MULTI_TENANCY: "", - ACCOUNT_PORTAL_URL: "http://localhost:3001", + ACCOUNT_PORTAL_URL: "http://localhost:10001", } let envFile = "" Object.keys(envFileJson).forEach(key => { diff --git a/packages/worker/src/api/controllers/system/environment.js b/packages/worker/src/api/controllers/system/environment.js index 305ccd7937..664e950797 100644 --- a/packages/worker/src/api/controllers/system/environment.js +++ b/packages/worker/src/api/controllers/system/environment.js @@ -3,7 +3,7 @@ const env = require("../../../environment") exports.fetch = async ctx => { ctx.body = { multiTenancy: !!env.MULTI_TENANCY, - cloud: !(env.SELF_HOSTED === "1"), + cloud: !env.SELF_HOSTED, accountPortalUrl: env.ACCOUNT_PORTAL_URL, } } diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index 12113c087c..646536f292 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -18,7 +18,7 @@ if (!LOADED && isDev() && !isTest()) { module.exports = { NODE_ENV: process.env.NODE_ENV, - SELF_HOSTED: process.env.SELF_HOSTED, + SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED), PORT: process.env.PORT, CLUSTER_PORT: process.env.CLUSTER_PORT, MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, From 4215f1b919b016f405d968dbd01162e6933cc9fb Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 20 Sep 2021 12:58:58 +0100 Subject: [PATCH 03/60] fix tests --- packages/auth/scripts/jestSetup.js | 1 + packages/server/scripts/jestSetup.js | 1 + packages/worker/scripts/jestSetup.js | 1 + 3 files changed, 3 insertions(+) diff --git a/packages/auth/scripts/jestSetup.js b/packages/auth/scripts/jestSetup.js index 07648f693f..93dbf3fd5a 100644 --- a/packages/auth/scripts/jestSetup.js +++ b/packages/auth/scripts/jestSetup.js @@ -1,5 +1,6 @@ const env = require("../src/environment") +env._set("SELF_HOSTED", "1") env._set("NODE_ENV", "jest") env._set("JWT_SECRET", "test-jwtsecret") env._set("LOG_LEVEL", "silent") diff --git a/packages/server/scripts/jestSetup.js b/packages/server/scripts/jestSetup.js index 0cff339fc2..1f3551bf5f 100644 --- a/packages/server/scripts/jestSetup.js +++ b/packages/server/scripts/jestSetup.js @@ -1,6 +1,7 @@ const { tmpdir } = require("os") const env = require("../src/environment") +env._set("SELF_HOSTED", "1") env._set("NODE_ENV", "jest") env._set("JWT_SECRET", "test-jwtsecret") env._set("CLIENT_ID", "test-client-id") diff --git a/packages/worker/scripts/jestSetup.js b/packages/worker/scripts/jestSetup.js index 374edfb946..89a517279a 100644 --- a/packages/worker/scripts/jestSetup.js +++ b/packages/worker/scripts/jestSetup.js @@ -1,5 +1,6 @@ const env = require("../src/environment") +env._set("SELF_HOSTED", "1") env._set("NODE_ENV", "jest") env._set("JWT_SECRET", "test-jwtsecret") env._set("LOG_LEVEL", "silent") From a99cee39bc0144fb78f15ab72aaf172379c18acd Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 20 Sep 2021 16:23:33 +0100 Subject: [PATCH 04/60] add multiselect / date / boolean types to automations --- .../FlowChart/FlowChart.svelte | 29 ++++++++++++++----- .../SetupPanel/AutomationBlockSetup.svelte | 5 +--- .../automation/SetupPanel/RowSelector.svelte | 22 ++++++++++++-- .../automation/SetupPanel/SchemaSetup.svelte | 17 ++++++----- 4 files changed, 52 insertions(+), 21 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index 92cc6e7cee..81fcd26d35 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -1,9 +1,8 @@ diff --git a/packages/builder/src/pages/builder/portal/settings/organisation.svelte b/packages/builder/src/pages/builder/portal/settings/organisation.svelte index be8b60e6e7..3d149e6e60 100644 --- a/packages/builder/src/pages/builder/portal/settings/organisation.svelte +++ b/packages/builder/src/pages/builder/portal/settings/organisation.svelte @@ -25,7 +25,7 @@ } const values = writable({ - analytics: !analytics.disabled(), + analytics: analytics.enabled, company: $organisation.company, platformUrl: $organisation.platformUrl, logo: $organisation.logoUrl diff --git a/packages/builder/vite.config.js b/packages/builder/vite.config.js index d8b8dbba1d..12b45e7cf8 100644 --- a/packages/builder/vite.config.js +++ b/packages/builder/vite.config.js @@ -22,6 +22,9 @@ export default ({ mode }) => { isProduction ? "production" : "development" ), "process.env.POSTHOG_TOKEN": JSON.stringify(process.env.POSTHOG_TOKEN), + "process.env.INTERCOM_TOKEN": JSON.stringify( + process.env.INTERCOM_TOKEN + ), "process.env.POSTHOG_URL": JSON.stringify(process.env.POSTHOG_URL), "process.env.SENTRY_DSN": JSON.stringify(process.env.SENTRY_DSN), }), From 52f4aad525ecc8c075921544f1e76950bfac3ef2 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 11:49:32 +0100 Subject: [PATCH 12/60] adding AWS region to bucket config --- packages/auth/src/environment.js | 1 + packages/auth/src/objectStore/index.js | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/auth/src/environment.js b/packages/auth/src/environment.js index 4d1453837c..cddd7ab98a 100644 --- a/packages/auth/src/environment.js +++ b/packages/auth/src/environment.js @@ -16,6 +16,7 @@ module.exports = { REDIS_PASSWORD: process.env.REDIS_PASSWORD, MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY, + AWS_REGION: process.env.AWS_REGION, MINIO_URL: process.env.MINIO_URL, INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, MULTI_TENANCY: process.env.MULTI_TENANCY, diff --git a/packages/auth/src/objectStore/index.js b/packages/auth/src/objectStore/index.js index 81bdd06b62..9f271ad80e 100644 --- a/packages/auth/src/objectStore/index.js +++ b/packages/auth/src/objectStore/index.js @@ -73,6 +73,7 @@ exports.ObjectStore = bucket => { AWS.config.update({ accessKeyId: env.MINIO_ACCESS_KEY, secretAccessKey: env.MINIO_SECRET_KEY, + region: env.AWS_REGION, }) const config = { s3ForcePathStyle: true, From d15ff0c6e95ba79fe11d71e4a197405bbd51f7e7 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 21 Sep 2021 12:05:58 +0100 Subject: [PATCH 13/60] use color alias for actions instead of hard-coding the color --- .../automation/AutomationBuilder/FlowChart/ActionModal.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte index 9af78df1b6..b822973b62 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/ActionModal.svelte @@ -123,7 +123,7 @@ padding: var(--spectrum-alias-item-padding-s); background: var(--spectrum-alias-background-color-secondary); transition: 0.3s all; - border: solid #3b3d3c; + border: solid var(--spectrum-alias-border-color); border-radius: 5px; box-sizing: border-box; border-width: 2px; From 02188f7ec0f24bea952faf96c941b01817989637 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 21 Sep 2021 11:15:43 +0000 Subject: [PATCH 14/60] v0.9.134 --- 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 205c85bb70..e2a24a455a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.133", + "version": "0.9.134", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 0668deeecc..ef836b1a5d 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.133", + "version": "0.9.134", "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 a55ac66fc0..c8f30a7a6c 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.133", + "version": "0.9.134", "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 8802c2e946..e757ccd4bb 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.133", + "version": "0.9.134", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.133", - "@budibase/client": "^0.9.133", + "@budibase/bbui": "^0.9.134", + "@budibase/client": "^0.9.134", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.133", + "@budibase/string-templates": "^0.9.134", "@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 cae7a9ea3b..3595f9cc85 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.133", + "version": "0.9.134", "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 ccc32c3a86..feba703919 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.133", + "version": "0.9.134", "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.133", - "@budibase/standard-components": "^0.9.133", - "@budibase/string-templates": "^0.9.133", + "@budibase/bbui": "^0.9.134", + "@budibase/standard-components": "^0.9.134", + "@budibase/string-templates": "^0.9.134", "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 a5025cbaeb..d5e91fd378 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.133", + "version": "0.9.134", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.133", - "@budibase/client": "^0.9.133", - "@budibase/string-templates": "^0.9.133", + "@budibase/auth": "^0.9.134", + "@budibase/client": "^0.9.134", + "@budibase/string-templates": "^0.9.134", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.133", + "@budibase/standard-components": "^0.9.134", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 0af332bfaa..2e0d30784e 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.133", + "version": "0.9.134", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.133", + "@budibase/bbui": "^0.9.134", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index c6a32adbbe..a8aae47fef 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.133", + "version": "0.9.134", "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 b4824bd171..d8aecf08cb 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.133", + "version": "0.9.134", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.133", - "@budibase/string-templates": "^0.9.133", + "@budibase/auth": "^0.9.134", + "@budibase/string-templates": "^0.9.134", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 44002979b05832c9aa3cdf54fcc5abdbbadbec2b Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 21 Sep 2021 12:27:53 +0100 Subject: [PATCH 15/60] Self hosted SSO flow and account deletion --- packages/auth/src/index.js | 2 ++ packages/auth/src/middleware/index.js | 2 ++ packages/auth/src/middleware/passport/google.js | 8 ++++++-- packages/auth/src/security/sessions.js | 4 ++++ 4 files changed, 14 insertions(+), 2 deletions(-) diff --git a/packages/auth/src/index.js b/packages/auth/src/index.js index 569456ea10..4aa2c8ab96 100644 --- a/packages/auth/src/index.js +++ b/packages/auth/src/index.js @@ -12,6 +12,7 @@ const { auditLog, tenancy, appTenancy, + authError, } = require("./middleware") const { setDB } = require("./db") const userCache = require("./cache/user") @@ -60,6 +61,7 @@ module.exports = { buildTenancyMiddleware: tenancy, buildAppTenancyMiddleware: appTenancy, auditLog, + authError, }, cache: { user: userCache, diff --git a/packages/auth/src/middleware/index.js b/packages/auth/src/middleware/index.js index 059f20af8b..cf8676a2bc 100644 --- a/packages/auth/src/middleware/index.js +++ b/packages/auth/src/middleware/index.js @@ -2,6 +2,7 @@ const jwt = require("./passport/jwt") const local = require("./passport/local") const google = require("./passport/google") const oidc = require("./passport/oidc") +const { authError } = require("./passport/utils") const authenticated = require("./authenticated") const auditLog = require("./auditLog") const tenancy = require("./tenancy") @@ -16,4 +17,5 @@ module.exports = { auditLog, tenancy, appTenancy, + authError, } diff --git a/packages/auth/src/middleware/passport/google.js b/packages/auth/src/middleware/passport/google.js index 07d6816c0b..cb93844c31 100644 --- a/packages/auth/src/middleware/passport/google.js +++ b/packages/auth/src/middleware/passport/google.js @@ -27,7 +27,11 @@ async function authenticate(accessToken, refreshToken, profile, done) { * from couchDB rather than environment variables, using this factory is necessary for dynamically configuring passport. * @returns Dynamically configured Passport Google Strategy */ -exports.strategyFactory = async function (config, callbackUrl) { +exports.strategyFactory = async function ( + config, + callbackUrl, + verify = authenticate +) { try { const { clientID, clientSecret } = config @@ -43,7 +47,7 @@ exports.strategyFactory = async function (config, callbackUrl) { clientSecret: config.clientSecret, callbackURL: callbackUrl, }, - authenticate + verify ) } catch (err) { console.error(err) diff --git a/packages/auth/src/security/sessions.js b/packages/auth/src/security/sessions.js index 328f74c794..83ca9d9bcd 100644 --- a/packages/auth/src/security/sessions.js +++ b/packages/auth/src/security/sessions.js @@ -30,6 +30,10 @@ exports.invalidateSessions = async (userId, sessionId = null) => { sessions.push({ key: makeSessionID(userId, sessionId) }) } else { sessions = await getSessionsForUser(userId) + sessions.forEach( + session => + (session.key = makeSessionID(session.userId, session.sessionId)) + ) } const client = await redis.getSessionClient() const promises = [] From 6d7ee7a9239ed0dae96b0899e7b911218edc87a1 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 13:58:30 +0100 Subject: [PATCH 16/60] updating to latest auth lib --- packages/server/yarn.lock | 48 +++++++++++++++++++-------------------- packages/worker/yarn.lock | 16 ++++++------- 2 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 8762aa9415..4014c57718 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -943,10 +943,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/auth@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.128.tgz#6bb6c716b6647b7e9362e3faf12b191650ea0ad4" - integrity sha512-WCcrtAXilT/4++7PdzyTYgrdVqZcKhUev3NcGrFQf7WbDhkVCuigWbb8Q01KXODjbs0BZC0RshVv/PxrgLbBQA== +"@budibase/auth@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.134.tgz#2cc5aed3b5215d4975039e58499f6de07d78a823" + integrity sha512-GkeTGXReap928KDTc1biVQlMMSF7kHHc9ErWFDk0unONJHVV5KJl21t+RbT7wQaHI1XMhdatQvYaFJgkfclTQQ== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -966,10 +966,10 @@ uuid "^8.3.2" zlib "^1.0.5" -"@budibase/bbui@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.128.tgz#71a5e81b02a4f64baa6874bfa4b1d4fed8cc9f0b" - integrity sha512-UCo9SRs1xsMQ0ClJOtNB7JeVF2+0iMVOfAZE7Rrf5d51W+1YeyM9b3BbfhxHRq1yeKLHrbdczerbTHQkmF1RwQ== +"@budibase/bbui@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.134.tgz#e82a364a4b7fdf5f8cd931d61eb3ed6972709fd9" + integrity sha512-zcLMz1GajVHY3YZ+f8tPmiAFcnKWmK93g0YENg4y+0URzBx6zPSccCP3gy+jzF/z7SOEY7XgaNPGs+zPzLGZ5w== dependencies: "@adobe/spectrum-css-workflow-icons" "^1.2.1" "@spectrum-css/actionbutton" "^1.0.1" @@ -1015,14 +1015,14 @@ svelte-flatpickr "^3.1.0" svelte-portal "^1.0.0" -"@budibase/client@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.128.tgz#894f1e9c73cb10b30565e8828244f7ff04a34fce" - integrity sha512-/CiijM5O/6yc5gtSAFBMP7eJE686QNX1FsCphpA89DjWdNEG5e2e0ZN9Z7AOTD90BUn7JXEAdvmqwDMGF5m8gg== +"@budibase/client@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.134.tgz#4667bf623fa07879d32149d1a9d26ccc30cb5ab6" + integrity sha512-xor7IYtzTm53it/kvRBxAmMaEWPspchOdFi7yDSN9/QIZULFp/Z0FLg3RoSaaHrDIvKDUXOg8ylZyoNbxm34+g== dependencies: - "@budibase/bbui" "^0.9.128" - "@budibase/standard-components" "^0.9.128" - "@budibase/string-templates" "^0.9.128" + "@budibase/bbui" "^0.9.134" + "@budibase/standard-components" "^0.9.134" + "@budibase/string-templates" "^0.9.134" regexparam "^1.3.0" shortid "^2.2.15" svelte-spa-router "^3.0.5" @@ -1055,12 +1055,12 @@ to-gfm-code-block "^0.1.1" year "^0.2.1" -"@budibase/standard-components@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.128.tgz#5d6e1dd751c6927dcf1ee515a6102bf73b315526" - integrity sha512-fB6BOwk5uhPxW+U+TrIdD+zXU/l22S2YFcjXhaSpYVM+inzih9e+v2FVy2aW0Y85FdJ+MqT420o9EaolSF0p1w== +"@budibase/standard-components@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.134.tgz#9038d2c45906a54d60efbac72fea475c23380017" + integrity sha512-3F8Mz4TpDZrKRprMoSDPDVB58WqlIHUoO7OQUdUcu9JR+jLOtMYmkQtFD4PfSNOYCy1rwQO7HLY2myjP5ltR1w== dependencies: - "@budibase/bbui" "^0.9.128" + "@budibase/bbui" "^0.9.134" "@spectrum-css/button" "^3.0.3" "@spectrum-css/card" "^3.0.3" "@spectrum-css/divider" "^1.0.3" @@ -1073,10 +1073,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/string-templates@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.128.tgz#50ee46dc0d726d481bd5139cd0b38364649a8463" - integrity sha512-4TzmnX2o5S2cts08ukB86El4wYm7cHuV2t6a7yDMGPe1mWeKP1WEtVF6rKhXEdbPTiotW8oYondOlgOP7DT9lA== +"@budibase/string-templates@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.134.tgz#089db910723d041f9fad27aef0ddb2e811134ee2" + integrity sha512-10syMncBtdXTJwJeatpvsxjCpKBv+0y+dr/3fjvKYkckY1j+ADQfj7jtzlZGdGb7PNZ554vOcjLb/cMkkhechg== dependencies: "@budibase/handlebars-helpers" "^0.11.4" dayjs "^1.10.4" diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 59dec93830..cf98c42f83 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -287,10 +287,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/auth@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.128.tgz#6bb6c716b6647b7e9362e3faf12b191650ea0ad4" - integrity sha512-WCcrtAXilT/4++7PdzyTYgrdVqZcKhUev3NcGrFQf7WbDhkVCuigWbb8Q01KXODjbs0BZC0RshVv/PxrgLbBQA== +"@budibase/auth@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.134.tgz#2cc5aed3b5215d4975039e58499f6de07d78a823" + integrity sha512-GkeTGXReap928KDTc1biVQlMMSF7kHHc9ErWFDk0unONJHVV5KJl21t+RbT7wQaHI1XMhdatQvYaFJgkfclTQQ== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -338,10 +338,10 @@ to-gfm-code-block "^0.1.1" year "^0.2.1" -"@budibase/string-templates@^0.9.128": - version "0.9.128" - resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.128.tgz#50ee46dc0d726d481bd5139cd0b38364649a8463" - integrity sha512-4TzmnX2o5S2cts08ukB86El4wYm7cHuV2t6a7yDMGPe1mWeKP1WEtVF6rKhXEdbPTiotW8oYondOlgOP7DT9lA== +"@budibase/string-templates@^0.9.134": + version "0.9.134" + resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.134.tgz#089db910723d041f9fad27aef0ddb2e811134ee2" + integrity sha512-10syMncBtdXTJwJeatpvsxjCpKBv+0y+dr/3fjvKYkckY1j+ADQfj7jtzlZGdGb7PNZ554vOcjLb/cMkkhechg== dependencies: "@budibase/handlebars-helpers" "^0.11.4" dayjs "^1.10.4" From 30a70a4a030cde23d2b8b6d2b98800e4ca6a2a5b Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 21 Sep 2021 13:08:07 +0000 Subject: [PATCH 17/60] v0.9.135 --- 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 e2a24a455a..1698b2ead7 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.134", + "version": "0.9.135", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index ef836b1a5d..4251a11dd0 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.134", + "version": "0.9.135", "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 c8f30a7a6c..150e55c5ce 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.134", + "version": "0.9.135", "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 e757ccd4bb..311064f304 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.134", + "version": "0.9.135", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.134", - "@budibase/client": "^0.9.134", + "@budibase/bbui": "^0.9.135", + "@budibase/client": "^0.9.135", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.134", + "@budibase/string-templates": "^0.9.135", "@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 3595f9cc85..29faa562c6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.134", + "version": "0.9.135", "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 feba703919..7ca1ffcd7e 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.134", + "version": "0.9.135", "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.134", - "@budibase/standard-components": "^0.9.134", - "@budibase/string-templates": "^0.9.134", + "@budibase/bbui": "^0.9.135", + "@budibase/standard-components": "^0.9.135", + "@budibase/string-templates": "^0.9.135", "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 d5e91fd378..37aa45a737 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.134", + "version": "0.9.135", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.134", - "@budibase/client": "^0.9.134", - "@budibase/string-templates": "^0.9.134", + "@budibase/auth": "^0.9.135", + "@budibase/client": "^0.9.135", + "@budibase/string-templates": "^0.9.135", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.134", + "@budibase/standard-components": "^0.9.135", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 2e0d30784e..240eae2c72 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.134", + "version": "0.9.135", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.134", + "@budibase/bbui": "^0.9.135", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index a8aae47fef..d388431dae 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.134", + "version": "0.9.135", "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 d8aecf08cb..08db892edd 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.134", + "version": "0.9.135", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.134", - "@budibase/string-templates": "^0.9.134", + "@budibase/auth": "^0.9.135", + "@budibase/string-templates": "^0.9.135", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 9aecdedbfc6b4cb5766bb4ea5c1d66bb5ae50b2c Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Tue, 21 Sep 2021 15:16:10 +0200 Subject: [PATCH 18/60] remove the link from navigation bar when removing the screen --- .../src/builderStore/store/frontend.js | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 603fa88b09..84c975edc5 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -215,6 +215,13 @@ export const getFrontendStore = () => { if (screenToDelete._id === state.selectedScreenId) { state.selectedScreenId = null } + //remove the link for this screen + screenDeletePromises.push( + store.actions.components.links.delete( + screenToDelete.routing.route, + screenToDelete.props._instanceName + ) + ) } return state }) @@ -646,6 +653,36 @@ export const getFrontendStore = () => { // Save layout await store.actions.layouts.save(layout) }, + delete: async (url, title) => { + const layout = get(mainLayout) + if (!layout) { + return + } + + // Add link setting to main layout + if (layout.props._component.endsWith("layout")) { + // If using a new SDK, add to the layout component settings + layout.props.links = layout.props.links.filter( + link => !(link.text === title && link.url === url) + ) + } else { + // If using an old SDK, add to the navigation component + // TODO: remove this when we can assume everyone has updated + const nav = findComponentType( + layout.props, + "@budibase/standard-components/navigation" + ) + if (!nav) { + return + } + + nav._children = nav._children.filter( + child => !(child.url === url && child.text === title) + ) + } + // Save layout + await store.actions.layouts.save(layout) + }, }, }, } From 3a50b74db81f6618cc63c8a522c40fb4cea82bae Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 14:36:30 +0100 Subject: [PATCH 19/60] only write to backups bucket in self host --- packages/server/src/utilities/fileSystem/index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/server/src/utilities/fileSystem/index.js b/packages/server/src/utilities/fileSystem/index.js index b83ff03854..42e61e5824 100644 --- a/packages/server/src/utilities/fileSystem/index.js +++ b/packages/server/src/utilities/fileSystem/index.js @@ -130,11 +130,13 @@ exports.performBackup = async (appId, backupName) => { ), }) // write the file to the object store - await streamUpload( - ObjectStoreBuckets.BACKUPS, - join(appId, backupName), - fs.createReadStream(path) - ) + if (env.SELF_HOSTED) { + await streamUpload( + ObjectStoreBuckets.BACKUPS, + join(appId, backupName), + fs.createReadStream(path) + ) + } return fs.createReadStream(path) } From 7e0b4259fe3cfc2634eb721f960b22af8247dac0 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 21 Sep 2021 13:47:15 +0000 Subject: [PATCH 20/60] v0.9.136 --- 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 1698b2ead7..1487a9e5d5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.135", + "version": "0.9.136", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 4251a11dd0..ac23cb8011 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.135", + "version": "0.9.136", "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 150e55c5ce..c3e34c439a 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.135", + "version": "0.9.136", "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 311064f304..c1cca2dd12 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.135", + "version": "0.9.136", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.135", - "@budibase/client": "^0.9.135", + "@budibase/bbui": "^0.9.136", + "@budibase/client": "^0.9.136", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.135", + "@budibase/string-templates": "^0.9.136", "@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 29faa562c6..13ef6d0e1c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.135", + "version": "0.9.136", "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 7ca1ffcd7e..24c0c3b9fc 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.135", + "version": "0.9.136", "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.135", - "@budibase/standard-components": "^0.9.135", - "@budibase/string-templates": "^0.9.135", + "@budibase/bbui": "^0.9.136", + "@budibase/standard-components": "^0.9.136", + "@budibase/string-templates": "^0.9.136", "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 37aa45a737..fb2e522b87 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.135", + "version": "0.9.136", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.135", - "@budibase/client": "^0.9.135", - "@budibase/string-templates": "^0.9.135", + "@budibase/auth": "^0.9.136", + "@budibase/client": "^0.9.136", + "@budibase/string-templates": "^0.9.136", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.135", + "@budibase/standard-components": "^0.9.136", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 240eae2c72..99e02ecb3d 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.135", + "version": "0.9.136", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.135", + "@budibase/bbui": "^0.9.136", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index d388431dae..3c09036e62 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.135", + "version": "0.9.136", "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 08db892edd..df88112aca 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.135", + "version": "0.9.136", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.135", - "@budibase/string-templates": "^0.9.135", + "@budibase/auth": "^0.9.136", + "@budibase/string-templates": "^0.9.136", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 5ab8f1662f046f602cf307c074d29730a3ab21e4 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 15:42:40 +0100 Subject: [PATCH 21/60] CI updates for self host --- .github/workflows/release.yml | 18 ++++++++++++++++++ package.json | 3 ++- 2 files changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8dd1d55f87..bc797b7492 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,12 @@ on: push: branches: - master + workflow_dispatch: + inputs: + release_self_host: + description: 'Release to self hosters? (Y/N)' + required: true + default: 'N' env: POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} @@ -47,6 +53,18 @@ jobs: uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Build/release Docker images + if: ${{ github.event.inputs.release_self_host == 'N' }} + run: | + docker login -u $DOCKER_USER -p $DOCKER_PASSWORD + yarn build + yarn build:docker + env: + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} + BUDIBASE_RELEASE_VERSION: ${{ steps.previoustag.outputs.tag }} + + - name: Build/release Docker images (Self Host) + if: ${{ github.event.inputs.release_self_host == 'Y' }} run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build diff --git a/package.json b/package.json index 05c69e54dc..7e329faafa 100644 --- a/package.json +++ b/package.json @@ -43,7 +43,8 @@ "lint:fix": "yarn run lint:fix:ts && yarn run lint:fix:prettier && yarn run lint:fix:eslint", "test:e2e": "lerna run cy:test", "test:e2e:ci": "lerna run cy:ci", - "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION release && cd -", + "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", + "build:docker:production": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION release && cd -", "build:docker:develop": "node scripts/pinVersions && lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "release:helm": "./scripts/release_helm_chart.sh", "multi:enable": "lerna run multi:enable", From 8f70ad9cdcd24242718134f89430f08e826e1a1e Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 21 Sep 2021 15:59:50 +0100 Subject: [PATCH 22/60] Performance improvements after testing - switching to temporary in memory queries for cloud views. --- packages/server/package.json | 2 +- .../src/api/controllers/row/internal.js | 8 +----- .../server/src/api/controllers/table/utils.js | 28 +++++++++++-------- packages/server/src/db/inMemoryView.js | 27 ++++++++++-------- packages/server/src/db/linkedRows/index.js | 7 +++-- .../src/utilities/rowProcessor/index.js | 21 ++++++++++---- 6 files changed, 55 insertions(+), 38 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 6d6b05752e..321dabe272 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -107,6 +107,7 @@ "pouchdb-all-dbs": "1.0.2", "pouchdb-find": "^7.2.2", "pouchdb-replication-stream": "1.2.9", + "pouchdb-adapter-memory": "^7.2.1", "server-destroy": "1.0.1", "svelte": "^3.38.2", "to-json-schema": "0.2.5", @@ -132,7 +133,6 @@ "express": "^4.17.1", "jest": "^27.0.5", "nodemon": "^2.0.4", - "pouchdb-adapter-memory": "^7.2.1", "prettier": "^2.3.1", "rimraf": "^3.0.2", "supertest": "^4.0.2", diff --git a/packages/server/src/api/controllers/row/internal.js b/packages/server/src/api/controllers/row/internal.js index 77e3069239..b663cc9e32 100644 --- a/packages/server/src/api/controllers/row/internal.js +++ b/packages/server/src/api/controllers/row/internal.js @@ -206,13 +206,7 @@ exports.fetchView = async ctx => { } else { const tableId = viewInfo.meta.tableId const data = await getRawTableData(ctx, db, tableId) - response = await inMemoryViews.runView( - appId, - viewInfo, - calculation, - group, - data - ) + response = await inMemoryViews.runView(viewInfo, calculation, group, data) } let rows diff --git a/packages/server/src/api/controllers/table/utils.js b/packages/server/src/api/controllers/table/utils.js index 154a9ba8f5..d263002da6 100644 --- a/packages/server/src/api/controllers/table/utils.js +++ b/packages/server/src/api/controllers/table/utils.js @@ -68,23 +68,17 @@ exports.handleDataImport = async (appId, user, table, dataImport) => { // Populate the table with rows imported from CSV in a bulk update const data = await csvParser.transform(dataImport) + let finalData = [] for (let i = 0; i < data.length; i++) { let row = data[i] row._id = generateRowID(table._id) row.tableId = table._id - const processed = inputProcessing(user, table, row) + const processed = inputProcessing(user, table, row, { + noAutoRelationships: true, + }) table = processed.table row = processed.row - // make sure link rows are up to date - row = await linkRows.updateLinks({ - appId, - eventType: linkRows.EventType.ROW_SAVE, - row, - tableId: row.tableId, - table, - }) - for (let [fieldName, schema] of Object.entries(table.schema)) { // check whether the options need to be updated for inclusion as part of the data import if ( @@ -98,10 +92,20 @@ exports.handleDataImport = async (appId, user, table, dataImport) => { ] } } - data[i] = row + + // make sure link rows are up to date + finalData.push( + linkRows.updateLinks({ + appId, + eventType: linkRows.EventType.ROW_SAVE, + row, + tableId: row.tableId, + table, + }) + ) } - await db.bulkDocs(data) + await db.bulkDocs(await Promise.all(finalData)) let response = await db.put(table) table._rev = response._rev } diff --git a/packages/server/src/db/inMemoryView.js b/packages/server/src/db/inMemoryView.js index d2dd22161e..892617e068 100644 --- a/packages/server/src/db/inMemoryView.js +++ b/packages/server/src/db/inMemoryView.js @@ -1,5 +1,6 @@ const PouchDB = require("pouchdb") const memory = require("pouchdb-adapter-memory") +const newid = require("./newid") PouchDB.plugin(memory) const Pouch = PouchDB.defaults({ @@ -7,16 +8,11 @@ const Pouch = PouchDB.defaults({ adapter: "memory", }) -exports.runView = async (appId, view, calculation, group, data) => { - // appId doesn't really do anything since its all in memory - // use it just incase multiple databases at the same time - const db = new Pouch(appId) - await db.put({ - _id: "_design/database", - views: { - runner: view, - }, - }) +exports.runView = async (view, calculation, group, data) => { + // use a different ID each time for the DB, make sure they + // are always unique for each query, don't want overlap + // which could cause 409s + const db = new Pouch(newid()) // write all the docs to the in memory Pouch (remove revs) await db.bulkDocs( data.map(row => ({ @@ -24,7 +20,16 @@ exports.runView = async (appId, view, calculation, group, data) => { _rev: undefined, })) ) - const response = await db.query("database/runner", { + let fn = (doc, emit) => emit(doc._id) + eval("fn = " + view.map.replace("function (doc)", "function (doc, emit)")) + const queryFns = { + meta: view.meta, + map: fn, + } + if (view.reduce) { + queryFns.reduce = view.reduce + } + const response = await db.query(queryFns, { include_docs: !calculation, group: !!group, }) diff --git a/packages/server/src/db/linkedRows/index.js b/packages/server/src/db/linkedRows/index.js index 67412e7e89..303cd085c1 100644 --- a/packages/server/src/db/linkedRows/index.js +++ b/packages/server/src/db/linkedRows/index.js @@ -76,9 +76,12 @@ async function getFullLinkedDocs(ctx, appId, links) { // create DBs const db = new CouchDB(appId) const linkedRowIds = links.map(link => link.id) - let linked = (await db.allDocs(getMultiIDParams(linkedRowIds))).rows.map( + const uniqueRowIds = [...new Set(linkedRowIds)] + let dbRows = (await db.allDocs(getMultiIDParams(uniqueRowIds))).rows.map( row => row.doc ) + // convert the unique db rows back to a full list of linked rows + const linked = linkedRowIds.map(id => dbRows.find(row => row._id === id)) // need to handle users as specific cases let [users, other] = partition(linked, linkRow => linkRow._id.startsWith(USER_METDATA_PREFIX) @@ -112,7 +115,7 @@ exports.updateLinks = async function (args) { let linkController = new LinkController(args) try { if ( - !(await linkController.doesTableHaveLinkedFields()) && + !(await linkController.doesTableHaveLinkedFields(table)) && (oldTable == null || !(await linkController.doesTableHaveLinkedFields(oldTable))) ) { diff --git a/packages/server/src/utilities/rowProcessor/index.js b/packages/server/src/utilities/rowProcessor/index.js index 4e1571892d..07549dd8a8 100644 --- a/packages/server/src/utilities/rowProcessor/index.js +++ b/packages/server/src/utilities/rowProcessor/index.js @@ -93,7 +93,12 @@ const TYPE_TRANSFORM_MAP = { * @returns {{row: Object, table: Object}} The updated row and table, the table may need to be updated * for automatic ID purposes. */ -function processAutoColumn(user, table, row, opts = { reprocessing: false }) { +function processAutoColumn( + user, + table, + row, + opts = { reprocessing: false, noAutoRelationships: false } +) { let now = new Date().toISOString() // if a row doesn't have a revision then it doesn't exist yet const creating = !row._rev @@ -103,7 +108,7 @@ function processAutoColumn(user, table, row, opts = { reprocessing: false }) { } switch (schema.subtype) { case AutoFieldSubTypes.CREATED_BY: - if (creating && !opts.reprocessing) { + if (creating && !opts.reprocessing && !opts.noAutoRelationships) { row[key] = [user.userId] } break @@ -113,7 +118,7 @@ function processAutoColumn(user, table, row, opts = { reprocessing: false }) { } break case AutoFieldSubTypes.UPDATED_BY: - if (!opts.reprocessing) { + if (!opts.reprocessing && !opts.noAutoRelationships) { row[key] = [user.userId] } break @@ -155,9 +160,15 @@ exports.coerce = (row, type) => { * @param {object} user the user which is performing the input. * @param {object} row the row which is being created/updated. * @param {object} table the table which the row is being saved to. + * @param {object} opts some input processing options (like disabling auto-column relationships). * @returns {object} the row which has been prepared to be written to the DB. */ -exports.inputProcessing = (user = {}, table, row) => { +exports.inputProcessing = ( + user = {}, + table, + row, + opts = { noAutoRelationships: false } +) => { let clonedRow = cloneDeep(row) // need to copy the table so it can be differenced on way out const copiedTable = cloneDeep(table) @@ -180,7 +191,7 @@ exports.inputProcessing = (user = {}, table, row) => { } } // handle auto columns - this returns an object like {table, row} - return processAutoColumn(user, copiedTable, clonedRow) + return processAutoColumn(user, copiedTable, clonedRow, opts) } /** From 64863fcf5eadaf14ef22698c93a863632c122d0b Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 21 Sep 2021 15:04:25 +0000 Subject: [PATCH 23/60] v0.9.137 --- 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 1487a9e5d5..0ccd0c91dd 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.136", + "version": "0.9.137", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index ac23cb8011..593419b919 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.136", + "version": "0.9.137", "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 c3e34c439a..927885320e 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.136", + "version": "0.9.137", "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 c1cca2dd12..0f28e50cb6 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.136", + "version": "0.9.137", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.136", - "@budibase/client": "^0.9.136", + "@budibase/bbui": "^0.9.137", + "@budibase/client": "^0.9.137", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.136", + "@budibase/string-templates": "^0.9.137", "@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 13ef6d0e1c..aca19b6ed6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.136", + "version": "0.9.137", "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 24c0c3b9fc..82c0d18235 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.136", + "version": "0.9.137", "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.136", - "@budibase/standard-components": "^0.9.136", - "@budibase/string-templates": "^0.9.136", + "@budibase/bbui": "^0.9.137", + "@budibase/standard-components": "^0.9.137", + "@budibase/string-templates": "^0.9.137", "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 fb2e522b87..0934fae367 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.136", + "version": "0.9.137", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.136", - "@budibase/client": "^0.9.136", - "@budibase/string-templates": "^0.9.136", + "@budibase/auth": "^0.9.137", + "@budibase/client": "^0.9.137", + "@budibase/string-templates": "^0.9.137", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.136", + "@budibase/standard-components": "^0.9.137", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 99e02ecb3d..d5ca6c41fb 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.136", + "version": "0.9.137", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.136", + "@budibase/bbui": "^0.9.137", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 3c09036e62..a80cb7e1b8 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.136", + "version": "0.9.137", "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 df88112aca..435efcb345 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.136", + "version": "0.9.137", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.136", - "@budibase/string-templates": "^0.9.136", + "@budibase/auth": "^0.9.137", + "@budibase/string-templates": "^0.9.137", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From efdd78c7fe3971909e266ca7fe81eeec785697a2 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 21 Sep 2021 16:07:04 +0100 Subject: [PATCH 24/60] Removing use of db.post as its dangerous to allow the possibility of _id being auto-generated, these docs would be lost as we couldn't query them out by the usual id mechanism. --- .../src/middleware/passport/tests/third-party-common.spec.js | 2 +- packages/auth/src/middleware/passport/third-party-common.js | 2 +- packages/server/src/api/controllers/datasource.js | 4 ++-- packages/server/src/api/controllers/row/internal.js | 1 - packages/server/src/api/controllers/table/index.js | 2 +- packages/worker/src/api/controllers/global/workspaces.js | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-) diff --git a/packages/auth/src/middleware/passport/tests/third-party-common.spec.js b/packages/auth/src/middleware/passport/tests/third-party-common.spec.js index ff38a01fbb..1ace65ba40 100644 --- a/packages/auth/src/middleware/passport/tests/third-party-common.spec.js +++ b/packages/auth/src/middleware/passport/tests/third-party-common.spec.js @@ -104,7 +104,7 @@ describe("third party common", () => { _id: id, email: email, } - const response = await db.post(dbUser) + const response = await db.put(dbUser) dbUser._rev = response.rev } diff --git a/packages/auth/src/middleware/passport/third-party-common.js b/packages/auth/src/middleware/passport/third-party-common.js index 7c03944232..c25aa3e0b0 100644 --- a/packages/auth/src/middleware/passport/third-party-common.js +++ b/packages/auth/src/middleware/passport/third-party-common.js @@ -71,7 +71,7 @@ exports.authenticateThirdParty = async function ( dbUser = await syncUser(dbUser, thirdPartyUser) // create or sync the user - const response = await db.post(dbUser) + const response = await db.put(dbUser) dbUser._rev = response.rev // authenticate diff --git a/packages/server/src/api/controllers/datasource.js b/packages/server/src/api/controllers/datasource.js index 38b6e68932..4a2fd7d86a 100644 --- a/packages/server/src/api/controllers/datasource.js +++ b/packages/server/src/api/controllers/datasource.js @@ -51,7 +51,7 @@ exports.buildSchemaFromDb = async function (ctx) { await connector.buildSchema(datasource._id, datasource.entities) datasource.entities = connector.tables - const response = await db.post(datasource) + const response = await db.put(datasource) datasource._rev = response.rev ctx.body = datasource @@ -89,7 +89,7 @@ exports.save = async function (ctx) { ...ctx.request.body, } - const response = await db.post(datasource) + const response = await db.put(datasource) datasource._rev = response.rev // Drain connection pools when configuration is changed diff --git a/packages/server/src/api/controllers/row/internal.js b/packages/server/src/api/controllers/row/internal.js index b663cc9e32..f8960129c2 100644 --- a/packages/server/src/api/controllers/row/internal.js +++ b/packages/server/src/api/controllers/row/internal.js @@ -197,7 +197,6 @@ exports.fetchView = async ctx => { throw "View does not exist." } let response - // TODO: make sure not self hosted in Cloud if (env.SELF_HOSTED) { response = await db.query(`database/${viewName}`, { include_docs: !calculation, diff --git a/packages/server/src/api/controllers/table/index.js b/packages/server/src/api/controllers/table/index.js index 60b5167f66..c7b72cf1c8 100644 --- a/packages/server/src/api/controllers/table/index.js +++ b/packages/server/src/api/controllers/table/index.js @@ -145,7 +145,7 @@ exports.save = async function (ctx) { if (updatedRows && updatedRows.length !== 0) { await db.bulkDocs(updatedRows) } - const result = await db.post(tableToSave) + const result = await db.put(tableToSave) tableToSave._rev = result.rev tableToSave = await tableSaveFunctions.after(tableToSave) diff --git a/packages/worker/src/api/controllers/global/workspaces.js b/packages/worker/src/api/controllers/global/workspaces.js index 95a1ec296d..48a710c92d 100644 --- a/packages/worker/src/api/controllers/global/workspaces.js +++ b/packages/worker/src/api/controllers/global/workspaces.js @@ -11,7 +11,7 @@ exports.save = async function (ctx) { } try { - const response = await db.post(workspaceDoc) + const response = await db.put(workspaceDoc) ctx.body = { _id: response.id, _rev: response.rev, From da5b856485a16cd17ecdd09f966da38dab180293 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 15:42:40 +0100 Subject: [PATCH 25/60] updating CI in develop --- .github/workflows/release.yml | 20 +++++++++++++++++++- package.json | 3 ++- 2 files changed, 21 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index aaee3923ef..7bef9e7fe4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,6 +4,12 @@ on: push: branches: - master + workflow_dispatch: + inputs: + release_self_host: + description: 'Release to self hosters? (Y/N)' + required: true + default: 'N' env: POSTHOG_TOKEN: ${{ secrets.POSTHOG_TOKEN }} @@ -47,7 +53,19 @@ jobs: uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Build/release Docker images - run: | + if: ${{ github.event.inputs.release_self_host == 'N' }} + run: | + docker login -u $DOCKER_USER -p $DOCKER_PASSWORD + yarn build + yarn build:docker + env: + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} + BUDIBASE_RELEASE_VERSION: ${{ steps.previoustag.outputs.tag }} + + - name: Build/release Docker images (Self Host) + if: ${{ github.event.inputs.release_self_host == 'Y' }} + run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build yarn build:docker diff --git a/package.json b/package.json index f87c3715aa..3df577ca58 100644 --- a/package.json +++ b/package.json @@ -42,7 +42,8 @@ "lint:fix": "yarn run lint:fix:ts && yarn run lint:fix:prettier && yarn run lint:fix:eslint", "test:e2e": "lerna run cy:test", "test:e2e:ci": "lerna run cy:ci", - "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION release && cd -", + "build:docker": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION && cd -", + "build:docker:production": "lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh $BUDIBASE_RELEASE_VERSION release && cd -", "build:docker:develop": "node scripts/pinVersions && lerna run build:docker && cd hosting/scripts/linux/ && ./release-to-docker-hub.sh develop && cd -", "release:helm": "./scripts/release_helm_chart.sh", "multi:enable": "lerna run multi:enable", From 8ecdc25452af7d5d3ad6ef3388b410cfad511eb7 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 16:39:45 +0100 Subject: [PATCH 26/60] make sure release is pointing to master --- .github/workflows/release.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bef9e7fe4..b85c069664 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,6 +22,8 @@ jobs: steps: - uses: actions/checkout@v2 + with: + ref: master - uses: actions/setup-node@v1 with: node-version: 12.x From eaba4c2698bbd64f2513d7ff1ce27cf49d9e4394 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 21 Sep 2021 15:51:11 +0000 Subject: [PATCH 27/60] v0.9.138 --- 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 0ccd0c91dd..80dc636d95 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.137", + "version": "0.9.138", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 593419b919..855c747ada 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.137", + "version": "0.9.138", "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 927885320e..898320ab07 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.137", + "version": "0.9.138", "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 0f28e50cb6..b653acf546 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.137", + "version": "0.9.138", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.137", - "@budibase/client": "^0.9.137", + "@budibase/bbui": "^0.9.138", + "@budibase/client": "^0.9.138", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.137", + "@budibase/string-templates": "^0.9.138", "@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 aca19b6ed6..0989bf9e15 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.137", + "version": "0.9.138", "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 82c0d18235..000df1749f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.137", + "version": "0.9.138", "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.137", - "@budibase/standard-components": "^0.9.137", - "@budibase/string-templates": "^0.9.137", + "@budibase/bbui": "^0.9.138", + "@budibase/standard-components": "^0.9.138", + "@budibase/string-templates": "^0.9.138", "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 0934fae367..8099b9ca4b 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.137", + "version": "0.9.138", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.137", - "@budibase/client": "^0.9.137", - "@budibase/string-templates": "^0.9.137", + "@budibase/auth": "^0.9.138", + "@budibase/client": "^0.9.138", + "@budibase/string-templates": "^0.9.138", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.137", + "@budibase/standard-components": "^0.9.138", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index d5ca6c41fb..9a5973c77f 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.137", + "version": "0.9.138", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.137", + "@budibase/bbui": "^0.9.138", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index a80cb7e1b8..aa11334ba2 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.137", + "version": "0.9.138", "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 435efcb345..4d077d87dd 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.137", + "version": "0.9.138", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.137", - "@budibase/string-templates": "^0.9.137", + "@budibase/auth": "^0.9.138", + "@budibase/string-templates": "^0.9.138", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From b6e1bbda44b10790afc5062a42726dc6f8bf5cf4 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 17:06:18 +0100 Subject: [PATCH 28/60] Update release.yml --- .github/workflows/release.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b85c069664..7bef9e7fe4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -22,8 +22,6 @@ jobs: steps: - uses: actions/checkout@v2 - with: - ref: master - uses: actions/setup-node@v1 with: node-version: 12.x From 1e8b8eb7a59dcbab66191a2e96297a8346b2924c Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 21 Sep 2021 16:15:41 +0000 Subject: [PATCH 29/60] v0.9.125-alpha.20 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 19b2d150eb..74b3b355d2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.125-alpha.19", + "version": "0.9.125-alpha.20", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index df23c89661..44a8f1250a 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.125-alpha.19", + "version": "0.9.125-alpha.20", "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 41d8633fad..9b0f1272f5 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.125-alpha.19", + "version": "0.9.125-alpha.20", "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 9a06cf4eef..52eaf62dbc 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.125-alpha.19", + "version": "0.9.125-alpha.20", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.125-alpha.19", - "@budibase/client": "^0.9.125-alpha.19", + "@budibase/bbui": "^0.9.125-alpha.20", + "@budibase/client": "^0.9.125-alpha.20", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.125-alpha.19", + "@budibase/string-templates": "^0.9.125-alpha.20", "@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 c656f9976b..923ebedf22 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.125-alpha.19", + "version": "0.9.125-alpha.20", "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 da32c89328..c3665577f7 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.125-alpha.19", + "version": "0.9.125-alpha.20", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,8 +19,8 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.125-alpha.19", - "@budibase/string-templates": "^0.9.125-alpha.19", + "@budibase/bbui": "^0.9.125-alpha.20", + "@budibase/string-templates": "^0.9.125-alpha.20", "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 f15cb95c2e..34f226c2c6 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.125-alpha.19", + "version": "0.9.125-alpha.20", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.125-alpha.19", - "@budibase/client": "^0.9.125-alpha.19", - "@budibase/string-templates": "^0.9.125-alpha.19", + "@budibase/auth": "^0.9.125-alpha.20", + "@budibase/client": "^0.9.125-alpha.20", + "@budibase/string-templates": "^0.9.125-alpha.20", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index c784f4dce6..45a5a423ae 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.125-alpha.19", + "version": "0.9.125-alpha.20", "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 571543b1cf..04eb8d2e2b 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.125-alpha.19", + "version": "0.9.125-alpha.20", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.125-alpha.19", - "@budibase/string-templates": "^0.9.125-alpha.19", + "@budibase/auth": "^0.9.125-alpha.20", + "@budibase/string-templates": "^0.9.125-alpha.20", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From ab0bd21ce1868a90dc4508a740ab3afc4c67be23 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 17:16:38 +0100 Subject: [PATCH 30/60] run release if workflow dispatch not used --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index bc797b7492..aaf8489019 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -53,7 +53,7 @@ jobs: uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Build/release Docker images - if: ${{ github.event.inputs.release_self_host == 'N' }} + if: ${{ github.event.inputs.release_self_host != 'Y' }} run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build From bd91ae1f95e5fafad14c8285612b6b3ba738e37d Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 21 Sep 2021 16:24:33 +0000 Subject: [PATCH 31/60] v0.9.139 --- 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 80dc636d95..93e1890431 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.138", + "version": "0.9.139", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 855c747ada..32dc672a71 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.138", + "version": "0.9.139", "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 898320ab07..408494b199 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.138", + "version": "0.9.139", "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 b653acf546..15ebb5e586 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.138", + "version": "0.9.139", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.138", - "@budibase/client": "^0.9.138", + "@budibase/bbui": "^0.9.139", + "@budibase/client": "^0.9.139", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.138", + "@budibase/string-templates": "^0.9.139", "@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 0989bf9e15..511ca3c09c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.138", + "version": "0.9.139", "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 000df1749f..9c742da09f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.138", + "version": "0.9.139", "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.138", - "@budibase/standard-components": "^0.9.138", - "@budibase/string-templates": "^0.9.138", + "@budibase/bbui": "^0.9.139", + "@budibase/standard-components": "^0.9.139", + "@budibase/string-templates": "^0.9.139", "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 8099b9ca4b..f71e815e2b 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.138", + "version": "0.9.139", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.138", - "@budibase/client": "^0.9.138", - "@budibase/string-templates": "^0.9.138", + "@budibase/auth": "^0.9.139", + "@budibase/client": "^0.9.139", + "@budibase/string-templates": "^0.9.139", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -117,7 +117,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.138", + "@budibase/standard-components": "^0.9.139", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 9a5973c77f..b4af55e3ff 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.138", + "version": "0.9.139", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.138", + "@budibase/bbui": "^0.9.139", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index aa11334ba2..bac0740e0a 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.138", + "version": "0.9.139", "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 4d077d87dd..e14954f970 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.138", + "version": "0.9.139", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -23,8 +23,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.138", - "@budibase/string-templates": "^0.9.138", + "@budibase/auth": "^0.9.139", + "@budibase/string-templates": "^0.9.139", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From d8b2dd035a24055c855083a49c6003f0ad8970b5 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 21 Sep 2021 17:37:26 +0100 Subject: [PATCH 32/60] Adding the ability to migrate from existing in db views to in memory views. --- .../src/api/controllers/row/internal.js | 30 +- .../server/src/api/controllers/view/index.js | 258 ++++++------------ .../server/src/api/controllers/view/utils.js | 109 ++++++++ .../server/src/api/routes/tests/view.spec.js | 2 +- packages/server/src/environment.js | 2 +- 5 files changed, 213 insertions(+), 188 deletions(-) create mode 100644 packages/server/src/api/controllers/view/utils.js diff --git a/packages/server/src/api/controllers/row/internal.js b/packages/server/src/api/controllers/row/internal.js index f8960129c2..d429c14cc7 100644 --- a/packages/server/src/api/controllers/row/internal.js +++ b/packages/server/src/api/controllers/row/internal.js @@ -20,6 +20,7 @@ const { fullSearch, paginatedSearch } = require("./internalSearch") const { getGlobalUsersFromMetadata } = require("../../../utilities/global") const inMemoryViews = require("../../../db/inMemoryView") const env = require("../../../environment") +const { migrateToInMemoryView } = require("../view/utils") const CALCULATION_TYPES = { SUM: "sum", @@ -74,15 +75,33 @@ async function getRawTableData(ctx, db, tableId) { async function getView(db, viewName) { let viewInfo - if (env.SELF_HOSTED) { + async function getFromDesignDoc() { const designDoc = await db.get("_design/database") viewInfo = designDoc.views[viewName] + return viewInfo + } + let migrate = false + if (env.SELF_HOSTED) { + viewInfo = await getFromDesignDoc() } else { - viewInfo = await db.get(generateMemoryViewID(viewName)) - if (viewInfo) { - viewInfo = viewInfo.view + try { + viewInfo = await db.get(generateMemoryViewID(viewName)) + if (viewInfo) { + viewInfo = viewInfo.view + } + } catch (err) { + // check if it can be retrieved from design doc (needs migrated) + if (err.status !== 404) { + viewInfo = null + } else { + viewInfo = await getFromDesignDoc() + migrate = !!viewInfo + } } } + if (migrate) { + await migrateToInMemoryView(db, viewName) + } if (!viewInfo) { throw "View does not exist." } @@ -193,9 +212,6 @@ exports.fetchView = async ctx => { const db = new CouchDB(appId) const { calculation, group, field } = ctx.query const viewInfo = await getView(db, viewName) - if (!viewInfo) { - throw "View does not exist." - } let response if (env.SELF_HOSTED) { response = await db.query(`database/${viewName}`, { diff --git a/packages/server/src/api/controllers/view/index.js b/packages/server/src/api/controllers/view/index.js index 4c2e6ee08b..ecaee0f32f 100644 --- a/packages/server/src/api/controllers/view/index.js +++ b/packages/server/src/api/controllers/view/index.js @@ -2,193 +2,93 @@ const CouchDB = require("../../../db") const viewTemplate = require("./viewBuilder") const { apiFileReturn } = require("../../../utilities/fileSystem") const exporters = require("./exporters") +const { saveView, getView, getViews, deleteView } = require("./utils") const { fetchView } = require("../row") -const { - ViewNames, - generateMemoryViewID, - getMemoryViewParams, -} = require("../../../db/utils") -const env = require("../../../environment") -async function getView(db, viewName) { - if (env.SELF_HOSTED) { - const designDoc = await db.get("_design/database") - return designDoc.views[viewName] - } else { - const viewDoc = await db.get(generateMemoryViewID(viewName)) - return viewDoc.view +exports.fetch = async ctx => { + const db = new CouchDB(ctx.appId) + ctx.body = await getViews(db) +} + +exports.save = async ctx => { + const db = new CouchDB(ctx.appId) + const { originalName, ...viewToSave } = ctx.request.body + const view = viewTemplate(viewToSave) + + if (!viewToSave.name) { + ctx.throw(400, "Cannot create view without a name") + } + + await saveView(db, originalName, viewToSave.name, view) + + // add views to table document + const table = await db.get(ctx.request.body.tableId) + if (!table.views) table.views = {} + if (!view.meta.schema) { + view.meta.schema = table.schema + } + table.views[viewToSave.name] = view.meta + if (originalName) { + delete table.views[originalName] + } + await db.put(table) + + ctx.body = { + ...table.views[viewToSave.name], + name: viewToSave.name, } } -async function getViews(db) { - const response = [] - if (env.SELF_HOSTED) { - const designDoc = await db.get("_design/database") - for (let name of Object.keys(designDoc.views)) { - // Only return custom views, not built ins - if (Object.values(ViewNames).indexOf(name) !== -1) { - continue - } - response.push({ - name, - ...designDoc.views[name], - }) +exports.destroy = async ctx => { + const db = new CouchDB(ctx.appId) + const viewName = decodeURI(ctx.params.viewName) + const view = await deleteView(db, viewName) + const table = await db.get(view.meta.tableId) + delete table.views[viewName] + await db.put(table) + + ctx.body = view +} + +exports.exportView = async ctx => { + const db = new CouchDB(ctx.appId) + const viewName = decodeURI(ctx.query.view) + const view = await getView(db, viewName) + + const format = ctx.query.format + if (!format) { + ctx.throw(400, "Format must be specified, either csv or json") + } + + if (view) { + ctx.params.viewName = viewName + // Fetch view rows + ctx.query = { + group: view.meta.groupBy, + calculation: view.meta.calculation, + stats: !!view.meta.field, + field: view.meta.field, } } else { - const views = ( - await db.allDocs( - getMemoryViewParams({ - include_docs: true, - }) - ) - ).rows.map(row => row.doc) - for (let viewDoc of views) { - response.push({ - name: viewDoc.name, - ...viewDoc.view, - }) - } + // table all_ view + /* istanbul ignore next */ + ctx.params.viewName = viewName } - return response -} -async function saveView(db, originalName, viewToSave, viewTemplate) { - if (env.SELF_HOSTED) { - const designDoc = await db.get("_design/database") - designDoc.views = { - ...designDoc.views, - [viewToSave.name]: viewTemplate, - } - // view has been renamed - if (originalName) { - delete designDoc.views[originalName] - } - await db.put(designDoc) - } else { - const id = generateMemoryViewID(viewToSave.name) - const originalId = originalName ? generateMemoryViewID(originalName) : null - const viewDoc = { - _id: id, - view: viewTemplate, - name: viewToSave.name, - tableId: viewTemplate.meta.tableId, - } - try { - const old = await db.get(id) - if (originalId) { - const originalDoc = await db.get(originalId) - await db.remove(originalDoc._id, originalDoc._rev) - } - if (old && old._rev) { - viewDoc._rev = old._rev - } - } catch (err) { - // didn't exist, just skip - } - await db.put(viewDoc) + await fetchView(ctx) + + let schema = view && view.meta && view.meta.schema + if (!schema) { + const tableId = ctx.params.tableId || view.meta.tableId + const table = await db.get(tableId) + schema = table.schema } + + // Export part + let headers = Object.keys(schema) + const exporter = exporters[format] + const filename = `${viewName}.${format}` + // send down the file + ctx.attachment(filename) + ctx.body = apiFileReturn(exporter(headers, ctx.body)) } - -async function deleteView(db, viewName) { - if (env.SELF_HOSTED) { - const designDoc = await db.get("_design/database") - const view = designDoc.views[viewName] - delete designDoc.views[viewName] - await db.put(designDoc) - return view - } else { - const id = generateMemoryViewID(viewName) - const viewDoc = await db.get(id) - await db.remove(viewDoc._id, viewDoc._rev) - return viewDoc.view - } -} - -const controller = { - fetch: async ctx => { - const db = new CouchDB(ctx.appId) - ctx.body = await getViews(db) - }, - save: async ctx => { - const db = new CouchDB(ctx.appId) - const { originalName, ...viewToSave } = ctx.request.body - const view = viewTemplate(viewToSave) - - if (!viewToSave.name) { - ctx.throw(400, "Cannot create view without a name") - } - - await saveView(db, originalName, viewToSave, view) - - // add views to table document - const table = await db.get(ctx.request.body.tableId) - if (!table.views) table.views = {} - if (!view.meta.schema) { - view.meta.schema = table.schema - } - table.views[viewToSave.name] = view.meta - if (originalName) { - delete table.views[originalName] - } - await db.put(table) - - ctx.body = { - ...table.views[viewToSave.name], - name: viewToSave.name, - } - }, - destroy: async ctx => { - const db = new CouchDB(ctx.appId) - const viewName = decodeURI(ctx.params.viewName) - const view = await deleteView(db, viewName) - const table = await db.get(view.meta.tableId) - delete table.views[viewName] - await db.put(table) - - ctx.body = view - }, - exportView: async ctx => { - const db = new CouchDB(ctx.appId) - const viewName = decodeURI(ctx.query.view) - const view = await getView(db, viewName) - - const format = ctx.query.format - if (!format) { - ctx.throw(400, "Format must be specified, either csv or json") - } - - if (view) { - ctx.params.viewName = viewName - // Fetch view rows - ctx.query = { - group: view.meta.groupBy, - calculation: view.meta.calculation, - stats: !!view.meta.field, - field: view.meta.field, - } - } else { - // table all_ view - /* istanbul ignore next */ - ctx.params.viewName = viewName - } - - await fetchView(ctx) - - let schema = view && view.meta && view.meta.schema - if (!schema) { - const tableId = ctx.params.tableId || view.meta.tableId - const table = await db.get(tableId) - schema = table.schema - } - - // Export part - let headers = Object.keys(schema) - const exporter = exporters[format] - const filename = `${viewName}.${format}` - // send down the file - ctx.attachment(filename) - ctx.body = apiFileReturn(exporter(headers, ctx.body)) - }, -} - -module.exports = controller diff --git a/packages/server/src/api/controllers/view/utils.js b/packages/server/src/api/controllers/view/utils.js new file mode 100644 index 0000000000..c93604177f --- /dev/null +++ b/packages/server/src/api/controllers/view/utils.js @@ -0,0 +1,109 @@ +const { + ViewNames, + generateMemoryViewID, + getMemoryViewParams, +} = require("../../../db/utils") +const env = require("../../../environment") + +exports.getView = async (db, viewName) => { + if (env.SELF_HOSTED) { + const designDoc = await db.get("_design/database") + return designDoc.views[viewName] + } else { + const viewDoc = await db.get(generateMemoryViewID(viewName)) + return viewDoc.view + } +} + +exports.getViews = async db => { + const response = [] + if (env.SELF_HOSTED) { + const designDoc = await db.get("_design/database") + for (let name of Object.keys(designDoc.views)) { + // Only return custom views, not built ins + if (Object.values(ViewNames).indexOf(name) !== -1) { + continue + } + response.push({ + name, + ...designDoc.views[name], + }) + } + } else { + const views = ( + await db.allDocs( + getMemoryViewParams({ + include_docs: true, + }) + ) + ).rows.map(row => row.doc) + for (let viewDoc of views) { + response.push({ + name: viewDoc.name, + ...viewDoc.view, + }) + } + } + return response +} + +exports.saveView = async (db, originalName, viewName, viewTemplate) => { + if (env.SELF_HOSTED) { + const designDoc = await db.get("_design/database") + designDoc.views = { + ...designDoc.views, + [viewName]: viewTemplate, + } + // view has been renamed + if (originalName) { + delete designDoc.views[originalName] + } + await db.put(designDoc) + } else { + const id = generateMemoryViewID(viewName) + const originalId = originalName ? generateMemoryViewID(originalName) : null + const viewDoc = { + _id: id, + view: viewTemplate, + name: viewName, + tableId: viewTemplate.meta.tableId, + } + try { + const old = await db.get(id) + if (originalId) { + const originalDoc = await db.get(originalId) + await db.remove(originalDoc._id, originalDoc._rev) + } + if (old && old._rev) { + viewDoc._rev = old._rev + } + } catch (err) { + // didn't exist, just skip + } + await db.put(viewDoc) + } +} + +exports.deleteView = async (db, viewName) => { + if (env.SELF_HOSTED) { + const designDoc = await db.get("_design/database") + const view = designDoc.views[viewName] + delete designDoc.views[viewName] + await db.put(designDoc) + return view + } else { + const id = generateMemoryViewID(viewName) + const viewDoc = await db.get(id) + await db.remove(viewDoc._id, viewDoc._rev) + return viewDoc.view + } +} + +exports.migrateToInMemoryView = async (db, viewName) => { + // delete the view initially + const designDoc = await db.get("_design/database") + const view = designDoc.views[viewName] + delete designDoc.views[viewName] + await db.put(designDoc) + await exports.saveView(db, null, viewName, view) +} diff --git a/packages/server/src/api/routes/tests/view.spec.js b/packages/server/src/api/routes/tests/view.spec.js index 458da6e023..b1c5f655c6 100644 --- a/packages/server/src/api/routes/tests/view.spec.js +++ b/packages/server/src/api/routes/tests/view.spec.js @@ -205,7 +205,7 @@ describe("/views", () => { }) describe("exportView", () => { - it("should be able to delete a view", async () => { + it("should be able to export a view", async () => { await config.createTable(priceTable()) await config.createRow() const view = await config.createView() diff --git a/packages/server/src/environment.js b/packages/server/src/environment.js index 98ca904b62..89e015b6f5 100644 --- a/packages/server/src/environment.js +++ b/packages/server/src/environment.js @@ -26,7 +26,7 @@ module.exports = { COUCH_DB_URL: process.env.COUCH_DB_URL, MINIO_URL: process.env.MINIO_URL, WORKER_URL: process.env.WORKER_URL, - SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED), + SELF_HOSTED: process.env.SELF_HOSTED, AWS_REGION: process.env.AWS_REGION, ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS, MINIO_ACCESS_KEY: process.env.MINIO_ACCESS_KEY, From ee2732fd51675080985262b88fd063744a8f76ab Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 21 Sep 2021 18:20:26 +0100 Subject: [PATCH 33/60] Cloud SSO flow and auto login on verification --- .../src/api/controllers/global/users.js | 28 +++++++++++++------ .../worker/src/api/routes/global/users.js | 2 +- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 8f754e2922..c8382d4189 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -31,7 +31,12 @@ async function allUsers() { return response.rows.map(row => row.doc) } -async function saveUser(user, tenantId, hashPassword = true) { +async function saveUser( + user, + tenantId, + hashPassword = true, + requirePassword = true +) { if (!tenantId) { throw "No tenancy specified." } @@ -57,7 +62,7 @@ async function saveUser(user, tenantId, hashPassword = true) { hashedPassword = hashPassword ? await hash(password) : password } else if (dbUser) { hashedPassword = dbUser.password - } else { + } else if (requirePassword) { throw "Password must be specified." } @@ -106,16 +111,21 @@ exports.save = async ctx => { } } +const parseBooleanParam = param => { + if (param && param == "false") { + return false + } else { + return true + } +} + exports.adminUser = async ctx => { const { email, password, tenantId } = ctx.request.body // account portal sends a pre-hashed password - honour param to prevent double hashing - let hashPassword = ctx.request.query.hashPassword - if (hashPassword && hashPassword == "false") { - hashPassword = false - } else { - hashPassword = true - } + const hashPassword = parseBooleanParam(ctx.request.query.hashPassword) + // account portal sends no password for SSO users + const requirePassword = parseBooleanParam(ctx.request.query.requirePassword) if (await doesTenantExist(tenantId)) { ctx.throw(403, "Organisation already exists.") @@ -148,7 +158,7 @@ exports.adminUser = async ctx => { tenantId, } try { - ctx.body = await saveUser(user, tenantId, hashPassword) + ctx.body = await saveUser(user, tenantId, hashPassword, requirePassword) } catch (err) { ctx.throw(err.status || 400, err) } diff --git a/packages/worker/src/api/routes/global/users.js b/packages/worker/src/api/routes/global/users.js index 9af249260d..1a04944a30 100644 --- a/packages/worker/src/api/routes/global/users.js +++ b/packages/worker/src/api/routes/global/users.js @@ -10,7 +10,7 @@ function buildAdminInitValidation() { return joiValidator.body( Joi.object({ email: Joi.string().required(), - password: Joi.string().required(), + password: Joi.string(), tenantId: Joi.string().required(), }) .required() From b4f9fd4f12050a028ad9c8264461724c89fbb478 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 20:21:15 +0100 Subject: [PATCH 34/60] changed events to constants, instantiated analytics client at right time --- .github/workflows/release.yml | 14 ++- packages/auth/src/objectStore/index.js | 2 +- packages/builder/src/App.svelte | 6 -- .../builder/src/analytics/IntercomClient.js | 10 +- .../builder/src/analytics/PosthogClient.js | 90 ++---------------- .../builder/src/analytics/SentryClient.js | 14 +-- packages/builder/src/analytics/constants.js | 94 +++++++++---------- packages/builder/src/analytics/index.js | 53 ++++++----- packages/builder/src/builderStore/index.js | 10 -- .../builderStore/store/automation/index.js | 4 +- .../src/builderStore/store/frontend.js | 4 +- .../CreateAutomationModal.svelte | 4 +- .../UpdateAutomationModal.svelte | 4 +- .../DataTable/modals/CalculateModal.svelte | 4 +- .../DataTable/modals/CreateViewModal.svelte | 4 +- .../DataTable/modals/FilterModal.svelte | 4 +- .../modals/CreateDatasourceModal.svelte | 4 +- .../modals/UpdateDatasourceModal.svelte | 4 +- .../modals/CreateTableModal.svelte | 4 +- .../src/components/deploy/DeployModal.svelte | 2 +- .../NavigationPanel/NewScreenModal.svelte | 4 +- .../src/pages/builder/auth/login.svelte | 12 +-- .../pages/builder/portal/apps/index.svelte | 12 +-- .../portal/settings/organisation.svelte | 8 +- packages/builder/src/stores/portal/auth.js | 14 +++ packages/server/package.json | 22 ++--- 26 files changed, 156 insertions(+), 251 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 00e7f9a795..7e0685c2c1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -48,7 +48,19 @@ jobs: uses: "WyriHaximus/github-action-get-previous-tag@v1" - name: Build/release Docker images - run: | + if: ${{ github.event.inputs.release_self_host != 'Y' }} + run: | + docker login -u $DOCKER_USER -p $DOCKER_PASSWORD + yarn build + yarn build:docker + env: + DOCKER_USER: ${{ secrets.DOCKER_USERNAME }} + DOCKER_PASSWORD: ${{ secrets.DOCKER_API_KEY }} + BUDIBASE_RELEASE_VERSION: ${{ steps.previoustag.outputs.tag }} + + - name: Build/release Docker images (Self Host) + if: ${{ github.event.inputs.release_self_host == 'Y' }} + run: | docker login -u $DOCKER_USER -p $DOCKER_PASSWORD yarn build yarn build:docker diff --git a/packages/auth/src/objectStore/index.js b/packages/auth/src/objectStore/index.js index 0f1307c39d..9f271ad80e 100644 --- a/packages/auth/src/objectStore/index.js +++ b/packages/auth/src/objectStore/index.js @@ -73,7 +73,7 @@ exports.ObjectStore = bucket => { AWS.config.update({ accessKeyId: env.MINIO_ACCESS_KEY, secretAccessKey: env.MINIO_SECRET_KEY, - region: env.AWS_REGION + region: env.AWS_REGION, }) const config = { s3ForcePathStyle: true, diff --git a/packages/builder/src/App.svelte b/packages/builder/src/App.svelte index 0624690b27..60051ea043 100644 --- a/packages/builder/src/App.svelte +++ b/packages/builder/src/App.svelte @@ -1,16 +1,10 @@ diff --git a/packages/builder/src/analytics/IntercomClient.js b/packages/builder/src/analytics/IntercomClient.js index 2cabeb97df..10c2f99695 100644 --- a/packages/builder/src/analytics/IntercomClient.js +++ b/packages/builder/src/analytics/IntercomClient.js @@ -48,7 +48,7 @@ export default class IntercomClient { return window.Intercom("boot", { app_id: this.token, - ...user + ...user, }) } @@ -61,6 +61,12 @@ export default class IntercomClient { captureEvent(event, props = {}) { if (!this.initialised) return - window.Intercom("trackEvent", event, props); + window.Intercom("trackEvent", event, props) + } + + logout() { + if (!this.initialised) return + + window.Intercom("shutdown") } } diff --git a/packages/builder/src/analytics/PosthogClient.js b/packages/builder/src/analytics/PosthogClient.js index 9a98520c91..8387c310d3 100644 --- a/packages/builder/src/analytics/PosthogClient.js +++ b/packages/builder/src/analytics/PosthogClient.js @@ -1,13 +1,6 @@ import posthog from "posthog-js" import { Events } from "./constants" -// let analyticsEnabled -// const posthogConfigured = process.env.POSTHOG_TOKEN && process.env.POSTHOG_URL - -// const FEEDBACK_SUBMITTED_KEY = "budibase:feedback_submitted" -// const APP_FIRST_STARTED_KEY = "budibase:first_run" -// const feedbackHours = 12 - export default class PosthogClient { constructor(token, url) { this.token = token @@ -27,18 +20,6 @@ export default class PosthogClient { this.initialised = true } - disabled() { - return posthog.has_opted_out_capturing() - } - - optIn() { - return posthog.opt_in_capturing() - } - - optOut() { - return posthog.opt_out_capturing() - } - identify(id) { if (!this.initialised) return @@ -76,69 +57,10 @@ export default class PosthogClient { posthog.capture(Events.NPS.SUBMITTED, prefixedFeedback) } + + logout() { + if (!this.initialised) return + + posthog.reset() + } } - -// function captureEvent(eventName, props = {}) { -// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return -// props.sourceApp = "builder" -// posthog.capture(eventName, props) -// } - -// if (!localStorage.getItem(APP_FIRST_STARTED_KEY)) { -// localStorage.setItem(APP_FIRST_STARTED_KEY, Date.now()) -// } - -// function submitFeedback(values) { -// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return -// localStorage.setItem(FEEDBACK_SUBMITTED_KEY, Date.now()) - -// const prefixedValues = Object.entries(values).reduce((obj, [key, value]) => { -// obj[`feedback_${key}`] = value -// return obj -// }, {}) - -// posthog.capture("Feedback Submitted", prefixedValues) -// } - -// function requestFeedbackOnDeploy() { -// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return false -// const lastSubmittedStr = localStorage.getItem(FEEDBACK_SUBMITTED_KEY) -// if (!lastSubmittedStr) return true -// return isFeedbackTimeElapsed(lastSubmittedStr) -// } - -// function highlightFeedbackIcon() { -// if (!analyticsEnabled || !process.env.POSTHOG_TOKEN) return false -// const lastSubmittedStr = localStorage.getItem(FEEDBACK_SUBMITTED_KEY) -// if (lastSubmittedStr) return isFeedbackTimeElapsed(lastSubmittedStr) -// const firstRunStr = localStorage.getItem(APP_FIRST_STARTED_KEY) -// if (!firstRunStr) return false -// return isFeedbackTimeElapsed(firstRunStr) -// } - -// Opt In/Out -// const ifAnalyticsEnabled = func => () => { -// if (analyticsEnabled && process.env.POSTHOG_TOKEN) { -// return func() -// } -// } -// const disabled = () => posthog.has_opted_out_capturing() -// const optIn = () => posthog.opt_in_capturing() -// const optOut = () => posthog.opt_out_capturing() - -// export default { -// init, -// identify, -// captureException, -// captureEvent, -// submitFeedback, -// highlightFeedbackIcon, -// disabled: () => { -// if (analyticsEnabled == null) { -// return true -// } -// return ifAnalyticsEnabled(disabled) -// }, -// optIn: ifAnalyticsEnabled(optIn), -// optOut: ifAnalyticsEnabled(optOut), -// } diff --git a/packages/builder/src/analytics/SentryClient.js b/packages/builder/src/analytics/SentryClient.js index 11377d254f..b871ea15d9 100644 --- a/packages/builder/src/analytics/SentryClient.js +++ b/packages/builder/src/analytics/SentryClient.js @@ -20,20 +20,10 @@ export default class SentryClient { } identify(id) { + if (!this.initalised) return + Sentry.configureScope(scope => { scope.setUser({ id }) }) } } - -// export function init() { -// if (process.env.SENTRY_DSN) { -// Sentry.init({ dsn: process.env.SENTRY_DSN }) -// } -// } - -// export function captureException(err) { -// // if (!analyticsEnabled) return -// Sentry.captureException(err) -// // captureEvent("Error", { error: err.message ? err.message : err }) -// } diff --git a/packages/builder/src/analytics/constants.js b/packages/builder/src/analytics/constants.js index 1102ad3ce4..d38b7bba4f 100644 --- a/packages/builder/src/analytics/constants.js +++ b/packages/builder/src/analytics/constants.js @@ -1,49 +1,49 @@ export const Events = { - BUILDER: { - STARTED: "Builder Started" - }, - COMPONENT: { - CREATED: "Added Component" - }, - DATASOURCE: { - CREATED: "Datasource Created", - UPDATED: "Datasource Updated", - }, - TABLE: { - CREATED: "Table Created", - }, - VIEW: { - CREATED: "View Created", - ADDED_FILTER: "Added View Filter", - ADDED_CALCULATE: "Added View Calculate" - }, - SCREEN: { - CREATED: "Screen Created" - }, - AUTOMATION: { - CREATED: "Added Component", - SAVED: "Automation Saved", - BLOCK_ADDED: "Added Automation Block", - }, - NPS: { - SUBMITTED: "budibase:feedback_submitted" - }, - APP: { - CREATED: "budibase:app_created", - PUBLISHED: "budibase:app_published", - UNPUBLISHED: "budibase:app_unpublished" - }, - ANALYTICS: { - OPT_IN: "budibase:analytics_opt_in", - OPT_OUT: "budibase:analytics_opt_out" - }, - USER: { - INVITE: "budibase:portal_user_invite" - }, - SMTP: { - SAVED: "budibase:smtp_saved" - }, - SSO: { - SAVED: "budibase:sso_saved" - } + BUILDER: { + STARTED: "Builder Started", + }, + COMPONENT: { + CREATED: "Added Component", + }, + DATASOURCE: { + CREATED: "Datasource Created", + UPDATED: "Datasource Updated", + }, + TABLE: { + CREATED: "Table Created", + }, + VIEW: { + CREATED: "View Created", + ADDED_FILTER: "Added View Filter", + ADDED_CALCULATE: "Added View Calculate", + }, + SCREEN: { + CREATED: "Screen Created", + }, + AUTOMATION: { + CREATED: "Automation Created", + SAVED: "Automation Saved", + BLOCK_ADDED: "Added Automation Block", + }, + NPS: { + SUBMITTED: "budibase:feedback_submitted", + }, + APP: { + CREATED: "budibase:app_created", + PUBLISHED: "budibase:app_published", + UNPUBLISHED: "budibase:app_unpublished", + }, + ANALYTICS: { + OPT_IN: "budibase:analytics_opt_in", + OPT_OUT: "budibase:analytics_opt_out", + }, + USER: { + INVITE: "budibase:portal_user_invite", + }, + SMTP: { + SAVED: "budibase:smtp_saved", + }, + SSO: { + SAVED: "budibase:sso_saved", + }, } diff --git a/packages/builder/src/analytics/index.js b/packages/builder/src/analytics/index.js index 9fd8f82668..b79ab67e0c 100644 --- a/packages/builder/src/analytics/index.js +++ b/packages/builder/src/analytics/index.js @@ -3,20 +3,15 @@ import PosthogClient from "./PosthogClient" import IntercomClient from "./IntercomClient" import SentryClient from "./SentryClient" import { Events } from "./constants" +import { auth } from "stores/portal" +import { get } from "svelte/store" -// const posthog = new PosthogClient( -// process.env.POSTHOG_TOKEN, -// process.env.POSTHOG_URL -// ) const posthog = new PosthogClient( - "phc_yGOn4i7jWKaCTapdGR6lfA4AvmuEQ2ijn5zAVSFYPlS", - "https://app.posthog.com" + process.env.POSTHOG_TOKEN, + process.env.POSTHOG_URL ) -// const sentry = new SentryClient(process.env.SENTRY_DSN) -const sentry = new SentryClient("https://a34ae347621946bf8acded18e5b7d4b8@o420233.ingest.sentry.io/5338131") -// const intercom = new IntercomClient(process.env.INTERCOM_TOKEN) -const intercom = new IntercomClient("qz2sxfuv") - +const sentry = new SentryClient(process.env.SENTRY_DSN) +const intercom = new IntercomClient(process.env.INTERCOM_TOKEN) class AnalyticsHub { constructor() { @@ -24,24 +19,27 @@ class AnalyticsHub { } async activate() { + // Setting the analytics env var off in the backend overrides org/tenant settings const analyticsStatus = await api.get("/api/analytics") const json = await analyticsStatus.json() - if (json.enabled) { - this.clients.forEach(client => client.init()) + // Multitenancy disabled on the backend + if (!json.enabled) return + + const tenantId = get(auth).tenantId + + if (tenantId) { + const res = await api.get( + `/api/global/configs/public?tenantId=${tenantId}` + ) + const orgJson = await res.json() + + // analytics opted out for the tenant + if (orgJson.config?.analytics === false) return } - this.enabled = json.enabled - } - - optIn() { - this.captureEvent(Events.ANALYTICS.OPT_IN) - this.clients.forEach(client => client.optIn()) - } - - optOut() { - this.captureEvent(Events.ANALYTICS.OPT_OUT) - this.clients.forEach(client => client.optOut()) + this.clients.forEach(client => client.init()) + this.enabled = true } identify(id, metadata) { @@ -68,9 +66,14 @@ class AnalyticsHub { submitFeedback(values) { posthog.npsFeedback(values) } + + async logout() { + posthog.logout() + intercom.logout() + } } const analytics = new AnalyticsHub() export { Events } -export default analytics \ No newline at end of file +export default analytics diff --git a/packages/builder/src/builderStore/index.js b/packages/builder/src/builderStore/index.js index fb888b6fc9..f32dedd47e 100644 --- a/packages/builder/src/builderStore/index.js +++ b/packages/builder/src/builderStore/index.js @@ -3,7 +3,6 @@ import { getAutomationStore } from "./store/automation" import { getHostingStore } from "./store/hosting" import { getThemeStore } from "./store/theme" import { derived, writable } from "svelte/store" -import analytics, { Events } from "analytics" import { FrontendTypes, LAYOUT_NAMES } from "../constants" import { findComponent } from "./storeUtils" @@ -55,13 +54,4 @@ export const mainLayout = derived(store, $store => { export const selectedAccessRole = writable("BASIC") -export const initialise = async () => { - try { - await analytics.activate() - analytics.captureEvent(Events.BUILDER.STARTED) - } catch (err) { - console.log(err) - } -} - export const screenSearchString = writable(null) diff --git a/packages/builder/src/builderStore/store/automation/index.js b/packages/builder/src/builderStore/store/automation/index.js index e60553070b..0a47970d28 100644 --- a/packages/builder/src/builderStore/store/automation/index.js +++ b/packages/builder/src/builderStore/store/automation/index.js @@ -2,7 +2,7 @@ import { writable } from "svelte/store" import api from "../../api" import Automation from "./Automation" import { cloneDeep } from "lodash/fp" -import analytics from "analytics" +import analytics, { Events } from "analytics" const automationActions = store => ({ fetch: async () => { @@ -110,7 +110,7 @@ const automationActions = store => ({ state.selectedBlock = newBlock return state }) - analytics.captureEvent("Added Automation Block", { + analytics.captureEvent(Events.AUTOMATION.BLOCK_ADDED, { name: block.name, }) }, diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index 603fa88b09..b7c42003da 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -19,7 +19,7 @@ import { import { fetchComponentLibDefinitions } from "../loadComponentLibraries" import api from "../api" import { FrontendTypes } from "constants" -import analytics from "analytics" +import analytics, { Events } from "analytics" import { findComponentType, findComponentParent, @@ -443,7 +443,7 @@ export const getFrontendStore = () => { }) // Log event - analytics.captureEvent("Added Component", { + analytics.captureEvent(Events.COMPONENT.CREATED, { name: componentInstance._component, }) diff --git a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte index 6580cd0b87..33a2f79b6f 100644 --- a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte @@ -4,7 +4,7 @@ import { automationStore } from "builderStore" import { notifications } from "@budibase/bbui" import { Input, ModalContent, Layout, Body, Icon } from "@budibase/bbui" - import analytics from "analytics" + import analytics, { Events } from "analytics" let name let selectedTrigger @@ -36,7 +36,7 @@ notifications.success(`Automation ${name} created.`) $goto(`./${$automationStore.selectedAutomation.automation._id}`) - analytics.captureEvent("Automation Created", { name }) + analytics.captureEvent(Events.AUTOMATION.CREATED, { name }) } $: triggers = Object.entries($automationStore.blockDefinitions.TRIGGER) diff --git a/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte index 29966ec372..64197c3a77 100644 --- a/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/UpdateAutomationModal.svelte @@ -2,7 +2,7 @@ import { automationStore } from "builderStore" import { notifications } from "@budibase/bbui" import { Icon, Input, ModalContent, Modal } from "@budibase/bbui" - import analytics from "analytics" + import analytics, { Events } from "analytics" let name let error = "" @@ -26,7 +26,7 @@ } await automationStore.actions.save(updatedAutomation) notifications.success(`Automation ${name} updated successfully.`) - analytics.captureEvent("Automation Saved", { name }) + analytics.captureEvent(Events.AUTOMATION.SAVED, { name }) hide() } diff --git a/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte b/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte index 660a822898..50d44eca88 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CalculateModal.svelte @@ -1,7 +1,7 @@ diff --git a/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte b/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte index 61777c0b7e..2f6ec51233 100644 --- a/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/CreateViewModal.svelte @@ -3,7 +3,7 @@ import { goto } from "@roxi/routify" import { views as viewsStore } from "stores/backend" import { tables } from "stores/backend" - import analytics from "analytics" + import analytics, { Events } from "analytics" let name let field @@ -21,7 +21,7 @@ field, }) notifications.success(`View ${name} created`) - analytics.captureEvent("View Created", { name }) + analytics.captureEvent(Events.VIEW.CREATED, { name }) $goto(`../../view/${name}`) } diff --git a/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte b/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte index 170bb75142..9c6f4956b0 100644 --- a/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/FilterModal.svelte @@ -11,7 +11,7 @@ Icon, } from "@budibase/bbui" import { tables, views } from "stores/backend" - import analytics from "analytics" + import analytics, { Events } from "analytics" const CONDITIONS = [ { @@ -65,7 +65,7 @@ function saveView() { views.save(view) notifications.success(`View ${view.name} saved.`) - analytics.captureEvent("Added View Filter", { + analytics.captureEvent(Events.VIEW.ADDED_FILTER, { filters: JSON.stringify(view.filters), }) } diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/CreateDatasourceModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/CreateDatasourceModal.svelte index 9cdd893230..e7affb30c4 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/CreateDatasourceModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/CreateDatasourceModal.svelte @@ -5,7 +5,7 @@ import { Input, Label, ModalContent, Modal, Context } from "@budibase/bbui" import TableIntegrationMenu from "../TableIntegrationMenu/index.svelte" import CreateTableModal from "components/backend/TableNavigator/modals/CreateTableModal.svelte" - import analytics from "analytics" + import analytics, { Events } from "analytics" import { getContext } from "svelte" const modalContext = getContext(Context.Modal) @@ -45,7 +45,7 @@ plus, }) notifications.success(`Datasource ${name} created successfully.`) - analytics.captureEvent("Datasource Created", { name, type }) + analytics.captureEvent(Events.DATASOURCE.CREATED, { name, type }) // Navigate to new datasource $goto(`./datasource/${response._id}`) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte b/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte index f93af59a38..28625aa86e 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/modals/UpdateDatasourceModal.svelte @@ -2,7 +2,7 @@ import { datasources } from "stores/backend" import { notifications } from "@budibase/bbui" import { Input, ModalContent, Modal } from "@budibase/bbui" - import analytics from "analytics" + import analytics, { Events } from "analytics" let error = "" let modal @@ -35,7 +35,7 @@ } await datasources.save(updatedDatasource) notifications.success(`Datasource ${name} updated successfully.`) - analytics.captureEvent("Datasource Updated", updatedDatasource) + analytics.captureEvent(Events.DATASOURCE.UPDATED, updatedDatasource) hide() } diff --git a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte index b59e5cda5e..dd8876be27 100644 --- a/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte +++ b/packages/builder/src/components/backend/TableNavigator/modals/CreateTableModal.svelte @@ -12,7 +12,7 @@ Layout, } from "@budibase/bbui" import TableDataImport from "../TableDataImport.svelte" - import analytics from "analytics" + import analytics, { Events } from "analytics" import screenTemplates from "builderStore/store/screenTemplates" import { buildAutoColumn, getAutoColumnInformation } from "builderStore/utils" import { NEW_ROW_TEMPLATE } from "builderStore/store/screenTemplates/newRowScreen" @@ -67,7 +67,7 @@ // Create table const table = await tables.save(newTable) notifications.success(`Table ${name} created successfully.`) - analytics.captureEvent("Table Created", { name }) + analytics.captureEvent(Events.TABLE.CREATED, { name }) // Create auto screens if (createAutoscreens) { diff --git a/packages/builder/src/components/deploy/DeployModal.svelte b/packages/builder/src/components/deploy/DeployModal.svelte index 5500aff866..3dcf0c27b1 100644 --- a/packages/builder/src/components/deploy/DeployModal.svelte +++ b/packages/builder/src/components/deploy/DeployModal.svelte @@ -25,7 +25,7 @@ throw new Error(`status ${response.status}`) } else { analytics.captureEvent(Events.APP.PUBLISHED, { - appId: $store.appId + appId: $store.appId, }) notifications.success(`Application published successfully`) } diff --git a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte index ed0c764956..e02f9d87e5 100644 --- a/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte +++ b/packages/builder/src/components/design/NavigationPanel/NewScreenModal.svelte @@ -4,7 +4,7 @@ import { roles } from "stores/backend" import { Input, Select, ModalContent, Toggle } from "@budibase/bbui" import getTemplates from "builderStore/store/screenTemplates" - import analytics from "analytics" + import analytics, { Events } from "analytics" const CONTAINER = "@budibase/standard-components/container" @@ -66,7 +66,7 @@ if (templateIndex !== undefined) { const template = templates[templateIndex] - analytics.captureEvent("Screen Created", { + analytics.captureEvent(Events.SCREEN.CREATED, { template: template.id || template.name, }) } diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte index 568a0550a3..f9f2b34578 100644 --- a/packages/builder/src/pages/builder/auth/login.svelte +++ b/packages/builder/src/pages/builder/auth/login.svelte @@ -15,7 +15,6 @@ import OIDCButton from "./_components/OIDCButton.svelte" import Logo from "assets/bb-emblem.svg" import { onMount } from "svelte" - import analytics from "analytics" let username = "" let password = "" @@ -26,20 +25,11 @@ async function login() { try { - const { user } = await auth.login({ + await auth.login({ username, password, }) - analytics.identify(user._id, user) - analytics.showChat({ - email: user.email, - created_at: Date.now(), - name: user.name, - user_id: user._id, - tenant: user.tenantId - }) - if ($auth?.user?.forceResetPassword) { $goto("./reset") } else { diff --git a/packages/builder/src/pages/builder/portal/apps/index.svelte b/packages/builder/src/pages/builder/portal/apps/index.svelte index 319a00f471..d84b327e90 100644 --- a/packages/builder/src/pages/builder/portal/apps/index.svelte +++ b/packages/builder/src/pages/builder/portal/apps/index.svelte @@ -15,8 +15,7 @@ } from "@budibase/bbui" import CreateAppModal from "components/start/CreateAppModal.svelte" import UpdateAppModal from "components/start/UpdateAppModal.svelte" - import api, { del } from "builderStore/api" - import analytics from "analytics" + import { del } from "builderStore/api" import { onMount } from "svelte" import { apps, auth, admin } from "stores/portal" import download from "downloadjs" @@ -66,14 +65,6 @@ } } - const checkKeys = async () => { - const response = await api.get(`/api/keys/`) - const keys = await response.json() - // if (keys.userId) { - // analytics.identify(keys.userId) - // } - } - const initiateAppCreation = () => { creationModal.show() creatingApp = true @@ -188,7 +179,6 @@ } onMount(async () => { - checkKeys() await apps.load() loaded = true }) diff --git a/packages/builder/src/pages/builder/portal/settings/organisation.svelte b/packages/builder/src/pages/builder/portal/settings/organisation.svelte index 3d149e6e60..79eaebb28b 100644 --- a/packages/builder/src/pages/builder/portal/settings/organisation.svelte +++ b/packages/builder/src/pages/builder/portal/settings/organisation.svelte @@ -48,13 +48,6 @@ async function saveConfig() { loading = true - // Set analytics preference - if ($values.analytics) { - analytics.optIn() - } else { - analytics.optOut() - } - // Upload logo if required if ($values.logo && !$values.logo.url) { await uploadLogo($values.logo) @@ -64,6 +57,7 @@ const config = { company: $values.company ?? "", platformUrl: $values.platformUrl ?? "", + analytics: $values.analytics, } // remove logo if required if (!$values.logo) { diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index fe8f87cfb2..22f7fedca4 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -1,6 +1,7 @@ import { derived, writable, get } from "svelte/store" import api from "../../builderStore/api" import { admin } from "stores/portal" +import analytics from "analytics" export function createAuthStore() { const auth = writable({ @@ -49,6 +50,19 @@ export function createAuthStore() { } return store }) + + if (user) { + analytics.activate().then(() => { + analytics.identify(user._id, user) + // TODO: check if the user is a certain org size + // analytics.showChat({ + // email: user.email, + // name: user.name, + // user_id: user._id, + // tenant: user.tenantId + // }) + }) + } } async function setOrganisation(tenantId) { diff --git a/packages/server/package.json b/packages/server/package.json index 6d6b05752e..fb2e522b87 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.125-alpha.18", + "version": "0.9.136", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -13,7 +13,7 @@ "postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/", "test": "jest --coverage --maxWorkers=2", "test:watch": "jest --watch", - "predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client", + "predocker": "copyfiles -f ../client/dist/budibase-client.js ../standard-components/manifest.json client", "build:docker": "yarn run predocker && docker build . -t app-service", "run:docker": "node dist/index.js", "dev:stack:up": "node scripts/dev/manage.js up", @@ -23,10 +23,9 @@ "format": "prettier --config ../../.prettierrc.json 'src/**/*.ts' --write", "lint": "eslint --fix src/", "lint:fix": "yarn run format && yarn run lint", + "initialise": "node scripts/initialise.js", "multi:enable": "node scripts/multiTenancy.js enable", - "multi:disable": "node scripts/multiTenancy.js disable", - "selfhost:enable": "node scripts/selfhost.js enable", - "selfhost:disable": "node scripts/selfhost.js disable" + "multi:disable": "node scripts/multiTenancy.js disable" }, "jest": { "preset": "ts-jest", @@ -49,8 +48,7 @@ "!src/automations/tests/**/*", "!src/utilities/fileProcessor.js", "!src/utilities/fileSystem/**/*", - "!src/utilities/redis.js", - "!src/api/controllers/row/internalSearch.js" + "!src/utilities/redis.js" ], "coverageReporters": [ "lcov", @@ -64,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.125-alpha.18", - "@budibase/client": "^0.9.125-alpha.18", - "@budibase/string-templates": "^0.9.125-alpha.18", + "@budibase/auth": "^0.9.136", + "@budibase/client": "^0.9.136", + "@budibase/string-templates": "^0.9.136", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -98,7 +96,7 @@ "lodash": "4.17.21", "mongodb": "3.6.3", "mssql": "6.2.3", - "mysql": "^2.18.1", + "mysql": "2.18.1", "node-fetch": "2.6.0", "open": "7.3.0", "pg": "8.5.1", @@ -112,12 +110,14 @@ "to-json-schema": "0.2.5", "uuid": "3.3.2", "validate.js": "0.13.1", + "worker-farm": "1.7.0", "yargs": "13.2.4", "zlib": "1.0.5" }, "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", + "@budibase/standard-components": "^0.9.136", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", From a00598ce38e97eea407ef540730f0891f2ae8703 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 20:28:33 +0100 Subject: [PATCH 35/60] JSdoc --- .../builder/src/analytics/IntercomClient.js | 26 +++++++++++++++++-- .../builder/src/analytics/PosthogClient.js | 26 ++++++++++++++----- .../builder/src/analytics/SentryClient.js | 8 ++++++ 3 files changed, 52 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/analytics/IntercomClient.js b/packages/builder/src/analytics/IntercomClient.js index 10c2f99695..8cc7e35bbf 100644 --- a/packages/builder/src/analytics/IntercomClient.js +++ b/packages/builder/src/analytics/IntercomClient.js @@ -3,6 +3,9 @@ export default class IntercomClient { this.token = token } + /** + * Instantiate intercom using their provided script. + */ init() { if (!this.token) return @@ -43,6 +46,11 @@ export default class IntercomClient { } } + /** + * Show the intercom chat bubble. + * @param {Object} user - user to identify + * @returns Intercom global object + */ show(user = {}) { if (!this.initialised) return @@ -52,21 +60,35 @@ export default class IntercomClient { }) } + /** + * Update intercom user details and messages. + * @returns Intercom global object + */ update() { if (!this.initialised) return return window.Intercom("update") } + /** + * Capture analytics events and send them to intercom. + * @param {String} event - event identifier + * @param {Object} props - properties for the event + * @returns Intercom global object + */ captureEvent(event, props = {}) { if (!this.initialised) return - window.Intercom("trackEvent", event, props) + return window.Intercom("trackEvent", event, props) } + /** + * Disassociate the user from the current session. + * @returns Intercom global object + */ logout() { if (!this.initialised) return - window.Intercom("shutdown") + return window.Intercom("shutdown") } } diff --git a/packages/builder/src/analytics/PosthogClient.js b/packages/builder/src/analytics/PosthogClient.js index 8387c310d3..4c45c10216 100644 --- a/packages/builder/src/analytics/PosthogClient.js +++ b/packages/builder/src/analytics/PosthogClient.js @@ -20,24 +20,31 @@ export default class PosthogClient { this.initialised = true } + /** + * Set the posthog context to the current user + * @param {String} id - unique user id + */ identify(id) { if (!this.initialised) return posthog.identify(id) } + /** + * Update user metadata associated with current user in posthog + * @param {Object} meta - user fields + */ updateUser(meta) { if (!this.initialised) return posthog.people.set(meta) } - captureException(err) { - if (!this.initialised) return - - this.captureEvent("Error", { error: err.message ? err.message : err }) - } - + /** + * Capture analytics events and send them to posthog. + * @param {String} event - event identifier + * @param {Object} props - properties for the event + */ captureEvent(eventName, props) { if (!this.initialised) return @@ -45,6 +52,10 @@ export default class PosthogClient { posthog.capture(eventName, props) } + /** + * Submit NPS feedback to posthog. + * @param {Object} values - NPS Values + */ npsFeedback(values) { if (!this.initialised) return @@ -58,6 +69,9 @@ export default class PosthogClient { posthog.capture(Events.NPS.SUBMITTED, prefixedFeedback) } + /** + * Reset posthog user back to initial state on logout. + */ logout() { if (!this.initialised) return diff --git a/packages/builder/src/analytics/SentryClient.js b/packages/builder/src/analytics/SentryClient.js index b871ea15d9..25e4c37690 100644 --- a/packages/builder/src/analytics/SentryClient.js +++ b/packages/builder/src/analytics/SentryClient.js @@ -13,12 +13,20 @@ export default class SentryClient { } } + /** + * Capture an exception and send it to sentry. + * @param {Error} err - JS error object + */ captureException(err) { if (!this.initalised) return Sentry.captureException(err) } + /** + * Identify user in sentry. + * @param {String} id - Unique user id + */ identify(id) { if (!this.initalised) return From fc4df8867c25e41c4d7b2d8669f3ab40230dd4bb Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 21 Sep 2021 20:30:58 +0100 Subject: [PATCH 36/60] update icon to use hoverable --- .../AutomationBuilder/FlowChart/FlowChart.svelte | 15 ++++++++------- .../AutomationPanel/CreateAutomationModal.svelte | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte index 81fcd26d35..c05a103fac 100644 --- a/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte +++ b/packages/builder/src/components/automation/AutomationBuilder/FlowChart/FlowChart.svelte @@ -62,8 +62,14 @@ style="display:flex; color: var(--spectrum-global-color-gray-400);" > - -
+ +
+ +
{ @@ -154,9 +160,4 @@ display: flex; padding-right: var(--spacing-m); } - - .icon:hover { - cursor: pointer; - color: var(--spectrum-alias-text-color-hover); - } diff --git a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte index 6580cd0b87..7700a4a1c2 100644 --- a/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte +++ b/packages/builder/src/components/automation/AutomationPanel/CreateAutomationModal.svelte @@ -102,7 +102,7 @@ padding: var(--spectrum-alias-item-padding-s); background: var(--spectrum-alias-background-color-secondary); transition: 0.3s all; - border: solid #3b3d3c; + border: solid var(--spectrum-alias-border-color); border-radius: 5px; box-sizing: border-box; border-width: 2px; From 447f1b7d902d2a9c2379dda3997a61d10075b87a Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 20:38:53 +0100 Subject: [PATCH 37/60] remove superfluous deps --- packages/server/package.json | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index fb2e522b87..8c967f8bf7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -110,14 +110,12 @@ "to-json-schema": "0.2.5", "uuid": "3.3.2", "validate.js": "0.13.1", - "worker-farm": "1.7.0", "yargs": "13.2.4", "zlib": "1.0.5" }, "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.136", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", From b7ff1a2464391db56b00486b0f0be7a7a7540ee8 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 20:39:56 +0100 Subject: [PATCH 38/60] turn analytics off for self hosted --- packages/server/src/api/controllers/analytics.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/analytics.js b/packages/server/src/api/controllers/analytics.js index d6e1a9ce5b..eb64bc87b9 100644 --- a/packages/server/src/api/controllers/analytics.js +++ b/packages/server/src/api/controllers/analytics.js @@ -2,6 +2,6 @@ const env = require("../../environment") exports.isEnabled = async function (ctx) { ctx.body = { - enabled: env.ENABLE_ANALYTICS === "true", + enabled: !env.SELF_HOSTED && env.ENABLE_ANALYTICS === "true", } } From 45981c62ef7ec0423d1cd4a06789cc5083c6cda0 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 20:47:04 +0100 Subject: [PATCH 39/60] lint --- packages/builder/src/analytics/PosthogClient.js | 4 ++-- packages/builder/src/analytics/SentryClient.js | 16 ++++++++-------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/builder/src/analytics/PosthogClient.js b/packages/builder/src/analytics/PosthogClient.js index 4c45c10216..0a1fde42ea 100644 --- a/packages/builder/src/analytics/PosthogClient.js +++ b/packages/builder/src/analytics/PosthogClient.js @@ -21,7 +21,7 @@ export default class PosthogClient { } /** - * Set the posthog context to the current user + * Set the posthog context to the current user * @param {String} id - unique user id */ identify(id) { @@ -70,7 +70,7 @@ export default class PosthogClient { } /** - * Reset posthog user back to initial state on logout. + * Reset posthog user back to initial state on logout. */ logout() { if (!this.initialised) return diff --git a/packages/builder/src/analytics/SentryClient.js b/packages/builder/src/analytics/SentryClient.js index 25e4c37690..2a1f8732e3 100644 --- a/packages/builder/src/analytics/SentryClient.js +++ b/packages/builder/src/analytics/SentryClient.js @@ -13,20 +13,20 @@ export default class SentryClient { } } - /** - * Capture an exception and send it to sentry. - * @param {Error} err - JS error object - */ + /** + * Capture an exception and send it to sentry. + * @param {Error} err - JS error object + */ captureException(err) { if (!this.initalised) return Sentry.captureException(err) } - /** - * Identify user in sentry. - * @param {String} id - Unique user id - */ + /** + * Identify user in sentry. + * @param {String} id - Unique user id + */ identify(id) { if (!this.initalised) return From e626e671abd5657b91a9c6e54990c2cad1bb38c6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:43:53 +0000 Subject: [PATCH 40/60] Bump tmpl from 1.0.4 to 1.0.5 in /packages/worker Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] --- packages/worker/yarn.lock | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index cf98c42f83..d41e1a799c 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -287,10 +287,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/auth@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.134.tgz#2cc5aed3b5215d4975039e58499f6de07d78a823" - integrity sha512-GkeTGXReap928KDTc1biVQlMMSF7kHHc9ErWFDk0unONJHVV5KJl21t+RbT7wQaHI1XMhdatQvYaFJgkfclTQQ== +"@budibase/auth@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.139.tgz#0610582800df062372582f9139c7aa99606af3e1" + integrity sha512-2JUAKC3AA74O3TXHjoGCoXkDxXqUS1K8KGFrJtrUQQrVq1YeQGSjD6Km+Ho8PqUaNdpEfZinBS1/3qFUqaQbuQ== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -338,10 +338,10 @@ to-gfm-code-block "^0.1.1" year "^0.2.1" -"@budibase/string-templates@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.134.tgz#089db910723d041f9fad27aef0ddb2e811134ee2" - integrity sha512-10syMncBtdXTJwJeatpvsxjCpKBv+0y+dr/3fjvKYkckY1j+ADQfj7jtzlZGdGb7PNZ554vOcjLb/cMkkhechg== +"@budibase/string-templates@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.139.tgz#f87de1d7382a81164bb734ef62ba552839805134" + integrity sha512-T7FR3GSmc/3vs6bynYrL/POjGP/z4pjlwjI4P6b2u10Fg2HWtI0QPZ+ifnOUf53Ry2r/PvDELATqkElpKh9Spg== dependencies: "@budibase/handlebars-helpers" "^0.11.4" dayjs "^1.10.4" @@ -6184,9 +6184,9 @@ tiny-queue@^0.2.0: integrity sha1-JaZ/LG4lOyypQZd7XvdELvl6YEY= tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-fast-properties@^2.0.0: version "2.0.0" From 87a30fed21d86d4f26e059d0ca2ff7f85e995940 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Tue, 21 Sep 2021 20:43:58 +0000 Subject: [PATCH 41/60] Bump tmpl from 1.0.4 to 1.0.5 in /packages/server Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] --- packages/server/yarn.lock | 54 +++++++++++++++++++-------------------- 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 5706ba1fa6..8062860f7f 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -943,10 +943,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/auth@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.134.tgz#2cc5aed3b5215d4975039e58499f6de07d78a823" - integrity sha512-GkeTGXReap928KDTc1biVQlMMSF7kHHc9ErWFDk0unONJHVV5KJl21t+RbT7wQaHI1XMhdatQvYaFJgkfclTQQ== +"@budibase/auth@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/auth/-/auth-0.9.139.tgz#0610582800df062372582f9139c7aa99606af3e1" + integrity sha512-2JUAKC3AA74O3TXHjoGCoXkDxXqUS1K8KGFrJtrUQQrVq1YeQGSjD6Km+Ho8PqUaNdpEfZinBS1/3qFUqaQbuQ== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -966,10 +966,10 @@ uuid "^8.3.2" zlib "^1.0.5" -"@budibase/bbui@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.134.tgz#e82a364a4b7fdf5f8cd931d61eb3ed6972709fd9" - integrity sha512-zcLMz1GajVHY3YZ+f8tPmiAFcnKWmK93g0YENg4y+0URzBx6zPSccCP3gy+jzF/z7SOEY7XgaNPGs+zPzLGZ5w== +"@budibase/bbui@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/bbui/-/bbui-0.9.139.tgz#e6cfc90e8f6c2aa3526fc6a7bef251bccdaf51bb" + integrity sha512-HllzXwfCnxqlV/ifdOR4Got6yrvK2rUFwKUWQIcYU0wk8h6hwYmLehP7HqgBa6l8+bvO1Ep9g+rjP2xJPJG21w== dependencies: "@adobe/spectrum-css-workflow-icons" "^1.2.1" "@spectrum-css/actionbutton" "^1.0.1" @@ -1015,14 +1015,14 @@ svelte-flatpickr "^3.1.0" svelte-portal "^1.0.0" -"@budibase/client@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.134.tgz#4667bf623fa07879d32149d1a9d26ccc30cb5ab6" - integrity sha512-xor7IYtzTm53it/kvRBxAmMaEWPspchOdFi7yDSN9/QIZULFp/Z0FLg3RoSaaHrDIvKDUXOg8ylZyoNbxm34+g== +"@budibase/client@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.9.139.tgz#acec8dc746295f7793b188f4950ab2268170366c" + integrity sha512-PSSSaWjUrY/C4kG8r46aOVfq0aCEZGuI2Uv4jkqmk1zgt0GTXiJ+iQBkg7WZqTDBm7JIUzYUzV1T102tN4L1Jg== dependencies: - "@budibase/bbui" "^0.9.134" - "@budibase/standard-components" "^0.9.134" - "@budibase/string-templates" "^0.9.134" + "@budibase/bbui" "^0.9.139" + "@budibase/standard-components" "^0.9.139" + "@budibase/string-templates" "^0.9.139" regexparam "^1.3.0" shortid "^2.2.15" svelte-spa-router "^3.0.5" @@ -1055,12 +1055,12 @@ to-gfm-code-block "^0.1.1" year "^0.2.1" -"@budibase/standard-components@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.134.tgz#9038d2c45906a54d60efbac72fea475c23380017" - integrity sha512-3F8Mz4TpDZrKRprMoSDPDVB58WqlIHUoO7OQUdUcu9JR+jLOtMYmkQtFD4PfSNOYCy1rwQO7HLY2myjP5ltR1w== +"@budibase/standard-components@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/standard-components/-/standard-components-0.9.139.tgz#cf8e2b759ae863e469e50272b3ca87f2827e66e3" + integrity sha512-Av0u9Eq2jerjhG6Atta+c0mOQGgE5K0QI3cm+8s/3Vki6/PXkO1YL5Alo3BOn9ayQAVZ/xp4rtZPuN/rzRibHw== dependencies: - "@budibase/bbui" "^0.9.134" + "@budibase/bbui" "^0.9.139" "@spectrum-css/button" "^3.0.3" "@spectrum-css/card" "^3.0.3" "@spectrum-css/divider" "^1.0.3" @@ -1073,10 +1073,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/string-templates@^0.9.134": - version "0.9.134" - resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.134.tgz#089db910723d041f9fad27aef0ddb2e811134ee2" - integrity sha512-10syMncBtdXTJwJeatpvsxjCpKBv+0y+dr/3fjvKYkckY1j+ADQfj7jtzlZGdGb7PNZ554vOcjLb/cMkkhechg== +"@budibase/string-templates@^0.9.139": + version "0.9.139" + resolved "https://registry.yarnpkg.com/@budibase/string-templates/-/string-templates-0.9.139.tgz#f87de1d7382a81164bb734ef62ba552839805134" + integrity sha512-T7FR3GSmc/3vs6bynYrL/POjGP/z4pjlwjI4P6b2u10Fg2HWtI0QPZ+ifnOUf53Ry2r/PvDELATqkElpKh9Spg== dependencies: "@budibase/handlebars-helpers" "^0.11.4" dayjs "^1.10.4" @@ -11110,9 +11110,9 @@ tmp@^0.0.33: os-tmpdir "~1.0.2" tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-buffer@^1.1.1: version "1.1.1" From 6137a97759206331db6706c898efaf3e49f637be Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 21 Sep 2021 21:48:54 +0100 Subject: [PATCH 42/60] remove standard components --- packages/standard-components/package.json | 49 ----------------------- 1 file changed, 49 deletions(-) delete mode 100644 packages/standard-components/package.json diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json deleted file mode 100644 index b4af55e3ff..0000000000 --- a/packages/standard-components/package.json +++ /dev/null @@ -1,49 +0,0 @@ -{ - "name": "@budibase/standard-components", - "module": "dist/standard-components.es.js", - "main": "dist/standard-components.es.js", - "svelte": "src/index.js", - "exports": { - ".": { - "import": "./dist/standard-components.es.js", - "require": "./dist/standard-components.es.js" - }, - "./package.json": "./package.json", - "./manifest.json": "./manifest.json" - }, - "scripts": { - "build": "vite build", - "prepublishOnly": "yarn run build", - "postpublish": "node scripts/deploy.js" - }, - "files": [ - "manifest.json", - "package.json", - "dist" - ], - "devDependencies": { - "@sveltejs/vite-plugin-svelte": "^1.0.0-next.5", - "svelte": "^3.38.2", - "vite": "^2.1.5" - }, - "keywords": [ - "svelte" - ], - "version": "0.9.139", - "license": "MIT", - "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", - "dependencies": { - "@budibase/bbui": "^0.9.139", - "@spectrum-css/button": "^3.0.3", - "@spectrum-css/card": "^3.0.3", - "@spectrum-css/divider": "^1.0.3", - "@spectrum-css/link": "^3.1.3", - "@spectrum-css/page": "^3.0.1", - "@spectrum-css/typography": "^3.0.2", - "@spectrum-css/vars": "^3.0.1", - "apexcharts": "^3.22.1", - "dayjs": "^1.10.5", - "svelte-apexcharts": "^1.0.2", - "svelte-flatpickr": "^3.1.0" - } -} From 2cc90fbb81200a6e0b2047f2a98105fadfe637d6 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 21 Sep 2021 20:57:20 +0000 Subject: [PATCH 43/60] v0.9.140-alpha.0 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 93e1890431..9b2b1cac6d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.139", + "version": "0.9.140-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 32dc672a71..448b408742 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.139", + "version": "0.9.140-alpha.0", "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 408494b199..123d168fee 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.139", + "version": "0.9.140-alpha.0", "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 15ebb5e586..fb4d050392 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.139", + "version": "0.9.140-alpha.0", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.139", - "@budibase/client": "^0.9.139", + "@budibase/bbui": "^0.9.140-alpha.0", + "@budibase/client": "^0.9.140-alpha.0", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.139", + "@budibase/string-templates": "^0.9.140-alpha.0", "@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 511ca3c09c..7bdf1a394f 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.139", + "version": "0.9.140-alpha.0", "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 4c3bf13c42..98b0daf581 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.139", + "version": "0.9.140-alpha.0", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.139", + "@budibase/bbui": "^0.9.140-alpha.0", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.139", + "@budibase/string-templates": "^0.9.140-alpha.0", "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 5b2c4d847e..ad6e55dd6c 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.139", + "version": "0.9.140-alpha.0", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.139", - "@budibase/client": "^0.9.139", - "@budibase/string-templates": "^0.9.139", + "@budibase/auth": "^0.9.140-alpha.0", + "@budibase/client": "^0.9.140-alpha.0", + "@budibase/string-templates": "^0.9.140-alpha.0", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index bac0740e0a..0ec109eca5 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.139", + "version": "0.9.140-alpha.0", "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 4549787399..eecd3d6959 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.139", + "version": "0.9.140-alpha.0", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.139", - "@budibase/string-templates": "^0.9.139", + "@budibase/auth": "^0.9.140-alpha.0", + "@budibase/string-templates": "^0.9.140-alpha.0", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 0751c96264cf8672a64cfad9ef62841a0b34b755 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Wed, 22 Sep 2021 06:04:17 +0000 Subject: [PATCH 44/60] Bump tmpl from 1.0.4 to 1.0.5 in /packages/string-templates Bumps [tmpl](https://github.com/daaku/nodejs-tmpl) from 1.0.4 to 1.0.5. - [Release notes](https://github.com/daaku/nodejs-tmpl/releases) - [Commits](https://github.com/daaku/nodejs-tmpl/commits/v1.0.5) --- updated-dependencies: - dependency-name: tmpl dependency-type: indirect ... Signed-off-by: dependabot[bot] --- packages/string-templates/yarn.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/string-templates/yarn.lock b/packages/string-templates/yarn.lock index 0188a9ec1d..82f99d7b31 100644 --- a/packages/string-templates/yarn.lock +++ b/packages/string-templates/yarn.lock @@ -4633,9 +4633,9 @@ time-stamp@^1.0.1: integrity sha1-dkpaEa9QVhkhsTPztE5hhofg9cM= tmpl@1.0.x: - version "1.0.4" - resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.4.tgz#23640dd7b42d00433911140820e5cf440e521dd1" - integrity sha1-I2QN17QtAEM5ERQIIOXPRA5SHdE= + version "1.0.5" + resolved "https://registry.yarnpkg.com/tmpl/-/tmpl-1.0.5.tgz#8683e0b902bb9c20c4f726e3c0b69f36518c07cc" + integrity sha512-3f0uOEAQwIqGuWW2MVzYg8fV/QNnc/IpuJNG837rLuczAaLVHslWHZQj4IGiEl5Hs3kkbhwL9Ab7Hrsmuj+Smw== to-fast-properties@^2.0.0: version "2.0.0" From 1790d13bb59a0712d6fb46468dd624445b386758 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 22 Sep 2021 09:29:51 +0100 Subject: [PATCH 45/60] added user created at timestamp --- .../builder/portal/manage/users/_components/AddUserModal.svelte | 2 +- packages/worker/src/api/controllers/global/users.js | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte index be5d6db746..25a69af1c8 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/AddUserModal.svelte @@ -26,7 +26,7 @@ notifications.error(res.message) } else { notifications.success(res.message) - analytics.captureEvent(Events.USER.INVITE) + analytics.captureEvent(Events.USER.INVITE, { type: selected }) } } diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 8f754e2922..ac92f3902c 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -63,6 +63,7 @@ async function saveUser(user, tenantId, hashPassword = true) { _id = _id || generateGlobalUserID() user = { + createdAt: Date.now(), ...dbUser, ...user, _id, @@ -138,6 +139,7 @@ exports.adminUser = async ctx => { const user = { email: email, password: password, + createdAt: Date.now(), roles: {}, builder: { global: true, From 9196ae8edb153207ab1e9d60b603a83e3ae37749 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 22 Sep 2021 09:38:32 +0100 Subject: [PATCH 46/60] account for user size in intercom --- packages/builder/src/stores/portal/auth.js | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index 22f7fedca4..cb4e14c4a9 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -54,13 +54,15 @@ export function createAuthStore() { if (user) { analytics.activate().then(() => { analytics.identify(user._id, user) - // TODO: check if the user is a certain org size - // analytics.showChat({ - // email: user.email, - // name: user.name, - // user_id: user._id, - // tenant: user.tenantId - // }) + if (user.size === "100+" || user.size === "10000+") { + analytics.showChat({ + email: user.email, + created_at: user.createdAt || Date.now(), + name: user.name, + user_id: user._id, + tenant: user.tenantId + }) + } }) } } From 792316e501277a278b8a096bb1f6cdaed1bc5b89 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 22 Sep 2021 08:58:01 +0000 Subject: [PATCH 47/60] v0.9.140-alpha.1 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 9b2b1cac6d..c87dac6ac4 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.0", + "version": "0.9.140-alpha.1", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 448b408742..8b27562961 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.0", + "version": "0.9.140-alpha.1", "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 123d168fee..dcda269ff7 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.140-alpha.0", + "version": "0.9.140-alpha.1", "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 fb4d050392..b4ccdeecee 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.0", + "version": "0.9.140-alpha.1", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.0", - "@budibase/client": "^0.9.140-alpha.0", + "@budibase/bbui": "^0.9.140-alpha.1", + "@budibase/client": "^0.9.140-alpha.1", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.0", + "@budibase/string-templates": "^0.9.140-alpha.1", "@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 7bdf1a394f..f3e4d68cb4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.0", + "version": "0.9.140-alpha.1", "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 98b0daf581..1de9dad00f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.0", + "version": "0.9.140-alpha.1", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.0", + "@budibase/bbui": "^0.9.140-alpha.1", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.0", + "@budibase/string-templates": "^0.9.140-alpha.1", "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 ad6e55dd6c..ed1a7a3c60 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.140-alpha.0", + "version": "0.9.140-alpha.1", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.0", - "@budibase/client": "^0.9.140-alpha.0", - "@budibase/string-templates": "^0.9.140-alpha.0", + "@budibase/auth": "^0.9.140-alpha.1", + "@budibase/client": "^0.9.140-alpha.1", + "@budibase/string-templates": "^0.9.140-alpha.1", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 0ec109eca5..2b3008eb02 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.0", + "version": "0.9.140-alpha.1", "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 eecd3d6959..a193e48b67 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.140-alpha.0", + "version": "0.9.140-alpha.1", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.0", - "@budibase/string-templates": "^0.9.140-alpha.0", + "@budibase/auth": "^0.9.140-alpha.1", + "@budibase/string-templates": "^0.9.140-alpha.1", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 53660cfe29eaaa7e89348c367382d04f8f90b2c8 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 22 Sep 2021 10:53:02 +0000 Subject: [PATCH 48/60] v0.9.140-alpha.2 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index c87dac6ac4..05d5356aa8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.1", + "version": "0.9.140-alpha.2", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 8b27562961..898542c0f0 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.1", + "version": "0.9.140-alpha.2", "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 dcda269ff7..17f8d61d65 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.140-alpha.1", + "version": "0.9.140-alpha.2", "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 b4ccdeecee..142ad738cf 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.1", + "version": "0.9.140-alpha.2", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.1", - "@budibase/client": "^0.9.140-alpha.1", + "@budibase/bbui": "^0.9.140-alpha.2", + "@budibase/client": "^0.9.140-alpha.2", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.1", + "@budibase/string-templates": "^0.9.140-alpha.2", "@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 f3e4d68cb4..a683b26218 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.1", + "version": "0.9.140-alpha.2", "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 1de9dad00f..1c41653321 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.1", + "version": "0.9.140-alpha.2", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.1", + "@budibase/bbui": "^0.9.140-alpha.2", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.1", + "@budibase/string-templates": "^0.9.140-alpha.2", "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 ed1a7a3c60..a69cc537f3 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.140-alpha.1", + "version": "0.9.140-alpha.2", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.1", - "@budibase/client": "^0.9.140-alpha.1", - "@budibase/string-templates": "^0.9.140-alpha.1", + "@budibase/auth": "^0.9.140-alpha.2", + "@budibase/client": "^0.9.140-alpha.2", + "@budibase/string-templates": "^0.9.140-alpha.2", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 2b3008eb02..e95b721048 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.1", + "version": "0.9.140-alpha.2", "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 a193e48b67..e081f52a39 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.140-alpha.1", + "version": "0.9.140-alpha.2", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.1", - "@budibase/string-templates": "^0.9.140-alpha.1", + "@budibase/auth": "^0.9.140-alpha.2", + "@budibase/string-templates": "^0.9.140-alpha.2", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 286a250390f4c5160221c53b05694759816076a9 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 22 Sep 2021 11:07:23 +0000 Subject: [PATCH 49/60] v0.9.140-alpha.3 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 05d5356aa8..850cb6aeaa 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.2", + "version": "0.9.140-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 898542c0f0..4ce04ce99f 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.2", + "version": "0.9.140-alpha.3", "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 17f8d61d65..b92d51e5b2 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.140-alpha.2", + "version": "0.9.140-alpha.3", "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 142ad738cf..19c8064e9f 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.2", + "version": "0.9.140-alpha.3", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.2", - "@budibase/client": "^0.9.140-alpha.2", + "@budibase/bbui": "^0.9.140-alpha.3", + "@budibase/client": "^0.9.140-alpha.3", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.2", + "@budibase/string-templates": "^0.9.140-alpha.3", "@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 a683b26218..25229d44c4 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.2", + "version": "0.9.140-alpha.3", "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 1c41653321..9d2557b939 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.2", + "version": "0.9.140-alpha.3", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.2", + "@budibase/bbui": "^0.9.140-alpha.3", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.2", + "@budibase/string-templates": "^0.9.140-alpha.3", "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 a69cc537f3..80ba5bb44a 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.140-alpha.2", + "version": "0.9.140-alpha.3", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -64,9 +64,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.2", - "@budibase/client": "^0.9.140-alpha.2", - "@budibase/string-templates": "^0.9.140-alpha.2", + "@budibase/auth": "^0.9.140-alpha.3", + "@budibase/client": "^0.9.140-alpha.3", + "@budibase/string-templates": "^0.9.140-alpha.3", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index e95b721048..1f85a336c6 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.2", + "version": "0.9.140-alpha.3", "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 e081f52a39..7d76c6419c 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.140-alpha.2", + "version": "0.9.140-alpha.3", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.2", - "@budibase/string-templates": "^0.9.140-alpha.2", + "@budibase/auth": "^0.9.140-alpha.3", + "@budibase/string-templates": "^0.9.140-alpha.3", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 398a82f1a724b9a91a1fb06c3752bcfbc6bc1800 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 22 Sep 2021 12:26:02 +0100 Subject: [PATCH 50/60] lint --- packages/builder/src/stores/portal/auth.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index cb4e14c4a9..e33a1f22ac 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -60,7 +60,7 @@ export function createAuthStore() { created_at: user.createdAt || Date.now(), name: user.name, user_id: user._id, - tenant: user.tenantId + tenant: user.tenantId, }) } }) From 0c9203d539e1f542fab6f2671a2cf612c9e609c1 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 22 Sep 2021 15:03:22 +0000 Subject: [PATCH 51/60] v0.9.140-alpha.4 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 850cb6aeaa..5bb17217e8 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.3", + "version": "0.9.140-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 4ce04ce99f..1cc258bb2f 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.3", + "version": "0.9.140-alpha.4", "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 b92d51e5b2..24581b203f 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.140-alpha.3", + "version": "0.9.140-alpha.4", "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 19c8064e9f..e0f510578d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.3", + "version": "0.9.140-alpha.4", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.3", - "@budibase/client": "^0.9.140-alpha.3", + "@budibase/bbui": "^0.9.140-alpha.4", + "@budibase/client": "^0.9.140-alpha.4", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.3", + "@budibase/string-templates": "^0.9.140-alpha.4", "@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 25229d44c4..7bfca5855d 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.3", + "version": "0.9.140-alpha.4", "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 9d2557b939..62ace6f4aa 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.3", + "version": "0.9.140-alpha.4", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.3", + "@budibase/bbui": "^0.9.140-alpha.4", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.3", + "@budibase/string-templates": "^0.9.140-alpha.4", "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 bacadf10b5..420e7082a1 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.140-alpha.3", + "version": "0.9.140-alpha.4", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.3", - "@budibase/client": "^0.9.140-alpha.3", - "@budibase/string-templates": "^0.9.140-alpha.3", + "@budibase/auth": "^0.9.140-alpha.4", + "@budibase/client": "^0.9.140-alpha.4", + "@budibase/string-templates": "^0.9.140-alpha.4", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 1f85a336c6..8dee560de9 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.3", + "version": "0.9.140-alpha.4", "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 7d76c6419c..8baa4a321e 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.140-alpha.3", + "version": "0.9.140-alpha.4", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.3", - "@budibase/string-templates": "^0.9.140-alpha.3", + "@budibase/auth": "^0.9.140-alpha.4", + "@budibase/string-templates": "^0.9.140-alpha.4", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From fe3902a33c4f422385a7d9837e0a5854202fd5f6 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Wed, 22 Sep 2021 17:27:07 +0200 Subject: [PATCH 52/60] Check if the formula validates against its constraints --- packages/server/src/api/controllers/row/utils.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/server/src/api/controllers/row/utils.js b/packages/server/src/api/controllers/row/utils.js index cb9a5e166c..ca6c782713 100644 --- a/packages/server/src/api/controllers/row/utils.js +++ b/packages/server/src/api/controllers/row/utils.js @@ -5,6 +5,7 @@ const { InternalTables } = require("../../../db/utils") const userController = require("../user") const { FieldTypes } = require("../../../constants") const { integrations } = require("../../../integrations") +const { processStringSync } = require("@budibase/string-templates") validateJs.extend(validateJs.validators.datetime, { parse: function (value) { @@ -73,6 +74,11 @@ exports.validate = async ({ appId, tableId, row, table }) => { errors[fieldName] = "Field not in list" } }) + } else if (table.schema[fieldName].type === FieldTypes.FORMULA) { + res = validateJs.single( + processStringSync(table.schema[fieldName].formula, row), + constraints + ) } else { res = validateJs.single(row[fieldName], constraints) } From f70cee3c52ee581a6cf090b031f378ff01babb47 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 22 Sep 2021 17:46:54 +0100 Subject: [PATCH 53/60] Fixing issue #2673 - discovered issues with some column types not being worked out to be auto-columns in postgres. --- .../service-vehicles/docker-compose.yml | 28 ++++++++++ .../integrations/service-vehicles/init.sql | 52 +++++++++++++++++++ .../integrations/service-vehicles/reset.sh | 3 ++ .../api/controllers/row/ExternalRequest.ts | 6 ++- packages/server/src/integrations/mysql.ts | 15 +----- packages/server/src/integrations/postgres.ts | 25 ++++----- packages/server/src/integrations/utils.ts | 18 +++++++ 7 files changed, 117 insertions(+), 30 deletions(-) create mode 100644 packages/server/scripts/integrations/service-vehicles/docker-compose.yml create mode 100644 packages/server/scripts/integrations/service-vehicles/init.sql create mode 100755 packages/server/scripts/integrations/service-vehicles/reset.sh diff --git a/packages/server/scripts/integrations/service-vehicles/docker-compose.yml b/packages/server/scripts/integrations/service-vehicles/docker-compose.yml new file mode 100644 index 0000000000..7473e540db --- /dev/null +++ b/packages/server/scripts/integrations/service-vehicles/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.8" +services: + db: + container_name: postgres-vehicle + image: postgres + restart: always + environment: + POSTGRES_USER: root + POSTGRES_PASSWORD: root + POSTGRES_DB: main + ports: + - "5432:5432" + volumes: + #- pg_data:/var/lib/postgresql/data/ + - ./init.sql:/docker-entrypoint-initdb.d/init.sql + + pgadmin: + container_name: pgadmin + image: dpage/pgadmin4 + restart: always + environment: + PGADMIN_DEFAULT_EMAIL: root@root.com + PGADMIN_DEFAULT_PASSWORD: root + ports: + - "5050:80" + +#volumes: +# pg_data: diff --git a/packages/server/scripts/integrations/service-vehicles/init.sql b/packages/server/scripts/integrations/service-vehicles/init.sql new file mode 100644 index 0000000000..3e0485313e --- /dev/null +++ b/packages/server/scripts/integrations/service-vehicles/init.sql @@ -0,0 +1,52 @@ +SELECT 'CREATE DATABASE main' +WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec +CREATE TABLE Vehicles ( + id bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ), + Registration text COLLATE pg_catalog."default", + Make text COLLATE pg_catalog."default", + Model text COLLATE pg_catalog."default", + Colour text COLLATE pg_catalog."default", + Year smallint, + CONSTRAINT Vehicles_pkey PRIMARY KEY (id) +); + +CREATE TABLE ServiceLog ( + id bigint NOT NULL GENERATED ALWAYS AS IDENTITY ( INCREMENT 1 START 1 MINVALUE 1 MAXVALUE 9223372036854775807 CACHE 1 ), + Description text COLLATE pg_catalog."default", + VehicleId bigint, + ServiceDate timestamp without time zone, + Category text COLLATE pg_catalog."default", + Mileage bigint, + CONSTRAINT ServiceLog_pkey PRIMARY KEY (id), + CONSTRAINT vehicle_foreign_key FOREIGN KEY (VehicleId) + REFERENCES Vehicles (id) MATCH SIMPLE + ON UPDATE NO ACTION + ON DELETE NO ACTION +); + +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('FAZ 9837','Volkswagen','Polo','White',2002); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('JHI 8827','BMW','M3','Black',2013); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('D903PI','Volvo','XC40','Grey',2014); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('YFI002','Volkswagen','Golf','Dark Blue',2018); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('HGT5677','Skoda','Octavia','Graphite',2009); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('PPF9276','Skoda','Octavia','Graphite',2021); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('J893FT','Toyota','Corolla','Red',2015); +INSERT INTO Vehicles (Registration, Make, Model, Colour, Year) +VALUES ('MJK776','Honda','HR-V','Silver',2015); + + +INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) +VALUES ('Change front brakes', 1, '2021-05-04', 'Brakes', 20667); +INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) +VALUES ('Tyres - full set', 1, '2021-05-04', 'Brakes', 20667); +INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) +VALUES ('Engine tune up', 2, '2021-07-14', 'Brakes', 50889); +INSERT INTO ServiceLog (Description, VehicleId, ServiceDate, Category, Mileage) +VALUES ('Replace transmission', 3, '2021-09-26', 'Transmission', 98002); diff --git a/packages/server/scripts/integrations/service-vehicles/reset.sh b/packages/server/scripts/integrations/service-vehicles/reset.sh new file mode 100755 index 0000000000..32778bd11f --- /dev/null +++ b/packages/server/scripts/integrations/service-vehicles/reset.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker-compose down +docker volume prune -f diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index eced518604..b809e597e4 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -437,7 +437,11 @@ module External { for (let [colName, { isMany, rows, tableId }] of Object.entries( related )) { - const table = this.getTable(tableId) + const table: Table = this.getTable(tableId) + // if its not the foreign key skip it, nothing to do + if (table.primary && table.primary.indexOf(colName) !== -1) { + continue + } for (let row of rows) { const filters = buildFilters(generateIdForRow(row, table), {}, table) // safety check, if there are no filters on deletion bad things happen diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index 3ce21675d9..c5db35ed2a 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -12,7 +12,7 @@ import { getSqlQuery } from "./utils" module MySQLModule { const mysql = require("mysql") const Sql = require("./base/sql") - const { buildExternalTableId, convertType } = require("./utils") + const { buildExternalTableId, convertType, copyExistingPropsOver } = require("./utils") const { FieldTypes } = require("../constants") interface MySQLConfig { @@ -194,18 +194,7 @@ module MySQLModule { } } - // add the existing relationships from the entities if they exist, to prevent them from being overridden - if (entities && entities[tableName]) { - const existingTableSchema = entities[tableName].schema - for (let key in existingTableSchema) { - if (!existingTableSchema.hasOwnProperty(key)) { - continue - } - if (existingTableSchema[key].type === "link") { - tables[tableName].schema[key] = existingTableSchema[key] - } - } - } + copyExistingPropsOver(tableName, tables, entities) } this.client.end() diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index dd46652871..63719980fb 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -12,7 +12,7 @@ module PostgresModule { const { Pool } = require("pg") const Sql = require("./base/sql") const { FieldTypes } = require("../constants") - const { buildExternalTableId, convertType } = require("./utils") + const { buildExternalTableId, convertType, copyExistingPropsOver } = require("./utils") interface PostgresConfig { host: string @@ -173,31 +173,24 @@ module PostgresModule { name: tableName, schema: {}, } - - // add the existing relationships from the entities if they exist, to prevent them from being overridden - if (entities && entities[tableName]) { - const existingTableSchema = entities[tableName].schema - for (let key in existingTableSchema) { - if (!existingTableSchema.hasOwnProperty(key)) { - continue - } - if (existingTableSchema[key].type === "link") { - tables[tableName].schema[key] = existingTableSchema[key] - } - } - } } const type: string = convertType(column.data_type, TYPE_MAP) - const isAuto: boolean = - typeof column.column_default === "string" && + const identity = !!(column.identity_generation || column.identity_start || column.identity_increment) + const hasDefault = typeof column.column_default === "string" && column.column_default.startsWith("nextval") + const isGenerated = column.is_generated && column.is_generated !== "NEVER" + const isAuto: boolean = hasDefault || identity || isGenerated tables[tableName].schema[columnName] = { autocolumn: isAuto, name: columnName, type, } } + + for (let tableName of Object.keys(tables)) { + copyExistingPropsOver(tableName, tables, entities) + } this.tables = tables } diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 5b247213c0..82c35bc2d9 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -82,3 +82,21 @@ export function isIsoDateString(str: string) { let d = new Date(str) return d.toISOString() === str } + +// add the existing relationships from the entities if they exist, to prevent them from being overridden +export function copyExistingPropsOver(tableName: string, tables: { [key: string]: any }, entities: { [key: string]: any }) { + if (entities && entities[tableName]) { + if (entities[tableName].primaryDisplay) { + tables[tableName].primaryDisplay = entities[tableName].primaryDisplay + } + const existingTableSchema = entities[tableName].schema + for (let key in existingTableSchema) { + if (!existingTableSchema.hasOwnProperty(key)) { + continue + } + if (existingTableSchema[key].type === "link") { + tables[tableName].schema[key] = existingTableSchema[key] + } + } + } +} From 15cd5e45144b43db3af75d58bbe695dc497b7cbd Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 22 Sep 2021 17:31:55 +0000 Subject: [PATCH 54/60] v0.9.140-alpha.5 --- 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 | 6 +++--- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 20 insertions(+), 20 deletions(-) diff --git a/lerna.json b/lerna.json index 5bb17217e8..e2e4d027b5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.4", + "version": "0.9.140-alpha.5", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 1cc258bb2f..8c1f38d64c 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.4", + "version": "0.9.140-alpha.5", "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 24581b203f..9ddedfd28f 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.140-alpha.4", + "version": "0.9.140-alpha.5", "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 e0f510578d..01dfc08f2c 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.4", + "version": "0.9.140-alpha.5", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.4", - "@budibase/client": "^0.9.140-alpha.4", + "@budibase/bbui": "^0.9.140-alpha.5", + "@budibase/client": "^0.9.140-alpha.5", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.4", + "@budibase/string-templates": "^0.9.140-alpha.5", "@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 7bfca5855d..147a0ffe2b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.4", + "version": "0.9.140-alpha.5", "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 62ace6f4aa..c739c5b80d 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.4", + "version": "0.9.140-alpha.5", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.4", + "@budibase/bbui": "^0.9.140-alpha.5", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.4", + "@budibase/string-templates": "^0.9.140-alpha.5", "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 671c062fcd..4d32021ff4 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.140-alpha.4", + "version": "0.9.140-alpha.5", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.4", - "@budibase/client": "^0.9.140-alpha.4", - "@budibase/string-templates": "^0.9.140-alpha.4", + "@budibase/auth": "^0.9.140-alpha.5", + "@budibase/client": "^0.9.140-alpha.5", + "@budibase/string-templates": "^0.9.140-alpha.5", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -102,10 +102,10 @@ "pg": "8.5.1", "pino-pretty": "4.0.0", "pouchdb": "7.2.1", + "pouchdb-adapter-memory": "^7.2.1", "pouchdb-all-dbs": "1.0.2", "pouchdb-find": "^7.2.2", "pouchdb-replication-stream": "1.2.9", - "pouchdb-adapter-memory": "^7.2.1", "server-destroy": "1.0.1", "svelte": "^3.38.2", "to-json-schema": "0.2.5", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 8dee560de9..f78a7cdf72 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.4", + "version": "0.9.140-alpha.5", "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 8baa4a321e..689e7d8569 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.140-alpha.4", + "version": "0.9.140-alpha.5", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.4", - "@budibase/string-templates": "^0.9.140-alpha.4", + "@budibase/auth": "^0.9.140-alpha.5", + "@budibase/string-templates": "^0.9.140-alpha.5", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 9eb5b46bc89790732f689013002fb415f24725d7 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 23 Sep 2021 08:48:11 +0200 Subject: [PATCH 55/60] Collapse queries with their datasource --- .../DatasourceNavigator.svelte | 25 +++++++++---------- 1 file changed, 12 insertions(+), 13 deletions(-) diff --git a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte index 84c737eb67..19713595ce 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/DatasourceNavigator.svelte @@ -63,20 +63,19 @@ {#if openDataSources.includes(datasource._id)} + {#each $queries.list.filter(query => query.datasourceId === datasource._id) as query} + onClickQuery(query)} + > + + + {/each} {/if} - - {#each $queries.list.filter(query => query.datasourceId === datasource._id) as query} - onClickQuery(query)} - > - - - {/each} {/each} {/if} From 2b2a78e1554e792730ad56f133424e4016b6f53d Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 23 Sep 2021 09:54:58 +0200 Subject: [PATCH 56/60] Extend Postgres data type map --- packages/server/src/integrations/postgres.ts | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index dd46652871..961dbec4e2 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -84,10 +84,13 @@ module PostgresModule { bigint: FieldTypes.NUMBER, decimal: FieldTypes.NUMBER, smallint: FieldTypes.NUMBER, + real: FieldTypes.NUMBER, + "double precision": FieldTypes.NUMBER, timestamp: FieldTypes.DATETIME, time: FieldTypes.DATETIME, boolean: FieldTypes.BOOLEAN, json: FieldTypes.JSON, + date: FieldTypes.DATETIME, } async function internalQuery(client: any, query: SqlQuery) { From aab5a1f1de1bc87b7a3b42fe8f3a186b0c96d25b Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 23 Sep 2021 08:49:16 +0000 Subject: [PATCH 57/60] v0.9.140-alpha.6 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index e2e4d027b5..a5f9e0ded9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.5", + "version": "0.9.140-alpha.6", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 8c1f38d64c..012051d267 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.5", + "version": "0.9.140-alpha.6", "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 9ddedfd28f..f781cc7c39 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.140-alpha.5", + "version": "0.9.140-alpha.6", "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 01dfc08f2c..52756145a2 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.5", + "version": "0.9.140-alpha.6", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.5", - "@budibase/client": "^0.9.140-alpha.5", + "@budibase/bbui": "^0.9.140-alpha.6", + "@budibase/client": "^0.9.140-alpha.6", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.5", + "@budibase/string-templates": "^0.9.140-alpha.6", "@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 147a0ffe2b..cfe403edc9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.5", + "version": "0.9.140-alpha.6", "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 c739c5b80d..a0df02e392 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.5", + "version": "0.9.140-alpha.6", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.5", + "@budibase/bbui": "^0.9.140-alpha.6", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.5", + "@budibase/string-templates": "^0.9.140-alpha.6", "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 4d32021ff4..653300aa8f 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.140-alpha.5", + "version": "0.9.140-alpha.6", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.5", - "@budibase/client": "^0.9.140-alpha.5", - "@budibase/string-templates": "^0.9.140-alpha.5", + "@budibase/auth": "^0.9.140-alpha.6", + "@budibase/client": "^0.9.140-alpha.6", + "@budibase/string-templates": "^0.9.140-alpha.6", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index f78a7cdf72..a244fab9ba 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.5", + "version": "0.9.140-alpha.6", "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 689e7d8569..01fd3f0f8e 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.140-alpha.5", + "version": "0.9.140-alpha.6", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.5", - "@budibase/string-templates": "^0.9.140-alpha.5", + "@budibase/auth": "^0.9.140-alpha.6", + "@budibase/string-templates": "^0.9.140-alpha.6", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 5dce298b44ac596c58db2c25286a167209b76972 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 23 Sep 2021 11:33:58 +0000 Subject: [PATCH 58/60] v0.9.140-alpha.7 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index a5f9e0ded9..34b61f435d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.6", + "version": "0.9.140-alpha.7", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 012051d267..50cdd91a27 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.6", + "version": "0.9.140-alpha.7", "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 f781cc7c39..8236cfb83a 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.140-alpha.6", + "version": "0.9.140-alpha.7", "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 52756145a2..8d4643b2c3 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.6", + "version": "0.9.140-alpha.7", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.6", - "@budibase/client": "^0.9.140-alpha.6", + "@budibase/bbui": "^0.9.140-alpha.7", + "@budibase/client": "^0.9.140-alpha.7", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.6", + "@budibase/string-templates": "^0.9.140-alpha.7", "@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 cfe403edc9..343bccf430 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.6", + "version": "0.9.140-alpha.7", "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 a0df02e392..147cfc78c4 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.6", + "version": "0.9.140-alpha.7", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.6", + "@budibase/bbui": "^0.9.140-alpha.7", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.6", + "@budibase/string-templates": "^0.9.140-alpha.7", "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 653300aa8f..38cf1184d9 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.140-alpha.6", + "version": "0.9.140-alpha.7", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.6", - "@budibase/client": "^0.9.140-alpha.6", - "@budibase/string-templates": "^0.9.140-alpha.6", + "@budibase/auth": "^0.9.140-alpha.7", + "@budibase/client": "^0.9.140-alpha.7", + "@budibase/string-templates": "^0.9.140-alpha.7", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index a244fab9ba..7bb0e92378 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.6", + "version": "0.9.140-alpha.7", "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 01fd3f0f8e..35e05cbef2 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.140-alpha.6", + "version": "0.9.140-alpha.7", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.6", - "@budibase/string-templates": "^0.9.140-alpha.6", + "@budibase/auth": "^0.9.140-alpha.7", + "@budibase/string-templates": "^0.9.140-alpha.7", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 9cbf830a92172bbfe88c6968223829d627cf9b71 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 23 Sep 2021 17:03:03 +0100 Subject: [PATCH 59/60] fixing path for client manifest --- packages/server/package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/package.json b/packages/server/package.json index 38cf1184d9..7a29669433 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -13,7 +13,7 @@ "postbuild": "copyfiles -u 1 src/**/*.svelte dist/ && copyfiles -u 1 src/**/*.hbs dist/ && copyfiles -u 1 src/**/*.json dist/", "test": "jest --coverage --maxWorkers=2", "test:watch": "jest --watch", - "predocker": "copyfiles -f ../client/dist/budibase-client.js ../standard-components/manifest.json client", + "predocker": "copyfiles -f ../client/dist/budibase-client.js ../client/manifest.json client", "build:docker": "yarn run predocker && docker build . -t app-service", "run:docker": "node dist/index.js", "dev:stack:up": "node scripts/dev/manage.js up", From 2fa6f2aa54185ccf8a58f0e43abb50dc2ca586b6 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 23 Sep 2021 16:11:26 +0000 Subject: [PATCH 60/60] v0.9.140-alpha.8 --- 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 | 6 +++--- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/lerna.json b/lerna.json index 34b61f435d..c3ee9351fe 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.7", + "version": "0.9.140-alpha.8", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 50cdd91a27..22f96811e8 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.7", + "version": "0.9.140-alpha.8", "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 8236cfb83a..82ee4b7d31 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.140-alpha.7", + "version": "0.9.140-alpha.8", "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 8d4643b2c3..c4d57c9709 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.7", + "version": "0.9.140-alpha.8", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.7", - "@budibase/client": "^0.9.140-alpha.7", + "@budibase/bbui": "^0.9.140-alpha.8", + "@budibase/client": "^0.9.140-alpha.8", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.7", + "@budibase/string-templates": "^0.9.140-alpha.8", "@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 343bccf430..459df417c3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.7", + "version": "0.9.140-alpha.8", "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 147cfc78c4..cc585ebac5 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.7", + "version": "0.9.140-alpha.8", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -19,9 +19,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.7", + "@budibase/bbui": "^0.9.140-alpha.8", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.7", + "@budibase/string-templates": "^0.9.140-alpha.8", "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 7a29669433..e0e7a8c8f8 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.140-alpha.7", + "version": "0.9.140-alpha.8", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -62,9 +62,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.7", - "@budibase/client": "^0.9.140-alpha.7", - "@budibase/string-templates": "^0.9.140-alpha.7", + "@budibase/auth": "^0.9.140-alpha.8", + "@budibase/client": "^0.9.140-alpha.8", + "@budibase/string-templates": "^0.9.140-alpha.8", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 7bb0e92378..d57515dbcc 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.140-alpha.7", + "version": "0.9.140-alpha.8", "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 35e05cbef2..81b1129918 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.140-alpha.7", + "version": "0.9.140-alpha.8", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -25,8 +25,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.140-alpha.7", - "@budibase/string-templates": "^0.9.140-alpha.7", + "@budibase/auth": "^0.9.140-alpha.8", + "@budibase/string-templates": "^0.9.140-alpha.8", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0",