From d41de1ca6ab562e76b2d6e40af94900cfaa63148 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Thu, 12 May 2022 19:46:13 +0100 Subject: [PATCH 01/27] webhook URL paste, hiding no access role --- .../src/components/automation/Shared/WebhookDisplay.svelte | 2 +- .../builder/src/components/common/inputs/CopyInput.svelte | 3 +-- .../manage/users/_components/UpdateRolesModal.svelte | 7 ++++++- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte b/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte index dcd96ce2b9..9ba4140b51 100644 --- a/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte +++ b/packages/builder/src/components/automation/Shared/WebhookDisplay.svelte @@ -12,4 +12,4 @@ } - + diff --git a/packages/builder/src/components/common/inputs/CopyInput.svelte b/packages/builder/src/components/common/inputs/CopyInput.svelte index 102fd5682a..589623f542 100644 --- a/packages/builder/src/components/common/inputs/CopyInput.svelte +++ b/packages/builder/src/components/common/inputs/CopyInput.svelte @@ -3,7 +3,6 @@ export let label = null export let value - export let copyValue export let dataCy = null const copyToClipboard = val => { @@ -19,7 +18,7 @@
-
copyToClipboard(value || copyValue)}> +
copyToClipboard(value)}>
diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte index 5a60bfdff8..8fb372cca7 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte @@ -6,6 +6,8 @@ export let app export let user + let devAccess = user?.admin?.global || user?.builder?.global + const NO_ACCESS = "NO_ACCESS" const dispatch = createEventDispatcher() @@ -14,7 +16,10 @@ let options = roles .filter(role => role._id !== "PUBLIC") .map(role => ({ value: role._id, label: role.name })) - options.push({ value: NO_ACCESS, label: "No Access" }) + + if (!devAccess) { + options.push({ value: NO_ACCESS, label: "No Access" }) + } let selectedRole = user?.roles?.[app?._id] async function updateUserRoles() { From f211981da7a9c4909a2aad6a958c4bd645fb4b71 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 May 2022 09:10:56 +0000 Subject: [PATCH 02/27] v1.0.159 --- lerna.json | 2 +- packages/backend-core/package.json | 2 +- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lerna.json b/lerna.json index c5e9eb390f..bf94ca06fb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.158", + "version": "1.0.159", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 080b414134..88a1399acc 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.158", + "version": "1.0.159", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 919c21bb17..7702ad707f 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": "1.0.158", + "version": "1.0.159", "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": "^1.0.158", + "@budibase/string-templates": "^1.0.159", "@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 58313c40e8..b8aff9dce7 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.158", + "version": "1.0.159", "license": "GPL-3.0", "private": true, "scripts": { @@ -67,10 +67,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.158", - "@budibase/client": "^1.0.158", - "@budibase/frontend-core": "^1.0.158", - "@budibase/string-templates": "^1.0.158", + "@budibase/bbui": "^1.0.159", + "@budibase/client": "^1.0.159", + "@budibase/frontend-core": "^1.0.159", + "@budibase/string-templates": "^1.0.159", "@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 cf0389b616..46d3895424 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.158", + "version": "1.0.159", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 0b8030a836..867d1081b5 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.158", + "version": "1.0.159", "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": "^1.0.158", - "@budibase/frontend-core": "^1.0.158", - "@budibase/string-templates": "^1.0.158", + "@budibase/bbui": "^1.0.159", + "@budibase/frontend-core": "^1.0.159", + "@budibase/string-templates": "^1.0.159", "@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 cebb297d7f..7d27988c3d 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.158", + "version": "1.0.159", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.158", + "@budibase/bbui": "^1.0.159", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 246402ee2e..baadb67844 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.158", + "version": "1.0.159", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -69,10 +69,10 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.158", - "@budibase/client": "^1.0.158", + "@budibase/backend-core": "^1.0.159", + "@budibase/client": "^1.0.159", "@budibase/pro": "1.0.158", - "@budibase/string-templates": "^1.0.158", + "@budibase/string-templates": "^1.0.159", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index e361af4947..926d542ccf 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.158", + "version": "1.0.159", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index a0248e4910..6c6294633c 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.158", + "version": "1.0.159", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -31,9 +31,9 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.158", + "@budibase/backend-core": "^1.0.159", "@budibase/pro": "1.0.158", - "@budibase/string-templates": "^1.0.158", + "@budibase/string-templates": "^1.0.159", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "^0.3.0", From a81744cf2ab6d555518995d95564da34b5cc0f37 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 May 2022 09:12:17 +0000 Subject: [PATCH 03/27] Update pro version to 1.0.159 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index baadb67844..53c8337001 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -71,7 +71,7 @@ "@apidevtools/swagger-parser": "^10.0.3", "@budibase/backend-core": "^1.0.159", "@budibase/client": "^1.0.159", - "@budibase/pro": "1.0.158", + "@budibase/pro": "1.0.159", "@budibase/string-templates": "^1.0.159", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 6c6294633c..404c7658a2 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -32,7 +32,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.0.159", - "@budibase/pro": "1.0.158", + "@budibase/pro": "1.0.159", "@budibase/string-templates": "^1.0.159", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", From 049bb5bd9c81e4b13a5804515daf19fa788fbeda Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 13 May 2022 23:44:56 +1200 Subject: [PATCH 04/27] Addresses #5731 - offset the UTC offset in ISO strings to allow date only columns in external DBs to save the correct date when in a timezone differing from UTC. --- packages/bbui/src/Form/Core/DatePicker.svelte | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/packages/bbui/src/Form/Core/DatePicker.svelte b/packages/bbui/src/Form/Core/DatePicker.svelte index fd67fa41bb..04e54d9a16 100644 --- a/packages/bbui/src/Form/Core/DatePicker.svelte +++ b/packages/bbui/src/Form/Core/DatePicker.svelte @@ -58,6 +58,11 @@ if (timeOnly) { newValue = `2000-01-01T${newValue.split("T")[1]}` } + // date only, offset for timezone so always right date + else if (!enableTime) { + const offset = dates[0].getTimezoneOffset() * 60000 + newValue = new Date(dates[0].getTime() - offset).toISOString() + } dispatch("change", newValue) } From e6586e64a36842d3f1a2f138d1f19f1dd369525c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Fri, 13 May 2022 14:36:11 +0100 Subject: [PATCH 05/27] only lock no_access for builder users --- .../portal/manage/users/_components/UpdateRolesModal.svelte | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte b/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte index 8fb372cca7..a9399fcca7 100644 --- a/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte +++ b/packages/builder/src/pages/builder/portal/manage/users/_components/UpdateRolesModal.svelte @@ -6,8 +6,6 @@ export let app export let user - let devAccess = user?.admin?.global || user?.builder?.global - const NO_ACCESS = "NO_ACCESS" const dispatch = createEventDispatcher() @@ -17,7 +15,7 @@ .filter(role => role._id !== "PUBLIC") .map(role => ({ value: role._id, label: role.name })) - if (!devAccess) { + if (!user?.builder?.global) { options.push({ value: NO_ACCESS, label: "No Access" }) } let selectedRole = user?.roles?.[app?._id] From c6120f509d9aebe658ad4e704572d83507c92929 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 May 2022 13:48:11 +0000 Subject: [PATCH 06/27] v1.0.160 --- lerna.json | 2 +- packages/backend-core/package.json | 2 +- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lerna.json b/lerna.json index bf94ca06fb..f175c9b642 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.159", + "version": "1.0.160", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 88a1399acc..eff00f5c7d 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.159", + "version": "1.0.160", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 7702ad707f..bd3ad97946 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": "1.0.159", + "version": "1.0.160", "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": "^1.0.159", + "@budibase/string-templates": "^1.0.160", "@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 b8aff9dce7..79fc77914d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.159", + "version": "1.0.160", "license": "GPL-3.0", "private": true, "scripts": { @@ -67,10 +67,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.159", - "@budibase/client": "^1.0.159", - "@budibase/frontend-core": "^1.0.159", - "@budibase/string-templates": "^1.0.159", + "@budibase/bbui": "^1.0.160", + "@budibase/client": "^1.0.160", + "@budibase/frontend-core": "^1.0.160", + "@budibase/string-templates": "^1.0.160", "@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 46d3895424..977fdb184b 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.159", + "version": "1.0.160", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 867d1081b5..ca6dead704 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.159", + "version": "1.0.160", "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": "^1.0.159", - "@budibase/frontend-core": "^1.0.159", - "@budibase/string-templates": "^1.0.159", + "@budibase/bbui": "^1.0.160", + "@budibase/frontend-core": "^1.0.160", + "@budibase/string-templates": "^1.0.160", "@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 7d27988c3d..47c4e8e699 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.159", + "version": "1.0.160", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.159", + "@budibase/bbui": "^1.0.160", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 53c8337001..cc06df6e7c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.159", + "version": "1.0.160", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -69,10 +69,10 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.159", - "@budibase/client": "^1.0.159", + "@budibase/backend-core": "^1.0.160", + "@budibase/client": "^1.0.160", "@budibase/pro": "1.0.159", - "@budibase/string-templates": "^1.0.159", + "@budibase/string-templates": "^1.0.160", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 926d542ccf..7908527856 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.159", + "version": "1.0.160", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 404c7658a2..422e9db9c1 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.159", + "version": "1.0.160", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -31,9 +31,9 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.159", + "@budibase/backend-core": "^1.0.160", "@budibase/pro": "1.0.159", - "@budibase/string-templates": "^1.0.159", + "@budibase/string-templates": "^1.0.160", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "^0.3.0", From 15b92a1f29ba15bca14dbf8751db04e806d353cf Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 May 2022 13:49:29 +0000 Subject: [PATCH 07/27] Update pro version to 1.0.160 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index cc06df6e7c..999b0693f2 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -71,7 +71,7 @@ "@apidevtools/swagger-parser": "^10.0.3", "@budibase/backend-core": "^1.0.160", "@budibase/client": "^1.0.160", - "@budibase/pro": "1.0.159", + "@budibase/pro": "1.0.160", "@budibase/string-templates": "^1.0.160", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 422e9db9c1..cc1a402d98 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -32,7 +32,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.0.160", - "@budibase/pro": "1.0.159", + "@budibase/pro": "1.0.160", "@budibase/string-templates": "^1.0.160", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", From dd6093a7ae0ca0938a3bdf9351b88e492f6bba46 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 13 May 2022 13:49:26 +0100 Subject: [PATCH 08/27] Create ObjectIds from matching string --- packages/server/src/integrations/mongodb.ts | 38 ++++++++++++++++----- 1 file changed, 30 insertions(+), 8 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index c955b43a65..044ca27fc8 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -6,7 +6,7 @@ import { import { IntegrationBase } from "./base/IntegrationBase" module MongoDBModule { - const { MongoClient } = require("mongodb") + const { MongoClient, ObjectID } = require("mongodb") interface MongoDBConfig { connectionString: string @@ -76,20 +76,41 @@ module MongoDBModule { return this.client.connect() } + createObjectIds(json: any): object { + function replaceObjectIds(json: any) { + for (let field of Object.keys(json)) { + if (field === "_id" && json["_id"].includes("ObjectId")) { + const id = json["_id"].match(/(?<=objectid\(['"]).*(?=['"]\))/gi)[0] + json["_id"] = new ObjectID.createFromHexString(id) + } + } + return json + } + + if (Array.isArray(json)) { + for (let i = 0; i < json.length; i++) { + json[i] = replaceObjectIds(json[i]) + } + return json + } + return replaceObjectIds(json) + } + async create(query: { json: object; extra: { [key: string]: string } }) { try { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) + let json = this.createObjectIds(query.json) // For mongodb we add an extra actionType to specify // which method we want to call on the collection switch (query.extra.actionTypes) { case "insertOne": { - return await collection.insertOne(query.json) + return await collection.insertOne(json) } case "insertMany": { - return await collection.insertOne(query.json).toArray() + return await collection.insertMany(json) } default: { throw new Error( @@ -110,22 +131,23 @@ module MongoDBModule { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) + let json = this.createObjectIds(query.json) switch (query.extra.actionTypes) { case "find": { - return await collection.find(query.json).toArray() + return await collection.find(json).toArray() } case "findOne": { - return await collection.findOne(query.json) + return await collection.findOne(json) } case "findOneAndUpdate": { - return await collection.findOneAndUpdate(query.json) + return await collection.findOneAndUpdate(json) } case "count": { - return await collection.countDocuments(query.json) + return await collection.countDocuments(json) } case "distinct": { - return await collection.distinct(query.json) + return await collection.distinct(json) } default: { throw new Error( From f40967784f77fd95bd41bad333b72f4159b2a7b2 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 13 May 2022 14:48:07 +0100 Subject: [PATCH 09/27] Fixed update --- packages/server/src/integrations/mongodb.ts | 39 +++++++++++++++++---- 1 file changed, 33 insertions(+), 6 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 044ca27fc8..ae6bd3b0dc 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -1,3 +1,4 @@ +import { Object } from "aws-sdk/clients/customerprofiles" import { Integration, DatasourceFieldTypes, @@ -13,6 +14,12 @@ module MongoDBModule { db: string } + interface UpdateDoc { + filter: object + update: object + options: Object + } + const SCHEMA: Integration = { docs: "https://github.com/mongodb/node-mongodb-native", friendlyName: "MongoDB", @@ -77,11 +84,17 @@ module MongoDBModule { } createObjectIds(json: any): object { + const self = this function replaceObjectIds(json: any) { for (let field of Object.keys(json)) { - if (field === "_id" && json["_id"].includes("ObjectId")) { + if (json[field] instanceof Object) { + json[field] = self.createObjectIds(json[field]) + } + if (field === "_id") { const id = json["_id"].match(/(?<=objectid\(['"]).*(?=['"]\))/gi)[0] - json["_id"] = new ObjectID.createFromHexString(id) + if (id) { + json["_id"] = new ObjectID.createFromHexString(id) + } } } return json @@ -141,7 +154,12 @@ module MongoDBModule { return await collection.findOne(json) } case "findOneAndUpdate": { - return await collection.findOneAndUpdate(json) + let findAndUpdateJson = json as UpdateDoc + return await collection.findOneAndUpdate( + findAndUpdateJson.filter, + findAndUpdateJson.update, + findAndUpdateJson.options + ) } case "count": { return await collection.countDocuments(json) @@ -163,18 +181,27 @@ module MongoDBModule { } } - async update(query: { json: object; extra: { [key: string]: string } }) { + async update(query: { json: UpdateDoc; extra: { [key: string]: string } }) { try { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) + let json = this.createObjectIds(query.json) as UpdateDoc switch (query.extra.actionTypes) { case "updateOne": { - return await collection.updateOne(query.json) + return await collection.updateOne( + json.filter, + json.update, + json.options + ) } case "updateMany": { - return await collection.updateMany(query.json).toArray() + return await collection.updateMany( + json.filter, + json.update, + json.options + ) } default: { throw new Error( From 035a7ee625eafdb1b01a4cdfde2ea2dd4d790770 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 13 May 2022 14:53:04 +0100 Subject: [PATCH 10/27] MongoDb Delete fix --- packages/server/src/integrations/mongodb.ts | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index ae6bd3b0dc..2cdc5c5ebc 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -222,13 +222,14 @@ module MongoDBModule { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) + let json = this.createObjectIds(query.json) switch (query.extra.actionTypes) { case "deleteOne": { - return await collection.deleteOne(query.json) + return await collection.deleteOne(json) } case "deleteMany": { - return await collection.deleteMany(query.json).toArray() + return await collection.deleteMany(json) } default: { throw new Error( From c2fc1598fa56671b2336316eeb26f6866a0161b4 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 13 May 2022 15:07:26 +0100 Subject: [PATCH 11/27] Null pointer fix --- packages/server/src/integrations/mongodb.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 2cdc5c5ebc..afb7c4109c 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -91,7 +91,9 @@ module MongoDBModule { json[field] = self.createObjectIds(json[field]) } if (field === "_id") { - const id = json["_id"].match(/(?<=objectid\(['"]).*(?=['"]\))/gi)[0] + const id = json["_id"].match( + /(?<=objectid\(['"]).*(?=['"]\))/gi + )?.[0] if (id) { json["_id"] = new ObjectID.createFromHexString(id) } From 0d3ab9ae332f605f02cbfdeddc47a4fa1b31065f Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 13 May 2022 15:56:02 +0100 Subject: [PATCH 12/27] Fix test for update --- .../src/integrations/tests/mongo.spec.js | 44 ++++++++++++------- 1 file changed, 28 insertions(+), 16 deletions(-) diff --git a/packages/server/src/integrations/tests/mongo.spec.js b/packages/server/src/integrations/tests/mongo.spec.js index 430ccc1c3a..1260491796 100644 --- a/packages/server/src/integrations/tests/mongo.spec.js +++ b/packages/server/src/integrations/tests/mongo.spec.js @@ -4,19 +4,19 @@ jest.mock("mongodb") class TestConfiguration { constructor(config = {}) { - this.integration = new MongoDBIntegration.integration(config) + this.integration = new MongoDBIntegration.integration(config) } } function disableConsole() { - jest.spyOn(console, 'error'); - console.error.mockImplementation(() => {}); + jest.spyOn(console, "error") + console.error.mockImplementation(() => {}) - return console.error.mockRestore; + return console.error.mockRestore } describe("MongoDB Integration", () => { - let config + let config let indexName = "Users" beforeEach(() => { @@ -25,12 +25,12 @@ describe("MongoDB Integration", () => { it("calls the create method with the correct params", async () => { const body = { - name: "Hello" + name: "Hello", } await config.integration.create({ index: indexName, json: body, - extra: { collection: 'testCollection', actionTypes: 'insertOne'} + extra: { collection: "testCollection", actionTypes: "insertOne" }, }) expect(config.integration.client.insertOne).toHaveBeenCalledWith(body) }) @@ -38,9 +38,9 @@ describe("MongoDB Integration", () => { it("calls the read method with the correct params", async () => { const query = { json: { - address: "test" + address: "test", }, - extra: { collection: 'testCollection', actionTypes: 'find'} + extra: { collection: "testCollection", actionTypes: "find" }, } const response = await config.integration.read(query) expect(config.integration.client.find).toHaveBeenCalledWith(query.json) @@ -50,9 +50,9 @@ describe("MongoDB Integration", () => { it("calls the delete method with the correct params", async () => { const query = { json: { - id: "test" + id: "test", }, - extra: { collection: 'testCollection', actionTypes: 'deleteOne'} + extra: { collection: "testCollection", actionTypes: "deleteOne" }, } await config.integration.delete(query) expect(config.integration.client.deleteOne).toHaveBeenCalledWith(query.json) @@ -61,19 +61,31 @@ describe("MongoDB Integration", () => { it("calls the update method with the correct params", async () => { const query = { json: { - id: "test" + filter: { + id: "test", + }, + update: { + name: "TestName", + }, + options: { + upsert: false, + }, }, - extra: { collection: 'testCollection', actionTypes: 'updateOne'} + extra: { collection: "testCollection", actionTypes: "updateOne" }, } await config.integration.update(query) - expect(config.integration.client.updateOne).toHaveBeenCalledWith(query.json) + expect(config.integration.client.updateOne).toHaveBeenCalledWith( + query.json.filter, + query.json.update, + query.json.options + ) }) it("throws an error when an invalid query.extra.actionType is passed for each method", async () => { const restore = disableConsole() const query = { - extra: { collection: 'testCollection', actionTypes: 'deleteOne'} + extra: { collection: "testCollection", actionTypes: "deleteOne" }, } let error = null @@ -85,4 +97,4 @@ describe("MongoDB Integration", () => { expect(error).toBeDefined() restore() }) -}) \ No newline at end of file +}) From 1d885f4de90f905e73a5813e1b8aa85cb71d251e Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 May 2022 15:45:14 +0000 Subject: [PATCH 13/27] v1.0.161 --- lerna.json | 2 +- packages/backend-core/package.json | 2 +- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lerna.json b/lerna.json index f175c9b642..7d6b8af18a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.160", + "version": "1.0.161", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index eff00f5c7d..4378aa6636 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.160", + "version": "1.0.161", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index bd3ad97946..db8300ad4f 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": "1.0.160", + "version": "1.0.161", "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": "^1.0.160", + "@budibase/string-templates": "^1.0.161", "@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 79fc77914d..544e361626 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.160", + "version": "1.0.161", "license": "GPL-3.0", "private": true, "scripts": { @@ -67,10 +67,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.160", - "@budibase/client": "^1.0.160", - "@budibase/frontend-core": "^1.0.160", - "@budibase/string-templates": "^1.0.160", + "@budibase/bbui": "^1.0.161", + "@budibase/client": "^1.0.161", + "@budibase/frontend-core": "^1.0.161", + "@budibase/string-templates": "^1.0.161", "@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 977fdb184b..a0732576bc 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.160", + "version": "1.0.161", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index ca6dead704..98b5de2b0b 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.160", + "version": "1.0.161", "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": "^1.0.160", - "@budibase/frontend-core": "^1.0.160", - "@budibase/string-templates": "^1.0.160", + "@budibase/bbui": "^1.0.161", + "@budibase/frontend-core": "^1.0.161", + "@budibase/string-templates": "^1.0.161", "@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 47c4e8e699..119e951f3c 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.160", + "version": "1.0.161", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.160", + "@budibase/bbui": "^1.0.161", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 999b0693f2..e48d7608d6 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.160", + "version": "1.0.161", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -69,10 +69,10 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.160", - "@budibase/client": "^1.0.160", + "@budibase/backend-core": "^1.0.161", + "@budibase/client": "^1.0.161", "@budibase/pro": "1.0.160", - "@budibase/string-templates": "^1.0.160", + "@budibase/string-templates": "^1.0.161", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 7908527856..dd6d51d3e7 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.160", + "version": "1.0.161", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index cc1a402d98..5367743d1a 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.160", + "version": "1.0.161", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -31,9 +31,9 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.160", + "@budibase/backend-core": "^1.0.161", "@budibase/pro": "1.0.160", - "@budibase/string-templates": "^1.0.160", + "@budibase/string-templates": "^1.0.161", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "^0.3.0", From 76670f248e296e4674f7ac6219dc76fcef65036b Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 May 2022 15:46:42 +0000 Subject: [PATCH 14/27] Update pro version to 1.0.161 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index e48d7608d6..3a9c3641f2 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -71,7 +71,7 @@ "@apidevtools/swagger-parser": "^10.0.3", "@budibase/backend-core": "^1.0.161", "@budibase/client": "^1.0.161", - "@budibase/pro": "1.0.160", + "@budibase/pro": "1.0.161", "@budibase/string-templates": "^1.0.161", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 5367743d1a..9fc394f23c 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -32,7 +32,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.0.161", - "@budibase/pro": "1.0.160", + "@budibase/pro": "1.0.161", "@budibase/string-templates": "^1.0.161", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", From 459e3c5eddf57f1bc0d7106fffd28782cfa7e408 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 13 May 2022 18:09:39 +0100 Subject: [PATCH 15/27] Addresses #5850 - when importing/migrating views and building new views it checks if calculations are used and if they are then it does an empty check to decide whether or not the fields should be included in the calculation, required for real CouchDB nodes. --- .../server/src/api/controllers/view/utils.js | 6 ++-- .../src/api/controllers/view/viewBuilder.js | 33 ++++++++++++++----- 2 files changed, 28 insertions(+), 11 deletions(-) diff --git a/packages/server/src/api/controllers/view/utils.js b/packages/server/src/api/controllers/view/utils.js index 59d169ef7f..5bddbf345c 100644 --- a/packages/server/src/api/controllers/view/utils.js +++ b/packages/server/src/api/controllers/view/utils.js @@ -7,6 +7,7 @@ const { } = require("../../../db/utils") const env = require("../../../environment") const { getAppDB } = require("@budibase/backend-core/context") +const viewBuilder = require("./viewBuilder") exports.getView = async viewName => { const db = getAppDB() @@ -114,7 +115,8 @@ exports.deleteView = async viewName => { exports.migrateToInMemoryView = async (db, viewName) => { // delete the view initially const designDoc = await db.get("_design/database") - const view = designDoc.views[viewName] + // run the view back through the view builder to update it + const view = viewBuilder(designDoc.views[viewName].meta) delete designDoc.views[viewName] await db.put(designDoc) await exports.saveView(db, null, viewName, view) @@ -123,7 +125,7 @@ exports.migrateToInMemoryView = async (db, viewName) => { exports.migrateToDesignView = async (db, viewName) => { let view = await db.get(generateMemoryViewID(viewName)) const designDoc = await db.get("_design/database") - designDoc.views[viewName] = view.view + designDoc.views[viewName] = viewBuilder(view.view.meta) await db.put(designDoc) await db.remove(view._id, view._rev) } diff --git a/packages/server/src/api/controllers/view/viewBuilder.js b/packages/server/src/api/controllers/view/viewBuilder.js index 6e2e5c8527..125964a50e 100644 --- a/packages/server/src/api/controllers/view/viewBuilder.js +++ b/packages/server/src/api/controllers/view/viewBuilder.js @@ -10,6 +10,12 @@ const TOKEN_MAP = { OR: "||", } +const CONDITIONS = { + EMPTY: "EMPTY", + NOT_EMPTY: "NOT_EMPTY", + CONTAINS: "CONTAINS", +} + const isEmptyExpression = key => { return `( doc["${key}"] === undefined || @@ -77,13 +83,13 @@ function parseFilterExpression(filters) { expression.push(TOKEN_MAP[filter.conjunction]) } - if (filter.condition === "CONTAINS") { + if (filter.condition === CONDITIONS.CONTAINS) { expression.push( `doc["${filter.key}"].${TOKEN_MAP[filter.condition]}("${filter.value}")` ) - } else if (filter.condition === "EMPTY") { + } else if (filter.condition === CONDITIONS.EMPTY) { expression.push(isEmptyExpression(filter.key)) - } else if (filter.condition === "NOT_EMPTY") { + } else if (filter.condition === CONDITIONS.NOT_EMPTY) { expression.push(`!${isEmptyExpression(filter.key)}`) } else { const value = @@ -125,12 +131,6 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { if (filters && filters.length > 0 && filters[0].conjunction) { delete filters[0].conjunction } - const parsedFilters = parseFilterExpression(filters) - const filterExpression = parsedFilters ? `&& (${parsedFilters})` : "" - - const emitExpression = parseEmitExpression(field, groupBy) - - const reduction = field && calculation ? { reduce: `_${calculation}` } : {} let schema = null @@ -139,8 +139,23 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { ...(groupBy ? GROUP_PROPERTY : FIELD_PROPERTY), ...SCHEMA_MAP[calculation], } + if ( + !filters.find( + filter => + filter.key === field && filter.condition === CONDITIONS.NOT_EMPTY + ) + ) { + filters.push({ key: field, condition: CONDITIONS.NOT_EMPTY }) + } } + const parsedFilters = parseFilterExpression(filters) + const filterExpression = parsedFilters ? `&& (${parsedFilters})` : "" + + const emitExpression = parseEmitExpression(field, groupBy) + + const reduction = field && calculation ? { reduce: `_${calculation}` } : {} + return { meta: { field, From 81f16aa7ce5e69ed425eee66d239e1c6e276729d Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 13 May 2022 21:22:10 +0100 Subject: [PATCH 16/27] Check type is string before match --- packages/server/src/integrations/mongodb.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index afb7c4109c..8237cd7844 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -85,12 +85,12 @@ module MongoDBModule { createObjectIds(json: any): object { const self = this - function replaceObjectIds(json: any) { + function interpolateObjectIds(json: any) { for (let field of Object.keys(json)) { if (json[field] instanceof Object) { json[field] = self.createObjectIds(json[field]) } - if (field === "_id") { + if (field === "_id" && typeof json[field] === "string") { const id = json["_id"].match( /(?<=objectid\(['"]).*(?=['"]\))/gi )?.[0] @@ -104,11 +104,11 @@ module MongoDBModule { if (Array.isArray(json)) { for (let i = 0; i < json.length; i++) { - json[i] = replaceObjectIds(json[i]) + json[i] = interpolateObjectIds(json[i]) } return json } - return replaceObjectIds(json) + return interpolateObjectIds(json) } async create(query: { json: object; extra: { [key: string]: string } }) { From e3883d480d5a19b44027f751e6bffb31730a15ce Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 16 May 2022 08:42:09 +0100 Subject: [PATCH 17/27] Lowercase the object typo --- packages/server/src/integrations/mongodb.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 8237cd7844..55b4cdaaf4 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -17,7 +17,7 @@ module MongoDBModule { interface UpdateDoc { filter: object update: object - options: Object + options: object } const SCHEMA: Integration = { From 7b570fea221661233e35a45d0bfd0dc67c344b3c Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 16 May 2022 08:43:27 +0100 Subject: [PATCH 18/27] Removed unused aws Object import --- packages/server/src/integrations/mongodb.ts | 1 - 1 file changed, 1 deletion(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 55b4cdaaf4..3ecc67258b 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -1,4 +1,3 @@ -import { Object } from "aws-sdk/clients/customerprofiles" import { Integration, DatasourceFieldTypes, From 0da9ee0a56a94f434d0e24abee427459be327819 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 16 May 2022 09:50:47 +0100 Subject: [PATCH 19/27] Using mongodb types --- package.json | 3 +- packages/server/src/integrations/mongodb.ts | 47 +++++++++++------ .../src/integrations/tests/mongo.spec.js | 9 +++- yarn.lock | 52 ++++++++++++++++--- 4 files changed, 85 insertions(+), 26 deletions(-) diff --git a/package.json b/package.json index fb6d9da990..84f1999ead 100644 --- a/package.json +++ b/package.json @@ -3,6 +3,8 @@ "private": true, "devDependencies": { "@rollup/plugin-json": "^4.0.2", + "@types/mongodb": "3.6.3", + "@typescript-eslint/parser": "4.28.0", "babel-eslint": "^10.0.3", "eslint": "^7.28.0", "eslint-plugin-cypress": "^2.11.3", @@ -16,7 +18,6 @@ "rimraf": "^3.0.2", "rollup-plugin-replace": "^2.2.0", "svelte": "^3.38.2", - "@typescript-eslint/parser": "4.28.0", "typescript": "4.5.5" }, "scripts": { diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 3ecc67258b..0823d73721 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -4,21 +4,23 @@ import { QueryTypes, } from "../definitions/datasource" import { IntegrationBase } from "./base/IntegrationBase" +import { + MongoClient, + ObjectID, + FilterQuery, + UpdateQuery, + FindOneAndUpdateOption, + UpdateOneOptions, + UpdateManyOptions, + CommonOptions, +} from "mongodb" module MongoDBModule { - const { MongoClient, ObjectID } = require("mongodb") - interface MongoDBConfig { connectionString: string db: string } - interface UpdateDoc { - filter: object - update: object - options: object - } - const SCHEMA: Integration = { docs: "https://github.com/mongodb/node-mongodb-native", friendlyName: "MongoDB", @@ -94,7 +96,7 @@ module MongoDBModule { /(?<=objectid\(['"]).*(?=['"]\))/gi )?.[0] if (id) { - json["_id"] = new ObjectID.createFromHexString(id) + json["_id"] = ObjectID.createFromHexString(id) } } } @@ -155,7 +157,11 @@ module MongoDBModule { return await collection.findOne(json) } case "findOneAndUpdate": { - let findAndUpdateJson = json as UpdateDoc + let findAndUpdateJson = json as { + filter: FilterQuery + update: UpdateQuery + options: FindOneAndUpdateOption + } return await collection.findOneAndUpdate( findAndUpdateJson.filter, findAndUpdateJson.update, @@ -182,26 +188,30 @@ module MongoDBModule { } } - async update(query: { json: UpdateDoc; extra: { [key: string]: string } }) { + async update(query: { json: object; extra: { [key: string]: string } }) { try { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) - let json = this.createObjectIds(query.json) as UpdateDoc + let json = this.createObjectIds(query.json) as { + filter: FilterQuery + update: UpdateQuery + options: object + } switch (query.extra.actionTypes) { case "updateOne": { return await collection.updateOne( json.filter, json.update, - json.options + json.options as UpdateOneOptions ) } case "updateMany": { return await collection.updateMany( json.filter, json.update, - json.options + json.options as UpdateManyOptions ) } default: { @@ -223,14 +233,17 @@ module MongoDBModule { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) - let json = this.createObjectIds(query.json) + let json = this.createObjectIds(query.json) as { + filter: FilterQuery + options: CommonOptions + } switch (query.extra.actionTypes) { case "deleteOne": { - return await collection.deleteOne(json) + return await collection.deleteOne(json.filter, json.options) } case "deleteMany": { - return await collection.deleteMany(json) + return await collection.deleteMany(json.filter, json.options) } default: { throw new Error( diff --git a/packages/server/src/integrations/tests/mongo.spec.js b/packages/server/src/integrations/tests/mongo.spec.js index 1260491796..b0a49521ec 100644 --- a/packages/server/src/integrations/tests/mongo.spec.js +++ b/packages/server/src/integrations/tests/mongo.spec.js @@ -50,12 +50,17 @@ describe("MongoDB Integration", () => { it("calls the delete method with the correct params", async () => { const query = { json: { - id: "test", + filter: { + id: "test", + }, + options: { + opt: "option" + } }, extra: { collection: "testCollection", actionTypes: "deleteOne" }, } await config.integration.delete(query) - expect(config.integration.client.deleteOne).toHaveBeenCalledWith(query.json) + expect(config.integration.client.deleteOne).toHaveBeenCalledWith(query.json.filter, query.json.options) }) it("calls the update method with the correct params", async () => { diff --git a/yarn.lock b/yarn.lock index 129b650c73..276dd62d08 100644 --- a/yarn.lock +++ b/yarn.lock @@ -972,6 +972,13 @@ estree-walker "^1.0.1" picomatch "^2.2.2" +"@types/bson@*": + version "4.2.0" + resolved "https://registry.yarnpkg.com/@types/bson/-/bson-4.2.0.tgz#a2f71e933ff54b2c3bf267b67fa221e295a33337" + integrity sha512-ELCPqAdroMdcuxqwMgUpifQyRoTpyYCNr1V9xKyF40VsBobsj+BbWNRvwGchMgBPGqkw655ypkjj2MEF5ywVwg== + dependencies: + bson "*" + "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" @@ -982,6 +989,19 @@ resolved "https://registry.yarnpkg.com/@types/minimist/-/minimist-1.2.2.tgz#ee771e2ba4b3dc5b372935d549fd9617bf345b8c" integrity sha512-jhuKLIRrhvCPLqwPcx6INqmKeiA5EWrsCOPhrlFSrbrmU4ZMPjj5Ul/oLCMDO98XRUIwVm78xICz4EPCektzeQ== +"@types/mongodb@3.6.3": + version "3.6.3" + resolved "https://registry.yarnpkg.com/@types/mongodb/-/mongodb-3.6.3.tgz#5655af409d9e32d5d5ae9a653abf3e5f9c83eb7a" + integrity sha512-6YNqGP1hk5bjUFaim+QoFFuI61WjHiHE1BNeB41TA00Xd2K7zG4lcWyLLq/XtIp36uMavvS5hoAUJ+1u/GcX2Q== + dependencies: + "@types/bson" "*" + "@types/node" "*" + +"@types/node@*": + version "17.0.33" + resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.33.tgz#3c1879b276dc63e73030bb91165e62a4509cd506" + integrity sha512-miWq2m2FiQZmaHfdZNcbpp9PuXg34W5JZ5CrJ/BaS70VuhoJENBEQybeiYSaPBRNq6KQGnjfEnc/F3PN++D+XQ== + "@types/node@>= 8": version "17.0.18" resolved "https://registry.yarnpkg.com/@types/node/-/node-17.0.18.tgz#3b4fed5cfb58010e3a2be4b6e74615e4847f1074" @@ -1300,6 +1320,11 @@ balanced-match@^1.0.0: resolved "https://registry.yarnpkg.com/balanced-match/-/balanced-match-1.0.2.tgz#e83e3a7e3f300b34cb9d87f615fa0cbf357690ee" integrity sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw== +base64-js@^1.3.1: + version "1.5.1" + resolved "https://registry.yarnpkg.com/base64-js/-/base64-js-1.5.1.tgz#1b1b440160a5bf7ad40b650f095963481903930a" + integrity sha512-AKpaYlHn8t4SVbOHCy+b5+KKgvR4vrsD8vbvrbiQJps7fKDTkjkDry6ji0rUJjC0kzbNePLwzxq8iypo41qeWA== + base@^0.11.1: version "0.11.2" resolved "https://registry.yarnpkg.com/base/-/base-0.11.2.tgz#7bde5ced145b6d551a90db87f83c558b4eb48a8f" @@ -1361,6 +1386,13 @@ braces@^3.0.2: dependencies: fill-range "^7.0.1" +bson@*: + version "4.6.3" + resolved "https://registry.yarnpkg.com/bson/-/bson-4.6.3.tgz#d1a9a0b84b9e84b62390811fc5580f6a8b1d858c" + integrity sha512-rAqP5hcUVJhXP2MCSNVsf0oM2OGU1So6A9pVRDYayvJ5+hygXHQApf87wd5NlhPM1J9RJnbqxIG/f8QTzRoQ4A== + dependencies: + buffer "^5.6.0" + btoa-lite@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/btoa-lite/-/btoa-lite-1.0.0.tgz#337766da15801210fdd956c22e9c6891ab9d0337" @@ -1371,6 +1403,14 @@ buffer-from@^1.0.0: resolved "https://registry.yarnpkg.com/buffer-from/-/buffer-from-1.1.2.tgz#2b146a6fd72e80b4f55d255f35ed59a3a9a41bd5" integrity sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ== +buffer@^5.6.0: + version "5.7.1" + resolved "https://registry.yarnpkg.com/buffer/-/buffer-5.7.1.tgz#ba62e7c13133053582197160851a8f648e99eed0" + integrity sha512-EHcyIPBQ4BSGlvjB16k5KgAJ27CIsHY/2JBmCRReo48y9rQ3MaUzWX3KVlBa4U7MyX02HdVj0K7C3WaB3ju7FQ== + dependencies: + base64-js "^1.3.1" + ieee754 "^1.1.13" + builtins@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/builtins/-/builtins-1.0.3.tgz#cb94faeb61c8696451db36534e1422f94f0aee88" @@ -2969,6 +3009,11 @@ iconv-lite@^0.6.2: dependencies: safer-buffer ">= 2.1.2 < 3.0.0" +ieee754@^1.1.13: + version "1.2.1" + resolved "https://registry.yarnpkg.com/ieee754/-/ieee754-1.2.1.tgz#8eb7a10a63fff25d15a57b001586d177d1b0d352" + integrity sha512-dcyqhDvX1C46lXZcVqCpK+FtMRQVdIMN6/Df5js2zouUsqG7I6sFxitIC+7KYK29KdXOLHdu9zL4sFnoVQnqaA== + iferr@^0.1.5: version "0.1.5" resolved "https://registry.yarnpkg.com/iferr/-/iferr-0.1.5.tgz#c60eed69e6d8fdb6b3104a1fcbca1c192dc5b501" @@ -4663,12 +4708,7 @@ performance-now@^2.1.0: resolved "https://registry.yarnpkg.com/performance-now/-/performance-now-2.1.0.tgz#6309f4e0e5fa913ec1c69307ae364b4b377c9e7b" integrity sha1-Ywn04OX6kT7BxpMHrjZLSzd8nns= -picomatch@^2.2.2: - version "2.3.1" - resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" - integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== - -picomatch@^2.3.1: +picomatch@^2.2.2, picomatch@^2.3.1: version "2.3.1" resolved "https://registry.yarnpkg.com/picomatch/-/picomatch-2.3.1.tgz#3ba3833733646d9d3e4995946c1365a67fb07a42" integrity sha512-JU3teHTNjmE2VCGFzuY8EXzCDVwEqB2a8fsIvwaStHhAWJEeVd1o1QD80CU6+ZdEXXSLbSsuLwJjkCBWqRQUVA== From 08f53591e61a44a6019aa35b74587afe68b356c3 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 16 May 2022 12:31:07 +0100 Subject: [PATCH 20/27] Fixing test cases. --- .../src/middleware/passport/tests/oidc.spec.js | 14 ++++++++------ .../__snapshots__/viewBuilder.spec.js.snap | 14 ++++++++++++-- .../server/src/api/routes/tests/view.spec.js | 7 ++++++- packages/server/yarn.lock | 18 +++++++++--------- packages/worker/yarn.lock | 18 +++++++++--------- 5 files changed, 44 insertions(+), 27 deletions(-) diff --git a/packages/backend-core/src/middleware/passport/tests/oidc.spec.js b/packages/backend-core/src/middleware/passport/tests/oidc.spec.js index bfe9f97dc0..c5e9fe0034 100644 --- a/packages/backend-core/src/middleware/passport/tests/oidc.spec.js +++ b/packages/backend-core/src/middleware/passport/tests/oidc.spec.js @@ -71,7 +71,7 @@ describe("oidc", () => { describe("authenticate", () => { afterEach(() => { - jest.clearAllMocks(); + jest.clearAllMocks() }); // mock third party common authentication @@ -80,10 +80,10 @@ describe("oidc", () => { // mock the passport callback const mockDone = jest.fn() + const mockSaveUserFn = jest.fn() async function doAuthenticate() { const oidc = require("../oidc") - const mockSaveUserFn = jest.fn() const authenticate = await oidc.buildVerifyFn(mockSaveUserFn) await authenticate( @@ -105,11 +105,13 @@ describe("oidc", () => { expect(authenticateThirdParty).toHaveBeenCalledWith( user, false, - mockDone) + mockDone, + mockSaveUserFn, + ) } it("delegates authentication to third party common", async () => { - doTest() + await doTest() }) it("uses JWT email to get email", async () => { @@ -118,7 +120,7 @@ describe("oidc", () => { email : "mock@budibase.com" } - doTest() + await doTest() }) it("uses JWT username to get email", async () => { @@ -127,7 +129,7 @@ describe("oidc", () => { preferred_username : "mock@budibase.com" } - doTest() + await doTest() }) it("uses JWT invalid username to get email", async () => { diff --git a/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap b/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap index 27c8615a46..99f67593fd 100644 --- a/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap +++ b/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap @@ -3,14 +3,24 @@ exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = ` Object { "map": "function (doc) { - if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" ) { + if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && (!( + doc[\\"myField\\"] === undefined || + doc[\\"myField\\"] === null || + doc[\\"myField\\"] === \\"\\" || + (Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0) + ))) { emit(doc[\\"_id\\"], doc[\\"myField\\"]); } }", "meta": Object { "calculation": "stats", "field": "myField", - "filters": Array [], + "filters": Array [ + Object { + "condition": "NOT_EMPTY", + "key": "myField", + }, + ], "groupBy": undefined, "schema": Object { "avg": Object { diff --git a/packages/server/src/api/routes/tests/view.spec.js b/packages/server/src/api/routes/tests/view.spec.js index b1c5f655c6..48d7f8c552 100644 --- a/packages/server/src/api/routes/tests/view.spec.js +++ b/packages/server/src/api/routes/tests/view.spec.js @@ -72,7 +72,12 @@ describe("/views", () => { field: "Price", calculation: "stats", tableId: table._id, - filters: [], + filters: [ + { + condition: "NOT_EMPTY", + key: "Price", + } + ], schema: { sum: { type: "number", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index d7212c2f48..f5e51de813 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1014,10 +1014,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.154.tgz#c310834892e7621778b07579464955487c5c9830" - integrity sha512-mcZxt8XhGgOB4XRHKkWTvBEI4HGp2bo8qyzOJRCvDqlg56S9zqGJDl75Z0N/Wc8N3I53QRcxISerj48odX172A== +"@budibase/backend-core@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.160.tgz#000e3b5a3ed91e73a542b4caa202a6f147d91294" + integrity sha512-XfAFU6sRPrCSEKlm58WeuPw8lUoJK+KwO0tcbT+bB2Nb7XCHplskryEgk/PM9ujRU6SMPDx11zKeqRebHlycbA== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -1091,12 +1091,12 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.154.tgz#f4e31e30376b206159b711224038141d73a1118e" - integrity sha512-+O6bemrcgyWG4a+D5dIOoZ+LGjW4aN7tRdFeZqoaIPCc1pA6zNtLUkM1nb+Laafuwq2Aht37vEuaRy7jfzVprA== +"@budibase/pro@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.160.tgz#921c4e3f65b866d84292644dfd8793c4d0b667c7" + integrity sha512-p+Jhnk1n98CWCJXydSQSO7a+HDpqGAHekGQbOR7aayuwuoYzyOXxTcHNLdBp+3lkXhLSZq9oIwfEGpgdrrhXPA== dependencies: - "@budibase/backend-core" "1.0.154" + "@budibase/backend-core" "1.0.160" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index a5e4c2d9e7..1b31c8ef50 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -293,10 +293,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.154.tgz#c310834892e7621778b07579464955487c5c9830" - integrity sha512-mcZxt8XhGgOB4XRHKkWTvBEI4HGp2bo8qyzOJRCvDqlg56S9zqGJDl75Z0N/Wc8N3I53QRcxISerj48odX172A== +"@budibase/backend-core@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.160.tgz#000e3b5a3ed91e73a542b4caa202a6f147d91294" + integrity sha512-XfAFU6sRPrCSEKlm58WeuPw8lUoJK+KwO0tcbT+bB2Nb7XCHplskryEgk/PM9ujRU6SMPDx11zKeqRebHlycbA== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -321,12 +321,12 @@ uuid "^8.3.2" zlib "^1.0.5" -"@budibase/pro@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.154.tgz#f4e31e30376b206159b711224038141d73a1118e" - integrity sha512-+O6bemrcgyWG4a+D5dIOoZ+LGjW4aN7tRdFeZqoaIPCc1pA6zNtLUkM1nb+Laafuwq2Aht37vEuaRy7jfzVprA== +"@budibase/pro@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.160.tgz#921c4e3f65b866d84292644dfd8793c4d0b667c7" + integrity sha512-p+Jhnk1n98CWCJXydSQSO7a+HDpqGAHekGQbOR7aayuwuoYzyOXxTcHNLdBp+3lkXhLSZq9oIwfEGpgdrrhXPA== dependencies: - "@budibase/backend-core" "1.0.154" + "@budibase/backend-core" "1.0.160" node-fetch "^2.6.1" "@cspotcode/source-map-consumer@0.8.0": From 7b07cff0c6e1f5a34555078fa2300cc0147ad0e8 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Mon, 16 May 2022 13:37:00 +0100 Subject: [PATCH 21/27] Updating view builder to handle if stats has a filter as well, don't need a conjuction this way. --- .../__snapshots__/viewBuilder.spec.js.snap | 57 +++++++++++++++++-- .../view/tests/viewBuilder.spec.js | 18 ++++++ .../src/api/controllers/view/viewBuilder.js | 14 +++-- .../server/src/api/routes/tests/view.spec.js | 7 +-- 4 files changed, 81 insertions(+), 15 deletions(-) diff --git a/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap b/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap index 99f67593fd..4572a8a24f 100644 --- a/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap +++ b/packages/server/src/api/controllers/view/tests/__snapshots__/viewBuilder.spec.js.snap @@ -1,14 +1,14 @@ // Jest Snapshot v1, https://goo.gl/fbAQLP -exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = ` +exports[`viewBuilder Calculate and filter creates a view with the calculation statistics and filter schema 1`] = ` Object { "map": "function (doc) { - if (doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && (!( + if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !( doc[\\"myField\\"] === undefined || doc[\\"myField\\"] === null || doc[\\"myField\\"] === \\"\\" || (Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0) - ))) { + )) && (doc[\\"age\\"] > 17)) { emit(doc[\\"_id\\"], doc[\\"myField\\"]); } }", @@ -17,8 +17,9 @@ Object { "field": "myField", "filters": Array [ Object { - "condition": "NOT_EMPTY", - "key": "myField", + "condition": "MT", + "key": "age", + "value": 17, }, ], "groupBy": undefined, @@ -51,6 +52,52 @@ Object { } `; +exports[`viewBuilder Calculate creates a view with the calculation statistics schema 1`] = ` +Object { + "map": "function (doc) { + if ((doc.tableId === \\"14f1c4e94d6a47b682ce89d35d4c78b0\\" && !( + doc[\\"myField\\"] === undefined || + doc[\\"myField\\"] === null || + doc[\\"myField\\"] === \\"\\" || + (Array.isArray(doc[\\"myField\\"]) && doc[\\"myField\\"].length === 0) + )) ) { + emit(doc[\\"_id\\"], doc[\\"myField\\"]); + } + }", + "meta": Object { + "calculation": "stats", + "field": "myField", + "filters": Array [], + "groupBy": undefined, + "schema": Object { + "avg": Object { + "type": "number", + }, + "count": Object { + "type": "number", + }, + "field": Object { + "type": "string", + }, + "max": Object { + "type": "number", + }, + "min": Object { + "type": "number", + }, + "sum": Object { + "type": "number", + }, + "sumsqr": Object { + "type": "number", + }, + }, + "tableId": "14f1c4e94d6a47b682ce89d35d4c78b0", + }, + "reduce": "_stats", +} +`; + exports[`viewBuilder Filter creates a view with multiple filters and conjunctions 1`] = ` Object { "map": "function (doc) { diff --git a/packages/server/src/api/controllers/view/tests/viewBuilder.spec.js b/packages/server/src/api/controllers/view/tests/viewBuilder.spec.js index d1674bca08..58fb68cfa7 100644 --- a/packages/server/src/api/controllers/view/tests/viewBuilder.spec.js +++ b/packages/server/src/api/controllers/view/tests/viewBuilder.spec.js @@ -44,4 +44,22 @@ describe("viewBuilder", () => { })).toMatchSnapshot() }) }) + + describe("Calculate and filter", () => { + it("creates a view with the calculation statistics and filter schema", () => { + expect(viewTemplate({ + "name": "Calculate View", + "field": "myField", + "calculation": "stats", + "tableId": "14f1c4e94d6a47b682ce89d35d4c78b0", + "filters": [ + { + "value": 17, + "condition": "MT", + "key": "age", + } + ] + })).toMatchSnapshot() + }) + }) }); \ No newline at end of file diff --git a/packages/server/src/api/controllers/view/viewBuilder.js b/packages/server/src/api/controllers/view/viewBuilder.js index 125964a50e..6596e0d9e7 100644 --- a/packages/server/src/api/controllers/view/viewBuilder.js +++ b/packages/server/src/api/controllers/view/viewBuilder.js @@ -132,7 +132,8 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { delete filters[0].conjunction } - let schema = null + let schema = null, + statFilter = null if (calculation) { schema = { @@ -145,7 +146,9 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { filter.key === field && filter.condition === CONDITIONS.NOT_EMPTY ) ) { - filters.push({ key: field, condition: CONDITIONS.NOT_EMPTY }) + statFilter = parseFilterExpression([ + { key: field, condition: CONDITIONS.NOT_EMPTY }, + ]) } } @@ -153,7 +156,10 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { const filterExpression = parsedFilters ? `&& (${parsedFilters})` : "" const emitExpression = parseEmitExpression(field, groupBy) - + const tableExpression = `doc.tableId === "${tableId}"` + const coreExpression = statFilter + ? `(${tableExpression} && ${statFilter})` + : tableExpression const reduction = field && calculation ? { reduce: `_${calculation}` } : {} return { @@ -166,7 +172,7 @@ function viewTemplate({ field, tableId, groupBy, filters = [], calculation }) { calculation, }, map: `function (doc) { - if (doc.tableId === "${tableId}" ${filterExpression}) { + if (${coreExpression} ${filterExpression}) { ${emitExpression} } }`, diff --git a/packages/server/src/api/routes/tests/view.spec.js b/packages/server/src/api/routes/tests/view.spec.js index 48d7f8c552..b1c5f655c6 100644 --- a/packages/server/src/api/routes/tests/view.spec.js +++ b/packages/server/src/api/routes/tests/view.spec.js @@ -72,12 +72,7 @@ describe("/views", () => { field: "Price", calculation: "stats", tableId: table._id, - filters: [ - { - condition: "NOT_EMPTY", - key: "Price", - } - ], + filters: [], schema: { sum: { type: "number", From 08eda0e89f54f33adbd8e52f9a1e03af673bc163 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 16 May 2022 16:48:39 +0000 Subject: [PATCH 22/27] v1.0.162 --- lerna.json | 2 +- packages/backend-core/package.json | 2 +- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lerna.json b/lerna.json index 7d6b8af18a..06a5b72839 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.161", + "version": "1.0.162", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index 4378aa6636..eb89f5e928 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.161", + "version": "1.0.162", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index db8300ad4f..9a8c06ce28 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": "1.0.161", + "version": "1.0.162", "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": "^1.0.161", + "@budibase/string-templates": "^1.0.162", "@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 544e361626..b9ad63957a 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.161", + "version": "1.0.162", "license": "GPL-3.0", "private": true, "scripts": { @@ -67,10 +67,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.161", - "@budibase/client": "^1.0.161", - "@budibase/frontend-core": "^1.0.161", - "@budibase/string-templates": "^1.0.161", + "@budibase/bbui": "^1.0.162", + "@budibase/client": "^1.0.162", + "@budibase/frontend-core": "^1.0.162", + "@budibase/string-templates": "^1.0.162", "@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 a0732576bc..7f3ad11bd7 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.161", + "version": "1.0.162", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 98b5de2b0b..34b2a93b0f 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.161", + "version": "1.0.162", "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": "^1.0.161", - "@budibase/frontend-core": "^1.0.161", - "@budibase/string-templates": "^1.0.161", + "@budibase/bbui": "^1.0.162", + "@budibase/frontend-core": "^1.0.162", + "@budibase/string-templates": "^1.0.162", "@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 119e951f3c..0745ede083 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.161", + "version": "1.0.162", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.161", + "@budibase/bbui": "^1.0.162", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index 3a9c3641f2..390291608c 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.161", + "version": "1.0.162", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -69,10 +69,10 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.161", - "@budibase/client": "^1.0.161", + "@budibase/backend-core": "^1.0.162", + "@budibase/client": "^1.0.162", "@budibase/pro": "1.0.161", - "@budibase/string-templates": "^1.0.161", + "@budibase/string-templates": "^1.0.162", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index dd6d51d3e7..b5f21c2013 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.161", + "version": "1.0.162", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 9fc394f23c..7d32dc0108 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.161", + "version": "1.0.162", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -31,9 +31,9 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.161", + "@budibase/backend-core": "^1.0.162", "@budibase/pro": "1.0.161", - "@budibase/string-templates": "^1.0.161", + "@budibase/string-templates": "^1.0.162", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "^0.3.0", From 5bbb253f73ac67386f5e9a54cb0765eb21721b61 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 16 May 2022 16:49:56 +0000 Subject: [PATCH 23/27] Update pro version to 1.0.162 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 390291608c..b3d237edbf 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -71,7 +71,7 @@ "@apidevtools/swagger-parser": "^10.0.3", "@budibase/backend-core": "^1.0.162", "@budibase/client": "^1.0.162", - "@budibase/pro": "1.0.161", + "@budibase/pro": "1.0.162", "@budibase/string-templates": "^1.0.162", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 7d32dc0108..f6687e3f26 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -32,7 +32,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.0.162", - "@budibase/pro": "1.0.161", + "@budibase/pro": "1.0.162", "@budibase/string-templates": "^1.0.162", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", From 0f4aaa477907c415de9485e21b3fa52a9e580db0 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 16 May 2022 22:44:38 +0100 Subject: [PATCH 24/27] Parse params if needed --- packages/server/src/integrations/mongodb.ts | 39 +++++++++++++++++++-- packages/server/yarn.lock | 18 +++++----- packages/worker/yarn.lock | 18 +++++----- 3 files changed, 55 insertions(+), 20 deletions(-) diff --git a/packages/server/src/integrations/mongodb.ts b/packages/server/src/integrations/mongodb.ts index 0823d73721..ae6754907b 100644 --- a/packages/server/src/integrations/mongodb.ts +++ b/packages/server/src/integrations/mongodb.ts @@ -112,6 +112,33 @@ module MongoDBModule { return interpolateObjectIds(json) } + parseQueryParams(params: string, mode: string) { + let queryParams = params.split(/(?<=(},)).*{/g) + let group1 = queryParams[0] + let group2 = queryParams[2] + let group3 = queryParams[4] + if (group1) { + group1 = JSON.parse(group1.replace(/,+$/, "")) + } + if (group2) { + group2 = JSON.parse("{" + group2.replace(/,+$/, "")) + } + if (group3) { + group3 = JSON.parse("{" + group3.replace(/,+$/, "")) + } + if (mode === "update") { + return { + filter: group1, + update: group2, + options: group3 ?? {}, + } + } + return { + filter: group1, + options: group2 ?? {}, + } + } + async create(query: { json: object; extra: { [key: string]: string } }) { try { await this.connect() @@ -193,7 +220,11 @@ module MongoDBModule { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) - let json = this.createObjectIds(query.json) as { + let queryJson = query.json + if (typeof queryJson === "string") { + queryJson = this.parseQueryParams(queryJson, "update") + } + let json = this.createObjectIds(queryJson) as { filter: FilterQuery update: UpdateQuery options: object @@ -233,7 +264,11 @@ module MongoDBModule { await this.connect() const db = this.client.db(this.config.db) const collection = db.collection(query.extra.collection) - let json = this.createObjectIds(query.json) as { + let queryJson = query.json + if (typeof queryJson === "string") { + queryJson = this.parseQueryParams(queryJson, "delete") + } + let json = this.createObjectIds(queryJson) as { filter: FilterQuery options: CommonOptions } diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index d7212c2f48..f5e51de813 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1014,10 +1014,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.154.tgz#c310834892e7621778b07579464955487c5c9830" - integrity sha512-mcZxt8XhGgOB4XRHKkWTvBEI4HGp2bo8qyzOJRCvDqlg56S9zqGJDl75Z0N/Wc8N3I53QRcxISerj48odX172A== +"@budibase/backend-core@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.160.tgz#000e3b5a3ed91e73a542b4caa202a6f147d91294" + integrity sha512-XfAFU6sRPrCSEKlm58WeuPw8lUoJK+KwO0tcbT+bB2Nb7XCHplskryEgk/PM9ujRU6SMPDx11zKeqRebHlycbA== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -1091,12 +1091,12 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.154.tgz#f4e31e30376b206159b711224038141d73a1118e" - integrity sha512-+O6bemrcgyWG4a+D5dIOoZ+LGjW4aN7tRdFeZqoaIPCc1pA6zNtLUkM1nb+Laafuwq2Aht37vEuaRy7jfzVprA== +"@budibase/pro@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.160.tgz#921c4e3f65b866d84292644dfd8793c4d0b667c7" + integrity sha512-p+Jhnk1n98CWCJXydSQSO7a+HDpqGAHekGQbOR7aayuwuoYzyOXxTcHNLdBp+3lkXhLSZq9oIwfEGpgdrrhXPA== dependencies: - "@budibase/backend-core" "1.0.154" + "@budibase/backend-core" "1.0.160" node-fetch "^2.6.1" "@budibase/standard-components@^0.9.139": diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index a5e4c2d9e7..1b31c8ef50 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -293,10 +293,10 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.154.tgz#c310834892e7621778b07579464955487c5c9830" - integrity sha512-mcZxt8XhGgOB4XRHKkWTvBEI4HGp2bo8qyzOJRCvDqlg56S9zqGJDl75Z0N/Wc8N3I53QRcxISerj48odX172A== +"@budibase/backend-core@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-1.0.160.tgz#000e3b5a3ed91e73a542b4caa202a6f147d91294" + integrity sha512-XfAFU6sRPrCSEKlm58WeuPw8lUoJK+KwO0tcbT+bB2Nb7XCHplskryEgk/PM9ujRU6SMPDx11zKeqRebHlycbA== dependencies: "@techpass/passport-openidconnect" "^0.3.0" aws-sdk "^2.901.0" @@ -321,12 +321,12 @@ uuid "^8.3.2" zlib "^1.0.5" -"@budibase/pro@1.0.154": - version "1.0.154" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.154.tgz#f4e31e30376b206159b711224038141d73a1118e" - integrity sha512-+O6bemrcgyWG4a+D5dIOoZ+LGjW4aN7tRdFeZqoaIPCc1pA6zNtLUkM1nb+Laafuwq2Aht37vEuaRy7jfzVprA== +"@budibase/pro@1.0.160": + version "1.0.160" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-1.0.160.tgz#921c4e3f65b866d84292644dfd8793c4d0b667c7" + integrity sha512-p+Jhnk1n98CWCJXydSQSO7a+HDpqGAHekGQbOR7aayuwuoYzyOXxTcHNLdBp+3lkXhLSZq9oIwfEGpgdrrhXPA== dependencies: - "@budibase/backend-core" "1.0.154" + "@budibase/backend-core" "1.0.160" node-fetch "^2.6.1" "@cspotcode/source-map-consumer@0.8.0": From b98476349ea211056e54e6e30c88b3ccde25277d Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 16 May 2022 23:22:33 +0100 Subject: [PATCH 25/27] editing getPlatformUrl for cloud --- .../middleware/passport/datasource/google.js | 24 ++++++++++++------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/packages/backend-core/src/middleware/passport/datasource/google.js b/packages/backend-core/src/middleware/passport/datasource/google.js index 96c7f99953..9b8019575c 100644 --- a/packages/backend-core/src/middleware/passport/datasource/google.js +++ b/packages/backend-core/src/middleware/passport/datasource/google.js @@ -1,7 +1,7 @@ const google = require("../google") const { Cookies, Configs } = require("../../../constants") const { clearCookie, getCookie } = require("../../../utils") -const { getScopedConfig, getPlatformUrl } = require("../../../db/utils") +const { getScopedConfig } = require("../../../db/utils") const { doWithDB } = require("../../../db") const environment = require("../../../environment") const { getGlobalDB } = require("../../../tenancy") @@ -21,20 +21,28 @@ async function fetchGoogleCreds() { ) } -async function platformUrl() { +async function getPlatformUrl() { + let platformUrl = environment.PLATFORM_URL || "http://localhost:10000" + const db = getGlobalDB() - const publicConfig = await getScopedConfig(db, { + const settings = await getScopedConfig(db, { type: Configs.SETTINGS, }) - return getPlatformUrl(publicConfig) + + // self hosted - check for platform url override + if (settings && settings.platformUrl) { + platformUrl = settings.platformUrl + } + + return platformUrl } async function preAuth(passport, ctx, next) { // get the relevant config const googleConfig = await fetchGoogleCreds() - const platUrl = await platformUrl() + const platformUrl = await getPlatformUrl() - let callbackUrl = `${platUrl}/api/global/auth/datasource/google/callback` + let callbackUrl = `${platformUrl}/api/global/auth/datasource/google/callback` const strategy = await google.strategyFactory(googleConfig, callbackUrl) if (!ctx.query.appId || !ctx.query.datasourceId) { @@ -51,9 +59,9 @@ async function preAuth(passport, ctx, next) { async function postAuth(passport, ctx, next) { // get the relevant config const config = await fetchGoogleCreds() - const platUrl = await platformUrl() + const platformUrl = await getPlatformUrl() - let callbackUrl = `${platUrl}/api/global/auth/datasource/google/callback` + let callbackUrl = `${platformUrl}/api/global/auth/datasource/google/callback` const strategy = await google.strategyFactory( config, callbackUrl, From 0a71979ebcb48d595950354461d6c85740981f54 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 16 May 2022 22:37:40 +0000 Subject: [PATCH 26/27] v1.0.163 --- lerna.json | 2 +- packages/backend-core/package.json | 2 +- packages/bbui/package.json | 4 ++-- packages/builder/package.json | 10 +++++----- packages/cli/package.json | 2 +- packages/client/package.json | 8 ++++---- packages/frontend-core/package.json | 4 ++-- packages/server/package.json | 8 ++++---- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 24 insertions(+), 24 deletions(-) diff --git a/lerna.json b/lerna.json index 06a5b72839..99915ab67b 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "1.0.162", + "version": "1.0.163", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index eb89f5e928..68df3f3f4c 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "1.0.162", + "version": "1.0.163", "description": "Budibase backend core libraries used in server and worker", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 9a8c06ce28..3147880fcb 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": "1.0.162", + "version": "1.0.163", "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": "^1.0.162", + "@budibase/string-templates": "^1.0.163", "@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 b9ad63957a..95611c6713 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "1.0.162", + "version": "1.0.163", "license": "GPL-3.0", "private": true, "scripts": { @@ -67,10 +67,10 @@ } }, "dependencies": { - "@budibase/bbui": "^1.0.162", - "@budibase/client": "^1.0.162", - "@budibase/frontend-core": "^1.0.162", - "@budibase/string-templates": "^1.0.162", + "@budibase/bbui": "^1.0.163", + "@budibase/client": "^1.0.163", + "@budibase/frontend-core": "^1.0.163", + "@budibase/string-templates": "^1.0.163", "@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 7f3ad11bd7..340f51c434 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "1.0.162", + "version": "1.0.163", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 34b2a93b0f..64f8b2a32c 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "1.0.162", + "version": "1.0.163", "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": "^1.0.162", - "@budibase/frontend-core": "^1.0.162", - "@budibase/string-templates": "^1.0.162", + "@budibase/bbui": "^1.0.163", + "@budibase/frontend-core": "^1.0.163", + "@budibase/string-templates": "^1.0.163", "@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 0745ede083..c10eedf983 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "1.0.162", + "version": "1.0.163", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^1.0.162", + "@budibase/bbui": "^1.0.163", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/server/package.json b/packages/server/package.json index b3d237edbf..70282f737a 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "1.0.162", + "version": "1.0.163", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -69,10 +69,10 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "^10.0.3", - "@budibase/backend-core": "^1.0.162", - "@budibase/client": "^1.0.162", + "@budibase/backend-core": "^1.0.163", + "@budibase/client": "^1.0.163", "@budibase/pro": "1.0.162", - "@budibase/string-templates": "^1.0.162", + "@budibase/string-templates": "^1.0.163", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", "@elastic/elasticsearch": "7.10.0", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index b5f21c2013..b054ba9d65 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "1.0.162", + "version": "1.0.163", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index f6687e3f26..12c6bb7e0f 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "1.0.162", + "version": "1.0.163", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -31,9 +31,9 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^1.0.162", + "@budibase/backend-core": "^1.0.163", "@budibase/pro": "1.0.162", - "@budibase/string-templates": "^1.0.162", + "@budibase/string-templates": "^1.0.163", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "^0.3.0", From 0f2f90aaa5586db941d0110ec1e79889d129d6a9 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Mon, 16 May 2022 22:39:14 +0000 Subject: [PATCH 27/27] Update pro version to 1.0.163 --- packages/server/package.json | 2 +- packages/worker/package.json | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/package.json b/packages/server/package.json index 70282f737a..ecc02aef4f 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -71,7 +71,7 @@ "@apidevtools/swagger-parser": "^10.0.3", "@budibase/backend-core": "^1.0.163", "@budibase/client": "^1.0.163", - "@budibase/pro": "1.0.162", + "@budibase/pro": "1.0.163", "@budibase/string-templates": "^1.0.163", "@bull-board/api": "^3.7.0", "@bull-board/koa": "^3.7.0", diff --git a/packages/worker/package.json b/packages/worker/package.json index 12c6bb7e0f..987c54c5c0 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -32,7 +32,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^1.0.163", - "@budibase/pro": "1.0.162", + "@budibase/pro": "1.0.163", "@budibase/string-templates": "^1.0.163", "@koa/router": "^8.0.0", "@sentry/node": "6.17.7",