From 1382c3bb12fbda94abb5dd68c0e2f738c6300537 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 15 Sep 2020 14:27:23 +0100 Subject: [PATCH 01/57] This is a breaking change, it updates the block definitions to work with the new structure of inputs and outputs. --- packages/server/src/api/controllers/record.js | 1 - packages/server/src/api/controllers/user.js | 1 + .../controllers/workflow/blockDefinitions.js | 190 ++++++++++++++++-- packages/server/src/utilities/accessLevels.js | 6 + packages/server/src/workflows/actions.js | 30 ++- packages/server/src/workflows/logic.js | 7 + 6 files changed, 203 insertions(+), 32 deletions(-) diff --git a/packages/server/src/api/controllers/record.js b/packages/server/src/api/controllers/record.js index f9cea706f5..8fc041c6af 100644 --- a/packages/server/src/api/controllers/record.js +++ b/packages/server/src/api/controllers/record.js @@ -53,7 +53,6 @@ exports.patch = async function(ctx) { ctx.body = record ctx.status = 200 ctx.message = `${model.name} updated successfully.` - return } exports.save = async function(ctx) { diff --git a/packages/server/src/api/controllers/user.js b/packages/server/src/api/controllers/user.js index d4525974f9..22cf2d2a3c 100644 --- a/packages/server/src/api/controllers/user.js +++ b/packages/server/src/api/controllers/user.js @@ -58,6 +58,7 @@ exports.create = async function(ctx) { ctx.message = "User created successfully." ctx.body = { _rev: response.rev, + _id: user._id, username, name, } diff --git a/packages/server/src/api/controllers/workflow/blockDefinitions.js b/packages/server/src/api/controllers/workflow/blockDefinitions.js index f713823245..7cd0f8ab05 100644 --- a/packages/server/src/api/controllers/workflow/blockDefinitions.js +++ b/packages/server/src/api/controllers/workflow/blockDefinitions.js @@ -1,28 +1,72 @@ +let accessLevels = require("../../../utilities/accessLevels") +let conditions = require("../../../workflows/logic").LogicConditions + const ACTION = { SAVE_RECORD: { name: "Save Record", tagline: "Save a {{record.model.name}} record", icon: "ri-save-3-fill", - description: "Save a record to your database.", - params: { - record: "record", - }, - args: { - record: {}, - }, + description: "Save a record to your database", type: "ACTION", + input: { + record: { + type: "record", + label: "The record to be written", + default: {}, + }, + model: { + type: "model", + label: "The table to save a record to", + }, + }, + output: { + response: { + type: "object", + label: "The response from the table", + }, + success: { + type: "boolean", + label: "Whether the action was successful", + }, + id: { + type: "string", + label: "The identifier of the new record", + }, + revision: { + type: "string", + label: "The revision of the new record", + }, + }, }, DELETE_RECORD: { - description: "Delete a record from your database.", + description: "Delete a record from your database", icon: "ri-delete-bin-line", name: "Delete Record", tagline: "Delete a {{record.model.name}} record", - params: {}, - args: {}, type: "ACTION", + input: { + id: { + type: "string", + label: "The identifier of the record to be deleted", + }, + revision: { + type: "string", + label: "The revision of the record to be deleted", + }, + }, + output: { + response: { + type: "object", + label: "The response from the table", + }, + success: { + type: "boolean", + label: "Whether the action was successful", + }, + }, }, CREATE_USER: { - description: "Create a new user.", + description: "Create a new user", tagline: "Create user {{username}}", icon: "ri-user-add-fill", name: "Create User", @@ -35,6 +79,40 @@ const ACTION = { accessLevelId: "POWER_USER", }, type: "ACTION", + input: { + username: { + type: "string", + label: "The username of the new user to create", + }, + password: { + type: "password", + label: "The password of the new user to create", + }, + accessLevelId: { + type: "string", + label: "The level of access to the system the new user will have", + default: accessLevels.POWERUSER_LEVEL_ID, + options: accessLevels.ACCESS_LEVELS, + }, + }, + output: { + id: { + type: "string", + label: "The identifier of the new user", + }, + revision: { + type: "string", + label: "The revision of the new user", + }, + response: { + type: "object", + label: "The response from the user table", + }, + success: { + type: "boolean", + label: "Whether the action was successful", + }, + }, }, SEND_EMAIL: { description: "Send an email.", @@ -48,6 +126,34 @@ const ACTION = { text: "longText", }, type: "ACTION", + input: { + to: { + type: "string", + label: "Email address to send email to", + }, + from: { + type: "string", + label: "Email address to send email from", + }, + subject: { + type: "string", + label: "The subject of the email", + }, + contents: { + type: "string", + label: "The contents of the email", + }, + }, + output: { + success: { + type: "boolean", + label: "Whether the email was sent", + }, + response: { + type: "object", + label: "A response from the email client, this may be an error", + }, + }, }, } @@ -56,7 +162,7 @@ const LOGIC = { name: "Filter", tagline: "{{filter}} {{condition}} {{value}}", icon: "ri-git-branch-line", - description: "Filter any workflows which do not meet certain conditions.", + description: "Filter any workflows which do not meet certain conditions", params: { filter: "string", condition: ["equals"], @@ -66,14 +172,38 @@ const LOGIC = { condition: "equals", }, type: "LOGIC", + input: { + field: { + type: "string", + label: "The input to filter on", + }, + condition: { + type: "string", + label: "The condition to use for filtering", + options: conditions, + }, + value: { + type: "string", + label: "The value to compare against", + }, + }, + output: { + success: { + type: "boolean", + label: "Whether the logic block passed", + }, + }, }, DELAY: { name: "Delay", icon: "ri-time-fill", tagline: "Delay for {{time}} milliseconds", - description: "Delay the workflow until an amount of time has passed.", - params: { - time: "number", + description: "Delay the workflow until an amount of time has passed", + input: { + time: { + type: "number", + label: "The duration of the delay in milliseconds", + }, }, type: "LOGIC", }, @@ -85,9 +215,18 @@ const TRIGGER = { event: "record:save", icon: "ri-save-line", tagline: "Record is added to {{model.name}}", - description: "Fired when a record is saved to your database.", - params: { - model: "model", + description: "Fired when a record is saved to your database", + input: { + model: { + type: "model", + label: "The table to trigger on when a new record is saved", + }, + }, + output: { + record: { + type: "record", + label: "The new record that was saved", + }, }, type: "TRIGGER", }, @@ -96,9 +235,18 @@ const TRIGGER = { event: "record:delete", icon: "ri-delete-bin-line", tagline: "Record is deleted from {{model.name}}", - description: "Fired when a record is deleted from your database.", - params: { - model: "model", + description: "Fired when a record is deleted from your database", + input: { + model: { + type: "model", + label: "The table to trigger on when a record is deleted", + }, + }, + output: { + record: { + type: "record", + label: "The record that was deleted", + }, }, type: "TRIGGER", }, diff --git a/packages/server/src/utilities/accessLevels.js b/packages/server/src/utilities/accessLevels.js index 50ae559d07..bc8ae4cb77 100644 --- a/packages/server/src/utilities/accessLevels.js +++ b/packages/server/src/utilities/accessLevels.js @@ -87,6 +87,12 @@ module.exports = { POWERUSER_LEVEL_ID, BUILDER_LEVEL_ID, ANON_LEVEL_ID, + ACCESS_LEVELS: [ + ADMIN_LEVEL_ID, + POWERUSER_LEVEL_ID, + BUILDER_LEVEL_ID, + ANON_LEVEL_ID, + ], READ_MODEL, WRITE_MODEL, READ_VIEW, diff --git a/packages/server/src/workflows/actions.js b/packages/server/src/workflows/actions.js index 1dd3aa694d..626a0af922 100644 --- a/packages/server/src/workflows/actions.js +++ b/packages/server/src/workflows/actions.js @@ -17,14 +17,18 @@ let BUILTIN_ACTIONS = { } try { - const response = await userController.create(ctx) + await userController.create(ctx) return { - user: response, + response: ctx.body, + id: ctx.body._id, + revision: ctx.body._rev, + success: ctx.status === 200, } } catch (err) { console.error(err) return { - user: null, + success: false, + response: err, } } }, @@ -45,13 +49,16 @@ let BUILTIN_ACTIONS = { try { await recordController.save(ctx) return { - record: ctx.body, + response: ctx.body, + id: ctx.body._id, + revision: ctx.body._rev, + success: ctx.status === 200, } } catch (err) { console.error(err) return { - record: null, - error: err.message, + success: false, + response: err, } } }, @@ -67,13 +74,12 @@ let BUILTIN_ACTIONS = { await sgMail.send(msg) return { success: true, - ...args, } } catch (err) { console.error(err) return { success: false, - error: err.message, + response: err, } } }, @@ -94,11 +100,15 @@ let BUILTIN_ACTIONS = { try { await recordController.destroy(ctx) + return { + response: ctx.body, + success: ctx.status === 200, + } } catch (err) { console.error(err) return { - record: null, - error: err.message, + success: false, + response: err, } } }, diff --git a/packages/server/src/workflows/logic.js b/packages/server/src/workflows/logic.js index a1d71bc0f2..376a712a4d 100644 --- a/packages/server/src/workflows/logic.js +++ b/packages/server/src/workflows/logic.js @@ -22,3 +22,10 @@ module.exports.getLogic = function(logicName) { return LOGIC[logicName] } } + +module.exports.LogicConditions = [ + "equals", + "notEquals", + "greaterThan", + "lessThan", +] From ba125b59879bbf0d8b17fc9342edf945b019d034 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Tue, 15 Sep 2020 14:45:37 +0100 Subject: [PATCH 02/57] Update workflow block definitions --- .../controllers/workflow/blockDefinitions.js | 103 +++++++----------- 1 file changed, 41 insertions(+), 62 deletions(-) diff --git a/packages/server/src/api/controllers/workflow/blockDefinitions.js b/packages/server/src/api/controllers/workflow/blockDefinitions.js index 7cd0f8ab05..30a98501b9 100644 --- a/packages/server/src/api/controllers/workflow/blockDefinitions.js +++ b/packages/server/src/api/controllers/workflow/blockDefinitions.js @@ -4,11 +4,11 @@ let conditions = require("../../../workflows/logic").LogicConditions const ACTION = { SAVE_RECORD: { name: "Save Record", - tagline: "Save a {{record.model.name}} record", + tagline: "Save a {{inputs.record.model.name}} record", icon: "ri-save-3-fill", description: "Save a record to your database", type: "ACTION", - input: { + inputs: { record: { type: "record", label: "The record to be written", @@ -16,10 +16,10 @@ const ACTION = { }, model: { type: "model", - label: "The table to save a record to", + label: "Table", }, }, - output: { + outputs: { response: { type: "object", label: "The response from the table", @@ -42,19 +42,19 @@ const ACTION = { description: "Delete a record from your database", icon: "ri-delete-bin-line", name: "Delete Record", - tagline: "Delete a {{record.model.name}} record", + tagline: "Delete a {{inputs.record.model.name}} record", type: "ACTION", - input: { + inputs: { id: { type: "string", - label: "The identifier of the record to be deleted", + label: "Record ID", }, revision: { type: "string", - label: "The revision of the record to be deleted", + label: "Record Revision", }, }, - output: { + outputs: { response: { type: "object", label: "The response from the table", @@ -67,35 +67,27 @@ const ACTION = { }, CREATE_USER: { description: "Create a new user", - tagline: "Create user {{username}}", + tagline: "Create user {{inputs.username}}", icon: "ri-user-add-fill", name: "Create User", - params: { - username: "string", - password: "password", - accessLevelId: "accessLevel", - }, - args: { - accessLevelId: "POWER_USER", - }, type: "ACTION", - input: { + inputs: { username: { type: "string", - label: "The username of the new user to create", + label: "Username", }, password: { type: "password", - label: "The password of the new user to create", + label: "Password", }, accessLevelId: { type: "string", - label: "The level of access to the system the new user will have", + label: "Access Level", default: accessLevels.POWERUSER_LEVEL_ID, options: accessLevels.ACCESS_LEVELS, }, }, - output: { + outputs: { id: { type: "string", label: "The identifier of the new user", @@ -116,35 +108,29 @@ const ACTION = { }, SEND_EMAIL: { description: "Send an email.", - tagline: "Send email to {{to}}", + tagline: "Send email to {{inputs.to}}", icon: "ri-mail-open-fill", name: "Send Email", - params: { - to: "string", - from: "string", - subject: "longText", - text: "longText", - }, type: "ACTION", - input: { + inputs: { to: { type: "string", - label: "Email address to send email to", + label: "Send To", }, from: { type: "string", - label: "Email address to send email from", + label: "Send From", }, subject: { type: "string", - label: "The subject of the email", + label: "Email Subject", }, contents: { type: "string", - label: "The contents of the email", + label: "Email Contents", }, }, - output: { + outputs: { success: { type: "boolean", label: "Whether the email was sent", @@ -160,34 +146,27 @@ const ACTION = { const LOGIC = { FILTER: { name: "Filter", - tagline: "{{filter}} {{condition}} {{value}}", + tagline: "{{inputs.filter}} {{inputs.condition}} {{inputs.value}}", icon: "ri-git-branch-line", description: "Filter any workflows which do not meet certain conditions", - params: { - filter: "string", - condition: ["equals"], - value: "string", - }, - args: { - condition: "equals", - }, type: "LOGIC", - input: { - field: { + inputs: { + filter: { type: "string", - label: "The input to filter on", + label: "Reference Value", }, condition: { type: "string", - label: "The condition to use for filtering", + label: "Condition", options: conditions, + default: "equals", }, value: { type: "string", - label: "The value to compare against", + label: "Comparison Value", }, }, - output: { + outputs: { success: { type: "boolean", label: "Whether the logic block passed", @@ -197,12 +176,12 @@ const LOGIC = { DELAY: { name: "Delay", icon: "ri-time-fill", - tagline: "Delay for {{time}} milliseconds", + tagline: "Delay for {{inputs.time}} milliseconds", description: "Delay the workflow until an amount of time has passed", - input: { + inputs: { time: { type: "number", - label: "The duration of the delay in milliseconds", + label: "Delay in milliseconds", }, }, type: "LOGIC", @@ -214,15 +193,15 @@ const TRIGGER = { name: "Record Saved", event: "record:save", icon: "ri-save-line", - tagline: "Record is added to {{model.name}}", + tagline: "Record is added to {{inputs.model.name}}", description: "Fired when a record is saved to your database", - input: { + inputs: { model: { type: "model", - label: "The table to trigger on when a new record is saved", + label: "Table", }, }, - output: { + outputs: { record: { type: "record", label: "The new record that was saved", @@ -234,15 +213,15 @@ const TRIGGER = { name: "Record Deleted", event: "record:delete", icon: "ri-delete-bin-line", - tagline: "Record is deleted from {{model.name}}", + tagline: "Record is deleted from {{inputs.model.name}}", description: "Fired when a record is deleted from your database", - input: { + inputs: { model: { type: "model", - label: "The table to trigger on when a record is deleted", + label: "Table", }, }, - output: { + outputs: { record: { type: "record", label: "The record that was deleted", From 43afb9af1bfee2a81507cc027a64e56666c2cf16 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 15 Sep 2020 15:52:38 +0100 Subject: [PATCH 03/57] Updating block definitions to use pure JSON schema so that it can be used for easy validation. --- .../controllers/workflow/blockDefinitions.js | 355 +++++++++++------- packages/server/src/workflows/actions.js | 34 +- packages/server/src/workflows/logic.js | 8 +- 3 files changed, 235 insertions(+), 162 deletions(-) diff --git a/packages/server/src/api/controllers/workflow/blockDefinitions.js b/packages/server/src/api/controllers/workflow/blockDefinitions.js index 30a98501b9..d985086be5 100644 --- a/packages/server/src/api/controllers/workflow/blockDefinitions.js +++ b/packages/server/src/api/controllers/workflow/blockDefinitions.js @@ -8,33 +8,44 @@ const ACTION = { icon: "ri-save-3-fill", description: "Save a record to your database", type: "ACTION", - inputs: { - record: { - type: "record", - label: "The record to be written", - default: {}, + inputs: {}, + schema: { + inputs: { + properties: { + record: { + type: "object", + customType: "record", + title: "The record to be written", + default: {}, + }, + model: { + type: "object", + customType: "model", + title: "Table", + }, + }, + required: ["record", "model"], }, - model: { - type: "model", - label: "Table", - }, - }, - outputs: { - response: { - type: "object", - label: "The response from the table", - }, - success: { - type: "boolean", - label: "Whether the action was successful", - }, - id: { - type: "string", - label: "The identifier of the new record", - }, - revision: { - type: "string", - label: "The revision of the new record", + outputs: { + properties: { + response: { + type: "object", + description: "The response from the table", + }, + success: { + type: "boolean", + description: "Whether the action was successful", + }, + id: { + type: "string", + description: "The identifier of the new record", + }, + revision: { + type: "string", + description: "The revision of the new record", + }, + }, + required: ["success", "id", "revision"], }, }, }, @@ -44,24 +55,33 @@ const ACTION = { name: "Delete Record", tagline: "Delete a {{inputs.record.model.name}} record", type: "ACTION", - inputs: { - id: { - type: "string", - label: "Record ID", + inputs: {}, + schema: { + inputs: { + properties: { + id: { + type: "string", + title: "Record ID", + }, + revision: { + type: "string", + title: "Record Revision", + }, + }, + required: ["id", "revision"], }, - revision: { - type: "string", - label: "Record Revision", - }, - }, - outputs: { - response: { - type: "object", - label: "The response from the table", - }, - success: { - type: "boolean", - label: "Whether the action was successful", + outputs: { + properties: { + response: { + type: "object", + description: "The response from the table", + }, + success: { + type: "boolean", + description: "Whether the action was successful", + }, + }, + required: ["success"], }, }, }, @@ -71,38 +91,48 @@ const ACTION = { icon: "ri-user-add-fill", name: "Create User", type: "ACTION", - inputs: { - username: { - type: "string", - label: "Username", + inputs: {}, + schema: { + inputs: { + properties: { + username: { + type: "string", + title: "Username", + }, + password: { + type: "string", + customType: "password", + title: "Password", + }, + accessLevelId: { + type: "string", + title: "Access Level", + default: accessLevels.POWERUSER_LEVEL_ID, + enum: accessLevels.ACCESS_LEVELS, + }, + }, + required: ["username", "password", "accessLevelId"], }, - password: { - type: "password", - label: "Password", - }, - accessLevelId: { - type: "string", - label: "Access Level", - default: accessLevels.POWERUSER_LEVEL_ID, - options: accessLevels.ACCESS_LEVELS, - }, - }, - outputs: { - id: { - type: "string", - label: "The identifier of the new user", - }, - revision: { - type: "string", - label: "The revision of the new user", - }, - response: { - type: "object", - label: "The response from the user table", - }, - success: { - type: "boolean", - label: "Whether the action was successful", + outputs: { + properties: { + id: { + type: "string", + description: "The identifier of the new user", + }, + revision: { + type: "string", + description: "The revision of the new user", + }, + response: { + type: "object", + description: "The response from the user table", + }, + success: { + type: "boolean", + description: "Whether the action was successful", + }, + }, + required: ["id", "revision", "success"], }, }, }, @@ -112,32 +142,42 @@ const ACTION = { icon: "ri-mail-open-fill", name: "Send Email", type: "ACTION", - inputs: { - to: { - type: "string", - label: "Send To", + inputs: {}, + schema: { + inputs: { + properties: { + to: { + type: "string", + title: "Send To", + }, + from: { + type: "string", + title: "Send From", + }, + subject: { + type: "string", + title: "Email Subject", + }, + contents: { + type: "string", + title: "Email Contents", + }, + }, + required: ["to", "from", "subject", "contents"], }, - from: { - type: "string", - label: "Send From", - }, - subject: { - type: "string", - label: "Email Subject", - }, - contents: { - type: "string", - label: "Email Contents", - }, - }, - outputs: { - success: { - type: "boolean", - label: "Whether the email was sent", - }, - response: { - type: "object", - label: "A response from the email client, this may be an error", + outputs: { + properties: { + success: { + type: "boolean", + description: "Whether the email was sent", + }, + response: { + type: "object", + description: + "A response from the email client, this may be an error", + }, + }, + required: ["success"], }, }, }, @@ -150,26 +190,33 @@ const LOGIC = { icon: "ri-git-branch-line", description: "Filter any workflows which do not meet certain conditions", type: "LOGIC", - inputs: { - filter: { - type: "string", - label: "Reference Value", + inputs: {}, + schema: { + inputs: { + filter: { + type: "string", + title: "Reference Value", + }, + condition: { + type: "string", + title: "Condition", + enum: conditions, + default: "equals", + }, + value: { + type: "string", + title: "Comparison Value", + }, + required: ["filter", "condition", "value"], }, - condition: { - type: "string", - label: "Condition", - options: conditions, - default: "equals", - }, - value: { - type: "string", - label: "Comparison Value", - }, - }, - outputs: { - success: { - type: "boolean", - label: "Whether the logic block passed", + outputs: { + properties: { + success: { + type: "boolean", + description: "Whether the logic block passed", + }, + }, + required: ["success"], }, }, }, @@ -178,10 +225,16 @@ const LOGIC = { icon: "ri-time-fill", tagline: "Delay for {{inputs.time}} milliseconds", description: "Delay the workflow until an amount of time has passed", - inputs: { - time: { - type: "number", - label: "Delay in milliseconds", + inputs: {}, + schema: { + inputs: { + properties: { + time: { + type: "number", + title: "Delay in milliseconds", + }, + }, + required: ["time"], }, }, type: "LOGIC", @@ -195,16 +248,27 @@ const TRIGGER = { icon: "ri-save-line", tagline: "Record is added to {{inputs.model.name}}", description: "Fired when a record is saved to your database", - inputs: { - model: { - type: "model", - label: "Table", + inputs: {}, + schema: { + inputs: { + properties: { + model: { + type: "object", + customType: "model", + title: "Table", + }, + }, + required: ["model"], }, - }, - outputs: { - record: { - type: "record", - label: "The new record that was saved", + outputs: { + properties: { + record: { + type: "object", + customType: "record", + description: "The new record that was saved", + }, + }, + required: ["record"], }, }, type: "TRIGGER", @@ -215,16 +279,27 @@ const TRIGGER = { icon: "ri-delete-bin-line", tagline: "Record is deleted from {{inputs.model.name}}", description: "Fired when a record is deleted from your database", - inputs: { - model: { - type: "model", - label: "Table", + inputs: {}, + schema: { + inputs: { + properties: { + model: { + type: "object", + customType: "model", + title: "Table", + }, + }, + required: ["model"], }, - }, - outputs: { - record: { - type: "record", - label: "The record that was deleted", + outputs: { + properties: { + record: { + type: "object", + customType: "record", + description: "The record that was deleted", + }, + }, + required: ["record"], }, }, type: "TRIGGER", diff --git a/packages/server/src/workflows/actions.js b/packages/server/src/workflows/actions.js index 626a0af922..1f3d8481cd 100644 --- a/packages/server/src/workflows/actions.js +++ b/packages/server/src/workflows/actions.js @@ -5,11 +5,11 @@ const sgMail = require("@sendgrid/mail") sgMail.setApiKey(process.env.SENDGRID_API_KEY) let BUILTIN_ACTIONS = { - CREATE_USER: async function({ args, context }) { - const { username, password, accessLevelId } = args + CREATE_USER: async function(inputs) { + const { username, password, accessLevelId } = inputs const ctx = { user: { - instanceId: context.instanceId, + instanceId: inputs.instanceId, }, request: { body: { username, password, accessLevelId }, @@ -32,18 +32,16 @@ let BUILTIN_ACTIONS = { } } }, - SAVE_RECORD: async function({ args, context }) { - const { model, ...record } = args.record - + SAVE_RECORD: async function(inputs) { const ctx = { params: { - instanceId: context.instanceId, - modelId: model._id, + instanceId: inputs.instanceId, + modelId: inputs.model._id, }, request: { - body: record, + body: inputs.record, }, - user: { instanceId: context.instanceId }, + user: { instanceId: inputs.instanceId }, } try { @@ -62,12 +60,12 @@ let BUILTIN_ACTIONS = { } } }, - SEND_EMAIL: async function({ args }) { + SEND_EMAIL: async function(inputs) { const msg = { - to: args.to, - from: args.from, - subject: args.subject, - text: args.text, + to: inputs.to, + from: inputs.from, + subject: inputs.subject, + text: inputs.text, } try { @@ -83,8 +81,8 @@ let BUILTIN_ACTIONS = { } } }, - DELETE_RECORD: async function({ args, context }) { - const { model, ...record } = args.record + DELETE_RECORD: async function(inputs) { + const { model, ...record } = inputs.record // TODO: better logging of when actions are missed due to missing parameters if (record.recordId == null || record.revId == null) { return @@ -95,7 +93,7 @@ let BUILTIN_ACTIONS = { recordId: record.recordId, revId: record.revId, }, - user: { instanceId: context.instanceId }, + user: { instanceId: inputs.instanceId }, } try { diff --git a/packages/server/src/workflows/logic.js b/packages/server/src/workflows/logic.js index 376a712a4d..437ac47600 100644 --- a/packages/server/src/workflows/logic.js +++ b/packages/server/src/workflows/logic.js @@ -1,12 +1,12 @@ const wait = ms => new Promise(resolve => setTimeout(resolve, ms)) let LOGIC = { - DELAY: async function delay({ args }) { - await wait(args.time) + DELAY: async function delay(inputs) { + await wait(inputs.time) }, - FILTER: async function filter({ args }) { - const { field, condition, value } = args + FILTER: async function filter(inputs) { + const { field, condition, value } = inputs switch (condition) { case "equals": if (field !== value) return From 0ade1ef55887ff38b4ca68d23bcdb31307c61688 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 16 Sep 2020 09:13:13 +0100 Subject: [PATCH 04/57] Bump svelte, rollup and rollup-plugin-terser dependencies to support optional chaining and nullish coalescing --- packages/builder/package.json | 6 +- packages/builder/yarn.lock | 375 +++++++--------------------------- 2 files changed, 80 insertions(+), 301 deletions(-) diff --git a/packages/builder/package.json b/packages/builder/package.json index 0d1b2a4163..c19d1b649e 100644 --- a/packages/builder/package.json +++ b/packages/builder/package.json @@ -99,7 +99,7 @@ "jest": "^24.8.0", "ncp": "^2.0.0", "rimraf": "^3.0.2", - "rollup": "^1.12.0", + "rollup": "^2.11.2", "rollup-plugin-alias": "^1.5.2", "rollup-plugin-commonjs": "^10.0.0", "rollup-plugin-copy": "^3.0.0", @@ -109,10 +109,10 @@ "rollup-plugin-node-globals": "^1.4.0", "rollup-plugin-node-resolve": "^5.2.0", "rollup-plugin-svelte": "^5.0.3", - "rollup-plugin-terser": "^4.0.4", + "rollup-plugin-terser": "^7.0.2", "rollup-plugin-url": "^2.2.2", "start-server-and-test": "^1.11.0", - "svelte": "3.23.x", + "svelte": "^3.24.1", "svelte-jester": "^1.0.6" }, "gitHead": "115189f72a850bfb52b65ec61d932531bf327072" diff --git a/packages/builder/yarn.lock b/packages/builder/yarn.lock index 5b23480449..2579176003 100644 --- a/packages/builder/yarn.lock +++ b/packages/builder/yarn.lock @@ -8,6 +8,13 @@ dependencies: "@babel/highlight" "^7.8.3" +"@babel/code-frame@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/code-frame/-/code-frame-7.10.4.tgz#168da1a36e90da68ae8d49c0f1b48c7c6249213a" + integrity sha512-vG6SvB6oYEhvgisZNFRmRCUkLz11c7rp+tbNTynGqc6mS1d5ATd/sGyV6W0KZZnXRKMTzZDRgQT3Ou9jhpAfUg== + dependencies: + "@babel/highlight" "^7.10.4" + "@babel/compat-data@^7.9.6": version "7.9.6" resolved "https://registry.yarnpkg.com/@babel/compat-data/-/compat-data-7.9.6.tgz#3f604c40e420131affe6f2c8052e9a275ae2049b" @@ -184,6 +191,11 @@ dependencies: "@babel/types" "^7.8.3" +"@babel/helper-validator-identifier@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.10.4.tgz#a78c7a7251e01f616512d31b10adcf52ada5e0d2" + integrity sha512-3U9y+43hz7ZM+rzG24Qe2mufW5KhvFg/NhnNph+i9mgCtdTCtMJuI1TMkrIUiK7Ix4PYlRF9I5dhqaLYA/ADXw== + "@babel/helper-validator-identifier@^7.9.0", "@babel/helper-validator-identifier@^7.9.5": version "7.9.5" resolved "https://registry.yarnpkg.com/@babel/helper-validator-identifier/-/helper-validator-identifier-7.9.5.tgz#90977a8e6fbf6b431a7dc31752eee233bf052d80" @@ -205,6 +217,15 @@ "@babel/traverse" "^7.9.6" "@babel/types" "^7.9.6" +"@babel/highlight@^7.10.4": + version "7.10.4" + resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.10.4.tgz#7d1bdfd65753538fabe6c38596cdb76d9ac60143" + integrity sha512-i6rgnR/YgPEQzZZnbTHHuZdlE8qyoBNalD6F+q4vAFlcMEcqmkoG+mPqJYJCo63qPf74+Y1UZsl3l6f7/RIkmA== + dependencies: + "@babel/helper-validator-identifier" "^7.10.4" + chalk "^2.0.0" + js-tokens "^4.0.0" + "@babel/highlight@^7.8.3": version "7.9.0" resolved "https://registry.yarnpkg.com/@babel/highlight/-/highlight-7.9.0.tgz#4e9b45ccb82b79607271b2979ad82c7b68163079" @@ -696,21 +717,6 @@ sirv-cli "^0.4.6" svelte-flatpickr "^2.4.0" -"@budibase/client@^0.1.19": - version "0.1.19" - resolved "https://registry.yarnpkg.com/@budibase/client/-/client-0.1.19.tgz#3906781423ab4626118c981657ecf7a4578c547c" - integrity sha512-crxnLgebsh6CR0aMleDahY/1vFPbveG6JuSS/EVZeoBmckzK8hwiUQYQhIlf68nZfzWsCE/M9TX7SJxsrKY3bQ== - dependencies: - "@nx-js/compiler-util" "^2.0.0" - bcryptjs "^2.4.3" - deep-equal "^2.0.1" - lodash "^4.17.15" - lunr "^2.3.5" - mustache "^4.0.1" - regexparam "^1.3.0" - shortid "^2.2.8" - svelte "^3.9.2" - "@budibase/colorpicker@^1.0.1": version "1.0.1" resolved "https://registry.yarnpkg.com/@budibase/colorpicker/-/colorpicker-1.0.1.tgz#940c180e7ebba0cb0756c4c8ef13f5dfab58e810" @@ -960,11 +966,6 @@ "@nodelib/fs.scandir" "2.1.3" fastq "^1.6.0" -"@nx-js/compiler-util@^2.0.0": - version "2.0.0" - resolved "https://registry.yarnpkg.com/@nx-js/compiler-util/-/compiler-util-2.0.0.tgz#c74c12165fa2f017a292bb79af007e8fce0af297" - integrity sha512-AxSQbwj9zqt8DYPZ6LwZdytqnwfiOEdcFdq4l8sdjkZmU2clTht7RDLCI8xvkp7KqgcNaOGlTeCM55TULWruyQ== - "@polka/url@^0.5.0": version "0.5.0" resolved "https://registry.yarnpkg.com/@polka/url/-/url-0.5.0.tgz#b21510597fd601e5d7c95008b76bf0d254ebfd31" @@ -1144,10 +1145,6 @@ version "1.1.1" resolved "https://registry.yarnpkg.com/@types/color-name/-/color-name-1.1.1.tgz#1c1261bbeaa10a8055bbc5d8ab84b7b2afc846a0" -"@types/estree@*": - version "0.0.44" - resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.44.tgz#980cc5a29a3ef3bea6ff1f7d021047d7ea575e21" - "@types/estree@0.0.39": version "0.0.39" resolved "https://registry.yarnpkg.com/@types/estree/-/estree-0.0.39.tgz#e177e699ee1b8c22d23174caaa7422644389509f" @@ -1290,7 +1287,7 @@ acorn@^6.0.1: version "6.4.1" resolved "https://registry.yarnpkg.com/acorn/-/acorn-6.4.1.tgz#531e58ba3f51b9dacb9a6646ca4debf5b14ca474" -acorn@^7.1.0, acorn@^7.1.1: +acorn@^7.1.1: version "7.2.0" resolved "https://registry.yarnpkg.com/acorn/-/acorn-7.2.0.tgz#17ea7e40d7c8640ff54a694c889c26f31704effe" @@ -1391,11 +1388,6 @@ array-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/array-equal/-/array-equal-1.0.0.tgz#8c2a5ef2472fd9ea742b04c77a75093ba2757c93" -array-filter@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/array-filter/-/array-filter-1.0.0.tgz#baf79e62e6ef4c2a4c0b831232daffec251f9d83" - integrity sha1-uveeYubvTCpMC4MSMtr/7CUfnYM= - array-union@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/array-union/-/array-union-2.1.0.tgz#b798420adbeb1de828d84acd8a2e23d3efe85e8d" @@ -1450,13 +1442,6 @@ atob@^2.1.2: version "2.1.2" resolved "https://registry.yarnpkg.com/atob/-/atob-2.1.2.tgz#6d9517eb9e030d2436666651e86bd9f6f13533c9" -available-typed-arrays@^1.0.0, available-typed-arrays@^1.0.2: - version "1.0.2" - resolved "https://registry.yarnpkg.com/available-typed-arrays/-/available-typed-arrays-1.0.2.tgz#6b098ca9d8039079ee3f77f7b783c4480ba513f5" - integrity sha512-XWX3OX8Onv97LMk/ftVyBibpGwY5a8SmuxZPzeOxqmuEqUCOM9ZE+uIaD1VNJ5QnvU2UQusvmKbuM1FR8QWGfQ== - dependencies: - array-filter "^1.0.0" - aws-sign2@~0.7.0: version "0.7.0" resolved "https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz#b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8" @@ -1531,11 +1516,6 @@ bcrypt-pbkdf@^1.0.0: dependencies: tweetnacl "^0.14.3" -bcryptjs@^2.4.3: - version "2.4.3" - resolved "https://registry.yarnpkg.com/bcryptjs/-/bcryptjs-2.4.3.tgz#9ab5627b93e60621ff7cdac5da9733027df1d0cb" - integrity sha1-mrVie5PmBiH/fNrF2pczAn3x0Ms= - binary-extensions@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/binary-extensions/-/binary-extensions-2.0.0.tgz#23c0df14f6a88077f5f986c0d167ec03c3d5537c" @@ -1922,7 +1902,7 @@ combined-stream@^1.0.6, combined-stream@~1.0.6: dependencies: delayed-stream "~1.0.0" -commander@2, commander@^2.19.0: +commander@2, commander@^2.20.0: version "2.20.3" resolved "https://registry.yarnpkg.com/commander/-/commander-2.20.3.tgz#fd485e84c03eb4881c20722ba48035e8531aeb33" @@ -2411,26 +2391,6 @@ decode-uri-component@^0.2.0: version "0.2.0" resolved "https://registry.yarnpkg.com/decode-uri-component/-/decode-uri-component-0.2.0.tgz#eb3913333458775cb84cd1a1fae062106bb87545" -deep-equal@^2.0.1: - version "2.0.3" - resolved "https://registry.yarnpkg.com/deep-equal/-/deep-equal-2.0.3.tgz#cad1c15277ad78a5c01c49c2dee0f54de8a6a7b0" - integrity sha512-Spqdl4H+ky45I9ByyJtXteOm9CaIrPmnIPmOhrkKGNYWeDgCvJ8jNYVCTjChxW4FqGuZnLHADc8EKRMX6+CgvA== - dependencies: - es-abstract "^1.17.5" - es-get-iterator "^1.1.0" - is-arguments "^1.0.4" - is-date-object "^1.0.2" - is-regex "^1.0.5" - isarray "^2.0.5" - object-is "^1.1.2" - object-keys "^1.1.1" - object.assign "^4.1.0" - regexp.prototype.flags "^1.3.0" - side-channel "^1.0.2" - which-boxed-primitive "^1.0.1" - which-collection "^1.0.1" - which-typed-array "^1.1.2" - deep-is@~0.1.3: version "0.1.3" resolved "https://registry.yarnpkg.com/deep-is/-/deep-is-0.1.3.tgz#b369d6fb5dbc13eecf524f91b070feedc357cf34" @@ -2600,54 +2560,6 @@ es-abstract@^1.17.0-next.1, es-abstract@^1.17.2, es-abstract@^1.17.5: string.prototype.trimleft "^2.1.1" string.prototype.trimright "^2.1.1" -es-abstract@^1.17.4: - version "1.17.6" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.17.6.tgz#9142071707857b2cacc7b89ecb670316c3e2d52a" - integrity sha512-Fr89bON3WFyUi5EvAeI48QTWX0AyekGgLA8H+c+7fbfCkJwRWRMLd8CQedNEyJuoYYhmtEqY92pgte1FAhBlhw== - dependencies: - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.0" - is-regex "^1.1.0" - object-inspect "^1.7.0" - object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" - -es-abstract@^1.18.0-next.0: - version "1.18.0-next.0" - resolved "https://registry.yarnpkg.com/es-abstract/-/es-abstract-1.18.0-next.0.tgz#b302834927e624d8e5837ed48224291f2c66e6fc" - integrity sha512-elZXTZXKn51hUBdJjSZGYRujuzilgXo8vSPQzjGYXLvSlGiCo8VO8ZGV3kjo9a0WNJJ57hENagwbtlRuHuzkcQ== - dependencies: - es-to-primitive "^1.2.1" - function-bind "^1.1.1" - has "^1.0.3" - has-symbols "^1.0.1" - is-callable "^1.2.0" - is-negative-zero "^2.0.0" - is-regex "^1.1.1" - object-inspect "^1.8.0" - object-keys "^1.1.1" - object.assign "^4.1.0" - string.prototype.trimend "^1.0.1" - string.prototype.trimstart "^1.0.1" - -es-get-iterator@^1.1.0: - version "1.1.0" - resolved "https://registry.yarnpkg.com/es-get-iterator/-/es-get-iterator-1.1.0.tgz#bb98ad9d6d63b31aacdc8f89d5d0ee57bcb5b4c8" - integrity sha512-UfrmHuWQlNMTs35e1ypnvikg6jCz3SK8v8ImvmDsh36fCVUR1MqoFDiyn0/k52C8NqO3YsO8Oe0azeesNuqSsQ== - dependencies: - es-abstract "^1.17.4" - has-symbols "^1.0.1" - is-arguments "^1.0.4" - is-map "^2.0.1" - is-set "^2.0.1" - is-string "^1.0.5" - isarray "^2.0.5" - es-to-primitive@^1.2.1: version "1.2.1" resolved "https://registry.yarnpkg.com/es-to-primitive/-/es-to-primitive-1.2.1.tgz#e55cd4c9cdc188bcefb03b366c736323fc5c898a" @@ -2954,7 +2866,7 @@ for-in@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/for-in/-/for-in-1.0.2.tgz#81068d295a8142ec0ac726c6e2200c30fb6d5e80" -foreach@^2.0.5, foreach@~2.0.1: +foreach@~2.0.1: version "2.0.5" resolved "https://registry.yarnpkg.com/foreach/-/foreach-2.0.5.tgz#0bee005018aeb260d0a3af3ae658dd0136ec1b99" integrity sha1-C+4AUBiusmDQo6865ljdATbsG5k= @@ -3328,31 +3240,16 @@ is-accessor-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" -is-arguments@^1.0.4: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-arguments/-/is-arguments-1.0.4.tgz#3faf966c7cba0ff437fb31f6250082fcf0448cf3" - integrity sha512-xPh0Rmt8NE65sNzvyUmWgI1tz3mKq74lGA0mL8LYZcoIzKOzDh6HmrYm3d18k60nHerC8A9Km8kYu87zfSFnLA== - is-arrayish@^0.2.1: version "0.2.1" resolved "https://registry.yarnpkg.com/is-arrayish/-/is-arrayish-0.2.1.tgz#77c99840527aa8ecb1a8ba697b80645a7a926a9d" -is-bigint@^1.0.0: - version "1.0.0" - resolved "https://registry.yarnpkg.com/is-bigint/-/is-bigint-1.0.0.tgz#73da8c33208d00f130e9b5e15d23eac9215601c4" - integrity sha512-t5mGUXC/xRheCK431ylNiSkGGpBp8bHENBcENTkDT6ppwPzEVxNGZRvgvmOEfbWkFhA7D2GEuE2mmQTr78sl2g== - is-binary-path@~2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/is-binary-path/-/is-binary-path-2.1.0.tgz#ea1f7f3b80f064236e83470f86c09c254fb45b09" dependencies: binary-extensions "^2.0.0" -is-boolean-object@^1.0.0: - version "1.0.1" - resolved "https://registry.yarnpkg.com/is-boolean-object/-/is-boolean-object-1.0.1.tgz#10edc0900dd127697a92f6f9807c7617d68ac48e" - integrity sha512-TqZuVwa/sppcrhUCAYkGBk7w0yxfQQnxq28fjkO53tnK9FQXmdwz2JS5+GjsWQ6RByES1K40nI+yDic5c9/aAQ== - is-buffer@^1.1.5: version "1.1.6" resolved "https://registry.yarnpkg.com/is-buffer/-/is-buffer-1.1.6.tgz#efaa2ea9daa0d7ab2ea13a97b2b8ad51fefbe8be" @@ -3361,11 +3258,6 @@ is-callable@^1.1.4, is-callable@^1.1.5: version "1.1.5" resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.1.5.tgz#f7e46b596890456db74e7f6e976cb3273d06faab" -is-callable@^1.2.0: - version "1.2.1" - resolved "https://registry.yarnpkg.com/is-callable/-/is-callable-1.2.1.tgz#4d1e21a4f437509d25ce55f8184350771421c96d" - integrity sha512-wliAfSzx6V+6WfMOmus1xy0XvSgf/dlStkvTfq7F0g4bOIW0PSUbnyse3NhDwdyYS1ozfUtAAySqTws3z9Eqgg== - is-ci@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-ci/-/is-ci-2.0.0.tgz#6bc6334181810e04b5c22b3d589fdca55026404c" @@ -3384,7 +3276,7 @@ is-data-descriptor@^1.0.0: dependencies: kind-of "^6.0.0" -is-date-object@^1.0.1, is-date-object@^1.0.2: +is-date-object@^1.0.1: version "1.0.2" resolved "https://registry.yarnpkg.com/is-date-object/-/is-date-object-1.0.2.tgz#bda736f2cd8fd06d32844e7743bfa7494c3bfd7e" @@ -3449,25 +3341,10 @@ is-installed-globally@^0.3.2: global-dirs "^2.0.1" is-path-inside "^3.0.1" -is-map@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-map/-/is-map-2.0.1.tgz#520dafc4307bb8ebc33b813de5ce7c9400d644a1" - integrity sha512-T/S49scO8plUiAOA2DBTBG3JHpn1yiw0kRp6dgiZ0v2/6twi5eiB0rHtHFH9ZIrvlWc6+4O+m4zg5+Z833aXgw== - is-module@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-module/-/is-module-1.0.0.tgz#3258fb69f78c14d5b815d664336b4cffb6441591" -is-negative-zero@^2.0.0: - version "2.0.0" - resolved "https://registry.yarnpkg.com/is-negative-zero/-/is-negative-zero-2.0.0.tgz#9553b121b0fac28869da9ed459e20c7543788461" - integrity sha1-lVOxIbD6wohp2p7UWeIMdUN4hGE= - -is-number-object@^1.0.3: - version "1.0.4" - resolved "https://registry.yarnpkg.com/is-number-object/-/is-number-object-1.0.4.tgz#36ac95e741cf18b283fc1ddf5e83da798e3ec197" - integrity sha512-zohwelOAur+5uXtk8O3GPQ1eAcu4ZX3UwxQhUlfFFMNpUd83gXgjbhJh6HmB6LUNV/ieOLQuDwJO3dWJosUeMw== - is-number@^3.0.0: version "3.0.0" resolved "https://registry.yarnpkg.com/is-number/-/is-number-3.0.0.tgz#24fd6201a4782cf50561c810276afc7d12d71195" @@ -3524,18 +3401,6 @@ is-regex@^1.0.5: dependencies: has "^1.0.3" -is-regex@^1.1.0, is-regex@^1.1.1: - version "1.1.1" - resolved "https://registry.yarnpkg.com/is-regex/-/is-regex-1.1.1.tgz#c6f98aacc546f6cec5468a07b7b153ab564a57b9" - integrity sha512-1+QkEcxiLlB7VEyFtyBg94e08OAsvq7FUBgApTq/w2ymCLyKJgDPsybBENVtA7XCQEgEXxKPonG+mvYRxh/LIg== - dependencies: - has-symbols "^1.0.1" - -is-set@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-set/-/is-set-2.0.1.tgz#d1604afdab1724986d30091575f54945da7e5f43" - integrity sha512-eJEzOtVyenDs1TMzSQ3kU3K+E0GUS9sno+F0OBT97xsgcJsF9nXMBtkT9/kut5JEpM7oL7X/0qxR17K3mcwIAA== - is-stream@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-1.1.0.tgz#12d4a3dd4e68e0b79ceb8dbc84173ae80d91ca44" @@ -3544,41 +3409,16 @@ is-stream@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/is-stream/-/is-stream-2.0.0.tgz#bde9c32680d6fae04129d6ac9d921ce7815f78e3" -is-string@^1.0.4, is-string@^1.0.5: - version "1.0.5" - resolved "https://registry.yarnpkg.com/is-string/-/is-string-1.0.5.tgz#40493ed198ef3ff477b8c7f92f644ec82a5cd3a6" - integrity sha512-buY6VNRjhQMiF1qWDouloZlQbRhDPCebwxSjxMjxgemYT46YMd2NR0/H+fBhEfWX4A/w9TBJ+ol+okqJKFE6vQ== - is-symbol@^1.0.2: version "1.0.3" resolved "https://registry.yarnpkg.com/is-symbol/-/is-symbol-1.0.3.tgz#38e1014b9e6329be0de9d24a414fd7441ec61937" dependencies: has-symbols "^1.0.1" -is-typed-array@^1.1.3: - version "1.1.3" - resolved "https://registry.yarnpkg.com/is-typed-array/-/is-typed-array-1.1.3.tgz#a4ff5a5e672e1a55f99c7f54e59597af5c1df04d" - integrity sha512-BSYUBOK/HJibQ30wWkWold5txYwMUXQct9YHAQJr8fSwvZoiglcqB0pd7vEN23+Tsi9IUEjztdOSzl4qLVYGTQ== - dependencies: - available-typed-arrays "^1.0.0" - es-abstract "^1.17.4" - foreach "^2.0.5" - has-symbols "^1.0.1" - is-typedarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/is-typedarray/-/is-typedarray-1.0.0.tgz#e479c80858df0c1b11ddda6940f96011fcda4a9a" -is-weakmap@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakmap/-/is-weakmap-2.0.1.tgz#5008b59bdc43b698201d18f62b37b2ca243e8cf2" - integrity sha512-NSBR4kH5oVj1Uwvv970ruUkCV7O1mzgVFO4/rev2cLRda9Tm9HrL70ZPut4rOHgY0FNrUu9BCbXA2sdQ+x0chA== - -is-weakset@^2.0.1: - version "2.0.1" - resolved "https://registry.yarnpkg.com/is-weakset/-/is-weakset-2.0.1.tgz#e9a0af88dbd751589f5e50d80f4c98b780884f83" - integrity sha512-pi4vhbhVHGLxohUw7PhGsueT4vRGFoXhP7+RGN0jKIv9+8PWYCQTqtADngrxOm2g46hoH0+g8uZZBzMrvVGDmw== - is-windows@^1.0.2: version "1.0.2" resolved "https://registry.yarnpkg.com/is-windows/-/is-windows-1.0.2.tgz#d1850eb9791ecd18e6182ce12a30f396634bb19d" @@ -3599,11 +3439,6 @@ isarray@1.0.0, isarray@~1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/isarray/-/isarray-1.0.0.tgz#bb935d48582cba168c06834957a54a3e07124f11" -isarray@^2.0.5: - version "2.0.5" - resolved "https://registry.yarnpkg.com/isarray/-/isarray-2.0.5.tgz#8af1e4c1221244cc62459faf38940d4e644a5723" - integrity sha512-xHjhDr3cNBK0BzdUJSPXZntQUx/mwMS5Rw4A7lPJ90XGAO6ISP/ePDNuo0vhqOZU+UD5JoodwCAAoZQd3FeAKw== - isbuffer@~0.0.0: version "0.0.0" resolved "https://registry.yarnpkg.com/isbuffer/-/isbuffer-0.0.0.tgz#38c146d9df528b8bf9b0701c3d43cf12df3fc39b" @@ -4004,13 +3839,22 @@ jest-watcher@^24.9.0: jest-util "^24.9.0" string-length "^2.0.0" -jest-worker@^24.0.0, jest-worker@^24.6.0, jest-worker@^24.9.0: +jest-worker@^24.6.0, jest-worker@^24.9.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-24.9.0.tgz#5dbfdb5b2d322e98567898238a9697bcce67b3e5" dependencies: merge-stream "^2.0.0" supports-color "^6.1.0" +jest-worker@^26.2.1: + version "26.3.0" + resolved "https://registry.yarnpkg.com/jest-worker/-/jest-worker-26.3.0.tgz#7c8a97e4f4364b4f05ed8bca8ca0c24de091871f" + integrity sha512-Vmpn2F6IASefL+DVBhPzI2J9/GJUsqzomdeN+P+dK8/jKxbh8R3BtFnx3FIta7wYlPU62cpJMJQo4kuOowcMnw== + dependencies: + "@types/node" "*" + merge-stream "^2.0.0" + supports-color "^7.0.0" + jest@^24.8.0: version "24.9.0" resolved "https://registry.yarnpkg.com/jest/-/jest-24.9.0.tgz#987d290c05a08b52c56188c1002e368edb007171" @@ -4417,11 +4261,6 @@ ltgt@^2.1.2: version "2.2.1" resolved "https://registry.yarnpkg.com/ltgt/-/ltgt-2.2.1.tgz#f35ca91c493f7b73da0e07495304f17b31f87ee5" -lunr@^2.3.5: - version "2.3.9" - resolved "https://registry.yarnpkg.com/lunr/-/lunr-2.3.9.tgz#18b123142832337dd6e964df1a5a7707b25d35e1" - integrity sha512-zTU3DaZaF3Rt9rhN3uBMGQD3dD2/vFQqnvZCDv4dl5iOzq2IZQqTxu90r4E5J+nP70J3ilqVCrbho2eWaeW8Ow== - magic-string@^0.22.5: version "0.22.5" resolved "https://registry.yarnpkg.com/magic-string/-/magic-string-0.22.5.tgz#8e9cf5afddf44385c1da5bc2a6a0dbd10b03657e" @@ -4719,19 +4558,6 @@ object-inspect@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.7.0.tgz#f4f6bd181ad77f006b5ece60bd0b6f398ff74a67" -object-inspect@^1.8.0: - version "1.8.0" - resolved "https://registry.yarnpkg.com/object-inspect/-/object-inspect-1.8.0.tgz#df807e5ecf53a609cc6bfe93eac3cc7be5b3a9d0" - integrity sha512-jLdtEOB112fORuypAyl/50VRVIBIdVQOSUUGQHzJ4xBSbit81zRarz7GThkEFZy1RceYrWYcPcBFPQwHyAc1gA== - -object-is@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/object-is/-/object-is-1.1.2.tgz#c5d2e87ff9e119f78b7a088441519e2eec1573b6" - integrity sha512-5lHCz+0uufF6wZ7CRFWJN3hp8Jqblpgve06U5CMQ3f//6iDjPr2PEo9MWCjEssDsa+UZEL4PkFpr+BMop6aKzQ== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.5" - object-keys@^1.0.11, object-keys@^1.0.12, object-keys@^1.1.1: version "1.1.1" resolved "https://registry.yarnpkg.com/object-keys/-/object-keys-1.1.1.tgz#1c47f272df277f3b1daf061677d9c82e2322c60e" @@ -5125,7 +4951,7 @@ ramda@~0.26.1: version "0.26.1" resolved "https://registry.yarnpkg.com/ramda/-/ramda-0.26.1.tgz#8d41351eb8111c55353617fc3bbffad8e4d35d06" -randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5: +randombytes@^2.0.0, randombytes@^2.0.1, randombytes@^2.0.5, randombytes@^2.1.0: version "2.1.0" resolved "https://registry.yarnpkg.com/randombytes/-/randombytes-2.1.0.tgz#df6f84372f0270dc65cdf6291349ab7a473d4f2a" dependencies: @@ -5242,19 +5068,6 @@ regex-not@^1.0.0, regex-not@^1.0.2: extend-shallow "^3.0.2" safe-regex "^1.1.0" -regexp.prototype.flags@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/regexp.prototype.flags/-/regexp.prototype.flags-1.3.0.tgz#7aba89b3c13a64509dabcf3ca8d9fbb9bdf5cb75" - integrity sha512-2+Q0C5g951OlYlJz6yu5/M33IcsESLlLfsyIaLJaG4FA2r4yP8MvVMJUUP/fVBkSpbbbZlS5gynbEWLipiiXiQ== - dependencies: - define-properties "^1.1.3" - es-abstract "^1.17.0-next.1" - -regexparam@^1.3.0: - version "1.3.0" - resolved "https://registry.yarnpkg.com/regexparam/-/regexparam-1.3.0.tgz#2fe42c93e32a40eff6235d635e0ffa344b92965f" - integrity sha512-6IQpFBv6e5vz1QAqI+V4k8P2e/3gRrqfCJ9FI+O1FLQTO+Uz6RXZEZOPmTJ6hlGj7gkERzY5BRCv09whKP96/g== - regexpu-core@^4.7.0: version "4.7.0" resolved "https://registry.yarnpkg.com/regexpu-core/-/regexpu-core-4.7.0.tgz#fcbf458c50431b0bb7b45d6967b8192d91f3d938" @@ -5491,14 +5304,15 @@ rollup-plugin-svelte@^5.0.3: rollup-pluginutils "^2.8.2" sourcemap-codec "^1.4.8" -rollup-plugin-terser@^4.0.4: - version "4.0.4" - resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-4.0.4.tgz#6f661ef284fa7c27963d242601691dc3d23f994e" +rollup-plugin-terser@^7.0.2: + version "7.0.2" + resolved "https://registry.yarnpkg.com/rollup-plugin-terser/-/rollup-plugin-terser-7.0.2.tgz#e8fbba4869981b2dc35ae7e8a502d5c6c04d324d" + integrity sha512-w3iIaU4OxcF52UUXiZNsNeuXIMDvFrr+ZXK6bFZ0Q60qyVfq4uLptoS4bbq3paG3x216eQllFZX7zt6TIImguQ== dependencies: - "@babel/code-frame" "^7.0.0" - jest-worker "^24.0.0" - serialize-javascript "^1.6.1" - terser "^3.14.1" + "@babel/code-frame" "^7.10.4" + jest-worker "^26.2.1" + serialize-javascript "^4.0.0" + terser "^5.0.0" rollup-plugin-url@^2.2.2: version "2.2.4" @@ -5514,13 +5328,12 @@ rollup-pluginutils@^2.3.1, rollup-pluginutils@^2.8.1, rollup-pluginutils@^2.8.2: dependencies: estree-walker "^0.6.1" -rollup@^1.12.0: - version "1.32.1" - resolved "https://registry.yarnpkg.com/rollup/-/rollup-1.32.1.tgz#4480e52d9d9e2ae4b46ba0d9ddeaf3163940f9c4" - dependencies: - "@types/estree" "*" - "@types/node" "*" - acorn "^7.1.0" +rollup@^2.11.2: + version "2.27.0" + resolved "https://registry.yarnpkg.com/rollup/-/rollup-2.27.0.tgz#f2b70a8dd583bc3675b36686289aa9a51e27af4f" + integrity sha512-1WlbhNdzhLjdhh2wsf6CDxmuBAYG+5O53fYqCcGv8aJOoX/ymCfCY6oZnvllXZzaC/Ng+lPPwq9EMbHOKc5ozA== + optionalDependencies: + fsevents "~2.1.2" rsvp@^4.8.4: version "4.8.5" @@ -5604,9 +5417,12 @@ semver@~2.3.1: version "2.3.2" resolved "https://registry.yarnpkg.com/semver/-/semver-2.3.2.tgz#b9848f25d6cf36333073ec9ef8856d42f1233e52" -serialize-javascript@^1.6.1: - version "1.9.1" - resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-1.9.1.tgz#cfc200aef77b600c47da9bb8149c943e798c2fdb" +serialize-javascript@^4.0.0: + version "4.0.0" + resolved "https://registry.yarnpkg.com/serialize-javascript/-/serialize-javascript-4.0.0.tgz#b525e1238489a5ecfc42afacc3fe99e666f4b1aa" + integrity sha512-GaNA54380uFefWghODBWEGisLZFj00nS5ACs6yHa9nLqlLpVLO8ChDGeKRjZnV4Nh4n0Qi7nhYZD/9fCPzEqkw== + dependencies: + randombytes "^2.1.0" set-blocking@^2.0.0: version "2.0.0" @@ -5652,21 +5468,13 @@ shellwords@^0.1.1: version "0.1.1" resolved "https://registry.yarnpkg.com/shellwords/-/shellwords-0.1.1.tgz#d6b9181c1a48d397324c84871efbcfc73fc0654b" -shortid@^2.2.15, shortid@^2.2.8: +shortid@^2.2.15: version "2.2.15" resolved "https://registry.yarnpkg.com/shortid/-/shortid-2.2.15.tgz#2b902eaa93a69b11120373cd42a1f1fe4437c122" integrity sha512-5EaCy2mx2Jgc/Fdn9uuDuNIIfWBpzY4XIlhoqtXF6qsf+/+SGZ+FxDdX/ZsMZiWupIWNqAEmiNY4RC+LSmCeOw== dependencies: nanoid "^2.1.0" -side-channel@^1.0.2: - version "1.0.3" - resolved "https://registry.yarnpkg.com/side-channel/-/side-channel-1.0.3.tgz#cdc46b057550bbab63706210838df5d4c19519c3" - integrity sha512-A6+ByhlLkksFoUepsGxfj5x1gTSrs+OydsRptUxeNCabQpCFUvcwIczgOigI8vhY/OJCnPnyE9rGiwgvr9cS1g== - dependencies: - es-abstract "^1.18.0-next.0" - object-inspect "^1.8.0" - signal-exit@^3.0.0, signal-exit@^3.0.2: version "3.0.3" resolved "https://registry.yarnpkg.com/signal-exit/-/signal-exit-3.0.3.tgz#a1410c2edd8f077b08b4e253c8eacfcaf057461c" @@ -5743,7 +5551,7 @@ source-map-resolve@^0.5.0, source-map-resolve@^0.5.2: source-map-url "^0.4.0" urix "^0.1.0" -source-map-support@^0.5.6, source-map-support@~0.5.10: +source-map-support@^0.5.6, source-map-support@~0.5.12: version "0.5.19" resolved "https://registry.yarnpkg.com/source-map-support/-/source-map-support-0.5.19.tgz#a98b62f86dcaf4f67399648c085291ab9e8fed61" dependencies: @@ -5893,7 +5701,7 @@ string-width@^4.2.0: is-fullwidth-code-point "^3.0.0" strip-ansi "^6.0.0" -string.prototype.trimend@^1.0.0, string.prototype.trimend@^1.0.1: +string.prototype.trimend@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/string.prototype.trimend/-/string.prototype.trimend-1.0.1.tgz#85812a6b847ac002270f5808146064c995fb6913" dependencies: @@ -5916,7 +5724,7 @@ string.prototype.trimright@^2.1.1: es-abstract "^1.17.5" string.prototype.trimend "^1.0.0" -string.prototype.trimstart@^1.0.0, string.prototype.trimstart@^1.0.1: +string.prototype.trimstart@^1.0.0: version "1.0.1" resolved "https://registry.yarnpkg.com/string.prototype.trimstart/-/string.prototype.trimstart-1.0.1.tgz#14af6d9f34b053f7cfc89b72f8f2ee14b9039a54" dependencies: @@ -5997,6 +5805,13 @@ supports-color@^6.1.0: dependencies: has-flag "^3.0.0" +supports-color@^7.0.0: + version "7.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.2.0.tgz#1b7dcdcb32b8138801b3e478ba6a51caa89648da" + integrity sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw== + dependencies: + has-flag "^4.0.0" + supports-color@^7.1.0: version "7.1.0" resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-7.1.0.tgz#68e32591df73e25ad1c4b49108a2ec507962bfd1" @@ -6027,14 +5842,10 @@ svelte-simple-modal@^0.4.2: version "0.4.2" resolved "https://registry.yarnpkg.com/svelte-simple-modal/-/svelte-simple-modal-0.4.2.tgz#2cfe26ec8c0760b89813d65dfee836399620d6b2" -svelte@3.23.x: - version "3.23.0" - resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.23.0.tgz#bbcd6887cf588c24a975b14467455abfff9acd3f" - -svelte@^3.9.2: - version "3.25.0" - resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.25.0.tgz#e7f89d11a2223ac02d29f75f82b2a9cca7fd7a54" - integrity sha512-CUfq+YTC5Q0tBg7Q9X/QxNutdEYp7ogdbcTZF3mrowOlp3+OF1ZexHwI0Io2VqFSDxht7TlA2lTIQC4RnhR1MQ== +svelte@^3.24.1: + version "3.25.1" + resolved "https://registry.yarnpkg.com/svelte/-/svelte-3.25.1.tgz#218def1243fea5a97af6eb60f5e232315bb57ac4" + integrity sha512-IbrVKTmuR0BvDw4ii8/gBNy8REu7nWTRy9uhUz+Yuae5lIjWgSGwKlWtJGC2Vg95s+UnXPqDu0Kk/sUwe0t2GQ== symbol-observable@^1.1.0: version "1.2.0" @@ -6048,13 +5859,14 @@ synchronous-promise@^2.0.13: version "2.0.13" resolved "https://registry.yarnpkg.com/synchronous-promise/-/synchronous-promise-2.0.13.tgz#9d8c165ddee69c5a6542862b405bc50095926702" -terser@^3.14.1: - version "3.17.0" - resolved "https://registry.yarnpkg.com/terser/-/terser-3.17.0.tgz#f88ffbeda0deb5637f9d24b0da66f4e15ab10cb2" +terser@^5.0.0: + version "5.3.1" + resolved "https://registry.yarnpkg.com/terser/-/terser-5.3.1.tgz#f50fe20ab48b15234fe9bdd86b10148ad5fca787" + integrity sha512-yD80f4hdwCWTH5mojzxe1q8bN1oJbsK/vfJGLcPZM/fl+/jItIVNKhFIHqqR71OipFWMLgj3Kc+GIp6CeIqfnA== dependencies: - commander "^2.19.0" + commander "^2.20.0" source-map "~0.6.1" - source-map-support "~0.5.10" + source-map-support "~0.5.12" test-exclude@^5.2.3: version "5.2.3" @@ -6367,43 +6179,10 @@ whatwg-url@^8.0.0: tr46 "^2.0.2" webidl-conversions "^5.0.0" -which-boxed-primitive@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-boxed-primitive/-/which-boxed-primitive-1.0.1.tgz#cbe8f838ebe91ba2471bb69e9edbda67ab5a5ec1" - integrity sha512-7BT4TwISdDGBgaemWU0N0OU7FeAEJ9Oo2P1PHRm/FCWoEi2VLWC9b6xvxAA3C/NMpxg3HXVgi0sMmGbNUbNepQ== - dependencies: - is-bigint "^1.0.0" - is-boolean-object "^1.0.0" - is-number-object "^1.0.3" - is-string "^1.0.4" - is-symbol "^1.0.2" - -which-collection@^1.0.1: - version "1.0.1" - resolved "https://registry.yarnpkg.com/which-collection/-/which-collection-1.0.1.tgz#70eab71ebbbd2aefaf32f917082fc62cdcb70906" - integrity sha512-W8xeTUwaln8i3K/cY1nGXzdnVZlidBcagyNFtBdD5kxnb4TvGKR7FfSIS3mYpwWS1QUCutfKz8IY8RjftB0+1A== - dependencies: - is-map "^2.0.1" - is-set "^2.0.1" - is-weakmap "^2.0.1" - is-weakset "^2.0.1" - which-module@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/which-module/-/which-module-2.0.0.tgz#d9ef07dce77b9902b8a3a8fa4b31c3e3f7e6e87a" -which-typed-array@^1.1.2: - version "1.1.2" - resolved "https://registry.yarnpkg.com/which-typed-array/-/which-typed-array-1.1.2.tgz#e5f98e56bda93e3dac196b01d47c1156679c00b2" - integrity sha512-KT6okrd1tE6JdZAy3o2VhMoYPh3+J6EMZLyrxBQsZflI1QCZIxMrIYLkosd8Twf+YfknVIHmYQPgJt238p8dnQ== - dependencies: - available-typed-arrays "^1.0.2" - es-abstract "^1.17.5" - foreach "^2.0.5" - function-bind "^1.1.1" - has-symbols "^1.0.1" - is-typed-array "^1.1.3" - which@^1.2.9, which@^1.3.0: version "1.3.1" resolved "https://registry.yarnpkg.com/which/-/which-1.3.1.tgz#a45043d54f5805316da8d62f9f50918d3da70b0a" From a08ef045bc9dfc130a48e82d96536afde487b8d8 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Wed, 16 Sep 2020 11:20:00 +0100 Subject: [PATCH 05/57] Updating definitions to remove the use of the fat model object in workflows and make sure the record structure is common where-ever it is used (as an input or as a trigger output). --- .../controllers/workflow/blockDefinitions.js | 49 ++++++++++++------- 1 file changed, 31 insertions(+), 18 deletions(-) diff --git a/packages/server/src/api/controllers/workflow/blockDefinitions.js b/packages/server/src/api/controllers/workflow/blockDefinitions.js index d985086be5..21299076e3 100644 --- a/packages/server/src/api/controllers/workflow/blockDefinitions.js +++ b/packages/server/src/api/controllers/workflow/blockDefinitions.js @@ -4,7 +4,7 @@ let conditions = require("../../../workflows/logic").LogicConditions const ACTION = { SAVE_RECORD: { name: "Save Record", - tagline: "Save a {{inputs.record.model.name}} record", + tagline: "Save a {{inputs.enriched.model.name}} record", icon: "ri-save-3-fill", description: "Save a record to your database", type: "ACTION", @@ -14,17 +14,20 @@ const ACTION = { properties: { record: { type: "object", + properties: { + modelId: { + type: "string", + customType: "model", + title: "Table", + }, + }, customType: "record", title: "The record to be written", default: {}, - }, - model: { - type: "object", - customType: "model", - title: "Table", + required: ["modelId"], }, }, - required: ["record", "model"], + required: ["record"], }, outputs: { properties: { @@ -53,12 +56,17 @@ const ACTION = { description: "Delete a record from your database", icon: "ri-delete-bin-line", name: "Delete Record", - tagline: "Delete a {{inputs.record.model.name}} record", + tagline: "Delete a {{inputs.enriched.model.name}} record", type: "ACTION", inputs: {}, schema: { inputs: { properties: { + modelId: { + type: "string", + customType: "model", + title: "Table", + }, id: { type: "string", title: "Record ID", @@ -68,10 +76,15 @@ const ACTION = { title: "Record Revision", }, }, - required: ["id", "revision"], + required: ["modelId", "id", "revision"], }, outputs: { properties: { + record: { + type: "object", + customType: "record", + description: "The deleted record", + }, response: { type: "object", description: "The response from the table", @@ -81,7 +94,7 @@ const ACTION = { description: "Whether the action was successful", }, }, - required: ["success"], + required: ["record", "success"], }, }, }, @@ -246,19 +259,19 @@ const TRIGGER = { name: "Record Saved", event: "record:save", icon: "ri-save-line", - tagline: "Record is added to {{inputs.model.name}}", + tagline: "Record is added to {{inputs.enriched.model.name}}", description: "Fired when a record is saved to your database", inputs: {}, schema: { inputs: { properties: { - model: { - type: "object", + modelId: { + type: "string", customType: "model", title: "Table", }, }, - required: ["model"], + required: ["modelId"], }, outputs: { properties: { @@ -277,19 +290,19 @@ const TRIGGER = { name: "Record Deleted", event: "record:delete", icon: "ri-delete-bin-line", - tagline: "Record is deleted from {{inputs.model.name}}", + tagline: "Record is deleted from {{inputs.enriched.model.name}}", description: "Fired when a record is deleted from your database", inputs: {}, schema: { inputs: { properties: { - model: { - type: "object", + modelId: { + type: "string", customType: "model", title: "Table", }, }, - required: ["model"], + required: ["modelId"], }, outputs: { properties: { From a8be0682bcabe952ad0f2ec5e72f77b269c4691d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 16 Sep 2020 13:54:27 +0100 Subject: [PATCH 06/57] Fixing definition for filter workflow block --- .../controllers/workflow/blockDefinitions.js | 30 ++++++++++--------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/packages/server/src/api/controllers/workflow/blockDefinitions.js b/packages/server/src/api/controllers/workflow/blockDefinitions.js index 21299076e3..5607ac8ee4 100644 --- a/packages/server/src/api/controllers/workflow/blockDefinitions.js +++ b/packages/server/src/api/controllers/workflow/blockDefinitions.js @@ -22,7 +22,7 @@ const ACTION = { }, }, customType: "record", - title: "The record to be written", + title: "Table", default: {}, required: ["modelId"], }, @@ -206,19 +206,21 @@ const LOGIC = { inputs: {}, schema: { inputs: { - filter: { - type: "string", - title: "Reference Value", - }, - condition: { - type: "string", - title: "Condition", - enum: conditions, - default: "equals", - }, - value: { - type: "string", - title: "Comparison Value", + properties: { + filter: { + type: "string", + title: "Reference Value", + }, + condition: { + type: "string", + title: "Condition", + enum: conditions, + default: "equals", + }, + value: { + type: "string", + title: "Comparison Value", + }, }, required: ["filter", "condition", "value"], }, From 2337e1bac3248df0a6462d9dab6d28d29a08e29d Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 16 Sep 2020 13:54:56 +0100 Subject: [PATCH 07/57] Make filter condition human readable since they're just strings --- packages/server/src/workflows/logic.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/packages/server/src/workflows/logic.js b/packages/server/src/workflows/logic.js index 437ac47600..7a584f995d 100644 --- a/packages/server/src/workflows/logic.js +++ b/packages/server/src/workflows/logic.js @@ -24,8 +24,8 @@ module.exports.getLogic = function(logicName) { } module.exports.LogicConditions = [ - "equals", - "notEquals", - "greaterThan", - "lessThan", + "Equals", + "Not equals", + "Greater than", + "Less than", ] From 79860161835549abaf14126667015217dba66d16 Mon Sep 17 00:00:00 2001 From: Andrew Kingston Date: Wed, 16 Sep 2020 13:55:28 +0100 Subject: [PATCH 08/57] Update builder to support new block definitions with JSON schema --- .../ParamInputs/ModelSelector.svelte | 11 +--- .../ParamInputs/RecordSelector.svelte | 36 ++++++----- .../SetupPanel/WorkflowBlockSetup.svelte | 60 +++++++++---------- .../WorkflowBuilder/flowchart/FlowItem.svelte | 20 ++++++- 4 files changed, 63 insertions(+), 64 deletions(-) diff --git a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte index 2ea4807d3f..e95306306e 100644 --- a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/ModelSelector.svelte @@ -2,19 +2,10 @@ import { backendUiStore } from "builderStore" export let value - $: modelId = value ? value._id : "" - - function onChange(e) { - value = $backendUiStore.models.find(model => model._id === e.target.value) - }
- {#each $backendUiStore.models as model} diff --git a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte index 64db828407..809d5847b5 100644 --- a/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/ParamInputs/RecordSelector.svelte @@ -3,31 +3,24 @@ import { Input, Label } from "@budibase/bbui" export let value - $: modelId = value && value.model ? value.model._id : "" - $: schemaFields = Object.keys(value && value.model ? value.model.schema : {}) - - function onChangeModel(e) { - value.model = $backendUiStore.models.find( - model => model._id === e.target.value - ) - } + $: value = value || {} + $: model = $backendUiStore.models.find(model => model._id === value?.modelId) + $: schemaFields = Object.keys(model?.schema ?? {}) function setParsedValue(evt, field) { - const fieldSchema = value.model.schema[field] - if (fieldSchema.type === "number") { - value[field] = parseInt(evt.target.value) - return + const fieldSchema = model?.schema[field] + if (fieldSchema) { + if (fieldSchema.type === "number") { + value[field] = parseInt(evt.target.value) + return + } } value[field] = evt.target.value }
- {#each $backendUiStore.models as model} @@ -37,9 +30,8 @@ {#if schemaFields.length}
- {#each schemaFields as field} -
+
{/if} + + diff --git a/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte index 5e889a32d0..79057fd845 100644 --- a/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte +++ b/packages/builder/src/components/workflow/SetupPanel/WorkflowBlockSetup.svelte @@ -1,41 +1,36 @@
-
{block.name}
- {#each params as [parameter, type]} -
- - {#if Array.isArray(type)} - - {#each type as option} + {#each value.enum as option} {/each} - {:else if type === 'accessLevel'} - - {:else if type === 'password'} - - {:else if type === 'number'} - - {:else if type === 'longText'} -