From 139c642199b77b7d723a842832619c6f1043bc8a Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Fri, 8 Sep 2023 23:53:15 +0100 Subject: [PATCH 01/13] Don't send S3 image data url to rows endpoint --- .../src/components/app/forms/S3Upload.svelte | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/packages/client/src/components/app/forms/S3Upload.svelte b/packages/client/src/components/app/forms/S3Upload.svelte index 795e2e4332..dfc5032de9 100644 --- a/packages/client/src/components/app/forms/S3Upload.svelte +++ b/packages/client/src/components/app/forms/S3Upload.svelte @@ -2,6 +2,7 @@ import Field from "./Field.svelte" import { CoreDropzone, ProgressCircle } from "@budibase/bbui" import { getContext, onMount, onDestroy } from "svelte" + import { cloneDeep } from "../../../../../bbui/src/helpers" export let datasourceId export let bucket @@ -14,6 +15,7 @@ let fieldState let fieldApi + let localFiles = [] const { API, notificationStore, uploadStore } = getContext("sdk") const component = getContext("component") @@ -90,9 +92,17 @@ } const handleChange = e => { - const changed = fieldApi.setValue(e.detail) + localFiles = e.detail + let files = cloneDeep(e.detail) || [] + // remove URL as it contains the full base64 image data + files.forEach(file => { + if (file.type?.startsWith("image")) { + delete file.url + } + }) + const changed = fieldApi.setValue(files) if (onChange && changed) { - onChange({ value: e.detail }) + onChange({ value: files }) } } @@ -118,7 +128,7 @@
{#if fieldState} Date: Fri, 8 Sep 2023 23:59:25 +0100 Subject: [PATCH 02/13] S3 upload field is now simple input --- .../src/components/design/settings/componentSettings.js | 3 ++- packages/client/manifest.json | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/packages/builder/src/components/design/settings/componentSettings.js b/packages/builder/src/components/design/settings/componentSettings.js index 8b151564a1..6d673cbd3d 100644 --- a/packages/builder/src/components/design/settings/componentSettings.js +++ b/packages/builder/src/components/design/settings/componentSettings.js @@ -1,4 +1,4 @@ -import { Checkbox, Select, RadioGroup, Stepper } from "@budibase/bbui" +import { Checkbox, Select, RadioGroup, Stepper, Input } from "@budibase/bbui" import DataSourceSelect from "./controls/DataSourceSelect.svelte" import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte" import DataProviderSelect from "./controls/DataProviderSelect.svelte" @@ -60,6 +60,7 @@ const componentMap = { "field/longform": FormFieldSelect, "field/datetime": FormFieldSelect, "field/attachment": FormFieldSelect, + "field/s3": Input, "field/link": FormFieldSelect, "field/array": FormFieldSelect, "field/json": FormFieldSelect, diff --git a/packages/client/manifest.json b/packages/client/manifest.json index 229d344d55..75fe287b2a 100644 --- a/packages/client/manifest.json +++ b/packages/client/manifest.json @@ -3721,7 +3721,7 @@ }, "settings": [ { - "type": "field/attachment", + "type": "field/s3", "label": "Field", "key": "field", "required": true From c860a7597815e609b5a7fb0067ad936657a1498d Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Sat, 9 Sep 2023 00:04:42 +0100 Subject: [PATCH 03/13] Use asterisk instead of null --- .../_components/EditDatasourceConfigButton.svelte | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte index 9e50ab8da3..54937f9415 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte @@ -31,7 +31,7 @@ datasource.source === IntegrationTypes.DYNAMODB || datasource.source === IntegrationTypes.S3 ) { - return `${datasource.config.endpoint}:${datasource.config.region}` + return `${datasource.config.endpoint || "*"}:${datasource.config.region}` } if (datasource.source === IntegrationTypes.ELASTICSEARCH) { return datasource.config.url From 491d5b2de74adfc0048998b4ba1985e4340d564c Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Mon, 11 Sep 2023 16:01:47 +0100 Subject: [PATCH 04/13] Remove missed reference to developer in user import modal --- packages/frontend-core/src/constants.js | 5 ----- 1 file changed, 5 deletions(-) diff --git a/packages/frontend-core/src/constants.js b/packages/frontend-core/src/constants.js index cfaaaea81b..344326065a 100644 --- a/packages/frontend-core/src/constants.js +++ b/packages/frontend-core/src/constants.js @@ -52,11 +52,6 @@ export const BuilderRoleDescriptions = [ icon: "User", label: "App user - Only has access to published apps", }, - { - value: BudibaseRoles.Developer, - icon: "Hammer", - label: "Developer - Access to the app builder", - }, { value: BudibaseRoles.Admin, icon: "Draw", From 7147752b9c5c33e4741e1c3ceaf643888ca36256 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 11 Sep 2023 21:26:05 +0100 Subject: [PATCH 05/13] Fix date validation regex --- packages/server/src/integrations/tests/sql.spec.ts | 12 ++++++++++++ packages/server/src/integrations/utils.ts | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/packages/server/src/integrations/tests/sql.spec.ts b/packages/server/src/integrations/tests/sql.spec.ts index 0bf1498f5f..5bbdbff006 100644 --- a/packages/server/src/integrations/tests/sql.spec.ts +++ b/packages/server/src/integrations/tests/sql.spec.ts @@ -657,4 +657,16 @@ describe("SQL query builder", () => { sql: `select * from (select top (@p0) * from [test] order by [test].[id] asc) as [test]`, }) }) + + it("should not parse JSON string as Date", () => { + let query = new Sql(SqlClient.POSTGRES, limit)._query( + generateCreateJson(TABLE_NAME, { + name: '{ "created_at":"2023-09-09T03:21:06.024Z" }', + }) + ) + expect(query).toEqual({ + bindings: ['{ "created_at":"2023-09-09T03:21:06.024Z" }'], + sql: `insert into \"test\" (\"name\") values ($1) returning *`, + }) + }) }) diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 3f598ce986..02041c9d4b 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -182,7 +182,7 @@ export function getSqlQuery(query: SqlQuery | string): SqlQuery { export const isSQL = helpers.isSQL export function isIsoDateString(str: string) { - if (!/\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z/.test(str)) { + if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(str.trim())) { return false } let d = new Date(str) From 17dc01808c384e5d703b14e8ce90bb0b363f3739 Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Mon, 11 Sep 2023 21:35:51 +0100 Subject: [PATCH 06/13] Additional unit test --- packages/server/src/integrations/base/sql.ts | 2 +- packages/server/src/integrations/tests/sql.spec.ts | 13 +++++++++++++ packages/server/src/integrations/utils.ts | 7 ++++--- 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/packages/server/src/integrations/base/sql.ts b/packages/server/src/integrations/base/sql.ts index 2cdae682b0..bf19ec9afe 100644 --- a/packages/server/src/integrations/base/sql.ts +++ b/packages/server/src/integrations/base/sql.ts @@ -58,7 +58,7 @@ function parse(input: any) { return null } if (isIsoDateString(input)) { - return new Date(input) + return new Date(input.trim()) } return input } diff --git a/packages/server/src/integrations/tests/sql.spec.ts b/packages/server/src/integrations/tests/sql.spec.ts index 5bbdbff006..5cc4849d03 100644 --- a/packages/server/src/integrations/tests/sql.spec.ts +++ b/packages/server/src/integrations/tests/sql.spec.ts @@ -669,4 +669,17 @@ describe("SQL query builder", () => { sql: `insert into \"test\" (\"name\") values ($1) returning *`, }) }) + + it("should parse and trim valid string as Date", () => { + const dateObj = new Date("2023-09-09T03:21:06.024Z") + let query = new Sql(SqlClient.POSTGRES, limit)._query( + generateCreateJson(TABLE_NAME, { + name: " 2023-09-09T03:21:06.024Z ", + }) + ) + expect(query).toEqual({ + bindings: [dateObj], + sql: `insert into \"test\" (\"name\") values ($1) returning *`, + }) + }) }) diff --git a/packages/server/src/integrations/utils.ts b/packages/server/src/integrations/utils.ts index 02041c9d4b..2883e4471c 100644 --- a/packages/server/src/integrations/utils.ts +++ b/packages/server/src/integrations/utils.ts @@ -182,11 +182,12 @@ export function getSqlQuery(query: SqlQuery | string): SqlQuery { export const isSQL = helpers.isSQL export function isIsoDateString(str: string) { - if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(str.trim())) { + const trimmedValue = str.trim() + if (!/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}.\d{3}Z$/.test(trimmedValue)) { return false } - let d = new Date(str) - return d.toISOString() === str + let d = new Date(trimmedValue) + return d.toISOString() === trimmedValue } /** From cee89b95b1c0ec332522d3f59b53406b4099b58d Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 12 Sep 2023 09:34:11 +0100 Subject: [PATCH 07/13] remove reference to premium plan --- packages/server/src/sdk/app/permissions/index.ts | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/packages/server/src/sdk/app/permissions/index.ts b/packages/server/src/sdk/app/permissions/index.ts index b2661b0f7e..b62a7fb459 100644 --- a/packages/server/src/sdk/app/permissions/index.ts +++ b/packages/server/src/sdk/app/permissions/index.ts @@ -61,11 +61,7 @@ export async function getInheritablePermissions( export async function allowsExplicitPermissions(resourceId: string) { if (isViewID(resourceId)) { const allowed = await features.isViewPermissionEnabled() - const minPlan = !allowed - ? env.SELF_HOSTED - ? PlanType.BUSINESS - : PlanType.PREMIUM - : undefined + const minPlan = !allowed ? PlanType.BUSINESS : undefined return { allowed, From 377fc7fc10e4176b4385f8e1a97dd0ee7321c6fc Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 12 Sep 2023 09:38:33 +0100 Subject: [PATCH 08/13] Updating pro reference to master --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 4638ae916e..961d683794 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 4638ae916e55ce89166095578cbd01745d0ee9ee +Subproject commit 961d683794442f615468d44b684e5a94633109eb From d294b171c0f5c0d131a75a3622324bb37d59061c Mon Sep 17 00:00:00 2001 From: Peter Clement Date: Tue, 12 Sep 2023 09:40:29 +0100 Subject: [PATCH 09/13] pro update --- packages/pro | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/pro b/packages/pro index 4638ae916e..961d683794 160000 --- a/packages/pro +++ b/packages/pro @@ -1 +1 @@ -Subproject commit 4638ae916e55ce89166095578cbd01745d0ee9ee +Subproject commit 961d683794442f615468d44b684e5a94633109eb From 260e0b6f99616ce81d06e25ecdb49977ff061e5f Mon Sep 17 00:00:00 2001 From: Mel O'Hagan Date: Tue, 12 Sep 2023 10:25:10 +0100 Subject: [PATCH 10/13] Improve default S3 subtitle --- .../_components/EditDatasourceConfigButton.svelte | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte index 54937f9415..9654b27b50 100644 --- a/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte +++ b/packages/builder/src/pages/builder/app/[application]/data/datasource/[datasourceId]/_components/EditDatasourceConfigButton.svelte @@ -27,11 +27,13 @@ if (datasource.source === IntegrationTypes.COUCHDB) { return datasource.config.database } - if ( - datasource.source === IntegrationTypes.DYNAMODB || - datasource.source === IntegrationTypes.S3 - ) { - return `${datasource.config.endpoint || "*"}:${datasource.config.region}` + if (datasource.source === IntegrationTypes.DYNAMODB) { + return `${datasource.config.endpoint}:${datasource.config.region}` + } + if (datasource.source === IntegrationTypes.S3) { + return datasource.config.endpoint + ? `${datasource.config.endpoint}:${datasource.config.region}` + : `s3.${datasource.config.region}.amazonaws.com` } if (datasource.source === IntegrationTypes.ELASTICSEARCH) { return datasource.config.url From 948e5184c181264f22c1ce6936ee0e55608b1af0 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 12 Sep 2023 09:28:46 +0000 Subject: [PATCH 11/13] Bump version to 2.10.4 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index efc51f353a..5b5e98d0ea 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.10.3", + "version": "2.10.4", "npmClient": "yarn", "packages": [ "packages/*" From b289253b0e0a6e2553ec7a71d8688b8d441ec62b Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 12 Sep 2023 10:18:09 +0000 Subject: [PATCH 12/13] Bump version to 2.10.5 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 5b5e98d0ea..23a10992cb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.10.4", + "version": "2.10.5", "npmClient": "yarn", "packages": [ "packages/*" From d92811f909d5915c71232c6e5fa85b922fbc6bb9 Mon Sep 17 00:00:00 2001 From: Budibase Staging Release Bot <> Date: Tue, 12 Sep 2023 10:18:42 +0000 Subject: [PATCH 13/13] Bump version to 2.10.6 --- lerna.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lerna.json b/lerna.json index 23a10992cb..63466ceedb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.10.5", + "version": "2.10.6", "npmClient": "yarn", "packages": [ "packages/*"