From 52db113a51339258c1b04699e9617c08b3107bc1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thomas=20Wei=C3=9F?= Date: Mon, 20 Sep 2021 09:37:14 +0200 Subject: [PATCH 01/42] fix ingress-nginx repo url --- hosting/kubernetes/budibase/Chart.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hosting/kubernetes/budibase/Chart.yaml b/hosting/kubernetes/budibase/Chart.yaml index b82cb3bab2..d00b228b0e 100644 --- a/hosting/kubernetes/budibase/Chart.yaml +++ b/hosting/kubernetes/budibase/Chart.yaml @@ -37,5 +37,5 @@ dependencies: condition: services.couchdb.enabled - name: ingress-nginx version: 3.35.0 - repository: https://github.com/kubernetes/ingress-nginx + repository: https://kubernetes.github.io/ingress-nginx condition: services.ingress.nginx From 297be181599c7f8cddbe44ac9f23cd8b145bdeea Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 22 Sep 2021 08:42:24 +0000 Subject: [PATCH 02/42] v0.9.140 --- 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..a21b86e032 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.0", + "version": "0.9.140", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 448b408742..b02625ef29 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", "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..b542df3bb8 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", "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..10c7572743 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", "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", + "@budibase/client": "^0.9.140", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.0", + "@budibase/string-templates": "^0.9.140", "@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..f6fadeff6b 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", "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..5ab814a4ac 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", "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", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.0", + "@budibase/string-templates": "^0.9.140", "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..743c2d8ff4 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", "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", + "@budibase/client": "^0.9.140", + "@budibase/string-templates": "^0.9.140", "@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..8686a43f51 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", "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..2d2bf0df80 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", "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", + "@budibase/string-templates": "^0.9.140", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From ecbe015c2a47cd25a3f6670c7be1aa501a48dae7 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 22 Sep 2021 11:36:15 +0000 Subject: [PATCH 03/42] v0.9.141 --- 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 a21b86e032..483a1abd82 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140", + "version": "0.9.141", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index b02625ef29..911163deed 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140", + "version": "0.9.141", "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 b542df3bb8..b45081b890 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", + "version": "0.9.141", "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 10c7572743..6f9ae796f0 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140", + "version": "0.9.141", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140", - "@budibase/client": "^0.9.140", + "@budibase/bbui": "^0.9.141", + "@budibase/client": "^0.9.141", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140", + "@budibase/string-templates": "^0.9.141", "@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 f6fadeff6b..9f9f0e7454 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140", + "version": "0.9.141", "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 5ab814a4ac..3cfdf8e2f3 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140", + "version": "0.9.141", "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", + "@budibase/bbui": "^0.9.141", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140", + "@budibase/string-templates": "^0.9.141", "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 743c2d8ff4..1bbb871f1b 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", + "version": "0.9.141", "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", - "@budibase/client": "^0.9.140", - "@budibase/string-templates": "^0.9.140", + "@budibase/auth": "^0.9.141", + "@budibase/client": "^0.9.141", + "@budibase/string-templates": "^0.9.141", "@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 8686a43f51..e0e73955d3 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", + "version": "0.9.141", "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 2d2bf0df80..8849499786 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", + "version": "0.9.141", "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", - "@budibase/string-templates": "^0.9.140", + "@budibase/auth": "^0.9.141", + "@budibase/string-templates": "^0.9.141", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 99644b0cd8ed811b84c4b23686cccb85147b8bf2 Mon Sep 17 00:00:00 2001 From: Maurits Lourens Date: Thu, 23 Sep 2021 11:11:00 +0200 Subject: [PATCH 04/42] Retrieve all columns from all not internal tables --- packages/server/src/integrations/postgres.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index dd46652871..3f9011db94 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -105,7 +105,7 @@ module PostgresModule { private readonly config: PostgresConfig COLUMNS_SQL = - "select * from information_schema.columns where table_schema = 'public'" + "select * from information_schema.columns where not table_schema = 'information_schema' and not table_schema = 'pg_catalog'" PRIMARY_KEYS_SQL = ` select tc.table_schema, tc.table_name, kc.column_name as primary_key From 9b989850401bbab65c568a9a94816af5b73e3936 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 23 Sep 2021 16:22:12 +0100 Subject: [PATCH 05/42] point logo upload to S3 bucket when not self hosted --- packages/worker/src/api/controllers/global/configs.js | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/worker/src/api/controllers/global/configs.js b/packages/worker/src/api/controllers/global/configs.js index aa83fd695f..c0c300e4db 100644 --- a/packages/worker/src/api/controllers/global/configs.js +++ b/packages/worker/src/api/controllers/global/configs.js @@ -10,6 +10,7 @@ const email = require("../../../utilities/email") const { upload, ObjectStoreBuckets } = require("@budibase/auth").objectStore const CouchDB = require("../../../db") const { getGlobalDB } = require("@budibase/auth/tenancy") +const env = require("../../../environment") exports.save = async function (ctx) { const db = getGlobalDB() @@ -174,7 +175,13 @@ exports.upload = async function (ctx) { const file = ctx.request.files.file const { type, name } = ctx.params - const bucket = ObjectStoreBuckets.GLOBAL + let bucket + if (env.SELF_HOSTED) { + bucket = ObjectStoreBuckets.GLOBAL + } else { + bucket = ObjectStoreBuckets.GLOBAL_CLOUD + } + const key = `${type}/${name}` await upload({ bucket, From ce3f8a364fe951325cba33accc2818d12a06a37b Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Thu, 23 Sep 2021 15:48:36 +0000 Subject: [PATCH 06/42] v0.9.142 --- 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 483a1abd82..a8cda22a63 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.141", + "version": "0.9.142", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 911163deed..f62e4cb5e6 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.141", + "version": "0.9.142", "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 b45081b890..ddede26a86 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.141", + "version": "0.9.142", "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 6f9ae796f0..7ab313974b 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.141", + "version": "0.9.142", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.141", - "@budibase/client": "^0.9.141", + "@budibase/bbui": "^0.9.142", + "@budibase/client": "^0.9.142", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.141", + "@budibase/string-templates": "^0.9.142", "@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 9f9f0e7454..0340759e45 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.141", + "version": "0.9.142", "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 3cfdf8e2f3..3d25a1b5d6 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.141", + "version": "0.9.142", "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.141", + "@budibase/bbui": "^0.9.142", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.141", + "@budibase/string-templates": "^0.9.142", "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 1bbb871f1b..9397ab16f3 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.141", + "version": "0.9.142", "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.141", - "@budibase/client": "^0.9.141", - "@budibase/string-templates": "^0.9.141", + "@budibase/auth": "^0.9.142", + "@budibase/client": "^0.9.142", + "@budibase/string-templates": "^0.9.142", "@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 e0e73955d3..44a3290696 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.141", + "version": "0.9.142", "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 8849499786..83e53e9b45 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.141", + "version": "0.9.142", "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.141", - "@budibase/string-templates": "^0.9.141", + "@budibase/auth": "^0.9.142", + "@budibase/string-templates": "^0.9.142", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From e47bf71e6cb3373f77139fbcbb7e629f1aea43f9 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 23 Sep 2021 19:04:53 +0100 Subject: [PATCH 07/42] Getting rid of the concept of permissions hierarchy, roles still have a hierarchy and base permissions still follow the old system, but resources can be given a stack of separate permissions which don't override each other. --- packages/auth/src/security/permissions.js | 7 +- packages/auth/src/security/roles.js | 15 +++- .../server/src/api/controllers/permission.js | 68 ++++++++----------- .../server/src/api/routes/tests/role.spec.js | 2 +- packages/server/src/utilities/index.js | 8 +++ 5 files changed, 50 insertions(+), 50 deletions(-) diff --git a/packages/auth/src/security/permissions.js b/packages/auth/src/security/permissions.js index 03fa5fa562..d0308d783e 100644 --- a/packages/auth/src/security/permissions.js +++ b/packages/auth/src/security/permissions.js @@ -139,8 +139,7 @@ exports.doesHaveResourcePermission = ( // set foundSub to not subResourceId, incase there is no subResource let foundMain = false, foundSub = false - for (let [resource, level] of Object.entries(permissions)) { - const levels = getAllowedLevels(level) + for (let [resource, levels] of Object.entries(permissions)) { if (resource === resourceId && levels.indexOf(permLevel) !== -1) { foundMain = true } @@ -177,10 +176,6 @@ exports.doesHaveBasePermission = (permType, permLevel, permissionIds) => { return false } -exports.higherPermission = (perm1, perm2) => { - return levelToNumber(perm1) > levelToNumber(perm2) ? perm1 : perm2 -} - exports.isPermissionLevelHigherThanRead = level => { return levelToNumber(level) > 1 } diff --git a/packages/auth/src/security/roles.js b/packages/auth/src/security/roles.js index baa8fc40dc..71fbc10132 100644 --- a/packages/auth/src/security/roles.js +++ b/packages/auth/src/security/roles.js @@ -1,6 +1,6 @@ const { getDB } = require("../db") const { cloneDeep } = require("lodash/fp") -const { BUILTIN_PERMISSION_IDS, higherPermission } = require("./permissions") +const { BUILTIN_PERMISSION_IDS } = require("./permissions") const { generateRoleID, getRoleParams, @@ -193,8 +193,17 @@ exports.getUserPermissions = async (appId, userRoleId) => { const permissions = {} for (let role of rolesHierarchy) { if (role.permissions) { - for (let [resource, level] of Object.entries(role.permissions)) { - permissions[resource] = higherPermission(permissions[resource], level) + for (let [resource, levels] of Object.entries(role.permissions)) { + if (!permissions[resource]) { + permissions[resource] = [] + } + const permsSet = new Set(permissions[resource]) + if (Array.isArray(levels)) { + levels.forEach(level => permsSet.add(level)) + } else { + permsSet.add(levels) + } + permissions[resource] = [...permsSet] } } } diff --git a/packages/server/src/api/controllers/permission.js b/packages/server/src/api/controllers/permission.js index e269f8c41d..6c02663649 100644 --- a/packages/server/src/api/controllers/permission.js +++ b/packages/server/src/api/controllers/permission.js @@ -1,9 +1,4 @@ -const { - getBuiltinPermissions, - PermissionLevels, - isPermissionLevelHigherThanRead, - higherPermission, -} = require("@budibase/auth/permissions") +const { getBuiltinPermissions } = require("@budibase/auth/permissions") const { isBuiltin, getDBRoleID, @@ -16,6 +11,7 @@ const { CURRENTLY_SUPPORTED_LEVELS, getBasePermissions, } = require("../../utilities/security") +const { removeFromArray } = require("../../utilities") const PermissionUpdateType = { REMOVE: "remove", @@ -24,22 +20,6 @@ const PermissionUpdateType = { const SUPPORTED_LEVELS = CURRENTLY_SUPPORTED_LEVELS -// quick function to perform a bit of weird logic, make sure fetch calls -// always say a write role also has read permission -function fetchLevelPerms(permissions, level, roleId) { - if (!permissions) { - permissions = {} - } - permissions[level] = roleId - if ( - isPermissionLevelHigherThanRead(level) && - !permissions[PermissionLevels.READ] - ) { - permissions[PermissionLevels.READ] = roleId - } - return permissions -} - // utility function to stop this repetition - permissions always stored under roles async function getAllDBRoles(db) { const body = await db.allDocs( @@ -74,23 +54,31 @@ async function updatePermissionOnRole( for (let role of dbRoles) { let updated = false const rolePermissions = role.permissions ? role.permissions : {} + // make sure its an array, also handle migrating + if ( + !rolePermissions[resourceId] || + !Array.isArray(rolePermissions[resourceId]) + ) { + rolePermissions[resourceId] = + typeof rolePermissions[resourceId] === "string" + ? [rolePermissions[resourceId]] + : [] + } // handle the removal/updating the role which has this permission first // the updating (role._id !== dbRoleId) is required because a resource/level can // only be permitted in a single role (this reduces hierarchy confusion and simplifies // the general UI for this, rather than needing to show everywhere it is used) if ( (role._id !== dbRoleId || remove) && - rolePermissions[resourceId] === level + rolePermissions[resourceId].indexOf(level) !== -1 ) { - delete rolePermissions[resourceId] + removeFromArray(rolePermissions[resourceId], level) updated = true } // handle the adding, we're on the correct role, at it to this if (!remove && role._id === dbRoleId) { - rolePermissions[resourceId] = higherPermission( - rolePermissions[resourceId], - level - ) + const set = new Set(rolePermissions[resourceId]) + rolePermissions[resourceId] = [...set.add(level)] updated = true } // handle the update, add it to bulk docs to perform at end @@ -127,12 +115,11 @@ exports.fetch = async function (ctx) { continue } const roleId = getExternalRoleID(role._id) - for (let [resource, level] of Object.entries(role.permissions)) { - permissions[resource] = fetchLevelPerms( - permissions[resource], - level, - roleId - ) + for (let [resource, levelArr] of Object.entries(role.permissions)) { + const levels = Array.isArray(levelArr) ? [levelArr] : levelArr + const perms = {} + levels.forEach(level => (perms[level] = roleId)) + permissions[resource] = perms } } // apply the base permissions @@ -157,12 +144,13 @@ exports.getResourcePerms = async function (ctx) { for (let level of SUPPORTED_LEVELS) { // update the various roleIds in the resource permissions for (let role of roles) { - if (role.permissions && role.permissions[resourceId] === level) { - permissions = fetchLevelPerms( - permissions, - level, - getExternalRoleID(role._id) - ) + const rolePerms = role.permissions + if ( + rolePerms && + (rolePerms[resourceId] === level || + rolePerms[resourceId].indexOf(level) !== -1) + ) { + permissions[level] = getExternalRoleID(role._id) } } } diff --git a/packages/server/src/api/routes/tests/role.spec.js b/packages/server/src/api/routes/tests/role.spec.js index ad42ef180a..d74a84b2b2 100644 --- a/packages/server/src/api/routes/tests/role.spec.js +++ b/packages/server/src/api/routes/tests/role.spec.js @@ -72,7 +72,7 @@ describe("/roles", () => { .expect(200) expect(res.body.length).toBeGreaterThan(0) const power = res.body.find(role => role._id === BUILTIN_ROLE_IDS.POWER) - expect(power.permissions[table._id]).toEqual("read") + expect(power.permissions[table._id]).toEqual(["read"]) }) }) diff --git a/packages/server/src/utilities/index.js b/packages/server/src/utilities/index.js index a81f9ddcf5..e24d04c581 100644 --- a/packages/server/src/utilities/index.js +++ b/packages/server/src/utilities/index.js @@ -10,6 +10,14 @@ exports.wait = ms => new Promise(resolve => setTimeout(resolve, ms)) exports.isDev = env.isDev +exports.removeFromArray = (array, element) => { + const index = array.indexOf(element) + if (index !== -1) { + array.splice(index, 1) + } + return array +} + /** * Makes sure that a URL has the correct number of slashes, while maintaining the * http(s):// double slashes. From 4a2028c354a41845c7a7f145932ad808f136266e Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 23 Sep 2021 22:40:14 +0100 Subject: [PATCH 08/42] usageQuota middleware writing to couch --- packages/server/src/api/routes/application.js | 5 +- .../server/src/automations/steps/createRow.js | 4 +- packages/server/src/middleware/usageQuota.js | 25 ++-- packages/server/src/utilities/usageQuota.js | 110 +++++------------- .../server/src/utilities/usageQuota.old.js | 105 +++++++++++++++++ .../src/api/controllers/global/users.js | 24 ++++ 6 files changed, 177 insertions(+), 96 deletions(-) create mode 100644 packages/server/src/utilities/usageQuota.old.js diff --git a/packages/server/src/api/routes/application.js b/packages/server/src/api/routes/application.js index c1d39acbd5..ef4aacf708 100644 --- a/packages/server/src/api/routes/application.js +++ b/packages/server/src/api/routes/application.js @@ -2,11 +2,12 @@ const Router = require("@koa/router") const controller = require("../controllers/application") const authorized = require("../../middleware/authorized") const { BUILDER } = require("@budibase/auth/permissions") +const usage = require("../../middleware/usageQuota") const router = Router() router - .post("/api/applications", authorized(BUILDER), controller.create) + .post("/api/applications", authorized(BUILDER), usage, controller.create) .get("/api/applications/:appId/definition", controller.fetchAppDefinition) .get("/api/applications", controller.fetch) .get("/api/applications/:appId/appPackage", controller.fetchAppPackage) @@ -21,6 +22,6 @@ router authorized(BUILDER), controller.revertClient ) - .delete("/api/applications/:appId", authorized(BUILDER), controller.delete) + .delete("/api/applications/:appId", authorized(BUILDER), usage, controller.delete) module.exports = router diff --git a/packages/server/src/automations/steps/createRow.js b/packages/server/src/automations/steps/createRow.js index 9033004578..41e775b3de 100644 --- a/packages/server/src/automations/steps/createRow.js +++ b/packages/server/src/automations/steps/createRow.js @@ -60,7 +60,7 @@ exports.definition = { }, } -exports.run = async function ({ inputs, appId, apiKey, emitter }) { +exports.run = async function ({ inputs, appId, tenantId, emitter }) { if (inputs.row == null || inputs.row.tableId == null) { return { success: false, @@ -84,7 +84,7 @@ exports.run = async function ({ inputs, appId, apiKey, emitter }) { inputs.row ) if (env.USE_QUOTAS) { - await usage.update(apiKey, usage.Properties.ROW, 1) + await usage.update(tenantId, usage.Properties.ROW, 1) } await rowController.save(ctx) return { diff --git a/packages/server/src/middleware/usageQuota.js b/packages/server/src/middleware/usageQuota.js index 4647878721..4ad1092f6c 100644 --- a/packages/server/src/middleware/usageQuota.js +++ b/packages/server/src/middleware/usageQuota.js @@ -13,6 +13,7 @@ const DOMAIN_MAP = { upload: usageQuota.Properties.UPLOAD, views: usageQuota.Properties.VIEW, users: usageQuota.Properties.USER, + applications: usageQuota.Properties.APPS, // this will not be updated by endpoint calls // instead it will be updated by triggerInfo automationRuns: usageQuota.Properties.AUTOMATION, @@ -28,9 +29,9 @@ function getProperty(url) { module.exports = async (ctx, next) => { // if in development or a self hosted cloud usage quotas should not be executed - if (env.isDev() || env.SELF_HOSTED) { - return next() - } + // if (env.isDev() || env.SELF_HOSTED) { + // return next() + // } const db = new CouchDB(ctx.appId) let usage = METHOD_MAP[ctx.req.method] @@ -49,17 +50,17 @@ module.exports = async (ctx, next) => { } // update usage for uploads to be the total size - if (property === usageQuota.Properties.UPLOAD) { - const files = - ctx.request.files.file.length > 1 - ? Array.from(ctx.request.files.file) - : [ctx.request.files.file] - usage = files.map(file => file.size).reduce((total, size) => total + size) - } + // if (property === usageQuota.Properties.UPLOAD) { + // const files = + // ctx.request.files.file.length > 1 + // ? Array.from(ctx.request.files.file) + // : [ctx.request.files.file] + // usage = files.map(file => file.size).reduce((total, size) => total + size) + // } try { - await usageQuota.update(ctx.auth.apiKey, property, usage) + await usageQuota.update(ctx.user.tenantId, property, usage) return next() } catch (err) { - ctx.throw(403, err) + ctx.throw(400, err) } } diff --git a/packages/server/src/utilities/usageQuota.js b/packages/server/src/utilities/usageQuota.js index bfe71a4093..502fc4cad2 100644 --- a/packages/server/src/utilities/usageQuota.js +++ b/packages/server/src/utilities/usageQuota.js @@ -1,41 +1,6 @@ + const env = require("../environment") -const { apiKeyTable } = require("../db/dynamoClient") - -const DEFAULT_USAGE = { - rows: 0, - storage: 0, - views: 0, - automationRuns: 0, - users: 0, -} - -const DEFAULT_PLAN = { - rows: 1000, - // 1 GB - storage: 8589934592, - views: 10, - automationRuns: 100, - users: 10000, -} - -function buildUpdateParams(key, property, usage) { - return { - primary: key, - condition: - "attribute_exists(#quota) AND attribute_exists(#limits) AND #quota.#prop < #limits.#prop AND #quotaReset > :now", - expression: "ADD #quota.#prop :usage", - names: { - "#quota": "usageQuota", - "#prop": property, - "#limits": "usageLimits", - "#quotaReset": "quotaReset", - }, - values: { - ":usage": usage, - ":now": Date.now(), - }, - } -} +const { getGlobalDB } = require("@budibase/auth/tenancy") function getNewQuotaReset() { return Date.now() + 2592000000 @@ -47,59 +12,44 @@ exports.Properties = { VIEW: "views", USER: "users", AUTOMATION: "automationRuns", -} - -exports.getAPIKey = async appId => { - if (!env.USE_QUOTAS) { - return { apiKey: null } - } - return apiKeyTable.get({ primary: appId }) + APPS: "apps" } /** - * Given a specified API key this will add to the usage object for the specified property. - * @param {string} apiKey The API key which is to be updated. + * Given a specified tenantId this will add to the usage object for the specified property. + * @param {string} tenantId The tenant to update the usage quotas for. * @param {string} property The property which is to be added to (within the nested usageQuota object). * @param {number} usage The amount (this can be negative) to adjust the number by. * @returns {Promise} When this completes the API key will now be up to date - the quota period may have * also been reset after this call. */ -exports.update = async (apiKey, property, usage) => { - if (!env.USE_QUOTAS) { - return - } +exports.update = async (tenantId, property, usage) => { + // if (!env.USE_QUOTAS) { + // return + // } try { - await apiKeyTable.update(buildUpdateParams(apiKey, property, usage)) + const db = getGlobalDB() + const quota = await db.get("usage_quota") + // TODO: check if the quota needs reset + if (Date.now() >= quota.quotaReset) { + quota.quotaReset = getNewQuotaReset() + for (let prop of Object.keys(quota.usageQuota)) { + quota.usageQuota[prop] = 0 + } + } + + // increment the quota + quota.usageQuota[property] += usage + + if (quota.usageQuota[property] >= quota.usageLimits[property]) { + throw new Error(`You have exceeded your usage quota of ${quota.usageLimits[property]} ${property}.`) + } + + // update the usage quotas + await db.put(quota) } catch (err) { - // conditional check means the condition failed, need to check why - if (err.code === "ConditionalCheckFailedException") { - // get the API key so we can check it - const keyObj = await apiKeyTable.get({ primary: apiKey }) - // the usage quota or usage limits didn't exist - if (keyObj && (keyObj.usageQuota == null || keyObj.usageLimits == null)) { - keyObj.usageQuota = - keyObj.usageQuota == null ? DEFAULT_USAGE : keyObj.usageQuota - keyObj.usageLimits = - keyObj.usageLimits == null ? DEFAULT_PLAN : keyObj.usageLimits - keyObj.quotaReset = getNewQuotaReset() - await apiKeyTable.put({ item: keyObj }) - return - } - // we have in fact breached the reset period - else if (keyObj && keyObj.quotaReset <= Date.now()) { - // update the quota reset period and reset the values for all properties - keyObj.quotaReset = getNewQuotaReset() - for (let prop of Object.keys(keyObj.usageQuota)) { - if (prop === property) { - keyObj.usageQuota[prop] = usage > 0 ? usage : 0 - } else { - keyObj.usageQuota[prop] = 0 - } - } - await apiKeyTable.put({ item: keyObj }) - return - } - } + console.error(`Error updating usage quotas for ${property}`, err) throw err } + } diff --git a/packages/server/src/utilities/usageQuota.old.js b/packages/server/src/utilities/usageQuota.old.js new file mode 100644 index 0000000000..bfe71a4093 --- /dev/null +++ b/packages/server/src/utilities/usageQuota.old.js @@ -0,0 +1,105 @@ +const env = require("../environment") +const { apiKeyTable } = require("../db/dynamoClient") + +const DEFAULT_USAGE = { + rows: 0, + storage: 0, + views: 0, + automationRuns: 0, + users: 0, +} + +const DEFAULT_PLAN = { + rows: 1000, + // 1 GB + storage: 8589934592, + views: 10, + automationRuns: 100, + users: 10000, +} + +function buildUpdateParams(key, property, usage) { + return { + primary: key, + condition: + "attribute_exists(#quota) AND attribute_exists(#limits) AND #quota.#prop < #limits.#prop AND #quotaReset > :now", + expression: "ADD #quota.#prop :usage", + names: { + "#quota": "usageQuota", + "#prop": property, + "#limits": "usageLimits", + "#quotaReset": "quotaReset", + }, + values: { + ":usage": usage, + ":now": Date.now(), + }, + } +} + +function getNewQuotaReset() { + return Date.now() + 2592000000 +} + +exports.Properties = { + ROW: "rows", + UPLOAD: "storage", + VIEW: "views", + USER: "users", + AUTOMATION: "automationRuns", +} + +exports.getAPIKey = async appId => { + if (!env.USE_QUOTAS) { + return { apiKey: null } + } + return apiKeyTable.get({ primary: appId }) +} + +/** + * Given a specified API key this will add to the usage object for the specified property. + * @param {string} apiKey The API key which is to be updated. + * @param {string} property The property which is to be added to (within the nested usageQuota object). + * @param {number} usage The amount (this can be negative) to adjust the number by. + * @returns {Promise} When this completes the API key will now be up to date - the quota period may have + * also been reset after this call. + */ +exports.update = async (apiKey, property, usage) => { + if (!env.USE_QUOTAS) { + return + } + try { + await apiKeyTable.update(buildUpdateParams(apiKey, property, usage)) + } catch (err) { + // conditional check means the condition failed, need to check why + if (err.code === "ConditionalCheckFailedException") { + // get the API key so we can check it + const keyObj = await apiKeyTable.get({ primary: apiKey }) + // the usage quota or usage limits didn't exist + if (keyObj && (keyObj.usageQuota == null || keyObj.usageLimits == null)) { + keyObj.usageQuota = + keyObj.usageQuota == null ? DEFAULT_USAGE : keyObj.usageQuota + keyObj.usageLimits = + keyObj.usageLimits == null ? DEFAULT_PLAN : keyObj.usageLimits + keyObj.quotaReset = getNewQuotaReset() + await apiKeyTable.put({ item: keyObj }) + return + } + // we have in fact breached the reset period + else if (keyObj && keyObj.quotaReset <= Date.now()) { + // update the quota reset period and reset the values for all properties + keyObj.quotaReset = getNewQuotaReset() + for (let prop of Object.keys(keyObj.usageQuota)) { + if (prop === property) { + keyObj.usageQuota[prop] = usage > 0 ? usage : 0 + } else { + keyObj.usageQuota[prop] = 0 + } + } + await apiKeyTable.put({ item: keyObj }) + return + } + } + throw err + } +} diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 1375240f34..b75c72290d 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -18,6 +18,7 @@ const { tryAddTenant, updateTenantId, } = require("@budibase/auth/tenancy") +const env = require("../../../environment") const PLATFORM_INFO_DB = StaticDatabases.PLATFORM_INFO.name @@ -138,6 +139,29 @@ exports.adminUser = async ctx => { include_docs: true, }) ) + + // write usage quotas for cloud + // if (!env.SELF_HOSTED) { + await db.post({ + _id: "usage_quota", + quotaReset: Date.now() + 2592000000, + usageQuota: { + automationRuns: 0, + rows: 0, + storage: 0, + apps: 0, + users: 0, + views: 0, + }, + usageLimits: { + automationRuns: 1000, + rows: 4000, + apps: 4, + // storage: 1000, + // users: 10 + }, + }) + // } if (response.rows.some(row => row.doc.admin)) { ctx.throw( From c49b88b57aedde3588f8b96cf7831953ded323d2 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 23 Sep 2021 23:25:25 +0100 Subject: [PATCH 09/42] automation runs quotas --- packages/server/src/api/routes/application.js | 7 +- packages/server/src/api/routes/user.js | 5 +- .../server/src/automations/steps/createRow.js | 4 +- .../server/src/automations/steps/deleteRow.js | 4 +- packages/server/src/automations/thread.js | 7 +- packages/server/src/integrations/mysql.ts | 6 +- packages/server/src/integrations/postgres.ts | 18 +- packages/server/src/integrations/utils.ts | 6 +- packages/server/src/middleware/usageQuota.js | 2 +- packages/server/src/utilities/usageQuota.js | 45 ++-- .../server/src/utilities/usageQuota.old.js | 196 +++++++++--------- .../src/api/controllers/global/users.js | 43 ++-- 12 files changed, 184 insertions(+), 159 deletions(-) diff --git a/packages/server/src/api/routes/application.js b/packages/server/src/api/routes/application.js index ef4aacf708..4d67a0f4f4 100644 --- a/packages/server/src/api/routes/application.js +++ b/packages/server/src/api/routes/application.js @@ -22,6 +22,11 @@ router authorized(BUILDER), controller.revertClient ) - .delete("/api/applications/:appId", authorized(BUILDER), usage, controller.delete) + .delete( + "/api/applications/:appId", + authorized(BUILDER), + usage, + controller.delete + ) module.exports = router diff --git a/packages/server/src/api/routes/user.js b/packages/server/src/api/routes/user.js index b3b486fe45..465fef82c8 100644 --- a/packages/server/src/api/routes/user.js +++ b/packages/server/src/api/routes/user.js @@ -5,7 +5,6 @@ const { PermissionLevels, PermissionTypes, } = require("@budibase/auth/permissions") -const usage = require("../../middleware/usageQuota") const router = Router() @@ -28,13 +27,13 @@ router .post( "/api/users/metadata/self", authorized(PermissionTypes.USER, PermissionLevels.WRITE), - usage, + // usage, controller.updateSelfMetadata ) .delete( "/api/users/metadata/:id", authorized(PermissionTypes.USER, PermissionLevels.WRITE), - usage, + // usage, controller.destroyMetadata ) diff --git a/packages/server/src/automations/steps/createRow.js b/packages/server/src/automations/steps/createRow.js index 41e775b3de..47d0b4eb99 100644 --- a/packages/server/src/automations/steps/createRow.js +++ b/packages/server/src/automations/steps/createRow.js @@ -60,7 +60,7 @@ exports.definition = { }, } -exports.run = async function ({ inputs, appId, tenantId, emitter }) { +exports.run = async function ({ inputs, appId, emitter }) { if (inputs.row == null || inputs.row.tableId == null) { return { success: false, @@ -84,7 +84,7 @@ exports.run = async function ({ inputs, appId, tenantId, emitter }) { inputs.row ) if (env.USE_QUOTAS) { - await usage.update(tenantId, usage.Properties.ROW, 1) + await usage.update(usage.Properties.ROW, 1) } await rowController.save(ctx) return { diff --git a/packages/server/src/automations/steps/deleteRow.js b/packages/server/src/automations/steps/deleteRow.js index 0f9648cc51..225f00c5df 100644 --- a/packages/server/src/automations/steps/deleteRow.js +++ b/packages/server/src/automations/steps/deleteRow.js @@ -52,7 +52,7 @@ exports.definition = { }, } -exports.run = async function ({ inputs, appId, apiKey, emitter }) { +exports.run = async function ({ inputs, appId, emitter }) { if (inputs.id == null || inputs.revision == null) { return { success: false, @@ -74,7 +74,7 @@ exports.run = async function ({ inputs, appId, apiKey, emitter }) { try { if (env.isProd()) { - await usage.update(apiKey, usage.Properties.ROW, -1) + await usage.update(usage.Properties.ROW, -1) } await rowController.destroy(ctx) return { diff --git a/packages/server/src/automations/thread.js b/packages/server/src/automations/thread.js index a3e81a2274..37484e50bd 100644 --- a/packages/server/src/automations/thread.js +++ b/packages/server/src/automations/thread.js @@ -6,6 +6,8 @@ const { DEFAULT_TENANT_ID } = require("@budibase/auth").constants const CouchDB = require("../db") const { DocumentTypes } = require("../db/utils") const { doInTenant } = require("@budibase/auth/tenancy") +const env = require("../environment") +const usage = require("../utilities/usageQuota") const FILTER_STEP_ID = actions.ACTION_DEFINITIONS.FILTER.stepId @@ -80,7 +82,6 @@ class Orchestrator { return stepFn({ inputs: step.inputs, appId: this._appId, - apiKey: automation.apiKey, emitter: this._emitter, context: this._context, }) @@ -95,6 +96,10 @@ class Orchestrator { return err } } + // TODO: don't count test runs + if (!env.SELF_HOSTED) { + usage.update(usage.Properties.AUTOMATION, 1) + } return this.executionOutput } } diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index c5db35ed2a..605e23024b 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -12,7 +12,11 @@ import { getSqlQuery } from "./utils" module MySQLModule { const mysql = require("mysql") const Sql = require("./base/sql") - const { buildExternalTableId, convertType, copyExistingPropsOver } = require("./utils") + const { + buildExternalTableId, + convertType, + copyExistingPropsOver, + } = require("./utils") const { FieldTypes } = require("../constants") interface MySQLConfig { diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index 23a8685648..707d779c65 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -12,7 +12,11 @@ module PostgresModule { const { Pool } = require("pg") const Sql = require("./base/sql") const { FieldTypes } = require("../constants") - const { buildExternalTableId, convertType, copyExistingPropsOver } = require("./utils") + const { + buildExternalTableId, + convertType, + copyExistingPropsOver, + } = require("./utils") interface PostgresConfig { host: string @@ -179,10 +183,16 @@ module PostgresModule { } const type: string = convertType(column.data_type, TYPE_MAP) - const identity = !!(column.identity_generation || column.identity_start || column.identity_increment) - const hasDefault = 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 isGenerated = + column.is_generated && column.is_generated !== "NEVER" const isAuto: boolean = hasDefault || identity || isGenerated tables[tableName].schema[columnName] = { autocolumn: isAuto, diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 82c35bc2d9..6e3dc6f684 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -84,7 +84,11 @@ export function isIsoDateString(str: string) { } // 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 }) { +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 diff --git a/packages/server/src/middleware/usageQuota.js b/packages/server/src/middleware/usageQuota.js index 4ad1092f6c..d18ffae205 100644 --- a/packages/server/src/middleware/usageQuota.js +++ b/packages/server/src/middleware/usageQuota.js @@ -1,6 +1,6 @@ const CouchDB = require("../db") const usageQuota = require("../utilities/usageQuota") -const env = require("../environment") +// const env = require("../environment") // currently only counting new writes and deletes const METHOD_MAP = { diff --git a/packages/server/src/utilities/usageQuota.js b/packages/server/src/utilities/usageQuota.js index 502fc4cad2..b98fb923cd 100644 --- a/packages/server/src/utilities/usageQuota.js +++ b/packages/server/src/utilities/usageQuota.js @@ -1,5 +1,4 @@ - -const env = require("../environment") +// const env = require("../environment") const { getGlobalDB } = require("@budibase/auth/tenancy") function getNewQuotaReset() { @@ -12,44 +11,44 @@ exports.Properties = { VIEW: "views", USER: "users", AUTOMATION: "automationRuns", - APPS: "apps" + APPS: "apps", } /** * Given a specified tenantId this will add to the usage object for the specified property. - * @param {string} tenantId The tenant to update the usage quotas for. * @param {string} property The property which is to be added to (within the nested usageQuota object). * @param {number} usage The amount (this can be negative) to adjust the number by. * @returns {Promise} When this completes the API key will now be up to date - the quota period may have * also been reset after this call. */ -exports.update = async (tenantId, property, usage) => { +exports.update = async (property, usage) => { // if (!env.USE_QUOTAS) { // return // } try { - const db = getGlobalDB() - const quota = await db.get("usage_quota") - // TODO: check if the quota needs reset - if (Date.now() >= quota.quotaReset) { - quota.quotaReset = getNewQuotaReset() - for (let prop of Object.keys(quota.usageQuota)) { - quota.usageQuota[prop] = 0 - } - } + const db = getGlobalDB() + const quota = await db.get("usage_quota") + // TODO: check if the quota needs reset + if (Date.now() >= quota.quotaReset) { + quota.quotaReset = getNewQuotaReset() + for (let prop of Object.keys(quota.usageQuota)) { + quota.usageQuota[prop] = 0 + } + } - // increment the quota - quota.usageQuota[property] += usage + // increment the quota + quota.usageQuota[property] += usage - if (quota.usageQuota[property] >= quota.usageLimits[property]) { - throw new Error(`You have exceeded your usage quota of ${quota.usageLimits[property]} ${property}.`) - } + if (quota.usageQuota[property] >= quota.usageLimits[property]) { + throw new Error( + `You have exceeded your usage quota of ${quota.usageLimits[property]} ${property}.` + ) + } - // update the usage quotas - await db.put(quota) + // update the usage quotas + await db.put(quota) } catch (err) { - console.error(`Error updating usage quotas for ${property}`, err) + console.error(`Error updating usage quotas for ${property}`, err) throw err } - } diff --git a/packages/server/src/utilities/usageQuota.old.js b/packages/server/src/utilities/usageQuota.old.js index bfe71a4093..39dad89c6d 100644 --- a/packages/server/src/utilities/usageQuota.old.js +++ b/packages/server/src/utilities/usageQuota.old.js @@ -1,105 +1,105 @@ -const env = require("../environment") -const { apiKeyTable } = require("../db/dynamoClient") +// const env = require("../environment") +// const { apiKeyTable } = require("../db/dynamoClient") -const DEFAULT_USAGE = { - rows: 0, - storage: 0, - views: 0, - automationRuns: 0, - users: 0, -} +// const DEFAULT_USAGE = { +// rows: 0, +// storage: 0, +// views: 0, +// automationRuns: 0, +// users: 0, +// } -const DEFAULT_PLAN = { - rows: 1000, - // 1 GB - storage: 8589934592, - views: 10, - automationRuns: 100, - users: 10000, -} +// const DEFAULT_PLAN = { +// rows: 1000, +// // 1 GB +// storage: 8589934592, +// views: 10, +// automationRuns: 100, +// users: 10000, +// } -function buildUpdateParams(key, property, usage) { - return { - primary: key, - condition: - "attribute_exists(#quota) AND attribute_exists(#limits) AND #quota.#prop < #limits.#prop AND #quotaReset > :now", - expression: "ADD #quota.#prop :usage", - names: { - "#quota": "usageQuota", - "#prop": property, - "#limits": "usageLimits", - "#quotaReset": "quotaReset", - }, - values: { - ":usage": usage, - ":now": Date.now(), - }, - } -} +// function buildUpdateParams(key, property, usage) { +// return { +// primary: key, +// condition: +// "attribute_exists(#quota) AND attribute_exists(#limits) AND #quota.#prop < #limits.#prop AND #quotaReset > :now", +// expression: "ADD #quota.#prop :usage", +// names: { +// "#quota": "usageQuota", +// "#prop": property, +// "#limits": "usageLimits", +// "#quotaReset": "quotaReset", +// }, +// values: { +// ":usage": usage, +// ":now": Date.now(), +// }, +// } +// } -function getNewQuotaReset() { - return Date.now() + 2592000000 -} +// function getNewQuotaReset() { +// return Date.now() + 2592000000 +// } -exports.Properties = { - ROW: "rows", - UPLOAD: "storage", - VIEW: "views", - USER: "users", - AUTOMATION: "automationRuns", -} +// exports.Properties = { +// ROW: "rows", +// UPLOAD: "storage", +// VIEW: "views", +// USER: "users", +// AUTOMATION: "automationRuns", +// } -exports.getAPIKey = async appId => { - if (!env.USE_QUOTAS) { - return { apiKey: null } - } - return apiKeyTable.get({ primary: appId }) -} +// exports.getAPIKey = async appId => { +// if (!env.USE_QUOTAS) { +// return { apiKey: null } +// } +// return apiKeyTable.get({ primary: appId }) +// } -/** - * Given a specified API key this will add to the usage object for the specified property. - * @param {string} apiKey The API key which is to be updated. - * @param {string} property The property which is to be added to (within the nested usageQuota object). - * @param {number} usage The amount (this can be negative) to adjust the number by. - * @returns {Promise} When this completes the API key will now be up to date - the quota period may have - * also been reset after this call. - */ -exports.update = async (apiKey, property, usage) => { - if (!env.USE_QUOTAS) { - return - } - try { - await apiKeyTable.update(buildUpdateParams(apiKey, property, usage)) - } catch (err) { - // conditional check means the condition failed, need to check why - if (err.code === "ConditionalCheckFailedException") { - // get the API key so we can check it - const keyObj = await apiKeyTable.get({ primary: apiKey }) - // the usage quota or usage limits didn't exist - if (keyObj && (keyObj.usageQuota == null || keyObj.usageLimits == null)) { - keyObj.usageQuota = - keyObj.usageQuota == null ? DEFAULT_USAGE : keyObj.usageQuota - keyObj.usageLimits = - keyObj.usageLimits == null ? DEFAULT_PLAN : keyObj.usageLimits - keyObj.quotaReset = getNewQuotaReset() - await apiKeyTable.put({ item: keyObj }) - return - } - // we have in fact breached the reset period - else if (keyObj && keyObj.quotaReset <= Date.now()) { - // update the quota reset period and reset the values for all properties - keyObj.quotaReset = getNewQuotaReset() - for (let prop of Object.keys(keyObj.usageQuota)) { - if (prop === property) { - keyObj.usageQuota[prop] = usage > 0 ? usage : 0 - } else { - keyObj.usageQuota[prop] = 0 - } - } - await apiKeyTable.put({ item: keyObj }) - return - } - } - throw err - } -} +// /** +// * Given a specified API key this will add to the usage object for the specified property. +// * @param {string} apiKey The API key which is to be updated. +// * @param {string} property The property which is to be added to (within the nested usageQuota object). +// * @param {number} usage The amount (this can be negative) to adjust the number by. +// * @returns {Promise} When this completes the API key will now be up to date - the quota period may have +// * also been reset after this call. +// */ +// exports.update = async (apiKey, property, usage) => { +// if (!env.USE_QUOTAS) { +// return +// } +// try { +// await apiKeyTable.update(buildUpdateParams(apiKey, property, usage)) +// } catch (err) { +// // conditional check means the condition failed, need to check why +// if (err.code === "ConditionalCheckFailedException") { +// // get the API key so we can check it +// const keyObj = await apiKeyTable.get({ primary: apiKey }) +// // the usage quota or usage limits didn't exist +// if (keyObj && (keyObj.usageQuota == null || keyObj.usageLimits == null)) { +// keyObj.usageQuota = +// keyObj.usageQuota == null ? DEFAULT_USAGE : keyObj.usageQuota +// keyObj.usageLimits = +// keyObj.usageLimits == null ? DEFAULT_PLAN : keyObj.usageLimits +// keyObj.quotaReset = getNewQuotaReset() +// await apiKeyTable.put({ item: keyObj }) +// return +// } +// // we have in fact breached the reset period +// else if (keyObj && keyObj.quotaReset <= Date.now()) { +// // update the quota reset period and reset the values for all properties +// keyObj.quotaReset = getNewQuotaReset() +// for (let prop of Object.keys(keyObj.usageQuota)) { +// if (prop === property) { +// keyObj.usageQuota[prop] = usage > 0 ? usage : 0 +// } else { +// keyObj.usageQuota[prop] = 0 +// } +// } +// await apiKeyTable.put({ item: keyObj }) +// return +// } +// } +// throw err +// } +// } diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index b75c72290d..294a835f14 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -1,7 +1,6 @@ const { generateGlobalUserID, getGlobalUserParams, - StaticDatabases, } = require("@budibase/auth/db") const { hash, getGlobalUserByEmail } = require("@budibase/auth").utils @@ -18,7 +17,7 @@ const { tryAddTenant, updateTenantId, } = require("@budibase/auth/tenancy") -const env = require("../../../environment") +// const env = require("../../../environment") const PLATFORM_INFO_DB = StaticDatabases.PLATFORM_INFO.name @@ -139,28 +138,28 @@ exports.adminUser = async ctx => { include_docs: true, }) ) - + // write usage quotas for cloud // if (!env.SELF_HOSTED) { - await db.post({ - _id: "usage_quota", - quotaReset: Date.now() + 2592000000, - usageQuota: { - automationRuns: 0, - rows: 0, - storage: 0, - apps: 0, - users: 0, - views: 0, - }, - usageLimits: { - automationRuns: 1000, - rows: 4000, - apps: 4, - // storage: 1000, - // users: 10 - }, - }) + await db.post({ + _id: "usage_quota", + quotaReset: Date.now() + 2592000000, + usageQuota: { + automationRuns: 0, + rows: 0, + storage: 0, + apps: 0, + users: 0, + views: 0, + }, + usageLimits: { + automationRuns: 1000, + rows: 4000, + apps: 4, + storage: 1000, + users: 10 + }, + }) // } if (response.rows.some(row => row.doc.admin)) { From 83384faed84d14804ad2ec85bb30e380c1d8af4d Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 23 Sep 2021 23:26:09 +0100 Subject: [PATCH 10/42] remove old middleware --- .../server/src/utilities/usageQuota.old.js | 105 ------------------ 1 file changed, 105 deletions(-) delete mode 100644 packages/server/src/utilities/usageQuota.old.js diff --git a/packages/server/src/utilities/usageQuota.old.js b/packages/server/src/utilities/usageQuota.old.js deleted file mode 100644 index 39dad89c6d..0000000000 --- a/packages/server/src/utilities/usageQuota.old.js +++ /dev/null @@ -1,105 +0,0 @@ -// const env = require("../environment") -// const { apiKeyTable } = require("../db/dynamoClient") - -// const DEFAULT_USAGE = { -// rows: 0, -// storage: 0, -// views: 0, -// automationRuns: 0, -// users: 0, -// } - -// const DEFAULT_PLAN = { -// rows: 1000, -// // 1 GB -// storage: 8589934592, -// views: 10, -// automationRuns: 100, -// users: 10000, -// } - -// function buildUpdateParams(key, property, usage) { -// return { -// primary: key, -// condition: -// "attribute_exists(#quota) AND attribute_exists(#limits) AND #quota.#prop < #limits.#prop AND #quotaReset > :now", -// expression: "ADD #quota.#prop :usage", -// names: { -// "#quota": "usageQuota", -// "#prop": property, -// "#limits": "usageLimits", -// "#quotaReset": "quotaReset", -// }, -// values: { -// ":usage": usage, -// ":now": Date.now(), -// }, -// } -// } - -// function getNewQuotaReset() { -// return Date.now() + 2592000000 -// } - -// exports.Properties = { -// ROW: "rows", -// UPLOAD: "storage", -// VIEW: "views", -// USER: "users", -// AUTOMATION: "automationRuns", -// } - -// exports.getAPIKey = async appId => { -// if (!env.USE_QUOTAS) { -// return { apiKey: null } -// } -// return apiKeyTable.get({ primary: appId }) -// } - -// /** -// * Given a specified API key this will add to the usage object for the specified property. -// * @param {string} apiKey The API key which is to be updated. -// * @param {string} property The property which is to be added to (within the nested usageQuota object). -// * @param {number} usage The amount (this can be negative) to adjust the number by. -// * @returns {Promise} When this completes the API key will now be up to date - the quota period may have -// * also been reset after this call. -// */ -// exports.update = async (apiKey, property, usage) => { -// if (!env.USE_QUOTAS) { -// return -// } -// try { -// await apiKeyTable.update(buildUpdateParams(apiKey, property, usage)) -// } catch (err) { -// // conditional check means the condition failed, need to check why -// if (err.code === "ConditionalCheckFailedException") { -// // get the API key so we can check it -// const keyObj = await apiKeyTable.get({ primary: apiKey }) -// // the usage quota or usage limits didn't exist -// if (keyObj && (keyObj.usageQuota == null || keyObj.usageLimits == null)) { -// keyObj.usageQuota = -// keyObj.usageQuota == null ? DEFAULT_USAGE : keyObj.usageQuota -// keyObj.usageLimits = -// keyObj.usageLimits == null ? DEFAULT_PLAN : keyObj.usageLimits -// keyObj.quotaReset = getNewQuotaReset() -// await apiKeyTable.put({ item: keyObj }) -// return -// } -// // we have in fact breached the reset period -// else if (keyObj && keyObj.quotaReset <= Date.now()) { -// // update the quota reset period and reset the values for all properties -// keyObj.quotaReset = getNewQuotaReset() -// for (let prop of Object.keys(keyObj.usageQuota)) { -// if (prop === property) { -// keyObj.usageQuota[prop] = usage > 0 ? usage : 0 -// } else { -// keyObj.usageQuota[prop] = 0 -// } -// } -// await apiKeyTable.put({ item: keyObj }) -// return -// } -// } -// throw err -// } -// } From 32bdc4a991c6d8f895c59a63067ac3d57c9fc5e9 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 24 Sep 2021 18:10:30 +0100 Subject: [PATCH 11/42] Minimal fix for issue involving JSON views and newlines with postgres, this fix couldn't be more over-arching as it risked breaking new lines across the board. Have included a script for setting up the test scenario as well. This fixes issue #2612. --- .../integrations/pg-json/docker-compose.yml | 28 +++++++++++++++++++ .../scripts/integrations/pg-json/init.sql | 22 +++++++++++++++ .../scripts/integrations/pg-json/reset.sh | 3 ++ packages/server/src/integrations/postgres.ts | 12 ++++++++ packages/server/src/utilities/index.js | 11 ++++++++ 5 files changed, 76 insertions(+) create mode 100644 packages/server/scripts/integrations/pg-json/docker-compose.yml create mode 100644 packages/server/scripts/integrations/pg-json/init.sql create mode 100755 packages/server/scripts/integrations/pg-json/reset.sh diff --git a/packages/server/scripts/integrations/pg-json/docker-compose.yml b/packages/server/scripts/integrations/pg-json/docker-compose.yml new file mode 100644 index 0000000000..6bc307a86d --- /dev/null +++ b/packages/server/scripts/integrations/pg-json/docker-compose.yml @@ -0,0 +1,28 @@ +version: "3.8" +services: + db: + container_name: postgres-json + 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-json + 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/pg-json/init.sql b/packages/server/scripts/integrations/pg-json/init.sql new file mode 100644 index 0000000000..06a5b4901d --- /dev/null +++ b/packages/server/scripts/integrations/pg-json/init.sql @@ -0,0 +1,22 @@ +SELECT 'CREATE DATABASE main' +WHERE NOT EXISTS (SELECT FROM pg_database WHERE datname = 'main')\gexec +CREATE TABLE jsonTable ( + id character varying(32), + data jsonb, + text text +); + +INSERT INTO jsonTable (id, data) VALUES ('1', '{"id": 1, "age": 1, "name": "Mike", "newline": "this is text with a\n newline in it"}'); + +CREATE VIEW jsonView AS SELECT + x.id, + x.age, + x.name, + x.newline +FROM + jsonTable c, + LATERAL jsonb_to_record(c.data) x (id character varying(32), + age BIGINT, + name TEXT, + newline TEXT + ); diff --git a/packages/server/scripts/integrations/pg-json/reset.sh b/packages/server/scripts/integrations/pg-json/reset.sh new file mode 100755 index 0000000000..32778bd11f --- /dev/null +++ b/packages/server/scripts/integrations/pg-json/reset.sh @@ -0,0 +1,3 @@ +#!/bin/bash +docker-compose down +docker volume prune -f diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index 23a8685648..15a500b67e 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -13,6 +13,9 @@ module PostgresModule { const Sql = require("./base/sql") const { FieldTypes } = require("../constants") const { buildExternalTableId, convertType, copyExistingPropsOver } = require("./utils") + const { escapeDangerousCharacters } = require("../utilities") + + const JSON_REGEX = /'{.*}'::json/s interface PostgresConfig { host: string @@ -94,6 +97,15 @@ module PostgresModule { } async function internalQuery(client: any, query: SqlQuery) { + // need to handle a specific issue with json data types in postgres, + // new lines inside the JSON data will break it + const matches = query.sql.match(JSON_REGEX) + if (matches && matches.length > 0) { + for (let match of matches) { + const escaped = escapeDangerousCharacters(match) + query.sql = query.sql.replace(match, escaped) + } + } try { return await client.query(query.sql, query.bindings || []) } catch (err) { diff --git a/packages/server/src/utilities/index.js b/packages/server/src/utilities/index.js index a81f9ddcf5..aac3610515 100644 --- a/packages/server/src/utilities/index.js +++ b/packages/server/src/utilities/index.js @@ -106,3 +106,14 @@ exports.deleteEntityMetadata = async (appId, type, entityId) => { await db.remove(id, rev) } } + +exports.escapeDangerousCharacters = string => { + return string + .replace(/[\\]/g, "\\\\") + .replace(/[\/]/g, "\\/") + .replace(/[\b]/g, "\\b") + .replace(/[\f]/g, "\\f") + .replace(/[\n]/g, "\\n") + .replace(/[\r]/g, "\\r") + .replace(/[\t]/g, "\\t") +} From 6c7423e52e32e952b5f46fb1be8c263a86c23374 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 10:32:39 +0100 Subject: [PATCH 12/42] ensure automation quotas are not incremented for test runs --- packages/server/src/automations/thread.js | 7 ++++--- packages/worker/src/api/controllers/global/users.js | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/server/src/automations/thread.js b/packages/server/src/automations/thread.js index 37484e50bd..ef12494165 100644 --- a/packages/server/src/automations/thread.js +++ b/packages/server/src/automations/thread.js @@ -4,7 +4,7 @@ const AutomationEmitter = require("../events/AutomationEmitter") const { processObject } = require("@budibase/string-templates") const { DEFAULT_TENANT_ID } = require("@budibase/auth").constants const CouchDB = require("../db") -const { DocumentTypes } = require("../db/utils") +const { DocumentTypes, isDevAppID } = require("../db/utils") const { doInTenant } = require("@budibase/auth/tenancy") const env = require("../environment") const usage = require("../utilities/usageQuota") @@ -96,8 +96,9 @@ class Orchestrator { return err } } - // TODO: don't count test runs - if (!env.SELF_HOSTED) { + + // Increment quota for automation runs + if (!env.SELF_HOSTED && !isDevAppID(this._appId)) { usage.update(usage.Properties.AUTOMATION, 1) } return this.executionOutput diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 294a835f14..61c2981280 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -157,7 +157,7 @@ exports.adminUser = async ctx => { rows: 4000, apps: 4, storage: 1000, - users: 10 + users: 10, }, }) // } From 009f30b5cc97911287f44cb0ef43fdb4f8e72474 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 27 Sep 2021 12:17:59 +0100 Subject: [PATCH 13/42] Removing useless statement. --- packages/server/src/utilities/index.js | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/server/src/utilities/index.js b/packages/server/src/utilities/index.js index aac3610515..3aa43976e1 100644 --- a/packages/server/src/utilities/index.js +++ b/packages/server/src/utilities/index.js @@ -110,7 +110,6 @@ exports.deleteEntityMetadata = async (appId, type, entityId) => { exports.escapeDangerousCharacters = string => { return string .replace(/[\\]/g, "\\\\") - .replace(/[\/]/g, "\\/") .replace(/[\b]/g, "\\b") .replace(/[\f]/g, "\\f") .replace(/[\n]/g, "\\n") From 704c8891516e4ff05f0445c494403328445bcdba Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 27 Sep 2021 13:17:31 +0100 Subject: [PATCH 14/42] Fixing issue discovered by test case. --- packages/server/src/integrations/postgres.ts | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/server/src/integrations/postgres.ts b/packages/server/src/integrations/postgres.ts index 15a500b67e..e06e3936c8 100644 --- a/packages/server/src/integrations/postgres.ts +++ b/packages/server/src/integrations/postgres.ts @@ -99,11 +99,13 @@ module PostgresModule { async function internalQuery(client: any, query: SqlQuery) { // need to handle a specific issue with json data types in postgres, // new lines inside the JSON data will break it - const matches = query.sql.match(JSON_REGEX) - if (matches && matches.length > 0) { - for (let match of matches) { - const escaped = escapeDangerousCharacters(match) - query.sql = query.sql.replace(match, escaped) + if (query && query.sql) { + const matches = query.sql.match(JSON_REGEX) + if (matches && matches.length > 0) { + for (let match of matches) { + const escaped = escapeDangerousCharacters(match) + query.sql = query.sql.replace(match, escaped) + } } } try { From 35d4eac78aa664c9f0c23b7be65392541d6d3e17 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 14:57:22 +0100 Subject: [PATCH 15/42] fallback SMTP configuration for cloud --- .../api/controllers/row/ExternalRequest.ts | 2 +- .../src/automations/tests/automation.spec.js | 2 -- .../src/automations/tests/createRow.spec.js | 2 +- .../src/automations/tests/deleteRow.spec.js | 2 +- packages/server/src/definitions/datasource.ts | 4 ++-- packages/server/src/integrations/base/sql.ts | 2 +- packages/server/src/integrations/mysql.ts | 6 +++--- .../src/middleware/tests/usageQuota.spec.js | 6 +++--- packages/server/src/middleware/usageQuota.js | 16 +++++++------- packages/server/src/utilities/usageQuota.js | 4 +++- .../src/api/controllers/global/users.js | 2 ++ packages/worker/src/environment.js | 5 +++++ packages/worker/src/utilities/email.js | 21 ++++++++++++++++--- 13 files changed, 48 insertions(+), 26 deletions(-) diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index 12db55efdc..75c3e9b492 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -546,7 +546,7 @@ module External { }, meta: { table, - } + }, } // can't really use response right now const response = await makeExternalQuery(appId, json) diff --git a/packages/server/src/automations/tests/automation.spec.js b/packages/server/src/automations/tests/automation.spec.js index 83b7b81a75..9444995ca1 100644 --- a/packages/server/src/automations/tests/automation.spec.js +++ b/packages/server/src/automations/tests/automation.spec.js @@ -13,8 +13,6 @@ const { makePartial } = require("../../tests/utilities") const { cleanInputValues } = require("../automationUtils") const setup = require("./utilities") -usageQuota.getAPIKey.mockReturnValue({ apiKey: "test" }) - describe("Run through some parts of the automations system", () => { let config = setup.getConfig() diff --git a/packages/server/src/automations/tests/createRow.spec.js b/packages/server/src/automations/tests/createRow.spec.js index 1004711d87..a04fc7aad4 100644 --- a/packages/server/src/automations/tests/createRow.spec.js +++ b/packages/server/src/automations/tests/createRow.spec.js @@ -46,7 +46,7 @@ describe("test the create row action", () => { await setup.runStep(setup.actions.CREATE_ROW.stepId, { row }) - expect(usageQuota.update).toHaveBeenCalledWith(setup.apiKey, "rows", 1) + expect(usageQuota.update).toHaveBeenCalledWith("rows", 1) }) }) diff --git a/packages/server/src/automations/tests/deleteRow.spec.js b/packages/server/src/automations/tests/deleteRow.spec.js index a3d73d3bf6..21246f22d0 100644 --- a/packages/server/src/automations/tests/deleteRow.spec.js +++ b/packages/server/src/automations/tests/deleteRow.spec.js @@ -37,7 +37,7 @@ describe("test the delete row action", () => { it("check usage quota attempts", async () => { await setup.runInProd(async () => { await setup.runStep(setup.actions.DELETE_ROW.stepId, inputs) - expect(usageQuota.update).toHaveBeenCalledWith(setup.apiKey, "rows", -1) + expect(usageQuota.update).toHaveBeenCalledWith("rows", -1) }) }) diff --git a/packages/server/src/definitions/datasource.ts b/packages/server/src/definitions/datasource.ts index d7d4e77961..2daef8eda7 100644 --- a/packages/server/src/definitions/datasource.ts +++ b/packages/server/src/definitions/datasource.ts @@ -1,4 +1,4 @@ -import {Table} from "./common"; +import { Table } from "./common" export enum Operation { CREATE = "CREATE", @@ -139,7 +139,7 @@ export interface QueryJson { paginate?: PaginationJson body?: object meta?: { - table?: Table, + table?: Table } extra?: { idFilter?: SearchFilters diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index 91af3e1a85..c5e9bdb0bb 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -148,7 +148,7 @@ function buildRead(knex: Knex, json: QueryJson, limit: number): KnexQuery { if (!resource) { resource = { fields: [] } } - let selectStatement: string|string[] = "*" + let selectStatement: string | string[] = "*" // handle select if (resource.fields && resource.fields.length > 0) { // select the resources as the format "table.columnName" - this is what is provided diff --git a/packages/server/src/integrations/mysql.ts b/packages/server/src/integrations/mysql.ts index d43ae86bea..c17cca0745 100644 --- a/packages/server/src/integrations/mysql.ts +++ b/packages/server/src/integrations/mysql.ts @@ -108,7 +108,7 @@ module MySQLModule { client: any, query: SqlQuery, connect: boolean = true - ): Promise { + ): Promise { // Node MySQL is callback based, so we must wrap our call in a promise return new Promise((resolve, reject) => { if (connect) { @@ -252,9 +252,9 @@ module MySQLModule { json.extra = { idFilter: { equal: { - [primaryKey]: results.insertId + [primaryKey]: results.insertId, }, - } + }, } return json } diff --git a/packages/server/src/middleware/tests/usageQuota.spec.js b/packages/server/src/middleware/tests/usageQuota.spec.js index 97d9c7794a..d828f2ca60 100644 --- a/packages/server/src/middleware/tests/usageQuota.spec.js +++ b/packages/server/src/middleware/tests/usageQuota.spec.js @@ -39,7 +39,7 @@ class TestConfiguration { if (bool) { env.isDev = () => false env.isProd = () => true - this.ctx.auth = { apiKey: "test" } + this.ctx.user = { tenantId: "test" } } else { env.isDev = () => true env.isProd = () => false @@ -114,7 +114,7 @@ describe("usageQuota middleware", () => { await config.executeMiddleware() - expect(usageQuota.update).toHaveBeenCalledWith("test", "rows", 1) + expect(usageQuota.update).toHaveBeenCalledWith("rows", 1) expect(config.next).toHaveBeenCalled() }) @@ -131,7 +131,7 @@ describe("usageQuota middleware", () => { ]) await config.executeMiddleware() - expect(usageQuota.update).toHaveBeenCalledWith("test", "storage", 10100) + expect(usageQuota.update).toHaveBeenCalledWith("storage", 10100) expect(config.next).toHaveBeenCalled() }) }) \ No newline at end of file diff --git a/packages/server/src/middleware/usageQuota.js b/packages/server/src/middleware/usageQuota.js index d18ffae205..d56a960615 100644 --- a/packages/server/src/middleware/usageQuota.js +++ b/packages/server/src/middleware/usageQuota.js @@ -50,15 +50,15 @@ module.exports = async (ctx, next) => { } // update usage for uploads to be the total size - // if (property === usageQuota.Properties.UPLOAD) { - // const files = - // ctx.request.files.file.length > 1 - // ? Array.from(ctx.request.files.file) - // : [ctx.request.files.file] - // usage = files.map(file => file.size).reduce((total, size) => total + size) - // } + if (property === usageQuota.Properties.UPLOAD) { + const files = + ctx.request.files.file.length > 1 + ? Array.from(ctx.request.files.file) + : [ctx.request.files.file] + usage = files.map(file => file.size).reduce((total, size) => total + size) + } try { - await usageQuota.update(ctx.user.tenantId, property, usage) + await usageQuota.update(property, usage) return next() } catch (err) { ctx.throw(400, err) diff --git a/packages/server/src/utilities/usageQuota.js b/packages/server/src/utilities/usageQuota.js index b98fb923cd..fb3f61f2f6 100644 --- a/packages/server/src/utilities/usageQuota.js +++ b/packages/server/src/utilities/usageQuota.js @@ -12,6 +12,7 @@ exports.Properties = { USER: "users", AUTOMATION: "automationRuns", APPS: "apps", + EMAILS: "emails", } /** @@ -28,7 +29,8 @@ exports.update = async (property, usage) => { try { const db = getGlobalDB() const quota = await db.get("usage_quota") - // TODO: check if the quota needs reset + + // Check if the quota needs reset if (Date.now() >= quota.quotaReset) { quota.quotaReset = getNewQuotaReset() for (let prop of Object.keys(quota.usageQuota)) { diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 61c2981280..c714f2b1ca 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -151,6 +151,7 @@ exports.adminUser = async ctx => { apps: 0, users: 0, views: 0, + emails: 0, }, usageLimits: { automationRuns: 1000, @@ -158,6 +159,7 @@ exports.adminUser = async ctx => { apps: 4, storage: 1000, users: 10, + emails: 50, }, }) // } diff --git a/packages/worker/src/environment.js b/packages/worker/src/environment.js index 646536f292..5f0556efc4 100644 --- a/packages/worker/src/environment.js +++ b/packages/worker/src/environment.js @@ -33,6 +33,11 @@ module.exports = { INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, MULTI_TENANCY: process.env.MULTI_TENANCY, ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL, + SMTP_USER: process.env.SMTP_USER, + SMTP_PASSWORD: process.env.SMTP_PASSWORD, + SMTP_HOST: process.env.SMTP_HOST, + SMTP_PORT: process.env.SMTP_PORT, + SMTP_FROM_ADDRESS: process.env.SMTP_FROM_ADDRESS, _set(key, value) { process.env[key] = value module.exports[key] = value diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index d22933ef36..5843cb28ea 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -1,4 +1,5 @@ const nodemailer = require("nodemailer") +const env = require("../environment") const { getScopedConfig } = require("@budibase/auth/db") const { EmailTemplatePurpose, TemplateTypes, Configs } = require("../constants") const { getTemplateByPurpose } = require("../constants/templates") @@ -110,7 +111,21 @@ async function getSmtpConfiguration(db, workspaceId = null) { if (workspaceId) { params.workspace = workspaceId } - return getScopedConfig(db, params) + + if (!env.SMTP_FALLBACK_ENABLED) { + return getScopedConfig(db, params) + } else { + // Use an SMTP fallback configuration from env variables + return { + port: env.SMTP_PORT, + host: env.SMTP_HOST, + secure: false, + auth: { + user: env.SMTP_USER, + pass: env.SMTP_PASSWORD, + }, + } + } } /** @@ -118,8 +133,8 @@ async function getSmtpConfiguration(db, workspaceId = null) { * @return {Promise} returns true if there is a configuration that can be used. */ exports.isEmailConfigured = async (workspaceId = null) => { - // when "testing" simply return true - if (TEST_MODE) { + // when "testing" or smtp fallback is enabled simply return true + if (TEST_MODE || env.SMTP_FALLBACK_ENABLED) { return true } const db = getGlobalDB() From 5b4bf74e2c438c0549d6945b8f41a83f3410460d Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 15:03:48 +0100 Subject: [PATCH 16/42] re-adding env var controls for cloud limit functionality --- packages/server/src/middleware/usageQuota.js | 8 ++-- packages/server/src/utilities/usageQuota.js | 9 ++-- .../src/api/controllers/global/users.js | 48 +++++++++---------- packages/worker/src/utilities/email.js | 6 ++- 4 files changed, 37 insertions(+), 34 deletions(-) diff --git a/packages/server/src/middleware/usageQuota.js b/packages/server/src/middleware/usageQuota.js index d56a960615..3a244ef5bc 100644 --- a/packages/server/src/middleware/usageQuota.js +++ b/packages/server/src/middleware/usageQuota.js @@ -1,6 +1,6 @@ const CouchDB = require("../db") const usageQuota = require("../utilities/usageQuota") -// const env = require("../environment") +const env = require("../environment") // currently only counting new writes and deletes const METHOD_MAP = { @@ -29,9 +29,9 @@ function getProperty(url) { module.exports = async (ctx, next) => { // if in development or a self hosted cloud usage quotas should not be executed - // if (env.isDev() || env.SELF_HOSTED) { - // return next() - // } + if (env.isDev() || env.SELF_HOSTED) { + return next() + } const db = new CouchDB(ctx.appId) let usage = METHOD_MAP[ctx.req.method] diff --git a/packages/server/src/utilities/usageQuota.js b/packages/server/src/utilities/usageQuota.js index fb3f61f2f6..4e645ec67d 100644 --- a/packages/server/src/utilities/usageQuota.js +++ b/packages/server/src/utilities/usageQuota.js @@ -1,4 +1,4 @@ -// const env = require("../environment") +const env = require("../environment") const { getGlobalDB } = require("@budibase/auth/tenancy") function getNewQuotaReset() { @@ -23,9 +23,10 @@ exports.Properties = { * also been reset after this call. */ exports.update = async (property, usage) => { - // if (!env.USE_QUOTAS) { - // return - // } + if (!env.USE_QUOTAS) { + return + } + try { const db = getGlobalDB() const quota = await db.get("usage_quota") diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index c714f2b1ca..e00fd3ecc0 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -17,7 +17,7 @@ const { tryAddTenant, updateTenantId, } = require("@budibase/auth/tenancy") -// const env = require("../../../environment") +const env = require("../../../environment") const PLATFORM_INFO_DB = StaticDatabases.PLATFORM_INFO.name @@ -140,29 +140,29 @@ exports.adminUser = async ctx => { ) // write usage quotas for cloud - // if (!env.SELF_HOSTED) { - await db.post({ - _id: "usage_quota", - quotaReset: Date.now() + 2592000000, - usageQuota: { - automationRuns: 0, - rows: 0, - storage: 0, - apps: 0, - users: 0, - views: 0, - emails: 0, - }, - usageLimits: { - automationRuns: 1000, - rows: 4000, - apps: 4, - storage: 1000, - users: 10, - emails: 50, - }, - }) - // } + if (!env.SELF_HOSTED) { + await db.post({ + _id: "usage_quota", + quotaReset: Date.now() + 2592000000, + usageQuota: { + automationRuns: 0, + rows: 0, + storage: 0, + apps: 0, + users: 0, + views: 0, + emails: 0, + }, + usageLimits: { + automationRuns: 1000, + rows: 4000, + apps: 4, + storage: 1000, + users: 10, + emails: 50, + }, + }) + } if (response.rows.some(row => row.doc.admin)) { ctx.throw( diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index 5843cb28ea..cd29170348 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -112,8 +112,10 @@ async function getSmtpConfiguration(db, workspaceId = null) { params.workspace = workspaceId } - if (!env.SMTP_FALLBACK_ENABLED) { - return getScopedConfig(db, params) + const customConfig = getScopedConfig(db, params) + + if (customConfig && !env.SMTP_FALLBACK_ENABLED) { + return customConfig } else { // Use an SMTP fallback configuration from env variables return { From c25bd4861696714c17d8b66e415a779809ac49c2 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 15:10:06 +0100 Subject: [PATCH 17/42] SMTP config fallback logic --- packages/worker/src/utilities/email.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index cd29170348..5fd8c05939 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -114,10 +114,12 @@ async function getSmtpConfiguration(db, workspaceId = null) { const customConfig = getScopedConfig(db, params) - if (customConfig && !env.SMTP_FALLBACK_ENABLED) { + if (customConfig) { return customConfig - } else { - // Use an SMTP fallback configuration from env variables + } + + // Use an SMTP fallback configuration from env variables + if (env.SMTP_FALLBACK_ENABLED) { return { port: env.SMTP_PORT, host: env.SMTP_HOST, From f9525b906538b5c6ae2f63d46fe3d543feb1d140 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 27 Sep 2021 14:25:00 +0000 Subject: [PATCH 18/42] v0.9.140-alpha.12 --- 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 e4dd4f4661..f3ea43dcc1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.11", + "version": "0.9.140-alpha.12", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 3be63010df..d42cb7b2c3 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.11", + "version": "0.9.140-alpha.12", "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 23f75a9565..e9aba805a9 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.11", + "version": "0.9.140-alpha.12", "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 4c0c6f1248..67ea2da45a 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.11", + "version": "0.9.140-alpha.12", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.11", - "@budibase/client": "^0.9.140-alpha.11", + "@budibase/bbui": "^0.9.140-alpha.12", + "@budibase/client": "^0.9.140-alpha.12", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.11", + "@budibase/string-templates": "^0.9.140-alpha.12", "@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 b71457a71a..f489f4635e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.11", + "version": "0.9.140-alpha.12", "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 8d387eb674..44ac4d6f2d 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.11", + "version": "0.9.140-alpha.12", "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.11", + "@budibase/bbui": "^0.9.140-alpha.12", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.11", + "@budibase/string-templates": "^0.9.140-alpha.12", "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 1e2dc602ae..3b13e4bd28 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.11", + "version": "0.9.140-alpha.12", "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.11", - "@budibase/client": "^0.9.140-alpha.11", - "@budibase/string-templates": "^0.9.140-alpha.11", + "@budibase/auth": "^0.9.140-alpha.12", + "@budibase/client": "^0.9.140-alpha.12", + "@budibase/string-templates": "^0.9.140-alpha.12", "@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 9ea3486427..1e73c0a708 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.11", + "version": "0.9.140-alpha.12", "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 be9ffabce5..94f3d0b577 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.11", + "version": "0.9.140-alpha.12", "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.11", - "@budibase/string-templates": "^0.9.140-alpha.11", + "@budibase/auth": "^0.9.140-alpha.12", + "@budibase/string-templates": "^0.9.140-alpha.12", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 2da28ecc71942670cecb277d8ce5a0a0f46ac908 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 16:28:39 +0100 Subject: [PATCH 19/42] prevent SMTP fallback for automations --- .../server/src/automations/steps/sendSmtpEmail.js | 2 +- packages/server/src/utilities/workerRequests.js | 3 ++- .../worker/src/api/controllers/global/email.js | 13 +++++++++++-- packages/worker/src/utilities/email.js | 14 ++++++++------ 4 files changed, 22 insertions(+), 10 deletions(-) diff --git a/packages/server/src/automations/steps/sendSmtpEmail.js b/packages/server/src/automations/steps/sendSmtpEmail.js index 9e4b5a6a3c..07a3059215 100644 --- a/packages/server/src/automations/steps/sendSmtpEmail.js +++ b/packages/server/src/automations/steps/sendSmtpEmail.js @@ -53,7 +53,7 @@ exports.run = async function ({ inputs }) { contents = "

No content

" } try { - let response = await sendSmtpEmail(to, from, subject, contents) + let response = await sendSmtpEmail(to, from, subject, contents, true) return { success: true, response, diff --git a/packages/server/src/utilities/workerRequests.js b/packages/server/src/utilities/workerRequests.js index 377658084f..2ace265ca0 100644 --- a/packages/server/src/utilities/workerRequests.js +++ b/packages/server/src/utilities/workerRequests.js @@ -34,7 +34,7 @@ function request(ctx, request) { exports.request = request // have to pass in the tenant ID as this could be coming from an automation -exports.sendSmtpEmail = async (to, from, subject, contents) => { +exports.sendSmtpEmail = async (to, from, subject, contents, automation) => { // tenant ID will be set in header const response = await fetch( checkSlashesInUrl(env.WORKER_URL + `/api/global/email/send`), @@ -46,6 +46,7 @@ exports.sendSmtpEmail = async (to, from, subject, contents) => { contents, subject, purpose: "custom", + automation, }, }) ) diff --git a/packages/worker/src/api/controllers/global/email.js b/packages/worker/src/api/controllers/global/email.js index 57b78a6d7a..e194a30862 100644 --- a/packages/worker/src/api/controllers/global/email.js +++ b/packages/worker/src/api/controllers/global/email.js @@ -2,8 +2,16 @@ const { sendEmail } = require("../../../utilities/email") const { getGlobalDB } = require("@budibase/auth/tenancy") exports.sendEmail = async ctx => { - let { workspaceId, email, userId, purpose, contents, from, subject } = - ctx.request.body + let { + workspaceId, + email, + userId, + purpose, + contents, + from, + subject, + automation, + } = ctx.request.body let user if (userId) { const db = getGlobalDB() @@ -15,6 +23,7 @@ exports.sendEmail = async ctx => { contents, from, subject, + automation, }) ctx.body = { ...response, diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index 5fd8c05939..14c836952e 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -102,9 +102,10 @@ async function buildEmail(purpose, email, context, { user, contents } = {}) { * Utility function for finding most valid SMTP configuration. * @param {object} db The CouchDB database which is to be looked up within. * @param {string|null} workspaceId If using finer grain control of configs a workspace can be used. + * @param {boolean|null} automation Whether or not the configuration is being fetched for an email automation. * @return {Promise} returns the SMTP configuration if it exists */ -async function getSmtpConfiguration(db, workspaceId = null) { +async function getSmtpConfiguration(db, workspaceId = null, automation) { const params = { type: Configs.SMTP, } @@ -116,10 +117,10 @@ async function getSmtpConfiguration(db, workspaceId = null) { if (customConfig) { return customConfig - } - + } + // Use an SMTP fallback configuration from env variables - if (env.SMTP_FALLBACK_ENABLED) { + if (!automation && env.SMTP_FALLBACK_ENABLED) { return { port: env.SMTP_PORT, host: env.SMTP_HOST, @@ -157,16 +158,17 @@ exports.isEmailConfigured = async (workspaceId = null) => { * @param {string|undefined} contents If sending a custom email then can supply contents which will be added to it. * @param {string|undefined} subject A custom subject can be specified if the config one is not desired. * @param {object|undefined} info Pass in a structure of information to be stored alongside the invitation. + * @param {boolean|undefined} disableFallback Prevent email being sent from SMTP fallback to avoid spam. * @return {Promise} returns details about the attempt to send email, e.g. if it is successful; based on * nodemailer response. */ exports.sendEmail = async ( email, purpose, - { workspaceId, user, from, contents, subject, info } = {} + { workspaceId, user, from, contents, subject, info, automation } = {} ) => { const db = getGlobalDB() - let config = (await getSmtpConfiguration(db, workspaceId)) || {} + let config = (await getSmtpConfiguration(db, workspaceId, automation)) || {} if (Object.keys(config).length === 0 && !TEST_MODE) { throw "Unable to find SMTP configuration." } From 42d9e0a482ce57775ccf00f3dd3023055e927e4e Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Mon, 27 Sep 2021 16:37:26 +0100 Subject: [PATCH 20/42] Remove platform url in the cloud, remove analytics picker completely --- packages/builder/src/analytics/index.js | 18 +------- .../portal/settings/organisation.svelte | 44 ++++++------------- packages/server/package.json | 4 +- 3 files changed, 18 insertions(+), 48 deletions(-) diff --git a/packages/builder/src/analytics/index.js b/packages/builder/src/analytics/index.js index b79ab67e0c..e9edf38d74 100644 --- a/packages/builder/src/analytics/index.js +++ b/packages/builder/src/analytics/index.js @@ -3,8 +3,6 @@ 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, @@ -19,27 +17,13 @@ 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() - // Multitenancy disabled on the backend + // Analytics disabled 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.clients.forEach(client => client.init()) - this.enabled = true } identify(id, metadata) { diff --git a/packages/builder/src/pages/builder/portal/settings/organisation.svelte b/packages/builder/src/pages/builder/portal/settings/organisation.svelte index 79eaebb28b..a182103c4e 100644 --- a/packages/builder/src/pages/builder/portal/settings/organisation.svelte +++ b/packages/builder/src/pages/builder/portal/settings/organisation.svelte @@ -7,13 +7,11 @@ Divider, Label, Input, - Toggle, Dropzone, notifications, } from "@budibase/bbui" - import { auth, organisation } from "stores/portal" + import { auth, organisation, admin } from "stores/portal" import { post } from "builderStore/api" - import analytics from "analytics" import { writable } from "svelte/store" import { redirect } from "@roxi/routify" @@ -25,7 +23,6 @@ } const values = writable({ - analytics: analytics.enabled, company: $organisation.company, platformUrl: $organisation.platformUrl, logo: $organisation.logoUrl @@ -57,7 +54,6 @@ const config = { company: $values.company ?? "", platformUrl: $values.platformUrl ?? "", - analytics: $values.analytics, } // remove logo if required if (!$values.logo) { @@ -112,34 +108,22 @@ - - - Platform - Here you can set up general platform settings. - -
-
- - -
-
- - + {#if !$admin.cloud} + - Analytics - - If you would like to send analytics that help us make Budibase better, - please let us know below. - + Platform + Here you can set up general platform settings. - -
- +
+
+ + +
- + {/if} +
+ +
{/if} diff --git a/packages/server/package.json b/packages/server/package.json index 1e2dc602ae..a038e03960 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -25,7 +25,9 @@ "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" + "multi:disable": "node scripts/multiTenancy.js disable", + "selfhost:enable": "node scripts/selfhost.js enable", + "selfhost:disable": "node scripts/selfhost.js disable" }, "jest": { "preset": "ts-jest", From f6014190c8860cc1529e1be50dad77eaed3337f7 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 16:39:08 +0100 Subject: [PATCH 21/42] tests --- packages/server/src/api/routes/view.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/server/src/api/routes/view.js b/packages/server/src/api/routes/view.js index 7d390805c6..f096dd4185 100644 --- a/packages/server/src/api/routes/view.js +++ b/packages/server/src/api/routes/view.js @@ -25,9 +25,8 @@ router "/api/views/:viewName", paramResource("viewName"), authorized(BUILDER), - usage, viewController.destroy ) - .post("/api/views", authorized(BUILDER), usage, viewController.save) + .post("/api/views", authorized(BUILDER), viewController.save) module.exports = router From 1e3fca15c5a18b837b9222a72e35c09cb8dad16f Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 27 Sep 2021 17:35:22 +0100 Subject: [PATCH 22/42] abstract usagedoc creation into auth, create the doc if it doesn't exist --- packages/auth/src/db/constants.js | 1 + packages/auth/src/db/utils.js | 25 +++++++++++++++++++ packages/server/src/api/routes/user.js | 2 -- packages/server/src/api/routes/view.js | 1 - packages/server/src/utilities/usageQuota.js | 18 ++++++++++++- .../src/api/controllers/global/users.js | 23 ++--------------- 6 files changed, 45 insertions(+), 25 deletions(-) diff --git a/packages/auth/src/db/constants.js b/packages/auth/src/db/constants.js index 77643ce4c5..ad4f6c9f66 100644 --- a/packages/auth/src/db/constants.js +++ b/packages/auth/src/db/constants.js @@ -12,6 +12,7 @@ exports.StaticDatabases = { name: "global-info", docs: { tenants: "tenants", + usageQuota: "usage_quota", }, }, } diff --git a/packages/auth/src/db/utils.js b/packages/auth/src/db/utils.js index a1a831523e..09e2ff6314 100644 --- a/packages/auth/src/db/utils.js +++ b/packages/auth/src/db/utils.js @@ -368,8 +368,33 @@ async function getScopedConfig(db, params) { return configDoc && configDoc.config ? configDoc.config : configDoc } +function generateNewUsageQuotaDoc() { + return { + _id: StaticDatabases.PLATFORM_INFO.docs.usageQuota, + quotaReset: Date.now() + 2592000000, + usageQuota: { + automationRuns: 0, + rows: 0, + storage: 0, + apps: 0, + users: 0, + views: 0, + emails: 0, + }, + usageLimits: { + automationRuns: 1000, + rows: 4000, + apps: 4, + storage: 1000, + users: 10, + emails: 50, + }, + } +} + exports.Replication = Replication exports.getScopedConfig = getScopedConfig exports.generateConfigID = generateConfigID exports.getConfigParams = getConfigParams exports.getScopedFullConfig = getScopedFullConfig +exports.generateNewUsageQuotaDoc = generateNewUsageQuotaDoc diff --git a/packages/server/src/api/routes/user.js b/packages/server/src/api/routes/user.js index 465fef82c8..d171870215 100644 --- a/packages/server/src/api/routes/user.js +++ b/packages/server/src/api/routes/user.js @@ -27,13 +27,11 @@ router .post( "/api/users/metadata/self", authorized(PermissionTypes.USER, PermissionLevels.WRITE), - // usage, controller.updateSelfMetadata ) .delete( "/api/users/metadata/:id", authorized(PermissionTypes.USER, PermissionLevels.WRITE), - // usage, controller.destroyMetadata ) diff --git a/packages/server/src/api/routes/view.js b/packages/server/src/api/routes/view.js index f096dd4185..b72fe1ac26 100644 --- a/packages/server/src/api/routes/view.js +++ b/packages/server/src/api/routes/view.js @@ -8,7 +8,6 @@ const { PermissionTypes, PermissionLevels, } = require("@budibase/auth/permissions") -const usage = require("../../middleware/usageQuota") const router = Router() diff --git a/packages/server/src/utilities/usageQuota.js b/packages/server/src/utilities/usageQuota.js index 4e645ec67d..80fddb8303 100644 --- a/packages/server/src/utilities/usageQuota.js +++ b/packages/server/src/utilities/usageQuota.js @@ -1,5 +1,9 @@ const env = require("../environment") const { getGlobalDB } = require("@budibase/auth/tenancy") +const { + StaticDatabases, + generateNewUsageQuotaDoc, +} = require("@budibase/auth/db") function getNewQuotaReset() { return Date.now() + 2592000000 @@ -15,6 +19,18 @@ exports.Properties = { EMAILS: "emails", } +async function getUsageQuotaDoc(db) { + let quota + try { + quota = await db.get(StaticDatabases.PLATFORM_INFO.docs.usageQuota) + } catch (err) { + // doc doesn't exist. Create it + quota = await db.post(generateNewUsageQuotaDoc()) + } + + return quota +} + /** * Given a specified tenantId this will add to the usage object for the specified property. * @param {string} property The property which is to be added to (within the nested usageQuota object). @@ -29,7 +45,7 @@ exports.update = async (property, usage) => { try { const db = getGlobalDB() - const quota = await db.get("usage_quota") + const quota = await getUsageQuotaDoc(db) // Check if the quota needs reset if (Date.now() >= quota.quotaReset) { diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index e00fd3ecc0..1d3f38698b 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -2,6 +2,7 @@ const { generateGlobalUserID, getGlobalUserParams, StaticDatabases, + generateNewUsageQuotaDoc, } = require("@budibase/auth/db") const { hash, getGlobalUserByEmail } = require("@budibase/auth").utils const { UserStatus, EmailTemplatePurpose } = require("../../../constants") @@ -141,27 +142,7 @@ exports.adminUser = async ctx => { // write usage quotas for cloud if (!env.SELF_HOSTED) { - await db.post({ - _id: "usage_quota", - quotaReset: Date.now() + 2592000000, - usageQuota: { - automationRuns: 0, - rows: 0, - storage: 0, - apps: 0, - users: 0, - views: 0, - emails: 0, - }, - usageLimits: { - automationRuns: 1000, - rows: 4000, - apps: 4, - storage: 1000, - users: 10, - emails: 50, - }, - }) + await db.post(generateNewUsageQuotaDoc()) } if (response.rows.some(row => row.doc.admin)) { From b2b13dc719b792c23853ea3f1a8b4c02ca3e435d Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 27 Sep 2021 17:39:48 +0000 Subject: [PATCH 23/42] v0.9.140-alpha.13 --- 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 f3ea43dcc1..faa0bb0841 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.140-alpha.12", + "version": "0.9.140-alpha.13", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index d42cb7b2c3..6c87de2810 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.140-alpha.12", + "version": "0.9.140-alpha.13", "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 e9aba805a9..cb54317f6d 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.12", + "version": "0.9.140-alpha.13", "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 67ea2da45a..02fdaffc11 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.140-alpha.12", + "version": "0.9.140-alpha.13", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.140-alpha.12", - "@budibase/client": "^0.9.140-alpha.12", + "@budibase/bbui": "^0.9.140-alpha.13", + "@budibase/client": "^0.9.140-alpha.13", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.140-alpha.12", + "@budibase/string-templates": "^0.9.140-alpha.13", "@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 f489f4635e..9c0f45ea30 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.140-alpha.12", + "version": "0.9.140-alpha.13", "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 44ac4d6f2d..4974ada5d0 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.140-alpha.12", + "version": "0.9.140-alpha.13", "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.12", + "@budibase/bbui": "^0.9.140-alpha.13", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.140-alpha.12", + "@budibase/string-templates": "^0.9.140-alpha.13", "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 3b13e4bd28..cb162c3806 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.12", + "version": "0.9.140-alpha.13", "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.12", - "@budibase/client": "^0.9.140-alpha.12", - "@budibase/string-templates": "^0.9.140-alpha.12", + "@budibase/auth": "^0.9.140-alpha.13", + "@budibase/client": "^0.9.140-alpha.13", + "@budibase/string-templates": "^0.9.140-alpha.13", "@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 1e73c0a708..6b37bcf5ab 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.12", + "version": "0.9.140-alpha.13", "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 94f3d0b577..97332b1412 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.12", + "version": "0.9.140-alpha.13", "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.12", - "@budibase/string-templates": "^0.9.140-alpha.12", + "@budibase/auth": "^0.9.140-alpha.13", + "@budibase/string-templates": "^0.9.140-alpha.13", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From ece3010c4e19ca81b4be226e8d156e923a85332a Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Mon, 27 Sep 2021 21:39:06 +0000 Subject: [PATCH 24/42] v0.9.143-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 a8cda22a63..01c429c73d 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.142", + "version": "0.9.143-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index f62e4cb5e6..0457520d91 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.142", + "version": "0.9.143-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 ddede26a86..42e4215caa 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.142", + "version": "0.9.143-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 7ab313974b..2c255835ce 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.142", + "version": "0.9.143-alpha.0", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.142", - "@budibase/client": "^0.9.142", + "@budibase/bbui": "^0.9.143-alpha.0", + "@budibase/client": "^0.9.143-alpha.0", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.142", + "@budibase/string-templates": "^0.9.143-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 0340759e45..29763b9da6 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.142", + "version": "0.9.143-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 3d25a1b5d6..f9777629f4 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.142", + "version": "0.9.143-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.142", + "@budibase/bbui": "^0.9.143-alpha.0", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.142", + "@budibase/string-templates": "^0.9.143-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 fff341dd57..ad289e8c0d 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.142", + "version": "0.9.143-alpha.0", "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.142", - "@budibase/client": "^0.9.142", - "@budibase/string-templates": "^0.9.142", + "@budibase/auth": "^0.9.143-alpha.0", + "@budibase/client": "^0.9.143-alpha.0", + "@budibase/string-templates": "^0.9.143-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 44a3290696..9b3c2487b9 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.142", + "version": "0.9.143-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 83e53e9b45..a1cd5c90e1 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.142", + "version": "0.9.143-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.142", - "@budibase/string-templates": "^0.9.142", + "@budibase/auth": "^0.9.143-alpha.0", + "@budibase/string-templates": "^0.9.143-alpha.0", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 0806e69010d7df91d4684c61e113ec4c07d218b6 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 28 Sep 2021 10:15:48 +0100 Subject: [PATCH 25/42] Temp account portal logging --- packages/auth/src/middleware/authenticated.js | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/packages/auth/src/middleware/authenticated.js b/packages/auth/src/middleware/authenticated.js index 944f3ee9d9..98773ded44 100644 --- a/packages/auth/src/middleware/authenticated.js +++ b/packages/auth/src/middleware/authenticated.js @@ -10,10 +10,15 @@ function finalise( { authenticated, user, internal, version, publicEndpoint } = {} ) { ctx.publicEndpoint = publicEndpoint || false + console.log("Temp Auth Middleware: public endoint", ctx.publicEndpoint) ctx.isAuthenticated = authenticated || false + console.log("Temp Auth Middleware: isAuthenticated", ctx.isAuthenticated) ctx.user = user + console.log("Temp Auth Middleware: user", ctx.user) ctx.internal = internal || false + console.log("Temp Auth Middleware: internal", ctx.internal) ctx.version = version + console.log("Temp Auth Middleware: version", ctx.version) } /** @@ -27,40 +32,50 @@ module.exports = ( ) => { const noAuthOptions = noAuthPatterns ? buildMatcherRegex(noAuthPatterns) : [] return async (ctx, next) => { + console.log("Temp Auth Middleware: Start auth middleware") let publicEndpoint = false const version = ctx.request.headers[Headers.API_VER] // the path is not authenticated const found = matches(ctx, noAuthOptions) if (found) { + console.log("Temp Auth Middleware: Public endpoint found") publicEndpoint = true } try { + console.log("Temp Auth Middleware: Parsing cookie") // check the actual user is authenticated first const authCookie = getCookie(ctx, Cookies.Auth) let authenticated = false, user = null, internal = false if (authCookie) { + console.log("Temp Auth Middleware: Auth cookie found") let error = null const sessionId = authCookie.sessionId, userId = authCookie.userId + console.log("Temp Auth Middleware: Getting session") const session = await getSession(userId, sessionId) if (!session) { error = "No session found" } else { try { + console.log("Temp Auth Middleware: Getting user") if (opts && opts.populateUser) { + console.log("Temp Auth Middleware: Populate user function found") user = await getUser( userId, session.tenantId, opts.populateUser(ctx) ) } else { + console.log("Temp Auth Middleware: Getting user from DB") user = await getUser(userId, session.tenantId) } delete user.password + console.log("Temp Auth Middleware: User is authenticated") authenticated = true } catch (err) { + console.log("Temp Auth Middleware: Holy shit there was an error") error = err } } @@ -69,6 +84,7 @@ module.exports = ( // remove the cookie as the user does not exist anymore clearCookie(ctx, Cookies.Auth) } else { + console.log("Temp Auth Middleware: No error") // make sure we denote that the session is still in use await updateSessionTTL(session) } @@ -87,14 +103,23 @@ module.exports = ( if (authenticated !== true) { authenticated = false } + console.log("Temp Auth Middleware: Auth status", { + authenticated, + user, + internal, + version, + publicEndpoint, + }) // isAuthenticated is a function, so use a variable to be able to check authed state finalise(ctx, { authenticated, user, internal, version, publicEndpoint }) return next() } catch (err) { + console.log("Temp Auth Middleware: Error:", err) // allow configuring for public access if ((opts && opts.publicAllowed) || publicEndpoint) { finalise(ctx, { authenticated: false, version, publicEndpoint }) } else { + console.log("Temp Auth Middleware: Throwing error status", err.status) ctx.throw(err.status || 403, err) } } From 9e8b14f0fbf6d86229c15071eb294570a026b4c5 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 09:24:39 +0000 Subject: [PATCH 26/42] v0.9.143-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 01c429c73d..df7816b085 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.0", + "version": "0.9.143-alpha.1", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 0457520d91..98c2c978f8 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.0", + "version": "0.9.143-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 42e4215caa..c25d4dd85e 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.143-alpha.0", + "version": "0.9.143-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 2c255835ce..1846c445aa 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.0", + "version": "0.9.143-alpha.1", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.0", - "@budibase/client": "^0.9.143-alpha.0", + "@budibase/bbui": "^0.9.143-alpha.1", + "@budibase/client": "^0.9.143-alpha.1", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.0", + "@budibase/string-templates": "^0.9.143-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 29763b9da6..f9d81ed830 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.0", + "version": "0.9.143-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 f9777629f4..5bd6cdfb71 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.0", + "version": "0.9.143-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.143-alpha.0", + "@budibase/bbui": "^0.9.143-alpha.1", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.0", + "@budibase/string-templates": "^0.9.143-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 ad289e8c0d..ba5bdce69b 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.143-alpha.0", + "version": "0.9.143-alpha.1", "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.143-alpha.0", - "@budibase/client": "^0.9.143-alpha.0", - "@budibase/string-templates": "^0.9.143-alpha.0", + "@budibase/auth": "^0.9.143-alpha.1", + "@budibase/client": "^0.9.143-alpha.1", + "@budibase/string-templates": "^0.9.143-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 9b3c2487b9..469a3eebb5 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.0", + "version": "0.9.143-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 a1cd5c90e1..2952e2bda3 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.143-alpha.0", + "version": "0.9.143-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.143-alpha.0", - "@budibase/string-templates": "^0.9.143-alpha.0", + "@budibase/auth": "^0.9.143-alpha.1", + "@budibase/string-templates": "^0.9.143-alpha.1", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From df261bf3ea68044c173ad237efdb88d547f08e0e Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 28 Sep 2021 11:33:07 +0100 Subject: [PATCH 27/42] Revert "Temp account portal logging" --- packages/auth/src/middleware/authenticated.js | 25 ------------------- 1 file changed, 25 deletions(-) diff --git a/packages/auth/src/middleware/authenticated.js b/packages/auth/src/middleware/authenticated.js index 98773ded44..944f3ee9d9 100644 --- a/packages/auth/src/middleware/authenticated.js +++ b/packages/auth/src/middleware/authenticated.js @@ -10,15 +10,10 @@ function finalise( { authenticated, user, internal, version, publicEndpoint } = {} ) { ctx.publicEndpoint = publicEndpoint || false - console.log("Temp Auth Middleware: public endoint", ctx.publicEndpoint) ctx.isAuthenticated = authenticated || false - console.log("Temp Auth Middleware: isAuthenticated", ctx.isAuthenticated) ctx.user = user - console.log("Temp Auth Middleware: user", ctx.user) ctx.internal = internal || false - console.log("Temp Auth Middleware: internal", ctx.internal) ctx.version = version - console.log("Temp Auth Middleware: version", ctx.version) } /** @@ -32,50 +27,40 @@ module.exports = ( ) => { const noAuthOptions = noAuthPatterns ? buildMatcherRegex(noAuthPatterns) : [] return async (ctx, next) => { - console.log("Temp Auth Middleware: Start auth middleware") let publicEndpoint = false const version = ctx.request.headers[Headers.API_VER] // the path is not authenticated const found = matches(ctx, noAuthOptions) if (found) { - console.log("Temp Auth Middleware: Public endpoint found") publicEndpoint = true } try { - console.log("Temp Auth Middleware: Parsing cookie") // check the actual user is authenticated first const authCookie = getCookie(ctx, Cookies.Auth) let authenticated = false, user = null, internal = false if (authCookie) { - console.log("Temp Auth Middleware: Auth cookie found") let error = null const sessionId = authCookie.sessionId, userId = authCookie.userId - console.log("Temp Auth Middleware: Getting session") const session = await getSession(userId, sessionId) if (!session) { error = "No session found" } else { try { - console.log("Temp Auth Middleware: Getting user") if (opts && opts.populateUser) { - console.log("Temp Auth Middleware: Populate user function found") user = await getUser( userId, session.tenantId, opts.populateUser(ctx) ) } else { - console.log("Temp Auth Middleware: Getting user from DB") user = await getUser(userId, session.tenantId) } delete user.password - console.log("Temp Auth Middleware: User is authenticated") authenticated = true } catch (err) { - console.log("Temp Auth Middleware: Holy shit there was an error") error = err } } @@ -84,7 +69,6 @@ module.exports = ( // remove the cookie as the user does not exist anymore clearCookie(ctx, Cookies.Auth) } else { - console.log("Temp Auth Middleware: No error") // make sure we denote that the session is still in use await updateSessionTTL(session) } @@ -103,23 +87,14 @@ module.exports = ( if (authenticated !== true) { authenticated = false } - console.log("Temp Auth Middleware: Auth status", { - authenticated, - user, - internal, - version, - publicEndpoint, - }) // isAuthenticated is a function, so use a variable to be able to check authed state finalise(ctx, { authenticated, user, internal, version, publicEndpoint }) return next() } catch (err) { - console.log("Temp Auth Middleware: Error:", err) // allow configuring for public access if ((opts && opts.publicAllowed) || publicEndpoint) { finalise(ctx, { authenticated: false, version, publicEndpoint }) } else { - console.log("Temp Auth Middleware: Throwing error status", err.status) ctx.throw(err.status || 403, err) } } From 5605209a7a4ede4471536cb24ed0d82e42f0e719 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 10:53:02 +0000 Subject: [PATCH 28/42] v0.9.143-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 df7816b085..8c5b3e450b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.1", + "version": "0.9.143-alpha.2", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 98c2c978f8..7e880c1e4c 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.1", + "version": "0.9.143-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 c25d4dd85e..f3fcfd4644 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.143-alpha.1", + "version": "0.9.143-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 1846c445aa..7728c462be 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.1", + "version": "0.9.143-alpha.2", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.1", - "@budibase/client": "^0.9.143-alpha.1", + "@budibase/bbui": "^0.9.143-alpha.2", + "@budibase/client": "^0.9.143-alpha.2", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.1", + "@budibase/string-templates": "^0.9.143-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 f9d81ed830..dc3843905c 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.1", + "version": "0.9.143-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 5bd6cdfb71..d8b44711b5 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.1", + "version": "0.9.143-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.143-alpha.1", + "@budibase/bbui": "^0.9.143-alpha.2", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.1", + "@budibase/string-templates": "^0.9.143-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 63d74cff2d..061cd30915 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.143-alpha.1", + "version": "0.9.143-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.143-alpha.1", - "@budibase/client": "^0.9.143-alpha.1", - "@budibase/string-templates": "^0.9.143-alpha.1", + "@budibase/auth": "^0.9.143-alpha.2", + "@budibase/client": "^0.9.143-alpha.2", + "@budibase/string-templates": "^0.9.143-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 469a3eebb5..293ea677fb 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.1", + "version": "0.9.143-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 2952e2bda3..2d47d3c8c1 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.143-alpha.1", + "version": "0.9.143-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.143-alpha.1", - "@budibase/string-templates": "^0.9.143-alpha.1", + "@budibase/auth": "^0.9.143-alpha.2", + "@budibase/string-templates": "^0.9.143-alpha.2", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From fc8aa07bf4b388984af44706e6c15d5ea5ec5262 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 12:21:31 +0000 Subject: [PATCH 29/42] v0.9.143-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 8c5b3e450b..f90cdc25b7 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.2", + "version": "0.9.143-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 7e880c1e4c..e24a365ba9 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.2", + "version": "0.9.143-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 f3fcfd4644..fbf1c0e282 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.143-alpha.2", + "version": "0.9.143-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 7728c462be..14795f0dc1 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.2", + "version": "0.9.143-alpha.3", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.2", - "@budibase/client": "^0.9.143-alpha.2", + "@budibase/bbui": "^0.9.143-alpha.3", + "@budibase/client": "^0.9.143-alpha.3", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.2", + "@budibase/string-templates": "^0.9.143-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 dc3843905c..84de82a3db 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.2", + "version": "0.9.143-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 d8b44711b5..184fc8290c 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.2", + "version": "0.9.143-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.143-alpha.2", + "@budibase/bbui": "^0.9.143-alpha.3", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.2", + "@budibase/string-templates": "^0.9.143-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 061cd30915..0f653637ec 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.143-alpha.2", + "version": "0.9.143-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.143-alpha.2", - "@budibase/client": "^0.9.143-alpha.2", - "@budibase/string-templates": "^0.9.143-alpha.2", + "@budibase/auth": "^0.9.143-alpha.3", + "@budibase/client": "^0.9.143-alpha.3", + "@budibase/string-templates": "^0.9.143-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 293ea677fb..857573d827 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.2", + "version": "0.9.143-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 2d47d3c8c1..2ce25d2a74 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.143-alpha.2", + "version": "0.9.143-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.143-alpha.2", - "@budibase/string-templates": "^0.9.143-alpha.2", + "@budibase/auth": "^0.9.143-alpha.3", + "@budibase/string-templates": "^0.9.143-alpha.3", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 2b2697a34e0e720059d3788ab3aaeda436794abc Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 28 Sep 2021 13:33:15 +0100 Subject: [PATCH 30/42] Fixing issue with refreshing data providers manually due to incorrect action name --- .../EventsEditor/actions/RefreshDataProvider.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDataProvider.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDataProvider.svelte index fe251a0320..93ddca8c3f 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDataProvider.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/EventsEditor/actions/RefreshDataProvider.svelte @@ -8,7 +8,7 @@ $: actionProviders = getActionProviderComponents( $currentAsset, $store.selectedComponentId, - "RefreshDataProvider" + "RefreshDatasource" ) From c03b9afbee0ae2b8295efb5a899c500ae8614c82 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 12:41:39 +0000 Subject: [PATCH 31/42] v0.9.143-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 f90cdc25b7..71be7bfa92 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.3", + "version": "0.9.143-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index e24a365ba9..edf2a0ad17 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.3", + "version": "0.9.143-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 fbf1c0e282..81a7a3b077 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.143-alpha.3", + "version": "0.9.143-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 14795f0dc1..82bebadbf2 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.3", + "version": "0.9.143-alpha.4", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.3", - "@budibase/client": "^0.9.143-alpha.3", + "@budibase/bbui": "^0.9.143-alpha.4", + "@budibase/client": "^0.9.143-alpha.4", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.3", + "@budibase/string-templates": "^0.9.143-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 84de82a3db..57878e2929 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.3", + "version": "0.9.143-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 184fc8290c..d4a4a24ba9 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.3", + "version": "0.9.143-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.143-alpha.3", + "@budibase/bbui": "^0.9.143-alpha.4", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.3", + "@budibase/string-templates": "^0.9.143-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 0f653637ec..07f11c8161 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.143-alpha.3", + "version": "0.9.143-alpha.4", "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.143-alpha.3", - "@budibase/client": "^0.9.143-alpha.3", - "@budibase/string-templates": "^0.9.143-alpha.3", + "@budibase/auth": "^0.9.143-alpha.4", + "@budibase/client": "^0.9.143-alpha.4", + "@budibase/string-templates": "^0.9.143-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 857573d827..bae80e4ca6 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.3", + "version": "0.9.143-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 2ce25d2a74..29e8137932 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.143-alpha.3", + "version": "0.9.143-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.143-alpha.3", - "@budibase/string-templates": "^0.9.143-alpha.3", + "@budibase/auth": "^0.9.143-alpha.4", + "@budibase/string-templates": "^0.9.143-alpha.4", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From b964813fad402aa06b54c8e07c070e58d86ab2cf Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 28 Sep 2021 15:22:19 +0100 Subject: [PATCH 32/42] Prevent root account users being re-created as internal budibase users --- packages/auth/accounts.js | 1 + packages/worker/src/api/controllers/global/users.js | 10 ++++++++++ 2 files changed, 11 insertions(+) create mode 100644 packages/auth/accounts.js diff --git a/packages/auth/accounts.js b/packages/auth/accounts.js new file mode 100644 index 0000000000..47ad03456a --- /dev/null +++ b/packages/auth/accounts.js @@ -0,0 +1 @@ +module.exports = require("./src/cloud/accounts") diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 1d3f38698b..9d2d27a05c 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -11,6 +11,7 @@ const { sendEmail } = require("../../../utilities/email") const { user: userCache } = require("@budibase/auth/cache") const { invalidateSessions } = require("@budibase/auth/sessions") const CouchDB = require("../../../db") +const accounts = require("@budibase/auth/accounts") const { getGlobalDB, getTenantId, @@ -49,10 +50,19 @@ async function saveUser( // make sure another user isn't using the same email let dbUser if (email) { + // check budibase users inside the tenant dbUser = await getGlobalUserByEmail(email) if (dbUser != null && (dbUser._id !== _id || Array.isArray(dbUser))) { throw "Email address already in use." } + + // check root account users in account portal + if (!env.SELF_HOSTED) { + const account = await accounts.getAccount(email) + if (account) { + throw "Email address already in use." + } + } } else { dbUser = await db.get(_id) } From 4b30a4e7ef0a6251c3f5ce8d18b6e190f84da62b Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 28 Sep 2021 15:49:03 +0100 Subject: [PATCH 33/42] Prevent duplicate internal budibase users across tenants --- .../src/api/controllers/global/users.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/packages/worker/src/api/controllers/global/users.js b/packages/worker/src/api/controllers/global/users.js index 9d2d27a05c..7753370f09 100644 --- a/packages/worker/src/api/controllers/global/users.js +++ b/packages/worker/src/api/controllers/global/users.js @@ -56,6 +56,14 @@ async function saveUser( throw "Email address already in use." } + // check budibase users in other tenants + if (env.MULTI_TENANCY) { + dbUser = await getTenantUser(email) + if (dbUser != null) { + throw "Email address already in use." + } + } + // check root account users in account portal if (!env.SELF_HOSTED) { const account = await accounts.getAccount(email) @@ -277,13 +285,22 @@ exports.find = async ctx => { ctx.body = user } -exports.tenantUserLookup = async ctx => { - const id = ctx.params.id - // lookup, could be email or userId, either will return a doc +// lookup, could be email or userId, either will return a doc +const getTenantUser = async identifier => { const db = new CouchDB(PLATFORM_INFO_DB) try { - ctx.body = await db.get(id) + return await db.get(identifier) } catch (err) { + return null + } +} + +exports.tenantUserLookup = async ctx => { + const id = ctx.params.id + const user = await getTenantUser(id) + if (user) { + ctx.body = user + } else { ctx.throw(400, "No tenant user found.") } } From 0518bac62eaa4d71ddd75b36625562295be29b1f Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Tue, 28 Sep 2021 16:35:31 +0100 Subject: [PATCH 34/42] Set cookie domain to fix logout --- .../kubernetes/budibase/{ => templates}/.helmignore | 0 .../budibase/templates/app-service-deployment.yaml | 2 ++ .../templates/worker-service-deployment.yaml | 2 ++ hosting/kubernetes/budibase/values.yaml | 1 + packages/auth/src/environment.js | 1 + packages/auth/src/utils.js | 12 ++++++++++-- 6 files changed, 16 insertions(+), 2 deletions(-) rename hosting/kubernetes/budibase/{ => templates}/.helmignore (100%) diff --git a/hosting/kubernetes/budibase/.helmignore b/hosting/kubernetes/budibase/templates/.helmignore similarity index 100% rename from hosting/kubernetes/budibase/.helmignore rename to hosting/kubernetes/budibase/templates/.helmignore diff --git a/hosting/kubernetes/budibase/templates/app-service-deployment.yaml b/hosting/kubernetes/budibase/templates/app-service-deployment.yaml index b101ab7854..5d9aee2619 100644 --- a/hosting/kubernetes/budibase/templates/app-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/app-service-deployment.yaml @@ -94,6 +94,8 @@ spec: value: {{ .Values.globals.sentryDSN }} - name: WORKER_URL value: worker-service:{{ .Values.services.worker.port }} + - name: COOKIE_DOMAIN + value: {{ .Values.globals.cookieDomain | quote }} image: budibase/apps imagePullPolicy: Always name: bbapps diff --git a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml index 6c165872c8..98a921a8a6 100644 --- a/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml +++ b/hosting/kubernetes/budibase/templates/worker-service-deployment.yaml @@ -89,6 +89,8 @@ spec: value: {{ .Values.globals.selfHosted | quote }} - name: ACCOUNT_PORTAL_URL value: {{ .Values.globals.accountPortalUrl | quote }} + - name: COOKIE_DOMAIN + value: {{ .Values.globals.cookieDomain | quote }} image: budibase/worker imagePullPolicy: Always name: bbworker diff --git a/hosting/kubernetes/budibase/values.yaml b/hosting/kubernetes/budibase/values.yaml index 1113842c8b..c9b2549b30 100644 --- a/hosting/kubernetes/budibase/values.yaml +++ b/hosting/kubernetes/budibase/values.yaml @@ -90,6 +90,7 @@ globals: logLevel: info selfHosted: 1 accountPortalUrL: "" + cookieDomain: "" createSecrets: true # creates an internal API key, JWT secrets and redis password for you # if createSecrets is set to false, you can hard-code your secrets here diff --git a/packages/auth/src/environment.js b/packages/auth/src/environment.js index bae5c65a1b..da24afc8a0 100644 --- a/packages/auth/src/environment.js +++ b/packages/auth/src/environment.js @@ -22,6 +22,7 @@ module.exports = { MULTI_TENANCY: process.env.MULTI_TENANCY, ACCOUNT_PORTAL_URL: process.env.ACCOUNT_PORTAL_URL, SELF_HOSTED: !!parseInt(process.env.SELF_HOSTED), + COOKIE_DOMAIN: process.env.COOKIE_DOMAIN, isTest, _set(key, value) { process.env[key] = value diff --git a/packages/auth/src/utils.js b/packages/auth/src/utils.js index 5936948fd7..f03ae300f7 100644 --- a/packages/auth/src/utils.js +++ b/packages/auth/src/utils.js @@ -4,6 +4,7 @@ const { options } = require("./middleware/passport/jwt") const { createUserEmailView } = require("./db/views") const { Headers } = require("./constants") const { getGlobalDB } = require("./tenancy") +const environment = require("./environment") const APP_PREFIX = DocumentTypes.APP + SEPARATOR @@ -70,12 +71,19 @@ exports.setCookie = (ctx, value, name = "builder") => { ctx.cookies.set(name) } else { value = jwt.sign(value, options.secretOrKey) - ctx.cookies.set(name, value, { + + const config = { maxAge: Number.MAX_SAFE_INTEGER, path: "/", httpOnly: false, overwrite: true, - }) + } + + if (environment.COOKIE_DOMAIN) { + config.domain = environment.COOKIE_DOMAIN + } + + ctx.cookies.set(name, value, config) } } From 46d22a1ae66bbacb3ea4e733c56d0335588a7b6c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 28 Sep 2021 16:40:03 +0100 Subject: [PATCH 35/42] adding subdomain checking to tenancy middleware --- packages/auth/src/tenancy/context.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/auth/src/tenancy/context.js b/packages/auth/src/tenancy/context.js index b1ef5a5807..01d1fdc604 100644 --- a/packages/auth/src/tenancy/context.js +++ b/packages/auth/src/tenancy/context.js @@ -53,6 +53,11 @@ exports.setTenantId = ( // processed later in the chain tenantId = user.tenantId || header || tenantId + // Set the tenantId from the subdomain + if (!tenantId) { + tenantId = ctx.subdomains && ctx.subdomains[0] + } + if (!tenantId && !allowNoTenant) { ctx.throw(403, "Tenant id not set") } From fd7e768ea19da35031b8657f5db83edbfbe86d78 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 16:04:16 +0000 Subject: [PATCH 36/42] v0.9.143-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 | 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 71be7bfa92..9a4365ace9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.4", + "version": "0.9.143-alpha.5", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index edf2a0ad17..e4c4a30bbd 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.4", + "version": "0.9.143-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 81a7a3b077..4e01575014 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.143-alpha.4", + "version": "0.9.143-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 82bebadbf2..1d9f2e42a5 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.4", + "version": "0.9.143-alpha.5", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.4", - "@budibase/client": "^0.9.143-alpha.4", + "@budibase/bbui": "^0.9.143-alpha.5", + "@budibase/client": "^0.9.143-alpha.5", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.4", + "@budibase/string-templates": "^0.9.143-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 57878e2929..9df99b296e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.4", + "version": "0.9.143-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 d4a4a24ba9..d1fb4b268a 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.4", + "version": "0.9.143-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.143-alpha.4", + "@budibase/bbui": "^0.9.143-alpha.5", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.4", + "@budibase/string-templates": "^0.9.143-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 07f11c8161..4251c582fb 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.143-alpha.4", + "version": "0.9.143-alpha.5", "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.143-alpha.4", - "@budibase/client": "^0.9.143-alpha.4", - "@budibase/string-templates": "^0.9.143-alpha.4", + "@budibase/auth": "^0.9.143-alpha.5", + "@budibase/client": "^0.9.143-alpha.5", + "@budibase/string-templates": "^0.9.143-alpha.5", "@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 bae80e4ca6..7e262f7846 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.4", + "version": "0.9.143-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 29e8137932..01911c3388 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.143-alpha.4", + "version": "0.9.143-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.143-alpha.4", - "@budibase/string-templates": "^0.9.143-alpha.4", + "@budibase/auth": "^0.9.143-alpha.5", + "@budibase/string-templates": "^0.9.143-alpha.5", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 402365f5b37c79aa603d2b99479cbddb58a389e6 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 28 Sep 2021 17:18:56 +0100 Subject: [PATCH 37/42] remove company size logic from the code --- packages/builder/src/stores/portal/auth.js | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/packages/builder/src/stores/portal/auth.js b/packages/builder/src/stores/portal/auth.js index e33a1f22ac..95157e3f93 100644 --- a/packages/builder/src/stores/portal/auth.js +++ b/packages/builder/src/stores/portal/auth.js @@ -54,15 +54,13 @@ export function createAuthStore() { if (user) { analytics.activate().then(() => { analytics.identify(user._id, user) - 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, - }) - } + analytics.showChat({ + email: user.email, + created_at: user.createdAt || Date.now(), + name: user.name, + user_id: user._id, + tenant: user.tenantId, + }) }) } } From 4f8da83dae42d672d609de66db12a6f717215575 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 16:35:28 +0000 Subject: [PATCH 38/42] v0.9.143-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 9a4365ace9..58b710b3d6 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.5", + "version": "0.9.143-alpha.6", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index e4c4a30bbd..2174b6adce 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.5", + "version": "0.9.143-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 4e01575014..36d6f0fcad 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.143-alpha.5", + "version": "0.9.143-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 1d9f2e42a5..6fb6291550 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.5", + "version": "0.9.143-alpha.6", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.5", - "@budibase/client": "^0.9.143-alpha.5", + "@budibase/bbui": "^0.9.143-alpha.6", + "@budibase/client": "^0.9.143-alpha.6", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.5", + "@budibase/string-templates": "^0.9.143-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 9df99b296e..c6900c19a7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.5", + "version": "0.9.143-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 d1fb4b268a..0e859f5ada 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.5", + "version": "0.9.143-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.143-alpha.5", + "@budibase/bbui": "^0.9.143-alpha.6", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.5", + "@budibase/string-templates": "^0.9.143-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 4251c582fb..d45bf124fc 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.143-alpha.5", + "version": "0.9.143-alpha.6", "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.143-alpha.5", - "@budibase/client": "^0.9.143-alpha.5", - "@budibase/string-templates": "^0.9.143-alpha.5", + "@budibase/auth": "^0.9.143-alpha.6", + "@budibase/client": "^0.9.143-alpha.6", + "@budibase/string-templates": "^0.9.143-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 7e262f7846..6e8262c0b3 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.5", + "version": "0.9.143-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 01911c3388..a509f917c5 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.143-alpha.5", + "version": "0.9.143-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.143-alpha.5", - "@budibase/string-templates": "^0.9.143-alpha.5", + "@budibase/auth": "^0.9.143-alpha.6", + "@budibase/string-templates": "^0.9.143-alpha.6", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 875e64e5a6122428c79ee52fe7aa8b0f6aacbb2e Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 28 Sep 2021 16:50:47 +0000 Subject: [PATCH 39/42] v0.9.143-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 58b710b3d6..1d2d09e7a9 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.6", + "version": "0.9.143-alpha.7", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 2174b6adce..11167adc5f 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.6", + "version": "0.9.143-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 36d6f0fcad..b9c33431a7 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.143-alpha.6", + "version": "0.9.143-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 6fb6291550..8df4565a24 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.6", + "version": "0.9.143-alpha.7", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.6", - "@budibase/client": "^0.9.143-alpha.6", + "@budibase/bbui": "^0.9.143-alpha.7", + "@budibase/client": "^0.9.143-alpha.7", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.6", + "@budibase/string-templates": "^0.9.143-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 c6900c19a7..804a4852f9 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.6", + "version": "0.9.143-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 0e859f5ada..32011d392f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.6", + "version": "0.9.143-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.143-alpha.6", + "@budibase/bbui": "^0.9.143-alpha.7", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.6", + "@budibase/string-templates": "^0.9.143-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 d45bf124fc..a11a9ab675 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.143-alpha.6", + "version": "0.9.143-alpha.7", "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.143-alpha.6", - "@budibase/client": "^0.9.143-alpha.6", - "@budibase/string-templates": "^0.9.143-alpha.6", + "@budibase/auth": "^0.9.143-alpha.7", + "@budibase/client": "^0.9.143-alpha.7", + "@budibase/string-templates": "^0.9.143-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 6e8262c0b3..6d5c150ae5 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.6", + "version": "0.9.143-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 a509f917c5..b512fcd39a 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.143-alpha.6", + "version": "0.9.143-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.143-alpha.6", - "@budibase/string-templates": "^0.9.143-alpha.6", + "@budibase/auth": "^0.9.143-alpha.7", + "@budibase/string-templates": "^0.9.143-alpha.7", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From b9ad634b8564746a00f0b9ba796f61b6b4799d5b Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 29 Sep 2021 08:57:09 +0100 Subject: [PATCH 40/42] Fix bug with filter editor preventing date pickers or booleans from being shown --- .../PropertyControls/FilterEditor/FilterDrawer.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte index d6bfadb150..4733fd4ffe 100644 --- a/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/PropertiesPanel/PropertyControls/FilterEditor/FilterDrawer.svelte @@ -133,7 +133,7 @@ /> {:else if ["string", "longform", "number"].includes(filter.type)} - {:else if filter.type === "options" || "array"} + {:else if ["options", "array"].includes(filter.type)} Date: Wed, 29 Sep 2021 08:27:38 +0000 Subject: [PATCH 41/42] v0.9.143-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 1d2d09e7a9..e6cf15d80b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.7", + "version": "0.9.143-alpha.8", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 11167adc5f..599857806c 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.7", + "version": "0.9.143-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 b9c33431a7..9db140849f 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.143-alpha.7", + "version": "0.9.143-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 8df4565a24..c4e548ef07 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.7", + "version": "0.9.143-alpha.8", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.7", - "@budibase/client": "^0.9.143-alpha.7", + "@budibase/bbui": "^0.9.143-alpha.8", + "@budibase/client": "^0.9.143-alpha.8", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.7", + "@budibase/string-templates": "^0.9.143-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 804a4852f9..7af1d0cc62 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.7", + "version": "0.9.143-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 32011d392f..f7b3884c03 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.7", + "version": "0.9.143-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.143-alpha.7", + "@budibase/bbui": "^0.9.143-alpha.8", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.7", + "@budibase/string-templates": "^0.9.143-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 a11a9ab675..47d524271b 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.143-alpha.7", + "version": "0.9.143-alpha.8", "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.143-alpha.7", - "@budibase/client": "^0.9.143-alpha.7", - "@budibase/string-templates": "^0.9.143-alpha.7", + "@budibase/auth": "^0.9.143-alpha.8", + "@budibase/client": "^0.9.143-alpha.8", + "@budibase/string-templates": "^0.9.143-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 6d5c150ae5..e0ab21d537 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.7", + "version": "0.9.143-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 b512fcd39a..768411bfb7 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.143-alpha.7", + "version": "0.9.143-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.143-alpha.7", - "@budibase/string-templates": "^0.9.143-alpha.7", + "@budibase/auth": "^0.9.143-alpha.8", + "@budibase/string-templates": "^0.9.143-alpha.8", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0", From 1236b70bf9b8df6ac2cccc0f8281e8ae94f48290 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 29 Sep 2021 09:06:03 +0000 Subject: [PATCH 42/42] v0.9.143-alpha.9 --- 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 e6cf15d80b..3f5a320ff1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.143-alpha.8", + "version": "0.9.143-alpha.9", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 599857806c..dfa4e91e62 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.143-alpha.8", + "version": "0.9.143-alpha.9", "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 9db140849f..13826985c8 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.143-alpha.8", + "version": "0.9.143-alpha.9", "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 c4e548ef07..b3bb6a6fe5 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.143-alpha.8", + "version": "0.9.143-alpha.9", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.143-alpha.8", - "@budibase/client": "^0.9.143-alpha.8", + "@budibase/bbui": "^0.9.143-alpha.9", + "@budibase/client": "^0.9.143-alpha.9", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.143-alpha.8", + "@budibase/string-templates": "^0.9.143-alpha.9", "@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 7af1d0cc62..40af06d5dd 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.143-alpha.8", + "version": "0.9.143-alpha.9", "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 f7b3884c03..e230d832a9 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.143-alpha.8", + "version": "0.9.143-alpha.9", "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.143-alpha.8", + "@budibase/bbui": "^0.9.143-alpha.9", "@budibase/standard-components": "^0.9.139", - "@budibase/string-templates": "^0.9.143-alpha.8", + "@budibase/string-templates": "^0.9.143-alpha.9", "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 47d524271b..df0f879a56 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.143-alpha.8", + "version": "0.9.143-alpha.9", "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.143-alpha.8", - "@budibase/client": "^0.9.143-alpha.8", - "@budibase/string-templates": "^0.9.143-alpha.8", + "@budibase/auth": "^0.9.143-alpha.9", + "@budibase/client": "^0.9.143-alpha.9", + "@budibase/string-templates": "^0.9.143-alpha.9", "@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 e0ab21d537..fadf50abaa 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.143-alpha.8", + "version": "0.9.143-alpha.9", "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 768411bfb7..908bf39f11 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.143-alpha.8", + "version": "0.9.143-alpha.9", "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.143-alpha.8", - "@budibase/string-templates": "^0.9.143-alpha.8", + "@budibase/auth": "^0.9.143-alpha.9", + "@budibase/string-templates": "^0.9.143-alpha.9", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0",