From ccb7f67458d8a8fb252b0c2ecb5b59532b2b3649 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 10 Aug 2021 13:00:15 +0100 Subject: [PATCH 1/6] ensure user metadata is created before link documents are created --- packages/server/src/db/linkedRows/LinkController.js | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/packages/server/src/db/linkedRows/LinkController.js b/packages/server/src/db/linkedRows/LinkController.js index d526bf159b..27b230f30a 100644 --- a/packages/server/src/db/linkedRows/LinkController.js +++ b/packages/server/src/db/linkedRows/LinkController.js @@ -1,6 +1,6 @@ const CouchDB = require("../index") const { IncludeDocs, getLinkDocuments } = require("./linkUtils") -const { generateLinkID } = require("../utils") +const { generateLinkID, InternalTables, generateUserMetadataID, getUserMetadataParams } = require("../utils") const Sentry = require("@sentry/node") const { FieldTypes, RelationshipTypes } = require("../../constants") @@ -208,6 +208,15 @@ class LinkController { const linkedTable = await this._db.get(field.tableId) const linkedSchema = linkedTable.schema[field.fieldName] + // We need to map the global users to metadata in each app for relationships + if (field.tableId === InternalTables.USER_METADATA) { + const users = await this._db.allDocs(getUserMetadataParams(null, {})) + const metadataRequired = rowField.filter(userId => !users.rows.some(user => user.id === userId)) + + // ensure non-existing user metadata is created in the app DB + await this._db.bulkDocs(metadataRequired.map(userId => ({ _id: userId }))) + } + // iterate through the link IDs in the row field, see if any don't exist already for (let linkId of rowField) { if (linkedSchema.relationshipType === RelationshipTypes.ONE_TO_MANY) { From 9053a847188f8f9bc67219e191486a87b6829546 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 10 Aug 2021 17:41:01 +0100 Subject: [PATCH 2/6] fix date sorting --- packages/bbui/src/Form/DatePicker.svelte | 1 + 1 file changed, 1 insertion(+) diff --git a/packages/bbui/src/Form/DatePicker.svelte b/packages/bbui/src/Form/DatePicker.svelte index cc2ed50ead..14548bed67 100644 --- a/packages/bbui/src/Form/DatePicker.svelte +++ b/packages/bbui/src/Form/DatePicker.svelte @@ -14,6 +14,7 @@ const dispatch = createEventDispatcher() const onChange = e => { value = e.detail + console.log(value.toISOString()) dispatch("change", e.detail) } From e2a86f160b9147ab7ca23d043939282a45a4c1d2 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 10 Aug 2021 17:41:11 +0100 Subject: [PATCH 3/6] fix date sorting --- packages/bbui/src/Form/DatePicker.svelte | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/bbui/src/Form/DatePicker.svelte b/packages/bbui/src/Form/DatePicker.svelte index 14548bed67..9e0c40b11d 100644 --- a/packages/bbui/src/Form/DatePicker.svelte +++ b/packages/bbui/src/Form/DatePicker.svelte @@ -13,9 +13,9 @@ const dispatch = createEventDispatcher() const onChange = e => { - value = e.detail - console.log(value.toISOString()) - dispatch("change", e.detail) + const isoString = e.detail.toISOString() + value = isoString + dispatch("change", isoString) } From 1678c86bf47c2b8d8c74941b83734aa8f2fa2c73 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 10 Aug 2021 17:46:28 +0100 Subject: [PATCH 4/6] lint --- packages/server/src/db/linkedRows/LinkController.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/server/src/db/linkedRows/LinkController.js b/packages/server/src/db/linkedRows/LinkController.js index 27b230f30a..5420c99300 100644 --- a/packages/server/src/db/linkedRows/LinkController.js +++ b/packages/server/src/db/linkedRows/LinkController.js @@ -1,6 +1,6 @@ const CouchDB = require("../index") const { IncludeDocs, getLinkDocuments } = require("./linkUtils") -const { generateLinkID, InternalTables, generateUserMetadataID, getUserMetadataParams } = require("../utils") +const { generateLinkID, InternalTables, getUserMetadataParams } = require("../utils") const Sentry = require("@sentry/node") const { FieldTypes, RelationshipTypes } = require("../../constants") From 83b99be1d66251740346411adb8bf5cc29b66dc0 Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Wed, 11 Aug 2021 20:34:45 +0100 Subject: [PATCH 5/6] linting :sparkles: --- .../server/src/db/linkedRows/LinkController.js | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/packages/server/src/db/linkedRows/LinkController.js b/packages/server/src/db/linkedRows/LinkController.js index 5420c99300..b66e2debb5 100644 --- a/packages/server/src/db/linkedRows/LinkController.js +++ b/packages/server/src/db/linkedRows/LinkController.js @@ -1,6 +1,10 @@ const CouchDB = require("../index") const { IncludeDocs, getLinkDocuments } = require("./linkUtils") -const { generateLinkID, InternalTables, getUserMetadataParams } = require("../utils") +const { + generateLinkID, + InternalTables, + getUserMetadataParams, +} = require("../utils") const Sentry = require("@sentry/node") const { FieldTypes, RelationshipTypes } = require("../../constants") @@ -211,10 +215,14 @@ class LinkController { // We need to map the global users to metadata in each app for relationships if (field.tableId === InternalTables.USER_METADATA) { const users = await this._db.allDocs(getUserMetadataParams(null, {})) - const metadataRequired = rowField.filter(userId => !users.rows.some(user => user.id === userId)) + const metadataRequired = rowField.filter( + userId => !users.rows.some(user => user.id === userId) + ) // ensure non-existing user metadata is created in the app DB - await this._db.bulkDocs(metadataRequired.map(userId => ({ _id: userId }))) + await this._db.bulkDocs( + metadataRequired.map(userId => ({ _id: userId })) + ) } // iterate through the link IDs in the row field, see if any don't exist already From 892970234b2283e871ff41831ec06b96539d3d01 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Fri, 13 Aug 2021 08:08:23 +0000 Subject: [PATCH 6/6] v0.9.105 --- 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 | 8 ++++---- 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, 23 insertions(+), 23 deletions(-) diff --git a/lerna.json b/lerna.json index 42072fe0a2..825ab2f1f1 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.104", + "version": "0.9.105", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index c51a6c727a..ea638f859f 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.104", + "version": "0.9.105", "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 42033cff38..c8f93c9dfb 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.104", + "version": "0.9.105", "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 d085ca67f2..a7ed98b639 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.104", + "version": "0.9.105", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.104", - "@budibase/client": "^0.9.104", + "@budibase/bbui": "^0.9.105", + "@budibase/client": "^0.9.105", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.104", + "@budibase/string-templates": "^0.9.105", "@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 cf27d9808e..0dc653a296 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.104", + "version": "0.9.105", "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 87c6987b51..6fe0e6b3bf 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.104", + "version": "0.9.105", "license": "MPL-2.0", "module": "dist/budibase-client.js", "main": "dist/budibase-client.js", @@ -18,9 +18,9 @@ "dev:builder": "rollup -cw" }, "dependencies": { - "@budibase/bbui": "^0.9.104", - "@budibase/standard-components": "^0.9.104", - "@budibase/string-templates": "^0.9.104", + "@budibase/bbui": "^0.9.105", + "@budibase/standard-components": "^0.9.105", + "@budibase/string-templates": "^0.9.105", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" diff --git a/packages/server/package.json b/packages/server/package.json index 891e04e499..7ca5437433 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.104", + "version": "0.9.105", "description": "Budibase Web Server", "main": "src/index.js", "repository": { @@ -60,9 +60,9 @@ "author": "Budibase", "license": "AGPL-3.0-or-later", "dependencies": { - "@budibase/auth": "^0.9.104", - "@budibase/client": "^0.9.104", - "@budibase/string-templates": "^0.9.104", + "@budibase/auth": "^0.9.105", + "@budibase/client": "^0.9.105", + "@budibase/string-templates": "^0.9.105", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -115,7 +115,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.104", + "@budibase/standard-components": "^0.9.105", "@jest/test-sequencer": "^24.8.0", "@types/bull": "^3.15.1", "@types/jest": "^26.0.23", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 9960fdb77a..a9bdbf6428 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.104", + "version": "0.9.105", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.104", + "@budibase/bbui": "^0.9.105", "@spectrum-css/card": "^3.0.3", "@spectrum-css/link": "^3.1.3", "@spectrum-css/page": "^3.0.1", diff --git a/packages/string-templates/package.json b/packages/string-templates/package.json index 709a254aee..d980f2b361 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.104", + "version": "0.9.105", "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 6348387e1d..9e33e6ac64 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.104", + "version": "0.9.105", "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.104", - "@budibase/string-templates": "^0.9.104", + "@budibase/auth": "^0.9.105", + "@budibase/string-templates": "^0.9.105", "@koa/router": "^8.0.0", "@techpass/passport-openidconnect": "^0.3.0", "aws-sdk": "^2.811.0",