@budibase/server 2.5.9 → 2.5.10-alpha.1

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 (198) hide show
  1. package/builder/assets/index.24635afb.js +1794 -0
  2. package/builder/assets/index.4eae16b2.css +6 -0
  3. package/builder/index.html +2 -2
  4. package/dist/api/controllers/application.js +3 -4
  5. package/dist/api/controllers/automation.js +13 -7
  6. package/dist/api/controllers/datasource.js +1 -1
  7. package/dist/api/controllers/dev.js +1 -1
  8. package/dist/api/controllers/ops.js +40 -0
  9. package/dist/api/controllers/plugin/index.js +6 -37
  10. package/dist/api/controllers/query/index.js +2 -2
  11. package/dist/api/controllers/row/ExternalRequest.js +21 -14
  12. package/dist/api/controllers/row/internal.js +5 -2
  13. package/dist/api/controllers/row/utils.js +2 -2
  14. package/dist/api/controllers/table/index.js +2 -2
  15. package/dist/api/controllers/table/utils.js +9 -3
  16. package/dist/api/controllers/user.js +1 -83
  17. package/dist/api/controllers/view/exporters.js +3 -1
  18. package/dist/api/index.js +1 -2
  19. package/dist/api/routes/index.js +2 -2
  20. package/dist/api/routes/{cloud.js → ops.js} +19 -6
  21. package/dist/api/routes/user.js +0 -1
  22. package/dist/app.js +4 -13
  23. package/dist/automations/actions.js +32 -6
  24. package/dist/automations/index.js +3 -2
  25. package/dist/automations/steps/bash.js +6 -6
  26. package/dist/automations/steps/createRow.js +11 -11
  27. package/dist/automations/steps/delay.js +3 -3
  28. package/dist/automations/steps/deleteRow.js +8 -8
  29. package/dist/automations/steps/discord.js +8 -8
  30. package/dist/automations/steps/executeQuery.js +9 -9
  31. package/dist/automations/steps/executeScript.js +6 -6
  32. package/dist/automations/steps/filter.js +6 -6
  33. package/dist/automations/steps/integromat.js +10 -10
  34. package/dist/automations/steps/loop.js +9 -9
  35. package/dist/automations/steps/outgoingWebhook.js +10 -10
  36. package/dist/automations/steps/queryRows.js +14 -14
  37. package/dist/automations/steps/sendSmtpEmail.js +9 -9
  38. package/dist/automations/steps/serverLog.js +4 -4
  39. package/dist/automations/steps/slack.js +6 -6
  40. package/dist/automations/steps/updateRow.js +11 -11
  41. package/dist/automations/steps/zapier.js +9 -9
  42. package/dist/automations/triggerInfo/app.js +5 -5
  43. package/dist/automations/triggerInfo/cron.js +4 -4
  44. package/dist/automations/triggerInfo/rowDeleted.js +5 -5
  45. package/dist/automations/triggerInfo/rowSaved.js +7 -7
  46. package/dist/automations/triggerInfo/rowUpdated.js +7 -7
  47. package/dist/automations/triggerInfo/webhook.js +6 -6
  48. package/dist/db/utils.js +3 -2
  49. package/dist/environment.js +0 -1
  50. package/dist/events/docUpdates/index.js +17 -0
  51. package/dist/events/docUpdates/processors.js +18 -0
  52. package/dist/events/docUpdates/syncUsers.js +49 -0
  53. package/dist/events/index.js +3 -0
  54. package/dist/integrations/base/sqlTable.js +9 -2
  55. package/dist/integrations/index.js +3 -3
  56. package/dist/integrations/microsoftSqlServer.js +5 -2
  57. package/dist/integrations/mysql.js +5 -3
  58. package/dist/integrations/postgres.js +7 -5
  59. package/dist/integrations/redis.js +7 -0
  60. package/dist/integrations/rest.js +4 -0
  61. package/dist/migrations/functions/syncQuotas.js +2 -0
  62. package/dist/migrations/functions/usageQuotas/syncApps.js +1 -2
  63. package/dist/migrations/functions/usageQuotas/syncRows.js +1 -2
  64. package/dist/migrations/functions/usageQuotas/syncUsers.js +21 -0
  65. package/dist/sdk/app/applications/sync.js +117 -23
  66. package/dist/sdk/app/backups/exports.js +14 -38
  67. package/dist/sdk/index.js +2 -0
  68. package/dist/sdk/plugins/index.js +27 -0
  69. package/dist/sdk/plugins/plugins.js +53 -0
  70. package/dist/sdk/users/utils.js +21 -4
  71. package/dist/startup.js +31 -28
  72. package/dist/threads/automation.js +16 -5
  73. package/dist/tsconfig.build.tsbuildinfo +1 -1
  74. package/dist/utilities/csv.js +33 -0
  75. package/dist/utilities/fileSystem/plugin.js +33 -23
  76. package/dist/utilities/global.js +17 -12
  77. package/dist/utilities/rowProcessor/utils.js +4 -5
  78. package/dist/utilities/schema.js +5 -1
  79. package/dist/watch.js +2 -2
  80. package/dist/websockets/client.js +14 -0
  81. package/dist/websockets/grid.js +60 -0
  82. package/dist/websockets/index.js +17 -0
  83. package/dist/websockets/websocket.js +78 -0
  84. package/package.json +16 -16
  85. package/scripts/dev/manage.js +2 -0
  86. package/scripts/integrations/mssql/data/entrypoint.sh +1 -0
  87. package/scripts/integrations/mssql/data/setup.sql +17 -17
  88. package/scripts/integrations/mysql/init.sql +1 -1
  89. package/scripts/integrations/postgres/init.sql +1 -0
  90. package/src/api/controllers/application.ts +4 -4
  91. package/src/api/controllers/automation.ts +12 -6
  92. package/src/api/controllers/datasource.ts +15 -5
  93. package/src/api/controllers/dev.ts +2 -2
  94. package/src/api/controllers/ops.ts +32 -0
  95. package/src/api/controllers/plugin/index.ts +8 -45
  96. package/src/api/controllers/query/index.ts +2 -2
  97. package/src/api/controllers/row/ExternalRequest.ts +21 -12
  98. package/src/api/controllers/row/internal.ts +13 -11
  99. package/src/api/controllers/row/utils.ts +4 -4
  100. package/src/api/controllers/table/index.ts +2 -2
  101. package/src/api/controllers/table/utils.ts +10 -3
  102. package/src/api/controllers/user.ts +10 -96
  103. package/src/api/controllers/view/exporters.ts +3 -1
  104. package/src/api/index.ts +2 -4
  105. package/src/api/routes/index.ts +2 -2
  106. package/src/api/routes/ops.ts +30 -0
  107. package/src/api/routes/tests/automation.spec.js +7 -4
  108. package/src/api/routes/tests/user.spec.js +48 -37
  109. package/src/api/routes/user.ts +0 -5
  110. package/src/app.ts +4 -15
  111. package/src/automations/actions.ts +56 -24
  112. package/src/automations/index.ts +1 -1
  113. package/src/automations/steps/bash.ts +10 -7
  114. package/src/automations/steps/createRow.ts +15 -12
  115. package/src/automations/steps/delay.ts +6 -4
  116. package/src/automations/steps/deleteRow.ts +12 -9
  117. package/src/automations/steps/discord.ts +10 -8
  118. package/src/automations/steps/executeQuery.ts +13 -10
  119. package/src/automations/steps/executeScript.ts +10 -7
  120. package/src/automations/steps/filter.ts +8 -6
  121. package/src/automations/steps/integromat.ts +12 -10
  122. package/src/automations/steps/loop.ts +16 -10
  123. package/src/automations/steps/outgoingWebhook.ts +14 -11
  124. package/src/automations/steps/queryRows.ts +18 -15
  125. package/src/automations/steps/sendSmtpEmail.ts +11 -9
  126. package/src/automations/steps/serverLog.ts +6 -4
  127. package/src/automations/steps/slack.ts +8 -6
  128. package/src/automations/steps/updateRow.ts +15 -12
  129. package/src/automations/steps/zapier.ts +11 -9
  130. package/src/automations/tests/utilities/index.ts +2 -2
  131. package/src/automations/triggerInfo/app.ts +8 -5
  132. package/src/automations/triggerInfo/cron.ts +7 -4
  133. package/src/automations/triggerInfo/rowDeleted.ts +8 -5
  134. package/src/automations/triggerInfo/rowSaved.ts +10 -7
  135. package/src/automations/triggerInfo/rowUpdated.ts +10 -7
  136. package/src/automations/triggerInfo/webhook.ts +9 -6
  137. package/src/db/utils.ts +1 -0
  138. package/src/environment.ts +0 -1
  139. package/src/events/docUpdates/index.ts +1 -0
  140. package/src/events/docUpdates/processors.ts +14 -0
  141. package/src/events/docUpdates/syncUsers.ts +35 -0
  142. package/src/events/index.ts +1 -0
  143. package/src/integration-test/postgres.spec.ts +3 -1
  144. package/src/integrations/base/sqlTable.ts +9 -2
  145. package/src/integrations/index.ts +3 -3
  146. package/src/integrations/microsoftSqlServer.ts +5 -2
  147. package/src/integrations/mysql.ts +5 -3
  148. package/src/integrations/postgres.ts +7 -5
  149. package/src/integrations/redis.ts +8 -0
  150. package/src/integrations/rest.ts +3 -0
  151. package/src/migrations/functions/syncQuotas.ts +2 -0
  152. package/src/migrations/functions/usageQuotas/syncApps.ts +2 -3
  153. package/src/migrations/functions/usageQuotas/syncRows.ts +2 -3
  154. package/src/migrations/functions/usageQuotas/syncUsers.ts +9 -0
  155. package/src/migrations/functions/usageQuotas/tests/syncRows.spec.ts +2 -2
  156. package/src/migrations/functions/usageQuotas/tests/syncUsers.spec.ts +26 -0
  157. package/src/migrations/index.ts +1 -0
  158. package/src/sdk/app/applications/sync.ts +129 -22
  159. package/src/sdk/app/applications/tests/sync.spec.ts +137 -0
  160. package/src/sdk/app/backups/exports.ts +17 -41
  161. package/src/sdk/index.ts +2 -0
  162. package/src/sdk/plugins/index.ts +5 -0
  163. package/src/sdk/plugins/plugins.ts +41 -0
  164. package/src/sdk/users/tests/utils.spec.ts +1 -32
  165. package/src/sdk/users/utils.ts +23 -5
  166. package/src/startup.ts +36 -34
  167. package/src/tests/jestEnv.ts +0 -1
  168. package/src/tests/jestSetup.ts +0 -1
  169. package/src/tests/utilities/TestConfiguration.ts +28 -0
  170. package/src/tests/utilities/structures.ts +25 -17
  171. package/src/threads/automation.ts +18 -6
  172. package/src/utilities/csv.ts +22 -0
  173. package/src/utilities/fileSystem/plugin.ts +13 -4
  174. package/src/utilities/global.ts +21 -16
  175. package/src/utilities/rowProcessor/utils.ts +9 -10
  176. package/src/utilities/schema.ts +8 -0
  177. package/src/utilities/tests/csv.spec.ts +33 -0
  178. package/src/watch.ts +2 -2
  179. package/src/websockets/client.ts +11 -0
  180. package/src/websockets/grid.ts +55 -0
  181. package/src/websockets/index.ts +14 -0
  182. package/src/websockets/websocket.ts +83 -0
  183. package/tsconfig.build.json +3 -5
  184. package/tsconfig.json +2 -1
  185. package/builder/assets/index.0b358332.js +0 -1817
  186. package/builder/assets/index.7f9a008b.css +0 -6
  187. package/dist/api/controllers/cloud.js +0 -130
  188. package/dist/elasticApm.js +0 -14
  189. package/dist/package.json +0 -180
  190. package/dist/websocket.js +0 -22
  191. package/scripts/likeCypress.ts +0 -35
  192. package/src/api/controllers/cloud.ts +0 -119
  193. package/src/api/routes/cloud.ts +0 -18
  194. package/src/api/routes/tests/cloud.spec.ts +0 -54
  195. package/src/elasticApm.ts +0 -10
  196. package/src/migrations/functions/tests/syncQuotas.spec.js +0 -26
  197. package/src/tests/logging.ts +0 -34
  198. package/src/websocket.ts +0 -26
@@ -26,14 +26,27 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
+ exports.errorValidator = exports.logsValidator = void 0;
29
30
  const router_1 = __importDefault(require("@koa/router"));
30
- const controller = __importStar(require("../controllers/cloud"));
31
- const authorized_1 = __importDefault(require("../../middleware/authorized"));
31
+ const controller = __importStar(require("../controllers/ops"));
32
32
  const backend_core_1 = require("@budibase/backend-core");
33
+ const joi_1 = __importDefault(require("joi"));
34
+ function logsValidator() {
35
+ return backend_core_1.middleware.joiValidator.body(joi_1.default.object({
36
+ message: joi_1.default.string().required(),
37
+ data: joi_1.default.object(),
38
+ }));
39
+ }
40
+ exports.logsValidator = logsValidator;
41
+ function errorValidator() {
42
+ return backend_core_1.middleware.joiValidator.body(joi_1.default.object({
43
+ message: joi_1.default.string().required(),
44
+ }));
45
+ }
46
+ exports.errorValidator = errorValidator;
33
47
  const router = new router_1.default();
34
48
  router
35
- .get("/api/cloud/export", (0, authorized_1.default)(backend_core_1.permissions.BUILDER), controller.exportApps)
36
- // has to be public, only run if apps don't exist
37
- .post("/api/cloud/import", controller.importApps)
38
- .get("/api/cloud/import/complete", controller.hasBeenImported);
49
+ .post("/api/ops/log", logsValidator(), controller.log)
50
+ .post("/api/ops/error", errorValidator(), controller.error)
51
+ .post("/api/ops/alert", errorValidator(), controller.alert);
39
52
  exports.default = router;
@@ -38,7 +38,6 @@ router
38
38
  .put("/api/users/metadata", (0, authorized_1.default)(PermissionType.USER, PermissionLevel.WRITE), controller.updateMetadata)
39
39
  .post("/api/users/metadata/self", (0, authorized_1.default)(PermissionType.USER, PermissionLevel.WRITE), controller.updateSelfMetadata)
40
40
  .delete("/api/users/metadata/:id", (0, authorized_1.default)(PermissionType.USER, PermissionLevel.WRITE), controller.destroyMetadata)
41
- .post("/api/users/metadata/sync/:id", (0, authorized_1.default)(PermissionType.USER, PermissionLevel.WRITE), controller.syncUser)
42
41
  .post("/api/users/flags", (0, authorized_1.default)(PermissionType.USER, PermissionLevel.WRITE), controller.setFlag)
43
42
  .get("/api/users/flags", (0, authorized_1.default)(PermissionType.USER, PermissionLevel.READ), controller.getFlags);
44
43
  exports.default = router;
package/dist/app.js CHANGED
@@ -38,18 +38,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
38
38
  if (process.env.DD_APM_ENABLED) {
39
39
  require("./ddApm");
40
40
  }
41
- if (process.env.ELASTIC_APM_ENABLED) {
42
- require("./elasticApm");
43
- }
44
41
  // need to load environment first
45
42
  const environment_1 = __importDefault(require("./environment"));
46
- // enable APM if configured
47
- if (process.env.ELASTIC_APM_ENABLED) {
48
- const apm = require("elastic-apm-node").start({
49
- serviceName: process.env.SERVICE,
50
- environment: process.env.BUDIBASE_ENVIRONMENT,
51
- });
52
- }
53
43
  const db = __importStar(require("./db"));
54
44
  db.init();
55
45
  const koa_1 = __importDefault(require("koa"));
@@ -59,8 +49,8 @@ const api = __importStar(require("./api"));
59
49
  const automations = __importStar(require("./automations"));
60
50
  const threads_1 = require("./threads");
61
51
  const redis = __importStar(require("./utilities/redis"));
52
+ const websockets_1 = require("./websockets");
62
53
  const backend_core_1 = require("@budibase/backend-core");
63
- const websocket_1 = require("./websocket");
64
54
  const startup_1 = require("./startup");
65
55
  const Sentry = require("@sentry/node");
66
56
  const destroyable = require("server-destroy");
@@ -80,7 +70,8 @@ app.use((0, koa_body_1.default)({
80
70
  enableTypes: ["json", "form", "text"],
81
71
  parsedMethods: ["POST", "PUT", "PATCH", "DELETE"],
82
72
  }));
83
- app.use(backend_core_1.middleware.logging);
73
+ app.use(backend_core_1.middleware.correlation);
74
+ app.use(backend_core_1.middleware.pino);
84
75
  app.use(userAgent);
85
76
  if (environment_1.default.isProd()) {
86
77
  environment_1.default._set("NODE_ENV", "production");
@@ -96,7 +87,7 @@ if (environment_1.default.isProd()) {
96
87
  }
97
88
  const server = http_1.default.createServer(app.callback());
98
89
  destroyable(server);
99
- (0, websocket_1.initialise)(server);
90
+ (0, websockets_1.initialise)(app, server);
100
91
  let shuttingDown = false, errCode = 0;
101
92
  server.on("close", () => __awaiter(void 0, void 0, void 0, function* () {
102
93
  // already in process
@@ -35,7 +35,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
35
35
  return (mod && mod.__esModule) ? mod : { "default": mod };
36
36
  };
37
37
  Object.defineProperty(exports, "__esModule", { value: true });
38
- exports.getAction = exports.ACTION_DEFINITIONS = void 0;
38
+ exports.getAction = exports.getActionDefinitions = exports.BUILTIN_ACTION_DEFINITIONS = void 0;
39
39
  const sendSmtpEmail = __importStar(require("./steps/sendSmtpEmail"));
40
40
  const createRow = __importStar(require("./steps/createRow"));
41
41
  const updateRow = __importStar(require("./steps/updateRow"));
@@ -53,6 +53,9 @@ const delay = __importStar(require("./steps/delay"));
53
53
  const queryRow = __importStar(require("./steps/queryRows"));
54
54
  const loop = __importStar(require("./steps/loop"));
55
55
  const environment_1 = __importDefault(require("../environment"));
56
+ const types_1 = require("@budibase/types");
57
+ const sdk_1 = __importDefault(require("../sdk"));
58
+ const fileSystem_1 = require("../utilities/fileSystem");
56
59
  const ACTION_IMPLS = {
57
60
  SEND_EMAIL_SMTP: sendSmtpEmail.run,
58
61
  CREATE_ROW: createRow.run,
@@ -71,7 +74,7 @@ const ACTION_IMPLS = {
71
74
  zapier: zapier.run,
72
75
  integromat: integromat.run,
73
76
  };
74
- exports.ACTION_DEFINITIONS = {
77
+ exports.BUILTIN_ACTION_DEFINITIONS = {
75
78
  SEND_EMAIL_SMTP: sendSmtpEmail.definition,
76
79
  CREATE_ROW: createRow.definition,
77
80
  UPDATE_ROW: updateRow.definition,
@@ -98,13 +101,36 @@ if (environment_1.default.SELF_HOSTED) {
98
101
  // @ts-ignore
99
102
  ACTION_IMPLS["EXECUTE_BASH"] = bash.run;
100
103
  // @ts-ignore
101
- exports.ACTION_DEFINITIONS["EXECUTE_BASH"] = bash.definition;
104
+ exports.BUILTIN_ACTION_DEFINITIONS["EXECUTE_BASH"] = bash.definition;
102
105
  }
106
+ function getActionDefinitions() {
107
+ return __awaiter(this, void 0, void 0, function* () {
108
+ const actionDefinitions = exports.BUILTIN_ACTION_DEFINITIONS;
109
+ if (environment_1.default.SELF_HOSTED) {
110
+ const plugins = yield sdk_1.default.plugins.fetch(types_1.PluginType.AUTOMATION);
111
+ for (let plugin of plugins) {
112
+ const schema = plugin.schema.schema;
113
+ actionDefinitions[schema.stepId] = Object.assign(Object.assign({}, schema), { custom: true });
114
+ }
115
+ }
116
+ return actionDefinitions;
117
+ });
118
+ }
119
+ exports.getActionDefinitions = getActionDefinitions;
103
120
  /* istanbul ignore next */
104
- function getAction(actionName) {
121
+ function getAction(stepId) {
105
122
  return __awaiter(this, void 0, void 0, function* () {
106
- if (ACTION_IMPLS[actionName] != null) {
107
- return ACTION_IMPLS[actionName];
123
+ if (ACTION_IMPLS[stepId] != null) {
124
+ return ACTION_IMPLS[stepId];
125
+ }
126
+ // must be a plugin
127
+ if (environment_1.default.SELF_HOSTED) {
128
+ const plugins = yield sdk_1.default.plugins.fetch(types_1.PluginType.AUTOMATION);
129
+ const found = plugins.find(plugin => plugin.schema.schema.stepId === stepId);
130
+ if (!found) {
131
+ throw new Error(`Unable to find action implementation for "${stepId}"`);
132
+ }
133
+ return (yield (0, fileSystem_1.getAutomationPlugin)(found)).action;
108
134
  }
109
135
  });
110
136
  }
@@ -9,7 +9,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
9
9
  });
10
10
  };
11
11
  Object.defineProperty(exports, "__esModule", { value: true });
12
- exports.getQueues = exports.init = exports.ACTION_DEFINITIONS = exports.TRIGGER_DEFINITIONS = exports.shutdown = exports.automationQueue = void 0;
12
+ exports.getQueues = exports.init = exports.getActionDefinitions = exports.BUILTIN_ACTION_DEFINITIONS = exports.TRIGGER_DEFINITIONS = exports.shutdown = exports.automationQueue = void 0;
13
13
  const utils_1 = require("./utils");
14
14
  const bullboard_1 = require("./bullboard");
15
15
  const triggers_1 = require("./triggers");
@@ -20,7 +20,8 @@ Object.defineProperty(exports, "shutdown", { enumerable: true, get: function ()
20
20
  var triggers_2 = require("./triggers");
21
21
  Object.defineProperty(exports, "TRIGGER_DEFINITIONS", { enumerable: true, get: function () { return triggers_2.TRIGGER_DEFINITIONS; } });
22
22
  var actions_1 = require("./actions");
23
- Object.defineProperty(exports, "ACTION_DEFINITIONS", { enumerable: true, get: function () { return actions_1.ACTION_DEFINITIONS; } });
23
+ Object.defineProperty(exports, "BUILTIN_ACTION_DEFINITIONS", { enumerable: true, get: function () { return actions_1.BUILTIN_ACTION_DEFINITIONS; } });
24
+ Object.defineProperty(exports, "getActionDefinitions", { enumerable: true, get: function () { return actions_1.getActionDefinitions; } });
24
25
  /**
25
26
  * This module is built purely to kick off the worker farm and manage the inputs/outputs
26
27
  */
@@ -46,7 +46,7 @@ exports.definition = {
46
46
  tagline: "Execute a bash command",
47
47
  icon: "JourneyEvent",
48
48
  description: "Run a bash script",
49
- type: "ACTION",
49
+ type: types_1.AutomationStepType.ACTION,
50
50
  internal: true,
51
51
  stepId: types_1.AutomationActionStepId.EXECUTE_BASH,
52
52
  inputs: {},
@@ -54,8 +54,8 @@ exports.definition = {
54
54
  inputs: {
55
55
  properties: {
56
56
  code: {
57
- type: "string",
58
- customType: "code",
57
+ type: types_1.AutomationIOType.STRING,
58
+ customType: types_1.AutomationCustomIOType.CODE,
59
59
  title: "Code",
60
60
  },
61
61
  },
@@ -64,16 +64,16 @@ exports.definition = {
64
64
  outputs: {
65
65
  properties: {
66
66
  stdout: {
67
- type: "string",
67
+ type: types_1.AutomationIOType.STRING,
68
68
  description: "Standard output of your bash command or script",
69
69
  },
70
70
  success: {
71
- type: "boolean",
71
+ type: types_1.AutomationIOType.BOOLEAN,
72
72
  description: "Whether the command was successful",
73
73
  },
74
74
  },
75
+ required: ["stdout"],
75
76
  },
76
- required: ["stdout"],
77
77
  },
78
78
  };
79
79
  function run({ inputs, context }) {
@@ -19,7 +19,7 @@ exports.definition = {
19
19
  tagline: "Create a {{inputs.enriched.table.name}} row",
20
20
  icon: "TableRowAddBottom",
21
21
  description: "Add a row to your database",
22
- type: "ACTION",
22
+ type: types_1.AutomationStepType.ACTION,
23
23
  internal: true,
24
24
  stepId: types_1.AutomationActionStepId.CREATE_ROW,
25
25
  inputs: {},
@@ -27,14 +27,14 @@ exports.definition = {
27
27
  inputs: {
28
28
  properties: {
29
29
  row: {
30
- type: "object",
30
+ type: types_1.AutomationIOType.OBJECT,
31
31
  properties: {
32
32
  tableId: {
33
- type: "string",
34
- customType: "table",
33
+ type: types_1.AutomationIOType.STRING,
34
+ customType: types_1.AutomationCustomIOType.TABLE,
35
35
  },
36
36
  },
37
- customType: "row",
37
+ customType: types_1.AutomationCustomIOType.ROW,
38
38
  title: "Table",
39
39
  required: ["tableId"],
40
40
  },
@@ -44,24 +44,24 @@ exports.definition = {
44
44
  outputs: {
45
45
  properties: {
46
46
  row: {
47
- type: "object",
48
- customType: "row",
47
+ type: types_1.AutomationIOType.OBJECT,
48
+ customType: types_1.AutomationCustomIOType.ROW,
49
49
  description: "The new row",
50
50
  },
51
51
  response: {
52
- type: "object",
52
+ type: types_1.AutomationIOType.OBJECT,
53
53
  description: "The response from the table",
54
54
  },
55
55
  success: {
56
- type: "boolean",
56
+ type: types_1.AutomationIOType.BOOLEAN,
57
57
  description: "Whether the row creation was successful",
58
58
  },
59
59
  id: {
60
- type: "string",
60
+ type: types_1.AutomationIOType.STRING,
61
61
  description: "The identifier of the new row",
62
62
  },
63
63
  revision: {
64
- type: "string",
64
+ type: types_1.AutomationIOType.STRING,
65
65
  description: "The revision of the new row",
66
66
  },
67
67
  },
@@ -24,7 +24,7 @@ exports.definition = {
24
24
  inputs: {
25
25
  properties: {
26
26
  time: {
27
- type: "number",
27
+ type: types_1.AutomationIOType.NUMBER,
28
28
  title: "Delay in milliseconds",
29
29
  },
30
30
  },
@@ -33,14 +33,14 @@ exports.definition = {
33
33
  outputs: {
34
34
  properties: {
35
35
  success: {
36
- type: "boolean",
36
+ type: types_1.AutomationIOType.BOOLEAN,
37
37
  description: "Whether the delay was successful",
38
38
  },
39
39
  },
40
40
  required: ["success"],
41
41
  },
42
42
  },
43
- type: "LOGIC",
43
+ type: types_1.AutomationStepType.LOGIC,
44
44
  };
45
45
  function run({ inputs }) {
46
46
  return __awaiter(this, void 0, void 0, function* () {
@@ -19,7 +19,7 @@ exports.definition = {
19
19
  icon: "TableRowRemoveCenter",
20
20
  name: "Delete Row",
21
21
  tagline: "Delete a {{inputs.enriched.table.name}} row",
22
- type: "ACTION",
22
+ type: types_1.AutomationStepType.ACTION,
23
23
  stepId: types_1.AutomationActionStepId.DELETE_ROW,
24
24
  internal: true,
25
25
  inputs: {},
@@ -27,12 +27,12 @@ exports.definition = {
27
27
  inputs: {
28
28
  properties: {
29
29
  tableId: {
30
- type: "string",
31
- customType: "table",
30
+ type: types_1.AutomationIOType.STRING,
31
+ customType: types_1.AutomationCustomIOType.TABLE,
32
32
  title: "Table",
33
33
  },
34
34
  id: {
35
- type: "string",
35
+ type: types_1.AutomationIOType.STRING,
36
36
  title: "Row ID",
37
37
  },
38
38
  },
@@ -41,16 +41,16 @@ exports.definition = {
41
41
  outputs: {
42
42
  properties: {
43
43
  row: {
44
- type: "object",
45
- customType: "row",
44
+ type: types_1.AutomationIOType.OBJECT,
45
+ customType: types_1.AutomationCustomIOType.ROW,
46
46
  description: "The deleted row",
47
47
  },
48
48
  response: {
49
- type: "object",
49
+ type: types_1.AutomationIOType.OBJECT,
50
50
  description: "The response from the table",
51
51
  },
52
52
  success: {
53
- type: "boolean",
53
+ type: types_1.AutomationIOType.BOOLEAN,
54
54
  description: "Whether the deletion was successful",
55
55
  },
56
56
  },
@@ -24,26 +24,26 @@ exports.definition = {
24
24
  description: "Send a message to a Discord server",
25
25
  icon: "ri-discord-line",
26
26
  stepId: types_1.AutomationActionStepId.discord,
27
- type: "ACTION",
27
+ type: types_1.AutomationStepType.ACTION,
28
28
  internal: false,
29
29
  inputs: {},
30
30
  schema: {
31
31
  inputs: {
32
32
  properties: {
33
33
  url: {
34
- type: "string",
34
+ type: types_1.AutomationIOType.STRING,
35
35
  title: "Discord Webhook URL",
36
36
  },
37
37
  username: {
38
- type: "string",
38
+ type: types_1.AutomationIOType.STRING,
39
39
  title: "Bot Name",
40
40
  },
41
41
  avatar_url: {
42
- type: "string",
42
+ type: types_1.AutomationIOType.STRING,
43
43
  title: "Bot Avatar URL",
44
44
  },
45
45
  content: {
46
- type: "string",
46
+ type: types_1.AutomationIOType.STRING,
47
47
  title: "Message",
48
48
  },
49
49
  },
@@ -52,15 +52,15 @@ exports.definition = {
52
52
  outputs: {
53
53
  properties: {
54
54
  httpStatus: {
55
- type: "number",
55
+ type: types_1.AutomationIOType.NUMBER,
56
56
  description: "The HTTP status code of the request",
57
57
  },
58
58
  response: {
59
- type: "string",
59
+ type: types_1.AutomationIOType.STRING,
60
60
  description: "The response from the Discord Webhook",
61
61
  },
62
62
  success: {
63
- type: "boolean",
63
+ type: types_1.AutomationIOType.BOOLEAN,
64
64
  description: "Whether the message sent successfully",
65
65
  },
66
66
  },
@@ -53,7 +53,7 @@ exports.definition = {
53
53
  tagline: "Execute Data Connector",
54
54
  icon: "Data",
55
55
  description: "Execute a query in an external data connector",
56
- type: "ACTION",
56
+ type: types_1.AutomationStepType.ACTION,
57
57
  stepId: types_1.AutomationActionStepId.EXECUTE_QUERY,
58
58
  internal: true,
59
59
  inputs: {},
@@ -61,14 +61,14 @@ exports.definition = {
61
61
  inputs: {
62
62
  properties: {
63
63
  query: {
64
- type: "object",
64
+ type: types_1.AutomationIOType.OBJECT,
65
65
  properties: {
66
66
  queryId: {
67
- type: "string",
68
- customType: "query",
67
+ type: types_1.AutomationIOType.STRING,
68
+ customType: types_1.AutomationCustomIOType.QUERY,
69
69
  },
70
70
  },
71
- customType: "queryParams",
71
+ customType: types_1.AutomationCustomIOType.QUERY_PARAMS,
72
72
  title: "Parameters",
73
73
  required: ["queryId"],
74
74
  },
@@ -78,20 +78,20 @@ exports.definition = {
78
78
  outputs: {
79
79
  properties: {
80
80
  response: {
81
- type: "object",
81
+ type: types_1.AutomationIOType.OBJECT,
82
82
  description: "The response from the datasource execution",
83
83
  },
84
84
  info: {
85
- type: "object",
85
+ type: types_1.AutomationIOType.OBJECT,
86
86
  description: "Some query types may return extra data, like headers from a REST query",
87
87
  },
88
88
  success: {
89
- type: "boolean",
89
+ type: types_1.AutomationIOType.BOOLEAN,
90
90
  description: "Whether the action was successful",
91
91
  },
92
92
  },
93
+ required: ["response", "success"],
93
94
  },
94
- required: ["response", "success"],
95
95
  },
96
96
  };
97
97
  function run({ inputs, appId, emitter }) {
@@ -42,7 +42,7 @@ exports.definition = {
42
42
  tagline: "Execute JavaScript Code",
43
43
  icon: "Code",
44
44
  description: "Run a piece of JavaScript code in your automation",
45
- type: "ACTION",
45
+ type: types_1.AutomationStepType.ACTION,
46
46
  internal: true,
47
47
  stepId: types_1.AutomationActionStepId.EXECUTE_SCRIPT,
48
48
  inputs: {},
@@ -50,8 +50,8 @@ exports.definition = {
50
50
  inputs: {
51
51
  properties: {
52
52
  code: {
53
- type: "string",
54
- customType: "code",
53
+ type: types_1.AutomationIOType.STRING,
54
+ customType: types_1.AutomationCustomIOType.CODE,
55
55
  title: "Code",
56
56
  },
57
57
  },
@@ -60,16 +60,16 @@ exports.definition = {
60
60
  outputs: {
61
61
  properties: {
62
62
  value: {
63
- type: "string",
63
+ type: types_1.AutomationIOType.STRING,
64
64
  description: "The result of the return statement",
65
65
  },
66
66
  success: {
67
- type: "boolean",
67
+ type: types_1.AutomationIOType.BOOLEAN,
68
68
  description: "Whether the action was successful",
69
69
  },
70
70
  },
71
+ required: ["success"],
71
72
  },
72
- required: ["success"],
73
73
  },
74
74
  };
75
75
  function run({ inputs, appId, context, emitter, }) {
@@ -28,7 +28,7 @@ exports.definition = {
28
28
  tagline: "{{inputs.field}} {{inputs.condition}} {{inputs.value}}",
29
29
  icon: "Branch2",
30
30
  description: "Conditionally halt automations which do not meet certain conditions",
31
- type: "LOGIC",
31
+ type: types_1.AutomationStepType.LOGIC,
32
32
  internal: true,
33
33
  stepId: types_1.AutomationActionStepId.FILTER,
34
34
  inputs: {
@@ -38,17 +38,17 @@ exports.definition = {
38
38
  inputs: {
39
39
  properties: {
40
40
  field: {
41
- type: "string",
41
+ type: types_1.AutomationIOType.STRING,
42
42
  title: "Reference Value",
43
43
  },
44
44
  condition: {
45
- type: "string",
45
+ type: types_1.AutomationIOType.STRING,
46
46
  title: "Condition",
47
47
  enum: Object.values(exports.FilterConditions),
48
48
  pretty: Object.values(exports.PrettyFilterConditions),
49
49
  },
50
50
  value: {
51
- type: "string",
51
+ type: types_1.AutomationIOType.STRING,
52
52
  title: "Comparison Value",
53
53
  },
54
54
  },
@@ -57,11 +57,11 @@ exports.definition = {
57
57
  outputs: {
58
58
  properties: {
59
59
  success: {
60
- type: "boolean",
60
+ type: types_1.AutomationIOType.BOOLEAN,
61
61
  description: "Whether the action was successful",
62
62
  },
63
63
  result: {
64
- type: "boolean",
64
+ type: types_1.AutomationIOType.BOOLEAN,
65
65
  description: "Whether the logic block passed",
66
66
  },
67
67
  },
@@ -22,34 +22,34 @@ exports.definition = {
22
22
  description: "Performs a webhook call to Integromat and gets the response (if configured)",
23
23
  icon: "ri-shut-down-line",
24
24
  stepId: types_1.AutomationActionStepId.integromat,
25
- type: "ACTION",
25
+ type: types_1.AutomationStepType.ACTION,
26
26
  internal: false,
27
27
  inputs: {},
28
28
  schema: {
29
29
  inputs: {
30
30
  properties: {
31
31
  url: {
32
- type: "string",
32
+ type: types_1.AutomationIOType.STRING,
33
33
  title: "Webhook URL",
34
34
  },
35
35
  value1: {
36
- type: "string",
36
+ type: types_1.AutomationIOType.STRING,
37
37
  title: "Input Value 1",
38
38
  },
39
39
  value2: {
40
- type: "string",
40
+ type: types_1.AutomationIOType.STRING,
41
41
  title: "Input Value 2",
42
42
  },
43
43
  value3: {
44
- type: "string",
44
+ type: types_1.AutomationIOType.STRING,
45
45
  title: "Input Value 3",
46
46
  },
47
47
  value4: {
48
- type: "string",
48
+ type: types_1.AutomationIOType.STRING,
49
49
  title: "Input Value 4",
50
50
  },
51
51
  value5: {
52
- type: "string",
52
+ type: types_1.AutomationIOType.STRING,
53
53
  title: "Input Value 5",
54
54
  },
55
55
  },
@@ -58,15 +58,15 @@ exports.definition = {
58
58
  outputs: {
59
59
  properties: {
60
60
  success: {
61
- type: "boolean",
61
+ type: types_1.AutomationIOType.BOOLEAN,
62
62
  description: "Whether call was successful",
63
63
  },
64
64
  httpStatus: {
65
- type: "number",
65
+ type: types_1.AutomationIOType.NUMBER,
66
66
  description: "The HTTP status code returned",
67
67
  },
68
68
  response: {
69
- type: "object",
69
+ type: types_1.AutomationIOType.OBJECT,
70
70
  description: "The webhook response - this can have properties",
71
71
  },
72
72
  },
@@ -14,19 +14,19 @@ exports.definition = {
14
14
  inputs: {
15
15
  properties: {
16
16
  option: {
17
- customType: "loopOption",
17
+ customType: types_1.AutomationCustomIOType.LOOP_OPTION,
18
18
  title: "Input type",
19
19
  },
20
20
  binding: {
21
- type: "string",
21
+ type: types_1.AutomationIOType.STRING,
22
22
  title: "Binding / Value",
23
23
  },
24
24
  iterations: {
25
- type: "number",
25
+ type: types_1.AutomationIOType.NUMBER,
26
26
  title: "Max loop iterations",
27
27
  },
28
28
  failure: {
29
- type: "string",
29
+ type: types_1.AutomationIOType.STRING,
30
30
  title: "Failure Condition",
31
31
  },
32
32
  },
@@ -35,20 +35,20 @@ exports.definition = {
35
35
  outputs: {
36
36
  properties: {
37
37
  items: {
38
- customType: "item",
38
+ customType: types_1.AutomationCustomIOType.ITEM,
39
39
  description: "The item currently being executed",
40
40
  },
41
41
  success: {
42
- type: "boolean",
42
+ type: types_1.AutomationIOType.BOOLEAN,
43
43
  description: "Whether the message loop was successfully",
44
44
  },
45
45
  iterations: {
46
- type: "number",
47
- descriptions: "The amount of times the block ran",
46
+ type: types_1.AutomationIOType.NUMBER,
47
+ description: "The amount of times the block ran",
48
48
  },
49
49
  },
50
50
  required: ["success", "items", "iterations"],
51
51
  },
52
52
  },
53
- type: "LOGIC",
53
+ type: types_1.AutomationStepType.LOGIC,
54
54
  };