From 22bab5052b71191759e52d55b788e0f1bac2e485 Mon Sep 17 00:00:00 2001 From: poirazis Date: Sat, 20 Jan 2024 23:11:31 +0200 Subject: [PATCH 01/11] commit --- packages/client/src/sdk.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/packages/client/src/sdk.js b/packages/client/src/sdk.js index 04499c01ab..d7612f9868 100644 --- a/packages/client/src/sdk.js +++ b/packages/client/src/sdk.js @@ -28,6 +28,7 @@ import { fetchDatasourceSchema } from "./utils/schema.js" import { getAPIKey } from "./utils/api.js" import { enrichButtonActions } from "./utils/buttonActions.js" import { processStringSync, makePropSafe } from "@budibase/string-templates" +import { fetchData, LuceneUtils } from "@budibase/frontend-core" export default { API, @@ -54,6 +55,8 @@ export default { linkable, getAction, fetchDatasourceSchema, + fetchData, + LuceneUtils, getAPIKey, enrichButtonActions, processStringSync, From 58fedd10f540d1a3c2700e8a83a9eb95ff25155e Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 26 Jan 2024 09:21:13 +0000 Subject: [PATCH 02/11] fix issue with automation not triggering when no fields existed --- packages/client/src/utils/buttonActions.js | 36 ++++++++++------------ 1 file changed, 17 insertions(+), 19 deletions(-) diff --git a/packages/client/src/utils/buttonActions.js b/packages/client/src/utils/buttonActions.js index 9b4640dbb4..12fc66270a 100644 --- a/packages/client/src/utils/buttonActions.js +++ b/packages/client/src/utils/buttonActions.js @@ -160,29 +160,27 @@ const deleteRowHandler = async action => { const triggerAutomationHandler = async action => { const { fields, notificationOverride, timeout } = action.parameters - if (fields) { - try { - const result = await API.triggerAutomation({ - automationId: action.parameters.automationId, - fields, - timeout, - }) - - // Value will exist if automation is synchronous, so return it. - if (result.value) { - if (!notificationOverride) { - notificationStore.actions.success("Automation ran successfully") - } - return { result } - } + try { + const result = await API.triggerAutomation({ + automationId: action.parameters.automationId, + fields, + timeout, + }) + // Value will exist if automation is synchronous, so return it. + if (result.value) { if (!notificationOverride) { - notificationStore.actions.success("Automation triggered") + notificationStore.actions.success("Automation ran successfully") } - } catch (error) { - // Abort next actions - return false + return { result } } + + if (!notificationOverride) { + notificationStore.actions.success("Automation triggered") + } + } catch (error) { + // Abort next actions + return false } } const navigationHandler = action => { From 84b2a36fda1d00bdba3381ee6d4446092613aa4c Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Fri, 26 Jan 2024 12:10:46 +0000 Subject: [PATCH 03/11] fix case where trigger fields could be undefined --- .../automation/SetupPanel/AutomationBlockSetup.svelte | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index af54e4d2da..5950747237 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -157,6 +157,7 @@ let bindings = [] let loopBlockCount = 0 const addBinding = (name, value, icon, idx, isLoopBlock, bindingName) => { + if (!name) return const runtimeBinding = determineRuntimeBinding(name, idx, isLoopBlock) const categoryName = determineCategoryName(idx, isLoopBlock, bindingName) @@ -291,7 +292,7 @@ loopBlockCount++ continue } - + console.log(schema) Object.entries(schema).forEach(([name, value]) => addBinding(name, value, icon, idx, isLoopBlock, bindingName) ) From 9c47671032f7d0fa16ad856853886e4a7fb1a24b Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 30 Jan 2024 15:39:12 +0000 Subject: [PATCH 04/11] fix issue with automation setting sync --- packages/builder/src/builderStore/store/frontend.js | 1 + .../automation/SetupPanel/AutomationBlockSetup.svelte | 1 - .../app/[application]/settings/automations/index.svelte | 5 +---- packages/server/src/api/controllers/application.ts | 3 +++ 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/builderStore/store/frontend.js b/packages/builder/src/builderStore/store/frontend.js index ff7c0d74b8..c649a58504 100644 --- a/packages/builder/src/builderStore/store/frontend.js +++ b/packages/builder/src/builderStore/store/frontend.js @@ -158,6 +158,7 @@ export const getFrontendStore = () => { ...INITIAL_FRONTEND_STATE.features, ...application.features, }, + automations: application.automations || {}, icon: application.icon || {}, initialised: true, })) diff --git a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte index 5950747237..a9e7ab0d39 100644 --- a/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte +++ b/packages/builder/src/components/automation/SetupPanel/AutomationBlockSetup.svelte @@ -292,7 +292,6 @@ loopBlockCount++ continue } - console.log(schema) Object.entries(schema).forEach(([name, value]) => addBinding(name, value, icon, idx, isLoopBlock, bindingName) ) diff --git a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte index fde392e31d..9c45eb7eb1 100644 --- a/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte +++ b/packages/builder/src/pages/builder/app/[application]/settings/automations/index.svelte @@ -36,15 +36,12 @@ let status = null let timeRange = null let loaded = false - - $: app = $apps.find(app => app.devId === $store.appId?.includes(app.appId)) + $: app = $apps.find(app => $store.appId?.includes(app.appId)) $: licensePlan = $auth.user?.license?.plan $: page = $pageInfo.page $: fetchLogs(automationId, status, page, timeRange) $: isCloud = $admin.cloud - $: chainAutomations = app?.automations?.chainAutomations ?? !isCloud - const timeOptions = [ { value: "90-d", label: "Past 90 days" }, { value: "30-d", label: "Past 30 days" }, diff --git a/packages/server/src/api/controllers/application.ts b/packages/server/src/api/controllers/application.ts index 70298c7172..33582cf656 100644 --- a/packages/server/src/api/controllers/application.ts +++ b/packages/server/src/api/controllers/application.ts @@ -445,6 +445,9 @@ export async function update(ctx: UserCtx) { name: app.name, url: app.url, icon: app.icon, + automations: { + chainAutomations: app.automations?.chainAutomations, + }, }) } From f3e0dfd46686a12a031e3484d11d7daa99ad3de6 Mon Sep 17 00:00:00 2001 From: Sam Rose Date: Wed, 31 Jan 2024 11:55:29 +0000 Subject: [PATCH 05/11] Update to @budibase/nano 10.1.5 --- packages/backend-core/package.json | 2 +- packages/types/package.json | 2 +- yarn.lock | 8 ++++---- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/packages/backend-core/package.json b/packages/backend-core/package.json index d6325e1de9..85644488f5 100644 --- a/packages/backend-core/package.json +++ b/packages/backend-core/package.json @@ -21,7 +21,7 @@ "test:watch": "jest --watchAll" }, "dependencies": { - "@budibase/nano": "10.1.4", + "@budibase/nano": "10.1.5", "@budibase/pouchdb-replication-stream": "1.2.10", "@budibase/shared-core": "0.0.0", "@budibase/types": "0.0.0", diff --git a/packages/types/package.json b/packages/types/package.json index 5111339c7b..ce4fce95fb 100644 --- a/packages/types/package.json +++ b/packages/types/package.json @@ -15,7 +15,7 @@ }, "jest": {}, "devDependencies": { - "@budibase/nano": "10.1.4", + "@budibase/nano": "10.1.5", "@types/koa": "2.13.4", "@types/pouchdb": "6.4.0", "@types/redlock": "4.0.3", diff --git a/yarn.lock b/yarn.lock index 80d1420edf..2c12097fb5 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2050,10 +2050,10 @@ to-gfm-code-block "^0.1.1" uuid "^9.0.1" -"@budibase/nano@10.1.4": - version "10.1.4" - resolved "https://registry.yarnpkg.com/@budibase/nano/-/nano-10.1.4.tgz#5c2670d0b4c12d736ddd6581c57d47c0aa45efad" - integrity sha512-J+IVaAljGideDvJss/AUxXA1599HEIUJo5c0LLlmc1KMA3GZWZjyX+w2fxAw3qF7hqFvX+qAStQgdcD3+/GPMA== +"@budibase/nano@10.1.5": + version "10.1.5" + resolved "https://registry.yarnpkg.com/@budibase/nano/-/nano-10.1.5.tgz#eeaded7bfc707ecabf8fde604425b865a90c06ec" + integrity sha512-q1eKIsYKo+iK17zsJYd3VBl+5ufQMPpHYLec0wVsid8wnJVrTQk7RNpBlBUn/EDgXM7t8XNNHlERqHu+CxJu8Q== dependencies: "@types/tough-cookie" "^4.0.2" axios "^1.1.3" From a23f76b8c813fd4a6043c816bcc79a69d311fee8 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 31 Jan 2024 08:57:54 -0300 Subject: [PATCH 06/11] update expiry time for attachments/images --- packages/backend-core/src/objectStore/cloudfront.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/backend-core/src/objectStore/cloudfront.ts b/packages/backend-core/src/objectStore/cloudfront.ts index 866fe9e880..3bca97d11e 100644 --- a/packages/backend-core/src/objectStore/cloudfront.ts +++ b/packages/backend-core/src/objectStore/cloudfront.ts @@ -23,7 +23,7 @@ const getCloudfrontSignParams = () => { return { keypairId: env.CLOUDFRONT_PUBLIC_KEY_ID!, privateKeyString: getPrivateKey(), - expireTime: new Date().getTime() + 1000 * 60 * 60, // 1 hour + expireTime: new Date().getTime() + 1000 * 60 * 60 * 24, // 1 day } } From c5fd92cd94eca5a237e887137a987b8d2fe33e82 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 31 Jan 2024 13:19:02 +0000 Subject: [PATCH 07/11] Bump version to 2.16.1 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index f91c51d4bb..328e7f720a 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.16.0", + "version": "2.16.1", "npmClient": "yarn", "packages": [ "packages/*", From 63cc5447d572017005e4370094b5c3d7d7fecca9 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 31 Jan 2024 10:47:27 -0300 Subject: [PATCH 08/11] adding lint rule for console.log --- .eslintrc.json | 6 ++++++ packages/builder/src/builderStore/dataBinding.js | 1 - packages/builder/src/builderStore/websocket.js | 2 +- packages/builder/src/components/common/CodeEditor/index.js | 2 +- .../src/components/portal/onboarding/TourPopover.svelte | 2 +- .../builder/src/components/portal/onboarding/tourHandler.js | 4 ++-- packages/builder/src/components/portal/onboarding/tours.js | 2 +- packages/builder/src/helpers/urlStateSync.js | 2 +- .../app/[application]/_components/BuilderSidePanel.svelte | 2 +- .../[componentId]/_components/Screen/GeneralPanel.svelte | 2 +- .../design/_components/NewScreen/CreateScreenModal.svelte | 2 +- packages/builder/src/pages/builder/auth/login.svelte | 2 +- 12 files changed, 17 insertions(+), 12 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 79f7e56712..4f08698fec 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -45,6 +45,12 @@ "no-prototype-builtins": "off", "local-rules/no-budibase-imports": "error" } + }, + { + "files": ["packages/builder/**/*"], + "rules": { + "no-console": ["error", { "allow": ["warn", "error", "debug"] } ] + } } ], "rules": { diff --git a/packages/builder/src/builderStore/dataBinding.js b/packages/builder/src/builderStore/dataBinding.js index cc3851c318..86aecd466f 100644 --- a/packages/builder/src/builderStore/dataBinding.js +++ b/packages/builder/src/builderStore/dataBinding.js @@ -364,7 +364,6 @@ const getContextBindings = (asset, componentId) => { * Generates a set of bindings for a given component context */ const generateComponentContextBindings = (asset, componentContext) => { - console.log("Hello ") const { component, definition, contexts } = componentContext if (!component || !definition || !contexts?.length) { return [] diff --git a/packages/builder/src/builderStore/websocket.js b/packages/builder/src/builderStore/websocket.js index ca3f49e9a3..4482e3ae1e 100644 --- a/packages/builder/src/builderStore/websocket.js +++ b/packages/builder/src/builderStore/websocket.js @@ -21,7 +21,7 @@ export const createBuilderWebsocket = appId => { }) }) socket.on("connect_error", err => { - console.log("Failed to connect to builder websocket:", err.message) + console.error("Failed to connect to builder websocket:", err.message) }) socket.on("disconnect", () => { userStore.actions.reset() diff --git a/packages/builder/src/components/common/CodeEditor/index.js b/packages/builder/src/components/common/CodeEditor/index.js index 7987deff52..da0e727e4e 100644 --- a/packages/builder/src/components/common/CodeEditor/index.js +++ b/packages/builder/src/components/common/CodeEditor/index.js @@ -312,7 +312,7 @@ export const insertBinding = (view, from, to, text, mode) => { } else if (mode.name == "handlebars") { parsedInsert = hbInsert(view.state.doc?.toString(), from, to, text) } else { - console.log("Unsupported") + console.warn("Unsupported") return } diff --git a/packages/builder/src/components/portal/onboarding/TourPopover.svelte b/packages/builder/src/components/portal/onboarding/TourPopover.svelte index d959a6ef95..cc56715284 100644 --- a/packages/builder/src/components/portal/onboarding/TourPopover.svelte +++ b/packages/builder/src/components/portal/onboarding/TourPopover.svelte @@ -67,7 +67,7 @@ })) navigateStep(target) } else { - console.log("Could not retrieve step") + console.warn("Could not retrieve step") } } else { if (typeof tourStep.onComplete === "function") { diff --git a/packages/builder/src/components/portal/onboarding/tourHandler.js b/packages/builder/src/components/portal/onboarding/tourHandler.js index d4a564f23a..5b44bdc96f 100644 --- a/packages/builder/src/components/portal/onboarding/tourHandler.js +++ b/packages/builder/src/components/portal/onboarding/tourHandler.js @@ -3,11 +3,11 @@ import { get } from "svelte/store" const registerNode = async (node, tourStepKey) => { if (!node) { - console.log("Tour Handler - an anchor node is required") + console.warn("Tour Handler - an anchor node is required") } if (!get(store).tourKey) { - console.log("Tour Handler - No active tour ", tourStepKey, node) + console.error("Tour Handler - No active tour ", tourStepKey, node) return } diff --git a/packages/builder/src/components/portal/onboarding/tours.js b/packages/builder/src/components/portal/onboarding/tours.js index e82026da94..55fd4c4a9b 100644 --- a/packages/builder/src/components/portal/onboarding/tours.js +++ b/packages/builder/src/components/portal/onboarding/tours.js @@ -45,7 +45,7 @@ const endUserOnboarding = async ({ skipped = false } = {}) => { onboarding: false, })) } catch (e) { - console.log("Onboarding failed", e) + console.error("Onboarding failed", e) return false } return true diff --git a/packages/builder/src/helpers/urlStateSync.js b/packages/builder/src/helpers/urlStateSync.js index 2408dde2f1..9337393f06 100644 --- a/packages/builder/src/helpers/urlStateSync.js +++ b/packages/builder/src/helpers/urlStateSync.js @@ -52,7 +52,7 @@ export const syncURLToState = options => { let cachedPage = get(routify.page) let previousParamsHash = null let debug = false - const log = (...params) => debug && console.log(`[${urlParam}]`, ...params) + const log = (...params) => debug && console.debug(`[${urlParam}]`, ...params) // Navigate to a certain URL const gotoUrl = (url, params) => { diff --git a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte index 33116094eb..cd00b36186 100644 --- a/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_components/BuilderSidePanel.svelte @@ -107,7 +107,7 @@ return } if (!prodAppId) { - console.log("Application id required") + console.error("Application id required") return } await usersFetch.update({ diff --git a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/GeneralPanel.svelte b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/GeneralPanel.svelte index fb9ee2c8a5..b2bcd3daa4 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/GeneralPanel.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/[screenId]/[componentId]/_components/Screen/GeneralPanel.svelte @@ -66,7 +66,7 @@ try { await store.actions.screens.updateSetting(get(selectedScreen), key, value) } catch (error) { - console.log(error) + console.error(error) notifications.error("Error saving screen settings") } } diff --git a/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/CreateScreenModal.svelte b/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/CreateScreenModal.svelte index a9d64afd19..5e3a7a0f37 100644 --- a/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/CreateScreenModal.svelte +++ b/packages/builder/src/pages/builder/app/[application]/design/_components/NewScreen/CreateScreenModal.svelte @@ -71,7 +71,7 @@ $goto(`./${screenId}`) store.actions.screens.select(screenId) } catch (error) { - console.log(error) + console.error(error) notifications.error("Error creating screens") } } diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte index 0ba7e6448b..7bb2a3ad49 100644 --- a/packages/builder/src/pages/builder/auth/login.svelte +++ b/packages/builder/src/pages/builder/auth/login.svelte @@ -31,7 +31,7 @@ async function login() { form.validate() if (Object.keys(errors).length > 0) { - console.log("errors", errors) + console.error("errors", errors) return } try { From 475070a495778bcc87738225fbddf87e26db734f Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 31 Jan 2024 10:53:53 -0300 Subject: [PATCH 09/11] client and frontend core --- .eslintrc.json | 6 +++++- .../src/components/app/embedded-map/EmbeddedMap.svelte | 2 +- packages/client/src/components/app/forms/CodeScanner.svelte | 2 +- packages/client/src/stores/org.js | 2 +- packages/frontend-core/src/components/grid/lib/websocket.js | 2 +- 5 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.eslintrc.json b/.eslintrc.json index 4f08698fec..917443014b 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -47,7 +47,11 @@ } }, { - "files": ["packages/builder/**/*"], + "files": [ + "packages/builder/**/*", + "packages/client/**/*", + "packages/frontend-core/**/*" + ], "rules": { "no-console": ["error", { "allow": ["warn", "error", "debug"] } ] } diff --git a/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte b/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte index 3bb7d5606d..979cb0e085 100644 --- a/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte +++ b/packages/client/src/components/app/embedded-map/EmbeddedMap.svelte @@ -307,7 +307,7 @@ // Reset view resetView() } catch (e) { - console.log("There was a problem with the map", e) + console.error("There was a problem with the map", e) } } diff --git a/packages/client/src/components/app/forms/CodeScanner.svelte b/packages/client/src/components/app/forms/CodeScanner.svelte index 2a546eb64c..008c0f5727 100644 --- a/packages/client/src/components/app/forms/CodeScanner.svelte +++ b/packages/client/src/components/app/forms/CodeScanner.svelte @@ -61,7 +61,7 @@ resolve({ initialised: true }) }) .catch(err => { - console.log("There was a problem scanning the image", err) + console.error("There was a problem scanning the image", err) resolve({ initialised: false }) }) }) diff --git a/packages/client/src/stores/org.js b/packages/client/src/stores/org.js index af0fc955f9..d8a17f7c32 100644 --- a/packages/client/src/stores/org.js +++ b/packages/client/src/stores/org.js @@ -14,7 +14,7 @@ const createOrgStore = () => { const settingsConfigDoc = await API.getTenantConfig(tenantId) set({ logoUrl: settingsConfigDoc.config.logoUrl }) } catch (e) { - console.log("Could not init org ", e) + console.error("Could not init org ", e) } } diff --git a/packages/frontend-core/src/components/grid/lib/websocket.js b/packages/frontend-core/src/components/grid/lib/websocket.js index af34acd530..b0fd236989 100644 --- a/packages/frontend-core/src/components/grid/lib/websocket.js +++ b/packages/frontend-core/src/components/grid/lib/websocket.js @@ -29,7 +29,7 @@ export const createGridWebsocket = context => { connectToDatasource(get(datasource)) }) socket.on("connect_error", err => { - console.log("Failed to connect to grid websocket:", err.message) + console.error("Failed to connect to grid websocket:", err.message) }) // User events From 3c6246e03fed7f71f43f30db2eaa961c3636f69d Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Wed, 31 Jan 2024 15:16:08 +0000 Subject: [PATCH 10/11] Bump version to 2.16.2 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 328e7f720a..38dff33c7e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.16.1", + "version": "2.16.2", "npmClient": "yarn", "packages": [ "packages/*", From 6fdbeb125868f7cd4d303dbe613340ba69bd9d29 Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Thu, 1 Feb 2024 09:42:38 +0000 Subject: [PATCH 11/11] submodule --- packages/account-portal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/account-portal b/packages/account-portal index 485ec16a9e..52f51dcfb9 160000 --- a/packages/account-portal +++ b/packages/account-portal @@ -1 +1 @@ -Subproject commit 485ec16a9eed48c548a5f1239772139f3319f028 +Subproject commit 52f51dcfb96d3fe58c8cc7a905e7d733f7cd84c2