From 33a173f057d8529c15702c4465bfc6d01838ca66 Mon Sep 17 00:00:00 2001 From: Joe <49767913+joebudi@users.noreply.github.com> Date: Tue, 1 Jun 2021 13:42:00 +0100 Subject: [PATCH 1/6] Update README.md --- README.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 4d87e531e3..d5eba71324 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@

- +

@@ -43,7 +43,7 @@

- Sign-up + Get started · Docs · @@ -70,7 +70,7 @@ - **Automate processes, integrate with other tools, and connect to webhooks.** Save time by automating manual processes and workflows. From connecting to webhooks, to automating emails, simply tell Budibase what to do and let it work for you. You can easily [create new automations for Budibase here](https://github.com/Budibase/automations) or [request new integrations here](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas).

- Budibase design ui + Budibase design ui

From f132bf7c9313985f0eb234e1757c5c6d23685b11 Mon Sep 17 00:00:00 2001 From: Budibase Release Bot <> Date: Tue, 1 Jun 2021 12:50:43 +0000 Subject: [PATCH 2/6] v0.9.19 --- 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 84762fd054..fec1d92e04 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.18", + "version": "0.9.19", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 822ed527d5..5b4d659665 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.18", + "version": "0.9.19", "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 feb4887cc7..5dc733ef3a 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.18", + "version": "0.9.19", "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 9b128e29f6..122dcff31d 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.18", + "version": "0.9.19", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.18", - "@budibase/client": "^0.9.18", + "@budibase/bbui": "^0.9.19", + "@budibase/client": "^0.9.19", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.18", + "@budibase/string-templates": "^0.9.19", "@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 9367e56e7b..be5956cf15 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.18", + "version": "0.9.19", "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 0d5410375b..8f6462adaa 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.18", + "version": "0.9.19", "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.18", + "@budibase/string-templates": "^0.9.19", "regexparam": "^1.3.0", "shortid": "^2.2.15", "svelte-spa-router": "^3.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.18", + "@budibase/standard-components": "^0.9.19", "@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 a0fe90505c..885f2a0af4 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.18", + "version": "0.9.19", "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.18", - "@budibase/client": "^0.9.18", - "@budibase/string-templates": "^0.9.18", + "@budibase/auth": "^0.9.19", + "@budibase/client": "^0.9.19", + "@budibase/string-templates": "^0.9.19", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -107,7 +107,7 @@ "zlib": "1.0.5" }, "devDependencies": { - "@budibase/standard-components": "^0.9.18", + "@budibase/standard-components": "^0.9.19", "@jest/test-sequencer": "^24.8.0", "docker-compose": "^0.23.6", "eslint": "^6.8.0", diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 301850df6b..45449b45c0 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.18", + "version": "0.9.19", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.18", + "@budibase/bbui": "^0.9.19", "@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 636cd114de..341b03e0e4 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.18", + "version": "0.9.19", "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 7d94eb34e8..3d15091992 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.18", + "version": "0.9.19", "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.18", - "@budibase/string-templates": "^0.9.18", + "@budibase/auth": "^0.9.19", + "@budibase/string-templates": "^0.9.19", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", From 36b39ef4df872e5c122686787a6e4fe88f20e0da Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 1 Jun 2021 15:00:28 +0100 Subject: [PATCH 3/6] merge google accounts, improve connection pooling for RDBMS --- .../auth/src/middleware/passport/google.js | 32 +++++++++++++++++-- .../server/src/api/controllers/datasource.js | 7 ++++ .../src/integrations/microsoftSqlServer.js | 10 +++--- packages/server/src/integrations/postgres.js | 25 +++++++-------- 4 files changed, 54 insertions(+), 20 deletions(-) diff --git a/packages/auth/src/middleware/passport/google.js b/packages/auth/src/middleware/passport/google.js index 407772ebf0..b56a19bcc3 100644 --- a/packages/auth/src/middleware/passport/google.js +++ b/packages/auth/src/middleware/passport/google.js @@ -2,20 +2,26 @@ const env = require("../../environment") const jwt = require("jsonwebtoken") const database = require("../../db") const GoogleStrategy = require("passport-google-oauth").OAuth2Strategy -const { StaticDatabases, generateGlobalUserID } = require("../../db/utils") +const { + StaticDatabases, + generateGlobalUserID, + ViewNames, +} = require("../../db/utils") async function authenticate(token, tokenSecret, profile, done) { // Check the user exists in the instance DB by email const db = database.getDB(StaticDatabases.GLOBAL.name) let dbUser + const userId = generateGlobalUserID(profile.id) try { // use the google profile id dbUser = await db.get(userId) } catch (err) { - console.error("Google user not found. Creating..") + console.log("Google user not found. Creating..") + // create the user const user = { _id: userId, @@ -26,6 +32,28 @@ async function authenticate(token, tokenSecret, profile, done) { }, ...profile._json, } + + // check if an account with the google email address exists locally + const users = await db.query(`database/${ViewNames.USER_BY_EMAIL}`, { + key: profile._json.email, + include_docs: true, + }) + + // Google user already exists by email + if (users.rows.length > 0) { + const existing = users.rows[0].doc + + console.log(existing) + + // remove the local account to avoid conflicts + await db.remove(existing._id, existing._rev) + + // merge with existing account + user.roles = existing.roles + user.builder = existing.builder + user.admin = existing.admin + } + const response = await db.post(user) dbUser = user diff --git a/packages/server/src/api/controllers/datasource.js b/packages/server/src/api/controllers/datasource.js index 4f3ebdb609..fa4bdf289b 100644 --- a/packages/server/src/api/controllers/datasource.js +++ b/packages/server/src/api/controllers/datasource.js @@ -4,6 +4,7 @@ const { getDatasourceParams, getQueryParams, } = require("../../db/utils") +const { integrations } = require("../../integrations") exports.fetch = async function (ctx) { const database = new CouchDB(ctx.appId) @@ -28,6 +29,12 @@ exports.save = async function (ctx) { const response = await db.post(datasource) datasource._rev = response.rev + // Drain connection pools when configuration is changed + const pool = integrations[datasource.source].pool + if (pool) { + await pool.end() + } + ctx.status = 200 ctx.message = "Datasource saved successfully." ctx.body = datasource diff --git a/packages/server/src/integrations/microsoftSqlServer.js b/packages/server/src/integrations/microsoftSqlServer.js index 05b92f1815..3dc5676e94 100644 --- a/packages/server/src/integrations/microsoftSqlServer.js +++ b/packages/server/src/integrations/microsoftSqlServer.js @@ -1,8 +1,6 @@ const sqlServer = require("mssql") const { FIELD_TYPES } = require("./Integration") -let pool - const SCHEMA = { docs: "https://github.com/tediousjs/node-mssql", description: @@ -53,19 +51,21 @@ const SCHEMA = { } class SqlServerIntegration { + static pool + constructor(config) { this.config = config this.config.options = { encrypt: this.config.encrypt, } delete this.config.encrypt - if (!pool) { - pool = new sqlServer.ConnectionPool(this.config) + if (!this.pool) { + this.pool = new sqlServer.ConnectionPool(this.config) } } async connect() { - const client = await pool.connect() + const client = await this.pool.connect() this.client = client.request() } diff --git a/packages/server/src/integrations/postgres.js b/packages/server/src/integrations/postgres.js index ed49e42f1c..ebc39a31a4 100644 --- a/packages/server/src/integrations/postgres.js +++ b/packages/server/src/integrations/postgres.js @@ -1,8 +1,6 @@ const { Pool } = require("pg") const { FIELD_TYPES } = require("./Integration") -let pool - const SCHEMA = { docs: "https://node-postgres.com", friendlyName: "PostgreSQL", @@ -35,7 +33,8 @@ const SCHEMA = { required: true, }, ssl: { - type: FIELD_TYPES.OBJECT, + type: FIELD_TYPES.BOOLEAN, + default: false, required: false, }, }, @@ -56,28 +55,28 @@ const SCHEMA = { } class PostgresIntegration { + static pool + constructor(config) { this.config = config - if (this.config.ssl && this.config.ssl.rejectUnauthorized) { - this.config.ssl.rejectUnauthorized = - this.config.ssl.rejectUnauthorized === "true" + if (this.config.ssl) { + this.config.ssl = { + rejectUnauthorized: true, + } } - if (!pool) { - pool = new Pool(this.config) + if (!this.pool) { + this.pool = new Pool(this.config) } + + this.client = this.pool } async query(sql) { try { - this.client = await pool.connect() return await this.client.query(sql) } catch (err) { throw new Error(err) - } finally { - if (this.client) { - this.client.release() - } } } From fbc425302405bdb1b4c7c0456e0979b52576b1c0 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 1 Jun 2021 15:02:27 +0100 Subject: [PATCH 4/6] Revert logo to BB emblem --- packages/builder/assets/bb-emblem.svg | 80 +++++++++++++++++++ .../src/pages/builder/admin/index.svelte | 2 +- .../builder/app/[application]/_layout.svelte | 2 +- .../src/pages/builder/apps/index.svelte | 2 +- .../src/pages/builder/auth/forgot.svelte | 2 +- .../src/pages/builder/auth/login.svelte | 2 +- .../src/pages/builder/auth/reset.svelte | 2 +- .../src/pages/builder/invite/index.svelte | 2 +- .../src/pages/builder/portal/_layout.svelte | 2 +- 9 files changed, 88 insertions(+), 8 deletions(-) create mode 100644 packages/builder/assets/bb-emblem.svg diff --git a/packages/builder/assets/bb-emblem.svg b/packages/builder/assets/bb-emblem.svg new file mode 100644 index 0000000000..9f4f3690d5 --- /dev/null +++ b/packages/builder/assets/bb-emblem.svg @@ -0,0 +1,80 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/builder/src/pages/builder/admin/index.svelte b/packages/builder/src/pages/builder/admin/index.svelte index 96f0b54679..b49152e2ed 100644 --- a/packages/builder/src/pages/builder/admin/index.svelte +++ b/packages/builder/src/pages/builder/admin/index.svelte @@ -11,7 +11,7 @@ import api from "builderStore/api" import { admin } from "stores/portal" import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" let adminUser = {} let error diff --git a/packages/builder/src/pages/builder/app/[application]/_layout.svelte b/packages/builder/src/pages/builder/app/[application]/_layout.svelte index ae11cf0c16..8c8bcbf380 100644 --- a/packages/builder/src/pages/builder/app/[application]/_layout.svelte +++ b/packages/builder/src/pages/builder/app/[application]/_layout.svelte @@ -6,7 +6,7 @@ import RevertModal from "components/deploy/RevertModal.svelte" import { get } from "builderStore/api" import { isActive, goto, layout } from "@roxi/routify" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" import { capitalise } from "helpers" // Get Package and set store diff --git a/packages/builder/src/pages/builder/apps/index.svelte b/packages/builder/src/pages/builder/apps/index.svelte index c4224b9f15..afe3296f23 100644 --- a/packages/builder/src/pages/builder/apps/index.svelte +++ b/packages/builder/src/pages/builder/apps/index.svelte @@ -19,7 +19,7 @@ import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte" import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte" import { processStringSync } from "@budibase/string-templates" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" let loaded = false let userInfoModal diff --git a/packages/builder/src/pages/builder/auth/forgot.svelte b/packages/builder/src/pages/builder/auth/forgot.svelte index f56293313a..4552774ff5 100644 --- a/packages/builder/src/pages/builder/auth/forgot.svelte +++ b/packages/builder/src/pages/builder/auth/forgot.svelte @@ -8,7 +8,7 @@ Heading, } from "@budibase/bbui" import { organisation, auth } from "stores/portal" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" let email = "" diff --git a/packages/builder/src/pages/builder/auth/login.svelte b/packages/builder/src/pages/builder/auth/login.svelte index 734a26cbf5..14ce47da8f 100644 --- a/packages/builder/src/pages/builder/auth/login.svelte +++ b/packages/builder/src/pages/builder/auth/login.svelte @@ -12,7 +12,7 @@ import { goto, params } from "@roxi/routify" import { auth } from "stores/portal" import GoogleButton from "./_components/GoogleButton.svelte" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" let username = "" let password = "" diff --git a/packages/builder/src/pages/builder/auth/reset.svelte b/packages/builder/src/pages/builder/auth/reset.svelte index e3e6ab42d9..aed2034aff 100644 --- a/packages/builder/src/pages/builder/auth/reset.svelte +++ b/packages/builder/src/pages/builder/auth/reset.svelte @@ -3,7 +3,7 @@ import { goto, params } from "@roxi/routify" import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte" import { auth } from "stores/portal" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" const resetCode = $params["?code"] let password, error diff --git a/packages/builder/src/pages/builder/invite/index.svelte b/packages/builder/src/pages/builder/invite/index.svelte index fb1a5b8281..a8eb9e83cf 100644 --- a/packages/builder/src/pages/builder/invite/index.svelte +++ b/packages/builder/src/pages/builder/invite/index.svelte @@ -3,7 +3,7 @@ import { goto, params } from "@roxi/routify" import { users } from "stores/portal" import PasswordRepeatInput from "components/common/users/PasswordRepeatInput.svelte" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" const inviteCode = $params["?code"] let password, error diff --git a/packages/builder/src/pages/builder/portal/_layout.svelte b/packages/builder/src/pages/builder/portal/_layout.svelte index ba5da18d98..0f691a33b2 100644 --- a/packages/builder/src/pages/builder/portal/_layout.svelte +++ b/packages/builder/src/pages/builder/portal/_layout.svelte @@ -15,7 +15,7 @@ import { onMount } from "svelte" import UpdateUserInfoModal from "components/settings/UpdateUserInfoModal.svelte" import ChangePasswordModal from "components/settings/ChangePasswordModal.svelte" - import Logo from "assets/bb-space-black.svg" + import Logo from "assets/bb-emblem.svg" let loaded = false let userInfoModal From a00357838d29b6cdf13c6f9d7c719261cee2eddb Mon Sep 17 00:00:00 2001 From: Martin McKeaveney Date: Tue, 1 Jun 2021 15:03:19 +0100 Subject: [PATCH 5/6] remove log --- packages/auth/src/middleware/passport/google.js | 2 -- 1 file changed, 2 deletions(-) diff --git a/packages/auth/src/middleware/passport/google.js b/packages/auth/src/middleware/passport/google.js index b56a19bcc3..96a0907536 100644 --- a/packages/auth/src/middleware/passport/google.js +++ b/packages/auth/src/middleware/passport/google.js @@ -43,8 +43,6 @@ async function authenticate(token, tokenSecret, profile, done) { if (users.rows.length > 0) { const existing = users.rows[0].doc - console.log(existing) - // remove the local account to avoid conflicts await db.remove(existing._id, existing._rev) From deacb738cfb30566aee60f3017148a75d8649398 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 1 Jun 2021 15:06:58 +0100 Subject: [PATCH 6/6] Revert logo in standard components --- packages/standard-components/src/Navigation.svelte | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/standard-components/src/Navigation.svelte b/packages/standard-components/src/Navigation.svelte index 43d8a0fa2a..29ea9eea8a 100644 --- a/packages/standard-components/src/Navigation.svelte +++ b/packages/standard-components/src/Navigation.svelte @@ -4,6 +4,9 @@ const { authStore, linkable, styleable, builderStore } = getContext("sdk") const component = getContext("component") + // BB emblem: https://i.imgur.com/Xhdt1YP.png + // Space logo: https://i.imgur.com/Dn7Xt1G.png + export let logoUrl export let hideLogo @@ -15,7 +18,7 @@