From 32e6c5bd7a1e844285b24c6753d042ff3f1b0cdb Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 6 Oct 2022 18:19:00 +0100 Subject: [PATCH 01/22] UI fixes --- .../src/components/backend/DataTable/modals/EditRoles.svelte | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte index e2ccab11af..c2e3db497a 100644 --- a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte @@ -37,6 +37,7 @@ const id = event?.detail const role = $roles.find(role => role._id === id) if (role) { + console.log("INH ", role.inherits) selectedRole = { ...role, inherits: role.inherits ?? "", @@ -124,7 +125,7 @@ role._id} getOptionLabel={role => role.name} disabled={builtInRoles.includes(selectedRole.name)} From c9f3dc7fe4aa1e49560fe86297c0b424b0eb392a Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Thu, 6 Oct 2022 19:22:18 +0100 Subject: [PATCH 03/22] Don't allow duplicate roles --- .../backend/DataTable/modals/EditRoles.svelte | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte index 881d9dda7c..600e331d3e 100644 --- a/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte +++ b/packages/builder/src/components/backend/DataTable/modals/EditRoles.svelte @@ -17,12 +17,21 @@ $: selectedRoleId = selectedRole._id $: otherRoles = editableRoles.filter(role => role._id !== selectedRoleId) $: isCreating = selectedRoleId == null || selectedRoleId === "" + + $: hasUniqueRoleName = !otherRoles + ?.map(role => role.name) + ?.includes(selectedRole.name) + $: valid = selectedRole.name && selectedRole.inherits && selectedRole.permissionId && !builtInRoles.includes(selectedRole.name) + $: shouldDisableRoleInput = + builtInRoles.includes(selectedRole.name) && + selectedRole.name?.toLowerCase() === selectedRoleId?.toLowerCase() + const fetchBasePermissions = async () => { try { basePermissions = await API.getBasePermissions() @@ -99,7 +108,7 @@ title="Edit Roles" confirmText={isCreating ? "Create" : "Save"} onConfirm={saveRole} - disabled={!valid} + disabled={!valid || !hasUniqueRoleName} > {#if errors.length} @@ -119,7 +128,8 @@ x._id} getOptionLabel={x => x.name} - disabled={builtInRoles.includes(selectedRole.name)} + disabled={shouldDisableRoleInput} /> {/if}
From 197d195cb464ee44f7e515e64a575404262f053b Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 7 Oct 2022 16:05:01 +0100 Subject: [PATCH 04/22] Switching from scan for app locks to mget - which is a fast O(N) operation that only retrieves what we need. --- packages/backend-core/src/redis/index.ts | 25 +++++++++++++++++++ .../server/src/api/controllers/application.ts | 17 ++++++------- packages/server/src/utilities/redis.js | 8 ++---- 3 files changed, 35 insertions(+), 15 deletions(-) diff --git a/packages/backend-core/src/redis/index.ts b/packages/backend-core/src/redis/index.ts index 206110366f..62e718d8ad 100644 --- a/packages/backend-core/src/redis/index.ts +++ b/packages/backend-core/src/redis/index.ts @@ -214,6 +214,31 @@ export = class RedisWrapper { } } + async bulkGet(keys: string[]) { + const db = this._db + const prefixedKeys = keys.map(key => addDbPrefix(db, key)) + let response = await this.getClient().mget(prefixedKeys) + if (Array.isArray(response)) { + let final: any = {} + let count = 0 + for (let result of response) { + if (result) { + let parsed + try { + parsed = JSON.parse(result) + } catch (err) { + parsed = result + } + final[keys[count]] = parsed + } + count++ + } + return final + } else { + throw new Error(`Invalid response: ${response}`) + } + } + async store(key: string, value: any, expirySeconds: number | null = null) { const db = this._db if (typeof value === "object") { diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index b6377a61a2..e8af2f54f8 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -32,7 +32,7 @@ const { import { USERS_TABLE_SCHEMA } from "../../constants" import { removeAppFromUserRoles } from "../../utilities/workerRequests" import { clientLibraryPath, stringToReadStream } from "../../utilities" -import { getAllLocks } from "../../utilities/redis" +import { getLocksById } from "../../utilities/redis" import { updateClientLibrary, backupClientLibrary, @@ -45,11 +45,10 @@ import { cleanupAutomations } from "../../automations/utils" import { context } from "@budibase/backend-core" import { checkAppMetadata } from "../../automations/logging" import { getUniqueRows } from "../../utilities/usageQuota/rows" -import { quotas } from "@budibase/pro" +import { quotas, groups } from "@budibase/pro" import { errors, events, migrations } from "@budibase/backend-core" import { App, Layout, Screen, MigrationType } from "@budibase/types" import { BASE_LAYOUT_PROP_IDS } from "../../constants/layouts" -import { groups } from "@budibase/pro" import { enrichPluginURLs } from "../../utilities/plugins" const URL_REGEX_SLASH = /\/|\\/g @@ -172,16 +171,16 @@ export const fetch = async (ctx: any) => { const all = ctx.query && ctx.query.status === AppStatus.ALL const apps = await getAllApps({ dev, all }) + const appIds = apps + .filter((app: any) => app.status === "development") + .map((app: any) => app.appId) // get the locks for all the dev apps if (dev || all) { - const locks = await getAllLocks() + const locks = await getLocksById(appIds) for (let app of apps) { - if (app.status !== "development") { - continue - } - const lock = locks.find((lock: any) => lock.appId === app.appId) + const lock = locks[app.appId] if (lock) { - app.lockedBy = lock.user + app.lockedBy = lock } else { // make sure its definitely not present delete app.lockedBy diff --git a/packages/server/src/utilities/redis.js b/packages/server/src/utilities/redis.js index 4eddca6e4a..b39b7cae55 100644 --- a/packages/server/src/utilities/redis.js +++ b/packages/server/src/utilities/redis.js @@ -34,12 +34,8 @@ exports.doesUserHaveLock = async (devAppId, user) => { return expected === userId } -exports.getAllLocks = async () => { - const locks = await devAppClient.scan() - return locks.map(lock => ({ - appId: lock.key, - user: lock.value, - })) +exports.getLocksById = async appIds => { + return await devAppClient.bulkGet(appIds) } exports.updateLock = async (devAppId, user) => { From d80c966cf137a0e6fd5a59c93edeb5d614c61009 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Fri, 7 Oct 2022 16:24:04 +0100 Subject: [PATCH 05/22] Fixing test mocks. --- packages/server/src/api/routes/tests/application.spec.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/server/src/api/routes/tests/application.spec.js b/packages/server/src/api/routes/tests/application.spec.js index dcfc2c6d9b..f62665d184 100644 --- a/packages/server/src/api/routes/tests/application.spec.js +++ b/packages/server/src/api/routes/tests/application.spec.js @@ -1,7 +1,7 @@ jest.mock("../../../utilities/redis", () => ({ init: jest.fn(), - getAllLocks: () => { - return [] + getLocksById: () => { + return {} }, doesUserHaveLock: () => { return true From 15723e38d81bca73c04fa9b53ef20195c3e650ae Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 7 Oct 2022 17:16:16 +0000 Subject: [PATCH 06/22] v2.0.24 --- 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 bc62b3c368..b2ce7d106f 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.0.23", + "version": "2.0.24", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index a9c1e3eb59..163cf61187 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/backend-core", - "version": "2.0.23", + "version": "2.0.24", "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.0.23", + "@budibase/types": "^2.0.24", "@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 3ca5585e34..86b1990e80 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.0.23", + "version": "2.0.24", "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.0.23", + "@budibase/string-templates": "^2.0.24", "@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 6f289d3433..07f53bcd05 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "2.0.23", + "version": "2.0.24", "license": "GPL-3.0", "private": true, "scripts": { @@ -71,10 +71,10 @@ } }, "dependencies": { - "@budibase/bbui": "^2.0.23", - "@budibase/client": "^2.0.23", - "@budibase/frontend-core": "^2.0.23", - "@budibase/string-templates": "^2.0.23", + "@budibase/bbui": "^2.0.24", + "@budibase/client": "^2.0.24", + "@budibase/frontend-core": "^2.0.24", + "@budibase/string-templates": "^2.0.24", "@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 e054839f25..a4d98d9daf 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "2.0.23", + "version": "2.0.24", "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.0.23", - "@budibase/string-templates": "^2.0.23", - "@budibase/types": "^2.0.23", + "@budibase/backend-core": "^2.0.24", + "@budibase/string-templates": "^2.0.24", + "@budibase/types": "^2.0.24", "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 f22039ae4f..9c1222c0c3 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "2.0.23", + "version": "2.0.24", "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.0.23", - "@budibase/frontend-core": "^2.0.23", - "@budibase/string-templates": "^2.0.23", + "@budibase/bbui": "^2.0.24", + "@budibase/frontend-core": "^2.0.24", + "@budibase/string-templates": "^2.0.24", "@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 3942ad481b..d028ae43c7 100644 --- a/packages/frontend-core/package.json +++ b/packages/frontend-core/package.json @@ -1,12 +1,12 @@ { "name": "@budibase/frontend-core", - "version": "2.0.23", + "version": "2.0.24", "description": "Budibase frontend core libraries used in builder and client", "author": "Budibase", "license": "MPL-2.0", "svelte": "src/index.js", "dependencies": { - "@budibase/bbui": "^2.0.23", + "@budibase/bbui": "^2.0.24", "lodash": "^4.17.21", "svelte": "^3.46.2" } diff --git a/packages/sdk/package.json b/packages/sdk/package.json index 59bd24e4ca..ebfd81e7b2 100644 --- a/packages/sdk/package.json +++ b/packages/sdk/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/sdk", - "version": "2.0.23", + "version": "2.0.24", "description": "Budibase Public API SDK", "author": "Budibase", "license": "MPL-2.0", diff --git a/packages/server/package.json b/packages/server/package.json index e9eca4136d..8d085e2ab7 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "2.0.23", + "version": "2.0.24", "description": "Budibase Web Server", "main": "src/index.ts", "repository": { @@ -77,11 +77,11 @@ "license": "GPL-3.0", "dependencies": { "@apidevtools/swagger-parser": "10.0.3", - "@budibase/backend-core": "^2.0.23", - "@budibase/client": "^2.0.23", + "@budibase/backend-core": "^2.0.24", + "@budibase/client": "^2.0.24", "@budibase/pro": "2.0.23", - "@budibase/string-templates": "^2.0.23", - "@budibase/types": "^2.0.23", + "@budibase/string-templates": "^2.0.24", + "@budibase/types": "^2.0.24", "@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 651034e3fd..23a7109cd4 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "2.0.23", + "version": "2.0.24", "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 8c1b53a33b..a36cabc46e 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/types", - "version": "2.0.23", + "version": "2.0.24", "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 9763d42abf..c2e690fe01 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "2.0.23", + "version": "2.0.24", "description": "Budibase background service", "main": "src/index.ts", "repository": { @@ -36,10 +36,10 @@ "author": "Budibase", "license": "GPL-3.0", "dependencies": { - "@budibase/backend-core": "^2.0.23", + "@budibase/backend-core": "^2.0.24", "@budibase/pro": "2.0.23", - "@budibase/string-templates": "^2.0.23", - "@budibase/types": "^2.0.23", + "@budibase/string-templates": "^2.0.24", + "@budibase/types": "^2.0.24", "@koa/router": "8.0.8", "@sentry/node": "6.17.7", "@techpass/passport-openidconnect": "0.3.2", From a0cc4a1b2194c60da44971a568b2e852b6855a12 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 7 Oct 2022 17:19:31 +0000 Subject: [PATCH 07/22] Update pro version to 2.0.24 --- 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 8d085e2ab7..36e723d0e9 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -79,7 +79,7 @@ "@apidevtools/swagger-parser": "10.0.3", "@budibase/backend-core": "^2.0.24", "@budibase/client": "^2.0.24", - "@budibase/pro": "2.0.23", + "@budibase/pro": "2.0.24", "@budibase/string-templates": "^2.0.24", "@budibase/types": "^2.0.24", "@bull-board/api": "3.7.0", diff --git a/packages/server/yarn.lock b/packages/server/yarn.lock index d70aabbcf7..e005d36235 100644 --- a/packages/server/yarn.lock +++ b/packages/server/yarn.lock @@ -1094,12 +1094,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.0.23": - version "2.0.23" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.23.tgz#915d4ea2e78547795894b2aebd81b8a8c9b568db" - integrity sha512-wovJF+kS/vVs+cR6lHieEEs99vmXsOt5qKjMAkkMUVXmWBWPYQaLppz+dxTV9xXd8Ht9yFhnkbOo7QJxFE8+fA== +"@budibase/backend-core@2.0.24": + version "2.0.24" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.24.tgz#305be50481095441aeb663add4271c06b0d98435" + integrity sha512-yq/TwV1GWGeAZgn8FrSVAk0tNXFQLvduoKrwy4f2EsR26R5y6uxp2B0igP0sKMvUJPjTNPBONJM0MdYx9JBSmA== dependencies: - "@budibase/types" "^2.0.23" + "@budibase/types" "^2.0.24" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -1180,13 +1180,13 @@ svelte-flatpickr "^3.2.3" svelte-portal "^1.0.0" -"@budibase/pro@2.0.23": - version "2.0.23" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.23.tgz#215759f07470d37b6571f54ad80d7fb38a2f902e" - integrity sha512-RP7lS076VP3W+9AI9d/ylM6k1YBotGlqkBrshgzX/pl1e2O9eg0MmG2/dP6X+w4LzGv2ruC7lfwyf3MgWgYFyQ== +"@budibase/pro@2.0.24": + version "2.0.24" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.24.tgz#d678753a28fc44f4f476120c8fb7b01365b5e18b" + integrity sha512-j/wsd1RCvTGodRAvD9GJZ9JDivGxMuFDAmrQlvcq5ffrqX2VDm0dSP/F+8YZFck4hdSmcL5VeqxZCPh2kx74vA== dependencies: - "@budibase/backend-core" "2.0.23" - "@budibase/types" "2.0.23" + "@budibase/backend-core" "2.0.24" + "@budibase/types" "2.0.24" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" @@ -1209,10 +1209,10 @@ svelte-apexcharts "^1.0.2" svelte-flatpickr "^3.1.0" -"@budibase/types@2.0.23", "@budibase/types@^2.0.23": - version "2.0.23" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.23.tgz#2467342b9c48c965319182ef4cbb7166c8bf1e43" - integrity sha512-Oyq9tVwV+zl38III1or4Cr8VOKemMv3L/o95CBXdyZRDmmVfdzQgJ7AByUMOj9quEe6IjctdkOI4ssE8Fds9Dw== +"@budibase/types@2.0.24", "@budibase/types@^2.0.24": + version "2.0.24" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.24.tgz#8ac0615b17d3f46809b10897b3217a86b6d2a62e" + integrity sha512-Lo1NGnu+4PH0OLjwxRU5dqEAADEBOCkikQtAjapVFIZWcBit0ZC/bXTs6meIaey6JqqEKOlDR5V+VwrzcmdUIA== "@bull-board/api@3.7.0": version "3.7.0" diff --git a/packages/worker/package.json b/packages/worker/package.json index c2e690fe01..ad7db4639b 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -37,7 +37,7 @@ "license": "GPL-3.0", "dependencies": { "@budibase/backend-core": "^2.0.24", - "@budibase/pro": "2.0.23", + "@budibase/pro": "2.0.24", "@budibase/string-templates": "^2.0.24", "@budibase/types": "^2.0.24", "@koa/router": "8.0.8", diff --git a/packages/worker/yarn.lock b/packages/worker/yarn.lock index f885ab690e..e0d3c1cb1c 100644 --- a/packages/worker/yarn.lock +++ b/packages/worker/yarn.lock @@ -291,12 +291,12 @@ resolved "https://registry.yarnpkg.com/@bcoe/v8-coverage/-/v8-coverage-0.2.3.tgz#75a2e8b51cb758a7553d6804a5932d7aace75c39" integrity sha512-0hYQ8SB4Db5zvZB4axdMHGwEaQjkZzFjQiN9LVYvIFB2nSUHW9tYpxWriPrWDASIxiaXax83REcLxuSdnGPZtw== -"@budibase/backend-core@2.0.23": - version "2.0.23" - resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.23.tgz#915d4ea2e78547795894b2aebd81b8a8c9b568db" - integrity sha512-wovJF+kS/vVs+cR6lHieEEs99vmXsOt5qKjMAkkMUVXmWBWPYQaLppz+dxTV9xXd8Ht9yFhnkbOo7QJxFE8+fA== +"@budibase/backend-core@2.0.24": + version "2.0.24" + resolved "https://registry.yarnpkg.com/@budibase/backend-core/-/backend-core-2.0.24.tgz#305be50481095441aeb663add4271c06b0d98435" + integrity sha512-yq/TwV1GWGeAZgn8FrSVAk0tNXFQLvduoKrwy4f2EsR26R5y6uxp2B0igP0sKMvUJPjTNPBONJM0MdYx9JBSmA== dependencies: - "@budibase/types" "^2.0.23" + "@budibase/types" "^2.0.24" "@shopify/jest-koa-mocks" "5.0.1" "@techpass/passport-openidconnect" "0.3.2" aws-sdk "2.1030.0" @@ -327,21 +327,21 @@ uuid "8.3.2" zlib "1.0.5" -"@budibase/pro@2.0.23": - version "2.0.23" - resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.23.tgz#215759f07470d37b6571f54ad80d7fb38a2f902e" - integrity sha512-RP7lS076VP3W+9AI9d/ylM6k1YBotGlqkBrshgzX/pl1e2O9eg0MmG2/dP6X+w4LzGv2ruC7lfwyf3MgWgYFyQ== +"@budibase/pro@2.0.24": + version "2.0.24" + resolved "https://registry.yarnpkg.com/@budibase/pro/-/pro-2.0.24.tgz#d678753a28fc44f4f476120c8fb7b01365b5e18b" + integrity sha512-j/wsd1RCvTGodRAvD9GJZ9JDivGxMuFDAmrQlvcq5ffrqX2VDm0dSP/F+8YZFck4hdSmcL5VeqxZCPh2kx74vA== dependencies: - "@budibase/backend-core" "2.0.23" - "@budibase/types" "2.0.23" + "@budibase/backend-core" "2.0.24" + "@budibase/types" "2.0.24" "@koa/router" "8.0.8" joi "17.6.0" node-fetch "^2.6.1" -"@budibase/types@2.0.23", "@budibase/types@^2.0.23": - version "2.0.23" - resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.23.tgz#2467342b9c48c965319182ef4cbb7166c8bf1e43" - integrity sha512-Oyq9tVwV+zl38III1or4Cr8VOKemMv3L/o95CBXdyZRDmmVfdzQgJ7AByUMOj9quEe6IjctdkOI4ssE8Fds9Dw== +"@budibase/types@2.0.24", "@budibase/types@^2.0.24": + version "2.0.24" + resolved "https://registry.yarnpkg.com/@budibase/types/-/types-2.0.24.tgz#8ac0615b17d3f46809b10897b3217a86b6d2a62e" + integrity sha512-Lo1NGnu+4PH0OLjwxRU5dqEAADEBOCkikQtAjapVFIZWcBit0ZC/bXTs6meIaey6JqqEKOlDR5V+VwrzcmdUIA== "@cspotcode/source-map-consumer@0.8.0": version "0.8.0" From 5838eb70b4a6bbfacb4b7d3b7fdb3e45e1d69b5c Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 10 Oct 2022 09:02:17 +0100 Subject: [PATCH 08/22] turn on gsheets --- packages/server/src/api/controllers/integration.js | 8 -------- packages/server/src/integrations/index.ts | 5 +---- 2 files changed, 1 insertion(+), 12 deletions(-) diff --git a/packages/server/src/api/controllers/integration.js b/packages/server/src/api/controllers/integration.js index 3d1643601b..2f11ec19ed 100644 --- a/packages/server/src/api/controllers/integration.js +++ b/packages/server/src/api/controllers/integration.js @@ -1,17 +1,9 @@ const { getDefinitions } = require("../../integrations") -const { SourceName } = require("@budibase/types") -const googlesheets = require("../../integrations/googlesheets") -const { featureFlags } = require("@budibase/backend-core") exports.fetch = async function (ctx) { ctx.status = 200 const defs = await getDefinitions() - // for google sheets integration google verification - if (featureFlags.isEnabled(featureFlags.TenantFeatureFlag.GOOGLE_SHEETS)) { - defs[SourceName.GOOGLE_SHEETS] = googlesheets.schema - } - ctx.body = defs } diff --git a/packages/server/src/integrations/index.ts b/packages/server/src/integrations/index.ts index 240f68ed91..c926aeb992 100644 --- a/packages/server/src/integrations/index.ts +++ b/packages/server/src/integrations/index.ts @@ -33,6 +33,7 @@ const DEFINITIONS: { [key: string]: Integration } = { [SourceName.ARANGODB]: arangodb.schema, [SourceName.REST]: rest.schema, [SourceName.FIRESTORE]: firebase.schema, + [SourceName.GOOGLE_SHEETS]: googlesheets.schema, [SourceName.REDIS]: redis.schema, [SourceName.SNOWFLAKE]: snowflake.schema, } @@ -66,10 +67,6 @@ if ( INTEGRATIONS[SourceName.ORACLE] = oracle.integration } -if (environment.SELF_HOSTED) { - DEFINITIONS[SourceName.GOOGLE_SHEETS] = googlesheets.schema -} - module.exports = { getDefinitions: async () => { const pluginSchemas: { [key: string]: Integration } = {} From 536b7238e93b826af375a5ab83719a04ebce8f4f Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Mon, 10 Oct 2022 11:00:45 +0100 Subject: [PATCH 09/22] redis fix for new instances, removing relationship options from google sheets integration --- packages/backend-core/src/redis/index.ts | 3 ++ .../PlusConfigForm.svelte | 44 ++++++++++--------- 2 files changed, 26 insertions(+), 21 deletions(-) diff --git a/packages/backend-core/src/redis/index.ts b/packages/backend-core/src/redis/index.ts index 62e718d8ad..8a15320ff3 100644 --- a/packages/backend-core/src/redis/index.ts +++ b/packages/backend-core/src/redis/index.ts @@ -216,6 +216,9 @@ export = class RedisWrapper { async bulkGet(keys: string[]) { const db = this._db + if (keys.length === 0) { + return {} + } const prefixedKeys = keys.map(key => addDbPrefix(db, key)) let response = await this.getClient().mget(prefixedKeys) if (Array.isArray(response)) { diff --git a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte index cef49d81a1..ff413094a0 100644 --- a/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte +++ b/packages/builder/src/components/backend/DatasourceNavigator/TableIntegrationMenu/PlusConfigForm.svelte @@ -209,27 +209,29 @@ {:else} No tables found. {/if} - -
- Relationships - -
- - Tell budibase how your tables are related to get even more smart features. - -{#if relationshipInfo && relationshipInfo.length > 0} - openRelationshipModal(detail.from, detail.to)} - schema={relationshipSchema} - data={relationshipInfo} - allowEditColumns={false} - allowEditRows={false} - allowSelectRows={false} - /> -{:else} - No relationships configured. +{#if integration.relationships !== false} + +
+ Relationships + +
+ + Tell budibase how your tables are related to get even more smart features. + + {#if relationshipInfo && relationshipInfo.length > 0} +
openRelationshipModal(detail.from, detail.to)} + schema={relationshipSchema} + data={relationshipInfo} + allowEditColumns={false} + allowEditRows={false} + allowSelectRows={false} + /> + {:else} + No relationships configured. + {/if} {/if}