diff --git a/README.md b/README.md index a66e3538c3..f23880bae6 100644 --- a/README.md +++ b/README.md @@ -64,7 +64,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 automation](https://github.com/Budibase/budibase/discussions?discussions_q=category%3AIdeas). -- **Admin paradise.** Budibase is made to scale. With Budibase, you can self-host on your own infraastructure and globally manage users, onboarding, SMTP, apps, groups, theming and more. You can also provide users/groups with an app portal and disseminate user-management to the group manager. +- **Admin paradise.** Budibase is made to scale. With Budibase, you can self-host on your own infrastructure and globally manage users, onboarding, SMTP, apps, groups, theming and more. You can also provide users/groups with an app portal and disseminate user-management to the group manager.

Budibase design ui diff --git a/hosting/envoy.yaml b/hosting/envoy.yaml index 20e912434a..d7b34f4d5e 100644 --- a/hosting/envoy.yaml +++ b/hosting/envoy.yaml @@ -139,5 +139,5 @@ static_resources: address: socket_address: address: watchtower-service - port_value: 6161 + port_value: 8080 diff --git a/lerna.json b/lerna.json index 8a4551b6f2..297aaa41be 100644 --- a/lerna.json +++ b/lerna.json @@ -1,5 +1,5 @@ { - "version": "0.9.50", + "version": "0.9.53", "npmClient": "yarn", "packages": [ "packages/*" diff --git a/packages/auth/package.json b/packages/auth/package.json index 2ebef3e2a6..5fbde7f1b8 100644 --- a/packages/auth/package.json +++ b/packages/auth/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/auth", - "version": "0.9.50", + "version": "0.9.53", "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 29d53397ab..847a310c96 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.50", + "version": "0.9.53", "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 4b38a9164b..4cebeed1c8 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/builder", - "version": "0.9.50", + "version": "0.9.53", "license": "AGPL-3.0", "private": true, "scripts": { @@ -65,10 +65,10 @@ } }, "dependencies": { - "@budibase/bbui": "^0.9.50", - "@budibase/client": "^0.9.50", + "@budibase/bbui": "^0.9.53", + "@budibase/client": "^0.9.53", "@budibase/colorpicker": "1.1.2", - "@budibase/string-templates": "^0.9.50", + "@budibase/string-templates": "^0.9.53", "@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 75e5c795b5..143fdebd10 100644 --- a/packages/cli/package.json +++ b/packages/cli/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/cli", - "version": "0.9.50", + "version": "0.9.53", "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 f80d5848fe..6fc386b053 100644 --- a/packages/client/package.json +++ b/packages/client/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/client", - "version": "0.9.50", + "version": "0.9.53", "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.50", - "@budibase/standard-components": "^0.9.50", - "@budibase/string-templates": "^0.9.50", + "@budibase/bbui": "^0.9.53", + "@budibase/standard-components": "^0.9.53", + "@budibase/string-templates": "^0.9.53", "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 593aa28815..379cc267d1 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.50", + "version": "0.9.53", "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.50", - "@budibase/client": "^0.9.50", - "@budibase/string-templates": "^0.9.50", + "@budibase/auth": "^0.9.53", + "@budibase/client": "^0.9.53", + "@budibase/string-templates": "^0.9.53", "@elastic/elasticsearch": "7.10.0", "@koa/router": "8.0.0", "@sendgrid/mail": "7.1.1", @@ -110,7 +110,7 @@ "devDependencies": { "@babel/core": "^7.14.3", "@babel/preset-env": "^7.14.4", - "@budibase/standard-components": "^0.9.50", + "@budibase/standard-components": "^0.9.53", "@jest/test-sequencer": "^24.8.0", "babel-jest": "^27.0.2", "docker-compose": "^0.23.6", diff --git a/packages/server/src/api/controllers/script.js b/packages/server/src/api/controllers/script.js index 3f110a2764..f312472801 100644 --- a/packages/server/src/api/controllers/script.js +++ b/packages/server/src/api/controllers/script.js @@ -3,13 +3,15 @@ const vm = require("vm") class ScriptExecutor { constructor(body) { - this.script = new vm.Script(body.script) + const code = `let fn = () => {\n${body.script}\n}; out = fn();` + this.script = new vm.Script(code) this.context = vm.createContext(body.context) this.context.fetch = fetch } execute() { - return this.script.runInContext(this.context) + this.script.runInContext(this.context) + return this.context.out } } diff --git a/packages/server/src/automations/actions.js b/packages/server/src/automations/actions.js index 762ce677a7..b0b5f9f1ba 100644 --- a/packages/server/src/automations/actions.js +++ b/packages/server/src/automations/actions.js @@ -7,6 +7,7 @@ const executeScript = require("./steps/executeScript") const bash = require("./steps/bash") const executeQuery = require("./steps/executeQuery") const outgoingWebhook = require("./steps/outgoingWebhook") +const serverLog = require("./steps/serverLog") const env = require("../environment") const Sentry = require("@sentry/node") const { @@ -24,6 +25,7 @@ const BUILTIN_ACTIONS = { EXECUTE_SCRIPT: executeScript.run, EXECUTE_BASH: bash.run, EXECUTE_QUERY: executeQuery.run, + SERVER_LOG: serverLog.run, } const BUILTIN_DEFINITIONS = { SEND_EMAIL: sendgridEmail.definition, @@ -35,6 +37,7 @@ const BUILTIN_DEFINITIONS = { EXECUTE_SCRIPT: executeScript.definition, EXECUTE_QUERY: executeQuery.definition, EXECUTE_BASH: bash.definition, + SERVER_LOG: serverLog.definition, } let MANIFEST = null diff --git a/packages/server/src/automations/steps/serverLog.js b/packages/server/src/automations/steps/serverLog.js new file mode 100644 index 0000000000..c28309c5c8 --- /dev/null +++ b/packages/server/src/automations/steps/serverLog.js @@ -0,0 +1,41 @@ +/** + * Note, there is some functionality in this that is not currently exposed as it + * is complex and maybe better to be opinionated here. + * GET/DELETE requests cannot handle body elements so they will not be sent if configured. + */ + +module.exports.definition = { + name: "Backend log", + tagline: "Console log a value in the backend", + icon: "ri-server-line", + description: "Logs the given text to the server (using console.log)", + type: "ACTION", + stepId: "SERVER_LOG", + inputs: { + text: "", + }, + schema: { + inputs: { + properties: { + text: { + type: "string", + title: "URL", + }, + }, + required: ["text"], + }, + outputs: { + properties: { + success: { + type: "boolean", + description: "Whether the action was successful", + }, + }, + required: ["success"], + }, + }, +} + +module.exports.run = async function ({ inputs, appId }) { + console.log(`App ${appId} - ${inputs.text}`) +} diff --git a/packages/server/src/db/linkedRows/LinkController.js b/packages/server/src/db/linkedRows/LinkController.js index 53ce8e45ad..c8331dec6b 100644 --- a/packages/server/src/db/linkedRows/LinkController.js +++ b/packages/server/src/db/linkedRows/LinkController.js @@ -211,14 +211,17 @@ class LinkController { // 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) { - const links = ( + let links = ( await getLinkDocuments({ appId: this._appId, tableId: field.tableId, rowId: linkId, includeDocs: IncludeDocs.EXCLUDE, }) - ).filter(link => link.id !== row._id) + ).filter( + link => + link.id !== row._id && link.fieldName === linkedSchema.name + ) // The 1 side of 1:N is already related to something else // You must remove the existing relationship diff --git a/packages/standard-components/package.json b/packages/standard-components/package.json index 76df1be08b..19c448799d 100644 --- a/packages/standard-components/package.json +++ b/packages/standard-components/package.json @@ -29,11 +29,11 @@ "keywords": [ "svelte" ], - "version": "0.9.50", + "version": "0.9.53", "license": "MIT", "gitHead": "d1836a898cab3f8ab80ee6d8f42be1a9eed7dcdc", "dependencies": { - "@budibase/bbui": "^0.9.50", + "@budibase/bbui": "^0.9.53", "@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 9ef62e7a17..fd1d0f44c0 100644 --- a/packages/string-templates/package.json +++ b/packages/string-templates/package.json @@ -1,6 +1,6 @@ { "name": "@budibase/string-templates", - "version": "0.9.50", + "version": "0.9.53", "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 7a45c307d8..6cb480acd2 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.50", + "version": "0.9.53", "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.50", - "@budibase/string-templates": "^0.9.50", + "@budibase/auth": "^0.9.53", + "@budibase/string-templates": "^0.9.53", "@koa/router": "^8.0.0", "aws-sdk": "^2.811.0", "bcryptjs": "^2.4.3", diff --git a/packages/worker/src/api/routes/tests/realEmail.spec.js b/packages/worker/src/api/routes/tests/realEmail.spec.js index 8c23141a53..acc0c7acc9 100644 --- a/packages/worker/src/api/routes/tests/realEmail.spec.js +++ b/packages/worker/src/api/routes/tests/realEmail.spec.js @@ -53,7 +53,6 @@ describe("/api/admin/email", () => { it("should be able to send a welcome email", async () => { await sendRealEmail(EmailTemplatePurpose.WELCOME) - }) it("should be able to send a invitation email", async () => {