From 0049d9f0220e18c88f21b00ced8ad1be7f2949a0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 14 Dec 2022 22:08:24 +0000 Subject: [PATCH 01/33] v2.1.46-alpha.12 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 3eca5da69e..e354443e63 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 32c98cc61b..018f7381aa 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "2.1.46-alpha.11", + "@budibase/types": "2.1.46-alpha.12", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 9cfe2a3c9d..491e93624b 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": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.1.46-alpha.11", + "@budibase/string-templates": "2.1.46-alpha.12", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 6a7b4e56cf..05841dfc9b 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.1.46-alpha.11", - "@budibase/client": "2.1.46-alpha.11", - "@budibase/frontend-core": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.11", + "@budibase/bbui": "2.1.46-alpha.12", + "@budibase/client": "2.1.46-alpha.12", + "@budibase/frontend-core": "2.1.46-alpha.12", + "@budibase/string-templates": "2.1.46-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 baa9af546c..01b5d3bbca 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.11", - "@budibase/types": "2.1.46-alpha.11", + "@budibase/backend-core": "2.1.46-alpha.12", + "@budibase/string-templates": "2.1.46-alpha.12", + "@budibase/types": "2.1.46-alpha.12", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index f336bd7762..a0ad597f1b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.1.46-alpha.11", + "version": "2.1.46-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": "2.1.46-alpha.11", - "@budibase/frontend-core": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.11", + "@budibase/bbui": "2.1.46-alpha.12", + "@budibase/frontend-core": "2.1.46-alpha.12", + "@budibase/string-templates": "2.1.46-alpha.12", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index beb43413be..fe8e700347 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.1.46-alpha.11", + "@budibase/bbui": "2.1.46-alpha.12", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 0ea1840b6c..c076bf0d8d 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 831b46a9d7..cb1ed9076c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.1.46-alpha.11", - "@budibase/client": "2.1.46-alpha.11", + "@budibase/backend-core": "2.1.46-alpha.12", + "@budibase/client": "2.1.46-alpha.12", "@budibase/pro": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.11", - "@budibase/types": "2.1.46-alpha.11", + "@budibase/string-templates": "2.1.46-alpha.12", + "@budibase/types": "2.1.46-alpha.12", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 56cc508b34..cb91016bcc 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 5182f416b6..941f3d65ec 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 6043c92aa4..99a5602c4d 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.46-alpha.11", + "version": "2.1.46-alpha.12", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.11", + "@budibase/backend-core": "2.1.46-alpha.12", "@budibase/pro": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.11", - "@budibase/types": "2.1.46-alpha.11", + "@budibase/string-templates": "2.1.46-alpha.12", + "@budibase/types": "2.1.46-alpha.12", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 8594839400051e5c45fd90c7e4558260819e5118 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 11:28:12 +0000 Subject: [PATCH 02/33] v2.1.46-alpha.13 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index e354443e63..50aae73f20 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 018f7381aa..94fa7e65b3 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "2.1.46-alpha.12", + "@budibase/types": "2.1.46-alpha.13", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-sdk": "2.1030.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 491e93624b..dcafdc0f6c 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": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.1.46-alpha.12", + "@budibase/string-templates": "2.1.46-alpha.13", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 05841dfc9b..0bf38cf3bd 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.1.46-alpha.12", - "@budibase/client": "2.1.46-alpha.12", - "@budibase/frontend-core": "2.1.46-alpha.12", - "@budibase/string-templates": "2.1.46-alpha.12", + "@budibase/bbui": "2.1.46-alpha.13", + "@budibase/client": "2.1.46-alpha.13", + "@budibase/frontend-core": "2.1.46-alpha.13", + "@budibase/string-templates": "2.1.46-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 01b5d3bbca..c1023123c3 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.12", - "@budibase/string-templates": "2.1.46-alpha.12", - "@budibase/types": "2.1.46-alpha.12", + "@budibase/backend-core": "2.1.46-alpha.13", + "@budibase/string-templates": "2.1.46-alpha.13", + "@budibase/types": "2.1.46-alpha.13", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index a0ad597f1b..57e331e7a9 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.1.46-alpha.12", + "version": "2.1.46-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": "2.1.46-alpha.12", - "@budibase/frontend-core": "2.1.46-alpha.12", - "@budibase/string-templates": "2.1.46-alpha.12", + "@budibase/bbui": "2.1.46-alpha.13", + "@budibase/frontend-core": "2.1.46-alpha.13", + "@budibase/string-templates": "2.1.46-alpha.13", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index fe8e700347..c33d2bc43e 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.1.46-alpha.12", + "@budibase/bbui": "2.1.46-alpha.13", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index c076bf0d8d..38b87277fb 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index cb1ed9076c..c1b25404e0 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.1.46-alpha.12", - "@budibase/client": "2.1.46-alpha.12", + "@budibase/backend-core": "2.1.46-alpha.13", + "@budibase/client": "2.1.46-alpha.13", "@budibase/pro": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.12", - "@budibase/types": "2.1.46-alpha.12", + "@budibase/string-templates": "2.1.46-alpha.13", + "@budibase/types": "2.1.46-alpha.13", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index cb91016bcc..b9e71666f6 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 941f3d65ec..85dfab8a94 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 99a5602c4d..9b3515ae67 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.46-alpha.12", + "version": "2.1.46-alpha.13", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.12", + "@budibase/backend-core": "2.1.46-alpha.13", "@budibase/pro": "2.1.46-alpha.11", - "@budibase/string-templates": "2.1.46-alpha.12", - "@budibase/types": "2.1.46-alpha.12", + "@budibase/string-templates": "2.1.46-alpha.13", + "@budibase/types": "2.1.46-alpha.13", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From e873fa828e0f14cc4865fc5fd59c711219d56f25 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 11:33:12 +0000 Subject: [PATCH 03/33] Update pro version to 2.1.46-alpha.13 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 31 ++++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 31 ++++++++++++++++--------------- 4 files changed, 34 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index c1b25404e0..8019d499f7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -45,7 +45,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.1.46-alpha.13", "@budibase/client": "2.1.46-alpha.13", - "@budibase/pro": "2.1.46-alpha.11", + "@budibase/pro": "2.1.46-alpha.13", "@budibase/string-templates": "2.1.46-alpha.13", "@budibase/types": "2.1.46-alpha.13", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 3970437fc7..bcb7c43688 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,12 +1273,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.46-alpha.11": - version "2.1.46-alpha.11" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.11.tgz#a8087f9e2cf042b09681d78c8ac3d9761e063bc2" - integrity sha512-rJC0HzwCbRBnehbhTPY/cYg7fdYPI6R7KHhU8T6Q9nbPzPH5wSbhC9+I6LqYSztT3w9DcWhTETrHOEz7L1y0DA== +"@budibase/backend-core@2.1.46-alpha.13": + version "2.1.46-alpha.13" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.13.tgz#a24c92f88c02ecf1fed0ea1c8f0d58f521d147ee" + integrity sha512-FtOJd7HLa3PxebwuLyGotTjdNG2DqLIjCDYyzk7lS+H7DhYX9pQ8nBS5TEc+pI9w7aXsWlIY5wFB90qIQ6tn+g== dependencies: - "@budibase/types" "2.1.46-alpha.11" + "@budibase/types" "2.1.46-alpha.13" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1360,16 +1360,17 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.1.46-alpha.11": - version "2.1.46-alpha.11" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.11.tgz#2fd8cc4dd71ee7be65ad921ddd4c27578a5ca7a5" - integrity sha512-88pN32BqZDTQe259HjPLprKPqvjdqRROjn+AZhzCvl2fPoybYVflzeDscRX+p2VMfIYpbIax49hQ5hJGUQotLw== +"@budibase/pro@2.1.46-alpha.13": + version "2.1.46-alpha.13" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.13.tgz#63712d6f22930d1de9bd62d6b74a015da3675c32" + integrity sha512-FwVEH3269I6wW5oT0f/lL/N6KrD5cJFfXc0jTLPNWo4nWOyoxGWr77sYZEhHtny+ifYuTk+BJxn2VyDNON2/Iw== dependencies: - "@budibase/backend-core" "2.1.46-alpha.11" - "@budibase/types" "2.1.46-alpha.11" + "@budibase/backend-core" "2.1.46-alpha.13" + "@budibase/types" "2.1.46-alpha.13" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" + jsonwebtoken "8.5.1" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": @@ -1390,10 +1391,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.1.46-alpha.11": - version "2.1.46-alpha.11" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.11.tgz#4cba69a4b6c2eecf2b49a9a216d1e4792c87eb52" - integrity sha512-KqYm7CfEiTt6y0vMf8lmoPtMRCFHBRqYmztO9qMYnmlcjaCSLaiEflJ/WK1AXsujjIeK9cHZ7hPPecqqvyFOOQ== +"@budibase/types@2.1.46-alpha.13": + version "2.1.46-alpha.13" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.13.tgz#0107530cc8321d468821eeff4adf221e33ea179b" + integrity sha512-SUN+RcaJBIuXvgveUje8y9I9FdB+LXAW3DUK0SZBEphL3LmU3/Mc2bfhS1kOoLyImVY52ByzinpCUyBHR7zWXQ== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 9b3515ae67..460f5be9ca 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.1.46-alpha.13", - "@budibase/pro": "2.1.46-alpha.11", + "@budibase/pro": "2.1.46-alpha.13", "@budibase/string-templates": "2.1.46-alpha.13", "@budibase/types": "2.1.46-alpha.13", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 2363661df0..f16fe132e3 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,12 +470,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.46-alpha.11": - version "2.1.46-alpha.11" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.11.tgz#a8087f9e2cf042b09681d78c8ac3d9761e063bc2" - integrity sha512-rJC0HzwCbRBnehbhTPY/cYg7fdYPI6R7KHhU8T6Q9nbPzPH5wSbhC9+I6LqYSztT3w9DcWhTETrHOEz7L1y0DA== +"@budibase/backend-core@2.1.46-alpha.13": + version "2.1.46-alpha.13" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.13.tgz#a24c92f88c02ecf1fed0ea1c8f0d58f521d147ee" + integrity sha512-FtOJd7HLa3PxebwuLyGotTjdNG2DqLIjCDYyzk7lS+H7DhYX9pQ8nBS5TEc+pI9w7aXsWlIY5wFB90qIQ6tn+g== dependencies: - "@budibase/types" "2.1.46-alpha.11" + "@budibase/types" "2.1.46-alpha.13" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -507,22 +507,23 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.1.46-alpha.11": - version "2.1.46-alpha.11" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.11.tgz#2fd8cc4dd71ee7be65ad921ddd4c27578a5ca7a5" - integrity sha512-88pN32BqZDTQe259HjPLprKPqvjdqRROjn+AZhzCvl2fPoybYVflzeDscRX+p2VMfIYpbIax49hQ5hJGUQotLw== +"@budibase/pro@2.1.46-alpha.13": + version "2.1.46-alpha.13" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.13.tgz#63712d6f22930d1de9bd62d6b74a015da3675c32" + integrity sha512-FwVEH3269I6wW5oT0f/lL/N6KrD5cJFfXc0jTLPNWo4nWOyoxGWr77sYZEhHtny+ifYuTk+BJxn2VyDNON2/Iw== dependencies: - "@budibase/backend-core" "2.1.46-alpha.11" - "@budibase/types" "2.1.46-alpha.11" + "@budibase/backend-core" "2.1.46-alpha.13" + "@budibase/types" "2.1.46-alpha.13" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" + jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.1.46-alpha.11": - version "2.1.46-alpha.11" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.11.tgz#4cba69a4b6c2eecf2b49a9a216d1e4792c87eb52" - integrity sha512-KqYm7CfEiTt6y0vMf8lmoPtMRCFHBRqYmztO9qMYnmlcjaCSLaiEflJ/WK1AXsujjIeK9cHZ7hPPecqqvyFOOQ== +"@budibase/types@2.1.46-alpha.13": + version "2.1.46-alpha.13" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.13.tgz#0107530cc8321d468821eeff4adf221e33ea179b" + integrity sha512-SUN+RcaJBIuXvgveUje8y9I9FdB+LXAW3DUK0SZBEphL3LmU3/Mc2bfhS1kOoLyImVY52ByzinpCUyBHR7zWXQ== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" From 786039055e76afd7cd2e1bb245c57855f9f17843 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 15 Dec 2022 11:35:22 +0000 Subject: [PATCH 04/33] File authentication using presigned URLs (#8883) * file auth wip * Private plugin bucket wip * Add etag to logo request, fix circular dependency * Resolve cyclic dependency * Ensure browser doesn't cache custom component * Global file fixes * File fixes / remove permaUrl * Add ctx local storage * Enable presigned url to work from any host * Test fix * Self hosting w/ S3 + other fixes * Fix for serving dev app in multi tenant * Fix backup restore and import attachment url processing, never store attachment urls * Test fixes * Unit tests WIP * Replace file path with base64 encoded private key * Multi tenancy tests for files * Environment files fixes * Post-merge build and test fixes * Add debug conditional to all jest logging and revert/fix prod minio proxy_pass * Re-add default '/' minio route :( * Rename iconFile -> iconFileName * Add cloudfront vars to k8s templates * Remove public bucket policy * Remove duplicated test --- .../templates/app-service-deployment.yaml | 10 +- .../templates/worker-service-deployment.yaml | 10 +- charts/budibase/values.yaml | 8 + hosting/nginx.dev.conf.hbs | 20 + hosting/nginx.prod.conf.hbs | 20 + hosting/single/nginx/nginx-default-site.conf | 38 +- package.json | 1 + packages/backend-core/__mocks__/aws-sdk.ts | 5 +- packages/backend-core/package.json | 1 + .../backend-core/src/context/mainContext.ts | 14 +- packages/backend-core/src/db/utils.ts | 22 +- packages/backend-core/src/environment.ts | 15 +- .../src/objectStore/buckets/app.ts | 40 ++ .../src/objectStore/buckets/global.ts | 29 ++ .../src/objectStore/buckets/index.ts | 3 + .../src/objectStore/buckets/plugins.ts | 71 ++++ .../src/objectStore/buckets/tests/app.spec.ts | 171 +++++++++ .../objectStore/buckets/tests/global.spec.ts | 74 ++++ .../objectStore/buckets/tests/plugins.spec.ts | 110 ++++++ .../src/objectStore/cloudfront.ts | 41 ++ .../backend-core/src/objectStore/index.ts | 1 + .../src/objectStore/objectStore.ts | 86 +++-- .../backend-core/src/objectStore/utils.ts | 1 - packages/backend-core/src/tenancy/tenancy.ts | 27 +- .../tests/utils.spec.ts} | 12 +- packages/backend-core/src/utils/utils.ts | 49 ++- packages/backend-core/tests/jestSetup.ts | 4 +- .../backend-core/tests/utilities/index.ts | 1 + .../tests/utilities/mocks/index.ts | 4 +- .../tests/utilities/structures/index.ts | 1 + .../tests/utilities/structures/plugins.ts | 19 + .../backend-core/tests/utilities/testEnv.ts | 87 +++++ packages/backend-core/tsconfig.json | 6 +- packages/backend-core/yarn.lock | 12 + .../IntegrationIcon.svelte | 5 +- .../client/src/components/ClientApp.svelte | 4 +- packages/server/__mocks__/aws-sdk.ts | 19 + packages/server/package.json | 4 +- .../server/src/api/controllers/application.ts | 28 +- packages/server/src/api/controllers/auth.ts | 4 +- packages/server/src/api/controllers/cloud.ts | 16 +- .../src/api/controllers/plugin/index.ts | 23 +- .../api/controllers/row/ExternalRequest.ts | 1 - .../src/api/controllers/row/internal.ts | 45 +-- .../src/api/controllers/row/staticFormula.ts | 7 +- .../server/src/api/controllers/row/utils.ts | 3 +- .../src/api/controllers/static/index.ts | 16 +- packages/server/src/api/routes/index.ts | 7 +- .../server/src/api/routes/tests/row.spec.js | 6 +- .../src/api/routes/tests/static.spec.js | 19 +- packages/server/src/environment.ts | 7 +- packages/server/src/integrations/index.ts | 6 +- .../functions/backfill/global/configs.ts | 9 +- .../server/src/sdk/app/backups/imports.ts | 10 +- packages/server/src/tests/jestSetup.ts | 5 +- .../server/src/utilities/fileSystem/app.ts | 86 +++++ .../src/utilities/fileSystem/clientLibrary.ts | 2 +- .../src/utilities/fileSystem/filesystem.ts | 170 +++++++++ .../server/src/utilities/fileSystem/index.ts | 353 +----------------- .../server/src/utilities/fileSystem/plugin.ts | 65 ++++ .../src/utilities/fileSystem/template.ts | 36 ++ packages/server/src/utilities/index.ts | 46 +-- packages/server/src/utilities/plugins.ts | 22 -- .../src/utilities/rowProcessor/index.ts | 25 +- .../src/utilities/tests/plugins.spec.ts | 23 -- packages/server/yarn.lock | 30 +- packages/types/package.json | 1 + packages/types/src/documents/app/row.ts | 3 +- packages/types/src/documents/global/config.ts | 15 +- packages/types/src/documents/global/plugin.ts | 7 +- packages/types/src/sdk/events/auth.ts | 3 +- packages/types/src/sdk/koa.ts | 33 +- packages/types/yarn.lock | 118 +++++- packages/worker/package.json | 3 +- .../src/api/controllers/global/configs.ts | 241 ++++++------ .../src/api/controllers/global/users.ts | 2 +- .../worker/src/api/routes/global/license.ts | 2 +- packages/worker/src/environment.ts | 5 + packages/worker/src/index.ts | 3 +- packages/worker/src/sdk/users/users.ts | 19 +- packages/worker/src/tests/jestSetup.ts | 4 +- .../src/tests/mocks/{email.js => email.ts} | 2 +- packages/worker/src/tests/mocks/index.ts | 2 +- .../worker/src/tests/structures/configs.ts | 4 +- packages/worker/yarn.lock | 15 +- 85 files changed, 1757 insertions(+), 840 deletions(-) create mode 100644 packages/backend-core/src/objectStore/buckets/app.ts create mode 100644 packages/backend-core/src/objectStore/buckets/global.ts create mode 100644 packages/backend-core/src/objectStore/buckets/index.ts create mode 100644 packages/backend-core/src/objectStore/buckets/plugins.ts create mode 100644 packages/backend-core/src/objectStore/buckets/tests/app.spec.ts create mode 100644 packages/backend-core/src/objectStore/buckets/tests/global.spec.ts create mode 100644 packages/backend-core/src/objectStore/buckets/tests/plugins.spec.ts create mode 100644 packages/backend-core/src/objectStore/cloudfront.ts rename packages/backend-core/src/{tests/utils.spec.js => utils/tests/utils.spec.ts} (61%) create mode 100644 packages/backend-core/tests/utilities/structures/plugins.ts create mode 100644 packages/backend-core/tests/utilities/testEnv.ts create mode 100644 packages/server/src/utilities/fileSystem/app.ts create mode 100644 packages/server/src/utilities/fileSystem/filesystem.ts create mode 100644 packages/server/src/utilities/fileSystem/plugin.ts create mode 100644 packages/server/src/utilities/fileSystem/template.ts delete mode 100644 packages/server/src/utilities/plugins.ts delete mode 100644 packages/server/src/utilities/tests/plugins.spec.ts rename packages/worker/src/tests/mocks/{email.js => email.ts} (90%) diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index a3e4790430..6acc45adb7 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -67,6 +67,8 @@ spec: - name: AWS_REGION value: {{ .Values.services.objectStore.region }} {{ end }} + - name: MINIO_ENABLED + value: {{ .Values.services.objectStore.minio }} - name: MINIO_ACCESS_KEY valueFrom: secretKeyRef: @@ -77,13 +79,19 @@ spec: secretKeyRef: name: {{ template "budibase.fullname" . }} key: objectStoreSecret + - name: CLOUDFRONT_CDN + value: {{ .Values.services.objectStore.cloudfront.cdn | quote }} + - name: CLOUDFRONT_PUBLIC_KEY_ID + value: {{ .Values.services.objectStore.cloudfront.publicKeyId | quote }} + - name: CLOUDFRONT_PRIVATE_KEY_64 + value: {{ .Values.services.objectStore.cloudfront.privateKey64 | quote }} - name: MINIO_URL value: {{ .Values.services.objectStore.url }} - name: PLUGIN_BUCKET_NAME value: {{ .Values.services.objectStore.pluginBucketName | quote }} - name: APPS_BUCKET_NAME value: {{ .Values.services.objectStore.appsBucketName | quote }} - - name: GLOBAL_CLOUD_BUCKET_NAME + - name: GLOBAL_BUCKET_NAME value: {{ .Values.services.objectStore.globalBucketName | quote }} - name: BACKUPS_BUCKET_NAME value: {{ .Values.services.objectStore.backupsBucketName | quote }} diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index 44bbb8aa20..5ff9dd5f51 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -68,6 +68,8 @@ spec: - name: AWS_REGION value: {{ .Values.services.objectStore.region }} {{ end }} + - name: MINIO_ENABLED + value: {{ .Values.services.objectStore.minio }} - name: MINIO_ACCESS_KEY valueFrom: secretKeyRef: @@ -80,11 +82,17 @@ spec: key: objectStoreSecret - name: MINIO_URL value: {{ .Values.services.objectStore.url }} + - name: CLOUDFRONT_CDN + value: {{ .Values.services.objectStore.cloudfront.cdn | quote }} + - name: CLOUDFRONT_PUBLIC_KEY_ID + value: {{ .Values.services.objectStore.cloudfront.publicKeyId | quote }} + - name: CLOUDFRONT_PRIVATE_KEY_64 + value: {{ .Values.services.objectStore.cloudfront.privateKey64 | quote }} - name: PLUGIN_BUCKET_NAME value: {{ .Values.services.objectStore.pluginBucketName | quote }} - name: APPS_BUCKET_NAME value: {{ .Values.services.objectStore.appsBucketName | quote }} - - name: GLOBAL_CLOUD_BUCKET_NAME + - name: GLOBAL_BUCKET_NAME value: {{ .Values.services.objectStore.globalBucketName | quote }} - name: BACKUPS_BUCKET_NAME value: {{ .Values.services.objectStore.backupsBucketName | quote }} diff --git a/charts/budibase/values.yaml b/charts/budibase/values.yaml index 726df7585b..1b2b1c3dcb 100644 --- a/charts/budibase/values.yaml +++ b/charts/budibase/values.yaml @@ -167,6 +167,7 @@ services: resources: {} objectStore: + # Set to false if using another object store such as S3 minio: true browser: true port: 9000 @@ -182,6 +183,13 @@ services: ## set, choosing the default provisioner. storageClass: "" resources: {} + cloudfront: + # Set the url of a distribution to enable cloudfront + cdn: "" + # ID of public key stored in cloudfront + publicKeyId: "" + # Base64 encoded private key for the above public key + privateKey64: "" # Override values in couchDB subchart couchdb: diff --git a/hosting/nginx.dev.conf.hbs b/hosting/nginx.dev.conf.hbs index 93a07435e5..1dfaeed7ee 100644 --- a/hosting/nginx.dev.conf.hbs +++ b/hosting/nginx.dev.conf.hbs @@ -186,6 +186,26 @@ http { proxy_pass http://minio-service:9000; } + location /files/signed/ { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # IMPORTANT: Signed urls will inspect the host header of the request. + # Normally a signed url will need to be generated with a specified client host in mind. + # To support dynamic hosts, e.g. some unknown self-hosted installation url, + # use a predefined host header. The host 'minio-service' is also used at the time of url signing. + proxy_set_header Host minio-service; + + proxy_connect_timeout 300; + proxy_http_version 1.1; + proxy_set_header Connection ""; + chunked_transfer_encoding off; + + proxy_pass http://minio-service:9000; + rewrite ^/files/signed/(.*)$ /$1 break; + } + client_header_timeout 60; client_body_timeout 60; keepalive_timeout 60; diff --git a/hosting/nginx.prod.conf.hbs b/hosting/nginx.prod.conf.hbs index 6f0f1b420d..cd70ce1ae2 100644 --- a/hosting/nginx.prod.conf.hbs +++ b/hosting/nginx.prod.conf.hbs @@ -208,6 +208,26 @@ http { proxy_pass http://$minio:9000; } + location /files/signed/ { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # IMPORTANT: Signed urls will inspect the host header of the request. + # Normally a signed url will need to be generated with a specified client host in mind. + # To support dynamic hosts, e.g. some unknown self-hosted installation url, + # use a predefined host header. The host 'minio-service' is also used at the time of url signing. + proxy_set_header Host minio-service; + + proxy_connect_timeout 300; + proxy_http_version 1.1; + proxy_set_header Connection ""; + chunked_transfer_encoding off; + + proxy_pass http://$minio:9000; + rewrite ^/files/signed/(.*)$ /$1 break; + } + client_header_timeout 60; client_body_timeout 60; keepalive_timeout 60; diff --git a/hosting/single/nginx/nginx-default-site.conf b/hosting/single/nginx/nginx-default-site.conf index acadb06250..3903c0647d 100644 --- a/hosting/single/nginx/nginx-default-site.conf +++ b/hosting/single/nginx/nginx-default-site.conf @@ -95,15 +95,37 @@ server { } location / { - proxy_set_header X-Real-IP $remote_addr; - proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; - proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + proxy_set_header Host $http_host; - proxy_connect_timeout 300; - proxy_http_version 1.1; - proxy_set_header Connection ""; - chunked_transfer_encoding off; - proxy_pass http://127.0.0.1:9000; + proxy_connect_timeout 300; + proxy_http_version 1.1; + proxy_set_header Connection ""; + chunked_transfer_encoding off; + + proxy_pass http://127.0.0.1:9000; + } + + location /files/signed/ { + proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; + proxy_set_header X-Forwarded-Proto $scheme; + + # IMPORTANT: Signed urls will inspect the host header of the request. + # Normally a signed url will need to be generated with a specified client host in mind. + # To support dynamic hosts, e.g. some unknown self-hosted installation url, + # use a predefined host header. The host 'minio-service' is also used at the time of url signing. + proxy_set_header Host minio-service; + + proxy_connect_timeout 300; + proxy_http_version 1.1; + proxy_set_header Connection ""; + chunked_transfer_encoding off; + + proxy_pass http://127.0.0.1:9000; + rewrite ^/files/signed/(.*)$ /$1 break; } client_header_timeout 60; diff --git a/package.json b/package.json index 6c147698ad..5034c3b743 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,7 @@ "bootstrap": "lerna bootstrap && lerna link && ./scripts/link-dependencies.sh", "build": "lerna run build", "build:dev": "lerna run prebuild && tsc --build --watch --preserveWatchOutput", + "build:backend": "lerna run build --ignore @budibase/client --ignore @budibase/bbui --ignore @budibase/builder --ignore @budibase/cli", "build:sdk": "lerna run build:sdk", "deps:circular": "madge packages/server/dist/index.js packages/worker/src/index.ts packages/backend-core/dist/src/index.js packages/cli/src/index.js --circular", "release": "lerna publish ${RELEASE_VERSION_TYPE:-patch} --yes --force-publish && yarn release:pro", diff --git a/packages/backend-core/__mocks__/aws-sdk.ts b/packages/backend-core/__mocks__/aws-sdk.ts index 7fac80faa9..b8d91dbaa9 100644 --- a/packages/backend-core/__mocks__/aws-sdk.ts +++ b/packages/backend-core/__mocks__/aws-sdk.ts @@ -3,7 +3,10 @@ const mockS3 = { deleteObject: jest.fn().mockReturnThis(), deleteObjects: jest.fn().mockReturnThis(), createBucket: jest.fn().mockReturnThis(), - listObjects: jest.fn().mockReturnThis(), + listObject: jest.fn().mockReturnThis(), + getSignedUrl: jest.fn((operation: string, params: any) => { + return `http://s3.example.com/${params.Bucket}/${params.Key}` + }), promise: jest.fn().mockReturnThis(), catch: jest.fn(), } diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 94fa7e65b3..21f9563194 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -23,6 +23,7 @@ "@budibase/types": "2.1.46-alpha.13", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", + "aws-cloudfront-sign": "2.2.0", "aws-sdk": "2.1030.0", "bcrypt": "5.0.1", "bcryptjs": "2.4.3", diff --git a/packages/backend-core/src/context/mainContext.ts b/packages/backend-core/src/context/mainContext.ts index d743d2f49b..c44ec4e767 100644 --- a/packages/backend-core/src/context/mainContext.ts +++ b/packages/backend-core/src/context/mainContext.ts @@ -2,7 +2,7 @@ // store an app ID to pretend there is a context import env from "../environment" import Context from "./Context" -import { getDevelopmentAppID, getProdAppID } from "../db/conversions" +import * as conversions from "../db/conversions" import { getDB } from "../db/db" import { DocumentType, @@ -181,6 +181,14 @@ export function getAppId(): string | undefined { } } +export const getProdAppId = () => { + const appId = getAppId() + if (!appId) { + throw new Error("Could not get appId") + } + return conversions.getProdAppID(appId) +} + export function updateTenantId(tenantId?: string) { let context: ContextMap = updateContext({ tenantId, @@ -229,7 +237,7 @@ export function getProdAppDB(opts?: any): Database { if (!appId) { throw new Error("Unable to retrieve prod DB - no app ID.") } - return getDB(getProdAppID(appId), opts) + return getDB(conversions.getProdAppID(appId), opts) } /** @@ -241,5 +249,5 @@ export function getDevAppDB(opts?: any): Database { if (!appId) { throw new Error("Unable to retrieve dev DB - no app ID.") } - return getDB(getDevelopmentAppID(appId), opts) + return getDB(conversions.getDevelopmentAppID(appId), opts) } diff --git a/packages/backend-core/src/db/utils.ts b/packages/backend-core/src/db/utils.ts index 590c3eeef8..5e501c8d22 100644 --- a/packages/backend-core/src/db/utils.ts +++ b/packages/backend-core/src/db/utils.ts @@ -14,7 +14,7 @@ import { doWithDB, allDbs, directCouchAllDbs } from "./db" import { getAppMetadata } from "../cache/appMetadata" import { isDevApp, isDevAppID, getProdAppID } from "./conversions" import * as events from "../events" -import { App, Database, ConfigType } from "@budibase/types" +import { App, Database, ConfigType, isSettingsConfig } from "@budibase/types" /** * Generates a new app ID. @@ -489,18 +489,12 @@ export const getScopedFullConfig = async function ( // custom logic for settings doc if (type === ConfigType.SETTINGS) { - if (scopedConfig && scopedConfig.doc) { - // overrides affected by environment variables - scopedConfig.doc.config.platformUrl = await getPlatformUrl({ - tenantAware: true, - }) - scopedConfig.doc.config.analyticsEnabled = - await events.analytics.enabled() - } else { + if (!scopedConfig || !scopedConfig.doc) { // defaults scopedConfig = { doc: { _id: generateConfigID({ type, user, workspace }), + type: ConfigType.SETTINGS, config: { platformUrl: await getPlatformUrl({ tenantAware: true }), analyticsEnabled: await events.analytics.enabled(), @@ -508,6 +502,16 @@ export const getScopedFullConfig = async function ( }, } } + + // will always be true - use assertion function to get type access + if (isSettingsConfig(scopedConfig.doc)) { + // overrides affected by environment + scopedConfig.doc.config.platformUrl = await getPlatformUrl({ + tenantAware: true, + }) + scopedConfig.doc.config.analyticsEnabled = + await events.analytics.enabled() + } } return scopedConfig && scopedConfig.doc diff --git a/packages/backend-core/src/environment.ts b/packages/backend-core/src/environment.ts index 00d8c3fa9e..60cf5b7882 100644 --- a/packages/backend-core/src/environment.ts +++ b/packages/backend-core/src/environment.ts @@ -25,7 +25,6 @@ const DefaultBucketName = { APPS: "prod-budi-app-assets", TEMPLATES: "templates", GLOBAL: "global", - CLOUD: "prod-budi-tenant-uploads", PLUGINS: "plugins", } @@ -33,6 +32,9 @@ const environment = { isTest, isJest, isDev, + isProd: () => { + return !isDev() + }, JS_BCRYPT: process.env.JS_BCRYPT, JWT_SECRET: process.env.JWT_SECRET, COUCH_DB_URL: process.env.COUCH_DB_URL || "http://localhost:4005", @@ -47,6 +49,7 @@ const environment = { MINIO_SECRET_KEY: process.env.MINIO_SECRET_KEY, AWS_REGION: process.env.AWS_REGION, MINIO_URL: process.env.MINIO_URL, + MINIO_ENABLED: process.env.MINIO_ENABLED || 1, INTERNAL_API_KEY: process.env.INTERNAL_API_KEY, MULTI_TENANCY: process.env.MULTI_TENANCY, ACCOUNT_PORTAL_URL: @@ -59,6 +62,9 @@ const environment = { POSTHOG_TOKEN: process.env.POSTHOG_TOKEN, ENABLE_ANALYTICS: process.env.ENABLE_ANALYTICS, TENANT_FEATURE_FLAGS: process.env.TENANT_FEATURE_FLAGS, + CLOUDFRONT_CDN: process.env.CLOUDFRONT_CDN, + CLOUDFRONT_PRIVATE_KEY_64: process.env.CLOUDFRONT_PRIVATE_KEY_64, + CLOUDFRONT_PUBLIC_KEY_ID: process.env.CLOUDFRONT_PUBLIC_KEY_ID, BACKUPS_BUCKET_NAME: process.env.BACKUPS_BUCKET_NAME || DefaultBucketName.BACKUPS, APPS_BUCKET_NAME: process.env.APPS_BUCKET_NAME || DefaultBucketName.APPS, @@ -66,8 +72,6 @@ const environment = { process.env.TEMPLATES_BUCKET_NAME || DefaultBucketName.TEMPLATES, GLOBAL_BUCKET_NAME: process.env.GLOBAL_BUCKET_NAME || DefaultBucketName.GLOBAL, - GLOBAL_CLOUD_BUCKET_NAME: - process.env.GLOBAL_CLOUD_BUCKET_NAME || DefaultBucketName.CLOUD, PLUGIN_BUCKET_NAME: process.env.PLUGIN_BUCKET_NAME || DefaultBucketName.PLUGINS, USE_COUCH: process.env.USE_COUCH || true, @@ -91,6 +95,11 @@ for (let [key, value] of Object.entries(environment)) { // @ts-ignore environment[key] = 0 } + // handle the edge case of "false" to disable an environment variable + if (value === "false") { + // @ts-ignore + environment[key] = 0 + } } export = environment diff --git a/packages/backend-core/src/objectStore/buckets/app.ts b/packages/backend-core/src/objectStore/buckets/app.ts new file mode 100644 index 0000000000..9951058d6a --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/app.ts @@ -0,0 +1,40 @@ +import env from "../../environment" +import * as objectStore from "../objectStore" +import * as cloudfront from "../cloudfront" + +/** + * In production the client library is stored in the object store, however in development + * we use the symlinked version produced by lerna, located in node modules. We link to this + * via a specific endpoint (under /api/assets/client). + * @param {string} appId In production we need the appId to look up the correct bucket, as the + * version of the client lib may differ between apps. + * @param {string} version The version to retrieve. + * @return {string} The URL to be inserted into appPackage response or server rendered + * app index file. + */ +export const clientLibraryUrl = (appId: string, version: string) => { + if (env.isProd()) { + let file = `${objectStore.sanitizeKey(appId)}/budibase-client.js` + if (env.CLOUDFRONT_CDN) { + // append app version to bust the cache + if (version) { + file += `?v=${version}` + } + // don't need to use presigned for client with cloudfront + // file is public + return cloudfront.getUrl(file) + } else { + return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, file) + } + } else { + return `/api/assets/client` + } +} + +export const getAppFileUrl = (s3Key: string) => { + if (env.CLOUDFRONT_CDN) { + return cloudfront.getPresignedUrl(s3Key) + } else { + return objectStore.getPresignedUrl(env.APPS_BUCKET_NAME, s3Key) + } +} diff --git a/packages/backend-core/src/objectStore/buckets/global.ts b/packages/backend-core/src/objectStore/buckets/global.ts new file mode 100644 index 0000000000..8bf883b11e --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/global.ts @@ -0,0 +1,29 @@ +import env from "../../environment" +import * as tenancy from "../../tenancy" +import * as objectStore from "../objectStore" +import * as cloudfront from "../cloudfront" + +// URLs + +export const getGlobalFileUrl = (type: string, name: string, etag?: string) => { + let file = getGlobalFileS3Key(type, name) + if (env.CLOUDFRONT_CDN) { + if (etag) { + file = `${file}?etag=${etag}` + } + return cloudfront.getPresignedUrl(file) + } else { + return objectStore.getPresignedUrl(env.GLOBAL_BUCKET_NAME, file) + } +} + +// KEYS + +export const getGlobalFileS3Key = (type: string, name: string) => { + let file = `${type}/${name}` + if (env.MULTI_TENANCY) { + const tenantId = tenancy.getTenantId() + file = `${tenantId}/${file}` + } + return file +} diff --git a/packages/backend-core/src/objectStore/buckets/index.ts b/packages/backend-core/src/objectStore/buckets/index.ts new file mode 100644 index 0000000000..8398242ee5 --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/index.ts @@ -0,0 +1,3 @@ +export * from "./app" +export * from "./global" +export * from "./plugins" diff --git a/packages/backend-core/src/objectStore/buckets/plugins.ts b/packages/backend-core/src/objectStore/buckets/plugins.ts new file mode 100644 index 0000000000..cd3bf77e87 --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/plugins.ts @@ -0,0 +1,71 @@ +import env from "../../environment" +import * as objectStore from "../objectStore" +import * as tenancy from "../../tenancy" +import * as cloudfront from "../cloudfront" +import { Plugin } from "@budibase/types" + +// URLS + +export const enrichPluginURLs = (plugins: Plugin[]) => { + if (!plugins || !plugins.length) { + return [] + } + return plugins.map(plugin => { + const jsUrl = getPluginJSUrl(plugin) + const iconUrl = getPluginIconUrl(plugin) + return { ...plugin, jsUrl, iconUrl } + }) +} + +const getPluginJSUrl = (plugin: Plugin) => { + const s3Key = getPluginJSKey(plugin) + return getPluginUrl(s3Key) +} + +const getPluginIconUrl = (plugin: Plugin): string | undefined => { + const s3Key = getPluginIconKey(plugin) + if (!s3Key) { + return + } + return getPluginUrl(s3Key) +} + +const getPluginUrl = (s3Key: string) => { + if (env.CLOUDFRONT_CDN) { + return cloudfront.getPresignedUrl(s3Key) + } else { + return objectStore.getPresignedUrl(env.PLUGIN_BUCKET_NAME, s3Key) + } +} + +// S3 KEYS + +export const getPluginJSKey = (plugin: Plugin) => { + return getPluginS3Key(plugin, "plugin.min.js") +} + +export const getPluginIconKey = (plugin: Plugin) => { + // stored iconUrl is deprecated - hardcode to icon.svg in this case + const iconFileName = plugin.iconUrl ? "icon.svg" : plugin.iconFileName + if (!iconFileName) { + return + } + return getPluginS3Key(plugin, iconFileName) +} + +const getPluginS3Key = (plugin: Plugin, fileName: string) => { + const s3Key = getPluginS3Dir(plugin.name) + return `${s3Key}/${fileName}` +} + +export const getPluginS3Dir = (pluginName: string) => { + let s3Key = `${pluginName}` + if (env.MULTI_TENANCY) { + const tenantId = tenancy.getTenantId() + s3Key = `${tenantId}/${s3Key}` + } + if (env.CLOUDFRONT_CDN) { + s3Key = `plugins/${s3Key}` + } + return s3Key +} diff --git a/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts b/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts new file mode 100644 index 0000000000..0375e97cbc --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/tests/app.spec.ts @@ -0,0 +1,171 @@ +import * as app from "../app" +import { getAppFileUrl } from "../app" +import { testEnv } from "../../../../tests" + +describe("app", () => { + beforeEach(() => { + testEnv.nodeJest() + }) + + describe("clientLibraryUrl", () => { + function getClientUrl() { + return app.clientLibraryUrl("app_123/budibase-client.js", "2.0.0") + } + + describe("single tenant", () => { + beforeAll(() => { + testEnv.singleTenant() + }) + + it("gets url in dev", () => { + testEnv.nodeDev() + const url = getClientUrl() + expect(url).toBe("/api/assets/client") + }) + + it("gets url with embedded minio", () => { + testEnv.withMinio() + const url = getClientUrl() + expect(url).toBe( + "/files/signed/prod-budi-app-assets/app_123/budibase-client.js/budibase-client.js" + ) + }) + + it("gets url with custom S3", () => { + testEnv.withS3() + const url = getClientUrl() + expect(url).toBe( + "http://s3.example.com/prod-budi-app-assets/app_123/budibase-client.js/budibase-client.js" + ) + }) + + it("gets url with cloudfront + s3", () => { + testEnv.withCloudfront() + const url = getClientUrl() + expect(url).toBe( + "http://cf.example.com/app_123/budibase-client.js/budibase-client.js?v=2.0.0" + ) + }) + }) + + describe("multi tenant", () => { + beforeAll(() => { + testEnv.multiTenant() + }) + + it("gets url in dev", async () => { + testEnv.nodeDev() + await testEnv.withTenant(tenantId => { + const url = getClientUrl() + expect(url).toBe("/api/assets/client") + }) + }) + + it("gets url with embedded minio", async () => { + await testEnv.withTenant(tenantId => { + testEnv.withMinio() + const url = getClientUrl() + expect(url).toBe( + "/files/signed/prod-budi-app-assets/app_123/budibase-client.js/budibase-client.js" + ) + }) + }) + + it("gets url with custom S3", async () => { + await testEnv.withTenant(tenantId => { + testEnv.withS3() + const url = getClientUrl() + expect(url).toBe( + "http://s3.example.com/prod-budi-app-assets/app_123/budibase-client.js/budibase-client.js" + ) + }) + }) + + it("gets url with cloudfront + s3", async () => { + await testEnv.withTenant(tenantId => { + testEnv.withCloudfront() + const url = getClientUrl() + expect(url).toBe( + "http://cf.example.com/app_123/budibase-client.js/budibase-client.js?v=2.0.0" + ) + }) + }) + }) + }) + + describe("getAppFileUrl", () => { + function getAppFileUrl() { + return app.getAppFileUrl("app_123/attachments/image.jpeg") + } + + describe("single tenant", () => { + beforeAll(() => { + testEnv.multiTenant() + }) + + it("gets url with embedded minio", () => { + testEnv.withMinio() + const url = getAppFileUrl() + expect(url).toBe( + "/files/signed/prod-budi-app-assets/app_123/attachments/image.jpeg" + ) + }) + + it("gets url with custom S3", () => { + testEnv.withS3() + const url = getAppFileUrl() + expect(url).toBe( + "http://s3.example.com/prod-budi-app-assets/app_123/attachments/image.jpeg" + ) + }) + + it("gets url with cloudfront + s3", () => { + testEnv.withCloudfront() + const url = getAppFileUrl() + // omit rest of signed params + expect( + url.includes("http://cf.example.com/app_123/attachments/image.jpeg?") + ).toBe(true) + }) + }) + + describe("multi tenant", () => { + beforeAll(() => { + testEnv.multiTenant() + }) + + it("gets url with embedded minio", async () => { + testEnv.withMinio() + await testEnv.withTenant(tenantId => { + const url = getAppFileUrl() + expect(url).toBe( + "/files/signed/prod-budi-app-assets/app_123/attachments/image.jpeg" + ) + }) + }) + + it("gets url with custom S3", async () => { + testEnv.withS3() + await testEnv.withTenant(tenantId => { + const url = getAppFileUrl() + expect(url).toBe( + "http://s3.example.com/prod-budi-app-assets/app_123/attachments/image.jpeg" + ) + }) + }) + + it("gets url with cloudfront + s3", async () => { + testEnv.withCloudfront() + await testEnv.withTenant(tenantId => { + const url = getAppFileUrl() + // omit rest of signed params + expect( + url.includes( + "http://cf.example.com/app_123/attachments/image.jpeg?" + ) + ).toBe(true) + }) + }) + }) + }) +}) diff --git a/packages/backend-core/src/objectStore/buckets/tests/global.spec.ts b/packages/backend-core/src/objectStore/buckets/tests/global.spec.ts new file mode 100644 index 0000000000..b495812356 --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/tests/global.spec.ts @@ -0,0 +1,74 @@ +import * as global from "../global" +import { testEnv } from "../../../../tests" + +describe("global", () => { + describe("getGlobalFileUrl", () => { + function getGlobalFileUrl() { + return global.getGlobalFileUrl("settings", "logoUrl", "etag") + } + + describe("single tenant", () => { + beforeAll(() => { + testEnv.singleTenant() + }) + + it("gets url with embedded minio", () => { + testEnv.withMinio() + const url = getGlobalFileUrl() + expect(url).toBe("/files/signed/global/settings/logoUrl") + }) + + it("gets url with custom S3", () => { + testEnv.withS3() + const url = getGlobalFileUrl() + expect(url).toBe("http://s3.example.com/global/settings/logoUrl") + }) + + it("gets url with cloudfront + s3", () => { + testEnv.withCloudfront() + const url = getGlobalFileUrl() + // omit rest of signed params + expect( + url.includes("http://cf.example.com/settings/logoUrl?etag=etag&") + ).toBe(true) + }) + }) + + describe("multi tenant", () => { + beforeAll(() => { + testEnv.multiTenant() + }) + + it("gets url with embedded minio", async () => { + testEnv.withMinio() + await testEnv.withTenant(tenantId => { + const url = getGlobalFileUrl() + expect(url).toBe(`/files/signed/global/${tenantId}/settings/logoUrl`) + }) + }) + + it("gets url with custom S3", async () => { + testEnv.withS3() + await testEnv.withTenant(tenantId => { + const url = getGlobalFileUrl() + expect(url).toBe( + `http://s3.example.com/global/${tenantId}/settings/logoUrl` + ) + }) + }) + + it("gets url with cloudfront + s3", async () => { + testEnv.withCloudfront() + await testEnv.withTenant(tenantId => { + const url = getGlobalFileUrl() + // omit rest of signed params + expect( + url.includes( + `http://cf.example.com/${tenantId}/settings/logoUrl?etag=etag&` + ) + ).toBe(true) + }) + }) + }) + }) +}) diff --git a/packages/backend-core/src/objectStore/buckets/tests/plugins.spec.ts b/packages/backend-core/src/objectStore/buckets/tests/plugins.spec.ts new file mode 100644 index 0000000000..affb8d8318 --- /dev/null +++ b/packages/backend-core/src/objectStore/buckets/tests/plugins.spec.ts @@ -0,0 +1,110 @@ +import * as plugins from "../plugins" +import { structures, testEnv } from "../../../../tests" + +describe("plugins", () => { + describe("enrichPluginURLs", () => { + const plugin = structures.plugins.plugin() + + function getEnrichedPluginUrls() { + const enriched = plugins.enrichPluginURLs([plugin])[0] + return { + jsUrl: enriched.jsUrl!, + iconUrl: enriched.iconUrl!, + } + } + + describe("single tenant", () => { + beforeAll(() => { + testEnv.singleTenant() + }) + + it("gets url with embedded minio", () => { + testEnv.withMinio() + const urls = getEnrichedPluginUrls() + expect(urls.jsUrl).toBe( + `/files/signed/plugins/${plugin.name}/plugin.min.js` + ) + expect(urls.iconUrl).toBe( + `/files/signed/plugins/${plugin.name}/icon.svg` + ) + }) + + it("gets url with custom S3", () => { + testEnv.withS3() + const urls = getEnrichedPluginUrls() + expect(urls.jsUrl).toBe( + `http://s3.example.com/plugins/${plugin.name}/plugin.min.js` + ) + expect(urls.iconUrl).toBe( + `http://s3.example.com/plugins/${plugin.name}/icon.svg` + ) + }) + + it("gets url with cloudfront + s3", () => { + testEnv.withCloudfront() + const urls = getEnrichedPluginUrls() + // omit rest of signed params + expect( + urls.jsUrl.includes( + `http://cf.example.com/plugins/${plugin.name}/plugin.min.js?` + ) + ).toBe(true) + expect( + urls.iconUrl.includes( + `http://cf.example.com/plugins/${plugin.name}/icon.svg?` + ) + ).toBe(true) + }) + }) + + describe("multi tenant", () => { + beforeAll(() => { + testEnv.multiTenant() + }) + + it("gets url with embedded minio", async () => { + testEnv.withMinio() + await testEnv.withTenant(tenantId => { + const urls = getEnrichedPluginUrls() + expect(urls.jsUrl).toBe( + `/files/signed/plugins/${tenantId}/${plugin.name}/plugin.min.js` + ) + expect(urls.iconUrl).toBe( + `/files/signed/plugins/${tenantId}/${plugin.name}/icon.svg` + ) + }) + }) + + it("gets url with custom S3", async () => { + testEnv.withS3() + await testEnv.withTenant(tenantId => { + const urls = getEnrichedPluginUrls() + expect(urls.jsUrl).toBe( + `http://s3.example.com/plugins/${tenantId}/${plugin.name}/plugin.min.js` + ) + expect(urls.iconUrl).toBe( + `http://s3.example.com/plugins/${tenantId}/${plugin.name}/icon.svg` + ) + }) + }) + + it("gets url with cloudfront + s3", async () => { + testEnv.withCloudfront() + await testEnv.withTenant(tenantId => { + const urls = getEnrichedPluginUrls() + // omit rest of signed params + expect( + urls.jsUrl.includes( + `http://cf.example.com/plugins/${tenantId}/${plugin.name}/plugin.min.js?` + ) + ).toBe(true) + expect( + urls.iconUrl.includes( + `http://cf.example.com/plugins/${tenantId}/${plugin.name}/icon.svg?` + ) + ).toBe(true) + }) + }) + }) + }) +}) diff --git a/packages/backend-core/src/objectStore/cloudfront.ts b/packages/backend-core/src/objectStore/cloudfront.ts new file mode 100644 index 0000000000..a61ea7f583 --- /dev/null +++ b/packages/backend-core/src/objectStore/cloudfront.ts @@ -0,0 +1,41 @@ +import env from "../environment" +const cfsign = require("aws-cloudfront-sign") + +let PRIVATE_KEY: string | undefined + +function getPrivateKey() { + if (!env.CLOUDFRONT_PRIVATE_KEY_64) { + throw new Error("CLOUDFRONT_PRIVATE_KEY_64 is not set") + } + + if (PRIVATE_KEY) { + return PRIVATE_KEY + } + + PRIVATE_KEY = Buffer.from(env.CLOUDFRONT_PRIVATE_KEY_64, "base64").toString( + "utf-8" + ) + + return PRIVATE_KEY +} + +const getCloudfrontSignParams = () => { + return { + keypairId: env.CLOUDFRONT_PUBLIC_KEY_ID, + privateKeyString: getPrivateKey(), + expireTime: new Date().getTime() + 1000 * 60 * 60, // 1 hour + } +} + +export const getPresignedUrl = (s3Key: string) => { + const url = getUrl(s3Key) + return cfsign.getSignedUrl(url, getCloudfrontSignParams()) +} + +export const getUrl = (s3Key: string) => { + let prefix = "/" + if (s3Key.startsWith("/")) { + prefix = "" + } + return `${env.CLOUDFRONT_CDN}${prefix}${s3Key}` +} diff --git a/packages/backend-core/src/objectStore/index.ts b/packages/backend-core/src/objectStore/index.ts index 2971834f0e..02c99828dd 100644 --- a/packages/backend-core/src/objectStore/index.ts +++ b/packages/backend-core/src/objectStore/index.ts @@ -1,2 +1,3 @@ export * from "./objectStore" export * from "./utils" +export * from "./buckets" diff --git a/packages/backend-core/src/objectStore/objectStore.ts b/packages/backend-core/src/objectStore/objectStore.ts index 2ae8848c53..89e1c88e10 100644 --- a/packages/backend-core/src/objectStore/objectStore.ts +++ b/packages/backend-core/src/objectStore/objectStore.ts @@ -8,7 +8,7 @@ import { promisify } from "util" import { join } from "path" import fs from "fs" import env from "../environment" -import { budibaseTempDir, ObjectStoreBuckets } from "./utils" +import { budibaseTempDir } from "./utils" import { v4 } from "uuid" import { APP_PREFIX, APP_DEV_PREFIX } from "../db" @@ -26,7 +26,7 @@ type UploadParams = { bucket: string filename: string path: string - type?: string + type?: string | null // can be undefined, we will remove it metadata?: { [key: string]: string | undefined @@ -41,6 +41,7 @@ const CONTENT_TYPE_MAP: any = { json: "application/json", gz: "application/gzip", } + const STRING_CONTENT_TYPES = [ CONTENT_TYPE_MAP.html, CONTENT_TYPE_MAP.css, @@ -58,35 +59,17 @@ export function sanitizeBucket(input: string) { return input.replace(new RegExp(APP_DEV_PREFIX, "g"), APP_PREFIX) } -function publicPolicy(bucketName: string) { - return { - Version: "2012-10-17", - Statement: [ - { - Effect: "Allow", - Principal: { - AWS: ["*"], - }, - Action: "s3:GetObject", - Resource: [`arn:aws:s3:::${bucketName}/*`], - }, - ], - } -} - -const PUBLIC_BUCKETS = [ - ObjectStoreBuckets.APPS, - ObjectStoreBuckets.GLOBAL, - ObjectStoreBuckets.PLUGINS, -] - /** * Gets a connection to the object store using the S3 SDK. * @param {string} bucket the name of the bucket which blobs will be uploaded/retrieved from. + * @param {object} opts configuration for the object store. * @return {Object} an S3 object store object, check S3 Nodejs SDK for usage. * @constructor */ -export const ObjectStore = (bucket: string) => { +export const ObjectStore = ( + bucket: string, + opts: { presigning: boolean } = { presigning: false } +) => { const config: any = { s3ForcePathStyle: true, signatureVersion: "v4", @@ -100,9 +83,20 @@ export const ObjectStore = (bucket: string) => { Bucket: sanitizeBucket(bucket), } } + + // custom S3 is in use i.e. minio if (env.MINIO_URL) { - config.endpoint = env.MINIO_URL + if (opts.presigning && !env.MINIO_ENABLED) { + // IMPORTANT: Signed urls will inspect the host header of the request. + // Normally a signed url will need to be generated with a specified host in mind. + // To support dynamic hosts, e.g. some unknown self-hosted installation url, + // use a predefined host. The host 'minio-service' is also forwarded to minio requests via nginx + config.endpoint = "minio-service" + } else { + config.endpoint = env.MINIO_URL + } } + return new AWS.S3(config) } @@ -135,16 +129,6 @@ export const makeSureBucketExists = async (client: any, bucketName: string) => { await promises[bucketName] delete promises[bucketName] } - // public buckets are quite hidden in the system, make sure - // no bucket is set accidentally - if (PUBLIC_BUCKETS.includes(bucketName)) { - await client - .putBucketPolicy({ - Bucket: bucketName, - Policy: JSON.stringify(publicPolicy(bucketName)), - }) - .promise() - } } else { throw new Error("Unable to write to object store bucket.") } @@ -274,6 +258,36 @@ export const listAllObjects = async (bucketName: string, path: string) => { return objects } +/** + * Generate a presigned url with a default TTL of 1 hour + */ +export const getPresignedUrl = ( + bucketName: string, + key: string, + durationSeconds: number = 3600 +) => { + const objectStore = ObjectStore(bucketName, { presigning: true }) + const params = { + Bucket: sanitizeBucket(bucketName), + Key: sanitizeKey(key), + Expires: durationSeconds, + } + const url = objectStore.getSignedUrl("getObject", params) + + if (!env.MINIO_ENABLED) { + // return the full URL to the client + return url + } else { + // return the path only to the client + // use the presigned url route to ensure the static + // hostname will be used in the request + const signedUrl = new URL(url) + const path = signedUrl.pathname + const query = signedUrl.search + return `/files/signed${path}${query}` + } +} + /** * Same as retrieval function but puts to a temporary file. */ diff --git a/packages/backend-core/src/objectStore/utils.ts b/packages/backend-core/src/objectStore/utils.ts index f3c9e93943..dba5f3d1c2 100644 --- a/packages/backend-core/src/objectStore/utils.ts +++ b/packages/backend-core/src/objectStore/utils.ts @@ -14,7 +14,6 @@ export const ObjectStoreBuckets = { APPS: env.APPS_BUCKET_NAME, TEMPLATES: env.TEMPLATES_BUCKET_NAME, GLOBAL: env.GLOBAL_BUCKET_NAME, - GLOBAL_CLOUD: env.GLOBAL_CLOUD_BUCKET_NAME, PLUGINS: env.PLUGIN_BUCKET_NAME, } diff --git a/packages/backend-core/src/tenancy/tenancy.ts b/packages/backend-core/src/tenancy/tenancy.ts index e0e0703433..732402bcb7 100644 --- a/packages/backend-core/src/tenancy/tenancy.ts +++ b/packages/backend-core/src/tenancy/tenancy.ts @@ -1,4 +1,4 @@ -import { doWithDB, queryPlatformView, getGlobalDBName } from "../db" +import { doWithDB, getGlobalDBName } from "../db" import { DEFAULT_TENANT_ID, getTenantId, @@ -8,11 +8,10 @@ import { import env from "../environment" import { BBContext, - PlatformUser, TenantResolutionStrategy, GetTenantIdOptions, } from "@budibase/types" -import { Header, StaticDatabases, ViewName } from "../constants" +import { Header, StaticDatabases } from "../constants" const TENANT_DOC = StaticDatabases.PLATFORM_INFO.docs.tenants const PLATFORM_INFO_DB = StaticDatabases.PLATFORM_INFO.name @@ -111,27 +110,7 @@ export async function lookupTenantId(userId: string) { }) } -// lookup, could be email or userId, either will return a doc -export async function getTenantUser( - identifier: string -): Promise { - // use the view here and allow to find anyone regardless of casing - // Use lowercase to ensure email login is case-insensitive - const users = await queryPlatformView( - ViewName.PLATFORM_USERS_LOWERCASE, - { - keys: [identifier.toLowerCase()], - include_docs: true, - } - ) - if (Array.isArray(users)) { - return users[0] - } else { - return users - } -} - -export function isUserInAppTenant(appId: string, user?: any) { +export const isUserInAppTenant = (appId: string, user?: any) => { let userTenantId if (user) { userTenantId = user.tenantId || DEFAULT_TENANT_ID diff --git a/packages/backend-core/src/tests/utils.spec.js b/packages/backend-core/src/utils/tests/utils.spec.ts similarity index 61% rename from packages/backend-core/src/tests/utils.spec.js rename to packages/backend-core/src/utils/tests/utils.spec.ts index fb3828921d..bb76a93653 100644 --- a/packages/backend-core/src/tests/utils.spec.js +++ b/packages/backend-core/src/utils/tests/utils.spec.ts @@ -1,8 +1,8 @@ -const { structures } = require("../../tests") -const utils = require("../utils") -const events = require("../events") -const { DEFAULT_TENANT_ID } = require("../constants") -const { doInTenant } = require("../context") +import { structures } from "../../../tests" +import * as utils from "../../utils" +import * as events from "../../events" +import { DEFAULT_TENANT_ID } from "../../constants" +import { doInTenant } from "../../context" describe("utils", () => { describe("platformLogout", () => { @@ -14,4 +14,4 @@ describe("utils", () => { }) }) }) -}) \ No newline at end of file +}) diff --git a/packages/backend-core/src/utils/utils.ts b/packages/backend-core/src/utils/utils.ts index 3e9fbb177a..fd8d31b13f 100644 --- a/packages/backend-core/src/utils/utils.ts +++ b/packages/backend-core/src/utils/utils.ts @@ -1,6 +1,13 @@ import { getAllApps, queryGlobalView } from "../db" import { options } from "../middleware/passport/jwt" -import { Header, Cookie, MAX_VALID_DATE } from "../constants" +import { + Header, + Cookie, + MAX_VALID_DATE, + DocumentType, + SEPARATOR, + ViewName, +} from "../constants" import env from "../environment" import * as userCache from "../cache/user" import { getSessionsForUser, invalidateSessions } from "../security/sessions" @@ -8,12 +15,11 @@ import * as events from "../events" import * as tenancy from "../tenancy" import { App, - BBContext, + Ctx, PlatformLogoutOpts, TenantResolutionStrategy, } from "@budibase/types" import { SetOption } from "cookies" -import { DocumentType, SEPARATOR, ViewName } from "../constants" const jwt = require("jsonwebtoken") const APP_PREFIX = DocumentType.APP + SEPARATOR @@ -25,7 +31,7 @@ function confirmAppId(possibleAppId: string | undefined) { : undefined } -async function resolveAppUrl(ctx: BBContext) { +async function resolveAppUrl(ctx: Ctx) { const appUrl = ctx.path.split("/")[2] let possibleAppUrl = `/${appUrl.toLowerCase()}` @@ -50,7 +56,7 @@ async function resolveAppUrl(ctx: BBContext) { return app && app.appId ? app.appId : undefined } -export function isServingApp(ctx: BBContext) { +export function isServingApp(ctx: Ctx) { // dev app if (ctx.path.startsWith(`/${APP_PREFIX}`)) { return true @@ -67,7 +73,7 @@ export function isServingApp(ctx: BBContext) { * @param {object} ctx The main request body to look through. * @returns {string|undefined} If an appId was found it will be returned. */ -export async function getAppIdFromCtx(ctx: BBContext) { +export async function getAppIdFromCtx(ctx: Ctx) { // look in headers const options = [ctx.headers[Header.APP_ID]] let appId @@ -83,12 +89,16 @@ export async function getAppIdFromCtx(ctx: BBContext) { appId = confirmAppId(ctx.request.body.appId) } - // look in the url - dev app - let appPath = - ctx.request.headers.referrer || - ctx.path.split("/").filter(subPath => subPath.startsWith(APP_PREFIX)) - if (!appId && appPath.length) { - appId = confirmAppId(appPath[0]) + // look in the path + const pathId = parseAppIdFromUrl(ctx.path) + if (!appId && pathId) { + appId = confirmAppId(pathId) + } + + // look in the referer + const refererId = parseAppIdFromUrl(ctx.request.headers.referer) + if (!appId && refererId) { + appId = confirmAppId(refererId) } // look in the url - prod app @@ -99,6 +109,13 @@ export async function getAppIdFromCtx(ctx: BBContext) { return appId } +function parseAppIdFromUrl(url?: string) { + if (!url) { + return + } + return url.split("/").find(subPath => subPath.startsWith(APP_PREFIX)) +} + /** * opens the contents of the specified encrypted JWT. * @return {object} the contents of the token. @@ -115,7 +132,7 @@ export function openJwt(token: string) { * @param {object} ctx The request which is to be manipulated. * @param {string} name The name of the cookie to get. */ -export function getCookie(ctx: BBContext, name: string) { +export function getCookie(ctx: Ctx, name: string) { const cookie = ctx.cookies.get(name) if (!cookie) { @@ -133,7 +150,7 @@ export function getCookie(ctx: BBContext, name: string) { * @param {object} opts options like whether to sign. */ export function setCookie( - ctx: BBContext, + ctx: Ctx, value: any, name = "builder", opts = { sign: true } @@ -159,7 +176,7 @@ export function setCookie( /** * Utility function, simply calls setCookie with an empty string for value */ -export function clearCookie(ctx: BBContext, name: string) { +export function clearCookie(ctx: Ctx, name: string) { setCookie(ctx, null, name) } @@ -169,7 +186,7 @@ export function clearCookie(ctx: BBContext, name: string) { * @param {object} ctx The koa context object to be tested. * @return {boolean} returns true if the call is from the client lib (a built app rather than the builder). */ -export function isClient(ctx: BBContext) { +export function isClient(ctx: Ctx) { return ctx.headers[Header.TYPE] === "client" } diff --git a/packages/backend-core/tests/jestSetup.ts b/packages/backend-core/tests/jestSetup.ts index 7870a721aa..b7ab5b49d9 100644 --- a/packages/backend-core/tests/jestSetup.ts +++ b/packages/backend-core/tests/jestSetup.ts @@ -17,7 +17,9 @@ env._set("MINIO_URL", "http://localhost") env._set("MINIO_ACCESS_KEY", "test") env._set("MINIO_SECRET_KEY", "test") -global.console.log = jest.fn() // console.log are ignored in tests +if (!process.env.DEBUG) { + global.console.log = jest.fn() // console.log are ignored in tests +} if (!process.env.CI) { // set a longer timeout in dev for debugging diff --git a/packages/backend-core/tests/utilities/index.ts b/packages/backend-core/tests/utilities/index.ts index 65578ff013..ee96a94152 100644 --- a/packages/backend-core/tests/utilities/index.ts +++ b/packages/backend-core/tests/utilities/index.ts @@ -1,6 +1,7 @@ export * as mocks from "./mocks" export * as structures from "./structures" export { generator } from "./structures" +export * as testEnv from "./testEnv" import * as dbConfig from "./db" dbConfig.init() diff --git a/packages/backend-core/tests/utilities/mocks/index.ts b/packages/backend-core/tests/utilities/mocks/index.ts index 931816be45..401fd7d7a7 100644 --- a/packages/backend-core/tests/utilities/mocks/index.ts +++ b/packages/backend-core/tests/utilities/mocks/index.ts @@ -1,6 +1,6 @@ -import "./posthog" -import "./events" export * as accounts from "./accounts" export * as date from "./date" export * as licenses from "./licenses" export { default as fetch } from "./fetch" +import "./posthog" +import "./events" diff --git a/packages/backend-core/tests/utilities/structures/index.ts b/packages/backend-core/tests/utilities/structures/index.ts index 68064b9715..e0ed4df9c4 100644 --- a/packages/backend-core/tests/utilities/structures/index.ts +++ b/packages/backend-core/tests/utilities/structures/index.ts @@ -6,3 +6,4 @@ export const generator = new Chance() export * as koa from "./koa" export * as accounts from "./accounts" export * as licenses from "./licenses" +export * as plugins from "./plugins" diff --git a/packages/backend-core/tests/utilities/structures/plugins.ts b/packages/backend-core/tests/utilities/structures/plugins.ts new file mode 100644 index 0000000000..e2d92858d3 --- /dev/null +++ b/packages/backend-core/tests/utilities/structures/plugins.ts @@ -0,0 +1,19 @@ +import { generator } from "." +import { Plugin, PluginSource, PluginType } from "@budibase/types" + +export function plugin(): Plugin { + return { + description: generator.word(), + name: generator.word(), + version: "1.0.0", + source: PluginSource.FILE, + package: { + name: generator.word, + }, + hash: generator.hash(), + schema: { + type: PluginType.DATASOURCE, + }, + iconFileName: "icon.svg", + } +} diff --git a/packages/backend-core/tests/utilities/testEnv.ts b/packages/backend-core/tests/utilities/testEnv.ts new file mode 100644 index 0000000000..b4f06b5153 --- /dev/null +++ b/packages/backend-core/tests/utilities/testEnv.ts @@ -0,0 +1,87 @@ +import env from "../../src/environment" +import * as tenancy from "../../src/tenancy" +import { newid } from "../../src/utils" + +// TENANCY + +export async function withTenant(task: (tenantId: string) => any) { + const tenantId = newid() + return tenancy.doInTenant(tenantId, async () => { + await task(tenantId) + }) +} + +export function singleTenant() { + env._set("MULTI_TENANCY", 0) +} + +export function multiTenant() { + env._set("MULTI_TENANCY", 1) +} + +// NODE + +export function nodeDev() { + env._set("NODE_ENV", "dev") +} + +export function nodeJest() { + env._set("NODE_ENV", "jest") +} + +// FILES + +export function withS3() { + env._set("NODE_ENV", "production") + env._set("MINIO_ENABLED", 0) + env._set("MINIO_URL", "http://s3.example.com") + env._set("CLOUDFRONT_CDN", undefined) +} + +const CLOUDFRONT_TEST_KEY = + "-----BEGIN RSA PRIVATE KEY-----\n" + + "MIIEpAIBAAKCAQEAqXRsir/0Qba1xEnybUs7d7QEAE02GRc+4H7HD5l5VnAxkV1m\n" + + "tNTXTmoYkaIhLdebV1EwQs3T9knxoyd4cVcrDkDfDLZErfYWJsuE3/QYNknnZs4/\n" + + "Ai0cg+v9ZX3gcizvpYg9GQI3INM0uRG8lJwGP7FQ/kknhA2yVFVCSxX6kkNtOUh5\n" + + "dKSG7m6IwswcSwD++Z/94vsFkoZIGY0e1CD/drFJ6+1TFY2YgbDKT5wDFLJ9vHFx\n" + + "/5o4POwn3gz/ru2Db9jbRdfEAqRdy46nRKQgBGUmupAgSK1+BJEzafexp8RmCGb0\n" + + "WUffxOtj8/jNCeCF0JBgVHAe3crOQ8ySrtoaHQIDAQABAoIBAA+ipW07/u6dTDI7\n" + + "XHoHKgqGeqQIe8he47dVG0ruL0rxeTFfe92NkfwzP+cYHZWcQkIRRLG1Six8cCZM\n" + + "uwlCML/U7n++xaGDhlG4D5+WZzGDKi3LM/cgcHQfrzbRIYeHa+lLI9AN60ZFFqVI\n" + + "5KyVpOH1m3KLD3FYzi6H22EQOxmJpqWlt2uArny5LxlPJKmmGSFjvneb4N2ZAKGQ\n" + + "QfClJGz9tRjceWUUdJrpqmTmBQIosKmLPq8PEviUNAVG+6m4r8jiRbf8OKkAm+3L\n" + + "LVIsN8HfYB9jEuERYPnbuXdX0kDEkg0xEyTH5YbNZvfm5ptCU9Xn+Jz1trF+wCHD\n" + + "2RlxdQUCgYEA3U0nCf6NTmmeMCsAX6gvaPuM0iUfUfS3b3G57I6u46lLGNLsfJw6\n" + + "MTpVc164lKYQK9czw/ijKzb8e3mcyzbPorVkajMjUCNWGrMK+vFbOGmqQkhUi30U\n" + + "IJuuTktMd+21D/SpLlev4MLria23vUIKEqNenYpV6wkGLt/mKtISaPMCgYEAxAYx\n" + + "j+xJLTK9eN+rpekwjYE78hD9VoBkBnr/NBiGV302AsJRuq2+L4zcBnAsH+SidFim\n" + + "cwqoj3jeVT8ZQFXlK3fGVaEJsCXd6GWk8ZIWUTn9JZwi2KcCvCU/YiHfx8c7y7Gl\n" + + "SiPXUPsvvkcw6RRh2u4J5tHLIqJe3W58ENoBNK8CgYEApxTBDMKrXTBQxn0w4wfQ\n" + + "A6soPuDYLMBeXj226eswD6KZmDxnYA1zwgcQzPIO2ewm+XKZGrR2PQJezbqbrrHL\n" + + "QkVBcwz49GA5eh8Dg0MGZCki6rhBXK8qqxPfHi2rpkBKG6nUsbBykXeY7XHC75kU\n" + + "kc3WeYsgIzvE908EMAA69hECgYEAinbpiYVZh1DBH+G26MIYZswz4OB5YyHcBevZ\n" + + "2x27v48VmMtUWe4iWopAXVfdA0ZILrD0Gm0b9gRl4IdqudQyxgqcEZ5oLoIBBwjN\n" + + "g0oy83tnwqpQvwLx3p7c79+HqCGmrlK0s/MvQ+e6qMi21t1r5e6hFed5euSA6B8E\n" + + "Cg9ELMcCgYB9bGwlNAE+iuzMIhKev1s7h3TzqKtGw37TtHXvxcTQs3uawJQksQ2s\n" + + "K0Zy1Ta7vybbwAA5m+LxoMT04WUdJO7Cr8/3rBMrbKKO3H7IgC3G+nXnOBdshzn5\n" + + "ifMbhZslFThC/osD5ZV7snXZgTWyPexaINJhHmdrAWpmW1h+UFoiMw==\n" + + "-----END RSA PRIVATE KEY-----\n" + +const CLOUDFRONT_TEST_KEY_64 = Buffer.from( + CLOUDFRONT_TEST_KEY, + "utf-8" +).toString("base64") + +export function withCloudfront() { + withS3() + env._set("CLOUDFRONT_CDN", "http://cf.example.com") + env._set("CLOUDFRONT_PUBLIC_KEY_ID", "keypair_123") + env._set("CLOUDFRONT_PRIVATE_KEY_64", CLOUDFRONT_TEST_KEY_64) +} + +export function withMinio() { + env._set("NODE_ENV", "production") + env._set("MINIO_ENABLED", 1) + env._set("MINIO_URL", "http://minio.example.com") + env._set("CLOUDFRONT_CDN", undefined) +} diff --git a/packages/backend-core/tsconfig.json b/packages/backend-core/tsconfig.json index ccefd149a0..1d9da5f2ae 100644 --- a/packages/backend-core/tsconfig.json +++ b/packages/backend-core/tsconfig.json @@ -8,6 +8,10 @@ } }, "references": [ - { "path": "../types" }, + { "path": "../types" } + ], + "exclude": [ + "node_modules", + "dist" ] } \ No newline at end of file diff --git a/packages/backend-core/yarn.lock b/packages/backend-core/yarn.lock index 0a25d5fb43..5115a44095 100644 --- a/packages/backend-core/yarn.lock +++ b/packages/backend-core/yarn.lock @@ -1526,6 +1526,13 @@ asynckit@^0.4.0: resolved "https://registry.yarnpkg.com/asynckit/-/asynckit-0.4.0.tgz#c79ed97f7f34cb8f2ba1bc9790bcc366474b4b79" integrity sha512-Oei9OH4tRh0YqU3GxhX79dM/mwVgvbZJaSNaRk+bshkj0S5cfHcgYakreBjrHwatXKbz+IoIdYLxrKim2MjW0Q== +aws-cloudfront-sign@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" + integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== + dependencies: + lodash "^3.6.0" + aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -3827,6 +3834,11 @@ lodash@4.17.21, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +lodash@^3.6.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" diff --git a/packages/builder/src/components/backend/DatasourceNavigator/IntegrationIcon.svelte b/packages/builder/src/components/backend/DatasourceNavigator/IntegrationIcon.svelte index e6cfbf7db8..a0cdabc63c 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/IntegrationIcon.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/IntegrationIcon.svelte @@ -1,18 +1,15 @@ + {#each $builderStore.usedPlugins as plugin} + {/each} {/if} diff --git a/packages/server/__mocks__/aws-sdk.ts b/packages/server/__mocks__/aws-sdk.ts index b0da0e97b6..2efbd303f2 100644 --- a/packages/server/__mocks__/aws-sdk.ts +++ b/packages/server/__mocks__/aws-sdk.ts @@ -51,6 +51,25 @@ module AwsMock { Contents: {}, }) ) + + // @ts-ignore + this.getSignedUrl = (operation, params) => { + return `http://test.com/${params.Bucket}/${params.Key}` + } + + // @ts-ignore + this.headBucket = jest.fn( + response({ + Contents: {}, + }) + ) + + // @ts-ignore + this.upload = jest.fn( + response({ + Contents: {}, + }) + ) } aws.DynamoDB = { DocumentClient } diff --git a/packages/server/package.json b/packages/server/package.json index 8019d499f7..9891cd49ba 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -130,13 +130,15 @@ "@types/ioredis": "4.28.10", "@types/jest": "27.5.1", "@types/koa": "2.13.4", - "@types/koa__router": "8.0.11", + "@types/koa__router": "8.0.8", "@types/lodash": "4.14.180", "@types/node": "14.18.20", "@types/node-fetch": "2.6.1", "@types/oracledb": "5.2.2", "@types/pouchdb": "6.4.0", "@types/redis": "4.0.11", + "@types/server-destroy": "1.0.1", + "@types/tar": "6.1.3", "@typescript-eslint/parser": "5.45.0", "apidoc": "0.50.4", "babel-jest": "27.5.1", diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index 7cb48e53df..7c5f02f7d0 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -23,21 +23,18 @@ import { errors, events, migrations, + objectStore, } from "@budibase/backend-core" import { USERS_TABLE_SCHEMA } from "../../constants" import { buildDefaultDocs } from "../../db/defaultData/datasource_bb_default" import { removeAppFromUserRoles } from "../../utilities/workerRequests" -import { - clientLibraryPath, - stringToReadStream, - isQsTrue, -} from "../../utilities" +import { stringToReadStream, isQsTrue } from "../../utilities" import { getLocksById } from "../../utilities/redis" import { updateClientLibrary, backupClientLibrary, revertClientLibrary, -} from "../../utilities/fileSystem/clientLibrary" +} from "../../utilities/fileSystem" import { cleanupAutomations } from "../../automations/utils" import { checkAppMetadata } from "../../automations/logging" import { getUniqueRows } from "../../utilities/usageQuota/rows" @@ -49,9 +46,9 @@ import { MigrationType, BBContext, Database, + UserCtx, } from "@budibase/types" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" -import { enrichPluginURLs } from "../../utilities/plugins" import sdk from "../../sdk" // utility function, need to do away with this @@ -204,27 +201,34 @@ export async function fetchAppDefinition(ctx: BBContext) { } } -export async function fetchAppPackage(ctx: BBContext) { +export async function fetchAppPackage(ctx: UserCtx) { const db = context.getAppDB() let application = await db.get(DocumentType.APP_METADATA) const layouts = await getLayouts() let screens = await getScreens() // Enrich plugin URLs - application.usedPlugins = enrichPluginURLs(application.usedPlugins) + application.usedPlugins = objectStore.enrichPluginURLs( + application.usedPlugins + ) // Only filter screens if the user is not a builder - if (!(ctx.user?.builder && ctx.user.builder.global)) { + if (!(ctx.user.builder && ctx.user.builder.global)) { const userRoleId = getUserRoleId(ctx) const accessController = new roles.AccessController() screens = await accessController.checkScreensAccess(screens, userRoleId) } + const clientLibPath = objectStore.clientLibraryUrl( + ctx.params.appId, + application.version + ) + ctx.body = { application, screens, layouts, - clientLibPath: clientLibraryPath(ctx.params.appId, application.version), + clientLibPath, } } @@ -370,7 +374,7 @@ async function appPostCreate(ctx: BBContext, app: App) { if (err.code && err.code === errors.codes.USAGE_LIMIT_EXCEEDED) { // this import resulted in row usage exceeding the quota // delete the app - // skip pre- and post-steps as no rows have been added to quotas yet + // skip pre and post-steps as no rows have been added to quotas yet ctx.params.appId = app.appId await destroyApp(ctx) } diff --git a/packages/server/src/api/controllers/auth.ts b/packages/server/src/api/controllers/auth.ts index c28b99529b..15b99bf2f8 100644 --- a/packages/server/src/api/controllers/auth.ts +++ b/packages/server/src/api/controllers/auth.ts @@ -3,7 +3,7 @@ import { InternalTables } from "../../db/utils" import { getFullUser } from "../../utilities/users" import { roles, context } from "@budibase/backend-core" import { groups } from "@budibase/pro" -import { ContextUser, User, Row } from "@budibase/types" +import { ContextUser, User, Row, UserCtx } from "@budibase/types" const PUBLIC_ROLE = roles.BUILTIN_ROLE_IDS.PUBLIC @@ -16,7 +16,7 @@ const addSessionAttributesToUser = (ctx: any) => { } } -export async function fetchSelf(ctx: any) { +export async function fetchSelf(ctx: UserCtx) { let userId = ctx.user.userId || ctx.user._id /* istanbul ignore next */ if (!userId || !ctx.isAuthenticated) { diff --git a/packages/server/src/api/controllers/cloud.ts b/packages/server/src/api/controllers/cloud.ts index f8f7a27d00..575682fe04 100644 --- a/packages/server/src/api/controllers/cloud.ts +++ b/packages/server/src/api/controllers/cloud.ts @@ -5,8 +5,8 @@ import { stringToReadStream } from "../../utilities" import { getDocParams, DocumentType, isDevAppID } from "../../db/utils" import { create } from "./application" import { join } from "path" -import { App, BBContext, Database } from "@budibase/types" import sdk from "../../sdk" +import { App, Ctx, Database } from "@budibase/types" async function createApp(appName: string, appDirectory: string) { const ctx = { @@ -35,7 +35,7 @@ async function getAllDocType(db: Database, docType: string) { return response.rows.map(row => row.doc) } -export async function exportApps(ctx: BBContext) { +export async function exportApps(ctx: Ctx) { if (env.SELF_HOSTED || !env.MULTI_TENANCY) { ctx.throw(400, "Exporting only allowed in multi-tenant cloud environments.") } @@ -65,13 +65,13 @@ async function checkHasBeenImported() { return apps.length !== 0 } -export async function hasBeenImported(ctx: BBContext) { +export async function hasBeenImported(ctx: Ctx) { ctx.body = { imported: await checkHasBeenImported(), } } -export async function importApps(ctx: BBContext) { +export async function importApps(ctx: Ctx) { if (!env.SELF_HOSTED || env.MULTI_TENANCY) { ctx.throw(400, "Importing only allowed in self hosted environments.") } @@ -82,12 +82,16 @@ export async function importApps(ctx: BBContext) { "Import file is required and environment must be fresh to import apps." ) } - if (ctx.request.files.importFile.type !== "application/gzip") { + const file = ctx.request.files.importFile + if (Array.isArray(file)) { + ctx.throw(400, "Single file is required") + } + if (file.type !== "application/gzip") { ctx.throw(400, "Import file must be a gzipped tarball.") } // initially get all the app databases out of the tarball - const tmpPath = sdk.backups.untarFile(ctx.request.files.importFile) + const tmpPath = sdk.backups.untarFile(file) const globalDbImport = sdk.backups.getGlobalDBFile(tmpPath) const appNames = sdk.backups.getListOfAppsInMulti(tmpPath) diff --git a/packages/server/src/api/controllers/plugin/index.ts b/packages/server/src/api/controllers/plugin/index.ts index 907fcf65a6..faecbc1fd8 100644 --- a/packages/server/src/api/controllers/plugin/index.ts +++ b/packages/server/src/api/controllers/plugin/index.ts @@ -1,10 +1,14 @@ import { npmUpload, urlUpload, githubUpload, fileUpload } from "./uploaders" -import { plugins as pluginCore, tenancy } from "@budibase/backend-core" -import { PluginType, FileType, PluginSource } from "@budibase/types" +import { + plugins as pluginCore, + db as dbCore, + tenancy, + objectStore, +} from "@budibase/backend-core" +import { PluginType, FileType, PluginSource, Plugin } from "@budibase/types" import env from "../../../environment" import { ClientAppSocket } from "../../../websocket" -import { db as dbCore } from "@budibase/backend-core" -import { plugins } from "@budibase/pro" +import { sdk as pro } from "@budibase/pro" export async function getPlugins(type?: PluginType) { const db = tenancy.getGlobalDB() @@ -13,9 +17,10 @@ export async function getPlugins(type?: PluginType) { include_docs: true, }) ) - const plugins = response.rows.map((row: any) => row.doc) + let plugins = response.rows.map((row: any) => row.doc) as Plugin[] + plugins = objectStore.enrichPluginURLs(plugins) if (type) { - return plugins.filter((plugin: any) => plugin.schema?.type === type) + return plugins.filter((plugin: Plugin) => plugin.schema?.type === type) } else { return plugins } @@ -84,7 +89,7 @@ export async function create(ctx: any) { ) } - const doc = await plugins.storePlugin(metadata, directory, source) + const doc = await pro.plugins.storePlugin(metadata, directory, source) ClientAppSocket.emit("plugins-update", { name, hash: doc.hash }) ctx.body = { @@ -107,7 +112,7 @@ export async function destroy(ctx: any) { const { pluginId } = ctx.params try { - await plugins.deletePlugin(pluginId) + await pro.plugins.deletePlugin(pluginId) ctx.body = { message: `Plugin ${ctx.params.pluginId} deleted.` } } catch (err: any) { @@ -127,7 +132,7 @@ export async function processUploadedPlugin( throw new Error("Only component plugins are supported outside of self-host") } - const doc = await plugins.storePlugin(metadata, directory, source) + const doc = await pro.plugins.storePlugin(metadata, directory, source) ClientAppSocket.emit("plugin-update", { name: doc.name, hash: doc.hash }) return doc } diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index a343553fc8..8eb1ce8263 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -21,7 +21,6 @@ import { getDatasourceAndQuery } from "./utils" import { FieldTypes, RelationshipTypes } from "../../../constants" import { breakExternalTableId, isSQL } from "../../../integrations/utils" import { processObjectSync } from "@budibase/string-templates" -// @ts-ignore import { cloneDeep } from "lodash/fp" import { processFormulas, processDates } from "../../../utilities/rowProcessor" import { context } from "@budibase/backend-core" diff --git a/packages/server/src/api/controllers/row/internal.ts b/packages/server/src/api/controllers/row/internal.ts index ea3277cd59..2b2b1b8b36 100644 --- a/packages/server/src/api/controllers/row/internal.ts +++ b/packages/server/src/api/controllers/row/internal.ts @@ -13,7 +13,7 @@ import { cleanupAttachments, } from "../../../utilities/rowProcessor" import { FieldTypes } from "../../../constants" -import { validate as rowValidate, findRow } from "./utils" +import * as utils from "./utils" import { fullSearch, paginatedSearch } from "./internalSearch" import { getGlobalUsersFromMetadata } from "../../../utilities/global" import * as inMemoryViews from "../../../db/inMemoryView" @@ -30,7 +30,8 @@ import { finaliseRow, updateRelatedFormula } from "./staticFormula" import * as exporters from "../view/exporters" import { apiFileReturn } from "../../../utilities/fileSystem" import { - BBContext, + Ctx, + UserCtx, Database, LinkDocumentValue, Row, @@ -69,7 +70,7 @@ async function getView(db: Database, viewName: string) { return viewInfo } -async function getRawTableData(ctx: BBContext, db: Database, tableId: string) { +async function getRawTableData(ctx: Ctx, db: Database, tableId: string) { let rows if (tableId === InternalTables.USER_METADATA) { await userController.fetchMetadata(ctx) @@ -85,7 +86,7 @@ async function getRawTableData(ctx: BBContext, db: Database, tableId: string) { return rows as Row[] } -export async function patch(ctx: BBContext) { +export async function patch(ctx: UserCtx) { const db = context.getAppDB() const inputs = ctx.request.body const tableId = inputs.tableId @@ -95,7 +96,7 @@ export async function patch(ctx: BBContext) { let dbTable = await db.get(tableId) oldRow = await outputProcessing( dbTable, - await findRow(ctx, tableId, inputs._id) + await utils.findRow(ctx, tableId, inputs._id) ) } catch (err) { if (isUserTable) { @@ -117,8 +118,8 @@ export async function patch(ctx: BBContext) { } // this returns the table and row incase they have been updated - let { table, row } = inputProcessing(ctx.user!, dbTable, combinedRow) - const validateResult = await rowValidate({ + let { table, row } = inputProcessing(ctx.user, dbTable, combinedRow) + const validateResult = await utils.validate({ row, table, }) @@ -150,7 +151,7 @@ export async function patch(ctx: BBContext) { }) } -export async function save(ctx: BBContext) { +export async function save(ctx: UserCtx) { const db = context.getAppDB() let inputs = ctx.request.body inputs.tableId = ctx.params.tableId @@ -161,8 +162,8 @@ export async function save(ctx: BBContext) { // this returns the table and row incase they have been updated const dbTable = await db.get(inputs.tableId) - let { table, row } = inputProcessing(ctx.user!, dbTable, inputs) - const validateResult = await rowValidate({ + let { table, row } = inputProcessing(ctx.user, dbTable, inputs) + const validateResult = await utils.validate({ row, table, }) @@ -185,7 +186,7 @@ export async function save(ctx: BBContext) { }) } -export async function fetchView(ctx: BBContext) { +export async function fetchView(ctx: Ctx) { const viewName = ctx.params.viewName // if this is a table view being looked for just transfer to that @@ -252,7 +253,7 @@ export async function fetchView(ctx: BBContext) { return rows } -export async function fetch(ctx: BBContext) { +export async function fetch(ctx: Ctx) { const db = context.getAppDB() const tableId = ctx.params.tableId @@ -261,15 +262,15 @@ export async function fetch(ctx: BBContext) { return outputProcessing(table, rows) } -export async function find(ctx: BBContext) { +export async function find(ctx: Ctx) { const db = dbCore.getDB(ctx.appId) const table = await db.get(ctx.params.tableId) - let row = await findRow(ctx, ctx.params.tableId, ctx.params.rowId) + let row = await utils.findRow(ctx, ctx.params.tableId, ctx.params.rowId) row = await outputProcessing(table, row) return row } -export async function destroy(ctx: BBContext) { +export async function destroy(ctx: Ctx) { const db = context.getAppDB() const { _id } = ctx.request.body let row = await db.get(_id) @@ -305,7 +306,7 @@ export async function destroy(ctx: BBContext) { return { response, row } } -export async function bulkDestroy(ctx: BBContext) { +export async function bulkDestroy(ctx: Ctx) { const db = context.getAppDB() const tableId = ctx.params.tableId const table = await db.get(tableId) @@ -344,7 +345,7 @@ export async function bulkDestroy(ctx: BBContext) { return { response: { ok: true }, rows: processedRows } } -export async function search(ctx: BBContext) { +export async function search(ctx: Ctx) { // Fetch the whole table when running in cypress, as search doesn't work if (!env.COUCH_DB_URL && env.isCypress()) { return { rows: await fetch(ctx) } @@ -376,14 +377,14 @@ export async function search(ctx: BBContext) { return response } -export async function validate(ctx: BBContext) { - return rowValidate({ +export async function validate(ctx: Ctx) { + return utils.validate({ tableId: ctx.params.tableId, row: ctx.request.body, }) } -export async function exportRows(ctx: BBContext) { +export async function exportRows(ctx: Ctx) { const db = context.getAppDB() const table = await db.get(ctx.params.tableId) const rowIds = ctx.request.body.rows @@ -421,14 +422,14 @@ export async function exportRows(ctx: BBContext) { return apiFileReturn(exporter(headers, rows)) } -export async function fetchEnrichedRow(ctx: BBContext) { +export async function fetchEnrichedRow(ctx: Ctx) { const db = context.getAppDB() const tableId = ctx.params.tableId const rowId = ctx.params.rowId // need table to work out where links go in row let [table, row] = await Promise.all([ db.get(tableId), - findRow(ctx, tableId, rowId), + utils.findRow(ctx, tableId, rowId), ]) // get the link docs const linkVals = (await linkRows.getLinkDocuments({ diff --git a/packages/server/src/api/controllers/row/staticFormula.ts b/packages/server/src/api/controllers/row/staticFormula.ts index 6e43f5822f..47a5af8f5a 100644 --- a/packages/server/src/api/controllers/row/staticFormula.ts +++ b/packages/server/src/api/controllers/row/staticFormula.ts @@ -16,7 +16,10 @@ const { cloneDeep } = require("lodash/fp") * updated. * NOTE: this will only for affect static formulas. */ -export async function updateRelatedFormula(table: Table, enrichedRows: Row[]) { +export async function updateRelatedFormula( + table: Table, + enrichedRows: Row[] | Row +) { const db = context.getAppDB() // no formula to update, we're done if (!table.relatedFormula) { @@ -155,7 +158,7 @@ export async function finaliseRow( enrichedRow = await processFormulas(table, enrichedRow, { dynamic: false }) // this updates the related formulas in other rows based on the relations to this row if (updateFormula) { - await exports.updateRelatedFormula(table, enrichedRow) + await updateRelatedFormula(table, enrichedRow) } return { row: enrichedRow, table } } diff --git a/packages/server/src/api/controllers/row/utils.ts b/packages/server/src/api/controllers/row/utils.ts index c003a16266..60aa8a6b7a 100644 --- a/packages/server/src/api/controllers/row/utils.ts +++ b/packages/server/src/api/controllers/row/utils.ts @@ -7,6 +7,7 @@ import { BBContext, Row, Table } from "@budibase/types" export { removeKeyNumbering } from "../../../integrations/base/utils" const validateJs = require("validate.js") const { cloneDeep } = require("lodash/fp") +import { Ctx } from "@budibase/types" validateJs.extend(validateJs.validators.datetime, { parse: function (value: string) { @@ -25,7 +26,7 @@ export async function getDatasourceAndQuery(json: any) { return makeExternalQuery(datasource, json) } -export async function findRow(ctx: BBContext, tableId: string, rowId: string) { +export async function findRow(ctx: Ctx, tableId: string, rowId: string) { const db = context.getAppDB() let row // TODO remove special user case in future diff --git a/packages/server/src/api/controllers/static/index.ts b/packages/server/src/api/controllers/static/index.ts index 32f5e33325..1113a2a1be 100644 --- a/packages/server/src/api/controllers/static/index.ts +++ b/packages/server/src/api/controllers/static/index.ts @@ -1,11 +1,9 @@ -import { enrichPluginURLs } from "../../../utilities/plugins" - require("svelte/register") const send = require("koa-send") const { resolve, join } = require("../../../utilities/centralPath") const uuid = require("uuid") -const { ObjectStoreBuckets } = require("../../../constants") +import { ObjectStoreBuckets } from "../../../constants" const { processString } = require("@budibase/string-templates") const { loadHandlebarsFile, @@ -13,8 +11,6 @@ const { TOP_LEVEL_PATH, } = require("../../../utilities/fileSystem") const env = require("../../../environment") -const { clientLibraryPath } = require("../../../utilities") -const { attachmentsRelativeURL } = require("../../../utilities") const { DocumentType } = require("../../../db/utils") const { context, objectStore, utils } = require("@budibase/backend-core") const AWS = require("aws-sdk") @@ -33,7 +29,7 @@ async function prepareUpload({ s3Key, bucket, metadata, file }: any) { return { size: file.size, name: file.name, - url: attachmentsRelativeURL(response.Key), + url: objectStore.getAppFileUrl(s3Key), extension: [...file.name.split(".")].pop(), key: response.Key, } @@ -85,7 +81,7 @@ export const uploadFile = async function (ctx: any) { return prepareUpload({ file, - s3Key: `${ctx.appId}/attachments/${processedFileName}`, + s3Key: `${context.getProdAppId()}/attachments/${processedFileName}`, bucket: ObjectStoreBuckets.APPS, }) }) @@ -107,14 +103,14 @@ export const serveApp = async function (ctx: any) { if (!env.isJest()) { const App = require("./templates/BudibaseApp.svelte").default - const plugins = enrichPluginURLs(appInfo.usedPlugins) + const plugins = objectStore.enrichPluginURLs(appInfo.usedPlugins) const { head, html, css } = App.render({ metaImage: "https://res.cloudinary.com/daog6scxm/image/upload/v1666109324/meta-images/budibase-meta-image_uukc1m.png", title: appInfo.name, production: env.isProd(), appId, - clientLibPath: clientLibraryPath(appId, appInfo.version, ctx), + clientLibPath: objectStore.clientLibraryUrl(appId, appInfo.version), usedPlugins: plugins, }) @@ -139,7 +135,7 @@ export const serveBuilderPreview = async function (ctx: any) { let appId = context.getAppId() const previewHbs = loadHandlebarsFile(`${__dirname}/templates/preview.hbs`) ctx.body = await processString(previewHbs, { - clientLibPath: clientLibraryPath(appId, appInfo.version, ctx), + clientLibPath: objectStore.clientLibraryUrl(appId, appInfo.version), }) } else { // just return the app info for jest to assert on diff --git a/packages/server/src/api/routes/index.ts b/packages/server/src/api/routes/index.ts index 02a4900077..8d6b1754a7 100644 --- a/packages/server/src/api/routes/index.ts +++ b/packages/server/src/api/routes/index.ts @@ -26,13 +26,14 @@ import cloudRoutes from "./cloud" import migrationRoutes from "./migrations" import pluginRoutes from "./plugin" import Router from "@koa/router" -import { api } from "@budibase/pro" +import { api as pro } from "@budibase/pro" export { default as staticRoutes } from "./static" export { default as publicRoutes } from "./public" -const appBackupRoutes = api.appBackups -const scheduleRoutes = api.schedules +const appBackupRoutes = pro.appBackups +const scheduleRoutes = pro.schedules + export const mainRoutes: Router[] = [ appBackupRoutes, backupRoutes, diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index 65e6df544a..cd09302dcc 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -10,6 +10,7 @@ const { StaticQuotaName, MonthlyQuotaName, } = require("@budibase/types") +const { structures } = require("@budibase/backend-core/tests"); describe("/rows", () => { let request = setup.getRequest() @@ -494,12 +495,13 @@ describe("/rows", () => { describe("attachments", () => { it("should allow enriching attachment rows", async () => { const table = await config.createAttachmentTable() + const attachmentId = `${structures.uuid()}.csv` const row = await config.createRow({ name: "test", description: "test", attachment: [ { - key: `${config.getAppId()}/attachments/test/thing.csv`, + key: `${config.getAppId()}/attachments/${attachmentId}`, }, ], tableId: table._id, @@ -509,7 +511,7 @@ describe("/rows", () => { context.doInAppContext(config.getAppId(), async () => { const enriched = await outputProcessing(table, [row]) expect(enriched[0].attachment[0].url).toBe( - `/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv` + `/files/signed/prod-budi-app-assets/${config.getProdAppId()}/attachments/${attachmentId}` ) }) }) diff --git a/packages/server/src/api/routes/tests/static.spec.js b/packages/server/src/api/routes/tests/static.spec.js index dba8cd76f9..cbfe167100 100644 --- a/packages/server/src/api/routes/tests/static.spec.js +++ b/packages/server/src/api/routes/tests/static.spec.js @@ -1,20 +1,5 @@ -jest.mock("node-fetch") -jest.mock("aws-sdk", () => ({ - config: { - update: jest.fn(), - }, - DynamoDB: { - DocumentClient: jest.fn(), - }, - S3: jest.fn(() => ({ - getSignedUrl: jest.fn(() => { - return "my-url" - }), - })), -})) - const setup = require("./utilities") -const { events, constants } = require("@budibase/backend-core") +const { constants } = require("@budibase/backend-core") describe("/static", () => { let request = setup.getRequest() @@ -102,7 +87,7 @@ describe("/static", () => { .set(config.defaultHeaders()) .expect("Content-Type", /json/) .expect(200) - expect(res.body.signedUrl).toEqual("my-url") + expect(res.body.signedUrl).toEqual("http://test.com/foo/bar") expect(res.body.publicUrl).toEqual( `https://${bucket}.s3.eu-west-1.amazonaws.com/${key}` ) diff --git a/packages/server/src/environment.ts b/packages/server/src/environment.ts index e7418ba5ec..1330dbc2f2 100644 --- a/packages/server/src/environment.ts +++ b/packages/server/src/environment.ts @@ -112,12 +112,17 @@ if (isDev() && module.exports.DISABLE_THREADING == null) { } // clean up any environment variable edge cases -for (let [key, value] of Object.entries(module.exports)) { +for (let [key, value] of Object.entries(environment)) { // handle the edge case of "0" to disable an environment variable if (value === "0") { // @ts-ignore environment[key] = 0 } + // handle the edge case of "false" to disable an environment variable + if (value === "false") { + // @ts-ignore + environment[key] = 0 + } } export = environment diff --git a/packages/server/src/integrations/index.ts b/packages/server/src/integrations/index.ts index e6f5968e32..283deedd70 100644 --- a/packages/server/src/integrations/index.ts +++ b/packages/server/src/integrations/index.ts @@ -98,11 +98,7 @@ export async function getIntegration(integration: string) { for (let plugin of plugins) { if (plugin.name === integration) { // need to use commonJS require due to its dynamic runtime nature - const retrieved: any = await getDatasourcePlugin( - plugin.name, - plugin.jsUrl, - plugin.schema?.hash - ) + const retrieved: any = await getDatasourcePlugin(plugin) if (retrieved.integration) { return retrieved.integration } else { diff --git a/packages/server/src/migrations/functions/backfill/global/configs.ts b/packages/server/src/migrations/functions/backfill/global/configs.ts index 9186a1626a..7eaa987bc7 100644 --- a/packages/server/src/migrations/functions/backfill/global/configs.ts +++ b/packages/server/src/migrations/functions/backfill/global/configs.ts @@ -5,6 +5,7 @@ import { isGoogleConfig, isOIDCConfig, isSettingsConfig, + ConfigType, } from "@budibase/types" import env from "./../../../../environment" @@ -31,15 +32,15 @@ export const backfill = async ( await events.email.SMTPCreated(timestamp) } if (isGoogleConfig(config)) { - await events.auth.SSOCreated("google", timestamp) + await events.auth.SSOCreated(ConfigType.GOOGLE, timestamp) if (config.config.activated) { - await events.auth.SSOActivated("google", timestamp) + await events.auth.SSOActivated(ConfigType.GOOGLE, timestamp) } } if (isOIDCConfig(config)) { - await events.auth.SSOCreated("oidc", timestamp) + await events.auth.SSOCreated(ConfigType.OIDC, timestamp) if (config.config.configs[0].activated) { - await events.auth.SSOActivated("oidc", timestamp) + await events.auth.SSOActivated(ConfigType.OIDC, timestamp) } } if (isSettingsConfig(config)) { diff --git a/packages/server/src/sdk/app/backups/imports.ts b/packages/server/src/sdk/app/backups/imports.ts index 4c2a721c2c..a4eec35361 100644 --- a/packages/server/src/sdk/app/backups/imports.ts +++ b/packages/server/src/sdk/app/backups/imports.ts @@ -55,12 +55,8 @@ async function updateAttachmentColumns(prodAppId: string, db: Database) { continue } row[column] = row[column].map((attachment: RowAttachment) => { - // URL looks like: /prod-budi-app-assets/appId/attachments/file.csv - const urlParts = attachment.url.split("/") - // drop the first empty element - urlParts.shift() - // get the prefix - const prefix = urlParts.shift() + // Key looks like: appId/attachments/file.csv + const urlParts = attachment.key.split("/") // remove the app ID urlParts.shift() // add new app ID @@ -69,7 +65,7 @@ async function updateAttachmentColumns(prodAppId: string, db: Database) { return { ...attachment, key, - url: `/${prefix}/${key}`, + url: "", // calculated on retrieval using key } }) } diff --git a/packages/server/src/tests/jestSetup.ts b/packages/server/src/tests/jestSetup.ts index c178cb4449..b53ac2d9fa 100644 --- a/packages/server/src/tests/jestSetup.ts +++ b/packages/server/src/tests/jestSetup.ts @@ -19,7 +19,10 @@ import { mocks } from "@budibase/backend-core/tests" const tk = require("timekeeper") tk.freeze(mocks.date.MOCK_DATE) -global.console.log = jest.fn() // console.log are ignored in tests +if (!process.env.DEBUG) { + global.console.log = jest.fn() // console.log are ignored in tests + global.console.warn = jest.fn() // console.warn are ignored in tests +} if (!process.env.CI) { // set a longer timeout in dev for debugging diff --git a/packages/server/src/utilities/fileSystem/app.ts b/packages/server/src/utilities/fileSystem/app.ts new file mode 100644 index 0000000000..b8976336ac --- /dev/null +++ b/packages/server/src/utilities/fileSystem/app.ts @@ -0,0 +1,86 @@ +import { budibaseTempDir } from "../budibaseDir" +import fs from "fs" +import { join } from "path" +import { ObjectStoreBuckets } from "../../constants" +import { updateClientLibrary } from "./clientLibrary" +import env from "../../environment" +import { objectStore, context } from "@budibase/backend-core" +import { TOP_LEVEL_PATH } from "./filesystem" + +export const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") + +/** + * Uploads the latest client library to the object store. + * @param {string} appId The ID of the app which is being created. + * @return {Promise} once promise completes app resources should be ready in object store. + */ +export const createApp = async (appId: string) => { + await updateClientLibrary(appId) +} + +/** + * Removes all of the assets created for an app in the object store. + * @param {string} appId The ID of the app which is being deleted. + * @return {Promise} once promise completes the app resources will be removed from object store. + */ +export const deleteApp = async (appId: string) => { + await objectStore.deleteFolder(ObjectStoreBuckets.APPS, `${appId}/`) +} + +/** + * Retrieves component libraries from object store (or tmp symlink if in local) + */ +export const getComponentLibraryManifest = async (library: string) => { + const appId = context.getAppId() + const filename = "manifest.json" + /* istanbul ignore next */ + // when testing in cypress and so on we need to get the package + // as the environment may not be fully fleshed out for dev or prod + if (env.isTest()) { + library = library.replace("standard-components", "client") + const lib = library.split("/")[1] + const path = require.resolve(library).split(lib)[0] + return require(join(path, lib, filename)) + } else if (env.isDev()) { + const path = join(NODE_MODULES_PATH, "@budibase", "client", filename) + // always load from new so that updates are refreshed + delete require.cache[require.resolve(path)] + return require(path) + } + + if (!appId) { + throw new Error("No app ID found - cannot get component libraries") + } + + let resp + let path + try { + // Try to load the manifest from the new file location + path = join(appId, filename) + resp = await objectStore.retrieve(ObjectStoreBuckets.APPS, path) + } catch (error) { + console.error( + `component-manifest-objectstore=failed appId=${appId} path=${path}`, + error + ) + // Fallback to loading it from the old location for old apps + path = join(appId, "node_modules", library, "package", filename) + resp = await objectStore.retrieve(ObjectStoreBuckets.APPS, path) + } + if (typeof resp !== "string") { + resp = resp.toString("utf8") + } + return JSON.parse(resp) +} + +/** + * Given a set of app IDs makes sure file system is cleared of any of their temp info. + */ +export const cleanup = (appIds: string[]) => { + for (let appId of appIds) { + const path = join(budibaseTempDir(), appId) + if (fs.existsSync(path)) { + fs.rmdirSync(path, { recursive: true }) + } + } +} diff --git a/packages/server/src/utilities/fileSystem/clientLibrary.ts b/packages/server/src/utilities/fileSystem/clientLibrary.ts index 9fb96ff9a5..da4decb3e3 100644 --- a/packages/server/src/utilities/fileSystem/clientLibrary.ts +++ b/packages/server/src/utilities/fileSystem/clientLibrary.ts @@ -4,7 +4,7 @@ import fs from "fs" import { objectStore } from "@budibase/backend-core" import { resolve } from "../centralPath" import env from "../../environment" -const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..") +import { TOP_LEVEL_PATH } from "./filesystem" /** * Client library paths in the object store: diff --git a/packages/server/src/utilities/fileSystem/filesystem.ts b/packages/server/src/utilities/fileSystem/filesystem.ts new file mode 100644 index 0000000000..0c9f1ee8cd --- /dev/null +++ b/packages/server/src/utilities/fileSystem/filesystem.ts @@ -0,0 +1,170 @@ +import { PathLike } from "fs" +const { budibaseTempDir } = require("../budibaseDir") +const fs = require("fs") +const { join } = require("path") +const uuid = require("uuid/v4") +const env = require("../../environment") +import tar from "tar" + +export const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..") + +/** + * Upon first startup of instance there may not be everything we need in tmp directory, set it up. + */ +export const init = () => { + const tempDir = budibaseTempDir() + if (!fs.existsSync(tempDir)) { + // some test cases fire this quickly enough that + // synchronous cases can end up here at the same time + try { + fs.mkdirSync(tempDir) + } catch (err: any) { + if (!err || err.code !== "EEXIST") { + throw err + } + } + } + const clientLibPath = join(budibaseTempDir(), "budibase-client.js") + if (env.isTest() && !fs.existsSync(clientLibPath)) { + fs.copyFileSync(require.resolve("@budibase/client"), clientLibPath) + } +} + +/** + * Checks if the system is currently in development mode and if it is makes sure + * everything required to function is ready. + */ +export const checkDevelopmentEnvironment = () => { + if (!env.isDev() || env.isTest()) { + return + } + if (!fs.existsSync(budibaseTempDir())) { + fs.mkdirSync(budibaseTempDir()) + } + let error + if (!fs.existsSync(join(process.cwd(), ".env"))) { + error = "Must run via yarn once to generate environment." + } + if (error) { + console.error(error) + process.exit(-1) + } +} + +/** + * Used to retrieve a handlebars file from the system which will be used as a template. + * This is allowable as the template handlebars files should be static and identical across + * the cluster. + * @param {string} path The path to the handlebars file which is to be loaded. + * @returns {string} The loaded handlebars file as a string - loaded as utf8. + */ +export const loadHandlebarsFile = (path: PathLike) => { + return fs.readFileSync(path, "utf8") +} + +/** + * When return a file from the API need to write the file to the system temporarily so we + * can create a read stream to send. + * @param {string} contents the contents of the file which is to be returned from the API. + * @return {Object} the read stream which can be put into the koa context body. + */ +export const apiFileReturn = (contents: any) => { + const path = join(budibaseTempDir(), uuid()) + fs.writeFileSync(path, contents) + return fs.createReadStream(path) +} + +export const streamFile = (path: string) => { + return fs.createReadStream(path) +} + +/** + * Writes the provided contents to a temporary file, which can be used briefly. + * @param {string} fileContents contents which will be written to a temp file. + * @return {string} the path to the temp file. + */ +export const storeTempFile = (fileContents: any) => { + const path = join(budibaseTempDir(), uuid()) + fs.writeFileSync(path, fileContents) + return path +} + +/** + * Utility function for getting a file read stream - a simple in memory buffered read + * stream doesn't work for pouchdb. + */ +export const stringToFileStream = (contents: any) => { + const path = storeTempFile(contents) + return fs.createReadStream(path) +} + +/** + * Creates a temp file and returns it from the API. + * @param {string} fileContents the contents to be returned in file. + */ +export const sendTempFile = (fileContents: any) => { + const path = storeTempFile(fileContents) + return fs.createReadStream(path) +} + +/** + * All file reads come through here just to make sure all of them make sense + * allows a centralised location to check logic is all good. + */ +export const readFileSync = (filepath: PathLike, options = "utf8") => { + return fs.readFileSync(filepath, options) +} + +export const createTempFolder = (item: any) => { + const path = join(budibaseTempDir(), item) + try { + // remove old tmp directories automatically - don't combine + if (fs.existsSync(path)) { + fs.rmSync(path, { recursive: true, force: true }) + } + fs.mkdirSync(path) + } catch (err: any) { + throw new Error(`Path cannot be created: ${err.message}`) + } + + return path +} + +export const extractTarball = async (fromFilePath: string, toPath: string) => { + await tar.extract({ + file: fromFilePath, + C: toPath, + }) +} + +/** + * Find for a file recursively from start path applying filter, return first match + */ +export const findFileRec = (startPath: PathLike, filter: string): any => { + if (!fs.existsSync(startPath)) { + return + } + + const files = fs.readdirSync(startPath) + for (let i = 0, len = files.length; i < len; i++) { + const filename = join(startPath, files[i]) + const stat = fs.lstatSync(filename) + + if (stat.isDirectory()) { + return findFileRec(filename, filter) + } else if (filename.endsWith(filter)) { + return filename + } + } +} + +/** + * Remove a folder which is not empty from the file system + */ +export const deleteFolderFileSystem = (path: PathLike) => { + if (!fs.existsSync(path)) { + return + } + + fs.rmSync(path, { recursive: true, force: true }) +} diff --git a/packages/server/src/utilities/fileSystem/index.ts b/packages/server/src/utilities/fileSystem/index.ts index 58a687c31b..836ee3aebd 100644 --- a/packages/server/src/utilities/fileSystem/index.ts +++ b/packages/server/src/utilities/fileSystem/index.ts @@ -1,348 +1,5 @@ -import { budibaseTempDir } from "../budibaseDir" -import fs from "fs" -import { join } from "path" -import { context, objectStore } from "@budibase/backend-core" -import { ObjectStoreBuckets } from "../../constants" -import { updateClientLibrary } from "./clientLibrary" -import { checkSlashesInUrl } from "../" -import env from "../../environment" -import fetch from "node-fetch" -const uuid = require("uuid/v4") -const tar = require("tar") - -export const TOP_LEVEL_PATH = join(__dirname, "..", "..", "..") -export const NODE_MODULES_PATH = join(TOP_LEVEL_PATH, "node_modules") -const DATASOURCE_PATH = join(budibaseTempDir(), "datasource") - -/** - * The single stack system (Cloud and Builder) should not make use of the file system where possible, - * this file handles all of the file access for the system with the intention of limiting it all to one - * place. Keeping all of this logic in one place means that when we need to do file system access (like - * downloading a package or opening a temporary file) in can be done in way that we can confirm it shouldn't - * be done through an object store instead. - */ - -/** - * Upon first startup of instance there may not be everything we need in tmp directory, set it up. - */ -export function init() { - const tempDir = budibaseTempDir() - if (!fs.existsSync(tempDir)) { - // some test cases fire this quickly enough that - // synchronous cases can end up here at the same time - try { - fs.mkdirSync(tempDir) - } catch (err: any) { - if (!err || err.code !== "EEXIST") { - throw err - } - } - } - const clientLibPath = join(budibaseTempDir(), "budibase-client.js") - if (env.isTest() && !fs.existsSync(clientLibPath)) { - fs.copyFileSync(require.resolve("@budibase/client"), clientLibPath) - } -} - -/** - * Checks if the system is currently in development mode and if it is makes sure - * everything required to function is ready. - */ -exports.checkDevelopmentEnvironment = () => { - if (!env.isDev() || env.isTest()) { - return - } - if (!fs.existsSync(budibaseTempDir())) { - fs.mkdirSync(budibaseTempDir()) - } - let error - if (!fs.existsSync(join(process.cwd(), ".env"))) { - error = "Must run via yarn once to generate environment." - } - if (error) { - console.error(error) - process.exit(-1) - } -} - -/** - * Used to retrieve a handlebars file from the system which will be used as a template. - * This is allowable as the template handlebars files should be static and identical across - * the cluster. - * @param {string} path The path to the handlebars file which is to be loaded. - * @returns {string} The loaded handlebars file as a string - loaded as utf8. - */ -export function loadHandlebarsFile(path: string) { - return fs.readFileSync(path, "utf8") -} - -/** - * When return a file from the API need to write the file to the system temporarily so we - * can create a read stream to send. - * @param {string} contents the contents of the file which is to be returned from the API. - * @param {string} encoding the encoding of the file to return (utf8 default) - * @return {Object} the read stream which can be put into the koa context body. - */ -export function apiFileReturn( - contents: string, - encoding: BufferEncoding = "utf8" -) { - const path = join(budibaseTempDir(), uuid()) - fs.writeFileSync(path, contents, { encoding }) - return fs.createReadStream(path, { encoding }) -} - -export function streamFile(path: string) { - return fs.createReadStream(path) -} - -/** - * Writes the provided contents to a temporary file, which can be used briefly. - * @param {string} fileContents contents which will be written to a temp file. - * @return {string} the path to the temp file. - */ -export function storeTempFile(fileContents: string) { - const path = join(budibaseTempDir(), uuid()) - fs.writeFileSync(path, fileContents) - return path -} - -/** - * Utility function for getting a file read stream - a simple in memory buffered read - * stream doesn't work for pouchdb. - */ -export function stringToFileStream(contents: string) { - const path = exports.storeTempFile(contents) - return fs.createReadStream(path) -} - -/** - * Creates a temp file and returns it from the API. - * @param {string} fileContents the contents to be returned in file. - */ -export function sendTempFile(fileContents: string) { - const path = exports.storeTempFile(fileContents) - return fs.createReadStream(path) -} - -/** - * Uploads the latest client library to the object store. - * @param {string} appId The ID of the app which is being created. - * @return {Promise} once promise completes app resources should be ready in object store. - */ -export async function createApp(appId: string) { - await updateClientLibrary(appId) -} - -/** - * Removes all of the assets created for an app in the object store. - * @param {string} appId The ID of the app which is being deleted. - * @return {Promise} once promise completes the app resources will be removed from object store. - */ -export async function deleteApp(appId: string) { - await objectStore.deleteFolder(ObjectStoreBuckets.APPS, `${appId}/`) -} - -/** - * Retrieves a template and pipes it to minio as well as making it available temporarily. - * @param {string} type The type of template which is to be retrieved. - * @param name - * @return {Promise<*>} - */ -export async function downloadTemplate(type: string, name: string) { - const DEFAULT_TEMPLATES_BUCKET = - "prod-budi-templates.s3-eu-west-1.amazonaws.com" - const templateUrl = `https://${DEFAULT_TEMPLATES_BUCKET}/templates/${type}/${name}.tar.gz` - return objectStore.downloadTarball( - templateUrl, - ObjectStoreBuckets.TEMPLATES, - type - ) -} - -/** - * Retrieves component libraries from object store (or tmp symlink if in local) - */ -export async function getComponentLibraryManifest(library: string) { - const appId = context.getAppId() - const filename = "manifest.json" - /* istanbul ignore next */ - // when testing in cypress and so on we need to get the package - // as the environment may not be fully fleshed out for dev or prod - if (env.isTest()) { - library = library.replace("standard-components", "client") - const lib = library.split("/")[1] - const path = require.resolve(library).split(lib)[0] - return require(join(path, lib, filename)) - } else if (env.isDev()) { - const path = join(NODE_MODULES_PATH, "@budibase", "client", filename) - // always load from new so that updates are refreshed - delete require.cache[require.resolve(path)] - return require(path) - } - - if (!appId) { - throw new Error("No app ID found - cannot get component libraries") - } - - let resp - let path - try { - // Try to load the manifest from the new file location - path = join(appId, filename) - resp = await objectStore.retrieve(ObjectStoreBuckets.APPS, path) - } catch (error) { - console.error( - `component-manifest-objectstore=failed appId=${appId} path=${path}`, - error - ) - // Fallback to loading it from the old location for old apps - path = join(appId, "node_modules", library, "package", filename) - resp = await objectStore.retrieve(ObjectStoreBuckets.APPS, path) - } - if (typeof resp !== "string") { - resp = resp.toString("utf8") - } - return JSON.parse(resp) -} - -/** - * All file reads come through here just to make sure all of them make sense - * allows a centralised location to check logic is all good. - */ -export function readFileSync( - filepath: string, - options: BufferEncoding = "utf8" -) { - return fs.readFileSync(filepath, { encoding: options }) -} - -/** - * Given a set of app IDs makes sure file system is cleared of any of their temp info. - */ -export function cleanup(appIds: string[]) { - for (let appId of appIds) { - const path = join(budibaseTempDir(), appId) - if (fs.existsSync(path)) { - fs.rmdirSync(path, { recursive: true }) - } - } -} - -export function createTempFolder(item: string) { - const path = join(budibaseTempDir(), item) - try { - // remove old tmp directories automatically - don't combine - if (fs.existsSync(path)) { - fs.rmSync(path, { recursive: true, force: true }) - } - fs.mkdirSync(path) - } catch (err: any) { - throw new Error(`Path cannot be created: ${err.message}`) - } - - return path -} - -export async function extractTarball(fromFilePath: string, toPath: string) { - await tar.extract({ - file: fromFilePath, - C: toPath, - }) -} - -export async function getPluginMetadata(path: string) { - let metadata: { schema?: any; package?: any } = {} - try { - const pkg = fs.readFileSync(join(path, "package.json"), "utf8") - const schema = fs.readFileSync(join(path, "schema.json"), "utf8") - - metadata.schema = JSON.parse(schema) - metadata.package = JSON.parse(pkg) - - if ( - !metadata.package.name || - !metadata.package.version || - !metadata.package.description - ) { - throw new Error( - "package.json is missing one of 'name', 'version' or 'description'." - ) - } - } catch (err: any) { - throw new Error( - `Unable to process schema.json/package.json in plugin. ${err.message}` - ) - } - - return { metadata, directory: path } -} - -export async function getDatasourcePlugin( - name: string, - url: string, - hash: string -) { - if (!fs.existsSync(DATASOURCE_PATH)) { - fs.mkdirSync(DATASOURCE_PATH) - } - const filename = join(DATASOURCE_PATH, name) - const metadataName = `${filename}.bbmetadata` - if (fs.existsSync(filename)) { - const currentHash = fs.readFileSync(metadataName, "utf8") - // if hash is the same return the file, otherwise remove it and re-download - if (currentHash === hash) { - return require(filename) - } else { - console.log(`Updating plugin: ${name}`) - delete require.cache[require.resolve(filename)] - fs.unlinkSync(filename) - } - } - const fullUrl = checkSlashesInUrl( - `${env.MINIO_URL}/${ObjectStoreBuckets.PLUGINS}/${url}` - ) - const response = await fetch(fullUrl) - if (response.status === 200) { - const content = await response.text() - fs.writeFileSync(filename, content) - fs.writeFileSync(metadataName, hash) - return require(filename) - } else { - throw new Error( - `Unable to retrieve plugin - reason: ${await response.text()}` - ) - } -} - -/** - * Find for a file recursively from start path applying filter, return first match - */ -export function findFileRec(startPath: string, filter: any) { - if (!fs.existsSync(startPath)) { - return - } - - const files = fs.readdirSync(startPath) - for (let i = 0, len = files.length; i < len; i++) { - const filename = join(startPath, files[i]) - const stat = fs.lstatSync(filename) - - if (stat.isDirectory()) { - return exports.findFileRec(filename, filter) - } else if (filename.endsWith(filter)) { - return filename - } - } -} - -/** - * Remove a folder which is not empty from the file system - */ -export function deleteFolderFileSystem(path: string) { - if (!fs.existsSync(path)) { - return - } - - fs.rmSync(path, { recursive: true, force: true }) -} +export * from "./app" +export * from "./clientLibrary" +export * from "./filesystem" +export * from "./plugin" +export * from "./template" diff --git a/packages/server/src/utilities/fileSystem/plugin.ts b/packages/server/src/utilities/fileSystem/plugin.ts new file mode 100644 index 0000000000..ea1742faba --- /dev/null +++ b/packages/server/src/utilities/fileSystem/plugin.ts @@ -0,0 +1,65 @@ +import { Plugin } from "@budibase/types" + +const { budibaseTempDir } = require("../budibaseDir") +const fs = require("fs") +const { join } = require("path") +import { objectStore } from "@budibase/backend-core" + +const DATASOURCE_PATH = join(budibaseTempDir(), "datasource") + +export const getPluginMetadata = async (path: string) => { + let metadata: any = {} + try { + const pkg = fs.readFileSync(join(path, "package.json"), "utf8") + const schema = fs.readFileSync(join(path, "schema.json"), "utf8") + + metadata.schema = JSON.parse(schema) + metadata.package = JSON.parse(pkg) + + if ( + !metadata.package.name || + !metadata.package.version || + !metadata.package.description + ) { + throw new Error( + "package.json is missing one of 'name', 'version' or 'description'." + ) + } + } catch (err: any) { + throw new Error( + `Unable to process schema.json/package.json in plugin. ${err.message}` + ) + } + + return { metadata, directory: path } +} + +export const getDatasourcePlugin = async (plugin: Plugin) => { + const hash = plugin.schema?.hash + if (!fs.existsSync(DATASOURCE_PATH)) { + fs.mkdirSync(DATASOURCE_PATH) + } + const filename = join(DATASOURCE_PATH, plugin.name) + const metadataName = `${filename}.bbmetadata` + if (fs.existsSync(filename)) { + const currentHash = fs.readFileSync(metadataName, "utf8") + // if hash is the same return the file, otherwise remove it and re-download + if (currentHash === hash) { + return require(filename) + } else { + console.log(`Updating plugin: ${plugin.name}`) + delete require.cache[require.resolve(filename)] + fs.unlinkSync(filename) + } + } + const pluginKey = objectStore.getPluginJSKey(plugin) + const pluginJs = await objectStore.retrieve( + objectStore.ObjectStoreBuckets.PLUGINS, + pluginKey + ) + + fs.writeFileSync(filename, pluginJs) + fs.writeFileSync(metadataName, hash) + + return require(filename) +} diff --git a/packages/server/src/utilities/fileSystem/template.ts b/packages/server/src/utilities/fileSystem/template.ts new file mode 100644 index 0000000000..17a959007e --- /dev/null +++ b/packages/server/src/utilities/fileSystem/template.ts @@ -0,0 +1,36 @@ +const fs = require("fs") +const { join } = require("path") +import { ObjectStoreBuckets } from "../../constants" +import { objectStore } from "@budibase/backend-core" + +/** + * This function manages temporary template files which are stored by Koa. + * @param {Object} template The template object retrieved from the Koa context object. + * @returns {Object} Returns an fs read stream which can be loaded into the database. + */ +export const getTemplateStream = async (template: any) => { + if (template.file) { + return fs.createReadStream(template.file.path) + } else { + const [type, name] = template.key.split("/") + const tmpPath = await downloadTemplate(type, name) + return fs.createReadStream(join(tmpPath, name, "db", "dump.txt")) + } +} + +/** + * Retrieves a template and pipes it to minio as well as making it available temporarily. + * @param {string} type The type of template which is to be retrieved. + * @param name + * @return {Promise<*>} + */ +export const downloadTemplate = async (type: string, name: string) => { + const DEFAULT_TEMPLATES_BUCKET = + "prod-budi-templates.s3-eu-west-1.amazonaws.com" + const templateUrl = `https://${DEFAULT_TEMPLATES_BUCKET}/templates/${type}/${name}.tar.gz` + return objectStore.downloadTarball( + templateUrl, + ObjectStoreBuckets.TEMPLATES, + type + ) +} diff --git a/packages/server/src/utilities/index.ts b/packages/server/src/utilities/index.ts index 4e672124cd..822ac68631 100644 --- a/packages/server/src/utilities/index.ts +++ b/packages/server/src/utilities/index.ts @@ -1,6 +1,5 @@ import env from "../environment" -import { OBJ_STORE_DIRECTORY } from "../constants" -import { objectStore, context } from "@budibase/backend-core" +import { context } from "@budibase/backend-core" import { generateMetadataID } from "../db/utils" import { Document } from "@budibase/types" import stream from "stream" @@ -32,49 +31,6 @@ export function checkSlashesInUrl(url: string) { return url.replace(/(https?:\/\/)|(\/)+/g, "$1$2") } -/** - * Gets the address of the object store, depending on whether self hosted or in cloud. - * @return {string} The base URL of the object store (MinIO or S3). - */ -export function objectStoreUrl() { - if (env.SELF_HOSTED || env.MINIO_URL) { - // can use a relative url for this as all goes through the proxy (this is hosted in minio) - return OBJ_STORE_DIRECTORY - } else { - return env.CDN_URL - } -} - -/** - * In production the client library is stored in the object store, however in development - * we use the symlinked version produced by lerna, located in node modules. We link to this - * via a specific endpoint (under /api/assets/client). - * @param {string} appId In production we need the appId to look up the correct bucket, as the - * version of the client lib may differ between apps. - * @param {string} version The version to retrieve. - * @return {string} The URL to be inserted into appPackage response or server rendered - * app index file. - */ -export function clientLibraryPath(appId: string, version: string) { - if (env.isProd()) { - let url = `${objectStoreUrl()}/${objectStore.sanitizeKey( - appId - )}/budibase-client.js` - - // append app version to bust the cache - if (version) { - url += `?v=${version}` - } - return url - } else { - return `/api/assets/client` - } -} - -export function attachmentsRelativeURL(attachmentKey: string) { - return checkSlashesInUrl(`${objectStoreUrl()}/${attachmentKey}`) -} - export async function updateEntityMetadata( type: string, entityId: string, diff --git a/packages/server/src/utilities/plugins.ts b/packages/server/src/utilities/plugins.ts deleted file mode 100644 index b3a9d50fff..0000000000 --- a/packages/server/src/utilities/plugins.ts +++ /dev/null @@ -1,22 +0,0 @@ -import env from "../environment" -import { plugins as ProPlugins } from "@budibase/pro" -import { objectStore } from "@budibase/backend-core" -import { Plugin } from "@budibase/types" - -export function enrichPluginURLs(plugins: Plugin[]) { - if (!plugins || !plugins.length) { - return [] - } - return plugins.map(plugin => { - const cloud = !env.SELF_HOSTED - const bucket = objectStore.ObjectStoreBuckets.PLUGINS - const jsFileName = "plugin.min.js" - - // In self host we need to prefix the path, as the bucket name is not part - // of the bucket path. In cloud, it's already part of the bucket path. - let jsUrl = cloud ? `${env.CDN_URL}/` : `/${bucket}/` - jsUrl += ProPlugins.getBucketPath(plugin.name) - jsUrl += jsFileName - return { ...plugin, jsUrl } - }) -} diff --git a/packages/server/src/utilities/rowProcessor/index.ts b/packages/server/src/utilities/rowProcessor/index.ts index e519c261c5..9e1029fa1a 100644 --- a/packages/server/src/utilities/rowProcessor/index.ts +++ b/packages/server/src/utilities/rowProcessor/index.ts @@ -1,12 +1,11 @@ import * as linkRows from "../../db/linkedRows" import { FieldTypes, AutoFieldSubTypes } from "../../constants" -import { attachmentsRelativeURL } from "../index" import { processFormulas, fixAutoColumnSubType } from "./utils" import { ObjectStoreBuckets } from "../../constants" import { context, db as dbCore, objectStore } from "@budibase/backend-core" import { InternalTables } from "../../db/utils" import { TYPE_TRANSFORM_MAP } from "./map" -import { Row, Table, ContextUser } from "@budibase/types" +import { Row, RowAttachment, Table, ContextUser } from "@budibase/types" const { cloneDeep } = require("lodash/fp") export * from "./utils" @@ -35,7 +34,7 @@ function getRemovedAttachmentKeys( return oldKeys } const newKeys = row[attachmentKey].map((attachment: any) => attachment.key) - return oldKeys.filter((key: any) => newKeys.indexOf(key) === -1) + return oldKeys.filter((key: string) => newKeys.indexOf(key) === -1) } /** @@ -105,7 +104,7 @@ export function processAutoColumn( * @param {object} type The type fo coerce to * @returns {object} The coerced value */ -export function coerce(row: any, type: any) { +export function coerce(row: any, type: string) { // no coercion specified for type, skip it if (!TYPE_TRANSFORM_MAP[type]) { return row @@ -158,6 +157,16 @@ export function inputProcessing( else { clonedRow[key] = coerce(value, field.type) } + + // remove any attachment urls, they are generated on read + if (field.type === FieldTypes.ATTACHMENT) { + const attachments = clonedRow[key] + if (attachments?.length) { + attachments.forEach((attachment: RowAttachment) => { + delete attachment.url + }) + } + } } if (!clonedRow._id || !clonedRow._rev) { @@ -194,15 +203,15 @@ export async function outputProcessing( // process formulas enriched = processFormulas(table, enriched, { dynamic: true }) as Row[] - // update the attachments URL depending on hosting + // set the attachments URLs for (let [property, column] of Object.entries(table.schema)) { if (column.type === FieldTypes.ATTACHMENT) { for (let row of enriched) { if (row[property] == null || !Array.isArray(row[property])) { continue } - row[property].forEach((attachment: any) => { - attachment.url = attachmentsRelativeURL(attachment.key) + row[property].forEach((attachment: RowAttachment) => { + attachment.url = objectStore.getAppFileUrl(attachment.key) }) } } @@ -265,6 +274,6 @@ export async function cleanupAttachments( } } if (files.length > 0) { - return objectStore.deleteFiles(ObjectStoreBuckets.APPS, files) + await objectStore.deleteFiles(ObjectStoreBuckets.APPS, files) } } diff --git a/packages/server/src/utilities/tests/plugins.spec.ts b/packages/server/src/utilities/tests/plugins.spec.ts deleted file mode 100644 index 4d9b0de449..0000000000 --- a/packages/server/src/utilities/tests/plugins.spec.ts +++ /dev/null @@ -1,23 +0,0 @@ -import { enrichPluginURLs } from "../plugins" -const env = require("../../environment") -jest.mock("../../environment") - -describe("plugins utility", () => { - let pluginsArray: any = [ - { - name: "test-plugin", - }, - ] - it("enriches the plugins url self-hosted", async () => { - let result = enrichPluginURLs(pluginsArray) - expect(result[0].jsUrl).toEqual("/plugins/test-plugin/plugin.min.js") - }) - - it("enriches the plugins url cloud", async () => { - env.SELF_HOSTED = 0 - let result = enrichPluginURLs(pluginsArray) - expect(result[0].jsUrl).toEqual( - "https://cdn.budi.live/test-plugin/plugin.min.js" - ) - }) -}) diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index bcb7c43688..76caf5a3fc 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -3125,10 +3125,10 @@ "@types/koa-compose" "*" "@types/node" "*" -"@types/koa__router@8.0.11": - version "8.0.11" - resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-8.0.11.tgz#d7b37e6db934fc072ea1baa2ab92bc8ac4564f3e" - integrity sha512-WXgKWpBsbS14kzmzD9LeFapOIa678h7zvUHxDwXwSx4ETKXhXLVUAToX6jZ/U7EihM7qwyD9W/BZvB0MRu7MTQ== +"@types/koa__router@8.0.8": + version "8.0.8" + resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-8.0.8.tgz#b1e0e9a512498777d3366bbdf0e853df27ec831c" + integrity sha512-9pGCaDtzCsj4HJ8HmGuqzk8+s57sPj4njWd08GG5o92n5Xp9io2snc40CPpXFhoKcZ8OKhuu6ht4gNou9e1C2w== dependencies: "@types/koa" "*" @@ -3400,6 +3400,13 @@ "@types/mime" "^1" "@types/node" "*" +"@types/server-destroy@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/server-destroy/-/server-destroy-1.0.1.tgz#6010a89e2df4f2c15a265fe73c70fd3641486530" + integrity sha512-77QGr7waZbE0Y0uF+G+uH3H3SmhyA78Jf2r5r7QSrpg0U3kSXduWpGjzP9PvPLR/KCy+kHjjpnugRHsYTnHopg== + dependencies: + "@types/node" "*" + "@types/stack-utils@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-1.0.1.tgz#0a851d3bd96498fa25c33ab7278ed3bd65f06c3e" @@ -3418,6 +3425,14 @@ "@types/cookiejar" "*" "@types/node" "*" +"@types/tar@6.1.3": + version "6.1.3" + resolved "https://registry.yarnpkg.com/@types/tar/-/tar-6.1.3.tgz#46a2ce7617950c4852dfd7e9cd41aa8161b9d750" + integrity sha512-YzDOr5kdAeqS8dcO6NTTHTMJ44MUCBDoLEIyPtwEn7PssKqUYL49R1iCVJPeiPzPlKi6DbH33eZkpeJ27e4vHg== + dependencies: + "@types/node" "*" + minipass "^3.3.5" + "@types/tough-cookie@*", "@types/tough-cookie@^4.0.2": version "4.0.2" resolved "https://registry.yarnpkg.com/@types/tough-cookie/-/tough-cookie-4.0.2.tgz#6286b4c7228d58ab7866d19716f3696e03a09397" @@ -10535,6 +10550,13 @@ minipass@^3.0.0: dependencies: yallist "^4.0.0" +minipass@^3.3.5: + version "3.3.6" + resolved "https://registry.yarnpkg.com/minipass/-/minipass-3.3.6.tgz#7bba384db3a1520d18c9c0e5251c3444e95dd94a" + integrity sha512-DxiNidxSEK+tHG6zOIklvNOwm3hvCrbUrdtzY74U6HKTJxvIDfOUL5W5P2Ghd3DTkhhKPYGqeNUIh5qcM4YBfw== + dependencies: + yallist "^4.0.0" + minizlib@^2.1.1: version "2.1.2" resolved "https://registry.yarnpkg.com/minizlib/-/minizlib-2.1.2.tgz#e90d3466ba209b932451508a11ce3d3632145931" diff --git a/packages/types/package.json b/packages/types/package.json index 85dfab8a94..4d72311766 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -15,6 +15,7 @@ "devDependencies": { "@types/json5": "^2.2.0", "@types/koa": "2.13.4", + "koa-body": "4.2.0", "@types/node": "14.18.20", "@types/pouchdb": "6.4.0", "nano": "10.1.0", diff --git a/packages/types/src/documents/app/row.ts b/packages/types/src/documents/app/row.ts index 2cac32279b..b18c6ebee7 100644 --- a/packages/types/src/documents/app/row.ts +++ b/packages/types/src/documents/app/row.ts @@ -19,9 +19,10 @@ export enum FieldType { export interface RowAttachment { size: number name: string - url: string extension: string key: string + // Populated on read + url?: string } export interface Row extends Document { diff --git a/packages/types/src/documents/global/config.ts b/packages/types/src/documents/global/config.ts index 65a8b15589..9b05069c9a 100644 --- a/packages/types/src/documents/global/config.ts +++ b/packages/types/src/documents/global/config.ts @@ -2,6 +2,7 @@ import { Document } from "../document" export interface Config extends Document { type: ConfigType + config: any } export interface SMTPConfig extends Config { @@ -17,9 +18,12 @@ export interface SMTPConfig extends Config { export interface SettingsConfig extends Config { config: { company: string - logoUrl: string + // Populated on read + logoUrl?: string + logoUrlEtag?: boolean platformUrl: string uniqueTenantId?: string + analyticsEnabled?: boolean } } @@ -57,18 +61,15 @@ export interface OIDCConfig extends Config { } } -export type NestedConfig = - | SMTPConfig - | SettingsConfig - | GoogleConfig - | OIDCConfig - export const isSettingsConfig = (config: Config): config is SettingsConfig => config.type === ConfigType.SETTINGS + export const isSMTPConfig = (config: Config): config is SMTPConfig => config.type === ConfigType.SMTP + export const isGoogleConfig = (config: Config): config is GoogleConfig => config.type === ConfigType.GOOGLE + export const isOIDCConfig = (config: Config): config is OIDCConfig => config.type === ConfigType.OIDC diff --git a/packages/types/src/documents/global/plugin.ts b/packages/types/src/documents/global/plugin.ts index 7f6d4f4995..17a8426d85 100644 --- a/packages/types/src/documents/global/plugin.ts +++ b/packages/types/src/documents/global/plugin.ts @@ -20,8 +20,6 @@ export interface Plugin extends Document { description: string name: string version: string - jsUrl?: string - iconUrl?: string source: PluginSource package: { [key: string]: any } hash: string @@ -29,6 +27,11 @@ export interface Plugin extends Document { type: PluginType [key: string]: any } + iconFileName?: string + // Populated on read + jsUrl?: string + // Populated on read + iconUrl?: string } export const PLUGIN_TYPE_ARR = Object.values(PluginType) diff --git a/packages/types/src/sdk/events/auth.ts b/packages/types/src/sdk/events/auth.ts index 6d79fb344b..eb9f3148a3 100644 --- a/packages/types/src/sdk/events/auth.ts +++ b/packages/types/src/sdk/events/auth.ts @@ -1,7 +1,8 @@ import { BaseEvent } from "./event" +import { ConfigType } from "../../documents" export type LoginSource = "local" | "google" | "oidc" | "google-internal" -export type SSOType = "oidc" | "google" +export type SSOType = ConfigType.OIDC | ConfigType.GOOGLE export interface LoginEvent extends BaseEvent { userId: string diff --git a/packages/types/src/sdk/koa.ts b/packages/types/src/sdk/koa.ts index 07d4a893c1..302d1aeb67 100644 --- a/packages/types/src/sdk/koa.ts +++ b/packages/types/src/sdk/koa.ts @@ -1,6 +1,7 @@ import { Context, Request } from "koa" import { User, Role, UserRoles, Account } from "../documents" import { FeatureFlag, License } from "../sdk" +import { Files } from "formidable" export interface ContextUser extends Omit { globalId?: string @@ -15,12 +16,34 @@ export interface ContextUser extends Omit { account?: Account } -export interface BBRequest extends Request { - body: any - files?: any +/** + * Add support for koa-body in context. + */ +export interface BBRequest extends Request { + body: RequestBody + files?: Files } -export interface BBContext extends Context { - request: BBRequest +/** + * Basic context with no user. + */ +export interface Ctx extends Context { + request: BBRequest + body: ResponseBody +} + +/** + * Authenticated context. + */ +export interface UserCtx + extends Ctx { + user: ContextUser +} + +/** + * Deprecated: Use UserCtx / Ctx appropriately + * Authenticated context. + */ +export interface BBContext extends Ctx { user?: ContextUser } diff --git a/packages/types/yarn.lock b/packages/types/yarn.lock index f596c58997..9ba7015888 100644 --- a/packages/types/yarn.lock +++ b/packages/types/yarn.lock @@ -65,6 +65,13 @@ "@types/qs" "*" "@types/serve-static" "*" +"@types/formidable@^1.0.31": + version "1.2.5" + resolved "https://registry.yarnpkg.com/@types/formidable/-/formidable-1.2.5.tgz#561d026e5f09179e5c8ef7b31e8f4652e11abe4c" + integrity sha512-zu3mQJa4hDNubEMViSj937602XdDGzK7Q5pJ5QmLUbNxclbo9tZGt5jtwM352ssZ+pqo5V4H14TBvT/ALqQQcA== + dependencies: + "@types/node" "*" + "@types/http-assert@*": version "1.5.3" resolved "https://registry.yarnpkg.com/@types/http-assert/-/http-assert-1.5.3.tgz#ef8e3d1a8d46c387f04ab0f2e8ab8cb0c5078661" @@ -345,6 +352,11 @@ brace-expansion@^1.1.7: balanced-match "^1.0.0" concat-map "0.0.1" +bytes@3.1.2: + version "3.1.2" + resolved "https://registry.yarnpkg.com/bytes/-/bytes-3.1.2.tgz#8b0beeb98605adf1b128fa4386403c009e0221a5" + integrity sha512-/Nf7TyzTx6S3yRJObOAV7956r8cr2+Oj8AC5dt8wSP3BQAoeX58NoHyCU8P8zGkNXStjTSi6fzO6F0pBdcYbEg== + call-bind@^1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/call-bind/-/call-bind-1.0.2.tgz#b1d4e89e688119c3c9a903ad30abb2f6a919be3c" @@ -353,6 +365,16 @@ call-bind@^1.0.0: function-bind "^1.1.1" get-intrinsic "^1.0.2" +co-body@^5.1.1: + version "5.2.0" + resolved "https://registry.yarnpkg.com/co-body/-/co-body-5.2.0.tgz#5a0a658c46029131e0e3a306f67647302f71c124" + integrity sha512-sX/LQ7LqUhgyaxzbe7IqwPeTr2yfpfUIQ/dgpKo6ZI4y4lpQA0YxAomWIY+7I7rHWcG02PG+OuPREzMW/5tszQ== + dependencies: + inflation "^2.0.0" + qs "^6.4.0" + raw-body "^2.2.0" + type-is "^1.6.14" + combined-stream@^1.0.8: version "1.0.8" resolved "https://registry.yarnpkg.com/combined-stream/-/combined-stream-1.0.8.tgz#c3d45a8b34fd730631a110a8a2520682b31d5a7f" @@ -377,6 +399,11 @@ delayed-stream@~1.0.0: resolved "https://registry.yarnpkg.com/delayed-stream/-/delayed-stream-1.0.0.tgz#df3ae199acadfb7d440aaae0b29e2272b24ec619" integrity sha512-ZySD7Nf91aLB0RxL4KGrKHBXl7Eds1DAmEdcoVawXnLD7SDhpNgtuII2aAkg7a7QS41jxPSZ17p4VdGnMHk3MQ== +depd@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/depd/-/depd-2.0.0.tgz#b696163cc757560d09cf22cc8fad1571b79e76df" + integrity sha512-g7nH6P6dyDioJogAAGprGpCtVImJhpPk/roCzdb3fIh61/s/nPsfR6onyMwkCAR/OlC3yBC0lESvUoQEAssIrw== + follow-redirects@^1.15.0: version "1.15.2" resolved "https://registry.yarnpkg.com/follow-redirects/-/follow-redirects-1.15.2.tgz#b460864144ba63f2681096f274c4e57026da2c13" @@ -391,6 +418,11 @@ form-data@^4.0.0: combined-stream "^1.0.8" mime-types "^2.1.12" +formidable@^1.1.1: + version "1.2.6" + resolved "https://registry.yarnpkg.com/formidable/-/formidable-1.2.6.tgz#d2a51d60162bbc9b4a055d8457a7c75315d1a168" + integrity sha512-KcpbcpuLNOwrEjnbpMC0gS+X8ciDoZE1kkqzat4a8vrprf+s9pKNQ/QIwWfbfs4ltgmFl3MD177SNTkve3BwGQ== + fs.realpath@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fs.realpath/-/fs.realpath-1.0.0.tgz#1504ad2523158caa40db4a2787cb01411994ea4f" @@ -441,6 +473,29 @@ http-cookie-agent@^4.0.2: dependencies: agent-base "^6.0.2" +http-errors@2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/http-errors/-/http-errors-2.0.0.tgz#b7774a1486ef73cf7667ac9ae0858c012c57b9d3" + integrity sha512-FtwrG/euBzaEjYeRqOgly7G0qviiXoJWnvEH2Z1plBdXgbyjv34pHTSb9zoeHMyDy33+DWy5Wt9Wo+TURtOYSQ== + dependencies: + depd "2.0.0" + inherits "2.0.4" + setprototypeof "1.2.0" + statuses "2.0.1" + toidentifier "1.0.1" + +iconv-lite@0.4.24: + version "0.4.24" + resolved "https://registry.yarnpkg.com/iconv-lite/-/iconv-lite-0.4.24.tgz#2022b4b25fbddc21d2f524974a474aafe733908b" + integrity sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA== + dependencies: + safer-buffer ">= 2.1.2 < 3" + +inflation@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/inflation/-/inflation-2.0.0.tgz#8b417e47c28f925a45133d914ca1fd389107f30f" + integrity sha512-m3xv4hJYR2oXw4o4Y5l6P5P16WYmazYof+el6Al3f+YlggGj6qT9kImBAnzDelRALnP5d3h4jGBPKzYCizjZZw== + inflight@^1.0.4: version "1.0.6" resolved "https://registry.yarnpkg.com/inflight/-/inflight-1.0.6.tgz#49bd6331d7d02d0c09bc910a1075ba8165b56df9" @@ -449,7 +504,7 @@ inflight@^1.0.4: once "^1.3.0" wrappy "1" -inherits@2: +inherits@2, inherits@2.0.4: version "2.0.4" resolved "https://registry.yarnpkg.com/inherits/-/inherits-2.0.4.tgz#0fa2c64f932917c3433a0ded55363aae37416b7c" integrity sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ== @@ -459,12 +514,26 @@ json5@*: resolved "https://registry.yarnpkg.com/json5/-/json5-2.2.1.tgz#655d50ed1e6f95ad1a3caababd2b0efda10b395c" integrity sha512-1hqLFMSrGHRHxav9q9gNjJ5EXznIxGVO09xQRrwplcS8qs28pZ8s8hupZAmqDwZUmVZ2Qb2jnyPOWcDH8m8dlA== +koa-body@4.2.0: + version "4.2.0" + resolved "https://registry.yarnpkg.com/koa-body/-/koa-body-4.2.0.tgz#37229208b820761aca5822d14c5fc55cee31b26f" + integrity sha512-wdGu7b9amk4Fnk/ytH8GuWwfs4fsB5iNkY8kZPpgQVb04QZSv85T0M8reb+cJmvLE8cjPYvBzRikD3s6qz8OoA== + dependencies: + "@types/formidable" "^1.0.31" + co-body "^5.1.1" + formidable "^1.1.1" + +media-typer@0.3.0: + version "0.3.0" + resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748" + integrity sha512-dq+qelQ9akHpcOl/gUVRTxVIOkAJ1wR3QAvb4RsVjS8oVoFjDGTc679wJYmUmknUF5HwMLOgb5O+a3KxfWapPQ== + mime-db@1.52.0: version "1.52.0" resolved "https://registry.yarnpkg.com/mime-db/-/mime-db-1.52.0.tgz#bbabcdc02859f4987301c856e3387ce5ec43bf70" integrity sha512-sPU4uV7dYlvtWJxwwxHD0PuihVNiE7TyAbQ5SWxDCB9mUYvOgroQOwYQQOKPJ8CIbE+1ETVlOoK1UC2nU3gYvg== -mime-types@^2.1.12: +mime-types@^2.1.12, mime-types@~2.1.24: version "2.1.35" resolved "https://registry.yarnpkg.com/mime-types/-/mime-types-2.1.35.tgz#381a871b62a734450660ae3deee44813f70d959a" integrity sha512-ZDY+bPm5zTTF+YpCrAU9nK0UgICYPT0QtT1NZWFv4s++TNkcgVaT0g6+4R2uI4MjQjzysHB1zxuWL50hzaeXiw== @@ -532,7 +601,7 @@ punycode@^2.1.1: resolved "https://registry.yarnpkg.com/punycode/-/punycode-2.1.1.tgz#b58b010ac40c22c5657616c8d2c2c02c7bf479ec" integrity sha512-XRsRjdf+j5ml+y/6GKHPZbrF/8p2Yga0JPtdqTIY2Xe5ohJPD9saDJJLPvp9+NSBprVvevdXZybnj2cv8OEd0A== -qs@^6.11.0: +qs@^6.11.0, qs@^6.4.0: version "6.11.0" resolved "https://registry.yarnpkg.com/qs/-/qs-6.11.0.tgz#fd0d963446f7a65e1367e01abd85429453f0c37a" integrity sha512-MvjoMCJwEarSbUYk5O+nmoSzSutSsTwF85zcHPQ9OrlFoZOYIjaqBAJIqIXjptyD5vThxGq52Xu/MaJzRkIk4Q== @@ -544,6 +613,16 @@ querystringify@^2.1.1: resolved "https://registry.yarnpkg.com/querystringify/-/querystringify-2.2.0.tgz#3345941b4153cb9d082d8eee4cda2016a9aef7f6" integrity sha512-FIqgj2EUvTa7R50u0rGsyTftzjYmv/a3hO345bZNrqabNqjtgiDMgmo4mkUjd+nzU5oF3dClKqFIPUKybUyqoQ== +raw-body@^2.2.0: + version "2.5.1" + resolved "https://registry.yarnpkg.com/raw-body/-/raw-body-2.5.1.tgz#fe1b1628b181b700215e5fd42389f98b71392857" + integrity sha512-qqJBtEyVgS0ZmPGdCFPWJ3FreoqvG4MVQln/kCgF7Olq95IbOp0/BWyMwbdtn4VTvkM8Y7khCQ2Xgk/tcrCXig== + dependencies: + bytes "3.1.2" + http-errors "2.0.0" + iconv-lite "0.4.24" + unpipe "1.0.0" + requires-port@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/requires-port/-/requires-port-1.0.0.tgz#925d2601d39ac485e091cf0da5c6e694dc3dcaff" @@ -556,6 +635,16 @@ rimraf@3.0.2: dependencies: glob "^7.1.3" +"safer-buffer@>= 2.1.2 < 3": + version "2.1.2" + resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a" + integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg== + +setprototypeof@1.2.0: + version "1.2.0" + resolved "https://registry.yarnpkg.com/setprototypeof/-/setprototypeof-1.2.0.tgz#66c9a24a73f9fc28cbe66b09fed3d33dcaf1b424" + integrity sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw== + side-channel@^1.0.4: version "1.0.4" resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.4.tgz#efce5c8fdc104ee751b25c58d4290011fa5ea2cf" @@ -565,6 +654,16 @@ side-channel@^1.0.4: get-intrinsic "^1.0.2" object-inspect "^1.9.0" +statuses@2.0.1: + version "2.0.1" + resolved "https://registry.yarnpkg.com/statuses/-/statuses-2.0.1.tgz#55cb000ccf1d48728bd23c685a063998cf1a1b63" + integrity sha512-RwNA9Z/7PrK06rYLIzFMlaF+l73iwpzsqRIFgbMLbTcLD6cOao82TaWefPXQvB2fOC4AjuYSEndS7N/mTCbkdQ== + +toidentifier@1.0.1: + version "1.0.1" + resolved "https://registry.yarnpkg.com/toidentifier/-/toidentifier-1.0.1.tgz#3be34321a88a820ed1bd80dfaa33e479fbb8dd35" + integrity sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA== + tough-cookie@^4.1.2: version "4.1.2" resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.2.tgz#e53e84b85f24e0b65dd526f46628db6c85f6b874" @@ -575,6 +674,14 @@ tough-cookie@^4.1.2: universalify "^0.2.0" url-parse "^1.5.3" +type-is@^1.6.14: + version "1.6.18" + resolved "https://registry.yarnpkg.com/type-is/-/type-is-1.6.18.tgz#4e552cd05df09467dcbc4ef739de89f2cf37c131" + integrity sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g== + dependencies: + media-typer "0.3.0" + mime-types "~2.1.24" + typescript@4.7.3: version "4.7.3" resolved "https://registry.yarnpkg.com/typescript/-/typescript-4.7.3.tgz#8364b502d5257b540f9de4c40be84c98e23a129d" @@ -585,6 +692,11 @@ universalify@^0.2.0: resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.2.0.tgz#6451760566fa857534745ab1dde952d1b1761be0" integrity sha512-CJ1QgKmNg3CwvAv/kOFmtnEN05f0D/cn9QntgNOQlQF9dgvVTHj3t+8JPdjqawCHk7V/KA+fbUqzZ9XWhcqPUg== +unpipe@1.0.0: + version "1.0.0" + resolved "https://registry.yarnpkg.com/unpipe/-/unpipe-1.0.0.tgz#b2bf4ee8514aae6165b4817829d21b2ef49904ec" + integrity sha512-pjy2bYhSsufwWlKwPc+l3cN7+wuJlK6uz0YdJEOlQDbl6jo/YlPi4mb8agUkVC8BF7V8NuzeyPNqRksA3hztKQ== + url-parse@^1.5.3: version "1.5.10" resolved "https://registry.yarnpkg.com/url-parse/-/url-parse-1.5.10.tgz#9d3c2f736c1d75dd3bd2be507dcc111f1e2ea9c1" diff --git a/packages/worker/package.json b/packages/worker/package.json index 460f5be9ca..98d59523ac 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -73,12 +73,13 @@ "@types/jest": "26.0.23", "@types/jsonwebtoken": "8.5.1", "@types/koa": "2.13.4", - "@types/koa__router": "8.0.11", + "@types/koa__router": "8.0.8", "@types/node": "14.18.20", "@types/node-fetch": "2.6.1", "@types/pouchdb": "6.4.0", "@types/uuid": "8.3.4", "@typescript-eslint/parser": "5.45.0", + "@types/server-destroy": "1.0.1", "copyfiles": "2.4.1", "eslint": "6.8.0", "jest": "28.1.1", diff --git a/packages/worker/src/api/controllers/global/configs.ts b/packages/worker/src/api/controllers/global/configs.ts index 1c4e57f0e1..c7491802b2 100644 --- a/packages/worker/src/api/controllers/global/configs.ts +++ b/packages/worker/src/api/controllers/global/configs.ts @@ -7,6 +7,7 @@ import { objectStore, tenancy, db as dbCore, + env as coreEnv, } from "@budibase/backend-core" import { checkAnyUserExists } from "../../../utilities/users" import { @@ -17,127 +18,106 @@ import { GoogleConfig, OIDCConfig, SettingsConfig, - BBContext, + isGoogleConfig, + isOIDCConfig, + isSettingsConfig, + isSMTPConfig, + Ctx, + UserCtx, } from "@budibase/types" const getEventFns = async (db: Database, config: ConfigDoc) => { const fns = [] - const type = config.type let existing if (config._id) { existing = await db.get(config._id) } - const ssoType = type as SSOType if (!existing) { - switch (config.type) { - case ConfigType.SMTP: { - fns.push(events.email.SMTPCreated) - break + if (isSMTPConfig(config)) { + fns.push(events.email.SMTPCreated) + } else if (isGoogleConfig(config)) { + fns.push(() => events.auth.SSOCreated(ConfigType.GOOGLE)) + if (config.config.activated) { + fns.push(() => events.auth.SSOActivated(ConfigType.GOOGLE)) } - case ConfigType.GOOGLE: { - const googleCfg = config as GoogleConfig - fns.push(() => events.auth.SSOCreated(ssoType)) - if (googleCfg.config.activated) { - fns.push(() => events.auth.SSOActivated(ssoType)) - } - break + } else if (isOIDCConfig(config)) { + fns.push(() => events.auth.SSOCreated(ConfigType.OIDC)) + if (config.config.configs[0].activated) { + fns.push(() => events.auth.SSOActivated(ConfigType.OIDC)) } - case ConfigType.OIDC: { - const oidcCfg = config as OIDCConfig - fns.push(() => events.auth.SSOCreated(ssoType)) - if (oidcCfg.config.configs[0].activated) { - fns.push(() => events.auth.SSOActivated(ssoType)) - } - break + } else if (isSettingsConfig(config)) { + // company + const company = config.config.company + if (company && company !== "Budibase") { + fns.push(events.org.nameUpdated) } - case ConfigType.SETTINGS: { - // company - const settingsCfg = config as SettingsConfig - const company = settingsCfg.config.company - if (company && company !== "Budibase") { - fns.push(events.org.nameUpdated) - } - // logo - const logoUrl = settingsCfg.config.logoUrl - if (logoUrl) { - fns.push(events.org.logoUpdated) - } + // logo + const logoUrl = config.config.logoUrl + if (logoUrl) { + fns.push(events.org.logoUpdated) + } - // platform url - const platformUrl = settingsCfg.config.platformUrl - if ( - platformUrl && - platformUrl !== "http://localhost:10000" && - env.SELF_HOSTED - ) { - fns.push(events.org.platformURLUpdated) - } - break + // platform url + const platformUrl = config.config.platformUrl + if ( + platformUrl && + platformUrl !== "http://localhost:10000" && + env.SELF_HOSTED + ) { + fns.push(events.org.platformURLUpdated) } } } else { - switch (config.type) { - case ConfigType.SMTP: { - fns.push(events.email.SMTPUpdated) - break + if (isSMTPConfig(config)) { + fns.push(events.email.SMTPUpdated) + } else if (isGoogleConfig(config)) { + fns.push(() => events.auth.SSOUpdated(ConfigType.GOOGLE)) + if (!existing.config.activated && config.config.activated) { + fns.push(() => events.auth.SSOActivated(ConfigType.GOOGLE)) + } else if (existing.config.activated && !config.config.activated) { + fns.push(() => events.auth.SSODeactivated(ConfigType.GOOGLE)) } - case ConfigType.GOOGLE: { - const googleCfg = config as GoogleConfig - fns.push(() => events.auth.SSOUpdated(ssoType)) - if (!existing.config.activated && googleCfg.config.activated) { - fns.push(() => events.auth.SSOActivated(ssoType)) - } else if (existing.config.activated && !googleCfg.config.activated) { - fns.push(() => events.auth.SSODeactivated(ssoType)) - } - break + } else if (isOIDCConfig(config)) { + fns.push(() => events.auth.SSOUpdated(ConfigType.OIDC)) + if ( + !existing.config.configs[0].activated && + config.config.configs[0].activated + ) { + fns.push(() => events.auth.SSOActivated(ConfigType.OIDC)) + } else if ( + existing.config.configs[0].activated && + !config.config.configs[0].activated + ) { + fns.push(() => events.auth.SSODeactivated(ConfigType.OIDC)) } - case ConfigType.OIDC: { - const oidcCfg = config as OIDCConfig - fns.push(() => events.auth.SSOUpdated(ssoType)) - if ( - !existing.config.configs[0].activated && - oidcCfg.config.configs[0].activated - ) { - fns.push(() => events.auth.SSOActivated(ssoType)) - } else if ( - existing.config.configs[0].activated && - !oidcCfg.config.configs[0].activated - ) { - fns.push(() => events.auth.SSODeactivated(ssoType)) - } - break + } else if (isSettingsConfig(config)) { + // company + const existingCompany = existing.config.company + const company = config.config.company + if (company && company !== "Budibase" && existingCompany !== company) { + fns.push(events.org.nameUpdated) } - case ConfigType.SETTINGS: { - // company - const settingsCfg = config as SettingsConfig - const existingCompany = existing.config.company - const company = settingsCfg.config.company - if (company && company !== "Budibase" && existingCompany !== company) { - fns.push(events.org.nameUpdated) - } - // logo - const existingLogoUrl = existing.config.logoUrl - const logoUrl = settingsCfg.config.logoUrl - if (logoUrl && existingLogoUrl !== logoUrl) { - fns.push(events.org.logoUpdated) - } + // logo + const existingLogoUrl = existing.config.logoUrl + const logoUrl = config.config.logoUrl + if (logoUrl && existingLogoUrl !== logoUrl) { + fns.push(events.org.logoUpdated) + } - // platform url - const existingPlatformUrl = existing.config.platformUrl - const platformUrl = settingsCfg.config.platformUrl - if ( - platformUrl && - platformUrl !== "http://localhost:10000" && - existingPlatformUrl !== platformUrl && - env.SELF_HOSTED - ) { - fns.push(events.org.platformURLUpdated) - } - break + // platform url + const existingPlatformUrl = existing.config.platformUrl + const platformUrl = config.config.platformUrl + if ( + platformUrl && + platformUrl !== "http://localhost:10000" && + existingPlatformUrl !== platformUrl && + env.SELF_HOSTED + ) { + fns.push(events.org.platformURLUpdated) } } } @@ -145,7 +125,7 @@ const getEventFns = async (db: Database, config: ConfigDoc) => { return fns } -export async function save(ctx: BBContext) { +export async function save(ctx: UserCtx) { const db = tenancy.getGlobalDB() const { type, workspace, user, config } = ctx.request.body let eventFns = await getEventFns(db, ctx.request.body) @@ -187,7 +167,7 @@ export async function save(ctx: BBContext) { } } -export async function fetch(ctx: BBContext) { +export async function fetch(ctx: UserCtx) { const db = tenancy.getGlobalDB() const response = await db.allDocs( dbCore.getConfigParams( @@ -204,7 +184,7 @@ export async function fetch(ctx: BBContext) { * Gets the most granular config for a particular configuration type. * The hierarchy is type -> workspace -> user. */ -export async function find(ctx: BBContext) { +export async function find(ctx: UserCtx) { const db = tenancy.getGlobalDB() const { userId, workspaceId } = ctx.query @@ -237,18 +217,18 @@ export async function find(ctx: BBContext) { } } -export async function publicOidc(ctx: BBContext) { +export async function publicOidc(ctx: Ctx) { const db = tenancy.getGlobalDB() try { // Find the config with the most granular scope based on context - const oidcConfig = await dbCore.getScopedFullConfig(db, { + const oidcConfig: OIDCConfig = await dbCore.getScopedFullConfig(db, { type: ConfigType.OIDC, }) if (!oidcConfig) { ctx.body = {} } else { - ctx.body = oidcConfig.config.configs.map((config: any) => ({ + ctx.body = oidcConfig.config.configs.map(config => ({ logo: config.logo, name: config.name, uuid: config.uuid, @@ -259,7 +239,7 @@ export async function publicOidc(ctx: BBContext) { } } -export async function publicSettings(ctx: BBContext) { +export async function publicSettings(ctx: Ctx) { const db = tenancy.getGlobalDB() try { @@ -285,6 +265,16 @@ export async function publicSettings(ctx: BBContext) { config = publicConfig } + // enrich the logo url + // empty url means deleted + if (config.config.logoUrl !== "") { + config.config.logoUrl = objectStore.getGlobalFileUrl( + "settings", + "logoUrl", + config.config.logoUrlEtag + ) + } + // google button flag if (googleConfig && googleConfig.config) { // activated by default for configs pre-activated flag @@ -311,28 +301,17 @@ export async function publicSettings(ctx: BBContext) { } } -export async function upload(ctx: BBContext) { - if (ctx.request.files == null || ctx.request.files.file.length > 1) { +export async function upload(ctx: UserCtx) { + if (ctx.request.files == null || Array.isArray(ctx.request.files.file)) { ctx.throw(400, "One file must be uploaded.") } const file = ctx.request.files.file const { type, name } = ctx.params - let bucket - if (env.SELF_HOSTED) { - bucket = objectStore.ObjectStoreBuckets.GLOBAL - } else { - bucket = objectStore.ObjectStoreBuckets.GLOBAL_CLOUD - } + let bucket = coreEnv.GLOBAL_BUCKET_NAME + const key = objectStore.getGlobalFileS3Key(type, name) - let key - if (env.MULTI_TENANCY) { - key = `${tenancy.getTenantId()}/${type}/${name}` - } else { - key = `${type}/${name}` - } - - await objectStore.upload({ + const result = await objectStore.upload({ bucket, filename: key, path: file.path, @@ -349,24 +328,26 @@ export async function upload(ctx: BBContext) { config: {}, } } - let url - if (env.SELF_HOSTED) { - url = `/${bucket}/${key}` - } else { - url = `${env.CDN_URL}/${key}` + + // save the Etag for cache bursting + const etag = result.ETag + if (etag) { + cfgStructure.config[`${name}Etag`] = etag.replace(/"/g, "") } - cfgStructure.config[`${name}`] = url - // write back to db with url updated + // save the file key + cfgStructure.config[`${name}`] = key + + // write back to db await db.put(cfgStructure) ctx.body = { message: "File has been uploaded and url stored to config.", - url, + url: objectStore.getGlobalFileUrl(type, name, etag), } } -export async function destroy(ctx: BBContext) { +export async function destroy(ctx: UserCtx) { const db = tenancy.getGlobalDB() const { id, rev } = ctx.params try { @@ -378,7 +359,7 @@ export async function destroy(ctx: BBContext) { } } -export async function configChecklist(ctx: BBContext) { +export async function configChecklist(ctx: Ctx) { const db = tenancy.getGlobalDB() const tenantId = tenancy.getTenantId() diff --git a/packages/worker/src/api/controllers/global/users.ts b/packages/worker/src/api/controllers/global/users.ts index 27b90cbd56..10741f3725 100644 --- a/packages/worker/src/api/controllers/global/users.ts +++ b/packages/worker/src/api/controllers/global/users.ts @@ -178,7 +178,7 @@ export const find = async (ctx: any) => { export const tenantUserLookup = async (ctx: any) => { const id = ctx.params.id - const user = await tenancy.getTenantUser(id) + const user = await sdk.users.getPlatformUser(id) if (user) { ctx.body = user } else { diff --git a/packages/worker/src/api/routes/global/license.ts b/packages/worker/src/api/routes/global/license.ts index 17b0d59e70..0fb2a6e8bd 100644 --- a/packages/worker/src/api/routes/global/license.ts +++ b/packages/worker/src/api/routes/global/license.ts @@ -10,4 +10,4 @@ router .delete("/api/global/license/info", controller.deleteInfo) .get("/api/global/license/usage", controller.getQuotaUsage) -export = router +export default router diff --git a/packages/worker/src/environment.ts b/packages/worker/src/environment.ts index 37d40a2a9c..c9c82b4e20 100644 --- a/packages/worker/src/environment.ts +++ b/packages/worker/src/environment.ts @@ -91,6 +91,11 @@ for (let [key, value] of Object.entries(environment)) { // @ts-ignore environment[key] = 0 } + // handle the edge case of "false" to disable an environment variable + if (value === "false") { + // @ts-ignore + environment[key] = 0 + } } export = environment diff --git a/packages/worker/src/index.ts b/packages/worker/src/index.ts index 34e6937f3a..e88f4952f4 100644 --- a/packages/worker/src/index.ts +++ b/packages/worker/src/index.ts @@ -24,7 +24,7 @@ import * as redis from "./utilities/redis" const Sentry = require("@sentry/node") const koaSession = require("koa-session") const logger = require("koa-pino-logger") -const destroyable = require("server-destroy") +import destroyable from "server-destroy" // this will setup http and https proxies form env variables bootstrap() @@ -79,7 +79,6 @@ server.on("close", async () => { const shutdown = () => { server.close() - // @ts-ignore server.destroy() } diff --git a/packages/worker/src/sdk/users/users.ts b/packages/worker/src/sdk/users/users.ts index aedbd59703..f3117b63ab 100644 --- a/packages/worker/src/sdk/users/users.ts +++ b/packages/worker/src/sdk/users/users.ts @@ -25,6 +25,7 @@ import { InviteUsersRequest, InviteUsersResponse, MigrationType, + PlatformUser, PlatformUserByEmail, RowResponse, SearchUsersRequest, @@ -153,10 +154,26 @@ const buildUser = async ( return fullUser } +// lookup, could be email or userId, either will return a doc +export const getPlatformUser = async ( + identifier: string +): Promise => { + // use the view here and allow to find anyone regardless of casing + // Use lowercase to ensure email login is case insensitive + const response = dbUtils.queryPlatformView( + ViewName.PLATFORM_USERS_LOWERCASE, + { + keys: [identifier.toLowerCase()], + include_docs: true, + } + ) as Promise + return response +} + const validateUniqueUser = async (email: string, tenantId: string) => { // check budibase users in other tenants if (env.MULTI_TENANCY) { - const tenantUser = await tenancy.getTenantUser(email) + const tenantUser = await getPlatformUser(email) if (tenantUser != null && tenantUser.tenantId !== tenantId) { throw `Unavailable` } diff --git a/packages/worker/src/tests/jestSetup.ts b/packages/worker/src/tests/jestSetup.ts index fee704ae45..ab82cb5be7 100644 --- a/packages/worker/src/tests/jestSetup.ts +++ b/packages/worker/src/tests/jestSetup.ts @@ -22,7 +22,9 @@ mocks.fetch.enable() const tk = require("timekeeper") tk.freeze(mocks.date.MOCK_DATE) -global.console.log = jest.fn() // console.log are ignored in tests +if (!process.env.DEBUG) { + global.console.log = jest.fn() // console.log are ignored in tests +} if (!process.env.CI) { // set a longer timeout in dev for debugging diff --git a/packages/worker/src/tests/mocks/email.js b/packages/worker/src/tests/mocks/email.ts similarity index 90% rename from packages/worker/src/tests/mocks/email.js rename to packages/worker/src/tests/mocks/email.ts index 5e34c38f41..c16c58ddb5 100644 --- a/packages/worker/src/tests/mocks/email.js +++ b/packages/worker/src/tests/mocks/email.ts @@ -1,4 +1,4 @@ -exports.mock = () => { +export function mock() { // mock the email system const sendMailMock = jest.fn() const nodemailer = require("nodemailer") diff --git a/packages/worker/src/tests/mocks/index.ts b/packages/worker/src/tests/mocks/index.ts index d11eee7452..4d69e04716 100644 --- a/packages/worker/src/tests/mocks/index.ts +++ b/packages/worker/src/tests/mocks/index.ts @@ -1,4 +1,4 @@ -const email = require("./email") +import * as email from "./email" import { mocks } from "@budibase/backend-core/tests" export = { diff --git a/packages/worker/src/tests/structures/configs.ts b/packages/worker/src/tests/structures/configs.ts index a692e77987..2c76f271c4 100644 --- a/packages/worker/src/tests/structures/configs.ts +++ b/packages/worker/src/tests/structures/configs.ts @@ -1,5 +1,5 @@ -const { Config } = require("../../constants") -const { utils } = require("@budibase/backend-core") +import { Config } from "../../constants" +import { utils } from "@budibase/backend-core" export function oidc(conf?: any) { return { diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index f16fe132e3..4c44cc6df3 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -1325,10 +1325,10 @@ "@types/koa-compose" "*" "@types/node" "*" -"@types/koa__router@8.0.11": - version "8.0.11" - resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-8.0.11.tgz#d7b37e6db934fc072ea1baa2ab92bc8ac4564f3e" - integrity sha512-WXgKWpBsbS14kzmzD9LeFapOIa678h7zvUHxDwXwSx4ETKXhXLVUAToX6jZ/U7EihM7qwyD9W/BZvB0MRu7MTQ== +"@types/koa__router@8.0.8": + version "8.0.8" + resolved "https://registry.yarnpkg.com/@types/koa__router/-/koa__router-8.0.8.tgz#b1e0e9a512498777d3366bbdf0e853df27ec831c" + integrity sha512-9pGCaDtzCsj4HJ8HmGuqzk8+s57sPj4njWd08GG5o92n5Xp9io2snc40CPpXFhoKcZ8OKhuu6ht4gNou9e1C2w== dependencies: "@types/koa" "*" @@ -1536,6 +1536,13 @@ "@types/mime" "^1" "@types/node" "*" +"@types/server-destroy@1.0.1": + version "1.0.1" + resolved "https://registry.yarnpkg.com/@types/server-destroy/-/server-destroy-1.0.1.tgz#6010a89e2df4f2c15a265fe73c70fd3641486530" + integrity sha512-77QGr7waZbE0Y0uF+G+uH3H3SmhyA78Jf2r5r7QSrpg0U3kSXduWpGjzP9PvPLR/KCy+kHjjpnugRHsYTnHopg== + dependencies: + "@types/node" "*" + "@types/stack-utils@^2.0.0": version "2.0.1" resolved "https://registry.yarnpkg.com/@types/stack-utils/-/stack-utils-2.0.1.tgz#20f18294f797f2209b5f65c8e3b5c8e8261d127c" From f4462de364b1ca3ff0b76465ad43fb314a868a4f Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 11:58:11 +0000 Subject: [PATCH 05/33] v2.1.46-alpha.14 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 4 ++-- packages/worker/package.json | 10 +++++----- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lerna.json b/lerna.json index 50aae73f20..17a93e7a05 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 21f9563194..3e625813c0 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "2.1.46-alpha.13", + "@budibase/types": "2.1.46-alpha.14", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index dcafdc0f6c..c5b50b49a1 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": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.1.46-alpha.13", + "@budibase/string-templates": "2.1.46-alpha.14", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 0bf38cf3bd..eff8b54d13 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.1.46-alpha.13", - "@budibase/client": "2.1.46-alpha.13", - "@budibase/frontend-core": "2.1.46-alpha.13", - "@budibase/string-templates": "2.1.46-alpha.13", + "@budibase/bbui": "2.1.46-alpha.14", + "@budibase/client": "2.1.46-alpha.14", + "@budibase/frontend-core": "2.1.46-alpha.14", + "@budibase/string-templates": "2.1.46-alpha.14", "@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 c1023123c3..cd8cb8138e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.13", - "@budibase/string-templates": "2.1.46-alpha.13", - "@budibase/types": "2.1.46-alpha.13", + "@budibase/backend-core": "2.1.46-alpha.14", + "@budibase/string-templates": "2.1.46-alpha.14", + "@budibase/types": "2.1.46-alpha.14", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 57e331e7a9..9ecfe0aa60 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "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": "2.1.46-alpha.13", - "@budibase/frontend-core": "2.1.46-alpha.13", - "@budibase/string-templates": "2.1.46-alpha.13", + "@budibase/bbui": "2.1.46-alpha.14", + "@budibase/frontend-core": "2.1.46-alpha.14", + "@budibase/string-templates": "2.1.46-alpha.14", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index c33d2bc43e..e1a7b73eaa 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.1.46-alpha.13", + "@budibase/bbui": "2.1.46-alpha.14", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 38b87277fb..c0bc2c5223 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 9891cd49ba..d806198fc7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.1.46-alpha.13", - "@budibase/client": "2.1.46-alpha.13", + "@budibase/backend-core": "2.1.46-alpha.14", + "@budibase/client": "2.1.46-alpha.14", "@budibase/pro": "2.1.46-alpha.13", - "@budibase/string-templates": "2.1.46-alpha.13", - "@budibase/types": "2.1.46-alpha.13", + "@budibase/string-templates": "2.1.46-alpha.14", + "@budibase/types": "2.1.46-alpha.14", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b9e71666f6..d7be07c1d1 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 4d72311766..9f88f75a28 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -15,9 +15,9 @@ "devDependencies": { "@types/json5": "^2.2.0", "@types/koa": "2.13.4", - "koa-body": "4.2.0", "@types/node": "14.18.20", "@types/pouchdb": "6.4.0", + "koa-body": "4.2.0", "nano": "10.1.0", "rimraf": "3.0.2", "typescript": "4.7.3" diff --git a/packages/worker/package.json b/packages/worker/package.json index 98d59523ac..bdb8350744 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.46-alpha.13", + "version": "2.1.46-alpha.14", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.13", + "@budibase/backend-core": "2.1.46-alpha.14", "@budibase/pro": "2.1.46-alpha.13", - "@budibase/string-templates": "2.1.46-alpha.13", - "@budibase/types": "2.1.46-alpha.13", + "@budibase/string-templates": "2.1.46-alpha.14", + "@budibase/types": "2.1.46-alpha.14", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", @@ -77,9 +77,9 @@ "@types/node": "14.18.20", "@types/node-fetch": "2.6.1", "@types/pouchdb": "6.4.0", + "@types/server-destroy": "1.0.1", "@types/uuid": "8.3.4", "@typescript-eslint/parser": "5.45.0", - "@types/server-destroy": "1.0.1", "copyfiles": "2.4.1", "eslint": "6.8.0", "jest": "28.1.1", From 67d78626a2c7cfdeacc754f87c84a5eccea5e7cb Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 12:01:41 +0000 Subject: [PATCH 06/33] Update pro version to 2.1.46-alpha.14 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 43 +++++++++++++++++++++++------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 43 +++++++++++++++++++++++------------- 4 files changed, 58 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index d806198fc7..e07ae269e0 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -45,7 +45,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.1.46-alpha.14", "@budibase/client": "2.1.46-alpha.14", - "@budibase/pro": "2.1.46-alpha.13", + "@budibase/pro": "2.1.46-alpha.14", "@budibase/string-templates": "2.1.46-alpha.14", "@budibase/types": "2.1.46-alpha.14", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 76caf5a3fc..ba710d05d5 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,14 +1273,15 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.46-alpha.13": - version "2.1.46-alpha.13" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.13.tgz#a24c92f88c02ecf1fed0ea1c8f0d58f521d147ee" - integrity sha512-FtOJd7HLa3PxebwuLyGotTjdNG2DqLIjCDYyzk7lS+H7DhYX9pQ8nBS5TEc+pI9w7aXsWlIY5wFB90qIQ6tn+g== +"@budibase/backend-core@2.1.46-alpha.14": + version "2.1.46-alpha.14" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.14.tgz#825ba57d92c69133530d15dacb20b9f17d293886" + integrity sha512-shPf4ZgI222gKGCn7u/MgxPmFVsP7YLREpbzkyxnoxjBoXcRTrlgT51sG+VfUcFrX4LEOn13wraBrxxaNyixSg== dependencies: - "@budibase/types" "2.1.46-alpha.13" + "@budibase/types" "2.1.46-alpha.14" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" + aws-cloudfront-sign "2.2.0" aws-sdk "2.1030.0" bcrypt "5.0.1" bcryptjs "2.4.3" @@ -1360,13 +1361,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.1.46-alpha.13": - version "2.1.46-alpha.13" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.13.tgz#63712d6f22930d1de9bd62d6b74a015da3675c32" - integrity sha512-FwVEH3269I6wW5oT0f/lL/N6KrD5cJFfXc0jTLPNWo4nWOyoxGWr77sYZEhHtny+ifYuTk+BJxn2VyDNON2/Iw== +"@budibase/pro@2.1.46-alpha.14": + version "2.1.46-alpha.14" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.14.tgz#d6f08e9b3b68a57be75b8576dde99109b390ae8d" + integrity sha512-B8mtvC/Wpr/phFotDAdm9hHRLFUAFwA1g2TRNnocTmUzKUpcw/JMSNc7pxtdOgvWMsaY375l3z5Y/tySSKndpg== dependencies: - "@budibase/backend-core" "2.1.46-alpha.13" - "@budibase/types" "2.1.46-alpha.13" + "@budibase/backend-core" "2.1.46-alpha.14" + "@budibase/types" "2.1.46-alpha.14" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1391,10 +1392,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.1.46-alpha.13": - version "2.1.46-alpha.13" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.13.tgz#0107530cc8321d468821eeff4adf221e33ea179b" - integrity sha512-SUN+RcaJBIuXvgveUje8y9I9FdB+LXAW3DUK0SZBEphL3LmU3/Mc2bfhS1kOoLyImVY52ByzinpCUyBHR7zWXQ== +"@budibase/types@2.1.46-alpha.14": + version "2.1.46-alpha.14" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.14.tgz#d3f90cd28dce19989206ee7dacad6ba1ae764d61" + integrity sha512-FXLE9XFCaA87jf7lXatGtSiSIiMIhIYGXJS2O5DhpYTYMCdT528DZs8h7R+5CuMsDwEF8WO1IlHTQ7Zw09jZZA== "@bull-board/api@3.7.0": version "3.7.0" @@ -4233,6 +4234,13 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== +aws-cloudfront-sign@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" + integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== + dependencies: + lodash "^3.6.0" + aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -10213,6 +10221,11 @@ lodash@4.17.21, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17. resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +lodash@^3.6.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== + logform@^2.3.2, logform@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/logform/-/logform-2.4.0.tgz#131651715a17d50f09c2a2c1a524ff1a4164bcfe" diff --git a/packages/worker/package.json b/packages/worker/package.json index bdb8350744..2cf0819a48 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.1.46-alpha.14", - "@budibase/pro": "2.1.46-alpha.13", + "@budibase/pro": "2.1.46-alpha.14", "@budibase/string-templates": "2.1.46-alpha.14", "@budibase/types": "2.1.46-alpha.14", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 4c44cc6df3..562574a7d0 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,14 +470,15 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.46-alpha.13": - version "2.1.46-alpha.13" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.13.tgz#a24c92f88c02ecf1fed0ea1c8f0d58f521d147ee" - integrity sha512-FtOJd7HLa3PxebwuLyGotTjdNG2DqLIjCDYyzk7lS+H7DhYX9pQ8nBS5TEc+pI9w7aXsWlIY5wFB90qIQ6tn+g== +"@budibase/backend-core@2.1.46-alpha.14": + version "2.1.46-alpha.14" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.14.tgz#825ba57d92c69133530d15dacb20b9f17d293886" + integrity sha512-shPf4ZgI222gKGCn7u/MgxPmFVsP7YLREpbzkyxnoxjBoXcRTrlgT51sG+VfUcFrX4LEOn13wraBrxxaNyixSg== dependencies: - "@budibase/types" "2.1.46-alpha.13" + "@budibase/types" "2.1.46-alpha.14" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" + aws-cloudfront-sign "2.2.0" aws-sdk "2.1030.0" bcrypt "5.0.1" bcryptjs "2.4.3" @@ -507,23 +508,23 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.1.46-alpha.13": - version "2.1.46-alpha.13" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.13.tgz#63712d6f22930d1de9bd62d6b74a015da3675c32" - integrity sha512-FwVEH3269I6wW5oT0f/lL/N6KrD5cJFfXc0jTLPNWo4nWOyoxGWr77sYZEhHtny+ifYuTk+BJxn2VyDNON2/Iw== +"@budibase/pro@2.1.46-alpha.14": + version "2.1.46-alpha.14" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.14.tgz#d6f08e9b3b68a57be75b8576dde99109b390ae8d" + integrity sha512-B8mtvC/Wpr/phFotDAdm9hHRLFUAFwA1g2TRNnocTmUzKUpcw/JMSNc7pxtdOgvWMsaY375l3z5Y/tySSKndpg== dependencies: - "@budibase/backend-core" "2.1.46-alpha.13" - "@budibase/types" "2.1.46-alpha.13" + "@budibase/backend-core" "2.1.46-alpha.14" + "@budibase/types" "2.1.46-alpha.14" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.1.46-alpha.13": - version "2.1.46-alpha.13" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.13.tgz#0107530cc8321d468821eeff4adf221e33ea179b" - integrity sha512-SUN+RcaJBIuXvgveUje8y9I9FdB+LXAW3DUK0SZBEphL3LmU3/Mc2bfhS1kOoLyImVY52ByzinpCUyBHR7zWXQ== +"@budibase/types@2.1.46-alpha.14": + version "2.1.46-alpha.14" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.14.tgz#d3f90cd28dce19989206ee7dacad6ba1ae764d61" + integrity sha512-FXLE9XFCaA87jf7lXatGtSiSIiMIhIYGXJS2O5DhpYTYMCdT528DZs8h7R+5CuMsDwEF8WO1IlHTQ7Zw09jZZA== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" @@ -1883,6 +1884,13 @@ atomic-sleep@^1.0.0: resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== +aws-cloudfront-sign@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" + integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== + dependencies: + lodash "^3.6.0" + aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -5226,6 +5234,11 @@ lodash@4.17.21, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +lodash@^3.6.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" From 090ae5df49453ac7ca4694865ffe46d9c2356835 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Thu, 15 Dec 2022 12:13:42 +0000 Subject: [PATCH 07/33] Master => Develop (#9049) * v2.1.46 * Update pro version to 2.1.46 * v2.2.0 * Update pro version to 2.2.0 * Fix for budibase plugin skeleton, which utilises the old import style. * Fix side nav styles * v2.2.1 * Update pro version to 2.2.1 * using dist folder to allow importing constants for openAPI specs * v2.2.2 * Update pro version to 2.2.2 * Fix for user enrichment call (updating to @budibase/nano fork) (#9038) * Fix for #9029 - this should fix the issue users have been experiencing with user enrichment calls in apps, essentially it utilises a fork of the nano library we use to interact with CouchDB, which has been updated to use a POST request rather than a GET request as it supports a larger set of data being sent as query parameters. * Incrementing Nano version to attempt to fix yarn registry issues. * v2.2.3 * Update pro version to 2.2.3 * Fix SQL table `_id` filtering (#9030) * Re-add support for filtering on _id using external SQL tables and fix filter key prefixes not working with _id field * Remove like operator from internal tables and only allow basic operators on SQL table _id column * Update data section filtering to respect new rules * Update automation section filtering to respect new rules * Update dynamic filter component to respect new rules Co-authored-by: Martin McKeaveney Co-authored-by: Budibase Release Bot <> Co-authored-by: mike12345567 Co-authored-by: Martin McKeaveney --- lerna.json | 2 +- packages/backend-core/package.json | 6 +- .../backend-core/src/db/couch/DatabaseImpl.ts | 2 +- packages/backend-core/yarn.lock | 24 +++---- packages/bbui/package.json | 4 +- packages/builder/package.json | 10 +-- .../SetupPanel/AutomationBlockSetup.svelte | 1 + .../backend/DataTable/DataTable.svelte | 1 + .../buttons/TableFilterButton.svelte | 2 + .../controls/FilterEditor/FilterDrawer.svelte | 20 +++--- .../controls/FilterEditor/FilterEditor.svelte | 6 +- packages/builder/src/helpers/searchFields.js | 10 +-- packages/cli/package.json | 8 +-- packages/client/package.json | 8 +-- .../client/src/components/app/Layout.svelte | 15 ++-- .../app/dynamic-filter/DynamicFilter.svelte | 8 +-- .../app/dynamic-filter/FilterModal.svelte | 11 ++- packages/frontend-core/package.json | 4 +- packages/frontend-core/src/utils/lucene.js | 33 ++++++--- packages/sdk/package.json | 2 +- packages/server/package.json | 12 ++-- packages/server/specs/resources/query.js | 2 +- packages/server/specs/resources/table.js | 2 +- .../api/controllers/row/ExternalRequest.ts | 21 ++++-- packages/server/yarn.lock | 70 ++++++++----------- packages/string-templates/package.json | 2 +- packages/types/package.json | 8 +-- packages/types/src/sdk/db.ts | 2 +- packages/types/yarn.lock | 26 +++---- packages/worker/package.json | 12 ++-- packages/worker/yarn.lock | 70 ++++++++----------- 31 files changed, 203 insertions(+), 201 deletions(-) diff --git a/lerna.json b/lerna.json index 17a93e7a05..3f4bf5ad60 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.1.46-alpha.14", + "version": "2.2.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 3e625813c0..cc58fc13e9 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -20,7 +20,8 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/types": "2.1.46-alpha.14", + "@budibase/nano": "10.1.1", + "@budibase/types": "^2.2.3", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", @@ -36,7 +37,6 @@ "koa-passport": "4.1.4", "lodash": "4.17.21", "lodash.isarguments": "3.1.0", - "nano": "^10.1.0", "node-fetch": "2.6.7", "passport-google-oauth": "2.0.0", "passport-jwt": "4.0.0", diff --git a/packages/backend-core/src/db/couch/DatabaseImpl.ts b/packages/backend-core/src/db/couch/DatabaseImpl.ts index de06b4e8ee..9b4761d961 100644 --- a/packages/backend-core/src/db/couch/DatabaseImpl.ts +++ b/packages/backend-core/src/db/couch/DatabaseImpl.ts @@ -1,4 +1,4 @@ -import Nano from "nano" +import Nano from "@budibase/nano" import { AllDocsResponse, AnyDocument, diff --git a/packages/backend-core/yarn.lock b/packages/backend-core/yarn.lock index 5115a44095..249c614d82 100644 --- a/packages/backend-core/yarn.lock +++ b/packages/backend-core/yarn.lock @@ -470,6 +470,18 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== +"@budibase/nano@10.1.1": + version "10.1.1" + resolved "https://registry.yarnpkg.com/@budibase/nano/-/nano-10.1.1.tgz#36ccda4d9bb64b5ee14dd2b27a295b40739b1038" + integrity sha512-kbMIzMkjVtl+xI0UPwVU0/pn8/ccxTyfzwBz6Z+ZiN2oUSb0fJCe0qwA6o8dxwSa8nZu4MbGAeMJl3CJndmWtA== + dependencies: + "@types/tough-cookie" "^4.0.2" + axios "^1.1.3" + http-cookie-agent "^4.0.2" + node-abort-controller "^3.0.1" + qs "^6.11.0" + tough-cookie "^4.1.2" + "@cspotcode/source-map-support@^0.8.0": version "0.8.1" resolved "https://registry.yarnpkg.com/@cspotcode/source-map-support/-/source-map-support-0.8.1.tgz#00629c35a688e05a88b1cda684fb9d5e73f000a1" @@ -4034,18 +4046,6 @@ msgpackr@^1.5.2: optionalDependencies: msgpackr-extract "^2.1.2" -nano@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/nano/-/nano-10.1.0.tgz#afdd5a7440e62f09a8e23f41fcea328d27383922" - integrity sha512-COeN2TpLcHuSN44QLnPmfZCoCsKAg8/aelPOVqqm/2/MvRHDEA11/Kld5C4sLzDlWlhFZ3SO2WGJGevCsvcEzQ== - dependencies: - "@types/tough-cookie" "^4.0.2" - axios "^1.1.3" - http-cookie-agent "^4.0.2" - node-abort-controller "^3.0.1" - qs "^6.11.0" - tough-cookie "^4.1.2" - napi-macros@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" diff --git a/packages/bbui/package.json b/packages/bbui/package.json index c5b50b49a1..dbf07e74f5 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": "2.1.46-alpha.14", + "version": "2.2.3", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.1.46-alpha.14", + "@budibase/string-templates": "^2.2.3", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index eff8b54d13..f1dafbb2a5 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.1.46-alpha.14", - "@budibase/client": "2.1.46-alpha.14", - "@budibase/frontend-core": "2.1.46-alpha.14", - "@budibase/string-templates": "2.1.46-alpha.14", + "@budibase/bbui": "^2.2.3", + "@budibase/client": "^2.2.3", + "@budibase/frontend-core": "^2.2.3", + "@budibase/string-templates": "^2.2.3", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index d09faa34c9..a73db5648b 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -232,6 +232,7 @@ {filters} {bindings} {schemaFields} + datasource={{ type: "table", tableId }} panel={AutomationBindingPanel} fillWidth on:change={e => (tempFilters = e.detail)} diff --git a/packages/builder/src/components/backend/DataTable/DataTable.svelte b/packages/builder/src/components/backend/DataTable/DataTable.svelte index 4f5c3375bd..bdf2f46b2c 100644 --- a/packages/builder/src/components/backend/DataTable/DataTable.svelte +++ b/packages/builder/src/components/backend/DataTable/DataTable.svelte @@ -190,6 +190,7 @@ {filters} on:change={onFilter} disabled={!hasCols} + tableId={id} /> {/key} diff --git a/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte b/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte index be9c6259c6..5db4eb5288 100644 --- a/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte +++ b/packages/builder/src/components/backend/DataTable/buttons/TableFilterButton.svelte @@ -6,6 +6,7 @@ export let schema export let filters export let disabled = false + export let tableId const dispatch = createEventDispatcher() @@ -37,6 +38,7 @@ allowBindings={false} {filters} {schemaFields} + datasource={{ type: "table", tableId }} on:change={e => (tempValue = e.detail)} /> diff --git a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte index d495e37216..629e2024e7 100644 --- a/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte +++ b/packages/builder/src/components/design/settings/controls/FilterEditor/FilterDrawer.svelte @@ -25,7 +25,7 @@ export let panel = ClientBindingPanel export let allowBindings = true export let fillWidth = false - export let tableId + export let datasource const dispatch = createEventDispatcher() const { OperatorOptions } = Constants @@ -41,11 +41,7 @@ $: parseFilters(filters) $: dispatch("change", enrichFilters(rawFilters, matchAny)) - $: enrichedSchemaFields = getFields( - schemaFields || [], - { allowLinks: true }, - tableId - ) + $: enrichedSchemaFields = getFields(schemaFields || [], { allowLinks: true }) $: fieldOptions = enrichedSchemaFields.map(field => field.name) || [] $: valueTypeOptions = allowBindings ? ["Value", "Binding"] : ["Value"] @@ -119,7 +115,11 @@ const santizeOperator = filter => { // Ensure a valid operator is selected - const operators = getValidOperatorsForType(filter.type).map(x => x.value) + const operators = getValidOperatorsForType( + filter.type, + filter.field, + datasource + ).map(x => x.value) if (!operators.includes(filter.operator)) { filter.operator = operators[0] ?? OperatorOptions.Equals.value } @@ -201,7 +201,11 @@ /> onOperatorChange(filter, e.detail)} placeholder={null} diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index e1a7b73eaa..9f623143aa 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.1.46-alpha.14", + "@budibase/bbui": "^2.2.3", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/frontend-core/src/utils/lucene.js b/packages/frontend-core/src/utils/lucene.js index 774ddbd834..427d8f8b97 100644 --- a/packages/frontend-core/src/utils/lucene.js +++ b/packages/frontend-core/src/utils/lucene.js @@ -7,7 +7,7 @@ const HBS_REGEX = /{{([^{].*?)}}/g * Returns the valid operator options for a certain data type * @param type the data type */ -export const getValidOperatorsForType = type => { +export const getValidOperatorsForType = (type, field, datasource) => { const Op = OperatorOptions const stringOps = [ Op.Equals, @@ -27,24 +27,37 @@ export const getValidOperatorsForType = type => { Op.NotEmpty, Op.In, ] + let ops = [] if (type === "string") { - return stringOps + ops = stringOps } else if (type === "number") { - return numOps + ops = numOps } else if (type === "options") { - return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In] + ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty, Op.In] } else if (type === "array") { - return [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty, Op.ContainsAny] + ops = [Op.Contains, Op.NotContains, Op.Empty, Op.NotEmpty, Op.ContainsAny] } else if (type === "boolean") { - return [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty] + ops = [Op.Equals, Op.NotEquals, Op.Empty, Op.NotEmpty] } else if (type === "longform") { - return stringOps + ops = stringOps } else if (type === "datetime") { - return numOps + ops = numOps } else if (type === "formula") { - return stringOps.concat([Op.MoreThan, Op.LessThan]) + ops = stringOps.concat([Op.MoreThan, Op.LessThan]) } - return [] + + // Filter out "like" for internal tables + const externalTable = datasource?.tableId?.includes("datasource_plus") + if (datasource?.type === "table" && !externalTable) { + ops = ops.filter(x => x !== Op.Like) + } + + // Only allow equal/not equal for _id in SQL tables + if (field === "_id" && externalTable) { + ops = [Op.Equals, Op.NotEquals] + } + + return ops } /** diff --git a/packages/sdk/package.json b/packages/sdk/package.json index c0bc2c5223..31249b8a7d 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index e07ae269e0..bce3119a2e 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.1.46-alpha.14", - "@budibase/client": "2.1.46-alpha.14", - "@budibase/pro": "2.1.46-alpha.14", - "@budibase/string-templates": "2.1.46-alpha.14", - "@budibase/types": "2.1.46-alpha.14", + "@budibase/backend-core": "^2.2.3", + "@budibase/client": "^2.2.3", + "@budibase/pro": "2.2.3", + "@budibase/string-templates": "^2.2.3", + "@budibase/types": "^2.2.3", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/server/specs/resources/query.js b/packages/server/specs/resources/query.js index 1442e46a04..10544ee7eb 100644 --- a/packages/server/specs/resources/query.js +++ b/packages/server/specs/resources/query.js @@ -1,6 +1,6 @@ const Resource = require("./utils/Resource") const { object } = require("./utils") -const { BaseQueryVerbs } = require("../../src/constants") +const { BaseQueryVerbs } = require("../../dist/constants") const query = { _id: "query_datasource_plus_4d8be0c506b9465daf4bf84d890fdab6_454854487c574d45bc4029b1e153219e", diff --git a/packages/server/specs/resources/table.js b/packages/server/specs/resources/table.js index 523a3a9dfd..9bc57daf42 100644 --- a/packages/server/specs/resources/table.js +++ b/packages/server/specs/resources/table.js @@ -2,7 +2,7 @@ const { FieldTypes, RelationshipTypes, FormulaTypes, -} = require("../../src/constants") +} = require("../../dist/constants") const { object } = require("./utils") const Resource = require("./utils/Resource") diff --git a/packages/server/src/api/controllers/row/ExternalRequest.ts b/packages/server/src/api/controllers/row/ExternalRequest.ts index 8eb1ce8263..80ba4fd808 100644 --- a/packages/server/src/api/controllers/row/ExternalRequest.ts +++ b/packages/server/src/api/controllers/row/ExternalRequest.ts @@ -24,6 +24,7 @@ import { processObjectSync } from "@budibase/string-templates" import { cloneDeep } from "lodash/fp" import { processFormulas, processDates } from "../../../utilities/rowProcessor" import { context } from "@budibase/backend-core" +import { removeKeyNumbering } from "./utils" export interface ManyRelationship { tableId?: string @@ -54,15 +55,21 @@ function buildFilters( let idCopy: undefined | string | any[] = cloneDeep(id) if (filters) { // need to map over the filters and make sure the _id field isn't present - for (let filter of Object.values(filters)) { - if (filter._id && primary) { - const parts = breakRowIdField(filter._id) - for (let field of primary) { - filter[field] = parts.shift() + let prefix = 1 + for (let operator of Object.values(filters)) { + for (let field of Object.keys(operator || {})) { + if (removeKeyNumbering(field) === "_id") { + if (primary) { + const parts = breakRowIdField(operator[field]) + for (let field of primary) { + operator[`${prefix}:${field}`] = parts.shift() + } + prefix++ + } + // make sure this field doesn't exist on any filter + delete operator[field] } } - // make sure this field doesn't exist on any filter - delete filter._id } } // there is no id, just use the user provided filters diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index ba710d05d5..d40ab069ad 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,15 +1273,15 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.46-alpha.14": - version "2.1.46-alpha.14" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.14.tgz#825ba57d92c69133530d15dacb20b9f17d293886" - integrity sha512-shPf4ZgI222gKGCn7u/MgxPmFVsP7YLREpbzkyxnoxjBoXcRTrlgT51sG+VfUcFrX4LEOn13wraBrxxaNyixSg== +"@budibase/backend-core@2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.3.tgz#e2c3214bdbd6fa5cc95038816ecc40a9a0538be9" + integrity sha512-vGOWkQ8Xk6p6Lcvbtj6Z4UMoZoZlllMwmnWkwBbwr0am9bVFBF9k65Ca/vioA1egsvmM9hKCCQV6xeDcUz8qaQ== dependencies: - "@budibase/types" "2.1.46-alpha.14" + "@budibase/nano" "10.1.1" + "@budibase/types" "^2.2.3" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" - aws-cloudfront-sign "2.2.0" aws-sdk "2.1030.0" bcrypt "5.0.1" bcryptjs "2.4.3" @@ -1294,7 +1294,6 @@ koa-passport "4.1.4" lodash "4.17.21" lodash.isarguments "3.1.0" - nano "^10.1.0" node-fetch "2.6.7" passport-google-oauth "2.0.0" passport-jwt "4.0.0" @@ -1361,17 +1360,28 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.1.46-alpha.14": - version "2.1.46-alpha.14" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.14.tgz#d6f08e9b3b68a57be75b8576dde99109b390ae8d" - integrity sha512-B8mtvC/Wpr/phFotDAdm9hHRLFUAFwA1g2TRNnocTmUzKUpcw/JMSNc7pxtdOgvWMsaY375l3z5Y/tySSKndpg== +"@budibase/nano@10.1.1": + version "10.1.1" + resolved "https://registry.yarnpkg.com/@budibase/nano/-/nano-10.1.1.tgz#36ccda4d9bb64b5ee14dd2b27a295b40739b1038" + integrity sha512-kbMIzMkjVtl+xI0UPwVU0/pn8/ccxTyfzwBz6Z+ZiN2oUSb0fJCe0qwA6o8dxwSa8nZu4MbGAeMJl3CJndmWtA== dependencies: - "@budibase/backend-core" "2.1.46-alpha.14" - "@budibase/types" "2.1.46-alpha.14" + "@types/tough-cookie" "^4.0.2" + axios "^1.1.3" + http-cookie-agent "^4.0.2" + node-abort-controller "^3.0.1" + qs "^6.11.0" + tough-cookie "^4.1.2" + +"@budibase/pro@2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.3.tgz#2e307353597e36df74f80d8affe4ba5686f895fb" + integrity sha512-o93ara4THEzMLyNyym+BzcPfB0S8XL4ayRnwbaUnF1cqwbJbiFUv4QR9PC2mrRW7f2EuyVdG2CiCh8EGi05f/A== + dependencies: + "@budibase/backend-core" "2.2.3" + "@budibase/types" "2.2.3" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" - jsonwebtoken "8.5.1" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": @@ -1392,10 +1402,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.1.46-alpha.14": - version "2.1.46-alpha.14" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.14.tgz#d3f90cd28dce19989206ee7dacad6ba1ae764d61" - integrity sha512-FXLE9XFCaA87jf7lXatGtSiSIiMIhIYGXJS2O5DhpYTYMCdT528DZs8h7R+5CuMsDwEF8WO1IlHTQ7Zw09jZZA== +"@budibase/types@2.2.3", "@budibase/types@^2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.3.tgz#81ecc4d04cf74698bcd7ea77cee226b0dfd9d949" + integrity sha512-+LnzJvxbsUtFnSvd9uki6N7OPwmqu4R8nLXuLzDJyknHVdrLgkAduv+0AZ6WIqjgl6ADVcvk48Et40s0wotZxw== "@bull-board/api@3.7.0": version "3.7.0" @@ -4234,13 +4244,6 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== -aws-cloudfront-sign@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" - integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== - dependencies: - lodash "^3.6.0" - aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -10221,11 +10224,6 @@ lodash@4.17.21, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17. resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -lodash@^3.6.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" - integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== - logform@^2.3.2, logform@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/logform/-/logform-2.4.0.tgz#131651715a17d50f09c2a2c1a524ff1a4164bcfe" @@ -10756,18 +10754,6 @@ nan@^2.12.1: resolved "https://registry.yarnpkg.com/nan/-/nan-2.16.0.tgz#664f43e45460fb98faf00edca0bb0d7b8dce7916" integrity sha512-UdAqHyFngu7TfQKsCBgAA6pWDkT8MAO7d0jyOecVhN5354xbLqdn8mV9Tat9gepAupm0bt2DbeaSC8vS52MuFA== -nano@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/nano/-/nano-10.1.0.tgz#afdd5a7440e62f09a8e23f41fcea328d27383922" - integrity sha512-COeN2TpLcHuSN44QLnPmfZCoCsKAg8/aelPOVqqm/2/MvRHDEA11/Kld5C4sLzDlWlhFZ3SO2WGJGevCsvcEzQ== - dependencies: - "@types/tough-cookie" "^4.0.2" - axios "^1.1.3" - http-cookie-agent "^4.0.2" - node-abort-controller "^3.0.1" - qs "^6.11.0" - tough-cookie "^4.1.2" - nanomatch@^1.2.9: version "1.2.13" resolved "https://registry.yarnpkg.com/nanomatch/-/nanomatch-1.2.13.tgz#b87a8aa4fc0de8fe6be88895b38983ff265bd119" diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index d7be07c1d1..6d878f4df8 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 9f88f75a28..f090f0a2af 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -13,12 +13,12 @@ }, "jest": {}, "devDependencies": { - "@types/json5": "^2.2.0", + "@budibase/nano": "10.1.1", + "@types/json5": "2.2.0", "@types/koa": "2.13.4", + "koa-body": "4.2.0", "@types/node": "14.18.20", "@types/pouchdb": "6.4.0", - "koa-body": "4.2.0", - "nano": "10.1.0", "rimraf": "3.0.2", "typescript": "4.7.3" } diff --git a/packages/types/src/sdk/db.ts b/packages/types/src/sdk/db.ts index 84daed0f90..50078ed6cc 100644 --- a/packages/types/src/sdk/db.ts +++ b/packages/types/src/sdk/db.ts @@ -1,5 +1,5 @@ import PouchDB from "pouchdb" -import Nano from "nano" +import Nano from "@budibase/nano" import { AllDocsResponse, AnyDocument, Document } from "../" export type PouchOptions = { diff --git a/packages/types/yarn.lock b/packages/types/yarn.lock index 9ba7015888..4acf3737a0 100644 --- a/packages/types/yarn.lock +++ b/packages/types/yarn.lock @@ -2,6 +2,18 @@ # yarn lockfile v1 +"@budibase/nano@10.1.1": + version "10.1.1" + resolved "https://registry.yarnpkg.com/@budibase/nano/-/nano-10.1.1.tgz#36ccda4d9bb64b5ee14dd2b27a295b40739b1038" + integrity sha512-kbMIzMkjVtl+xI0UPwVU0/pn8/ccxTyfzwBz6Z+ZiN2oUSb0fJCe0qwA6o8dxwSa8nZu4MbGAeMJl3CJndmWtA== + dependencies: + "@types/tough-cookie" "^4.0.2" + axios "^1.1.3" + http-cookie-agent "^4.0.2" + node-abort-controller "^3.0.1" + qs "^6.11.0" + tough-cookie "^4.1.2" + "@types/accepts@*": version "1.3.5" resolved "https://registry.yarnpkg.com/@types/accepts/-/accepts-1.3.5.tgz#c34bec115cfc746e04fe5a059df4ce7e7b391575" @@ -82,7 +94,7 @@ resolved "https://registry.yarnpkg.com/@types/http-errors/-/http-errors-1.8.2.tgz#7315b4c4c54f82d13fa61c228ec5c2ea5cc9e0e1" integrity sha512-EqX+YQxINb+MeXaIqYDASb6U6FCHbWjkj4a1CKDBks3d/QiB2+PqBLyO72vLDgAO1wUI4O+9gweRcQK11bTL/w== -"@types/json5@^2.2.0": +"@types/json5@2.2.0": version "2.2.0" resolved "https://registry.yarnpkg.com/@types/json5/-/json5-2.2.0.tgz#afff29abf9182a7d4a7e39105ca051f11c603d13" integrity sha512-NrVug5woqbvNZ0WX+Gv4R+L4TGddtmFek2u8RtccAgFZWtS9QXF2xCXY22/M4nzkaKF0q9Fc6M/5rxLDhfwc/A== @@ -552,18 +564,6 @@ ms@2.1.2: resolved "https://registry.yarnpkg.com/ms/-/ms-2.1.2.tgz#d09d1f357b443f493382a8eb3ccd183872ae6009" integrity sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w== -nano@10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/nano/-/nano-10.1.0.tgz#afdd5a7440e62f09a8e23f41fcea328d27383922" - integrity sha512-COeN2TpLcHuSN44QLnPmfZCoCsKAg8/aelPOVqqm/2/MvRHDEA11/Kld5C4sLzDlWlhFZ3SO2WGJGevCsvcEzQ== - dependencies: - "@types/tough-cookie" "^4.0.2" - axios "^1.1.3" - http-cookie-agent "^4.0.2" - node-abort-controller "^3.0.1" - qs "^6.11.0" - tough-cookie "^4.1.2" - node-abort-controller@^3.0.1: version "3.0.1" resolved "https://registry.yarnpkg.com/node-abort-controller/-/node-abort-controller-3.0.1.tgz#f91fa50b1dee3f909afabb7e261b1e1d6b0cb74e" diff --git a/packages/worker/package.json b/packages/worker/package.json index 2cf0819a48..62bb22ec6e 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.1.46-alpha.14", + "version": "2.2.3", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.1.46-alpha.14", - "@budibase/pro": "2.1.46-alpha.14", - "@budibase/string-templates": "2.1.46-alpha.14", - "@budibase/types": "2.1.46-alpha.14", + "@budibase/backend-core": "^2.2.3", + "@budibase/pro": "2.2.3", + "@budibase/string-templates": "^2.2.3", + "@budibase/types": "^2.2.3", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", @@ -77,9 +77,9 @@ "@types/node": "14.18.20", "@types/node-fetch": "2.6.1", "@types/pouchdb": "6.4.0", - "@types/server-destroy": "1.0.1", "@types/uuid": "8.3.4", "@typescript-eslint/parser": "5.45.0", + "@types/server-destroy": "1.0.1", "copyfiles": "2.4.1", "eslint": "6.8.0", "jest": "28.1.1", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 562574a7d0..4d5602339f 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,15 +470,15 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.1.46-alpha.14": - version "2.1.46-alpha.14" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.1.46-alpha.14.tgz#825ba57d92c69133530d15dacb20b9f17d293886" - integrity sha512-shPf4ZgI222gKGCn7u/MgxPmFVsP7YLREpbzkyxnoxjBoXcRTrlgT51sG+VfUcFrX4LEOn13wraBrxxaNyixSg== +"@budibase/backend-core@2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.3.tgz#e2c3214bdbd6fa5cc95038816ecc40a9a0538be9" + integrity sha512-vGOWkQ8Xk6p6Lcvbtj6Z4UMoZoZlllMwmnWkwBbwr0am9bVFBF9k65Ca/vioA1egsvmM9hKCCQV6xeDcUz8qaQ== dependencies: - "@budibase/types" "2.1.46-alpha.14" + "@budibase/nano" "10.1.1" + "@budibase/types" "^2.2.3" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" - aws-cloudfront-sign "2.2.0" aws-sdk "2.1030.0" bcrypt "5.0.1" bcryptjs "2.4.3" @@ -491,7 +491,6 @@ koa-passport "4.1.4" lodash "4.17.21" lodash.isarguments "3.1.0" - nano "^10.1.0" node-fetch "2.6.7" passport-google-oauth "2.0.0" passport-jwt "4.0.0" @@ -508,23 +507,34 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.1.46-alpha.14": - version "2.1.46-alpha.14" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.1.46-alpha.14.tgz#d6f08e9b3b68a57be75b8576dde99109b390ae8d" - integrity sha512-B8mtvC/Wpr/phFotDAdm9hHRLFUAFwA1g2TRNnocTmUzKUpcw/JMSNc7pxtdOgvWMsaY375l3z5Y/tySSKndpg== +"@budibase/nano@10.1.1": + version "10.1.1" + resolved "https://registry.yarnpkg.com/@budibase/nano/-/nano-10.1.1.tgz#36ccda4d9bb64b5ee14dd2b27a295b40739b1038" + integrity sha512-kbMIzMkjVtl+xI0UPwVU0/pn8/ccxTyfzwBz6Z+ZiN2oUSb0fJCe0qwA6o8dxwSa8nZu4MbGAeMJl3CJndmWtA== dependencies: - "@budibase/backend-core" "2.1.46-alpha.14" - "@budibase/types" "2.1.46-alpha.14" + "@types/tough-cookie" "^4.0.2" + axios "^1.1.3" + http-cookie-agent "^4.0.2" + node-abort-controller "^3.0.1" + qs "^6.11.0" + tough-cookie "^4.1.2" + +"@budibase/pro@2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.3.tgz#2e307353597e36df74f80d8affe4ba5686f895fb" + integrity sha512-o93ara4THEzMLyNyym+BzcPfB0S8XL4ayRnwbaUnF1cqwbJbiFUv4QR9PC2mrRW7f2EuyVdG2CiCh8EGi05f/A== + dependencies: + "@budibase/backend-core" "2.2.3" + "@budibase/types" "2.2.3" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" - jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.1.46-alpha.14": - version "2.1.46-alpha.14" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.1.46-alpha.14.tgz#d3f90cd28dce19989206ee7dacad6ba1ae764d61" - integrity sha512-FXLE9XFCaA87jf7lXatGtSiSIiMIhIYGXJS2O5DhpYTYMCdT528DZs8h7R+5CuMsDwEF8WO1IlHTQ7Zw09jZZA== +"@budibase/types@2.2.3", "@budibase/types@^2.2.3": + version "2.2.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.3.tgz#81ecc4d04cf74698bcd7ea77cee226b0dfd9d949" + integrity sha512-+LnzJvxbsUtFnSvd9uki6N7OPwmqu4R8nLXuLzDJyknHVdrLgkAduv+0AZ6WIqjgl6ADVcvk48Et40s0wotZxw== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" @@ -1884,13 +1894,6 @@ atomic-sleep@^1.0.0: resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== -aws-cloudfront-sign@2.2.0: - version "2.2.0" - resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" - integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== - dependencies: - lodash "^3.6.0" - aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -5234,11 +5237,6 @@ lodash@4.17.21, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== -lodash@^3.6.0: - version "3.10.1" - resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" - integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== - lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" @@ -5514,18 +5512,6 @@ mute-stream@0.0.8: resolved "https://registry.yarnpkg.com/mute-stream/-/mute-stream-0.0.8.tgz#1630c42b2251ff81e2a283de96a5497ea92e5e0d" integrity sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA== -nano@^10.1.0: - version "10.1.0" - resolved "https://registry.yarnpkg.com/nano/-/nano-10.1.0.tgz#afdd5a7440e62f09a8e23f41fcea328d27383922" - integrity sha512-COeN2TpLcHuSN44QLnPmfZCoCsKAg8/aelPOVqqm/2/MvRHDEA11/Kld5C4sLzDlWlhFZ3SO2WGJGevCsvcEzQ== - dependencies: - "@types/tough-cookie" "^4.0.2" - axios "^1.1.3" - http-cookie-agent "^4.0.2" - node-abort-controller "^3.0.1" - qs "^6.11.0" - tough-cookie "^4.1.2" - napi-macros@~2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/napi-macros/-/napi-macros-2.0.0.tgz#2b6bae421e7b96eb687aa6c77a7858640670001b" From 8461dc22fe129ae496852282cd73f539f86fe2e5 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 12:27:02 +0000 Subject: [PATCH 08/33] v2.2.4-alpha.0 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 4 ++-- packages/worker/package.json | 10 +++++----- 12 files changed, 34 insertions(+), 34 deletions(-) diff --git a/lerna.json b/lerna.json index 3f4bf5ad60..d4c0cd9288 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.3", + "version": "2.2.4-alpha.0", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index cc58fc13e9..ddfbb1eeaa 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -21,7 +21,7 @@ }, "dependencies": { "@budibase/nano": "10.1.1", - "@budibase/types": "^2.2.3", + "@budibase/types": "2.2.4-alpha.0", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index dbf07e74f5..663c40a211 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": "2.2.3", + "version": "2.2.4-alpha.0", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "^2.2.3", + "@budibase/string-templates": "2.2.4-alpha.0", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index f1dafbb2a5..0be715d48d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "^2.2.3", - "@budibase/client": "^2.2.3", - "@budibase/frontend-core": "^2.2.3", - "@budibase/string-templates": "^2.2.3", + "@budibase/bbui": "2.2.4-alpha.0", + "@budibase/client": "2.2.4-alpha.0", + "@budibase/frontend-core": "2.2.4-alpha.0", + "@budibase/string-templates": "2.2.4-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 8a5b69f5ce..099a7becd8 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "^2.2.3", - "@budibase/string-templates": "^2.2.3", - "@budibase/types": "^2.2.3", + "@budibase/backend-core": "2.2.4-alpha.0", + "@budibase/string-templates": "2.2.4-alpha.0", + "@budibase/types": "2.2.4-alpha.0", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index d524e60c64..271be8d453 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.2.3", + "version": "2.2.4-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": "^2.2.3", - "@budibase/frontend-core": "^2.2.3", - "@budibase/string-templates": "^2.2.3", + "@budibase/bbui": "2.2.4-alpha.0", + "@budibase/frontend-core": "2.2.4-alpha.0", + "@budibase/string-templates": "2.2.4-alpha.0", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 9f623143aa..ad7ae912f2 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^2.2.3", + "@budibase/bbui": "2.2.4-alpha.0", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 31249b8a7d..08de972400 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index bce3119a2e..131aa38761 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^2.2.3", - "@budibase/client": "^2.2.3", + "@budibase/backend-core": "2.2.4-alpha.0", + "@budibase/client": "2.2.4-alpha.0", "@budibase/pro": "2.2.3", - "@budibase/string-templates": "^2.2.3", - "@budibase/types": "^2.2.3", + "@budibase/string-templates": "2.2.4-alpha.0", + "@budibase/types": "2.2.4-alpha.0", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 6d878f4df8..edbfbb2fae 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index f090f0a2af..9e08cd1341 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", @@ -16,9 +16,9 @@ "@budibase/nano": "10.1.1", "@types/json5": "2.2.0", "@types/koa": "2.13.4", - "koa-body": "4.2.0", "@types/node": "14.18.20", "@types/pouchdb": "6.4.0", + "koa-body": "4.2.0", "rimraf": "3.0.2", "typescript": "4.7.3" } diff --git a/packages/worker/package.json b/packages/worker/package.json index 62bb22ec6e..a277697fdc 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.2.3", + "version": "2.2.4-alpha.0", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^2.2.3", + "@budibase/backend-core": "2.2.4-alpha.0", "@budibase/pro": "2.2.3", - "@budibase/string-templates": "^2.2.3", - "@budibase/types": "^2.2.3", + "@budibase/string-templates": "2.2.4-alpha.0", + "@budibase/types": "2.2.4-alpha.0", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", @@ -77,9 +77,9 @@ "@types/node": "14.18.20", "@types/node-fetch": "2.6.1", "@types/pouchdb": "6.4.0", + "@types/server-destroy": "1.0.1", "@types/uuid": "8.3.4", "@typescript-eslint/parser": "5.45.0", - "@types/server-destroy": "1.0.1", "copyfiles": "2.4.1", "eslint": "6.8.0", "jest": "28.1.1", From 69252c350a7f4b9a63dc30db9513fb92a282f842 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Thu, 15 Dec 2022 12:29:53 +0000 Subject: [PATCH 09/33] Fix helm upgrade by adding quota to MINIO_ENABLED (#9054) --- charts/budibase/templates/app-service-deployment.yaml | 2 +- charts/budibase/templates/worker-service-deployment.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/charts/budibase/templates/app-service-deployment.yaml b/charts/budibase/templates/app-service-deployment.yaml index 6acc45adb7..e955992c66 100644 --- a/charts/budibase/templates/app-service-deployment.yaml +++ b/charts/budibase/templates/app-service-deployment.yaml @@ -68,7 +68,7 @@ spec: value: {{ .Values.services.objectStore.region }} {{ end }} - name: MINIO_ENABLED - value: {{ .Values.services.objectStore.minio }} + value: {{ .Values.services.objectStore.minio | quote }} - name: MINIO_ACCESS_KEY valueFrom: secretKeyRef: diff --git a/charts/budibase/templates/worker-service-deployment.yaml b/charts/budibase/templates/worker-service-deployment.yaml index 5ff9dd5f51..7168764d56 100644 --- a/charts/budibase/templates/worker-service-deployment.yaml +++ b/charts/budibase/templates/worker-service-deployment.yaml @@ -69,7 +69,7 @@ spec: value: {{ .Values.services.objectStore.region }} {{ end }} - name: MINIO_ENABLED - value: {{ .Values.services.objectStore.minio }} + value: {{ .Values.services.objectStore.minio | quote }} - name: MINIO_ACCESS_KEY valueFrom: secretKeyRef: From 704e6661ecf4dde17e67bd4766617d430e0d46fe Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 12:48:37 +0000 Subject: [PATCH 10/33] v2.2.4-alpha.1 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index d4c0cd9288..6498fb4b14 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index ddfbb1eeaa..af56950418 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -21,7 +21,7 @@ }, "dependencies": { "@budibase/nano": "10.1.1", - "@budibase/types": "2.2.4-alpha.0", + "@budibase/types": "2.2.4-alpha.1", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 663c40a211..26419d823e 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": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.2.4-alpha.0", + "@budibase/string-templates": "2.2.4-alpha.1", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 0be715d48d..ddb19b409f 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.2.4-alpha.0", - "@budibase/client": "2.2.4-alpha.0", - "@budibase/frontend-core": "2.2.4-alpha.0", - "@budibase/string-templates": "2.2.4-alpha.0", + "@budibase/bbui": "2.2.4-alpha.1", + "@budibase/client": "2.2.4-alpha.1", + "@budibase/frontend-core": "2.2.4-alpha.1", + "@budibase/string-templates": "2.2.4-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 099a7becd8..31116fd3c0 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.0", - "@budibase/string-templates": "2.2.4-alpha.0", - "@budibase/types": "2.2.4-alpha.0", + "@budibase/backend-core": "2.2.4-alpha.1", + "@budibase/string-templates": "2.2.4-alpha.1", + "@budibase/types": "2.2.4-alpha.1", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 271be8d453..b4a1413e23 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.2.4-alpha.0", + "version": "2.2.4-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": "2.2.4-alpha.0", - "@budibase/frontend-core": "2.2.4-alpha.0", - "@budibase/string-templates": "2.2.4-alpha.0", + "@budibase/bbui": "2.2.4-alpha.1", + "@budibase/frontend-core": "2.2.4-alpha.1", + "@budibase/string-templates": "2.2.4-alpha.1", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index ad7ae912f2..3b58a358e6 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.2.4-alpha.0", + "@budibase/bbui": "2.2.4-alpha.1", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 08de972400..2d59be7d01 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 131aa38761..23eb657546 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.2.4-alpha.0", - "@budibase/client": "2.2.4-alpha.0", + "@budibase/backend-core": "2.2.4-alpha.1", + "@budibase/client": "2.2.4-alpha.1", "@budibase/pro": "2.2.3", - "@budibase/string-templates": "2.2.4-alpha.0", - "@budibase/types": "2.2.4-alpha.0", + "@budibase/string-templates": "2.2.4-alpha.1", + "@budibase/types": "2.2.4-alpha.1", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index edbfbb2fae..21c7627e64 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 9e08cd1341..a89484d0bd 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index a277697fdc..3d521595fe 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.2.4-alpha.0", + "version": "2.2.4-alpha.1", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.0", + "@budibase/backend-core": "2.2.4-alpha.1", "@budibase/pro": "2.2.3", - "@budibase/string-templates": "2.2.4-alpha.0", - "@budibase/types": "2.2.4-alpha.0", + "@budibase/string-templates": "2.2.4-alpha.1", + "@budibase/types": "2.2.4-alpha.1", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From c18c8d5af4acf2712cafb04a26bdf7f1f265d850 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 12:52:49 +0000 Subject: [PATCH 11/33] Update pro version to 2.2.4-alpha.1 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 44 ++++++++++++++++++++++++------------ packages/worker/package.json | 2 +- packages/worker/yarn.lock | 44 ++++++++++++++++++++++++------------ 4 files changed, 60 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 23eb657546..f201ef614e 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -45,7 +45,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.2.4-alpha.1", "@budibase/client": "2.2.4-alpha.1", - "@budibase/pro": "2.2.3", + "@budibase/pro": "2.2.4-alpha.1", "@budibase/string-templates": "2.2.4-alpha.1", "@budibase/types": "2.2.4-alpha.1", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index d40ab069ad..2ae2b2891a 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,15 +1273,16 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.3.tgz#e2c3214bdbd6fa5cc95038816ecc40a9a0538be9" - integrity sha512-vGOWkQ8Xk6p6Lcvbtj6Z4UMoZoZlllMwmnWkwBbwr0am9bVFBF9k65Ca/vioA1egsvmM9hKCCQV6xeDcUz8qaQ== +"@budibase/backend-core@2.2.4-alpha.1": + version "2.2.4-alpha.1" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.1.tgz#ab9862662a574b0b8e6fe3fcce85c06c78c42e87" + integrity sha512-KsT1iU+tp+LOl6KNkjCTUGRWi0ePRr95MY3mbnykoHlfEYJUqRMI5Kx7VuIT0AGhzcfin/LI8u0GP+8ENHcAOA== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "^2.2.3" + "@budibase/types" "2.2.4-alpha.1" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" + aws-cloudfront-sign "2.2.0" aws-sdk "2.1030.0" bcrypt "5.0.1" bcryptjs "2.4.3" @@ -1372,16 +1373,17 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.3.tgz#2e307353597e36df74f80d8affe4ba5686f895fb" - integrity sha512-o93ara4THEzMLyNyym+BzcPfB0S8XL4ayRnwbaUnF1cqwbJbiFUv4QR9PC2mrRW7f2EuyVdG2CiCh8EGi05f/A== +"@budibase/pro@2.2.4-alpha.1": + version "2.2.4-alpha.1" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.1.tgz#d84fffa32def8afa9b8d71b3f5de82d3a1081546" + integrity sha512-OGW/eRPxslq2ipcXkbQIBo+jiHzKpVZMHpgyxUw4cpi4+Np0bdCsc6l0IFIdM8GUaNYAcYgJXagzcn2nZs5fUw== dependencies: - "@budibase/backend-core" "2.2.3" - "@budibase/types" "2.2.3" + "@budibase/backend-core" "2.2.4-alpha.1" + "@budibase/types" "2.2.4-alpha.1" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" + jsonwebtoken "8.5.1" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": @@ -1402,10 +1404,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.2.3", "@budibase/types@^2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.3.tgz#81ecc4d04cf74698bcd7ea77cee226b0dfd9d949" - integrity sha512-+LnzJvxbsUtFnSvd9uki6N7OPwmqu4R8nLXuLzDJyknHVdrLgkAduv+0AZ6WIqjgl6ADVcvk48Et40s0wotZxw== +"@budibase/types@2.2.4-alpha.1": + version "2.2.4-alpha.1" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.1.tgz#6d3d86857479ce8f63591b6989d156d7a751abe5" + integrity sha512-wY0cMCtZrBi2wivdSM29dAkLJWlEY6lEJ4MtH9GbY6o83YwXhHwi//AXTOYWyau9u4ZaNahOjmI+wEffgkv3yQ== "@bull-board/api@3.7.0": version "3.7.0" @@ -4244,6 +4246,13 @@ available-typed-arrays@^1.0.5: resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.5.tgz#92f95616501069d07d10edb2fc37d3e1c65123b7" integrity sha512-DMD0KiN46eipeziST1LPP/STfDU0sufISXmjSgvVsoU2tqxctQeASejWcfNtxYKqETM1UxQ8sp2OrSBWpHY6sw== +aws-cloudfront-sign@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" + integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== + dependencies: + lodash "^3.6.0" + aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -10224,6 +10233,11 @@ lodash@4.17.21, lodash@^4.17.11, lodash@^4.17.14, lodash@^4.17.15, lodash@^4.17. resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +lodash@^3.6.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== + logform@^2.3.2, logform@^2.4.0: version "2.4.0" resolved "https://registry.yarnpkg.com/logform/-/logform-2.4.0.tgz#131651715a17d50f09c2a2c1a524ff1a4164bcfe" diff --git a/packages/worker/package.json b/packages/worker/package.json index 3d521595fe..3cec73b784 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.2.4-alpha.1", - "@budibase/pro": "2.2.3", + "@budibase/pro": "2.2.4-alpha.1", "@budibase/string-templates": "2.2.4-alpha.1", "@budibase/types": "2.2.4-alpha.1", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 4d5602339f..06e5f04682 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,15 +470,16 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.3.tgz#e2c3214bdbd6fa5cc95038816ecc40a9a0538be9" - integrity sha512-vGOWkQ8Xk6p6Lcvbtj6Z4UMoZoZlllMwmnWkwBbwr0am9bVFBF9k65Ca/vioA1egsvmM9hKCCQV6xeDcUz8qaQ== +"@budibase/backend-core@2.2.4-alpha.1": + version "2.2.4-alpha.1" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.1.tgz#ab9862662a574b0b8e6fe3fcce85c06c78c42e87" + integrity sha512-KsT1iU+tp+LOl6KNkjCTUGRWi0ePRr95MY3mbnykoHlfEYJUqRMI5Kx7VuIT0AGhzcfin/LI8u0GP+8ENHcAOA== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "^2.2.3" + "@budibase/types" "2.2.4-alpha.1" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" + aws-cloudfront-sign "2.2.0" aws-sdk "2.1030.0" bcrypt "5.0.1" bcryptjs "2.4.3" @@ -519,22 +520,23 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.3.tgz#2e307353597e36df74f80d8affe4ba5686f895fb" - integrity sha512-o93ara4THEzMLyNyym+BzcPfB0S8XL4ayRnwbaUnF1cqwbJbiFUv4QR9PC2mrRW7f2EuyVdG2CiCh8EGi05f/A== +"@budibase/pro@2.2.4-alpha.1": + version "2.2.4-alpha.1" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.1.tgz#d84fffa32def8afa9b8d71b3f5de82d3a1081546" + integrity sha512-OGW/eRPxslq2ipcXkbQIBo+jiHzKpVZMHpgyxUw4cpi4+Np0bdCsc6l0IFIdM8GUaNYAcYgJXagzcn2nZs5fUw== dependencies: - "@budibase/backend-core" "2.2.3" - "@budibase/types" "2.2.3" + "@budibase/backend-core" "2.2.4-alpha.1" + "@budibase/types" "2.2.4-alpha.1" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" + jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.2.3", "@budibase/types@^2.2.3": - version "2.2.3" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.3.tgz#81ecc4d04cf74698bcd7ea77cee226b0dfd9d949" - integrity sha512-+LnzJvxbsUtFnSvd9uki6N7OPwmqu4R8nLXuLzDJyknHVdrLgkAduv+0AZ6WIqjgl6ADVcvk48Et40s0wotZxw== +"@budibase/types@2.2.4-alpha.1": + version "2.2.4-alpha.1" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.1.tgz#6d3d86857479ce8f63591b6989d156d7a751abe5" + integrity sha512-wY0cMCtZrBi2wivdSM29dAkLJWlEY6lEJ4MtH9GbY6o83YwXhHwi//AXTOYWyau9u4ZaNahOjmI+wEffgkv3yQ== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" @@ -1894,6 +1896,13 @@ atomic-sleep@^1.0.0: resolved "https://registry.yarnpkg.com/atomic-sleep/-/atomic-sleep-1.0.0.tgz#eb85b77a601fc932cfe432c5acd364a9e2c9075b" integrity sha512-kNOjDqAh7px0XWNI+4QbzoiR/nTkHAWNud2uvnJquD1/x5a7EQZMJT0AczqK0Qn67oY/TTQ1LbUKajZpp3I9tQ== +aws-cloudfront-sign@2.2.0: + version "2.2.0" + resolved "https://registry.yarnpkg.com/aws-cloudfront-sign/-/aws-cloudfront-sign-2.2.0.tgz#3910f5a6d0d90fec07f2b4ef8ab07f3eefb5625d" + integrity sha512-qG+rwZMP3KRTPPbVmWY8DlrT56AkA4iVOeo23vkdK2EXeW/brJFN2haSNKzVz+oYhFMEIzVVloeAcrEzuRkuVQ== + dependencies: + lodash "^3.6.0" + aws-sdk@2.1030.0: version "2.1030.0" resolved "https://registry.yarnpkg.com/aws-sdk/-/aws-sdk-2.1030.0.tgz#24a856af3d2b8b37c14a8f59974993661c66fd82" @@ -5237,6 +5246,11 @@ lodash@4.17.21, lodash@^4.17.14, lodash@^4.17.19, lodash@^4.17.21: resolved "https://registry.yarnpkg.com/lodash/-/lodash-4.17.21.tgz#679591c564c3bffaae8454cf0b3df370c3d6911c" integrity sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg== +lodash@^3.6.0: + version "3.10.1" + resolved "https://registry.yarnpkg.com/lodash/-/lodash-3.10.1.tgz#5bf45e8e49ba4189e17d482789dfd15bd140b7b6" + integrity sha512-9mDDwqVIma6OZX79ZlDACZl8sBm0TEnkf99zV3iMA4GzkIT/9hiqP5mY0HoT1iNLCrKc/R1HByV+yJfRWVJryQ== + lowercase-keys@^1.0.0, lowercase-keys@^1.0.1: version "1.0.1" resolved "https://registry.yarnpkg.com/lowercase-keys/-/lowercase-keys-1.0.1.tgz#6f9e30b47084d971a7c820ff15a6c5167b74c26f" From f5c902fb574ed7e84c88a91d079d33e10ee60dd0 Mon Sep 17 00:00:00 2001 From: melohagan <101575380+melohagan@users.noreply.github.com> Date: Thu, 15 Dec 2022 13:59:03 +0000 Subject: [PATCH 12/33] Add compact setting to AttachmentField (#9052) --- packages/bbui/src/Form/Core/Dropzone.svelte | 137 +++++++++--------- packages/client/manifest.json | 9 +- .../app/forms/AttachmentField.svelte | 4 +- 3 files changed, 81 insertions(+), 69 deletions(-) diff --git a/packages/bbui/src/Form/Core/Dropzone.svelte b/packages/bbui/src/Form/Core/Dropzone.svelte index c64e69b201..e2ef4e65ce 100644 --- a/packages/bbui/src/Form/Core/Dropzone.svelte +++ b/packages/bbui/src/Form/Core/Dropzone.svelte @@ -15,6 +15,7 @@ export let value = [] export let id = null export let disabled = false + export let compact = false export let fileSizeLimit = BYTES_IN_MB * 20 export let processFiles = null export let deleteAttachments = null @@ -239,70 +240,72 @@ bind:this={fileInput} on:change={handleFile} /> - - - - - - - - - - - - - - - -

- Drag and drop your file -

+ {#if !compact} + + + + + + + + + + + + + + + +

+ Drag and drop your file +

+ {/if} {#if !disabled}

Select a file to upload -
- from your computer + {#if !compact} +
+ from your computer + {/if}

{#if fileTags.length} diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 37b8cc5c8b..9d50c13bb6 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3440,6 +3440,12 @@ } ] }, + { + "type": "boolean", + "label": "Compact", + "key": "compact", + "defaultValue": false + }, { "type": "boolean", "label": "Disabled", @@ -3785,7 +3791,6 @@ "defaultValue": false, "info": "Row selection is only compatible with internal or SQL tables" }, - { "section": true, "name": "On Row Click", @@ -5298,4 +5303,4 @@ "suffix": "repeater" } } -} +} \ No newline at end of file diff --git a/packages/client/src/components/app/forms/AttachmentField.svelte b/packages/client/src/components/app/forms/AttachmentField.svelte index da04c57e82..e24115ebc0 100644 --- a/packages/client/src/components/app/forms/AttachmentField.svelte +++ b/packages/client/src/components/app/forms/AttachmentField.svelte @@ -6,6 +6,7 @@ export let field export let label export let disabled = false + export let compact = false export let validation export let extensions export let onChange @@ -89,6 +90,7 @@ {handleTooManyFiles} {maximum} {extensions} + {compact} /> {/if} @@ -96,6 +98,6 @@ From d0ce6c1fe215a028f48648e4accce3338dad0526 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 14:13:23 +0000 Subject: [PATCH 13/33] v2.2.4-alpha.2 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 6498fb4b14..439190499e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index af56950418..dd36746391 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -21,7 +21,7 @@ }, "dependencies": { "@budibase/nano": "10.1.1", - "@budibase/types": "2.2.4-alpha.1", + "@budibase/types": "2.2.4-alpha.2", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 26419d823e..20e727f0c6 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": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.2.4-alpha.1", + "@budibase/string-templates": "2.2.4-alpha.2", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index ddb19b409f..b1d31891c7 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.2.4-alpha.1", - "@budibase/client": "2.2.4-alpha.1", - "@budibase/frontend-core": "2.2.4-alpha.1", - "@budibase/string-templates": "2.2.4-alpha.1", + "@budibase/bbui": "2.2.4-alpha.2", + "@budibase/client": "2.2.4-alpha.2", + "@budibase/frontend-core": "2.2.4-alpha.2", + "@budibase/string-templates": "2.2.4-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 31116fd3c0..b4ec4dc6fb 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.1", - "@budibase/string-templates": "2.2.4-alpha.1", - "@budibase/types": "2.2.4-alpha.1", + "@budibase/backend-core": "2.2.4-alpha.2", + "@budibase/string-templates": "2.2.4-alpha.2", + "@budibase/types": "2.2.4-alpha.2", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index b4a1413e23..56ac723814 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.2.4-alpha.1", + "version": "2.2.4-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": "2.2.4-alpha.1", - "@budibase/frontend-core": "2.2.4-alpha.1", - "@budibase/string-templates": "2.2.4-alpha.1", + "@budibase/bbui": "2.2.4-alpha.2", + "@budibase/frontend-core": "2.2.4-alpha.2", + "@budibase/string-templates": "2.2.4-alpha.2", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index 3b58a358e6..caad86f712 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.2.4-alpha.1", + "@budibase/bbui": "2.2.4-alpha.2", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 2d59be7d01..06e58c1448 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index f201ef614e..17854dcb02 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.2.4-alpha.1", - "@budibase/client": "2.2.4-alpha.1", + "@budibase/backend-core": "2.2.4-alpha.2", + "@budibase/client": "2.2.4-alpha.2", "@budibase/pro": "2.2.4-alpha.1", - "@budibase/string-templates": "2.2.4-alpha.1", - "@budibase/types": "2.2.4-alpha.1", + "@budibase/string-templates": "2.2.4-alpha.2", + "@budibase/types": "2.2.4-alpha.2", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 21c7627e64..00875c759d 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index a89484d0bd..523df6b045 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 3cec73b784..3b1447906e 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.2.4-alpha.1", + "version": "2.2.4-alpha.2", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.1", + "@budibase/backend-core": "2.2.4-alpha.2", "@budibase/pro": "2.2.4-alpha.1", - "@budibase/string-templates": "2.2.4-alpha.1", - "@budibase/types": "2.2.4-alpha.1", + "@budibase/string-templates": "2.2.4-alpha.2", + "@budibase/types": "2.2.4-alpha.2", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 9566e832d4e231a4c8a357875965cebdae73bc7b Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 14:17:01 +0000 Subject: [PATCH 14/33] Update pro version to 2.2.4-alpha.2 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 17854dcb02..5a1a0a0d9f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -45,7 +45,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.2.4-alpha.2", "@budibase/client": "2.2.4-alpha.2", - "@budibase/pro": "2.2.4-alpha.1", + "@budibase/pro": "2.2.4-alpha.2", "@budibase/string-templates": "2.2.4-alpha.2", "@budibase/types": "2.2.4-alpha.2", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 2ae2b2891a..c04560642a 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,13 +1273,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.4-alpha.1": - version "2.2.4-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.1.tgz#ab9862662a574b0b8e6fe3fcce85c06c78c42e87" - integrity sha512-KsT1iU+tp+LOl6KNkjCTUGRWi0ePRr95MY3mbnykoHlfEYJUqRMI5Kx7VuIT0AGhzcfin/LI8u0GP+8ENHcAOA== +"@budibase/backend-core@2.2.4-alpha.2": + version "2.2.4-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.2.tgz#7942695880cd5677d91dd1fc85deb0f13769bed1" + integrity sha512-2VMZjKeojP9S0aDKeK8y/I1xY5XoIWHmioqwydppG9R0hIRk2MsxNAg6XxcPMHFEwV2AJc9TX9byDo+qXKyvlw== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "2.2.4-alpha.1" + "@budibase/types" "2.2.4-alpha.2" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1373,13 +1373,13 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.4-alpha.1": - version "2.2.4-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.1.tgz#d84fffa32def8afa9b8d71b3f5de82d3a1081546" - integrity sha512-OGW/eRPxslq2ipcXkbQIBo+jiHzKpVZMHpgyxUw4cpi4+Np0bdCsc6l0IFIdM8GUaNYAcYgJXagzcn2nZs5fUw== +"@budibase/pro@2.2.4-alpha.2": + version "2.2.4-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.2.tgz#1e1a26b9194669aed1737d1245be45b448a6e889" + integrity sha512-jqOuLIUqFyphG9K0Ovly2ipVdAMZ7yvqLo74S3KwVu74Rk5Ab7rBw4DecOdKvGbu/r0ssNdXDXv8bns/P6I2ng== dependencies: - "@budibase/backend-core" "2.2.4-alpha.1" - "@budibase/types" "2.2.4-alpha.1" + "@budibase/backend-core" "2.2.4-alpha.2" + "@budibase/types" "2.2.4-alpha.2" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1404,10 +1404,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.2.4-alpha.1": - version "2.2.4-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.1.tgz#6d3d86857479ce8f63591b6989d156d7a751abe5" - integrity sha512-wY0cMCtZrBi2wivdSM29dAkLJWlEY6lEJ4MtH9GbY6o83YwXhHwi//AXTOYWyau9u4ZaNahOjmI+wEffgkv3yQ== +"@budibase/types@2.2.4-alpha.2": + version "2.2.4-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.2.tgz#56503aee0e1294ca5b27338f229290dc4739c79a" + integrity sha512-Z8VcC/TjuBz0SoFPRD+Kj1B0w5w4lNpSXQWecsHp9ne72vG788LrMeoepBnXMw/icNof1cG/vu7J/sr4ONzQTg== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index 3b1447906e..185b90eb7e 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.2.4-alpha.2", - "@budibase/pro": "2.2.4-alpha.1", + "@budibase/pro": "2.2.4-alpha.2", "@budibase/string-templates": "2.2.4-alpha.2", "@budibase/types": "2.2.4-alpha.2", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index 06e5f04682..e3eb4f73d7 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,13 +470,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.4-alpha.1": - version "2.2.4-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.1.tgz#ab9862662a574b0b8e6fe3fcce85c06c78c42e87" - integrity sha512-KsT1iU+tp+LOl6KNkjCTUGRWi0ePRr95MY3mbnykoHlfEYJUqRMI5Kx7VuIT0AGhzcfin/LI8u0GP+8ENHcAOA== +"@budibase/backend-core@2.2.4-alpha.2": + version "2.2.4-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.2.tgz#7942695880cd5677d91dd1fc85deb0f13769bed1" + integrity sha512-2VMZjKeojP9S0aDKeK8y/I1xY5XoIWHmioqwydppG9R0hIRk2MsxNAg6XxcPMHFEwV2AJc9TX9byDo+qXKyvlw== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "2.2.4-alpha.1" + "@budibase/types" "2.2.4-alpha.2" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -520,23 +520,23 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.4-alpha.1": - version "2.2.4-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.1.tgz#d84fffa32def8afa9b8d71b3f5de82d3a1081546" - integrity sha512-OGW/eRPxslq2ipcXkbQIBo+jiHzKpVZMHpgyxUw4cpi4+Np0bdCsc6l0IFIdM8GUaNYAcYgJXagzcn2nZs5fUw== +"@budibase/pro@2.2.4-alpha.2": + version "2.2.4-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.2.tgz#1e1a26b9194669aed1737d1245be45b448a6e889" + integrity sha512-jqOuLIUqFyphG9K0Ovly2ipVdAMZ7yvqLo74S3KwVu74Rk5Ab7rBw4DecOdKvGbu/r0ssNdXDXv8bns/P6I2ng== dependencies: - "@budibase/backend-core" "2.2.4-alpha.1" - "@budibase/types" "2.2.4-alpha.1" + "@budibase/backend-core" "2.2.4-alpha.2" + "@budibase/types" "2.2.4-alpha.2" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.2.4-alpha.1": - version "2.2.4-alpha.1" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.1.tgz#6d3d86857479ce8f63591b6989d156d7a751abe5" - integrity sha512-wY0cMCtZrBi2wivdSM29dAkLJWlEY6lEJ4MtH9GbY6o83YwXhHwi//AXTOYWyau9u4ZaNahOjmI+wEffgkv3yQ== +"@budibase/types@2.2.4-alpha.2": + version "2.2.4-alpha.2" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.2.tgz#56503aee0e1294ca5b27338f229290dc4739c79a" + integrity sha512-Z8VcC/TjuBz0SoFPRD+Kj1B0w5w4lNpSXQWecsHp9ne72vG788LrMeoepBnXMw/icNof1cG/vu7J/sr4ONzQTg== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" From a1ee10c1c6ab89af1988d89fed538823e6b21e7a Mon Sep 17 00:00:00 2001 From: FlaminWrap <97764630+FlaminWrap@users.noreply.github.com> Date: Thu, 15 Dec 2022 16:21:24 +0000 Subject: [PATCH 15/33] Button action for user prompt (#8676) * Commit for enhancement #7762 Added Question option for buttons which acts as a dialog prompting the user to confirm or cancel before continuing. * Fixes * Made changes to allow custom modal title Changed Question to User Prompt Allows custom title * Revert "Made changes to allow custom modal title" This reverts commit 42a43bef4914cd52b07a2b6964bf78aa50eb2707. * Revert "Fixes" This reverts commit 915a8718e5ac6dd32a6c3d377d5edb02fc8a3138. * Adds custom title Adds custom title * Wrong version of buttonActions was commited * Delete index.js * refactor * lint Co-authored-by: Mel O'Hagan --- .../actions/PromptUser.svelte | 50 +++++++++++++++++++ .../ButtonActionEditor/actions/index.js | 1 + .../controls/ButtonActionEditor/manifest.json | 5 ++ packages/client/src/utils/buttonActions.js | 12 ++++- 4 files changed, 66 insertions(+), 2 deletions(-) create mode 100644 packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte new file mode 100644 index 0000000000..85d395e4f4 --- /dev/null +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/PromptUser.svelte @@ -0,0 +1,50 @@ + + +
+ Enter the message you wish to display to the user. +
+ + + + +
+
+ + diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js index 4a9640312d..90ce1607e4 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/actions/index.js @@ -16,5 +16,6 @@ export { default as ExportData } from "./ExportData.svelte" export { default as ContinueIf } from "./ContinueIf.svelte" export { default as UpdateFieldValue } from "./UpdateFieldValue.svelte" export { default as ShowNotification } from "./ShowNotification.svelte" +export { default as PromptUser } from "./PromptUser.svelte" export { default as OpenSidePanel } from "./OpenSidePanel.svelte" export { default as CloseSidePanel } from "./CloseSidePanel.svelte" diff --git a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json index 521ad85f0a..7497990304 100644 --- a/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json +++ b/packages/builder/src/components/design/settings/controls/ButtonActionEditor/manifest.json @@ -117,6 +117,11 @@ "component": "ShowNotification", "dependsOnFeature": "showNotificationAction" }, + { + "name": "Prompt User", + "type": "application", + "component": "PromptUser" + }, { "name": "Open Side Panel", "type": "application", diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index e471518285..06bc6f356a 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -327,6 +327,8 @@ const showNotificationHandler = action => { notificationStore.actions[type]?.(message, autoDismiss) } +const promptUserHandler = () => {} + const OpenSidePanelHandler = action => { const { id } = action.parameters if (id) { @@ -357,6 +359,7 @@ const handlerMap = { ["Export Data"]: exportDataHandler, ["Continue if / Stop if"]: continueIfHandler, ["Show Notification"]: showNotificationHandler, + ["Prompt User"]: promptUserHandler, ["Open Side Panel"]: OpenSidePanelHandler, ["Close Side Panel"]: CloseSidePanelHandler, } @@ -366,6 +369,7 @@ const confirmTextMap = { ["Save Row"]: "Are you sure you want to save this row?", ["Execute Query"]: "Are you sure you want to execute this query?", ["Trigger Automation"]: "Are you sure you want to trigger this automation?", + ["Prompt User"]: "Are you sure you want to contiune?", } /** @@ -417,8 +421,12 @@ export const enrichButtonActions = (actions, context) => { return new Promise(resolve => { const defaultText = confirmTextMap[action["##eventHandlerType"]] const confirmText = action.parameters?.confirmText || defaultText + + const defaultTitleText = action["##eventHandlerType"] + const customTitleText = + action.parameters?.customTitleText || defaultTitleText confirmationStore.actions.showConfirmation( - action["##eventHandlerType"], + customTitleText, confirmText, async () => { // When confirmed, execute this action immediately, @@ -429,7 +437,7 @@ export const enrichButtonActions = (actions, context) => { buttonContext.push(result) const newContext = { ...context, actions: buttonContext } - // Enrich and call the next button action + // Enrich and call the next button action if there is more than one action remaining const next = enrichButtonActions( actions.slice(i + 1), newContext From 03b8d7b439fd17307f76f440e024c9a1bac5dc31 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 16:38:10 +0000 Subject: [PATCH 16/33] v2.2.4-alpha.3 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index 439190499e..f61ae22758 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index dd36746391..b432264fab 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -21,7 +21,7 @@ }, "dependencies": { "@budibase/nano": "10.1.1", - "@budibase/types": "2.2.4-alpha.2", + "@budibase/types": "2.2.4-alpha.3", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 20e727f0c6..3864ba41da 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": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.2.4-alpha.2", + "@budibase/string-templates": "2.2.4-alpha.3", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index b1d31891c7..8c344a1e8f 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.2.4-alpha.2", - "@budibase/client": "2.2.4-alpha.2", - "@budibase/frontend-core": "2.2.4-alpha.2", - "@budibase/string-templates": "2.2.4-alpha.2", + "@budibase/bbui": "2.2.4-alpha.3", + "@budibase/client": "2.2.4-alpha.3", + "@budibase/frontend-core": "2.2.4-alpha.3", + "@budibase/string-templates": "2.2.4-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 b4ec4dc6fb..04ce554cd7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.2", - "@budibase/string-templates": "2.2.4-alpha.2", - "@budibase/types": "2.2.4-alpha.2", + "@budibase/backend-core": "2.2.4-alpha.3", + "@budibase/string-templates": "2.2.4-alpha.3", + "@budibase/types": "2.2.4-alpha.3", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 56ac723814..79599b1805 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.2.4-alpha.2", + "version": "2.2.4-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": "2.2.4-alpha.2", - "@budibase/frontend-core": "2.2.4-alpha.2", - "@budibase/string-templates": "2.2.4-alpha.2", + "@budibase/bbui": "2.2.4-alpha.3", + "@budibase/frontend-core": "2.2.4-alpha.3", + "@budibase/string-templates": "2.2.4-alpha.3", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index caad86f712..b07847be2b 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.2.4-alpha.2", + "@budibase/bbui": "2.2.4-alpha.3", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 06e58c1448..d42a4b0db1 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 5a1a0a0d9f..72de0d3434 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.2.4-alpha.2", - "@budibase/client": "2.2.4-alpha.2", + "@budibase/backend-core": "2.2.4-alpha.3", + "@budibase/client": "2.2.4-alpha.3", "@budibase/pro": "2.2.4-alpha.2", - "@budibase/string-templates": "2.2.4-alpha.2", - "@budibase/types": "2.2.4-alpha.2", + "@budibase/string-templates": "2.2.4-alpha.3", + "@budibase/types": "2.2.4-alpha.3", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 00875c759d..2486e1bb63 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 523df6b045..5acd23a83f 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index 185b90eb7e..bdbd96fd29 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.2.4-alpha.2", + "version": "2.2.4-alpha.3", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.2", + "@budibase/backend-core": "2.2.4-alpha.3", "@budibase/pro": "2.2.4-alpha.2", - "@budibase/string-templates": "2.2.4-alpha.2", - "@budibase/types": "2.2.4-alpha.2", + "@budibase/string-templates": "2.2.4-alpha.3", + "@budibase/types": "2.2.4-alpha.3", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From 0e8dd810346ebbc0dcd5f4423cbf5a7fdeecf4eb Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Thu, 15 Dec 2022 16:42:29 +0000 Subject: [PATCH 17/33] Update pro version to 2.2.4-alpha.3 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 72de0d3434..4067c96490 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -45,7 +45,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.2.4-alpha.3", "@budibase/client": "2.2.4-alpha.3", - "@budibase/pro": "2.2.4-alpha.2", + "@budibase/pro": "2.2.4-alpha.3", "@budibase/string-templates": "2.2.4-alpha.3", "@budibase/types": "2.2.4-alpha.3", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index c04560642a..94cdc996c8 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,13 +1273,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.4-alpha.2": - version "2.2.4-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.2.tgz#7942695880cd5677d91dd1fc85deb0f13769bed1" - integrity sha512-2VMZjKeojP9S0aDKeK8y/I1xY5XoIWHmioqwydppG9R0hIRk2MsxNAg6XxcPMHFEwV2AJc9TX9byDo+qXKyvlw== +"@budibase/backend-core@2.2.4-alpha.3": + version "2.2.4-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.3.tgz#9651f883f94a8ad2f16078851a8d564ef05a2d0a" + integrity sha512-aJ5qLauH4wk6zFVjlpuy7+qpOgCDH+K5IaGQBMFBTswV/cZGmX5j6VkZin57CTZ/6RfaujvifAcDy90UDl8PRA== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "2.2.4-alpha.2" + "@budibase/types" "2.2.4-alpha.3" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1373,13 +1373,13 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.4-alpha.2": - version "2.2.4-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.2.tgz#1e1a26b9194669aed1737d1245be45b448a6e889" - integrity sha512-jqOuLIUqFyphG9K0Ovly2ipVdAMZ7yvqLo74S3KwVu74Rk5Ab7rBw4DecOdKvGbu/r0ssNdXDXv8bns/P6I2ng== +"@budibase/pro@2.2.4-alpha.3": + version "2.2.4-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.3.tgz#e872bc5db00716b3a3f180d2588c0cea5e3fb550" + integrity sha512-qHGgYdK1ny7gt73Qn3heAzadp3jqNQsJHuk9HEkmTIp5frvreya7J7FcA1thi6w2isUMxydk0bKegalDyT3fnA== dependencies: - "@budibase/backend-core" "2.2.4-alpha.2" - "@budibase/types" "2.2.4-alpha.2" + "@budibase/backend-core" "2.2.4-alpha.3" + "@budibase/types" "2.2.4-alpha.3" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1404,10 +1404,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.2.4-alpha.2": - version "2.2.4-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.2.tgz#56503aee0e1294ca5b27338f229290dc4739c79a" - integrity sha512-Z8VcC/TjuBz0SoFPRD+Kj1B0w5w4lNpSXQWecsHp9ne72vG788LrMeoepBnXMw/icNof1cG/vu7J/sr4ONzQTg== +"@budibase/types@2.2.4-alpha.3": + version "2.2.4-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.3.tgz#23009c111ecc46aa99b29f97176c68c39bce5180" + integrity sha512-w0UxNeea1wV3DChKHNckxkAYfnirKXyWJLyLCyq1U4z5p2XADmHKmL7LTdFCWZPJzbH+JmtXgNYm7+Nt9h6ogw== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index bdbd96fd29..f5ec959871 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.2.4-alpha.3", - "@budibase/pro": "2.2.4-alpha.2", + "@budibase/pro": "2.2.4-alpha.3", "@budibase/string-templates": "2.2.4-alpha.3", "@budibase/types": "2.2.4-alpha.3", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index e3eb4f73d7..a5c6e6c627 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,13 +470,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.4-alpha.2": - version "2.2.4-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.2.tgz#7942695880cd5677d91dd1fc85deb0f13769bed1" - integrity sha512-2VMZjKeojP9S0aDKeK8y/I1xY5XoIWHmioqwydppG9R0hIRk2MsxNAg6XxcPMHFEwV2AJc9TX9byDo+qXKyvlw== +"@budibase/backend-core@2.2.4-alpha.3": + version "2.2.4-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.3.tgz#9651f883f94a8ad2f16078851a8d564ef05a2d0a" + integrity sha512-aJ5qLauH4wk6zFVjlpuy7+qpOgCDH+K5IaGQBMFBTswV/cZGmX5j6VkZin57CTZ/6RfaujvifAcDy90UDl8PRA== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "2.2.4-alpha.2" + "@budibase/types" "2.2.4-alpha.3" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -520,23 +520,23 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.4-alpha.2": - version "2.2.4-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.2.tgz#1e1a26b9194669aed1737d1245be45b448a6e889" - integrity sha512-jqOuLIUqFyphG9K0Ovly2ipVdAMZ7yvqLo74S3KwVu74Rk5Ab7rBw4DecOdKvGbu/r0ssNdXDXv8bns/P6I2ng== +"@budibase/pro@2.2.4-alpha.3": + version "2.2.4-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.3.tgz#e872bc5db00716b3a3f180d2588c0cea5e3fb550" + integrity sha512-qHGgYdK1ny7gt73Qn3heAzadp3jqNQsJHuk9HEkmTIp5frvreya7J7FcA1thi6w2isUMxydk0bKegalDyT3fnA== dependencies: - "@budibase/backend-core" "2.2.4-alpha.2" - "@budibase/types" "2.2.4-alpha.2" + "@budibase/backend-core" "2.2.4-alpha.3" + "@budibase/types" "2.2.4-alpha.3" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.2.4-alpha.2": - version "2.2.4-alpha.2" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.2.tgz#56503aee0e1294ca5b27338f229290dc4739c79a" - integrity sha512-Z8VcC/TjuBz0SoFPRD+Kj1B0w5w4lNpSXQWecsHp9ne72vG788LrMeoepBnXMw/icNof1cG/vu7J/sr4ONzQTg== +"@budibase/types@2.2.4-alpha.3": + version "2.2.4-alpha.3" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.3.tgz#23009c111ecc46aa99b29f97176c68c39bce5180" + integrity sha512-w0UxNeea1wV3DChKHNckxkAYfnirKXyWJLyLCyq1U4z5p2XADmHKmL7LTdFCWZPJzbH+JmtXgNYm7+Nt9h6ogw== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" From f4a39080dee3176d91f3f26a0e4b55b4b13a04e3 Mon Sep 17 00:00:00 2001 From: Rory Powell Date: Fri, 16 Dec 2022 11:14:31 +0000 Subject: [PATCH 18/33] Minio and local licensing fixes (#9071) --- packages/backend-core/src/objectStore/objectStore.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/src/objectStore/objectStore.ts b/packages/backend-core/src/objectStore/objectStore.ts index 89e1c88e10..1cc8ad3add 100644 --- a/packages/backend-core/src/objectStore/objectStore.ts +++ b/packages/backend-core/src/objectStore/objectStore.ts @@ -86,7 +86,7 @@ export const ObjectStore = ( // custom S3 is in use i.e. minio if (env.MINIO_URL) { - if (opts.presigning && !env.MINIO_ENABLED) { + if (opts.presigning && env.MINIO_ENABLED) { // IMPORTANT: Signed urls will inspect the host header of the request. // Normally a signed url will need to be generated with a specified host in mind. // To support dynamic hosts, e.g. some unknown self-hosted installation url, From 4760a76978fd017651000c7254ff06ab0a9c0663 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 16 Dec 2022 11:33:20 +0000 Subject: [PATCH 19/33] v2.2.4-alpha.4 --- lerna.json | 2 +- packages/backend-core/package.json | 4 ++-- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 8 ++++---- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/sdk/package.json | 2 +- packages/server/package.json | 10 +++++----- packages/string-templates/package.json | 2 +- packages/types/package.json | 2 +- packages/worker/package.json | 8 ++++---- 12 files changed, 32 insertions(+), 32 deletions(-) diff --git a/lerna.json b/lerna.json index f61ae22758..6073b88ae5 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index b432264fab..1f4af2ad63 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase backend core libraries used in server and worker", "main": "dist/src/index.js", "types": "dist/src/index.d.ts", @@ -21,7 +21,7 @@ }, "dependencies": { "@budibase/nano": "10.1.1", - "@budibase/types": "2.2.4-alpha.3", + "@budibase/types": "2.2.4-alpha.4", "@shopify/jest-koa-mocks": "5.0.1", "@techpass/passport-openidconnect": "0.3.2", "aws-cloudfront-sign": "2.2.0", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 3864ba41da..1243cc5b4b 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": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "license": "MPL-2.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", @@ -38,7 +38,7 @@ ], "dependencies": { "@adobe/spectrum-css-workflow-icons": "1.2.1", - "@budibase/string-templates": "2.2.4-alpha.3", + "@budibase/string-templates": "2.2.4-alpha.4", "@spectrum-css/actionbutton": "1.0.1", "@spectrum-css/actiongroup": "1.0.1", "@spectrum-css/avatar": "3.0.2", diff --git a/packages/builder/package.json b/packages/builder/package.json index 8c344a1e8f..4926ce4107 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "2.2.4-alpha.3", - "@budibase/client": "2.2.4-alpha.3", - "@budibase/frontend-core": "2.2.4-alpha.3", - "@budibase/string-templates": "2.2.4-alpha.3", + "@budibase/bbui": "2.2.4-alpha.4", + "@budibase/client": "2.2.4-alpha.4", + "@budibase/frontend-core": "2.2.4-alpha.4", + "@budibase/string-templates": "2.2.4-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 04ce554cd7..2a8ab02ced 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { @@ -26,9 +26,9 @@ "outputPath": "build" }, "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.3", - "@budibase/string-templates": "2.2.4-alpha.3", - "@budibase/types": "2.2.4-alpha.3", + "@budibase/backend-core": "2.2.4-alpha.4", + "@budibase/string-templates": "2.2.4-alpha.4", + "@budibase/types": "2.2.4-alpha.4", "axios": "0.21.2", "chalk": "4.1.0", "cli-progress": "3.11.2", diff --git a/packages/client/package.json b/packages/client/package.json index 79599b1805..b1bc035062 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.2.4-alpha.3", + "version": "2.2.4-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": "2.2.4-alpha.3", - "@budibase/frontend-core": "2.2.4-alpha.3", - "@budibase/string-templates": "2.2.4-alpha.3", + "@budibase/bbui": "2.2.4-alpha.4", + "@budibase/frontend-core": "2.2.4-alpha.4", + "@budibase/string-templates": "2.2.4-alpha.4", "@spectrum-css/button": "^3.0.3", "@spectrum-css/card": "^3.0.3", "@spectrum-css/divider": "^1.0.3", diff --git a/packages/frontend-core/package.json b/packages/frontend-core/package.json index b07847be2b..df0bd1df5f 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "2.2.4-alpha.3", + "@budibase/bbui": "2.2.4-alpha.4", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index d42a4b0db1..c9d2887d80 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index 4067c96490..37850606e4 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -43,11 +43,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "2.2.4-alpha.3", - "@budibase/client": "2.2.4-alpha.3", + "@budibase/backend-core": "2.2.4-alpha.4", + "@budibase/client": "2.2.4-alpha.4", "@budibase/pro": "2.2.4-alpha.3", - "@budibase/string-templates": "2.2.4-alpha.3", - "@budibase/types": "2.2.4-alpha.3", + "@budibase/string-templates": "2.2.4-alpha.4", + "@budibase/types": "2.2.4-alpha.4", "@bull-board/api": "3.7.0", "@bull-board/koa": "3.9.4", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 2486e1bb63..e31c2f0f84 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/types/package.json b/packages/types/package.json index 5acd23a83f..8fd504a244 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase types", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/worker/package.json b/packages/worker/package.json index f5ec959871..bc3f509286 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.2.4-alpha.3", + "version": "2.2.4-alpha.4", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "2.2.4-alpha.3", + "@budibase/backend-core": "2.2.4-alpha.4", "@budibase/pro": "2.2.4-alpha.3", - "@budibase/string-templates": "2.2.4-alpha.3", - "@budibase/types": "2.2.4-alpha.3", + "@budibase/string-templates": "2.2.4-alpha.4", + "@budibase/types": "2.2.4-alpha.4", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From cf0bc606e43569084f1b383d0182d87ea88fdfd3 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Fri, 16 Dec 2022 11:37:35 +0000 Subject: [PATCH 20/33] Update pro version to 2.2.4-alpha.4 --- packages/server/package.json | 2 +- packages/server/yarn.lock | 30 +++++++++++++++--------------- packages/worker/package.json | 2 +- packages/worker/yarn.lock | 30 +++++++++++++++--------------- 4 files changed, 32 insertions(+), 32 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 37850606e4..d2e5770612 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -45,7 +45,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "2.2.4-alpha.4", "@budibase/client": "2.2.4-alpha.4", - "@budibase/pro": "2.2.4-alpha.3", + "@budibase/pro": "2.2.4-alpha.4", "@budibase/string-templates": "2.2.4-alpha.4", "@budibase/types": "2.2.4-alpha.4", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index 94cdc996c8..87977b6157 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1273,13 +1273,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.4-alpha.3": - version "2.2.4-alpha.3" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.3.tgz#9651f883f94a8ad2f16078851a8d564ef05a2d0a" - integrity sha512-aJ5qLauH4wk6zFVjlpuy7+qpOgCDH+K5IaGQBMFBTswV/cZGmX5j6VkZin57CTZ/6RfaujvifAcDy90UDl8PRA== +"@budibase/backend-core@2.2.4-alpha.4": + version "2.2.4-alpha.4" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.4.tgz#c0b858936131ef4631c6baa2282482e089e6e9bf" + integrity sha512-CAK7cy6VSIAcQHpvD+yX4BHSglJ0pYEHIWfGjXVAk8iI0BDQg76NWhHNkuqko2bUhKxcGLe7J9hF5zWvY+J+/w== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "2.2.4-alpha.3" + "@budibase/types" "2.2.4-alpha.4" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -1373,13 +1373,13 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.4-alpha.3": - version "2.2.4-alpha.3" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.3.tgz#e872bc5db00716b3a3f180d2588c0cea5e3fb550" - integrity sha512-qHGgYdK1ny7gt73Qn3heAzadp3jqNQsJHuk9HEkmTIp5frvreya7J7FcA1thi6w2isUMxydk0bKegalDyT3fnA== +"@budibase/pro@2.2.4-alpha.4": + version "2.2.4-alpha.4" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.4.tgz#e8eb302a227cd3ef24830ae4ccca32790221af09" + integrity sha512-484bPOjmo617tyd4L1qZfiBIN5IMZH7+J4f6QrUGtHYy1JfEf0W0A0ZIbLoC/U7a/6D/FhVPRLQU8aWYnr+BIw== dependencies: - "@budibase/backend-core" "2.2.4-alpha.3" - "@budibase/types" "2.2.4-alpha.3" + "@budibase/backend-core" "2.2.4-alpha.4" + "@budibase/types" "2.2.4-alpha.4" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" @@ -1404,10 +1404,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.2.4-alpha.3": - version "2.2.4-alpha.3" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.3.tgz#23009c111ecc46aa99b29f97176c68c39bce5180" - integrity sha512-w0UxNeea1wV3DChKHNckxkAYfnirKXyWJLyLCyq1U4z5p2XADmHKmL7LTdFCWZPJzbH+JmtXgNYm7+Nt9h6ogw== +"@budibase/types@2.2.4-alpha.4": + version "2.2.4-alpha.4" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.4.tgz#6f4ad1967546459efb49f8169e5d68147b90effc" + integrity sha512-VAPp8+FuM6lG2wUwVq9e7MvRnW/OBuNFDuB8vK2jUKxOMNu+C195DSQUBzVZGBgF/6R5pxnoLMfC0oJgftH7ww== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index bc3f509286..ac4c2bc403 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "2.2.4-alpha.4", - "@budibase/pro": "2.2.4-alpha.3", + "@budibase/pro": "2.2.4-alpha.4", "@budibase/string-templates": "2.2.4-alpha.4", "@budibase/types": "2.2.4-alpha.4", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index a5c6e6c627..aa2843fd03 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -470,13 +470,13 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.2.4-alpha.3": - version "2.2.4-alpha.3" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.3.tgz#9651f883f94a8ad2f16078851a8d564ef05a2d0a" - integrity sha512-aJ5qLauH4wk6zFVjlpuy7+qpOgCDH+K5IaGQBMFBTswV/cZGmX5j6VkZin57CTZ/6RfaujvifAcDy90UDl8PRA== +"@budibase/backend-core@2.2.4-alpha.4": + version "2.2.4-alpha.4" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.2.4-alpha.4.tgz#c0b858936131ef4631c6baa2282482e089e6e9bf" + integrity sha512-CAK7cy6VSIAcQHpvD+yX4BHSglJ0pYEHIWfGjXVAk8iI0BDQg76NWhHNkuqko2bUhKxcGLe7J9hF5zWvY+J+/w== dependencies: "@budibase/nano" "10.1.1" - "@budibase/types" "2.2.4-alpha.3" + "@budibase/types" "2.2.4-alpha.4" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-cloudfront-sign "2.2.0" @@ -520,23 +520,23 @@ qs "^6.11.0" tough-cookie "^4.1.2" -"@budibase/pro@2.2.4-alpha.3": - version "2.2.4-alpha.3" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.3.tgz#e872bc5db00716b3a3f180d2588c0cea5e3fb550" - integrity sha512-qHGgYdK1ny7gt73Qn3heAzadp3jqNQsJHuk9HEkmTIp5frvreya7J7FcA1thi6w2isUMxydk0bKegalDyT3fnA== +"@budibase/pro@2.2.4-alpha.4": + version "2.2.4-alpha.4" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.2.4-alpha.4.tgz#e8eb302a227cd3ef24830ae4ccca32790221af09" + integrity sha512-484bPOjmo617tyd4L1qZfiBIN5IMZH7+J4f6QrUGtHYy1JfEf0W0A0ZIbLoC/U7a/6D/FhVPRLQU8aWYnr+BIw== dependencies: - "@budibase/backend-core" "2.2.4-alpha.3" - "@budibase/types" "2.2.4-alpha.3" + "@budibase/backend-core" "2.2.4-alpha.4" + "@budibase/types" "2.2.4-alpha.4" "@koa/router" "8.0.8" bull "4.10.1" joi "17.6.0" jsonwebtoken "8.5.1" node-fetch "^2.6.1" -"@budibase/types@2.2.4-alpha.3": - version "2.2.4-alpha.3" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.3.tgz#23009c111ecc46aa99b29f97176c68c39bce5180" - integrity sha512-w0UxNeea1wV3DChKHNckxkAYfnirKXyWJLyLCyq1U4z5p2XADmHKmL7LTdFCWZPJzbH+JmtXgNYm7+Nt9h6ogw== +"@budibase/types@2.2.4-alpha.4": + version "2.2.4-alpha.4" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.2.4-alpha.4.tgz#6f4ad1967546459efb49f8169e5d68147b90effc" + integrity sha512-VAPp8+FuM6lG2wUwVq9e7MvRnW/OBuNFDuB8vK2jUKxOMNu+C195DSQUBzVZGBgF/6R5pxnoLMfC0oJgftH7ww== "@cspotcode/source-map-support@^0.8.0": version "0.8.1" From 3b1819952d9eea37634902d05a9055af8e13087f Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Sat, 17 Dec 2022 14:13:06 +0000 Subject: [PATCH 21/33] Builder data section routing refactor (#8996) * Improve theming with spectrum badges and dedupe spectrum label usage * Update data section nav to match designs and use panel component * Fix main content layout in data section * Update data section routing for tables * Improve data section routing for tables to account for edge cases * Update internal and sample datasource routing * Update external datasource routing * Update routing for queries and make a top level concept like everything else * Update routing for views * Fix undefined reference when deleting datasource * Reduce network calls and fix issues with stale datasourcenavigator state * Update routing for REST queries and unify routes for normal queries and REST queries * Lint * Fix links for queries from datasource details page * Remove redundant API calls and improve table deletion logic * Improve data entity deletion logic and redirection and fix query details keying * Improve determination of selected item in datasource tree * Lint * Fix BBUI import * Fix datasource navigator selected state not working for internal DB or sample data --- packages/bbui/src/Badge/Badge.svelte | 13 + .../src/Table/RelationshipRenderer.svelte | 11 +- .../components/backend/DataTable/Table.svelte | 1 - .../DataTable/modals/CreateViewModal.svelte | 4 +- .../DatasourceNavigator.svelte | 132 ++++++---- .../popovers/EditDatasourcePopover.svelte | 19 +- .../popovers/EditQueryPopover.svelte | 16 +- .../TableNavigator/TableNavigator.svelte | 33 +-- .../popovers/EditTablePopover.svelte | 9 +- .../popovers/EditViewPopover.svelte | 7 +- .../src/components/design/Panel.svelte | 2 + .../integration}/DynamicVariableModal.svelte | 0 .../components/integration/QueryViewer.svelte | 245 +++++++++--------- .../integration}/RestBodyInput.svelte | 0 .../integration/RestQueryViewer.svelte} | 37 ++- packages/builder/src/helpers/urlStateSync.js | 19 +- .../app/[application]/data/_layout.svelte | 69 ++--- .../datasource/[datasourceId]/_layout.svelte | 23 ++ .../index.svelte | 52 ++-- .../[query]/_layout.svelte | 23 -- .../[selectedDatasource]/[query]/index.svelte | 39 --- .../[selectedDatasource]/_layout.svelte | 17 -- .../rest/[query]/_layout.svelte | 13 - .../datasource/bb_internal/_layout.svelte | 7 - .../data/datasource/bb_internal/index.svelte | 10 +- .../_layout.svelte | 8 - .../index.svelte | 19 +- .../data/datasource/index.svelte | 10 +- .../data/query/[queryId]/_layout.svelte | 22 ++ .../data/query/[queryId]/index.svelte | 18 ++ .../app/[application]/data/query/index.svelte | 16 ++ .../query/new/[datasourceId]/index.svelte | 38 +++ .../[application]/data/query/new/index.svelte | 5 + .../data/table/[selectedTable]/_layout.svelte | 13 - .../data/table/[tableId]/_layout.svelte | 20 ++ .../index.svelte | 6 +- .../[rowId]/[field]}/index.svelte | 6 +- .../relationship/[rowId]}/index.svelte | 0 .../relationship/index.svelte | 0 .../[application]/data/table/_layout.svelte | 19 -- .../app/[application]/data/table/index.svelte | 11 +- .../data/view/[selectedView]/_layout.svelte | 22 -- .../data/view/[viewName]/_layout.svelte | 20 ++ .../index.svelte | 0 .../app/[application]/data/view/index.svelte | 16 ++ .../builder/src/stores/backend/datasources.js | 160 ++++++------ .../builder/src/stores/backend/queries.js | 226 ++++++++-------- packages/builder/src/stores/backend/tables.js | 196 +++++++------- packages/builder/src/stores/backend/views.js | 88 ++++--- 49 files changed, 894 insertions(+), 846 deletions(-) rename packages/builder/src/{pages/builder/app/[application]/data/datasource/[selectedDatasource]/_components => components/integration}/DynamicVariableModal.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/data/datasource/[selectedDatasource]/_components => components/integration}/RestBodyInput.svelte (100%) rename packages/builder/src/{pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/index.svelte => components/integration/RestQueryViewer.svelte} (98%) create mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_layout.svelte rename packages/builder/src/pages/builder/app/[application]/data/datasource/{[selectedDatasource] => [datasourceId]}/index.svelte (87%) delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/[query]/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/[query]/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/[selectedDatasource]/rest/[query]/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/bb_internal/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/datasource/datasource_internal_bb_default/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/query/[queryId]/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/query/[queryId]/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/query/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/query/new/[datasourceId]/index.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/query/new/index.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/table/[selectedTable]/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/table/[tableId]/_layout.svelte rename packages/builder/src/pages/builder/app/[application]/data/table/{[selectedTable] => [tableId]}/index.svelte (71%) rename packages/builder/src/pages/builder/app/[application]/data/table/{[selectedTable]/relationship/[selectedRow]/[selectedField] => [tableId]/relationship/[rowId]/[field]}/index.svelte (62%) rename packages/builder/src/pages/builder/app/[application]/data/table/{[selectedTable]/relationship/[selectedRow] => [tableId]/relationship/[rowId]}/index.svelte (100%) rename packages/builder/src/pages/builder/app/[application]/data/table/{[selectedTable] => [tableId]}/relationship/index.svelte (100%) delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/table/_layout.svelte delete mode 100644 packages/builder/src/pages/builder/app/[application]/data/view/[selectedView]/_layout.svelte create mode 100644 packages/builder/src/pages/builder/app/[application]/data/view/[viewName]/_layout.svelte rename packages/builder/src/pages/builder/app/[application]/data/view/{[selectedView] => [viewName]}/index.svelte (100%) create mode 100644 packages/builder/src/pages/builder/app/[application]/data/view/index.svelte diff --git a/packages/bbui/src/Badge/Badge.svelte b/packages/bbui/src/Badge/Badge.svelte index 4bc701d983..8b54045297 100644 --- a/packages/bbui/src/Badge/Badge.svelte +++ b/packages/bbui/src/Badge/Badge.svelte @@ -10,10 +10,13 @@ export let green = false export let active = false export let inactive = false + export let hoverable = false + + diff --git a/packages/bbui/src/Table/RelationshipRenderer.svelte b/packages/bbui/src/Table/RelationshipRenderer.svelte index 4db0c63d95..b70eaeb07d 100644 --- a/packages/bbui/src/Table/RelationshipRenderer.svelte +++ b/packages/bbui/src/Table/RelationshipRenderer.svelte @@ -1,6 +1,7 @@ {#if $database?._id} @@ -44,8 +23,9 @@ border={idx > 0} icon={table._id === TableNames.USERS ? "UserGroup" : "Table"} text={table.name} - selected={$tables.selected?._id === table._id} - on:click={() => selectTable(table)} + selected={$isActive("./table/:tableId") && + $tables.selected?._id === table._id} + on:click={() => $goto(`./table/${table._id}`)} > {#if table._id !== TableNames.USERS} @@ -56,8 +36,9 @@ indentLevel={2} icon="Remove" text={viewName} - selected={selectedView === viewName} - on:click={() => onClickView(table, viewName)} + selected={$isActive("./view/:viewName") && + $views.selected?.name === viewName} + on:click={() => $goto(`./view/${viewName}`)} > - import { goto } from "@roxi/routify" + import { goto, params } from "@roxi/routify" import { store } from "builderStore" import { cloneDeep } from "lodash/fp" import { tables, datasources } from "stores/backend" @@ -41,17 +41,16 @@ } async function deleteTable() { - const wasSelectedTable = $tables.selected + const isSelected = $params.tableId === table._id try { await tables.delete(table) await store.actions.screens.delete(templateScreens) - await tables.fetch() if (table.type === "external") { await datasources.fetch() } notifications.success("Table deleted") - if (wasSelectedTable && wasSelectedTable._id === table._id) { - $goto("./table") + if (isSelected) { + $goto(`./datasource/${table.datasourceId}`) } } catch (error) { notifications.error("Error deleting table") diff --git a/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte b/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte index f543b34ddc..44eb1e9b7b 100644 --- a/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte +++ b/packages/builder/src/components/backend/TableNavigator/popovers/EditViewPopover.svelte @@ -1,5 +1,5 @@ - - Query {integrationInfo?.friendlyName} - - Config -
-
- - -
- {#if queryConfig} -
- -
- Add a JavaScript function to transform the query result. - (query.transformer = e.detail)} - /> - -
-
- Results - - - - -
- - Below, you can preview the results from your query and change the schema. - -
- {#if data} - - - - - - - - - - - + {#if queryConfig} +
+ +