bumping to master version

This commit is contained in:
Martin McKeaveney 2023-09-13 13:10:33 +01:00
commit 52d1b4d4ff
11 changed files with 55 additions and 26 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.10.3-alpha.2", "version": "2.10.6",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -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 DataSourceSelect from "./controls/DataSourceSelect.svelte"
import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte" import S3DataSourceSelect from "./controls/S3DataSourceSelect.svelte"
import DataProviderSelect from "./controls/DataProviderSelect.svelte" import DataProviderSelect from "./controls/DataProviderSelect.svelte"
@ -60,6 +60,7 @@ const componentMap = {
"field/longform": FormFieldSelect, "field/longform": FormFieldSelect,
"field/datetime": FormFieldSelect, "field/datetime": FormFieldSelect,
"field/attachment": FormFieldSelect, "field/attachment": FormFieldSelect,
"field/s3": Input,
"field/link": FormFieldSelect, "field/link": FormFieldSelect,
"field/array": FormFieldSelect, "field/array": FormFieldSelect,
"field/json": FormFieldSelect, "field/json": FormFieldSelect,

View File

@ -27,12 +27,14 @@
if (datasource.source === IntegrationTypes.COUCHDB) { if (datasource.source === IntegrationTypes.COUCHDB) {
return datasource.config.database return datasource.config.database
} }
if ( if (datasource.source === IntegrationTypes.DYNAMODB) {
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.S3) {
return datasource.config.endpoint
? `${datasource.config.endpoint}:${datasource.config.region}`
: `s3.${datasource.config.region}.amazonaws.com`
}
if (datasource.source === IntegrationTypes.ELASTICSEARCH) { if (datasource.source === IntegrationTypes.ELASTICSEARCH) {
return datasource.config.url return datasource.config.url
} }

View File

@ -3721,7 +3721,7 @@
}, },
"settings": [ "settings": [
{ {
"type": "field/attachment", "type": "field/s3",
"label": "Field", "label": "Field",
"key": "field", "key": "field",
"required": true "required": true

View File

@ -2,6 +2,7 @@
import Field from "./Field.svelte" import Field from "./Field.svelte"
import { CoreDropzone, ProgressCircle } from "@budibase/bbui" import { CoreDropzone, ProgressCircle } from "@budibase/bbui"
import { getContext, onMount, onDestroy } from "svelte" import { getContext, onMount, onDestroy } from "svelte"
import { cloneDeep } from "../../../../../bbui/src/helpers"
export let datasourceId export let datasourceId
export let bucket export let bucket
@ -14,6 +15,7 @@
let fieldState let fieldState
let fieldApi let fieldApi
let localFiles = []
const { API, notificationStore, uploadStore } = getContext("sdk") const { API, notificationStore, uploadStore } = getContext("sdk")
const component = getContext("component") const component = getContext("component")
@ -90,9 +92,17 @@
} }
const handleChange = e => { 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) { if (onChange && changed) {
onChange({ value: e.detail }) onChange({ value: files })
} }
} }
@ -118,7 +128,7 @@
<div class="content"> <div class="content">
{#if fieldState} {#if fieldState}
<CoreDropzone <CoreDropzone
value={fieldState.value} value={localFiles}
disabled={loading || fieldState.disabled} disabled={loading || fieldState.disabled}
error={fieldState.error} error={fieldState.error}
on:change={handleChange} on:change={handleChange}

View File

@ -52,11 +52,6 @@ export const BuilderRoleDescriptions = [
icon: "User", icon: "User",
label: "App user - Only has access to published apps", label: "App user - Only has access to published apps",
}, },
{
value: BudibaseRoles.Developer,
icon: "Hammer",
label: "Developer - Access to the app builder",
},
{ {
value: BudibaseRoles.Admin, value: BudibaseRoles.Admin,
icon: "Draw", icon: "Draw",

View File

@ -58,7 +58,7 @@ function parse(input: any) {
return null return null
} }
if (isIsoDateString(input)) { if (isIsoDateString(input)) {
return new Date(input) return new Date(input.trim())
} }
return input return input
} }

View File

@ -657,4 +657,29 @@ describe("SQL query builder", () => {
sql: `select * from (select top (@p0) * from [test] order by [test].[id] asc) as [test]`, 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 *`,
})
})
}) })

View File

@ -182,11 +182,12 @@ export function getSqlQuery(query: SqlQuery | string): SqlQuery {
export const isSQL = helpers.isSQL export const isSQL = helpers.isSQL
export function isIsoDateString(str: string) { 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 return false
} }
let d = new Date(str) let d = new Date(trimmedValue)
return d.toISOString() === str return d.toISOString() === trimmedValue
} }
/** /**

View File

@ -61,11 +61,7 @@ export async function getInheritablePermissions(
export async function allowsExplicitPermissions(resourceId: string) { export async function allowsExplicitPermissions(resourceId: string) {
if (isViewID(resourceId)) { if (isViewID(resourceId)) {
const allowed = await features.isViewPermissionEnabled() const allowed = await features.isViewPermissionEnabled()
const minPlan = !allowed const minPlan = !allowed ? PlanType.BUSINESS : undefined
? env.SELF_HOSTED
? PlanType.BUSINESS
: PlanType.PREMIUM
: undefined
return { return {
allowed, allowed,

View File

@ -17,8 +17,7 @@ describe("getExternalSchema", () => {
} }
beforeAll(async () => { 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:13.12")
const container = await new GenericContainer("postgres")
.withExposedPorts(5432) .withExposedPorts(5432)
.withEnv("POSTGRES_PASSWORD", "password") .withEnv("POSTGRES_PASSWORD", "password")
.start() .start()