diff --git a/lerna.json b/lerna.json index e070f6579c..63466ceedb 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "2.10.3-alpha.2", + "version": "2.10.6", "npmClient": "yarn", "packages": [ "packages/*" 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/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..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,12 +27,14 @@ if (datasource.source === IntegrationTypes.COUCHDB) { return datasource.config.database } - if ( - datasource.source === IntegrationTypes.DYNAMODB || - datasource.source === IntegrationTypes.S3 - ) { + 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 } 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 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} { 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 *`, + }) + }) + + 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 3f598ce986..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)) { + 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 } /** 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, diff --git a/qa-core/src/integrations/external-schema/postgres.integration.spec.ts b/qa-core/src/integrations/external-schema/postgres.integration.spec.ts index 762a16b221..a0812c9677 100644 --- a/qa-core/src/integrations/external-schema/postgres.integration.spec.ts +++ b/qa-core/src/integrations/external-schema/postgres.integration.spec.ts @@ -17,8 +17,7 @@ describe("getExternalSchema", () => { } beforeAll(async () => { - // This is left on propose without a tag, so if a new version introduces a breaking change we will be notified - const container = await new GenericContainer("postgres") + const container = await new GenericContainer("postgres:13.12") .withExposedPorts(5432) .withEnv("POSTGRES_PASSWORD", "password") .start()