From 8ab567e64c504a243f374a3468b52750b2f7fbe6 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 12:29:27 +0100 Subject: [PATCH 01/14] Correctly set initial values when registering fields in forms --- .../standard-components/src/forms/Form.svelte | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/packages/standard-components/src/forms/Form.svelte b/packages/standard-components/src/forms/Form.svelte index d73af72a47..9a2c909385 100644 --- a/packages/standard-components/src/forms/Form.svelte +++ b/packages/standard-components/src/forms/Form.svelte @@ -42,18 +42,6 @@ // Auto columns are always disabled const isAutoColumn = !!schema?.[field]?.autocolumn - if (fieldMap[field] != null) { - // Update disabled property just so that toggling the disabled field - // state in the builder makes updates in real time. - // We only need this because of optimisations which prevent fully - // remounting when settings change. - fieldMap[field].fieldState.update(state => { - state.disabled = disabled || fieldDisabled || isAutoColumn - return state - }) - return fieldMap[field] - } - // Create validation function based on field schema const constraints = schema?.[field]?.constraints const validate = createValidatorFromConstraints(constraints, field, table) @@ -67,6 +55,10 @@ fieldApi: makeFieldApi(field, defaultValue, validate), fieldSchema: schema?.[field] ?? {}, } + + // Set initial value + fieldMap[field].fieldApi.setValue(defaultValue, true) + return fieldMap[field] }, validate: () => { From f586042267db5836cda4929c3802a5dc42f931d5 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 12:53:12 +0100 Subject: [PATCH 02/14] Add type setting to forms and fix inheriting initial values --- packages/standard-components/manifest.json | 7 +++++ .../standard-components/src/forms/Form.svelte | 31 ++++++++++++++++--- 2 files changed, 34 insertions(+), 4 deletions(-) diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index 8f0f63f681..998d053fe3 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -1023,6 +1023,13 @@ "ValidateForm" ], "settings": [ + { + "type": "select", + "label": "Type", + "key": "type", + "options": ["Create", "Update"], + "defaultValue": "Create" + }, { "type": "schema", "label": "Schema", diff --git a/packages/standard-components/src/forms/Form.svelte b/packages/standard-components/src/forms/Form.svelte index 9a2c909385..438e93073e 100644 --- a/packages/standard-components/src/forms/Form.svelte +++ b/packages/standard-components/src/forms/Form.svelte @@ -8,6 +8,7 @@ export let theme export let size export let disabled = false + export let type = "Create" const component = getContext("component") const context = getContext("context") @@ -19,15 +20,29 @@ let fieldMap = {} // Returns the closes data context which isn't a built in context - const getInitialValues = context => { + const getInitialValues = (type, dataSource, context) => { + // Only inherit values for update forms + if (type !== "Update") { + return {} + } + // Only inherit values for forms targetting internal tables + if (!dataSource?.tableId) { + return {} + } + // Don't inherit values representing built in contexts if (["user", "url"].includes(context.closestComponentId)) { return {} } - return context[`${context.closestComponentId}`] || {} + // Only inherit values if the table ID matches + const closestContext = context[`${context.closestComponentId}`] || {} + if (dataSource.tableId !== closestContext?.tableId) { + return {} + } + return closestContext } // Use the closest data context as the initial form values - const initialValues = getInitialValues($context) + const initialValues = getInitialValues(type, dataSource, $context) // Form state contains observable data about the form const formState = writable({ values: initialValues, errors: {}, valid: true }) @@ -46,6 +61,7 @@ const constraints = schema?.[field]?.constraints const validate = createValidatorFromConstraints(constraints, field, table) + // Construct field object fieldMap[field] = { fieldState: makeFieldState( field, @@ -57,7 +73,14 @@ } // Set initial value - fieldMap[field].fieldApi.setValue(defaultValue, true) + const initialValue = get(fieldMap[field].fieldState).value + formState.update(state => ({ + ...state, + values: { + ...state.values, + [field]: initialValue, + }, + })) return fieldMap[field] }, From e5737987c550851b3207716537e6baf11562534a Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 12:55:17 +0100 Subject: [PATCH 03/14] Change form type setting to 'actionType' to avoid clashing with old settings --- packages/standard-components/manifest.json | 2 +- packages/standard-components/src/forms/Form.svelte | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/standard-components/manifest.json b/packages/standard-components/manifest.json index 998d053fe3..81aa63e1e3 100644 --- a/packages/standard-components/manifest.json +++ b/packages/standard-components/manifest.json @@ -1026,7 +1026,7 @@ { "type": "select", "label": "Type", - "key": "type", + "key": "actionType", "options": ["Create", "Update"], "defaultValue": "Create" }, diff --git a/packages/standard-components/src/forms/Form.svelte b/packages/standard-components/src/forms/Form.svelte index 438e93073e..327cc70572 100644 --- a/packages/standard-components/src/forms/Form.svelte +++ b/packages/standard-components/src/forms/Form.svelte @@ -8,7 +8,7 @@ export let theme export let size export let disabled = false - export let type = "Create" + export let actionType = "Create" const component = getContext("component") const context = getContext("context") @@ -42,7 +42,7 @@ } // Use the closest data context as the initial form values - const initialValues = getInitialValues(type, dataSource, $context) + const initialValues = getInitialValues(actionType, dataSource, $context) // Form state contains observable data about the form const formState = writable({ values: initialValues, errors: {}, valid: true }) From 739abfd706a87d78af8abc4150d981aa0d6f30b0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 13:08:36 +0100 Subject: [PATCH 04/14] Update autoscreens to add new form type setting --- .../src/builderStore/store/screenTemplates/newRowScreen.js | 1 + .../src/builderStore/store/screenTemplates/rowDetailScreen.js | 1 + 2 files changed, 2 insertions(+) diff --git a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js index be399b4bb8..980f71742b 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/newRowScreen.js @@ -35,6 +35,7 @@ const createScreen = table => { const form = makeMainForm() .instanceName("Form") .customProps({ + actionType: "Create", theme: "spectrum--lightest", size: "spectrum--medium", dataSource: { diff --git a/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js b/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js index b0cf694a5d..f15f1de5a4 100644 --- a/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js +++ b/packages/builder/src/builderStore/store/screenTemplates/rowDetailScreen.js @@ -110,6 +110,7 @@ const createScreen = table => { const form = makeMainForm() .instanceName("Form") .customProps({ + actionType: "Update", theme: "spectrum--lightest", size: "spectrum--medium", dataSource: { From 4d8e878f6f6c24e47eb94189845cb5f236626353 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 14:17:11 +0100 Subject: [PATCH 05/14] Allow string templates to handle null objects without failing --- packages/string-templates/src/index.cjs | 3 --- packages/string-templates/test/basic.spec.js | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/packages/string-templates/src/index.cjs b/packages/string-templates/src/index.cjs index a14a3efcda..0b4515b815 100644 --- a/packages/string-templates/src/index.cjs +++ b/packages/string-templates/src/index.cjs @@ -16,9 +16,6 @@ registerAll(hbsInstance) * utility function to check if the object is valid */ function testObject(object) { - if (object == null) { - throw "Unable to process null object" - } // JSON stringify will fail if there are any cycles, stops infinite recursion try { JSON.stringify(object) diff --git a/packages/string-templates/test/basic.spec.js b/packages/string-templates/test/basic.spec.js index f5c7c8be75..f9b994be99 100644 --- a/packages/string-templates/test/basic.spec.js +++ b/packages/string-templates/test/basic.spec.js @@ -81,14 +81,14 @@ describe("Test that the object processing works correctly", () => { expect(error).not.toBeNull() }) - it("should fail gracefully when wrong type is passed in", async () => { + it("should be able to handle null objects", async () => { let error = null try { await processObject(null, null) } catch (err) { error = err } - expect(error).not.toBeNull() + expect(error).toBeNull() }) }) From ad45781228939f0d06f6131d2b029e5e1815cf36 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 9 Jun 2021 13:51:07 +0000 Subject: [PATCH 06/14] v0.9.39 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 6 +++--- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lerna.json b/lerna.json index 44d7024afe..5f06e73f5e 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.38", + "version": "0.9.39", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index e0979c1a09..7faa482e84 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.38", + "version": "0.9.39", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index a7d58fa075..018a5f5d15 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.38", + "version": "0.9.39", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 1499c61c25..32975defa9 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.38", + "version": "0.9.39", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.38", - "@budibase/client": "^0.9.38", + "@budibase/bbui": "^0.9.39", + "@budibase/client": "^0.9.39", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.38", + "@budibase/string-templates": "^0.9.39", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index aefd140f7a..0b2f6b54db 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.38", + "version": "0.9.39", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 719a88ed3c..65c318c211 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.38", + "version": "0.9.39", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,13 +18,13 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/string-templates": "^0.9.38", + "@budibase/string-templates": "^0.9.39", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.38", + "@budibase/standard-components": "^0.9.39", "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "fs-extra": "^8.1.0", diff --git a/packages/server/package.json b/packages/server/package.json index f3552c8f01..19a047c484 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.38", + "version": "0.9.39", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.38", - "@budibase/client": "^0.9.38", - "@budibase/string-templates": "^0.9.38", + "@budibase/auth": "^0.9.39", + "@budibase/client": "^0.9.39", + "@budibase/string-templates": "^0.9.39", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -109,7 +109,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.38", + "@budibase/standard-components": "^0.9.39", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 897b38e957..8e88318439 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.38", + "version": "0.9.39", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.38", + "@budibase/bbui": "^0.9.39", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", "apexcharts": "^3.22.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index eef3409d12..f604c36da3 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.38", + "version": "0.9.39", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 8c0dcb5f4c..2c124f7280 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.38", + "version": "0.9.39", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.38", - "@budibase/string-templates": "^0.9.38", + "@budibase/auth": "^0.9.39", + "@budibase/string-templates": "^0.9.39", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From 22431a4ea2c65d7b3d24721dc769606a1aaf4e79 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 9 Jun 2021 15:45:54 +0100 Subject: [PATCH 07/14] Updating SMTP config to show better errors. --- .../builder/portal/manage/email/index.svelte | 18 +++++++++++------- .../src/api/controllers/admin/configs.js | 16 ++++++++++------ .../worker/src/api/routes/admin/configs.js | 1 - packages/worker/src/utilities/email.js | 6 ++---- 4 files changed, 23 insertions(+), 18 deletions(-) diff --git a/packages/builder/src/pages/builder/portal/manage/email/index.svelte b/packages/builder/src/pages/builder/portal/manage/email/index.svelte index 44442767a8..46af44ec93 100644 --- a/packages/builder/src/pages/builder/portal/manage/email/index.svelte +++ b/packages/builder/src/pages/builder/portal/manage/email/index.svelte @@ -38,17 +38,21 @@ let loading async function saveSmtp() { - try { - // Save your SMTP config - const response = await api.post(`/api/admin/configs`, smtpConfig) + // Save your SMTP config + const response = await api.post(`/api/admin/configs`, smtpConfig) + + if (response.status !== 200) { + const error = await response.text() + let message = error + try { + message = JSON.parse(error).message + } catch (err) {} + notifications.error(`Failed to save email settings, reason: ${message}`) + } else { const json = await response.json() - if (response.status !== 200) throw new Error(json.message) smtpConfig._rev = json._rev smtpConfig._id = json._id - notifications.success(`Settings saved.`) - } catch (err) { - notifications.error(`Failed to save email settings. ${err}`) } } diff --git a/packages/worker/src/api/controllers/admin/configs.js b/packages/worker/src/api/controllers/admin/configs.js index 82466249a2..e1bd385384 100644 --- a/packages/worker/src/api/controllers/admin/configs.js +++ b/packages/worker/src/api/controllers/admin/configs.js @@ -27,11 +27,15 @@ exports.save = async function (ctx) { }) } - // verify the configuration - switch (type) { - case Configs.SMTP: - await email.verifyConfig(config) - break + try { + // verify the configuration + switch (type) { + case Configs.SMTP: + await email.verifyConfig(config) + break + } + } catch (err) { + ctx.throw(400, err) } try { @@ -42,7 +46,7 @@ exports.save = async function (ctx) { _rev: response.rev, } } catch (err) { - ctx.throw(err.status, err) + ctx.throw(400, err) } } diff --git a/packages/worker/src/api/routes/admin/configs.js b/packages/worker/src/api/routes/admin/configs.js index 09b8f97f84..c388b83456 100644 --- a/packages/worker/src/api/routes/admin/configs.js +++ b/packages/worker/src/api/routes/admin/configs.js @@ -14,7 +14,6 @@ function smtpValidation() { host: Joi.string().required(), from: Joi.string().email().required(), secure: Joi.boolean().optional(), - selfSigned: Joi.boolean().optional(), auth: Joi.object({ type: Joi.string().valid("login", "oauth2", null), user: Joi.string().required(), diff --git a/packages/worker/src/utilities/email.js b/packages/worker/src/utilities/email.js index 778ad8af4b..4e48844843 100644 --- a/packages/worker/src/utilities/email.js +++ b/packages/worker/src/utilities/email.js @@ -27,10 +27,8 @@ function createSMTPTransport(config) { secure: config.secure || false, auth: config.auth, } - if (config.selfSigned) { - options.tls = { - rejectUnauthorized: false, - } + options.tls = { + rejectUnauthorized: false, } } else { options = { From aed973681e1cea734f068b18e3eae30f497400e8 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 9 Jun 2021 15:26:30 +0000 Subject: [PATCH 08/14] v0.9.40 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 6 +++--- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lerna.json b/lerna.json index 5f06e73f5e..8a46a8b0b2 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.39", + "version": "0.9.40", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 7faa482e84..f683188e7c 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.39", + "version": "0.9.40", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 018a5f5d15..0ec5631d0f 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.39", + "version": "0.9.40", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 32975defa9..0901e29b47 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.39", + "version": "0.9.40", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.39", - "@budibase/client": "^0.9.39", + "@budibase/bbui": "^0.9.40", + "@budibase/client": "^0.9.40", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.39", + "@budibase/string-templates": "^0.9.40", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 0b2f6b54db..252e5abd7e 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.39", + "version": "0.9.40", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 65c318c211..f764598bde 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.39", + "version": "0.9.40", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,13 +18,13 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/string-templates": "^0.9.39", + "@budibase/string-templates": "^0.9.40", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.39", + "@budibase/standard-components": "^0.9.40", "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "fs-extra": "^8.1.0", diff --git a/packages/server/package.json b/packages/server/package.json index 19a047c484..ecd6907df9 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.39", + "version": "0.9.40", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.39", - "@budibase/client": "^0.9.39", - "@budibase/string-templates": "^0.9.39", + "@budibase/auth": "^0.9.40", + "@budibase/client": "^0.9.40", + "@budibase/string-templates": "^0.9.40", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -109,7 +109,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.39", + "@budibase/standard-components": "^0.9.40", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 8e88318439..8eb9007698 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.39", + "version": "0.9.40", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.39", + "@budibase/bbui": "^0.9.40", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", "apexcharts": "^3.22.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index f604c36da3..a1139b7835 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.39", + "version": "0.9.40", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 2c124f7280..54fa295db3 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.39", + "version": "0.9.40", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.39", - "@budibase/string-templates": "^0.9.39", + "@budibase/auth": "^0.9.40", + "@budibase/string-templates": "^0.9.40", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From 6e2823a4c00125613cdc5a581c9dfbfcb6cba5eb Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 16:41:15 +0100 Subject: [PATCH 09/14] Invert boolean filter expressions to consider nulls as false --- packages/standard-components/src/lucene.js | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/packages/standard-components/src/lucene.js b/packages/standard-components/src/lucene.js index fbeaecbdd7..93abad3159 100644 --- a/packages/standard-components/src/lucene.js +++ b/packages/standard-components/src/lucene.js @@ -13,7 +13,9 @@ export const buildLuceneQuery = filter => { notEmpty: {}, } if (Array.isArray(filter)) { - filter.forEach(({ operator, field, type, value }) => { + // Build up proper range filters + filter.forEach(expression => { + const { operator, field, type, value } = expression if (operator.startsWith("range")) { if (!query.range[field]) { query.range[field] = { @@ -33,10 +35,26 @@ export const buildLuceneQuery = filter => { query.range[field].high = value } } else if (query[operator]) { - query[operator][field] = value + if (type === "boolean") { + // Transform boolean filters to cope with null. + // "equals false" needs to be "not equals true" + // "not equals false" needs to be "equals true" + if (operator === "equal" && value === "false") { + query.notEqual[field] = "true" + } else if (operator === "notEqual" && value === "false") { + query.equal[field] = "true" + } else { + query[operator][field] = value + } + } else { + query[operator][field] = value + } } }) } + + console.log(query) + return query } From 7d30f69352a70d2b20a490398b16789985197fac Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 9 Jun 2021 16:42:14 +0100 Subject: [PATCH 10/14] Remove log statement --- packages/standard-components/src/lucene.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/standard-components/src/lucene.js b/packages/standard-components/src/lucene.js index 93abad3159..8cbd1ea0fe 100644 --- a/packages/standard-components/src/lucene.js +++ b/packages/standard-components/src/lucene.js @@ -53,8 +53,6 @@ export const buildLuceneQuery = filter => { }) } - console.log(query) - return query } From 5086a4d0c9566a073de5f3a53f1f2d528f301e86 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 9 Jun 2021 17:38:24 +0100 Subject: [PATCH 11/14] Super quick fix for attachments, keeping in correct object store directory. --- hosting/docker-compose.dev.yaml | 1 - packages/server/src/api/controllers/static/index.js | 2 +- packages/server/src/api/routes/tests/row.spec.js | 4 ++-- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/hosting/docker-compose.dev.yaml b/hosting/docker-compose.dev.yaml index 3b99ef796c..eaced64e06 100644 --- a/hosting/docker-compose.dev.yaml +++ b/hosting/docker-compose.dev.yaml @@ -14,7 +14,6 @@ services: environment: MINIO_ACCESS_KEY: ${MINIO_ACCESS_KEY} MINIO_SECRET_KEY: ${MINIO_SECRET_KEY} - MINIO_BROWSER: "off" command: server /data healthcheck: test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"] diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 64cfb122f7..8eac910261 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -71,7 +71,7 @@ exports.uploadFile = async function (ctx) { return prepareUpload({ file, - s3Key: `assets/${ctx.appId}/attachments/${processedFileName}`, + s3Key: `/${ctx.appId}/attachments/${processedFileName}`, bucket: ObjectStoreBuckets.APPS, }) }) diff --git a/packages/server/src/api/routes/tests/row.spec.js b/packages/server/src/api/routes/tests/row.spec.js index ce7d76100b..60796e56f1 100644 --- a/packages/server/src/api/routes/tests/row.spec.js +++ b/packages/server/src/api/routes/tests/row.spec.js @@ -385,7 +385,7 @@ describe("/rows", () => { name: "test", description: "test", attachment: [{ - key: `${config.getAppId()}/attachment/test/thing.csv`, + key: `${config.getAppId()}/attachments/test/thing.csv`, }], tableId: table._id, }) @@ -393,7 +393,7 @@ describe("/rows", () => { await setup.switchToSelfHosted(async () => { const enriched = await outputProcessing(config.getAppId(), table, [row]) expect(enriched[0].attachment[0].url).toBe( - `/prod-budi-app-assets/${config.getAppId()}/attachment/test/thing.csv` + `/prod-budi-app-assets/${config.getAppId()}/attachments/test/thing.csv` ) }) }) From 968c4dabb7718720ca105e80f248590301bca2ce Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Wed, 9 Jun 2021 18:01:31 +0000 Subject: [PATCH 12/14] v0.9.41 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 6 +++--- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lerna.json b/lerna.json index 8a46a8b0b2..137e5a8602 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.40", + "version": "0.9.41", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index f683188e7c..008e261302 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.40", + "version": "0.9.41", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 0ec5631d0f..14f2f6970f 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.40", + "version": "0.9.41", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 0901e29b47..5e366a02ae 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.40", + "version": "0.9.41", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.40", - "@budibase/client": "^0.9.40", + "@budibase/bbui": "^0.9.41", + "@budibase/client": "^0.9.41", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.40", + "@budibase/string-templates": "^0.9.41", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index 252e5abd7e..d886de7e68 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.40", + "version": "0.9.41", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index f764598bde..1398440209 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.40", + "version": "0.9.41", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,13 +18,13 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/string-templates": "^0.9.40", + "@budibase/string-templates": "^0.9.41", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.40", + "@budibase/standard-components": "^0.9.41", "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "fs-extra": "^8.1.0", diff --git a/packages/server/package.json b/packages/server/package.json index ecd6907df9..d437ec3ec9 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.40", + "version": "0.9.41", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.40", - "@budibase/client": "^0.9.40", - "@budibase/string-templates": "^0.9.40", + "@budibase/auth": "^0.9.41", + "@budibase/client": "^0.9.41", + "@budibase/string-templates": "^0.9.41", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -109,7 +109,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.40", + "@budibase/standard-components": "^0.9.41", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 8eb9007698..269293fd6d 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.40", + "version": "0.9.41", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.40", + "@budibase/bbui": "^0.9.41", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", "apexcharts": "^3.22.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index a1139b7835..e7c6681110 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.40", + "version": "0.9.41", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 54fa295db3..1d628d3054 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.40", + "version": "0.9.41", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.40", - "@budibase/string-templates": "^0.9.40", + "@budibase/auth": "^0.9.41", + "@budibase/string-templates": "^0.9.41", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From 73e7398a4173b7df1317d6802c67abe1c8ba7319 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Thu, 10 Jun 2021 11:34:37 +0100 Subject: [PATCH 13/14] Removing leading slash. --- packages/server/src/api/controllers/static/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/api/controllers/static/index.js b/packages/server/src/api/controllers/static/index.js index 8eac910261..92306259b6 100644 --- a/packages/server/src/api/controllers/static/index.js +++ b/packages/server/src/api/controllers/static/index.js @@ -71,7 +71,7 @@ exports.uploadFile = async function (ctx) { return prepareUpload({ file, - s3Key: `/${ctx.appId}/attachments/${processedFileName}`, + s3Key: `${ctx.appId}/attachments/${processedFileName}`, bucket: ObjectStoreBuckets.APPS, }) }) From fac53fe92fe7c0e3293a6051641a84b316a5a856 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Thu, 10 Jun 2021 10:51:32 +0000 Subject: [PATCH 14/14] v0.9.42 --- lerna.json | 2 +- packages/auth/package.json | 2 +- packages/bbui/package.json | 2 +- packages/builder/package.json | 8 ++++---- packages/cli/package.json | 2 +- packages/client/package.json | 6 +++--- packages/server/package.json | 10 +++++----- packages/standard-components/package.json | 4 ++-- packages/string-templates/package.json | 2 +- packages/worker/package.json | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/lerna.json b/lerna.json index 137e5a8602..605266be51 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.41", + "version": "0.9.42", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 008e261302..888390cb00 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.41", + "version": "0.9.42", "description": "Authentication middlewares for budibase builder and apps", "main": "src/index.js", "author": "Budibase", diff --git a/packages/bbui/package.json b/packages/bbui/package.json index 14f2f6970f..4769e55fa9 100644 --- a/packages/bbui/package.json +++ b/packages/bbui/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/bbui", "description": "A UI solution used in the different Budibase projects.", - "version": "0.9.41", + "version": "0.9.42", "license": "AGPL-3.0", "svelte": "src/index.js", "module": "dist/bbui.es.js", diff --git a/packages/builder/package.json b/packages/builder/package.json index 5e366a02ae..85e2884a8b 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.41", + "version": "0.9.42", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.41", - "@budibase/client": "^0.9.41", + "@budibase/bbui": "^0.9.42", + "@budibase/client": "^0.9.42", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.41", + "@budibase/string-templates": "^0.9.42", "@sentry/browser": "5.19.1", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", diff --git a/packages/cli/package.json b/packages/cli/package.json index d886de7e68..0b3bb30160 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.41", + "version": "0.9.42", "description": "Budibase CLI, for developers, self hosting and migrations.", "main": "src/index.js", "bin": { diff --git a/packages/client/package.json b/packages/client/package.json index 1398440209..d4c1e68683 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.41", + "version": "0.9.42", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,13 +18,13 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/string-templates": "^0.9.41", + "@budibase/string-templates": "^0.9.42", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.41", + "@budibase/standard-components": "^0.9.42", "@rollup/plugin-commonjs": "^18.0.0", "@rollup/plugin-node-resolve": "^11.2.1", "fs-extra": "^8.1.0", diff --git a/packages/server/package.json b/packages/server/package.json index d437ec3ec9..cb6751186a 100644 --- a/packages/server/package.json +++ b/packages/server/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/server", "email": "hi@budibase.com", - "version": "0.9.41", + "version": "0.9.42", "description": "Budibase Web Server", "main": "src/electron.js", "repository": { @@ -55,9 +55,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.41", - "@budibase/client": "^0.9.41", - "@budibase/string-templates": "^0.9.41", + "@budibase/auth": "^0.9.42", + "@budibase/client": "^0.9.42", + "@budibase/string-templates": "^0.9.42", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -109,7 +109,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.41", + "@budibase/standard-components": "^0.9.42", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 269293fd6d..0ea1ebce03 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.41", + "version": "0.9.42", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.41", + "@budibase/bbui": "^0.9.42", "@spectrum-css/page": "^3.0.1", "@spectrum-css/vars": "^3.0.1", "apexcharts": "^3.22.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index e7c6681110..b1dc7e9a25 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.41", + "version": "0.9.42", "description": "Handlebars wrapper for Budibase templating.", "main": "src/index.cjs", "module": "dist/bundle.mjs", diff --git a/packages/worker/package.json b/packages/worker/package.json index 1d628d3054..db15ad4f6b 100644 --- a/packages/worker/package.json +++ b/packages/worker/package.json @@ -1,7 +1,7 @@ { "name": "@budibase/worker", "email": "hi@budibase.com", - "version": "0.9.41", + "version": "0.9.42", "description": "Budibase background service", "main": "src/index.js", "repository": { @@ -21,8 +21,8 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.41", - "@budibase/string-templates": "^0.9.41", + "@budibase/auth": "^0.9.42", + "@budibase/string-templates": "^0.9.42", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3",