@budibase/server 2.5.6-alpha.2 → 2.5.6-alpha.20
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/{index.80d32454.js → index.3eea26b2.js} +378 -362
- package/builder/assets/index.7ec21ee2.css +6 -0
- package/builder/index.html +2 -2
- package/dist/api/controllers/automation.js +13 -7
- package/dist/api/controllers/plugin/index.js +6 -37
- package/dist/api/controllers/query/index.js +2 -2
- package/dist/api/controllers/table/utils.js +9 -3
- package/dist/api/routes/index.js +0 -2
- package/dist/app.js +2 -2
- package/dist/automations/actions.js +32 -6
- package/dist/automations/index.js +3 -2
- package/dist/automations/steps/bash.js +6 -6
- package/dist/automations/steps/createRow.js +11 -11
- package/dist/automations/steps/delay.js +3 -3
- package/dist/automations/steps/deleteRow.js +8 -8
- package/dist/automations/steps/discord.js +8 -8
- package/dist/automations/steps/executeQuery.js +9 -9
- package/dist/automations/steps/executeScript.js +6 -6
- package/dist/automations/steps/filter.js +6 -6
- package/dist/automations/steps/integromat.js +10 -10
- package/dist/automations/steps/loop.js +9 -9
- package/dist/automations/steps/outgoingWebhook.js +10 -10
- package/dist/automations/steps/queryRows.js +14 -14
- package/dist/automations/steps/sendSmtpEmail.js +9 -9
- package/dist/automations/steps/serverLog.js +4 -4
- package/dist/automations/steps/slack.js +6 -6
- package/dist/automations/steps/updateRow.js +11 -11
- package/dist/automations/steps/zapier.js +9 -9
- package/dist/automations/triggerInfo/app.js +5 -5
- package/dist/automations/triggerInfo/cron.js +4 -4
- package/dist/automations/triggerInfo/rowDeleted.js +5 -5
- package/dist/automations/triggerInfo/rowSaved.js +7 -7
- package/dist/automations/triggerInfo/rowUpdated.js +7 -7
- package/dist/automations/triggerInfo/webhook.js +6 -6
- package/dist/integrations/index.js +3 -3
- package/dist/migrations/functions/syncQuotas.js +2 -0
- package/dist/migrations/functions/usageQuotas/syncApps.js +0 -1
- package/dist/migrations/functions/usageQuotas/syncUsers.js +21 -0
- package/dist/package.json +10 -9
- package/dist/sdk/app/backups/exports.js +1 -35
- package/dist/sdk/index.js +2 -0
- package/dist/{api/routes/cloud.js → sdk/plugins/index.js} +2 -14
- package/dist/sdk/plugins/plugins.js +53 -0
- package/dist/threads/automation.js +2 -2
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utilities/fileSystem/plugin.js +33 -23
- package/dist/watch.js +2 -2
- package/dist/websockets/client.js +14 -0
- package/dist/websockets/grid.js +60 -0
- package/dist/websockets/index.js +17 -0
- package/dist/websockets/websocket.js +78 -0
- package/package.json +11 -10
- package/src/api/controllers/automation.ts +12 -6
- package/src/api/controllers/plugin/index.ts +8 -45
- package/src/api/controllers/query/index.ts +2 -2
- package/src/api/controllers/table/utils.ts +10 -3
- package/src/api/index.ts +0 -1
- package/src/api/routes/index.ts +0 -2
- package/src/api/routes/tests/automation.spec.js +2 -2
- package/src/app.ts +2 -2
- package/src/automations/actions.ts +56 -24
- package/src/automations/index.ts +1 -1
- package/src/automations/steps/bash.ts +10 -7
- package/src/automations/steps/createRow.ts +15 -12
- package/src/automations/steps/delay.ts +6 -4
- package/src/automations/steps/deleteRow.ts +12 -9
- package/src/automations/steps/discord.ts +10 -8
- package/src/automations/steps/executeQuery.ts +13 -10
- package/src/automations/steps/executeScript.ts +10 -7
- package/src/automations/steps/filter.ts +8 -6
- package/src/automations/steps/integromat.ts +12 -10
- package/src/automations/steps/loop.ts +16 -10
- package/src/automations/steps/outgoingWebhook.ts +14 -11
- package/src/automations/steps/queryRows.ts +18 -15
- package/src/automations/steps/sendSmtpEmail.ts +11 -9
- package/src/automations/steps/serverLog.ts +6 -4
- package/src/automations/steps/slack.ts +8 -6
- package/src/automations/steps/updateRow.ts +15 -12
- package/src/automations/steps/zapier.ts +11 -9
- package/src/automations/tests/utilities/index.ts +2 -2
- package/src/automations/triggerInfo/app.ts +8 -5
- package/src/automations/triggerInfo/cron.ts +7 -4
- package/src/automations/triggerInfo/rowDeleted.ts +8 -5
- package/src/automations/triggerInfo/rowSaved.ts +10 -7
- package/src/automations/triggerInfo/rowUpdated.ts +10 -7
- package/src/automations/triggerInfo/webhook.ts +9 -6
- package/src/integrations/index.ts +3 -3
- package/src/migrations/functions/syncQuotas.ts +2 -0
- package/src/migrations/functions/usageQuotas/syncApps.ts +1 -2
- package/src/migrations/functions/usageQuotas/syncUsers.ts +9 -0
- package/src/migrations/functions/usageQuotas/tests/syncUsers.spec.ts +26 -0
- package/src/migrations/index.ts +1 -0
- package/src/sdk/app/backups/exports.ts +0 -35
- package/src/sdk/index.ts +2 -0
- package/src/sdk/plugins/index.ts +5 -0
- package/src/sdk/plugins/plugins.ts +41 -0
- package/src/tests/utilities/structures.ts +25 -17
- package/src/threads/automation.ts +2 -2
- package/src/utilities/fileSystem/plugin.ts +13 -4
- package/src/watch.ts +2 -2
- package/src/websockets/client.ts +11 -0
- package/src/websockets/grid.ts +55 -0
- package/src/websockets/index.ts +14 -0
- package/src/websockets/websocket.ts +83 -0
- package/builder/assets/index.841e62d8.css +0 -6
- package/dist/api/controllers/cloud.js +0 -130
- package/dist/websocket.js +0 -22
- package/src/api/controllers/cloud.ts +0 -119
- package/src/api/routes/cloud.ts +0 -18
- package/src/api/routes/tests/cloud.spec.ts +0 -54
- package/src/migrations/functions/tests/syncQuotas.spec.js +0 -26
- package/src/websocket.ts +0 -26
package/builder/index.html
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
<link rel="preconnect" href="https://fonts.gstatic.com" />
|
|
9
9
|
<link href="https://fonts.googleapis.com/css2?family=Source+Sans+Pro:wght@400;600;700&display=swap"
|
|
10
10
|
rel="stylesheet" />
|
|
11
|
-
<script type="module" crossorigin src="/builder/assets/index.
|
|
12
|
-
<link rel="stylesheet" href="/builder/assets/index.
|
|
11
|
+
<script type="module" crossorigin src="/builder/assets/index.3eea26b2.js"></script>
|
|
12
|
+
<link rel="stylesheet" href="/builder/assets/index.7ec21ee2.css">
|
|
13
13
|
</head>
|
|
14
14
|
|
|
15
15
|
<body id="app">
|
|
@@ -33,7 +33,6 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
33
33
|
};
|
|
34
34
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
35
35
|
exports.test = exports.trigger = exports.getDefinitionList = exports.getTriggerList = exports.getActionList = exports.clearLogError = exports.logSearch = exports.destroy = exports.find = exports.fetch = exports.update = exports.handleStepEvents = exports.getDeletedSteps = exports.getNewSteps = exports.create = void 0;
|
|
36
|
-
const actions = __importStar(require("../../automations/actions"));
|
|
37
36
|
const triggers = __importStar(require("../../automations/triggers"));
|
|
38
37
|
const utils_1 = require("../../db/utils");
|
|
39
38
|
const utils_2 = require("../../automations/utils");
|
|
@@ -42,8 +41,15 @@ const constants_1 = require("../../constants");
|
|
|
42
41
|
const redis_1 = require("../../utilities/redis");
|
|
43
42
|
const backend_core_1 = require("@budibase/backend-core");
|
|
44
43
|
const pro_1 = require("@budibase/pro");
|
|
45
|
-
const
|
|
46
|
-
|
|
44
|
+
const actions_1 = require("../../automations/actions");
|
|
45
|
+
function getActionDefinitions() {
|
|
46
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
+
return (0, utils_2.removeDeprecated)(yield (0, actions_1.getActionDefinitions)());
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function getTriggerDefinitions() {
|
|
51
|
+
return (0, utils_2.removeDeprecated)(triggers.TRIGGER_DEFINITIONS);
|
|
52
|
+
}
|
|
47
53
|
/*************************
|
|
48
54
|
* *
|
|
49
55
|
* BUILDER FUNCTIONS *
|
|
@@ -234,21 +240,21 @@ function clearLogError(ctx) {
|
|
|
234
240
|
exports.clearLogError = clearLogError;
|
|
235
241
|
function getActionList(ctx) {
|
|
236
242
|
return __awaiter(this, void 0, void 0, function* () {
|
|
237
|
-
ctx.body =
|
|
243
|
+
ctx.body = yield getActionDefinitions();
|
|
238
244
|
});
|
|
239
245
|
}
|
|
240
246
|
exports.getActionList = getActionList;
|
|
241
247
|
function getTriggerList(ctx) {
|
|
242
248
|
return __awaiter(this, void 0, void 0, function* () {
|
|
243
|
-
ctx.body =
|
|
249
|
+
ctx.body = getTriggerDefinitions();
|
|
244
250
|
});
|
|
245
251
|
}
|
|
246
252
|
exports.getTriggerList = getTriggerList;
|
|
247
253
|
function getDefinitionList(ctx) {
|
|
248
254
|
return __awaiter(this, void 0, void 0, function* () {
|
|
249
255
|
ctx.body = {
|
|
250
|
-
trigger:
|
|
251
|
-
action:
|
|
256
|
+
trigger: getTriggerDefinitions(),
|
|
257
|
+
action: yield getActionDefinitions(),
|
|
252
258
|
};
|
|
253
259
|
});
|
|
254
260
|
}
|
|
@@ -12,30 +12,14 @@ 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.
|
|
15
|
+
exports.destroy = exports.fetch = exports.create = exports.upload = void 0;
|
|
16
16
|
const uploaders_1 = require("./uploaders");
|
|
17
17
|
const backend_core_1 = require("@budibase/backend-core");
|
|
18
18
|
const types_1 = require("@budibase/types");
|
|
19
19
|
const environment_1 = __importDefault(require("../../../environment"));
|
|
20
|
-
const
|
|
20
|
+
const websockets_1 = require("../../../websockets");
|
|
21
|
+
const sdk_1 = __importDefault(require("../../../sdk"));
|
|
21
22
|
const pro_1 = require("@budibase/pro");
|
|
22
|
-
function getPlugins(type) {
|
|
23
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
24
|
-
const db = backend_core_1.tenancy.getGlobalDB();
|
|
25
|
-
const response = yield db.allDocs(backend_core_1.db.getPluginParams(null, {
|
|
26
|
-
include_docs: true,
|
|
27
|
-
}));
|
|
28
|
-
let plugins = response.rows.map((row) => row.doc);
|
|
29
|
-
plugins = backend_core_1.objectStore.enrichPluginURLs(plugins);
|
|
30
|
-
if (type) {
|
|
31
|
-
return plugins.filter((plugin) => { var _a; return ((_a = plugin.schema) === null || _a === void 0 ? void 0 : _a.type) === type; });
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
return plugins;
|
|
35
|
-
}
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
exports.getPlugins = getPlugins;
|
|
39
23
|
function upload(ctx) {
|
|
40
24
|
return __awaiter(this, void 0, void 0, function* () {
|
|
41
25
|
const plugins = ctx.request.files.file.length > 1
|
|
@@ -45,7 +29,7 @@ function upload(ctx) {
|
|
|
45
29
|
let docs = [];
|
|
46
30
|
// can do single or multiple plugins
|
|
47
31
|
for (let plugin of plugins) {
|
|
48
|
-
const doc = yield
|
|
32
|
+
const doc = yield sdk_1.default.plugins.processUploaded(plugin, types_1.PluginSource.FILE);
|
|
49
33
|
docs.push(doc);
|
|
50
34
|
}
|
|
51
35
|
ctx.body = {
|
|
@@ -93,7 +77,7 @@ function create(ctx) {
|
|
|
93
77
|
throw new Error("Only component plugins are supported outside of self-host");
|
|
94
78
|
}
|
|
95
79
|
const doc = yield pro_1.sdk.plugins.storePlugin(metadata, directory, source);
|
|
96
|
-
|
|
80
|
+
websockets_1.clientAppSocket.emit("plugins-update", { name, hash: doc.hash });
|
|
97
81
|
ctx.body = {
|
|
98
82
|
message: "Plugin uploaded successfully",
|
|
99
83
|
plugins: [doc],
|
|
@@ -109,7 +93,7 @@ function create(ctx) {
|
|
|
109
93
|
exports.create = create;
|
|
110
94
|
function fetch(ctx) {
|
|
111
95
|
return __awaiter(this, void 0, void 0, function* () {
|
|
112
|
-
ctx.body = yield
|
|
96
|
+
ctx.body = yield sdk_1.default.plugins.fetch();
|
|
113
97
|
});
|
|
114
98
|
}
|
|
115
99
|
exports.fetch = fetch;
|
|
@@ -126,18 +110,3 @@ function destroy(ctx) {
|
|
|
126
110
|
});
|
|
127
111
|
}
|
|
128
112
|
exports.destroy = destroy;
|
|
129
|
-
function processUploadedPlugin(plugin, source) {
|
|
130
|
-
var _a;
|
|
131
|
-
return __awaiter(this, void 0, void 0, function* () {
|
|
132
|
-
const { metadata, directory } = yield (0, uploaders_1.fileUpload)(plugin);
|
|
133
|
-
backend_core_1.plugins.validate(metadata === null || metadata === void 0 ? void 0 : metadata.schema);
|
|
134
|
-
// Only allow components in cloud
|
|
135
|
-
if (!environment_1.default.SELF_HOSTED && ((_a = metadata === null || metadata === void 0 ? void 0 : metadata.schema) === null || _a === void 0 ? void 0 : _a.type) !== types_1.PluginType.COMPONENT) {
|
|
136
|
-
throw new Error("Only component plugins are supported outside of self-host");
|
|
137
|
-
}
|
|
138
|
-
const doc = yield pro_1.sdk.plugins.storePlugin(metadata, directory, source);
|
|
139
|
-
websocket_1.ClientAppSocket.emit("plugin-update", { name: doc.name, hash: doc.hash });
|
|
140
|
-
return doc;
|
|
141
|
-
});
|
|
142
|
-
}
|
|
143
|
-
exports.processUploadedPlugin = processUploadedPlugin;
|
|
@@ -237,7 +237,7 @@ function execute(ctx, opts = { rowsOnly: false, isAutomation: false }) {
|
|
|
237
237
|
},
|
|
238
238
|
};
|
|
239
239
|
const runFn = () => Runner.run(inputs);
|
|
240
|
-
const { rows, pagination, extra } = yield pro_1.quotas.addQuery(runFn, {
|
|
240
|
+
const { rows, pagination, extra, info } = yield pro_1.quotas.addQuery(runFn, {
|
|
241
241
|
datasourceId: datasource._id,
|
|
242
242
|
});
|
|
243
243
|
// remove the raw from execution incase transformer being used to hide data
|
|
@@ -248,7 +248,7 @@ function execute(ctx, opts = { rowsOnly: false, isAutomation: false }) {
|
|
|
248
248
|
ctx.body = rows;
|
|
249
249
|
}
|
|
250
250
|
else {
|
|
251
|
-
ctx.body = Object.assign({ data: rows, pagination }, extra);
|
|
251
|
+
ctx.body = Object.assign(Object.assign({ data: rows, pagination }, extra), info);
|
|
252
252
|
}
|
|
253
253
|
}
|
|
254
254
|
catch (err) {
|
|
@@ -97,19 +97,25 @@ function makeSureTableUpToDate(table, tableToSave) {
|
|
|
97
97
|
}
|
|
98
98
|
exports.makeSureTableUpToDate = makeSureTableUpToDate;
|
|
99
99
|
function importToRows(data, table, user = null) {
|
|
100
|
+
let originalTable = table;
|
|
100
101
|
let finalData = [];
|
|
101
102
|
for (let i = 0; i < data.length; i++) {
|
|
102
103
|
let row = data[i];
|
|
103
104
|
row._id = (0, utils_1.generateRowID)(table._id);
|
|
104
105
|
row.tableId = table._id;
|
|
106
|
+
// We use a reference to table here and update it after input processing,
|
|
107
|
+
// so that we can auto increment auto IDs in imported data properly
|
|
105
108
|
const processed = (0, rowProcessor_1.inputProcessing)(user, table, row, {
|
|
106
109
|
noAutoRelationships: true,
|
|
107
110
|
});
|
|
108
111
|
row = processed.row;
|
|
109
112
|
table = processed.table;
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
+
// However here we must reference the original table, as we want to mutate
|
|
114
|
+
// the real schema of the table passed in, not the clone used for
|
|
115
|
+
// incrementing auto IDs
|
|
116
|
+
for (const [fieldName, schema] of Object.entries(originalTable.schema)) {
|
|
117
|
+
if ((schema.type === constants_1.FieldTypes.OPTIONS ||
|
|
118
|
+
schema.type === constants_1.FieldTypes.ARRAY) &&
|
|
113
119
|
row[fieldName] &&
|
|
114
120
|
(!schema.constraints.inclusion ||
|
|
115
121
|
schema.constraints.inclusion.indexOf(row[fieldName]) === -1)) {
|
package/dist/api/routes/index.js
CHANGED
|
@@ -28,7 +28,6 @@ const query_1 = __importDefault(require("./query"));
|
|
|
28
28
|
const backup_1 = __importDefault(require("./backup"));
|
|
29
29
|
const metadata_1 = __importDefault(require("./metadata"));
|
|
30
30
|
const dev_1 = __importDefault(require("./dev"));
|
|
31
|
-
const cloud_1 = __importDefault(require("./cloud"));
|
|
32
31
|
const migrations_1 = __importDefault(require("./migrations"));
|
|
33
32
|
const plugin_1 = __importDefault(require("./plugin"));
|
|
34
33
|
const ops_1 = __importDefault(require("./ops"));
|
|
@@ -64,7 +63,6 @@ exports.mainRoutes = [
|
|
|
64
63
|
query_1.default,
|
|
65
64
|
metadata_1.default,
|
|
66
65
|
dev_1.default,
|
|
67
|
-
cloud_1.default,
|
|
68
66
|
row_1.default,
|
|
69
67
|
migrations_1.default,
|
|
70
68
|
plugin_1.default,
|
package/dist/app.js
CHANGED
|
@@ -49,8 +49,8 @@ const api = __importStar(require("./api"));
|
|
|
49
49
|
const automations = __importStar(require("./automations"));
|
|
50
50
|
const threads_1 = require("./threads");
|
|
51
51
|
const redis = __importStar(require("./utilities/redis"));
|
|
52
|
+
const websockets_1 = require("./websockets");
|
|
52
53
|
const backend_core_1 = require("@budibase/backend-core");
|
|
53
|
-
const websocket_1 = require("./websocket");
|
|
54
54
|
const startup_1 = require("./startup");
|
|
55
55
|
const Sentry = require("@sentry/node");
|
|
56
56
|
const destroyable = require("server-destroy");
|
|
@@ -87,7 +87,7 @@ if (environment_1.default.isProd()) {
|
|
|
87
87
|
}
|
|
88
88
|
const server = http_1.default.createServer(app.callback());
|
|
89
89
|
destroyable(server);
|
|
90
|
-
(0,
|
|
90
|
+
(0, websockets_1.initialise)(app, server);
|
|
91
91
|
let shuttingDown = false, errCode = 0;
|
|
92
92
|
server.on("close", () => __awaiter(void 0, void 0, void 0, function* () {
|
|
93
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.
|
|
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.
|
|
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.
|
|
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(
|
|
121
|
+
function getAction(stepId) {
|
|
105
122
|
return __awaiter(this, void 0, void 0, function* () {
|
|
106
|
-
if (ACTION_IMPLS[
|
|
107
|
-
return ACTION_IMPLS[
|
|
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.
|
|
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, "
|
|
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:
|
|
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:
|
|
58
|
-
customType:
|
|
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:
|
|
67
|
+
type: types_1.AutomationIOType.STRING,
|
|
68
68
|
description: "Standard output of your bash command or script",
|
|
69
69
|
},
|
|
70
70
|
success: {
|
|
71
|
-
type:
|
|
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:
|
|
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:
|
|
30
|
+
type: types_1.AutomationIOType.OBJECT,
|
|
31
31
|
properties: {
|
|
32
32
|
tableId: {
|
|
33
|
-
type:
|
|
34
|
-
customType:
|
|
33
|
+
type: types_1.AutomationIOType.STRING,
|
|
34
|
+
customType: types_1.AutomationCustomIOType.TABLE,
|
|
35
35
|
},
|
|
36
36
|
},
|
|
37
|
-
customType:
|
|
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:
|
|
48
|
-
customType:
|
|
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:
|
|
52
|
+
type: types_1.AutomationIOType.OBJECT,
|
|
53
53
|
description: "The response from the table",
|
|
54
54
|
},
|
|
55
55
|
success: {
|
|
56
|
-
type:
|
|
56
|
+
type: types_1.AutomationIOType.BOOLEAN,
|
|
57
57
|
description: "Whether the row creation was successful",
|
|
58
58
|
},
|
|
59
59
|
id: {
|
|
60
|
-
type:
|
|
60
|
+
type: types_1.AutomationIOType.STRING,
|
|
61
61
|
description: "The identifier of the new row",
|
|
62
62
|
},
|
|
63
63
|
revision: {
|
|
64
|
-
type:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
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:
|
|
31
|
-
customType:
|
|
30
|
+
type: types_1.AutomationIOType.STRING,
|
|
31
|
+
customType: types_1.AutomationCustomIOType.TABLE,
|
|
32
32
|
title: "Table",
|
|
33
33
|
},
|
|
34
34
|
id: {
|
|
35
|
-
type:
|
|
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:
|
|
45
|
-
customType:
|
|
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:
|
|
49
|
+
type: types_1.AutomationIOType.OBJECT,
|
|
50
50
|
description: "The response from the table",
|
|
51
51
|
},
|
|
52
52
|
success: {
|
|
53
|
-
type:
|
|
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:
|
|
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:
|
|
34
|
+
type: types_1.AutomationIOType.STRING,
|
|
35
35
|
title: "Discord Webhook URL",
|
|
36
36
|
},
|
|
37
37
|
username: {
|
|
38
|
-
type:
|
|
38
|
+
type: types_1.AutomationIOType.STRING,
|
|
39
39
|
title: "Bot Name",
|
|
40
40
|
},
|
|
41
41
|
avatar_url: {
|
|
42
|
-
type:
|
|
42
|
+
type: types_1.AutomationIOType.STRING,
|
|
43
43
|
title: "Bot Avatar URL",
|
|
44
44
|
},
|
|
45
45
|
content: {
|
|
46
|
-
type:
|
|
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:
|
|
55
|
+
type: types_1.AutomationIOType.NUMBER,
|
|
56
56
|
description: "The HTTP status code of the request",
|
|
57
57
|
},
|
|
58
58
|
response: {
|
|
59
|
-
type:
|
|
59
|
+
type: types_1.AutomationIOType.STRING,
|
|
60
60
|
description: "The response from the Discord Webhook",
|
|
61
61
|
},
|
|
62
62
|
success: {
|
|
63
|
-
type:
|
|
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:
|
|
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:
|
|
64
|
+
type: types_1.AutomationIOType.OBJECT,
|
|
65
65
|
properties: {
|
|
66
66
|
queryId: {
|
|
67
|
-
type:
|
|
68
|
-
customType:
|
|
67
|
+
type: types_1.AutomationIOType.STRING,
|
|
68
|
+
customType: types_1.AutomationCustomIOType.QUERY,
|
|
69
69
|
},
|
|
70
70
|
},
|
|
71
|
-
customType:
|
|
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:
|
|
81
|
+
type: types_1.AutomationIOType.OBJECT,
|
|
82
82
|
description: "The response from the datasource execution",
|
|
83
83
|
},
|
|
84
84
|
info: {
|
|
85
|
-
type:
|
|
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:
|
|
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:
|
|
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:
|
|
54
|
-
customType:
|
|
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:
|
|
63
|
+
type: types_1.AutomationIOType.STRING,
|
|
64
64
|
description: "The result of the return statement",
|
|
65
65
|
},
|
|
66
66
|
success: {
|
|
67
|
-
type:
|
|
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, }) {
|