2021-05-11 16:08:59 +02:00
|
|
|
const sendSmtpEmail = require("./steps/sendSmtpEmail")
|
2020-10-09 20:10:28 +02:00
|
|
|
const createRow = require("./steps/createRow")
|
|
|
|
const updateRow = require("./steps/updateRow")
|
|
|
|
const deleteRow = require("./steps/deleteRow")
|
2021-03-26 15:56:34 +01:00
|
|
|
const executeScript = require("./steps/executeScript")
|
|
|
|
const executeQuery = require("./steps/executeQuery")
|
2020-10-27 13:33:25 +01:00
|
|
|
const outgoingWebhook = require("./steps/outgoingWebhook")
|
2021-06-18 19:07:51 +02:00
|
|
|
const serverLog = require("./steps/serverLog")
|
2021-09-03 18:36:00 +02:00
|
|
|
const discord = require("./steps/discord")
|
2021-09-07 14:58:53 +02:00
|
|
|
const slack = require("./steps/slack")
|
2021-09-03 18:36:00 +02:00
|
|
|
const zapier = require("./steps/zapier")
|
|
|
|
const integromat = require("./steps/integromat")
|
2021-09-14 12:28:39 +02:00
|
|
|
let filter = require("./steps/filter")
|
|
|
|
let delay = require("./steps/delay")
|
2021-09-15 20:02:44 +02:00
|
|
|
let queryRow = require("./steps/queryRows")
|
2022-03-25 10:26:55 +01:00
|
|
|
let loop = require("./steps/loop")
|
2021-10-13 18:03:19 +02:00
|
|
|
const env = require("../environment")
|
2020-09-10 16:00:21 +02:00
|
|
|
|
2021-09-06 18:53:02 +02:00
|
|
|
const ACTION_IMPLS = {
|
2021-05-11 16:08:59 +02:00
|
|
|
SEND_EMAIL_SMTP: sendSmtpEmail.run,
|
2020-10-09 20:10:28 +02:00
|
|
|
CREATE_ROW: createRow.run,
|
|
|
|
UPDATE_ROW: updateRow.run,
|
|
|
|
DELETE_ROW: deleteRow.run,
|
2020-10-27 13:33:25 +01:00
|
|
|
OUTGOING_WEBHOOK: outgoingWebhook.run,
|
2021-03-26 15:56:34 +01:00
|
|
|
EXECUTE_SCRIPT: executeScript.run,
|
|
|
|
EXECUTE_QUERY: executeQuery.run,
|
2021-06-18 19:07:51 +02:00
|
|
|
SERVER_LOG: serverLog.run,
|
2021-09-14 12:28:39 +02:00
|
|
|
DELAY: delay.run,
|
|
|
|
FILTER: filter.run,
|
2021-09-15 20:02:44 +02:00
|
|
|
QUERY_ROWS: queryRow.run,
|
2022-03-25 10:26:55 +01:00
|
|
|
LOOP: loop.run,
|
2021-09-03 18:36:00 +02:00
|
|
|
// these used to be lowercase step IDs, maintain for backwards compat
|
|
|
|
discord: discord.run,
|
2021-09-07 14:58:53 +02:00
|
|
|
slack: slack.run,
|
2021-09-03 18:36:00 +02:00
|
|
|
zapier: zapier.run,
|
|
|
|
integromat: integromat.run,
|
2020-09-16 15:00:04 +02:00
|
|
|
}
|
2021-09-06 18:53:02 +02:00
|
|
|
const ACTION_DEFINITIONS = {
|
2021-05-11 16:08:59 +02:00
|
|
|
SEND_EMAIL_SMTP: sendSmtpEmail.definition,
|
2020-10-09 20:10:28 +02:00
|
|
|
CREATE_ROW: createRow.definition,
|
|
|
|
UPDATE_ROW: updateRow.definition,
|
|
|
|
DELETE_ROW: deleteRow.definition,
|
2020-10-27 13:33:25 +01:00
|
|
|
OUTGOING_WEBHOOK: outgoingWebhook.definition,
|
2021-03-26 15:56:34 +01:00
|
|
|
EXECUTE_SCRIPT: executeScript.definition,
|
|
|
|
EXECUTE_QUERY: executeQuery.definition,
|
2021-06-18 19:07:51 +02:00
|
|
|
SERVER_LOG: serverLog.definition,
|
2021-09-14 12:28:39 +02:00
|
|
|
DELAY: delay.definition,
|
|
|
|
FILTER: filter.definition,
|
2021-09-15 20:02:44 +02:00
|
|
|
QUERY_ROWS: queryRow.definition,
|
2022-03-25 10:26:55 +01:00
|
|
|
LOOP: loop.definition,
|
2021-09-03 18:36:00 +02:00
|
|
|
// these used to be lowercase step IDs, maintain for backwards compat
|
|
|
|
discord: discord.definition,
|
2021-09-07 14:58:53 +02:00
|
|
|
slack: slack.definition,
|
2021-09-03 18:36:00 +02:00
|
|
|
zapier: zapier.definition,
|
|
|
|
integromat: integromat.definition,
|
2020-09-22 15:07:22 +02:00
|
|
|
}
|
|
|
|
|
2021-10-13 18:03:19 +02:00
|
|
|
// don't add the bash script/definitions unless in self host
|
|
|
|
// the fact this isn't included in any definitions means it cannot be
|
|
|
|
// ran at all
|
|
|
|
if (env.SELF_HOSTED) {
|
|
|
|
const bash = require("./steps/bash")
|
|
|
|
ACTION_IMPLS["EXECUTE_BASH"] = bash.run
|
|
|
|
ACTION_DEFINITIONS["EXECUTE_BASH"] = bash.definition
|
|
|
|
}
|
|
|
|
|
2021-03-15 15:11:13 +01:00
|
|
|
/* istanbul ignore next */
|
2021-09-06 18:53:02 +02:00
|
|
|
exports.getAction = async function (actionName) {
|
|
|
|
if (ACTION_IMPLS[actionName] != null) {
|
|
|
|
return ACTION_IMPLS[actionName]
|
2020-09-10 16:00:21 +02:00
|
|
|
}
|
|
|
|
}
|
2020-09-16 15:00:04 +02:00
|
|
|
|
2021-09-06 18:53:02 +02:00
|
|
|
exports.ACTION_DEFINITIONS = ACTION_DEFINITIONS
|