@budibase/server 2.5.6-alpha.4 → 2.5.6-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (77) hide show
  1. package/builder/assets/{index.58b41739.js → index.564a7c4f.js} +243 -243
  2. package/builder/assets/{index.841e62d8.css → index.9e886d0a.css} +1 -1
  3. package/builder/index.html +2 -2
  4. package/dist/api/controllers/automation.js +13 -7
  5. package/dist/api/controllers/plugin/index.js +4 -35
  6. package/dist/automations/actions.js +32 -6
  7. package/dist/automations/index.js +3 -2
  8. package/dist/automations/steps/bash.js +6 -6
  9. package/dist/automations/steps/createRow.js +11 -11
  10. package/dist/automations/steps/delay.js +3 -3
  11. package/dist/automations/steps/deleteRow.js +8 -8
  12. package/dist/automations/steps/discord.js +8 -8
  13. package/dist/automations/steps/executeQuery.js +9 -9
  14. package/dist/automations/steps/executeScript.js +6 -6
  15. package/dist/automations/steps/filter.js +6 -6
  16. package/dist/automations/steps/integromat.js +10 -10
  17. package/dist/automations/steps/loop.js +9 -9
  18. package/dist/automations/steps/outgoingWebhook.js +10 -10
  19. package/dist/automations/steps/queryRows.js +14 -14
  20. package/dist/automations/steps/sendSmtpEmail.js +9 -9
  21. package/dist/automations/steps/serverLog.js +4 -4
  22. package/dist/automations/steps/slack.js +6 -6
  23. package/dist/automations/steps/updateRow.js +11 -11
  24. package/dist/automations/steps/zapier.js +9 -9
  25. package/dist/automations/triggerInfo/app.js +5 -5
  26. package/dist/automations/triggerInfo/cron.js +4 -4
  27. package/dist/automations/triggerInfo/rowDeleted.js +5 -5
  28. package/dist/automations/triggerInfo/rowSaved.js +7 -7
  29. package/dist/automations/triggerInfo/rowUpdated.js +7 -7
  30. package/dist/automations/triggerInfo/webhook.js +6 -6
  31. package/dist/integrations/index.js +3 -3
  32. package/dist/package.json +7 -7
  33. package/dist/sdk/index.js +2 -0
  34. package/dist/sdk/plugins/index.js +27 -0
  35. package/dist/sdk/plugins/plugins.js +53 -0
  36. package/dist/threads/automation.js +2 -2
  37. package/dist/tsconfig.build.tsbuildinfo +1 -1
  38. package/dist/utilities/fileSystem/plugin.js +33 -23
  39. package/dist/watch.js +2 -2
  40. package/package.json +8 -8
  41. package/src/api/controllers/automation.ts +12 -6
  42. package/src/api/controllers/plugin/index.ts +6 -43
  43. package/src/api/routes/tests/automation.spec.js +2 -2
  44. package/src/automations/actions.ts +56 -24
  45. package/src/automations/index.ts +1 -1
  46. package/src/automations/steps/bash.ts +10 -7
  47. package/src/automations/steps/createRow.ts +15 -12
  48. package/src/automations/steps/delay.ts +6 -4
  49. package/src/automations/steps/deleteRow.ts +12 -9
  50. package/src/automations/steps/discord.ts +10 -8
  51. package/src/automations/steps/executeQuery.ts +13 -10
  52. package/src/automations/steps/executeScript.ts +10 -7
  53. package/src/automations/steps/filter.ts +8 -6
  54. package/src/automations/steps/integromat.ts +12 -10
  55. package/src/automations/steps/loop.ts +16 -10
  56. package/src/automations/steps/outgoingWebhook.ts +14 -11
  57. package/src/automations/steps/queryRows.ts +18 -15
  58. package/src/automations/steps/sendSmtpEmail.ts +11 -9
  59. package/src/automations/steps/serverLog.ts +6 -4
  60. package/src/automations/steps/slack.ts +8 -6
  61. package/src/automations/steps/updateRow.ts +15 -12
  62. package/src/automations/steps/zapier.ts +11 -9
  63. package/src/automations/tests/utilities/index.ts +2 -2
  64. package/src/automations/triggerInfo/app.ts +8 -5
  65. package/src/automations/triggerInfo/cron.ts +7 -4
  66. package/src/automations/triggerInfo/rowDeleted.ts +8 -5
  67. package/src/automations/triggerInfo/rowSaved.ts +10 -7
  68. package/src/automations/triggerInfo/rowUpdated.ts +10 -7
  69. package/src/automations/triggerInfo/webhook.ts +9 -6
  70. package/src/integrations/index.ts +3 -3
  71. package/src/sdk/index.ts +2 -0
  72. package/src/sdk/plugins/index.ts +5 -0
  73. package/src/sdk/plugins/plugins.ts +41 -0
  74. package/src/tests/utilities/structures.ts +25 -17
  75. package/src/threads/automation.ts +2 -2
  76. package/src/utilities/fileSystem/plugin.ts +13 -4
  77. package/src/watch.ts +2 -2
@@ -12,12 +12,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
12
12
  return (mod && mod.__esModule) ? mod : { "default": mod };
13
13
  };
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.getDatasourcePlugin = exports.getPluginMetadata = void 0;
15
+ exports.getAutomationPlugin = exports.getDatasourcePlugin = exports.getPluginMetadata = void 0;
16
16
  const budibaseDir_1 = require("../budibaseDir");
17
17
  const fs_1 = __importDefault(require("fs"));
18
18
  const path_1 = require("path");
19
19
  const backend_core_1 = require("@budibase/backend-core");
20
20
  const DATASOURCE_PATH = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), "datasource");
21
+ const AUTOMATION_PATH = (0, path_1.join)((0, budibaseDir_1.budibaseTempDir)(), "automation");
21
22
  const getPluginMetadata = (path) => __awaiter(void 0, void 0, void 0, function* () {
22
23
  let metadata = {};
23
24
  try {
@@ -37,30 +38,39 @@ const getPluginMetadata = (path) => __awaiter(void 0, void 0, void 0, function*
37
38
  return { metadata, directory: path };
38
39
  });
39
40
  exports.getPluginMetadata = getPluginMetadata;
40
- const getDatasourcePlugin = (plugin) => __awaiter(void 0, void 0, void 0, function* () {
41
+ function getPluginImpl(path, plugin) {
41
42
  var _a;
42
- const hash = (_a = plugin.schema) === null || _a === void 0 ? void 0 : _a.hash;
43
- if (!fs_1.default.existsSync(DATASOURCE_PATH)) {
44
- fs_1.default.mkdirSync(DATASOURCE_PATH);
45
- }
46
- const filename = (0, path_1.join)(DATASOURCE_PATH, plugin.name);
47
- const metadataName = `${filename}.bbmetadata`;
48
- if (fs_1.default.existsSync(filename)) {
49
- const currentHash = fs_1.default.readFileSync(metadataName, "utf8");
50
- // if hash is the same return the file, otherwise remove it and re-download
51
- if (currentHash === hash) {
52
- return require(filename);
43
+ return __awaiter(this, void 0, void 0, function* () {
44
+ const hash = (_a = plugin.schema) === null || _a === void 0 ? void 0 : _a.hash;
45
+ if (!fs_1.default.existsSync(path)) {
46
+ fs_1.default.mkdirSync(path);
53
47
  }
54
- else {
55
- console.log(`Updating plugin: ${plugin.name}`);
56
- delete require.cache[require.resolve(filename)];
57
- fs_1.default.unlinkSync(filename);
48
+ const filename = (0, path_1.join)(path, plugin.name);
49
+ const metadataName = `${filename}.bbmetadata`;
50
+ if (fs_1.default.existsSync(filename)) {
51
+ const currentHash = fs_1.default.readFileSync(metadataName, "utf8");
52
+ // if hash is the same return the file, otherwise remove it and re-download
53
+ if (currentHash === hash) {
54
+ return require(filename);
55
+ }
56
+ else {
57
+ console.log(`Updating plugin: ${plugin.name}`);
58
+ delete require.cache[require.resolve(filename)];
59
+ fs_1.default.unlinkSync(filename);
60
+ }
58
61
  }
59
- }
60
- const pluginKey = backend_core_1.objectStore.getPluginJSKey(plugin);
61
- const pluginJs = yield backend_core_1.objectStore.retrieve(backend_core_1.objectStore.ObjectStoreBuckets.PLUGINS, pluginKey);
62
- fs_1.default.writeFileSync(filename, pluginJs);
63
- fs_1.default.writeFileSync(metadataName, hash);
64
- return require(filename);
62
+ const pluginKey = backend_core_1.objectStore.getPluginJSKey(plugin);
63
+ const pluginJs = yield backend_core_1.objectStore.retrieve(backend_core_1.objectStore.ObjectStoreBuckets.PLUGINS, pluginKey);
64
+ fs_1.default.writeFileSync(filename, pluginJs);
65
+ fs_1.default.writeFileSync(metadataName, hash);
66
+ return require(filename);
67
+ });
68
+ }
69
+ const getDatasourcePlugin = (plugin) => __awaiter(void 0, void 0, void 0, function* () {
70
+ return getPluginImpl(DATASOURCE_PATH, plugin);
65
71
  });
66
72
  exports.getDatasourcePlugin = getDatasourcePlugin;
73
+ const getAutomationPlugin = (plugin) => __awaiter(void 0, void 0, void 0, function* () {
74
+ return getPluginImpl(AUTOMATION_PATH, plugin);
75
+ });
76
+ exports.getAutomationPlugin = getAutomationPlugin;
package/dist/watch.js CHANGED
@@ -18,7 +18,7 @@ const environment_1 = __importDefault(require("./environment"));
18
18
  const chokidar_1 = __importDefault(require("chokidar"));
19
19
  const fs_1 = __importDefault(require("fs"));
20
20
  const backend_core_1 = require("@budibase/backend-core");
21
- const plugin_1 = require("./api/controllers/plugin");
21
+ const plugins_1 = __importDefault(require("./sdk/plugins"));
22
22
  function watch() {
23
23
  const watchPath = path_1.default.join(environment_1.default.PLUGINS_DIR, "./**/*.tar.gz");
24
24
  chokidar_1.default
@@ -41,7 +41,7 @@ function watch() {
41
41
  const split = path.split("/");
42
42
  const name = split[split.length - 1];
43
43
  console.log("Importing plugin:", path);
44
- yield (0, plugin_1.processUploadedPlugin)({ name, path });
44
+ yield plugins_1.default.processUploaded({ name, path });
45
45
  }
46
46
  catch (err) {
47
47
  const message = (err === null || err === void 0 ? void 0 : err.message) ? err === null || err === void 0 ? void 0 : err.message : err;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@budibase/server",
3
3
  "email": "hi@budibase.com",
4
- "version": "2.5.6-alpha.4",
4
+ "version": "2.5.6-alpha.5",
5
5
  "description": "Budibase Web Server",
6
6
  "main": "src/index.ts",
7
7
  "repository": {
@@ -45,12 +45,12 @@
45
45
  "license": "GPL-3.0",
46
46
  "dependencies": {
47
47
  "@apidevtools/swagger-parser": "10.0.3",
48
- "@budibase/backend-core": "2.5.6-alpha.4",
49
- "@budibase/client": "2.5.6-alpha.4",
50
- "@budibase/pro": "2.5.6-alpha.3",
51
- "@budibase/shared-core": "2.5.6-alpha.4",
52
- "@budibase/string-templates": "2.5.6-alpha.4",
53
- "@budibase/types": "2.5.6-alpha.4",
48
+ "@budibase/backend-core": "2.5.6-alpha.5",
49
+ "@budibase/client": "2.5.6-alpha.5",
50
+ "@budibase/pro": "2.5.6-alpha.4",
51
+ "@budibase/shared-core": "2.5.6-alpha.5",
52
+ "@budibase/string-templates": "2.5.6-alpha.5",
53
+ "@budibase/types": "2.5.6-alpha.5",
54
54
  "@bull-board/api": "3.7.0",
55
55
  "@bull-board/koa": "3.9.4",
56
56
  "@elastic/elasticsearch": "7.10.0",
@@ -175,5 +175,5 @@
175
175
  "optionalDependencies": {
176
176
  "oracledb": "5.3.0"
177
177
  },
178
- "gitHead": "5d3a476e3f9f58fa5f33d5bb75ce82c11dc4e227"
178
+ "gitHead": "bd66f0f010edb2916b667bba2e408e9a1ce92f6e"
179
179
  }
@@ -16,9 +16,15 @@ import { setTestFlag, clearTestFlag } from "../../utilities/redis"
16
16
  import { context, cache, events } from "@budibase/backend-core"
17
17
  import { automations } from "@budibase/pro"
18
18
  import { Automation, BBContext } from "@budibase/types"
19
+ import { getActionDefinitions as actionDefs } from "../../automations/actions"
19
20
 
20
- const ACTION_DEFS = removeDeprecated(actions.ACTION_DEFINITIONS)
21
- const TRIGGER_DEFS = removeDeprecated(triggers.TRIGGER_DEFINITIONS)
21
+ async function getActionDefinitions() {
22
+ return removeDeprecated(await actionDefs())
23
+ }
24
+
25
+ function getTriggerDefinitions() {
26
+ return removeDeprecated(triggers.TRIGGER_DEFINITIONS)
27
+ }
22
28
 
23
29
  /*************************
24
30
  * *
@@ -228,17 +234,17 @@ export async function clearLogError(ctx: BBContext) {
228
234
  }
229
235
 
230
236
  export async function getActionList(ctx: BBContext) {
231
- ctx.body = ACTION_DEFS
237
+ ctx.body = await getActionDefinitions()
232
238
  }
233
239
 
234
240
  export async function getTriggerList(ctx: BBContext) {
235
- ctx.body = TRIGGER_DEFS
241
+ ctx.body = getTriggerDefinitions()
236
242
  }
237
243
 
238
244
  export async function getDefinitionList(ctx: BBContext) {
239
245
  ctx.body = {
240
- trigger: TRIGGER_DEFS,
241
- action: ACTION_DEFS,
246
+ trigger: getTriggerDefinitions(),
247
+ action: await getActionDefinitions(),
242
248
  }
243
249
  }
244
250
 
@@ -1,31 +1,11 @@
1
- import { npmUpload, urlUpload, githubUpload, fileUpload } from "./uploaders"
2
- import {
3
- plugins as pluginCore,
4
- db as dbCore,
5
- tenancy,
6
- objectStore,
7
- } from "@budibase/backend-core"
8
- import { PluginType, FileType, PluginSource, Plugin } from "@budibase/types"
1
+ import { npmUpload, urlUpload, githubUpload } from "./uploaders"
2
+ import { plugins as pluginCore } from "@budibase/backend-core"
3
+ import { PluginType, FileType, PluginSource } from "@budibase/types"
9
4
  import env from "../../../environment"
10
5
  import { ClientAppSocket } from "../../../websocket"
6
+ import sdk from "../../../sdk"
11
7
  import { sdk as pro } from "@budibase/pro"
12
8
 
13
- export async function getPlugins(type?: PluginType) {
14
- const db = tenancy.getGlobalDB()
15
- const response = await db.allDocs(
16
- dbCore.getPluginParams(null, {
17
- include_docs: true,
18
- })
19
- )
20
- let plugins = response.rows.map((row: any) => row.doc) as Plugin[]
21
- plugins = objectStore.enrichPluginURLs(plugins)
22
- if (type) {
23
- return plugins.filter((plugin: Plugin) => plugin.schema?.type === type)
24
- } else {
25
- return plugins
26
- }
27
- }
28
-
29
9
  export async function upload(ctx: any) {
30
10
  const plugins: FileType[] =
31
11
  ctx.request.files.file.length > 1
@@ -35,7 +15,7 @@ export async function upload(ctx: any) {
35
15
  let docs = []
36
16
  // can do single or multiple plugins
37
17
  for (let plugin of plugins) {
38
- const doc = await processUploadedPlugin(plugin, PluginSource.FILE)
18
+ const doc = await sdk.plugins.processUploaded(plugin, PluginSource.FILE)
39
19
  docs.push(doc)
40
20
  }
41
21
  ctx.body = {
@@ -105,7 +85,7 @@ export async function create(ctx: any) {
105
85
  }
106
86
 
107
87
  export async function fetch(ctx: any) {
108
- ctx.body = await getPlugins()
88
+ ctx.body = await sdk.plugins.fetch()
109
89
  }
110
90
 
111
91
  export async function destroy(ctx: any) {
@@ -119,20 +99,3 @@ export async function destroy(ctx: any) {
119
99
  ctx.throw(400, err.message)
120
100
  }
121
101
  }
122
-
123
- export async function processUploadedPlugin(
124
- plugin: FileType,
125
- source?: PluginSource
126
- ) {
127
- const { metadata, directory } = await fileUpload(plugin)
128
- pluginCore.validate(metadata?.schema)
129
-
130
- // Only allow components in cloud
131
- if (!env.SELF_HOSTED && metadata?.schema?.type !== PluginType.COMPONENT) {
132
- throw new Error("Only component plugins are supported outside of self-host")
133
- }
134
-
135
- const doc = await pro.plugins.storePlugin(metadata, directory, source)
136
- ClientAppSocket.emit("plugin-update", { name: doc.name, hash: doc.hash })
137
- return doc
138
- }
@@ -7,7 +7,7 @@ const {
7
7
  const setup = require("./utilities")
8
8
  const { basicAutomation, newAutomation, automationTrigger, automationStep } = setup.structures
9
9
  const MAX_RETRIES = 4
10
- const { TRIGGER_DEFINITIONS, ACTION_DEFINITIONS } = require("../../../automations")
10
+ const { TRIGGER_DEFINITIONS, BUILTIN_ACTION_DEFINITIONS } = require("../../../automations")
11
11
  const { events } = require("@budibase/backend-core")
12
12
 
13
13
 
@@ -55,7 +55,7 @@ describe("/automations", () => {
55
55
  .expect('Content-Type', /json/)
56
56
  .expect(200)
57
57
 
58
- let definitionsLength = Object.keys(ACTION_DEFINITIONS).length
58
+ let definitionsLength = Object.keys(BUILTIN_ACTION_DEFINITIONS).length
59
59
  definitionsLength-- // OUTGOING_WEBHOOK is deprecated
60
60
 
61
61
  expect(Object.keys(res.body.action).length).toBeGreaterThanOrEqual(definitionsLength)
@@ -15,7 +15,14 @@ import * as delay from "./steps/delay"
15
15
  import * as queryRow from "./steps/queryRows"
16
16
  import * as loop from "./steps/loop"
17
17
  import env from "../environment"
18
- import { AutomationStepSchema, AutomationStepInput } from "@budibase/types"
18
+ import {
19
+ AutomationStepSchema,
20
+ AutomationStepInput,
21
+ PluginType,
22
+ AutomationStep,
23
+ } from "@budibase/types"
24
+ import sdk from "../sdk"
25
+ import { getAutomationPlugin } from "../utilities/fileSystem"
19
26
 
20
27
  const ACTION_IMPLS: Record<
21
28
  string,
@@ -38,25 +45,26 @@ const ACTION_IMPLS: Record<
38
45
  zapier: zapier.run,
39
46
  integromat: integromat.run,
40
47
  }
41
- export const ACTION_DEFINITIONS: Record<string, AutomationStepSchema> = {
42
- SEND_EMAIL_SMTP: sendSmtpEmail.definition,
43
- CREATE_ROW: createRow.definition,
44
- UPDATE_ROW: updateRow.definition,
45
- DELETE_ROW: deleteRow.definition,
46
- OUTGOING_WEBHOOK: outgoingWebhook.definition,
47
- EXECUTE_SCRIPT: executeScript.definition,
48
- EXECUTE_QUERY: executeQuery.definition,
49
- SERVER_LOG: serverLog.definition,
50
- DELAY: delay.definition,
51
- FILTER: filter.definition,
52
- QUERY_ROWS: queryRow.definition,
53
- LOOP: loop.definition,
54
- // these used to be lowercase step IDs, maintain for backwards compat
55
- discord: discord.definition,
56
- slack: slack.definition,
57
- zapier: zapier.definition,
58
- integromat: integromat.definition,
59
- }
48
+ export const BUILTIN_ACTION_DEFINITIONS: Record<string, AutomationStepSchema> =
49
+ {
50
+ SEND_EMAIL_SMTP: sendSmtpEmail.definition,
51
+ CREATE_ROW: createRow.definition,
52
+ UPDATE_ROW: updateRow.definition,
53
+ DELETE_ROW: deleteRow.definition,
54
+ OUTGOING_WEBHOOK: outgoingWebhook.definition,
55
+ EXECUTE_SCRIPT: executeScript.definition,
56
+ EXECUTE_QUERY: executeQuery.definition,
57
+ SERVER_LOG: serverLog.definition,
58
+ DELAY: delay.definition,
59
+ FILTER: filter.definition,
60
+ QUERY_ROWS: queryRow.definition,
61
+ LOOP: loop.definition,
62
+ // these used to be lowercase step IDs, maintain for backwards compat
63
+ discord: discord.definition,
64
+ slack: slack.definition,
65
+ zapier: zapier.definition,
66
+ integromat: integromat.definition,
67
+ }
60
68
 
61
69
  // don't add the bash script/definitions unless in self host
62
70
  // the fact this isn't included in any definitions means it cannot be
@@ -66,12 +74,36 @@ if (env.SELF_HOSTED) {
66
74
  // @ts-ignore
67
75
  ACTION_IMPLS["EXECUTE_BASH"] = bash.run
68
76
  // @ts-ignore
69
- ACTION_DEFINITIONS["EXECUTE_BASH"] = bash.definition
77
+ BUILTIN_ACTION_DEFINITIONS["EXECUTE_BASH"] = bash.definition
78
+ }
79
+
80
+ export async function getActionDefinitions() {
81
+ const actionDefinitions = BUILTIN_ACTION_DEFINITIONS
82
+ if (env.SELF_HOSTED) {
83
+ const plugins = await sdk.plugins.fetch(PluginType.AUTOMATION)
84
+ for (let plugin of plugins) {
85
+ const schema = plugin.schema.schema as AutomationStep
86
+ actionDefinitions[schema.stepId] = {
87
+ ...schema,
88
+ custom: true,
89
+ }
90
+ }
91
+ }
92
+ return actionDefinitions
70
93
  }
71
94
 
72
95
  /* istanbul ignore next */
73
- export async function getAction(actionName: string) {
74
- if (ACTION_IMPLS[actionName] != null) {
75
- return ACTION_IMPLS[actionName]
96
+ export async function getAction(stepId: string) {
97
+ if (ACTION_IMPLS[stepId] != null) {
98
+ return ACTION_IMPLS[stepId]
99
+ }
100
+ // must be a plugin
101
+ if (env.SELF_HOSTED) {
102
+ const plugins = await sdk.plugins.fetch(PluginType.AUTOMATION)
103
+ const found = plugins.find(plugin => plugin.schema.schema.stepId === stepId)
104
+ if (!found) {
105
+ throw new Error(`Unable to find action implementation for "${stepId}"`)
106
+ }
107
+ return (await getAutomationPlugin(found)).action
76
108
  }
77
109
  }
@@ -6,7 +6,7 @@ import BullQueue from "bull"
6
6
  export { automationQueue } from "./bullboard"
7
7
  export { shutdown } from "./bullboard"
8
8
  export { TRIGGER_DEFINITIONS } from "./triggers"
9
- export { ACTION_DEFINITIONS } from "./actions"
9
+ export { BUILTIN_ACTION_DEFINITIONS, getActionDefinitions } from "./actions"
10
10
 
11
11
  /**
12
12
  * This module is built purely to kick off the worker farm and manage the inputs/outputs
@@ -4,8 +4,11 @@ import * as automationUtils from "../automationUtils"
4
4
  import environment from "../../environment"
5
5
  import {
6
6
  AutomationActionStepId,
7
- AutomationStepSchema,
7
+ AutomationCustomIOType,
8
+ AutomationIOType,
8
9
  AutomationStepInput,
10
+ AutomationStepSchema,
11
+ AutomationStepType,
9
12
  } from "@budibase/types"
10
13
 
11
14
  export const definition: AutomationStepSchema = {
@@ -13,7 +16,7 @@ export const definition: AutomationStepSchema = {
13
16
  tagline: "Execute a bash command",
14
17
  icon: "JourneyEvent",
15
18
  description: "Run a bash script",
16
- type: "ACTION",
19
+ type: AutomationStepType.ACTION,
17
20
  internal: true,
18
21
  stepId: AutomationActionStepId.EXECUTE_BASH,
19
22
  inputs: {},
@@ -21,8 +24,8 @@ export const definition: AutomationStepSchema = {
21
24
  inputs: {
22
25
  properties: {
23
26
  code: {
24
- type: "string",
25
- customType: "code",
27
+ type: AutomationIOType.STRING,
28
+ customType: AutomationCustomIOType.CODE,
26
29
  title: "Code",
27
30
  },
28
31
  },
@@ -31,16 +34,16 @@ export const definition: AutomationStepSchema = {
31
34
  outputs: {
32
35
  properties: {
33
36
  stdout: {
34
- type: "string",
37
+ type: AutomationIOType.STRING,
35
38
  description: "Standard output of your bash command or script",
36
39
  },
37
40
  success: {
38
- type: "boolean",
41
+ type: AutomationIOType.BOOLEAN,
39
42
  description: "Whether the command was successful",
40
43
  },
41
44
  },
45
+ required: ["stdout"],
42
46
  },
43
- required: ["stdout"],
44
47
  },
45
48
  }
46
49
 
@@ -3,8 +3,11 @@ import { cleanUpRow, getError } from "../automationUtils"
3
3
  import { buildCtx } from "./utils"
4
4
  import {
5
5
  AutomationActionStepId,
6
- AutomationStepSchema,
6
+ AutomationCustomIOType,
7
+ AutomationIOType,
7
8
  AutomationStepInput,
9
+ AutomationStepSchema,
10
+ AutomationStepType,
8
11
  } from "@budibase/types"
9
12
 
10
13
  export const definition: AutomationStepSchema = {
@@ -12,7 +15,7 @@ export const definition: AutomationStepSchema = {
12
15
  tagline: "Create a {{inputs.enriched.table.name}} row",
13
16
  icon: "TableRowAddBottom",
14
17
  description: "Add a row to your database",
15
- type: "ACTION",
18
+ type: AutomationStepType.ACTION,
16
19
  internal: true,
17
20
  stepId: AutomationActionStepId.CREATE_ROW,
18
21
  inputs: {},
@@ -20,14 +23,14 @@ export const definition: AutomationStepSchema = {
20
23
  inputs: {
21
24
  properties: {
22
25
  row: {
23
- type: "object",
26
+ type: AutomationIOType.OBJECT,
24
27
  properties: {
25
28
  tableId: {
26
- type: "string",
27
- customType: "table",
29
+ type: AutomationIOType.STRING,
30
+ customType: AutomationCustomIOType.TABLE,
28
31
  },
29
32
  },
30
- customType: "row",
33
+ customType: AutomationCustomIOType.ROW,
31
34
  title: "Table",
32
35
  required: ["tableId"],
33
36
  },
@@ -37,24 +40,24 @@ export const definition: AutomationStepSchema = {
37
40
  outputs: {
38
41
  properties: {
39
42
  row: {
40
- type: "object",
41
- customType: "row",
43
+ type: AutomationIOType.OBJECT,
44
+ customType: AutomationCustomIOType.ROW,
42
45
  description: "The new row",
43
46
  },
44
47
  response: {
45
- type: "object",
48
+ type: AutomationIOType.OBJECT,
46
49
  description: "The response from the table",
47
50
  },
48
51
  success: {
49
- type: "boolean",
52
+ type: AutomationIOType.BOOLEAN,
50
53
  description: "Whether the row creation was successful",
51
54
  },
52
55
  id: {
53
- type: "string",
56
+ type: AutomationIOType.STRING,
54
57
  description: "The identifier of the new row",
55
58
  },
56
59
  revision: {
57
- type: "string",
60
+ type: AutomationIOType.STRING,
58
61
  description: "The revision of the new row",
59
62
  },
60
63
  },
@@ -1,8 +1,10 @@
1
1
  import { wait } from "../../utilities"
2
2
  import {
3
3
  AutomationActionStepId,
4
- AutomationStepSchema,
4
+ AutomationIOType,
5
5
  AutomationStepInput,
6
+ AutomationStepSchema,
7
+ AutomationStepType,
6
8
  } from "@budibase/types"
7
9
 
8
10
  export const definition: AutomationStepSchema = {
@@ -17,7 +19,7 @@ export const definition: AutomationStepSchema = {
17
19
  inputs: {
18
20
  properties: {
19
21
  time: {
20
- type: "number",
22
+ type: AutomationIOType.NUMBER,
21
23
  title: "Delay in milliseconds",
22
24
  },
23
25
  },
@@ -26,14 +28,14 @@ export const definition: AutomationStepSchema = {
26
28
  outputs: {
27
29
  properties: {
28
30
  success: {
29
- type: "boolean",
31
+ type: AutomationIOType.BOOLEAN,
30
32
  description: "Whether the delay was successful",
31
33
  },
32
34
  },
33
35
  required: ["success"],
34
36
  },
35
37
  },
36
- type: "LOGIC",
38
+ type: AutomationStepType.LOGIC,
37
39
  }
38
40
 
39
41
  export async function run({ inputs }: AutomationStepInput) {
@@ -3,8 +3,11 @@ import { buildCtx } from "./utils"
3
3
  import { getError } from "../automationUtils"
4
4
  import {
5
5
  AutomationActionStepId,
6
- AutomationStepSchema,
7
6
  AutomationStepInput,
7
+ AutomationStepSchema,
8
+ AutomationStepType,
9
+ AutomationIOType,
10
+ AutomationCustomIOType,
8
11
  } from "@budibase/types"
9
12
 
10
13
  export const definition: AutomationStepSchema = {
@@ -12,7 +15,7 @@ export const definition: AutomationStepSchema = {
12
15
  icon: "TableRowRemoveCenter",
13
16
  name: "Delete Row",
14
17
  tagline: "Delete a {{inputs.enriched.table.name}} row",
15
- type: "ACTION",
18
+ type: AutomationStepType.ACTION,
16
19
  stepId: AutomationActionStepId.DELETE_ROW,
17
20
  internal: true,
18
21
  inputs: {},
@@ -20,12 +23,12 @@ export const definition: AutomationStepSchema = {
20
23
  inputs: {
21
24
  properties: {
22
25
  tableId: {
23
- type: "string",
24
- customType: "table",
26
+ type: AutomationIOType.STRING,
27
+ customType: AutomationCustomIOType.TABLE,
25
28
  title: "Table",
26
29
  },
27
30
  id: {
28
- type: "string",
31
+ type: AutomationIOType.STRING,
29
32
  title: "Row ID",
30
33
  },
31
34
  },
@@ -34,16 +37,16 @@ export const definition: AutomationStepSchema = {
34
37
  outputs: {
35
38
  properties: {
36
39
  row: {
37
- type: "object",
38
- customType: "row",
40
+ type: AutomationIOType.OBJECT,
41
+ customType: AutomationCustomIOType.ROW,
39
42
  description: "The deleted row",
40
43
  },
41
44
  response: {
42
- type: "object",
45
+ type: AutomationIOType.OBJECT,
43
46
  description: "The response from the table",
44
47
  },
45
48
  success: {
46
- type: "boolean",
49
+ type: AutomationIOType.BOOLEAN,
47
50
  description: "Whether the deletion was successful",
48
51
  },
49
52
  },
@@ -4,6 +4,8 @@ import {
4
4
  AutomationActionStepId,
5
5
  AutomationStepSchema,
6
6
  AutomationStepInput,
7
+ AutomationStepType,
8
+ AutomationIOType,
7
9
  } from "@budibase/types"
8
10
 
9
11
  const DEFAULT_USERNAME = "Budibase Automate"
@@ -15,26 +17,26 @@ export const definition: AutomationStepSchema = {
15
17
  description: "Send a message to a Discord server",
16
18
  icon: "ri-discord-line",
17
19
  stepId: AutomationActionStepId.discord,
18
- type: "ACTION",
20
+ type: AutomationStepType.ACTION,
19
21
  internal: false,
20
22
  inputs: {},
21
23
  schema: {
22
24
  inputs: {
23
25
  properties: {
24
26
  url: {
25
- type: "string",
27
+ type: AutomationIOType.STRING,
26
28
  title: "Discord Webhook URL",
27
29
  },
28
30
  username: {
29
- type: "string",
31
+ type: AutomationIOType.STRING,
30
32
  title: "Bot Name",
31
33
  },
32
34
  avatar_url: {
33
- type: "string",
35
+ type: AutomationIOType.STRING,
34
36
  title: "Bot Avatar URL",
35
37
  },
36
38
  content: {
37
- type: "string",
39
+ type: AutomationIOType.STRING,
38
40
  title: "Message",
39
41
  },
40
42
  },
@@ -43,15 +45,15 @@ export const definition: AutomationStepSchema = {
43
45
  outputs: {
44
46
  properties: {
45
47
  httpStatus: {
46
- type: "number",
48
+ type: AutomationIOType.NUMBER,
47
49
  description: "The HTTP status code of the request",
48
50
  },
49
51
  response: {
50
- type: "string",
52
+ type: AutomationIOType.STRING,
51
53
  description: "The response from the Discord Webhook",
52
54
  },
53
55
  success: {
54
- type: "boolean",
56
+ type: AutomationIOType.BOOLEAN,
55
57
  description: "Whether the message sent successfully",
56
58
  },
57
59
  },