@budibase/server 0.9.138 → 0.9.140-alpha.2
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.
- package/builder/assets/discord.c14881e9.svg +10 -0
- package/builder/assets/{index.b18ab99b.js → index.1d1fa051.js} +35 -35
- package/builder/assets/{index.121692c9.css → index.79907e5c.css} +5 -5
- package/builder/assets/integromat.42212f11.png +0 -0
- package/builder/assets/slack.1e1f7cfb.svg +33 -0
- package/builder/assets/{vendor.7177f366.js → vendor.d39b3c1e.js} +2 -2
- package/builder/assets/zapier.3fbd8f5c.png +0 -0
- package/builder/index.html +3 -3
- package/coverage/clover.xml +2138 -2091
- package/coverage/coverage-final.json +120 -106
- package/coverage/lcov-report/api/controllers/analytics.js.html +3 -3
- package/coverage/lcov-report/api/controllers/apikeys.js.html +6 -6
- package/coverage/lcov-report/api/controllers/application.js.html +84 -84
- package/coverage/lcov-report/api/controllers/auth.js.html +6 -6
- package/coverage/lcov-report/api/controllers/automation.js.html +182 -356
- package/coverage/lcov-report/api/controllers/backup.js.html +3 -3
- package/coverage/lcov-report/api/controllers/component.js.html +5 -5
- package/coverage/lcov-report/api/controllers/datasource.js.html +12 -12
- package/coverage/lcov-report/api/controllers/dev.js.html +15 -15
- package/coverage/lcov-report/api/controllers/hosting.js.html +8 -8
- package/coverage/lcov-report/api/controllers/index.html +47 -32
- package/coverage/lcov-report/api/controllers/integration.js.html +4 -4
- package/coverage/lcov-report/api/controllers/layout.js.html +6 -6
- package/coverage/lcov-report/api/controllers/metadata.js.html +218 -0
- package/coverage/lcov-report/api/controllers/permission.js.html +14 -14
- package/coverage/lcov-report/api/controllers/query.js.html +17 -23
- package/coverage/lcov-report/api/controllers/role.js.html +9 -9
- package/coverage/lcov-report/api/controllers/routing.js.html +9 -9
- package/coverage/lcov-report/api/controllers/row/external.js.html +15 -15
- package/coverage/lcov-report/api/controllers/row/index.html +29 -44
- package/coverage/lcov-report/api/controllers/row/index.js.html +48 -45
- package/coverage/lcov-report/api/controllers/row/internal.js.html +159 -126
- package/coverage/lcov-report/api/controllers/row/utils.js.html +17 -17
- package/coverage/lcov-report/api/controllers/screen.js.html +7 -7
- package/coverage/lcov-report/api/controllers/script.js.html +5 -5
- package/coverage/lcov-report/api/controllers/table/index.html +1 -1
- package/coverage/lcov-report/api/controllers/table/index.js.html +40 -40
- package/coverage/lcov-report/api/controllers/table/utils.js.html +48 -48
- package/coverage/lcov-report/api/controllers/templates.js.html +5 -5
- package/coverage/lcov-report/api/controllers/user.js.html +14 -11
- package/coverage/lcov-report/api/controllers/view/exporters.js.html +3 -3
- package/coverage/lcov-report/api/controllers/view/index.html +1 -1
- package/coverage/lcov-report/api/controllers/view/index.js.html +9 -9
- package/coverage/lcov-report/api/controllers/view/viewBuilder.js.html +6 -6
- package/coverage/lcov-report/api/controllers/webhook.js.html +14 -14
- package/coverage/lcov-report/api/index.html +1 -1
- package/coverage/lcov-report/api/index.js.html +23 -23
- package/coverage/lcov-report/api/routes/analytics.js.html +6 -6
- package/coverage/lcov-report/api/routes/apikeys.js.html +8 -8
- package/coverage/lcov-report/api/routes/application.js.html +8 -8
- package/coverage/lcov-report/api/routes/auth.js.html +6 -6
- package/coverage/lcov-report/api/routes/automation.js.html +41 -26
- package/coverage/lcov-report/api/routes/backup.js.html +8 -8
- package/coverage/lcov-report/api/routes/component.js.html +8 -8
- package/coverage/lcov-report/api/routes/datasource.js.html +13 -13
- package/coverage/lcov-report/api/routes/deploy.js.html +8 -8
- package/coverage/lcov-report/api/routes/dev.js.html +11 -11
- package/coverage/lcov-report/api/routes/hosting.js.html +8 -8
- package/coverage/lcov-report/api/routes/index.html +24 -9
- package/coverage/lcov-report/api/routes/index.js.html +36 -30
- package/coverage/lcov-report/api/routes/integration.js.html +8 -8
- package/coverage/lcov-report/api/routes/layout.js.html +8 -8
- package/coverage/lcov-report/api/routes/metadata.js.html +194 -0
- package/coverage/lcov-report/api/routes/permission.js.html +12 -12
- package/coverage/lcov-report/api/routes/query.js.html +13 -13
- package/coverage/lcov-report/api/routes/role.js.html +12 -12
- package/coverage/lcov-report/api/routes/routing.js.html +8 -8
- package/coverage/lcov-report/api/routes/row.js.html +10 -10
- package/coverage/lcov-report/api/routes/screen.js.html +11 -11
- package/coverage/lcov-report/api/routes/script.js.html +1 -1
- package/coverage/lcov-report/api/routes/static.js.html +13 -16
- package/coverage/lcov-report/api/routes/table.js.html +12 -12
- package/coverage/lcov-report/api/routes/templates.js.html +8 -8
- package/coverage/lcov-report/api/routes/user.js.html +9 -9
- package/coverage/lcov-report/api/routes/view.js.html +11 -11
- package/coverage/lcov-report/api/routes/webhook.js.html +11 -11
- package/coverage/lcov-report/automations/actions.js.html +57 -117
- package/coverage/lcov-report/automations/automationUtils.js.html +7 -7
- package/coverage/lcov-report/automations/bullboard.js.html +49 -16
- package/coverage/lcov-report/automations/index.html +67 -67
- package/coverage/lcov-report/automations/index.js.html +26 -128
- package/coverage/lcov-report/automations/steps/bash.js.html +37 -16
- package/coverage/lcov-report/automations/steps/createRow.js.html +15 -15
- package/coverage/lcov-report/automations/steps/delay.js.html +48 -9
- package/coverage/lcov-report/automations/steps/deleteRow.js.html +14 -14
- package/coverage/lcov-report/automations/steps/discord.js.html +329 -0
- package/coverage/lcov-report/automations/steps/executeQuery.js.html +22 -34
- package/coverage/lcov-report/automations/steps/executeScript.js.html +21 -33
- package/coverage/lcov-report/automations/steps/filter.js.html +28 -25
- package/coverage/lcov-report/automations/steps/index.html +140 -65
- package/coverage/lcov-report/automations/steps/integromat.js.html +341 -0
- package/coverage/lcov-report/automations/steps/outgoingWebhook.js.html +44 -38
- package/coverage/lcov-report/automations/steps/queryRows.js.html +437 -0
- package/coverage/lcov-report/automations/steps/sendSmtpEmail.js.html +13 -13
- package/coverage/lcov-report/automations/steps/serverLog.js.html +23 -11
- package/coverage/lcov-report/automations/steps/{sendgridEmail.js.html → slack.js.html} +58 -88
- package/coverage/lcov-report/automations/steps/updateRow.js.html +12 -12
- package/coverage/lcov-report/automations/steps/utils.js.html +188 -0
- package/coverage/lcov-report/automations/steps/zapier.js.html +332 -0
- package/coverage/lcov-report/automations/thread.js.html +79 -76
- package/coverage/lcov-report/automations/triggerInfo/app.js.html +173 -0
- package/coverage/lcov-report/automations/triggerInfo/cron.js.html +173 -0
- package/coverage/lcov-report/automations/triggerInfo/index.html +201 -0
- package/coverage/lcov-report/automations/triggerInfo/index.js.html +125 -0
- package/coverage/lcov-report/automations/triggerInfo/rowDeleted.js.html +176 -0
- package/coverage/lcov-report/automations/triggerInfo/rowSaved.js.html +200 -0
- package/coverage/lcov-report/automations/triggerInfo/rowUpdated.js.html +200 -0
- package/coverage/lcov-report/automations/triggerInfo/webhook.js.html +188 -0
- package/coverage/lcov-report/automations/triggers.js.html +67 -838
- package/coverage/lcov-report/automations/utils.js.html +557 -0
- package/coverage/lcov-report/constants/index.html +5 -5
- package/coverage/lcov-report/constants/index.js.html +32 -17
- package/coverage/lcov-report/constants/layouts.js.html +5 -5
- package/coverage/lcov-report/constants/screens.js.html +4 -4
- package/coverage/lcov-report/db/client.js.html +18 -18
- package/coverage/lcov-report/db/index.html +19 -19
- package/coverage/lcov-report/db/index.js.html +3 -3
- package/coverage/lcov-report/db/linkedRows/LinkController.js.html +79 -79
- package/coverage/lcov-report/db/linkedRows/index.html +18 -18
- package/coverage/lcov-report/db/linkedRows/index.js.html +107 -149
- package/coverage/lcov-report/db/linkedRows/linkUtils.js.html +43 -43
- package/coverage/lcov-report/db/newid.js.html +4 -4
- package/coverage/lcov-report/db/utils.js.html +127 -76
- package/coverage/lcov-report/events/AutomationEmitter.js.html +7 -7
- package/coverage/lcov-report/events/index.html +1 -1
- package/coverage/lcov-report/events/index.js.html +6 -6
- package/coverage/lcov-report/events/utils.js.html +3 -3
- package/coverage/lcov-report/index.html +116 -101
- package/coverage/lcov-report/integrations/tests/TestConfiguration.js.html +1 -1
- package/coverage/lcov-report/integrations/tests/index.html +1 -1
- package/coverage/lcov-report/{automations/logic.js.html → middleware/appInfo.js.html} +35 -38
- package/coverage/lcov-report/middleware/authorized.js.html +16 -16
- package/coverage/lcov-report/middleware/builder.js.html +15 -15
- package/coverage/lcov-report/middleware/currentapp.js.html +33 -33
- package/coverage/lcov-report/middleware/index.html +23 -8
- package/coverage/lcov-report/middleware/joi-validator.js.html +6 -6
- package/coverage/lcov-report/middleware/resourceId.js.html +28 -28
- package/coverage/lcov-report/middleware/selfhost.js.html +1 -1
- package/coverage/lcov-report/middleware/usageQuota.js.html +8 -8
- package/coverage/lcov-report/utilities/bcrypt.js.html +1 -1
- package/coverage/lcov-report/utilities/budibaseDir.js.html +1 -1
- package/coverage/lcov-report/utilities/centralPath.js.html +1 -1
- package/coverage/lcov-report/utilities/csvParser.js.html +6 -6
- package/coverage/lcov-report/utilities/global.js.html +33 -33
- package/coverage/lcov-report/utilities/index.html +28 -28
- package/coverage/lcov-report/utilities/index.js.html +178 -25
- package/coverage/lcov-report/utilities/queue/inMemoryQueue.js.html +18 -18
- package/coverage/lcov-report/utilities/queue/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.html +1 -1
- package/coverage/lcov-report/utilities/routing/index.js.html +6 -6
- package/coverage/lcov-report/utilities/rowProcessor/index.html +14 -14
- package/coverage/lcov-report/utilities/rowProcessor/index.js.html +87 -51
- package/coverage/lcov-report/utilities/rowProcessor/utils.js.html +10 -10
- package/coverage/lcov-report/utilities/security.js.html +9 -9
- package/coverage/lcov-report/utilities/statusCodes.js.html +1 -1
- package/coverage/lcov-report/utilities/users.js.html +5 -5
- package/coverage/lcov-report/utilities/workerRequests.js.html +52 -52
- package/coverage/lcov.info +3255 -3218
- package/dist/api/controllers/automation.js +60 -127
- package/dist/api/controllers/deploy/index.js +17 -1
- package/dist/api/controllers/metadata.js +49 -0
- package/dist/api/controllers/query.js +0 -2
- package/dist/api/controllers/row/ExternalRequest.js +1 -1
- package/dist/api/controllers/row/index.js +1 -0
- package/dist/api/controllers/row/internal.js +33 -23
- package/dist/api/controllers/static/index.js +1 -28
- package/dist/api/controllers/static/templates/BudibaseApp.svelte +4 -1
- package/dist/api/controllers/user.js +1 -1
- package/dist/api/routes/automation.js +4 -5
- package/dist/api/routes/index.js +2 -0
- package/dist/api/routes/metadata.js +13 -0
- package/dist/api/routes/static.js +0 -1
- package/dist/api/routes/tests/utilities/TestFunctions.js +13 -0
- package/dist/app.js +1 -1
- package/dist/automations/actions.js +29 -46
- package/dist/automations/bullboard.js +11 -2
- package/dist/automations/index.js +11 -48
- package/dist/automations/steps/bash.js +12 -6
- package/dist/automations/steps/createRow.js +5 -5
- package/dist/automations/steps/delay.js +16 -3
- package/dist/automations/steps/deleteRow.js +5 -5
- package/dist/automations/steps/discord.js +91 -0
- package/dist/automations/steps/executeQuery.js +12 -15
- package/dist/automations/steps/executeScript.js +12 -15
- package/dist/automations/steps/filter.js +19 -18
- package/dist/automations/steps/integromat.js +94 -0
- package/dist/automations/steps/outgoingWebhook.js +19 -20
- package/dist/automations/steps/queryRows.js +129 -0
- package/dist/automations/steps/sendSmtpEmail.js +4 -4
- package/dist/automations/steps/serverLog.js +7 -3
- package/dist/automations/steps/slack.js +73 -0
- package/dist/automations/steps/updateRow.js +4 -4
- package/dist/automations/steps/utils.js +46 -0
- package/dist/automations/steps/zapier.js +91 -0
- package/dist/automations/tests/utilities/index.js +2 -12
- package/dist/automations/thread.js +23 -25
- package/dist/automations/triggerInfo/app.js +32 -0
- package/dist/automations/triggerInfo/cron.js +32 -0
- package/dist/automations/triggerInfo/index.js +15 -0
- package/dist/automations/triggerInfo/rowDeleted.js +33 -0
- package/dist/automations/triggerInfo/rowSaved.js +41 -0
- package/dist/automations/triggerInfo/rowUpdated.js +41 -0
- package/dist/automations/triggerInfo/webhook.js +37 -0
- package/dist/automations/triggers.js +27 -285
- package/dist/automations/utils.js +143 -0
- package/dist/constants/index.js +4 -0
- package/dist/db/linkedRows/index.js +20 -34
- package/dist/db/utils.js +14 -1
- package/dist/environment.js +2 -1
- package/dist/integrations/mysql.js +14 -2
- package/dist/middleware/appInfo.js +17 -0
- package/dist/middleware/usageQuota.js +1 -1
- package/dist/package.json +12 -11
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/dist/utilities/appDirectoryTemplate/package.json +1 -1
- package/dist/utilities/fileSystem/clientLibrary.js +2 -2
- package/dist/utilities/fileSystem/index.js +2 -27
- package/dist/utilities/index.js +54 -0
- package/dist/utilities/redis.js +16 -1
- package/dist/utilities/rowProcessor/index.js +7 -4
- package/package.json +13 -12
- package/scripts/jestSetup.js +1 -0
- package/scripts/selfhost.js +8 -0
- package/src/api/controllers/automation.js +87 -145
- package/src/api/controllers/deploy/index.js +23 -1
- package/src/api/controllers/metadata.js +46 -0
- package/src/api/controllers/query.js +0 -2
- package/src/api/controllers/row/ExternalRequest.ts +1 -1
- package/src/api/controllers/row/index.js +1 -0
- package/src/api/controllers/row/internal.js +34 -23
- package/src/api/controllers/static/index.js +1 -39
- package/src/api/controllers/static/templates/BudibaseApp.svelte +4 -1
- package/src/api/controllers/user.js +1 -0
- package/src/api/routes/automation.js +16 -11
- package/src/api/routes/index.js +2 -0
- package/src/api/routes/metadata.js +38 -0
- package/src/api/routes/static.js +0 -1
- package/src/api/routes/tests/automation.spec.js +4 -26
- package/src/api/routes/tests/metadata.spec.js +65 -0
- package/src/api/routes/tests/utilities/TestFunctions.js +14 -0
- package/src/app.ts +1 -1
- package/src/automations/actions.js +29 -49
- package/src/automations/bullboard.js +13 -2
- package/src/automations/index.js +11 -45
- package/src/automations/steps/bash.js +13 -6
- package/src/automations/steps/createRow.js +5 -5
- package/src/automations/steps/delay.js +16 -3
- package/src/automations/steps/deleteRow.js +5 -5
- package/src/automations/steps/discord.js +83 -0
- package/src/automations/steps/executeQuery.js +12 -16
- package/src/automations/steps/executeScript.js +12 -16
- package/src/automations/steps/filter.js +19 -18
- package/src/automations/steps/integromat.js +87 -0
- package/src/automations/steps/outgoingWebhook.js +20 -18
- package/src/automations/steps/queryRows.js +119 -0
- package/src/automations/steps/sendSmtpEmail.js +4 -4
- package/src/automations/steps/serverLog.js +7 -3
- package/src/automations/steps/slack.js +64 -0
- package/src/automations/steps/updateRow.js +4 -4
- package/src/automations/steps/utils.js +36 -0
- package/src/automations/steps/zapier.js +84 -0
- package/src/automations/tests/automation.spec.js +4 -67
- package/src/automations/tests/delay.spec.js +2 -2
- package/src/automations/tests/filter.spec.js +14 -14
- package/src/automations/tests/queryRows.spec.js +51 -0
- package/src/automations/tests/utilities/index.js +2 -13
- package/src/automations/thread.js +27 -26
- package/src/automations/triggerInfo/app.js +31 -0
- package/src/automations/triggerInfo/cron.js +31 -0
- package/src/automations/triggerInfo/index.js +15 -0
- package/src/automations/triggerInfo/rowDeleted.js +32 -0
- package/src/automations/triggerInfo/rowSaved.js +40 -0
- package/src/automations/triggerInfo/rowUpdated.js +40 -0
- package/src/automations/triggerInfo/webhook.js +36 -0
- package/src/automations/triggers.js +33 -290
- package/src/automations/utils.js +159 -0
- package/src/constants/index.js +5 -0
- package/src/db/linkedRows/index.js +21 -35
- package/src/db/tests/linkTests.spec.js +0 -12
- package/src/db/utils.js +17 -0
- package/src/environment.js +2 -1
- package/src/integrations/mysql.ts +15 -2
- package/src/middleware/appInfo.js +19 -0
- package/src/middleware/usageQuota.js +1 -1
- package/src/utilities/appDirectoryTemplate/package.json +1 -1
- package/src/utilities/fileSystem/clientLibrary.js +2 -2
- package/src/utilities/fileSystem/index.js +2 -36
- package/src/utilities/index.js +51 -0
- package/src/utilities/redis.js +18 -1
- package/src/utilities/rowProcessor/index.js +16 -4
- package/coverage/lcov-report/api/controllers/row/internalSearch.js.html +0 -1244
- package/dist/automations/logic.js +0 -17
- package/dist/automations/steps/sendgridEmail.js +0 -85
- package/src/automations/logic.js +0 -20
- package/src/automations/steps/sendgridEmail.js +0 -74
- package/src/automations/tests/sendEmail.spec.js +0 -36
|
@@ -97,3 +97,16 @@ exports.checkPermissionsEndpoint = ({ config, method, url, body, passRole, failR
|
|
|
97
97
|
exports.getDB = config => {
|
|
98
98
|
return new CouchDB(config.getAppId());
|
|
99
99
|
};
|
|
100
|
+
exports.testAutomation = (config, automation) => __awaiter(void 0, void 0, void 0, function* () {
|
|
101
|
+
return yield config.request
|
|
102
|
+
.post(`/api/automations/${automation._id}/test`)
|
|
103
|
+
.send({
|
|
104
|
+
row: {
|
|
105
|
+
name: "Test",
|
|
106
|
+
description: "TEST",
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
.set(config.defaultHeaders())
|
|
110
|
+
.expect("Content-Type", /json/)
|
|
111
|
+
.expect(200);
|
|
112
|
+
});
|
package/dist/app.js
CHANGED
|
@@ -82,8 +82,8 @@ module.exports = server.listen(env.PORT || 0, () => __awaiter(void 0, void 0, vo
|
|
|
82
82
|
env._set("PORT", server.address().port);
|
|
83
83
|
eventEmitter.emitPort(env.PORT);
|
|
84
84
|
fileSystem.init();
|
|
85
|
-
yield automations.init();
|
|
86
85
|
yield redis.init();
|
|
86
|
+
yield automations.init();
|
|
87
87
|
}));
|
|
88
88
|
process.on("uncaughtException", err => {
|
|
89
89
|
console.error(err);
|
|
@@ -8,7 +8,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const sendgridEmail = require("./steps/sendgridEmail");
|
|
12
11
|
const sendSmtpEmail = require("./steps/sendSmtpEmail");
|
|
13
12
|
const createRow = require("./steps/createRow");
|
|
14
13
|
const updateRow = require("./steps/updateRow");
|
|
@@ -18,11 +17,14 @@ const bash = require("./steps/bash");
|
|
|
18
17
|
const executeQuery = require("./steps/executeQuery");
|
|
19
18
|
const outgoingWebhook = require("./steps/outgoingWebhook");
|
|
20
19
|
const serverLog = require("./steps/serverLog");
|
|
21
|
-
const
|
|
22
|
-
const
|
|
23
|
-
const
|
|
24
|
-
const
|
|
25
|
-
|
|
20
|
+
const discord = require("./steps/discord");
|
|
21
|
+
const slack = require("./steps/slack");
|
|
22
|
+
const zapier = require("./steps/zapier");
|
|
23
|
+
const integromat = require("./steps/integromat");
|
|
24
|
+
let filter = require("./steps/filter");
|
|
25
|
+
let delay = require("./steps/delay");
|
|
26
|
+
let queryRow = require("./steps/queryRows");
|
|
27
|
+
const ACTION_IMPLS = {
|
|
26
28
|
SEND_EMAIL_SMTP: sendSmtpEmail.run,
|
|
27
29
|
CREATE_ROW: createRow.run,
|
|
28
30
|
UPDATE_ROW: updateRow.run,
|
|
@@ -32,9 +34,16 @@ const BUILTIN_ACTIONS = {
|
|
|
32
34
|
EXECUTE_BASH: bash.run,
|
|
33
35
|
EXECUTE_QUERY: executeQuery.run,
|
|
34
36
|
SERVER_LOG: serverLog.run,
|
|
37
|
+
DELAY: delay.run,
|
|
38
|
+
FILTER: filter.run,
|
|
39
|
+
QUERY_ROWS: queryRow.run,
|
|
40
|
+
// these used to be lowercase step IDs, maintain for backwards compat
|
|
41
|
+
discord: discord.run,
|
|
42
|
+
slack: slack.run,
|
|
43
|
+
zapier: zapier.run,
|
|
44
|
+
integromat: integromat.run,
|
|
35
45
|
};
|
|
36
|
-
const
|
|
37
|
-
SEND_EMAIL: sendgridEmail.definition,
|
|
46
|
+
const ACTION_DEFINITIONS = {
|
|
38
47
|
SEND_EMAIL_SMTP: sendSmtpEmail.definition,
|
|
39
48
|
CREATE_ROW: createRow.definition,
|
|
40
49
|
UPDATE_ROW: updateRow.definition,
|
|
@@ -44,47 +53,21 @@ const BUILTIN_DEFINITIONS = {
|
|
|
44
53
|
EXECUTE_QUERY: executeQuery.definition,
|
|
45
54
|
EXECUTE_BASH: bash.definition,
|
|
46
55
|
SERVER_LOG: serverLog.definition,
|
|
56
|
+
DELAY: delay.definition,
|
|
57
|
+
FILTER: filter.definition,
|
|
58
|
+
QUERY_ROWS: queryRow.definition,
|
|
59
|
+
// these used to be lowercase step IDs, maintain for backwards compat
|
|
60
|
+
discord: discord.definition,
|
|
61
|
+
slack: slack.definition,
|
|
62
|
+
zapier: zapier.definition,
|
|
63
|
+
integromat: integromat.definition,
|
|
47
64
|
};
|
|
48
|
-
let MANIFEST = null;
|
|
49
65
|
/* istanbul ignore next */
|
|
50
|
-
function
|
|
51
|
-
return `${pkgName}@${version}.min.js`;
|
|
52
|
-
}
|
|
53
|
-
/* istanbul ignore next */
|
|
54
|
-
module.exports.getAction = function (actionName) {
|
|
55
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
56
|
-
if (BUILTIN_ACTIONS[actionName] != null) {
|
|
57
|
-
return BUILTIN_ACTIONS[actionName];
|
|
58
|
-
}
|
|
59
|
-
// worker pools means that a worker may not have manifest
|
|
60
|
-
if (env.isProd() && MANIFEST == null) {
|
|
61
|
-
MANIFEST = yield module.exports.init();
|
|
62
|
-
}
|
|
63
|
-
// env setup to get async packages
|
|
64
|
-
if (!MANIFEST || !MANIFEST.packages || !MANIFEST.packages[actionName]) {
|
|
65
|
-
return null;
|
|
66
|
-
}
|
|
67
|
-
const pkg = MANIFEST.packages[actionName];
|
|
68
|
-
const bundleName = buildBundleName(pkg.stepId, pkg.version);
|
|
69
|
-
return getExternalAutomationStep(pkg.stepId, pkg.version, bundleName);
|
|
70
|
-
});
|
|
71
|
-
};
|
|
72
|
-
module.exports.init = function () {
|
|
66
|
+
exports.getAction = function (actionName) {
|
|
73
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
module.exports.DEFINITIONS =
|
|
77
|
-
MANIFEST && MANIFEST.packages
|
|
78
|
-
? Object.assign(MANIFEST.packages, BUILTIN_DEFINITIONS)
|
|
79
|
-
: BUILTIN_DEFINITIONS;
|
|
80
|
-
}
|
|
81
|
-
catch (err) {
|
|
82
|
-
console.error(err);
|
|
83
|
-
Sentry.captureException(err);
|
|
68
|
+
if (ACTION_IMPLS[actionName] != null) {
|
|
69
|
+
return ACTION_IMPLS[actionName];
|
|
84
70
|
}
|
|
85
|
-
return MANIFEST;
|
|
86
71
|
});
|
|
87
72
|
};
|
|
88
|
-
|
|
89
|
-
module.exports.DEFINITIONS = BUILTIN_DEFINITIONS;
|
|
90
|
-
module.exports.BUILTIN_DEFINITIONS = BUILTIN_DEFINITIONS;
|
|
73
|
+
exports.ACTION_DEFINITIONS = ACTION_DEFINITIONS;
|
|
@@ -1,13 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
const { createBullBoard } = require("bull-board");
|
|
3
3
|
const { BullAdapter } = require("bull-board/bullAdapter");
|
|
4
|
-
const { getQueues } = require("./triggers");
|
|
5
4
|
const express = require("express");
|
|
5
|
+
const env = require("../environment");
|
|
6
|
+
const Queue = env.isTest()
|
|
7
|
+
? require("../utilities/queue/inMemoryQueue")
|
|
8
|
+
: require("bull");
|
|
9
|
+
const { JobQueues } = require("../constants");
|
|
10
|
+
const { utils } = require("@budibase/auth/redis");
|
|
11
|
+
const { opts, redisProtocolUrl } = utils.getRedisOptions();
|
|
12
|
+
const redisConfig = redisProtocolUrl || { redis: opts };
|
|
13
|
+
let automationQueue = new Queue(JobQueues.AUTOMATIONS, redisConfig);
|
|
6
14
|
exports.pathPrefix = "/bulladmin";
|
|
7
15
|
exports.init = () => {
|
|
8
16
|
const expressApp = express();
|
|
9
17
|
// Set up queues for bull board admin
|
|
10
|
-
const queues =
|
|
18
|
+
const queues = [automationQueue];
|
|
11
19
|
const adapters = [];
|
|
12
20
|
for (let queue of queues) {
|
|
13
21
|
adapters.push(new BullAdapter(queue));
|
|
@@ -16,3 +24,4 @@ exports.init = () => {
|
|
|
16
24
|
expressApp.use(exports.pathPrefix, router);
|
|
17
25
|
return expressApp;
|
|
18
26
|
};
|
|
27
|
+
exports.queue = automationQueue;
|
|
@@ -8,55 +8,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
8
8
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const env = require("../environment");
|
|
14
|
-
const workerFarm = require("worker-farm");
|
|
15
|
-
const singleThread = require("./thread");
|
|
16
|
-
const { getAPIKey, update, Properties } = require("../utilities/usageQuota");
|
|
17
|
-
let workers = workerFarm(require.resolve("./thread"));
|
|
18
|
-
function runWorker(job) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
workers(job, err => {
|
|
21
|
-
if (err) {
|
|
22
|
-
reject(err);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
resolve();
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
function updateQuota(automation) {
|
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
32
|
-
const appId = automation.appId;
|
|
33
|
-
const apiObj = yield getAPIKey(appId);
|
|
34
|
-
// this will fail, causing automation to escape if limits reached
|
|
35
|
-
yield update(apiObj.apiKey, Properties.AUTOMATION, 1);
|
|
36
|
-
return apiObj.apiKey;
|
|
37
|
-
});
|
|
38
|
-
}
|
|
11
|
+
const { processEvent } = require("./utils");
|
|
12
|
+
const { queue } = require("./bullboard");
|
|
39
13
|
/**
|
|
40
14
|
* This module is built purely to kick off the worker farm and manage the inputs/outputs
|
|
41
15
|
*/
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
if (env.isProd()) {
|
|
51
|
-
yield runWorker(job);
|
|
52
|
-
}
|
|
53
|
-
else {
|
|
54
|
-
yield singleThread(job);
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
catch (err) {
|
|
58
|
-
console.error(`${job.data.automation.appId} automation ${job.data.automation._id} was unable to run - ${err}`);
|
|
59
|
-
}
|
|
60
|
-
}));
|
|
61
|
-
});
|
|
16
|
+
exports.init = function () {
|
|
17
|
+
// this promise will not complete
|
|
18
|
+
return queue.process((job) => __awaiter(this, void 0, void 0, function* () {
|
|
19
|
+
yield processEvent(job);
|
|
20
|
+
}));
|
|
21
|
+
};
|
|
22
|
+
exports.getQueues = () => {
|
|
23
|
+
return [queue];
|
|
62
24
|
};
|
|
25
|
+
exports.queue = queue;
|
|
@@ -10,12 +10,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
10
10
|
};
|
|
11
11
|
const { execSync } = require("child_process");
|
|
12
12
|
const { processStringSync } = require("@budibase/string-templates");
|
|
13
|
-
|
|
13
|
+
exports.definition = {
|
|
14
14
|
name: "Bash Scripting",
|
|
15
15
|
tagline: "Execute a bash command",
|
|
16
|
-
icon: "
|
|
16
|
+
icon: "JourneyEvent",
|
|
17
17
|
description: "Run a bash script",
|
|
18
18
|
type: "ACTION",
|
|
19
|
+
internal: true,
|
|
19
20
|
stepId: "EXECUTE_BASH",
|
|
20
21
|
inputs: {},
|
|
21
22
|
schema: {
|
|
@@ -33,14 +34,18 @@ module.exports.definition = {
|
|
|
33
34
|
properties: {
|
|
34
35
|
stdout: {
|
|
35
36
|
type: "string",
|
|
36
|
-
description: "Standard output of your bash command or script
|
|
37
|
+
description: "Standard output of your bash command or script",
|
|
38
|
+
},
|
|
39
|
+
success: {
|
|
40
|
+
type: "boolean",
|
|
41
|
+
description: "Whether the command was successful",
|
|
37
42
|
},
|
|
38
43
|
},
|
|
39
44
|
},
|
|
40
45
|
required: ["stdout"],
|
|
41
46
|
},
|
|
42
47
|
};
|
|
43
|
-
|
|
48
|
+
exports.run = function ({ inputs, context }) {
|
|
44
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
45
50
|
if (inputs.code == null) {
|
|
46
51
|
return {
|
|
@@ -49,19 +54,20 @@ module.exports.run = function ({ inputs, context }) {
|
|
|
49
54
|
}
|
|
50
55
|
try {
|
|
51
56
|
const command = processStringSync(inputs.code, context);
|
|
52
|
-
let stdout;
|
|
57
|
+
let stdout, success = true;
|
|
53
58
|
try {
|
|
54
59
|
stdout = execSync(command, { timeout: 500 }).toString();
|
|
55
60
|
}
|
|
56
61
|
catch (err) {
|
|
57
62
|
stdout = err.message;
|
|
63
|
+
success = false;
|
|
58
64
|
}
|
|
59
65
|
return {
|
|
60
66
|
stdout,
|
|
67
|
+
success,
|
|
61
68
|
};
|
|
62
69
|
}
|
|
63
70
|
catch (err) {
|
|
64
|
-
console.error(err);
|
|
65
71
|
return {
|
|
66
72
|
success: false,
|
|
67
73
|
response: err,
|
|
@@ -12,12 +12,13 @@ const rowController = require("../../api/controllers/row");
|
|
|
12
12
|
const automationUtils = require("../automationUtils");
|
|
13
13
|
const env = require("../../environment");
|
|
14
14
|
const usage = require("../../utilities/usageQuota");
|
|
15
|
-
|
|
15
|
+
exports.definition = {
|
|
16
16
|
name: "Create Row",
|
|
17
17
|
tagline: "Create a {{inputs.enriched.table.name}} row",
|
|
18
|
-
icon: "
|
|
18
|
+
icon: "TableRowAddBottom",
|
|
19
19
|
description: "Add a row to your database",
|
|
20
20
|
type: "ACTION",
|
|
21
|
+
internal: true,
|
|
21
22
|
stepId: "CREATE_ROW",
|
|
22
23
|
inputs: {},
|
|
23
24
|
schema: {
|
|
@@ -51,7 +52,7 @@ module.exports.definition = {
|
|
|
51
52
|
},
|
|
52
53
|
success: {
|
|
53
54
|
type: "boolean",
|
|
54
|
-
description: "Whether the
|
|
55
|
+
description: "Whether the row creation was successful",
|
|
55
56
|
},
|
|
56
57
|
id: {
|
|
57
58
|
type: "string",
|
|
@@ -66,7 +67,7 @@ module.exports.definition = {
|
|
|
66
67
|
},
|
|
67
68
|
},
|
|
68
69
|
};
|
|
69
|
-
|
|
70
|
+
exports.run = function ({ inputs, appId, apiKey, emitter }) {
|
|
70
71
|
return __awaiter(this, void 0, void 0, function* () {
|
|
71
72
|
if (inputs.row == null || inputs.row.tableId == null) {
|
|
72
73
|
return {
|
|
@@ -102,7 +103,6 @@ module.exports.run = function ({ inputs, appId, apiKey, emitter }) {
|
|
|
102
103
|
};
|
|
103
104
|
}
|
|
104
105
|
catch (err) {
|
|
105
|
-
console.error(err);
|
|
106
106
|
return {
|
|
107
107
|
success: false,
|
|
108
108
|
response: err,
|
|
@@ -9,12 +9,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
let { wait } = require("../../utilities");
|
|
12
|
-
|
|
12
|
+
exports.definition = {
|
|
13
13
|
name: "Delay",
|
|
14
|
-
icon: "
|
|
14
|
+
icon: "Clock",
|
|
15
15
|
tagline: "Delay for {{inputs.time}} milliseconds",
|
|
16
16
|
description: "Delay the automation until an amount of time has passed",
|
|
17
17
|
stepId: "DELAY",
|
|
18
|
+
internal: true,
|
|
18
19
|
inputs: {},
|
|
19
20
|
schema: {
|
|
20
21
|
inputs: {
|
|
@@ -26,11 +27,23 @@ module.exports.definition = {
|
|
|
26
27
|
},
|
|
27
28
|
required: ["time"],
|
|
28
29
|
},
|
|
30
|
+
outputs: {
|
|
31
|
+
properties: {
|
|
32
|
+
success: {
|
|
33
|
+
type: "boolean",
|
|
34
|
+
description: "Whether the delay was successful",
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
required: ["success"],
|
|
38
|
+
},
|
|
29
39
|
},
|
|
30
40
|
type: "LOGIC",
|
|
31
41
|
};
|
|
32
|
-
|
|
42
|
+
exports.run = function delay({ inputs }) {
|
|
33
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
34
44
|
yield wait(inputs.time);
|
|
45
|
+
return {
|
|
46
|
+
success: true,
|
|
47
|
+
};
|
|
35
48
|
});
|
|
36
49
|
};
|
|
@@ -11,13 +11,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
const rowController = require("../../api/controllers/row");
|
|
12
12
|
const env = require("../../environment");
|
|
13
13
|
const usage = require("../../utilities/usageQuota");
|
|
14
|
-
|
|
14
|
+
exports.definition = {
|
|
15
15
|
description: "Delete a row from your database",
|
|
16
|
-
icon: "
|
|
16
|
+
icon: "TableRowRemoveCenter",
|
|
17
17
|
name: "Delete Row",
|
|
18
18
|
tagline: "Delete a {{inputs.enriched.table.name}} row",
|
|
19
19
|
type: "ACTION",
|
|
20
20
|
stepId: "DELETE_ROW",
|
|
21
|
+
internal: true,
|
|
21
22
|
inputs: {},
|
|
22
23
|
schema: {
|
|
23
24
|
inputs: {
|
|
@@ -51,14 +52,14 @@ module.exports.definition = {
|
|
|
51
52
|
},
|
|
52
53
|
success: {
|
|
53
54
|
type: "boolean",
|
|
54
|
-
description: "Whether the
|
|
55
|
+
description: "Whether the deletion was successful",
|
|
55
56
|
},
|
|
56
57
|
},
|
|
57
58
|
required: ["row", "success"],
|
|
58
59
|
},
|
|
59
60
|
},
|
|
60
61
|
};
|
|
61
|
-
|
|
62
|
+
exports.run = function ({ inputs, appId, apiKey, emitter }) {
|
|
62
63
|
return __awaiter(this, void 0, void 0, function* () {
|
|
63
64
|
if (inputs.id == null || inputs.revision == null) {
|
|
64
65
|
return {
|
|
@@ -93,7 +94,6 @@ module.exports.run = function ({ inputs, appId, apiKey, emitter }) {
|
|
|
93
94
|
};
|
|
94
95
|
}
|
|
95
96
|
catch (err) {
|
|
96
|
-
console.error(err);
|
|
97
97
|
return {
|
|
98
98
|
success: false,
|
|
99
99
|
response: err,
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
const fetch = require("node-fetch");
|
|
12
|
+
const { getFetchResponse } = require("./utils");
|
|
13
|
+
const DEFAULT_USERNAME = "Budibase Automate";
|
|
14
|
+
const DEFAULT_AVATAR_URL = "https://i.imgur.com/a1cmTKM.png";
|
|
15
|
+
exports.definition = {
|
|
16
|
+
name: "Discord Message",
|
|
17
|
+
tagline: "Send a message to a Discord server",
|
|
18
|
+
description: "Send a message to a Discord server",
|
|
19
|
+
icon: "ri-discord-line",
|
|
20
|
+
stepId: "discord",
|
|
21
|
+
type: "ACTION",
|
|
22
|
+
internal: false,
|
|
23
|
+
inputs: {},
|
|
24
|
+
schema: {
|
|
25
|
+
inputs: {
|
|
26
|
+
properties: {
|
|
27
|
+
url: {
|
|
28
|
+
type: "string",
|
|
29
|
+
title: "Discord Webhook URL",
|
|
30
|
+
},
|
|
31
|
+
username: {
|
|
32
|
+
type: "string",
|
|
33
|
+
title: "Bot Name",
|
|
34
|
+
},
|
|
35
|
+
avatar_url: {
|
|
36
|
+
type: "string",
|
|
37
|
+
title: "Bot Avatar URL",
|
|
38
|
+
},
|
|
39
|
+
content: {
|
|
40
|
+
type: "string",
|
|
41
|
+
title: "Message",
|
|
42
|
+
},
|
|
43
|
+
},
|
|
44
|
+
required: ["url", "content"],
|
|
45
|
+
},
|
|
46
|
+
outputs: {
|
|
47
|
+
properties: {
|
|
48
|
+
httpStatus: {
|
|
49
|
+
type: "number",
|
|
50
|
+
description: "The HTTP status code of the request",
|
|
51
|
+
},
|
|
52
|
+
response: {
|
|
53
|
+
type: "string",
|
|
54
|
+
description: "The response from the Discord Webhook",
|
|
55
|
+
},
|
|
56
|
+
success: {
|
|
57
|
+
type: "boolean",
|
|
58
|
+
description: "Whether the message sent successfully",
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
},
|
|
63
|
+
};
|
|
64
|
+
exports.run = function ({ inputs }) {
|
|
65
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
66
|
+
let { url, username, avatar_url, content } = inputs;
|
|
67
|
+
if (!username) {
|
|
68
|
+
username = DEFAULT_USERNAME;
|
|
69
|
+
}
|
|
70
|
+
if (!avatar_url) {
|
|
71
|
+
avatar_url = DEFAULT_AVATAR_URL;
|
|
72
|
+
}
|
|
73
|
+
const response = yield fetch(url, {
|
|
74
|
+
method: "post",
|
|
75
|
+
body: JSON.stringify({
|
|
76
|
+
username,
|
|
77
|
+
avatar_url,
|
|
78
|
+
content,
|
|
79
|
+
}),
|
|
80
|
+
headers: {
|
|
81
|
+
"Content-Type": "application/json",
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
const { status, message } = yield getFetchResponse(response);
|
|
85
|
+
return {
|
|
86
|
+
httpStatus: status,
|
|
87
|
+
success: status === 200,
|
|
88
|
+
response: message,
|
|
89
|
+
};
|
|
90
|
+
});
|
|
91
|
+
};
|
|
@@ -20,13 +20,15 @@ var __rest = (this && this.__rest) || function (s, e) {
|
|
|
20
20
|
return t;
|
|
21
21
|
};
|
|
22
22
|
const queryController = require("../../api/controllers/query");
|
|
23
|
-
|
|
23
|
+
const { buildCtx } = require("./utils");
|
|
24
|
+
exports.definition = {
|
|
24
25
|
name: "External Data Connector",
|
|
25
26
|
tagline: "Execute Data Connector",
|
|
26
|
-
icon: "
|
|
27
|
+
icon: "Data",
|
|
27
28
|
description: "Execute a query in an external data connector",
|
|
28
29
|
type: "ACTION",
|
|
29
30
|
stepId: "EXECUTE_QUERY",
|
|
31
|
+
internal: true,
|
|
30
32
|
inputs: {},
|
|
31
33
|
schema: {
|
|
32
34
|
inputs: {
|
|
@@ -61,7 +63,7 @@ module.exports.definition = {
|
|
|
61
63
|
required: ["response", "success"],
|
|
62
64
|
},
|
|
63
65
|
};
|
|
64
|
-
|
|
66
|
+
exports.run = function ({ inputs, appId, emitter }) {
|
|
65
67
|
return __awaiter(this, void 0, void 0, function* () {
|
|
66
68
|
if (inputs.query == null) {
|
|
67
69
|
return {
|
|
@@ -72,27 +74,22 @@ module.exports.run = function ({ inputs, appId, emitter }) {
|
|
|
72
74
|
};
|
|
73
75
|
}
|
|
74
76
|
const _a = inputs.query, { queryId } = _a, rest = __rest(_a, ["queryId"]);
|
|
75
|
-
const ctx = {
|
|
77
|
+
const ctx = buildCtx(appId, emitter, {
|
|
78
|
+
body: {
|
|
79
|
+
parameters: rest,
|
|
80
|
+
},
|
|
76
81
|
params: {
|
|
77
82
|
queryId,
|
|
78
83
|
},
|
|
79
|
-
|
|
80
|
-
body: {
|
|
81
|
-
parameters: rest,
|
|
82
|
-
},
|
|
83
|
-
},
|
|
84
|
-
appId,
|
|
85
|
-
eventEmitter: emitter,
|
|
86
|
-
};
|
|
87
|
-
yield queryController.execute(ctx);
|
|
84
|
+
});
|
|
88
85
|
try {
|
|
86
|
+
yield queryController.execute(ctx);
|
|
89
87
|
return {
|
|
90
88
|
response: ctx.body,
|
|
91
|
-
success:
|
|
89
|
+
success: true,
|
|
92
90
|
};
|
|
93
91
|
}
|
|
94
92
|
catch (err) {
|
|
95
|
-
console.error(err);
|
|
96
93
|
return {
|
|
97
94
|
success: false,
|
|
98
95
|
response: err,
|
|
@@ -9,12 +9,14 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
});
|
|
10
10
|
};
|
|
11
11
|
const scriptController = require("../../api/controllers/script");
|
|
12
|
-
|
|
12
|
+
const { buildCtx } = require("./utils");
|
|
13
|
+
exports.definition = {
|
|
13
14
|
name: "JS Scripting",
|
|
14
15
|
tagline: "Execute JavaScript Code",
|
|
15
|
-
icon: "
|
|
16
|
+
icon: "Code",
|
|
16
17
|
description: "Run a piece of JavaScript code in your automation",
|
|
17
18
|
type: "ACTION",
|
|
19
|
+
internal: true,
|
|
18
20
|
stepId: "EXECUTE_SCRIPT",
|
|
19
21
|
inputs: {},
|
|
20
22
|
schema: {
|
|
@@ -32,7 +34,7 @@ module.exports.definition = {
|
|
|
32
34
|
properties: {
|
|
33
35
|
value: {
|
|
34
36
|
type: "string",
|
|
35
|
-
description: "The result of the
|
|
37
|
+
description: "The result of the return statement",
|
|
36
38
|
},
|
|
37
39
|
success: {
|
|
38
40
|
type: "boolean",
|
|
@@ -43,7 +45,7 @@ module.exports.definition = {
|
|
|
43
45
|
required: ["success"],
|
|
44
46
|
},
|
|
45
47
|
};
|
|
46
|
-
|
|
48
|
+
exports.run = function ({ inputs, appId, context, emitter }) {
|
|
47
49
|
return __awaiter(this, void 0, void 0, function* () {
|
|
48
50
|
if (inputs.code == null) {
|
|
49
51
|
return {
|
|
@@ -53,25 +55,20 @@ module.exports.run = function ({ inputs, appId, context, emitter }) {
|
|
|
53
55
|
},
|
|
54
56
|
};
|
|
55
57
|
}
|
|
56
|
-
const ctx = {
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
context,
|
|
61
|
-
},
|
|
58
|
+
const ctx = buildCtx(appId, emitter, {
|
|
59
|
+
body: {
|
|
60
|
+
script: inputs.code,
|
|
61
|
+
context,
|
|
62
62
|
},
|
|
63
|
-
|
|
64
|
-
eventEmitter: emitter,
|
|
65
|
-
};
|
|
63
|
+
});
|
|
66
64
|
try {
|
|
67
65
|
yield scriptController.execute(ctx);
|
|
68
66
|
return {
|
|
69
|
-
success:
|
|
67
|
+
success: true,
|
|
70
68
|
value: ctx.body,
|
|
71
69
|
};
|
|
72
70
|
}
|
|
73
71
|
catch (err) {
|
|
74
|
-
console.error(err);
|
|
75
72
|
return {
|
|
76
73
|
success: false,
|
|
77
74
|
response: err,
|