Merge branch 'master' of github.com:Budibase/budibase into develop

This commit is contained in:
Michael Drury 2022-11-29 11:13:54 +00:00
commit 1f0570907a
20 changed files with 106 additions and 40 deletions

View File

@ -1,5 +1,5 @@
{ {
"version": "2.1.32-alpha.11", "version": "2.1.39",
"npmClient": "yarn", "npmClient": "yarn",
"packages": [ "packages": [
"packages/*" "packages/*"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/backend-core", "name": "@budibase/backend-core",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase backend core libraries used in server and worker", "description": "Budibase backend core libraries used in server and worker",
"main": "dist/src/index.js", "main": "dist/src/index.js",
"types": "dist/src/index.d.ts", "types": "dist/src/index.d.ts",
@ -20,7 +20,7 @@
"test:watch": "jest --watchAll" "test:watch": "jest --watchAll"
}, },
"dependencies": { "dependencies": {
"@budibase/types": "2.1.32-alpha.11", "@budibase/types": "^2.1.39",
"@shopify/jest-koa-mocks": "5.0.1", "@shopify/jest-koa-mocks": "5.0.1",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",
"aws-sdk": "2.1030.0", "aws-sdk": "2.1030.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/bbui", "name": "@budibase/bbui",
"description": "A UI solution used in the different Budibase projects.", "description": "A UI solution used in the different Budibase projects.",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"module": "dist/bbui.es.js", "module": "dist/bbui.es.js",
@ -38,7 +38,7 @@
], ],
"dependencies": { "dependencies": {
"@adobe/spectrum-css-workflow-icons": "^1.2.1", "@adobe/spectrum-css-workflow-icons": "^1.2.1",
"@budibase/string-templates": "2.1.32-alpha.11", "@budibase/string-templates": "^2.1.39",
"@spectrum-css/actionbutton": "^1.0.1", "@spectrum-css/actionbutton": "^1.0.1",
"@spectrum-css/actiongroup": "^1.0.1", "@spectrum-css/actiongroup": "^1.0.1",
"@spectrum-css/avatar": "^3.0.2", "@spectrum-css/avatar": "^3.0.2",

View File

@ -197,6 +197,7 @@
</svg> </svg>
{/if} {/if}
<input <input
{disabled}
data-input data-input
type="text" type="text"
class="spectrum-Textfield-input spectrum-InputGroup-input" class="spectrum-Textfield-input spectrum-InputGroup-input"

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/builder", "name": "@budibase/builder",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"license": "GPL-3.0", "license": "GPL-3.0",
"private": true, "private": true,
"scripts": { "scripts": {
@ -71,10 +71,10 @@
} }
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.1.32-alpha.11", "@budibase/bbui": "^2.1.39",
"@budibase/client": "2.1.32-alpha.11", "@budibase/client": "^2.1.39",
"@budibase/frontend-core": "2.1.32-alpha.11", "@budibase/frontend-core": "^2.1.39",
"@budibase/string-templates": "2.1.32-alpha.11", "@budibase/string-templates": "^2.1.39",
"@sentry/browser": "5.19.1", "@sentry/browser": "5.19.1",
"@spectrum-css/page": "^3.0.1", "@spectrum-css/page": "^3.0.1",
"@spectrum-css/vars": "^3.0.1", "@spectrum-css/vars": "^3.0.1",
@ -82,7 +82,7 @@
"dayjs": "^1.11.2", "dayjs": "^1.11.2",
"downloadjs": "1.4.7", "downloadjs": "1.4.7",
"lodash": "4.17.21", "lodash": "4.17.21",
"posthog-js": "1.4.5", "posthog-js": "^1.36.0",
"remixicon": "2.5.0", "remixicon": "2.5.0",
"shortid": "2.2.15", "shortid": "2.2.15",
"svelte-dnd-action": "^0.9.8", "svelte-dnd-action": "^0.9.8",

View File

@ -374,7 +374,7 @@ export const getFrontendStore = () => {
s._id !== screen._id s._id !== screen._id
) )
}) })
if (otherHomeScreens.length) { if (otherHomeScreens.length && updatedScreen.routing.homeScreen) {
const patch = screen => { const patch = screen => {
screen.routing.homeScreen = false screen.routing.homeScreen = false
} }

View File

@ -7,9 +7,9 @@
let name = "" let name = ""
let submitted = false let submitted = false
$: valid = name && name.length > 0 && !datasource?.entities[name] $: valid = name && name.length > 0 && !datasource?.entities?.[name]
$: error = $: error =
!submitted && name && datasource?.entities[name] !submitted && name && datasource?.entities?.[name]
? "Table name already in use." ? "Table name already in use."
: null : null

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/cli", "name": "@budibase/cli",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase CLI, for developers, self hosting and migrations.", "description": "Budibase CLI, for developers, self hosting and migrations.",
"main": "src/index.js", "main": "src/index.js",
"bin": { "bin": {
@ -26,9 +26,9 @@
"outputPath": "build" "outputPath": "build"
}, },
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.1.32-alpha.11", "@budibase/backend-core": "^2.1.39",
"@budibase/string-templates": "2.1.32-alpha.11", "@budibase/string-templates": "^2.1.39",
"@budibase/types": "2.1.32-alpha.11", "@budibase/types": "^2.1.39",
"axios": "0.21.2", "axios": "0.21.2",
"chalk": "4.1.0", "chalk": "4.1.0",
"cli-progress": "3.11.2", "cli-progress": "3.11.2",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/client", "name": "@budibase/client",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"license": "MPL-2.0", "license": "MPL-2.0",
"module": "dist/budibase-client.js", "module": "dist/budibase-client.js",
"main": "dist/budibase-client.js", "main": "dist/budibase-client.js",
@ -19,9 +19,9 @@
"dev:builder": "rollup -cw" "dev:builder": "rollup -cw"
}, },
"dependencies": { "dependencies": {
"@budibase/bbui": "2.1.32-alpha.11", "@budibase/bbui": "^2.1.39",
"@budibase/frontend-core": "2.1.32-alpha.11", "@budibase/frontend-core": "^2.1.39",
"@budibase/string-templates": "2.1.32-alpha.11", "@budibase/string-templates": "^2.1.39",
"@spectrum-css/button": "^3.0.3", "@spectrum-css/button": "^3.0.3",
"@spectrum-css/card": "^3.0.3", "@spectrum-css/card": "^3.0.3",
"@spectrum-css/divider": "^1.0.3", "@spectrum-css/divider": "^1.0.3",

View File

@ -1,12 +1,12 @@
{ {
"name": "@budibase/frontend-core", "name": "@budibase/frontend-core",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase frontend core libraries used in builder and client", "description": "Budibase frontend core libraries used in builder and client",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",
"svelte": "src/index.js", "svelte": "src/index.js",
"dependencies": { "dependencies": {
"@budibase/bbui": "2.1.32-alpha.11", "@budibase/bbui": "^2.1.39",
"lodash": "^4.17.21", "lodash": "^4.17.21",
"svelte": "^3.46.2" "svelte": "^3.46.2"
} }

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/sdk", "name": "@budibase/sdk",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase Public API SDK", "description": "Budibase Public API SDK",
"author": "Budibase", "author": "Budibase",
"license": "MPL-2.0", "license": "MPL-2.0",

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/server", "name": "@budibase/server",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase Web Server", "description": "Budibase Web Server",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -43,11 +43,11 @@
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@apidevtools/swagger-parser": "10.0.3", "@apidevtools/swagger-parser": "10.0.3",
"@budibase/backend-core": "2.1.32-alpha.11", "@budibase/backend-core": "^2.1.39",
"@budibase/client": "2.1.32-alpha.11", "@budibase/client": "^2.1.39",
"@budibase/pro": "2.1.32-alpha.11", "@budibase/pro": "2.1.39",
"@budibase/string-templates": "2.1.32-alpha.11", "@budibase/string-templates": "^2.1.39",
"@budibase/types": "2.1.32-alpha.11", "@budibase/types": "^2.1.39",
"@bull-board/api": "3.7.0", "@bull-board/api": "3.7.0",
"@bull-board/koa": "3.9.4", "@bull-board/koa": "3.9.4",
"@elastic/elasticsearch": "7.10.0", "@elastic/elasticsearch": "7.10.0",

View File

@ -220,6 +220,9 @@ export async function save(ctx: BBContext) {
const db = context.getAppDB() const db = context.getAppDB()
const datasource = await db.get(datasourceId) const datasource = await db.get(datasourceId)
if (!datasource.entities) {
datasource.entities = {}
}
const oldTables = cloneDeep(datasource.entities) const oldTables = cloneDeep(datasource.entities)
const tables: Record<string, Table> = datasource.entities const tables: Record<string, Table> = datasource.entities

View File

@ -106,7 +106,11 @@ function bindingTypeCoerce(bindings: any[]) {
} }
// if not a number, see if it is a date - important to do in this order as any // if not a number, see if it is a date - important to do in this order as any
// integer will be considered a valid date // integer will be considered a valid date
else if (/^\d/.test(binding) && dayjs(binding).isValid()) { else if (
/^\d/.test(binding) &&
dayjs(binding).isValid() &&
!binding.includes(",")
) {
bindings[i] = dayjs(binding).toDate() bindings[i] = dayjs(binding).toDate()
} }
} }

View File

@ -73,4 +73,61 @@ describe("MySQL Integration", () => {
expect(response).toEqual([{ deleted: true }]) expect(response).toEqual([{ deleted: true }])
}) })
}) })
describe("binding type coerce", () => {
it("ignores non-string types ", async () => {
const sql = "select * from users;"
const date = new Date()
await config.integration.read({
sql,
bindings: [11, date, ["a", "b", "c"], { id: 1 }],
})
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [
11,
date,
["a", "b", "c"],
{ id: 1 },
])
})
it("parses strings matching a number regex", async () => {
const sql = "select * from users;"
await config.integration.read({
sql,
bindings: ["101", "3.14"],
})
expect(config.integration.client.query).toHaveBeenCalledWith(
sql,
[101, 3.14]
)
})
it("parses strings matching a valid date format", async () => {
const sql = "select * from users;"
await config.integration.read({
sql,
bindings: [
"2001-10-30",
"2010-09-01T13:30:59.123Z",
"2021-02-05 12:01 PM",
],
})
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [
new Date("2001-10-30T00:00:00.000Z"),
new Date("2010-09-01T13:30:59.123Z"),
new Date("2021-02-05T12:01:00.000Z"),
])
})
it("does not parse string matching a valid array of numbers as date", async () => {
const sql = "select * from users;"
await config.integration.read({
sql,
bindings: ["1,2,2017"],
})
expect(config.integration.client.query).toHaveBeenCalledWith(sql, [
"1,2,2017",
])
})
})
}) })

View File

@ -53,7 +53,6 @@ class QueryRunner {
async execute(): Promise<any> { async execute(): Promise<any> {
let { datasource, fields, queryVerb, transformer } = this let { datasource, fields, queryVerb, transformer } = this
let datasourceClone = cloneDeep(datasource) let datasourceClone = cloneDeep(datasource)
let fieldsClone = cloneDeep(fields) let fieldsClone = cloneDeep(fields)
@ -176,6 +175,7 @@ class QueryRunner {
parameters, parameters,
transformer: query.transformer, transformer: query.transformer,
queryId, queryId,
ctx: this.ctx,
}, },
{ noRecursiveQuery: true } { noRecursiveQuery: true }
).execute() ).execute()

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/string-templates", "name": "@budibase/string-templates",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Handlebars wrapper for Budibase templating.", "description": "Handlebars wrapper for Budibase templating.",
"main": "src/index.cjs", "main": "src/index.cjs",
"module": "dist/bundle.mjs", "module": "dist/bundle.mjs",

View File

@ -1,6 +1,6 @@
{ {
"name": "@budibase/types", "name": "@budibase/types",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase types", "description": "Budibase types",
"main": "dist/index.js", "main": "dist/index.js",
"types": "dist/index.d.ts", "types": "dist/index.d.ts",

View File

@ -23,4 +23,5 @@ export interface Price {
duration: PriceDuration duration: PriceDuration
priceId: string priceId: string
dayPasses: number dayPasses: number
isPerUser: boolean
} }

View File

@ -1,7 +1,7 @@
{ {
"name": "@budibase/worker", "name": "@budibase/worker",
"email": "hi@budibase.com", "email": "hi@budibase.com",
"version": "2.1.32-alpha.11", "version": "2.1.39",
"description": "Budibase background service", "description": "Budibase background service",
"main": "src/index.ts", "main": "src/index.ts",
"repository": { "repository": {
@ -36,10 +36,10 @@
"author": "Budibase", "author": "Budibase",
"license": "GPL-3.0", "license": "GPL-3.0",
"dependencies": { "dependencies": {
"@budibase/backend-core": "2.1.32-alpha.11", "@budibase/backend-core": "^2.1.39",
"@budibase/pro": "2.1.32-alpha.11", "@budibase/pro": "2.1.39",
"@budibase/string-templates": "2.1.32-alpha.11", "@budibase/string-templates": "^2.1.39",
"@budibase/types": "2.1.32-alpha.11", "@budibase/types": "^2.1.39",
"@koa/router": "8.0.8", "@koa/router": "8.0.8",
"@sentry/node": "6.17.7", "@sentry/node": "6.17.7",
"@techpass/passport-openidconnect": "0.3.2", "@techpass/passport-openidconnect": "0.3.2",