n8n-nodes-base 1.92.0 → 1.94.0
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/dist/credentials/AirtopApi.credentials.js +2 -1
- package/dist/credentials/AirtopApi.credentials.js.map +1 -1
- package/dist/credentials/JinaAiApi.credentials.js +1 -1
- package/dist/credentials/JinaAiApi.credentials.js.map +1 -1
- package/dist/credentials/MicrosoftSharePointOAuth2Api.credentials.js +0 -9
- package/dist/credentials/MicrosoftSharePointOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js +13 -0
- package/dist/credentials/MicrosoftTeamsOAuth2Api.credentials.js.map +1 -1
- package/dist/credentials/Snowflake.credentials.js +46 -2
- package/dist/credentials/Snowflake.credentials.js.map +1 -1
- package/dist/known/credentials.json +10 -1
- package/dist/known/nodes.json +20 -4
- package/dist/methods/defined.json +6 -0
- package/dist/methods/referenced.json +3 -0
- package/dist/nodes/Airtop/Airtop.node.js +14 -8
- package/dist/nodes/Airtop/Airtop.node.js.map +1 -1
- package/dist/nodes/Airtop/GenericFunctions.js +87 -15
- package/dist/nodes/Airtop/GenericFunctions.js.map +1 -1
- package/dist/nodes/Airtop/actions/common/fields.js +9 -0
- package/dist/nodes/Airtop/actions/common/fields.js.map +1 -1
- package/dist/nodes/Airtop/actions/common/output.utils.js +79 -0
- package/dist/nodes/Airtop/actions/common/output.utils.js.map +1 -0
- package/dist/nodes/Airtop/actions/common/session.utils.js +2 -2
- package/dist/nodes/Airtop/actions/common/session.utils.js.map +1 -1
- package/dist/nodes/Airtop/actions/extraction/getPaginated.operation.js +13 -4
- package/dist/nodes/Airtop/actions/extraction/getPaginated.operation.js.map +1 -1
- package/dist/nodes/Airtop/actions/extraction/query.operation.js +21 -3
- package/dist/nodes/Airtop/actions/extraction/query.operation.js.map +1 -1
- package/dist/nodes/Airtop/actions/extraction/scrape.operation.js +2 -1
- package/dist/nodes/Airtop/actions/extraction/scrape.operation.js.map +1 -1
- package/dist/nodes/Airtop/actions/file/File.resource.js +104 -0
- package/dist/nodes/Airtop/actions/file/File.resource.js.map +1 -0
- package/dist/nodes/Airtop/actions/file/delete.operation.js +60 -0
- package/dist/nodes/Airtop/actions/file/delete.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/file/get.operation.js +91 -0
- package/dist/nodes/Airtop/actions/file/get.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/file/getMany.operation.js +100 -0
- package/dist/nodes/Airtop/actions/file/getMany.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/file/helpers.js +199 -0
- package/dist/nodes/Airtop/actions/file/helpers.js.map +1 -0
- package/dist/nodes/Airtop/actions/file/load.operation.js +85 -0
- package/dist/nodes/Airtop/actions/file/load.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/file/upload.operation.js +186 -0
- package/dist/nodes/Airtop/actions/file/upload.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/interaction/Interaction.resource.js +22 -1
- package/dist/nodes/Airtop/actions/interaction/Interaction.resource.js.map +1 -1
- package/dist/nodes/Airtop/actions/interaction/fill.operation.js +89 -0
- package/dist/nodes/Airtop/actions/interaction/fill.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/interaction/scroll.operation.js +219 -0
- package/dist/nodes/Airtop/actions/interaction/scroll.operation.js.map +1 -0
- package/dist/nodes/Airtop/actions/node.type.js.map +1 -1
- package/dist/nodes/Airtop/actions/router.js +13 -4
- package/dist/nodes/Airtop/actions/router.js.map +1 -1
- package/dist/nodes/Airtop/actions/session/create.operation.js +85 -32
- package/dist/nodes/Airtop/actions/session/create.operation.js.map +1 -1
- package/dist/nodes/Airtop/actions/window/Window.resource.js +2 -1
- package/dist/nodes/Airtop/actions/window/Window.resource.js.map +1 -1
- package/dist/nodes/Airtop/actions/window/create.operation.js +1 -1
- package/dist/nodes/Airtop/actions/window/create.operation.js.map +1 -1
- package/dist/nodes/Airtop/actions/window/takeScreenshot.operation.js +26 -3
- package/dist/nodes/Airtop/actions/window/takeScreenshot.operation.js.map +1 -1
- package/dist/nodes/Airtop/constants.js +38 -5
- package/dist/nodes/Airtop/constants.js.map +1 -1
- package/dist/nodes/Airtop/countries.js +1026 -0
- package/dist/nodes/Airtop/countries.js.map +1 -0
- package/dist/nodes/Airtop/transport/index.js +6 -3
- package/dist/nodes/Airtop/transport/index.js.map +1 -1
- package/dist/nodes/Airtop/transport/types.js.map +1 -1
- package/dist/nodes/Aws/IAM/AwsIam.node.js +95 -0
- package/dist/nodes/Aws/IAM/AwsIam.node.js.map +1 -0
- package/dist/nodes/Aws/IAM/AwsIam.node.json +18 -0
- package/dist/nodes/Aws/IAM/AwsIam.svg +18 -0
- package/dist/nodes/Aws/IAM/descriptions/common.js +188 -0
- package/dist/nodes/Aws/IAM/descriptions/common.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/Group.resource.js +175 -0
- package/dist/nodes/Aws/IAM/descriptions/group/Group.resource.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/create.operation.js +66 -0
- package/dist/nodes/Aws/IAM/descriptions/group/create.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/delete.operation.js +43 -0
- package/dist/nodes/Aws/IAM/descriptions/group/delete.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/get.operation.js +50 -0
- package/dist/nodes/Aws/IAM/descriptions/group/get.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/getAll.operation.js +47 -0
- package/dist/nodes/Aws/IAM/descriptions/group/getAll.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/group/update.operation.js +70 -0
- package/dist/nodes/Aws/IAM/descriptions/group/update.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/index.js +42 -0
- package/dist/nodes/Aws/IAM/descriptions/index.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/User.resource.js +231 -0
- package/dist/nodes/Aws/IAM/descriptions/user/User.resource.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/addToGroup.operation.js +47 -0
- package/dist/nodes/Aws/IAM/descriptions/user/addToGroup.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/create.operation.js +118 -0
- package/dist/nodes/Aws/IAM/descriptions/user/create.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/delete.operation.js +43 -0
- package/dist/nodes/Aws/IAM/descriptions/user/delete.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/get.operation.js +43 -0
- package/dist/nodes/Aws/IAM/descriptions/user/get.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/getAll.operation.js +66 -0
- package/dist/nodes/Aws/IAM/descriptions/user/getAll.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/removeFromGroup.operation.js +74 -0
- package/dist/nodes/Aws/IAM/descriptions/user/removeFromGroup.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/descriptions/user/update.operation.js +68 -0
- package/dist/nodes/Aws/IAM/descriptions/user/update.operation.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/constants.js +47 -0
- package/dist/nodes/Aws/IAM/helpers/constants.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/errorHandler.js +90 -0
- package/dist/nodes/Aws/IAM/helpers/errorHandler.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/types.js +17 -0
- package/dist/nodes/Aws/IAM/helpers/types.js.map +1 -0
- package/dist/nodes/Aws/IAM/helpers/utils.js +279 -0
- package/dist/nodes/Aws/IAM/helpers/utils.js.map +1 -0
- package/dist/nodes/Aws/IAM/methods/index.js +39 -0
- package/dist/nodes/Aws/IAM/methods/index.js.map +1 -0
- package/dist/nodes/Aws/IAM/methods/listSearch.js +132 -0
- package/dist/nodes/Aws/IAM/methods/listSearch.js.map +1 -0
- package/dist/nodes/Aws/IAM/transport/index.js +64 -0
- package/dist/nodes/Aws/IAM/transport/index.js.map +1 -0
- package/dist/nodes/Cron/Cron.node.js +1 -1
- package/dist/nodes/Cron/Cron.node.js.map +1 -1
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js +2 -2
- package/dist/nodes/EmailReadImap/v1/EmailReadImapV1.node.js.map +1 -1
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js +2 -2
- package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js.map +1 -1
- package/dist/nodes/Evaluation/Evaluation/Description.node.js +146 -0
- package/dist/nodes/Evaluation/Evaluation/Description.node.js.map +1 -0
- package/dist/nodes/Evaluation/Evaluation/Evaluation.node.ee.js +117 -0
- package/dist/nodes/Evaluation/Evaluation/Evaluation.node.ee.js.map +1 -0
- package/dist/nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.js +187 -0
- package/dist/nodes/Evaluation/EvaluationTrigger/EvaluationTrigger.node.ee.js.map +1 -0
- package/dist/nodes/Evaluation/methods/index.js +42 -0
- package/dist/nodes/Evaluation/methods/index.js.map +1 -0
- package/dist/nodes/Evaluation/methods/loadOptions.js +40 -0
- package/dist/nodes/Evaluation/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Evaluation/utils/evaluationTriggerUtils.js +119 -0
- package/dist/nodes/Evaluation/utils/evaluationTriggerUtils.js.map +1 -0
- package/dist/nodes/Evaluation/utils/evaluationUtils.js +171 -0
- package/dist/nodes/Evaluation/utils/evaluationUtils.js.map +1 -0
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.js +4 -3
- package/dist/nodes/ExecuteWorkflow/ExecuteWorkflowTrigger/ExecuteWorkflowTrigger.node.js.map +1 -1
- package/dist/nodes/Form/common.descriptions.js +2 -2
- package/dist/nodes/Form/common.descriptions.js.map +1 -1
- package/dist/nodes/Google/Drive/v2/actions/file/upload.operation.js +4 -1
- package/dist/nodes/Google/Drive/v2/actions/file/upload.operation.js.map +1 -1
- package/dist/nodes/Google/Firebase/CloudFirestore/GenericFunctions.js +1 -2
- package/dist/nodes/Google/Firebase/CloudFirestore/GenericFunctions.js.map +1 -1
- package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js +113 -107
- package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/sheet/read.operation.js +52 -106
- package/dist/nodes/Google/Sheet/v2/actions/sheet/read.operation.js.map +1 -1
- package/dist/nodes/Google/Sheet/v2/actions/utils/readOperation.js +97 -0
- package/dist/nodes/Google/Sheet/v2/actions/utils/readOperation.js.map +1 -0
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js +20 -17
- package/dist/nodes/Google/Sheet/v2/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Google/YouTube/YouTube.node.js +4 -2
- package/dist/nodes/Google/YouTube/YouTube.node.js.map +1 -1
- package/dist/nodes/HttpRequest/GenericFunctions.js +1 -1
- package/dist/nodes/HttpRequest/GenericFunctions.js.map +1 -1
- package/dist/nodes/Interval/Interval.node.js +1 -1
- package/dist/nodes/Interval/Interval.node.js.map +1 -1
- package/dist/nodes/Jira/Jira.node.js +34 -15
- package/dist/nodes/Jira/Jira.node.js.map +1 -1
- package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js +2 -2
- package/dist/nodes/LocalFileTrigger/LocalFileTrigger.node.js.map +1 -1
- package/dist/nodes/MQTT/MqttTrigger.node.js +2 -2
- package/dist/nodes/MQTT/MqttTrigger.node.js.map +1 -1
- package/dist/nodes/ManualTrigger/ManualTrigger.node.js +1 -1
- package/dist/nodes/ManualTrigger/ManualTrigger.node.js.map +1 -1
- package/dist/nodes/Merge/Merge.node.js +3 -2
- package/dist/nodes/Merge/Merge.node.js.map +1 -1
- package/dist/nodes/Merge/v3/actions/mode/combineBySql.js +42 -4
- package/dist/nodes/Merge/v3/actions/mode/combineBySql.js.map +1 -1
- package/dist/nodes/Merge/v3/actions/versionDescription.js +1 -1
- package/dist/nodes/Merge/v3/actions/versionDescription.js.map +1 -1
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js +93 -0
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharePoint.node.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/MicrosoftSharepoint.node.json +18 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/common.descriptions.js +190 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/common.descriptions.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/File.resource.js +108 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/File.resource.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/download.operation.js +62 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/download.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js +129 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/update.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js +77 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/file/upload.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/index.js +45 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/index.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js +175 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/Item.resource.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/create.operation.js +100 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/create.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/delete.operation.js +62 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/delete.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/get.operation.js +83 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/getAll.operation.js +203 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/update.operation.js +100 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/update.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/upsert.operation.js +100 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/item/upsert.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js +99 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/List.resource.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/get.operation.js +65 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/get.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/getAll.operation.js +105 -0
- package/dist/nodes/Microsoft/SharePoint/descriptions/list/getAll.operation.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/interfaces.js +17 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/utils.js +252 -0
- package/dist/nodes/Microsoft/SharePoint/helpers/utils.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/methods/index.js +42 -0
- package/dist/nodes/Microsoft/SharePoint/methods/index.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/methods/listSearch.js +222 -0
- package/dist/nodes/Microsoft/SharePoint/methods/listSearch.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/methods/resourceMapping.js +104 -0
- package/dist/nodes/Microsoft/SharePoint/methods/resourceMapping.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/test/credentials.js +54 -0
- package/dist/nodes/Microsoft/SharePoint/test/credentials.js.map +1 -0
- package/dist/nodes/Microsoft/SharePoint/transport/index.js +46 -0
- package/dist/nodes/Microsoft/SharePoint/transport/index.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/MicrosoftTeamsTrigger.node.js +387 -0
- package/dist/nodes/Microsoft/Teams/MicrosoftTeamsTrigger.node.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/MicrosoftTeamsTrigger.node.json +18 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/types.js +17 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/types.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils-trigger.js +147 -0
- package/dist/nodes/Microsoft/Teams/v2/helpers/utils-trigger.js.map +1 -0
- package/dist/nodes/Microsoft/Teams/v2/transport/index.js.map +1 -1
- package/dist/nodes/MongoDb/GenericFunctions.js +9 -2
- package/dist/nodes/MongoDb/GenericFunctions.js.map +1 -1
- package/dist/nodes/MongoDb/MongoDb.node.js +25 -5
- package/dist/nodes/MongoDb/MongoDb.node.js.map +1 -1
- package/dist/nodes/PostBin/BinDescription.js +1 -1
- package/dist/nodes/PostBin/BinDescription.js.map +1 -1
- package/dist/nodes/PostBin/GenericFunctions.js +5 -5
- package/dist/nodes/PostBin/GenericFunctions.js.map +1 -1
- package/dist/nodes/PostBin/PostBin.node.js +1 -1
- package/dist/nodes/PostBin/PostBin.node.js.map +1 -1
- package/dist/nodes/PostBin/RequestDescription.js +2 -2
- package/dist/nodes/PostBin/RequestDescription.js.map +1 -1
- package/dist/nodes/Postgres/PostgresTrigger.node.js +2 -2
- package/dist/nodes/Postgres/PostgresTrigger.node.js.map +1 -1
- package/dist/nodes/RabbitMQ/RabbitMQTrigger.node.js +2 -2
- package/dist/nodes/RabbitMQ/RabbitMQTrigger.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js +8 -3
- package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js.map +1 -1
- package/dist/nodes/RespondToWebhook/utils.js +43 -0
- package/dist/nodes/RespondToWebhook/utils.js.map +1 -0
- package/dist/nodes/Schedule/ScheduleTrigger.node.js +1 -1
- package/dist/nodes/Schedule/ScheduleTrigger.node.js.map +1 -1
- package/dist/nodes/Snowflake/GenericFunctions.js +34 -2
- package/dist/nodes/Snowflake/GenericFunctions.js.map +1 -1
- package/dist/nodes/Snowflake/Snowflake.node.js +5 -7
- package/dist/nodes/Snowflake/Snowflake.node.js.map +1 -1
- package/dist/nodes/SseTrigger/SseTrigger.node.js +2 -2
- package/dist/nodes/SseTrigger/SseTrigger.node.js.map +1 -1
- package/dist/nodes/Telegram/Telegram.node.js +5 -1
- package/dist/nodes/Telegram/Telegram.node.js.map +1 -1
- package/dist/nodes/Transform/Summarize/utils.js +2 -1
- package/dist/nodes/Transform/Summarize/utils.js.map +1 -1
- package/dist/test/setup.js +1 -0
- package/dist/test/setup.js.map +1 -1
- package/dist/types/credentials.json +7 -7
- package/dist/types/nodes.json +27 -23
- package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js +12 -2
- package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js.map +1 -1
- package/package.json +15 -12
- package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.js +0 -119
- package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.js.map +0 -1
- package/dist/nodes/EvaluationMetrics/EvaluationMetrics.node.json +0 -14
- /package/dist/{credentials/icons/SharePoint.svg → nodes/Microsoft/SharePoint/microsoftSharePoint.svg} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/RabbitMQ/RabbitMQTrigger.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport type { Message } from 'amqplib';\nimport type {\n\tIDeferredPromise,\n\tIExecuteResponsePromiseData,\n\tINodeProperties,\n\tINodeType,\n\tINodeTypeDescription,\n\tIRun,\n\tITriggerFunctions,\n\tITriggerResponse,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport { rabbitDefaultOptions } from './DefaultOptions';\nimport { MessageTracker, rabbitmqConnectQueue, parseMessage } from './GenericFunctions';\nimport type { TriggerOptions } from './types';\n\nexport class RabbitMQTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'RabbitMQ Trigger',\n\t\tname: 'rabbitmqTrigger',\n\t\ticon: 'file:rabbitmq.svg',\n\t\tgroup: ['trigger'],\n\t\tversion: 1,\n\t\tdescription: 'Listens to RabbitMQ messages',\n\t\teventTriggerDescription: '',\n\t\tdefaults: {\n\t\t\tname: 'RabbitMQ Trigger',\n\t\t},\n\t\ttriggerPanel: {\n\t\t\theader: '',\n\t\t\texecutionsHelp: {\n\t\t\t\tinactive:\n\t\t\t\t\t\"<b>While building your workflow</b>, click the 'test step' button, then trigger a Rabbit MQ event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time a change is detected, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t\t\tactive:\n\t\t\t\t\t\"<b>While building your workflow</b>, click the 'test step' button, then trigger a Rabbit MQ event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time a change is detected, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t\t},\n\t\t\tactivationHint:\n\t\t\t\t\"Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).\",\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'rabbitmq',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Queue / Topic',\n\t\t\t\tname: 'queue',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'queue-name',\n\t\t\t\tdescription: 'The name of the queue to read from',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: {},\n\t\t\t\tplaceholder: 'Add option',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Content Is Binary',\n\t\t\t\t\t\tname: 'contentIsBinary',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription: 'Whether to save the content as binary',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Delete From Queue When',\n\t\t\t\t\t\tname: 'acknowledge',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Execution Finishes',\n\t\t\t\t\t\t\t\tvalue: 'executionFinishes',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'After the workflow execution finished. No matter if the execution was successful or not.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Execution Finishes Successfully',\n\t\t\t\t\t\t\t\tvalue: 'executionFinishesSuccessfully',\n\t\t\t\t\t\t\t\tdescription: 'After the workflow execution finished successfully',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Immediately',\n\t\t\t\t\t\t\t\tvalue: 'immediately',\n\t\t\t\t\t\t\t\tdescription: 'As soon as the message got received',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Specified Later in Workflow',\n\t\t\t\t\t\t\t\tvalue: 'laterMessageNode',\n\t\t\t\t\t\t\t\tdescription: 'Using a RabbitMQ node to remove the item from the queue',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdefault: 'immediately',\n\t\t\t\t\t\tdescription: 'When to acknowledge the message',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'JSON Parse Body',\n\t\t\t\t\t\tname: 'jsonParseBody',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t\tcontentIsBinary: [true],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription: 'Whether to parse the body to an object',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Only Content',\n\t\t\t\t\t\tname: 'onlyContent',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t\tcontentIsBinary: [true],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription: 'Whether to return only the content property',\n\t\t\t\t\t},\n\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Parallel Message Processing Limit',\n\t\t\t\t\t\tname: 'parallelMessages',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: -1,\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t\tacknowledge: ['immediately'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdescription: 'Max number of executions at a time. Use -1 for no limit.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Binding',\n\t\t\t\t\t\tname: 'binding',\n\t\t\t\t\t\tplaceholder: 'Add Binding',\n\t\t\t\t\t\tdescription: 'Add binding to queu',\n\t\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: {},\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'bindings',\n\t\t\t\t\t\t\t\tdisplayName: 'Binding',\n\t\t\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Exchange',\n\t\t\t\t\t\t\t\t\t\tname: 'exchange',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tplaceholder: 'exchange',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'RoutingKey',\n\t\t\t\t\t\t\t\t\t\tname: 'routingKey',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tplaceholder: 'routing-key',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t...rabbitDefaultOptions,\n\t\t\t\t].sort((a, b) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a as INodeProperties).displayName.toLowerCase() <\n\t\t\t\t\t\t(b as INodeProperties).displayName.toLowerCase()\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a as INodeProperties).displayName.toLowerCase() >\n\t\t\t\t\t\t(b as INodeProperties).displayName.toLowerCase()\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}) as INodeProperties[],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t\"To delete an item from the queue, insert a RabbitMQ node later in the workflow and use the 'Delete from queue' operation\",\n\t\t\t\tname: 'laterMessageNode',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/options.acknowledge': ['laterMessageNode'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst queue = this.getNodeParameter('queue') as string;\n\t\tconst options = this.getNodeParameter('options', {}) as TriggerOptions;\n\t\tconst channel = await rabbitmqConnectQueue.call(this, queue, options);\n\n\t\tif (this.getMode() === 'manual') {\n\t\t\tconst manualTriggerFunction = async () => {\n\t\t\t\t// Do only catch a single message when executing manually, else messages will leak\n\t\t\t\tawait channel.prefetch(1);\n\n\t\t\t\tconst processMessage = async (message: Message | null) => {\n\t\t\t\t\tif (message !== null) {\n\t\t\t\t\t\tconst item = await parseMessage(message, options, this.helpers);\n\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t\tthis.emit([[item]]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.emitError(new Error('Connection got closed unexpectedly'));\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tconst existingMessage = await channel.get(queue);\n\t\t\t\tif (existingMessage) await processMessage(existingMessage);\n\t\t\t\telse await channel.consume(queue, processMessage);\n\t\t\t};\n\n\t\t\tconst closeFunction = async () => {\n\t\t\t\tawait channel.close();\n\t\t\t\tawait channel.connection.close();\n\t\t\t\treturn;\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcloseFunction,\n\t\t\t\tmanualTriggerFunction,\n\t\t\t};\n\t\t}\n\n\t\tconst parallelMessages = options.parallelMessages ?? -1;\n\t\tif (isNaN(parallelMessages) || parallelMessages === 0 || parallelMessages < -1) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Parallel message processing limit must be a number greater than zero (or -1 for no limit)',\n\t\t\t);\n\t\t}\n\n\t\tlet acknowledgeMode = options.acknowledge ?? 'immediately';\n\n\t\tif (parallelMessages !== -1 && acknowledgeMode === 'immediately') {\n\t\t\t// If parallel message limit is set, then the default mode is \"executionFinishes\"\n\t\t\t// unless acknowledgeMode got set specifically. Be aware that the mode \"immediately\"\n\t\t\t// can not be supported in this case.\n\t\t\tacknowledgeMode = 'executionFinishes';\n\t\t}\n\n\t\tconst messageTracker = new MessageTracker();\n\t\tlet closeGotCalled = false;\n\n\t\tif (parallelMessages !== -1) {\n\t\t\tawait channel.prefetch(parallelMessages);\n\t\t}\n\n\t\tchannel.on('close', () => {\n\t\t\tif (!closeGotCalled) {\n\t\t\t\tthis.emitError(new Error('Connection got closed unexpectedly'));\n\t\t\t}\n\t\t});\n\n\t\tconst consumerInfo = await channel.consume(queue, async (message) => {\n\t\t\tif (message !== null) {\n\t\t\t\ttry {\n\t\t\t\t\tif (acknowledgeMode !== 'immediately') {\n\t\t\t\t\t\tmessageTracker.received(message);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst item = await parseMessage(message, options, this.helpers);\n\n\t\t\t\t\tlet responsePromise: IDeferredPromise<IRun> | undefined = undefined;\n\t\t\t\t\tlet responsePromiseHook: IDeferredPromise<IExecuteResponsePromiseData> | undefined =\n\t\t\t\t\t\tundefined;\n\t\t\t\t\tif (acknowledgeMode !== 'immediately' && acknowledgeMode !== 'laterMessageNode') {\n\t\t\t\t\t\tresponsePromise = this.helpers.createDeferredPromise();\n\t\t\t\t\t} else if (acknowledgeMode === 'laterMessageNode') {\n\t\t\t\t\t\tresponsePromiseHook = this.helpers.createDeferredPromise<IExecuteResponsePromiseData>();\n\t\t\t\t\t}\n\t\t\t\t\tif (responsePromiseHook) {\n\t\t\t\t\t\tthis.emit([[item]], responsePromiseHook, undefined);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.emit([[item]], undefined, responsePromise);\n\t\t\t\t\t}\n\t\t\t\t\tif (responsePromise && acknowledgeMode !== 'laterMessageNode') {\n\t\t\t\t\t\t// Acknowledge message after the execution finished\n\t\t\t\t\t\tawait responsePromise.promise.then(async (data: IRun) => {\n\t\t\t\t\t\t\tif (data.data.resultData.error) {\n\t\t\t\t\t\t\t\t// The execution did fail\n\t\t\t\t\t\t\t\tif (acknowledgeMode === 'executionFinishesSuccessfully') {\n\t\t\t\t\t\t\t\t\tchannel.nack(message);\n\t\t\t\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (responsePromiseHook && acknowledgeMode === 'laterMessageNode') {\n\t\t\t\t\t\tawait responsePromiseHook.promise.then(() => {\n\t\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Acknowledge message directly\n\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst workflow = this.getWorkflow();\n\t\t\t\t\tconst node = this.getNode();\n\t\t\t\t\tif (acknowledgeMode !== 'immediately') {\n\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.logger.error(\n\t\t\t\t\t\t`There was a problem with the RabbitMQ Trigger node \"${node.name}\" in workflow \"${workflow.id}\": \"${error.message}\"`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnode: node.name,\n\t\t\t\t\t\t\tworkflowId: workflow.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tconst consumerTag = consumerInfo.consumerTag;\n\n\t\t// The \"closeFunction\" function gets called by n8n whenever\n\t\t// the workflow gets deactivated and can so clean up.\n\t\tconst closeFunction = async () => {\n\t\t\tcloseGotCalled = true;\n\t\t\ttry {\n\t\t\t\treturn await messageTracker.closeChannel(channel, consumerTag);\n\t\t\t} catch (error) {\n\t\t\t\tconst workflow = this.getWorkflow();\n\t\t\t\tconst node = this.getNode();\n\t\t\t\tthis.logger.error(\n\t\t\t\t\t`There was a problem closing the RabbitMQ Trigger node connection \"${node.name}\" in workflow \"${workflow.id}\": \"${error.message}\"`,\n\t\t\t\t\t{\n\t\t\t\t\t\tnode: node.name,\n\t\t\t\t\t\tworkflowId: workflow.id,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\t\t};\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAYA,0BAAwD;AAExD,4BAAqC;AACrC,8BAAmE;AAG5D,MAAM,gBAAqC;AAAA,EAA3C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,SAAS;AAAA,MACjB,SAAS;AAAA,MACT,aAAa;AAAA,MACb,yBAAyB;AAAA,MACzB,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,cAAc;AAAA,QACb,QAAQ;AAAA,QACR,gBAAgB;AAAA,UACf,UACC;AAAA,UACD,QACC;AAAA,QACF;AAAA,QACA,gBACC;AAAA,MACF;AAAA,MACA,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,YAAY;AAAA,QACX;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,UACT,aAAa;AAAA,UACb,aAAa;AAAA,QACd;AAAA,QACA;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS,CAAC;AAAA,UACV,aAAa;AAAA,UACb,SAAS;AAAA,YACR;AAAA,cAC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AS;AAAA,YACtB;AAAA,UACD;AAAA,QACD;AAAA,MACD;AAAA,IACD,CAAC;AACD,UAAM,cAAc,aAAa;AAIjC,UAAM,gBAAgB,YAAY;AACjC,uBAAiB;AACjB,UAAI;AACH,eAAO,MAAM,eAAe,aAAa,SAAS,WAAW;AAAA,MAC9D,SAAS,OAAO;AACf,cAAM,WAAW,KAAK,YAAY;AAClC,cAAM,OAAO,KAAK,QAAQ;AAC1B,aAAK,OAAO;AAAA,UACX,qEAAqE,KAAK,IAAI,kBAAkB,SAAS,EAAE,OAAO,MAAM,OAAO;AAAA,UAC/H;AAAA,YACC,MAAM,KAAK;AAAA,YACX,YAAY,SAAS;AAAA,UACtB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;","names":["closeFunction"]}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/RabbitMQ/RabbitMQTrigger.node.ts"],"sourcesContent":["/* eslint-disable n8n-nodes-base/node-filename-against-convention */\nimport type { Message } from 'amqplib';\nimport type {\n\tIDeferredPromise,\n\tIExecuteResponsePromiseData,\n\tINodeProperties,\n\tINodeType,\n\tINodeTypeDescription,\n\tIRun,\n\tITriggerFunctions,\n\tITriggerResponse,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport { rabbitDefaultOptions } from './DefaultOptions';\nimport { MessageTracker, rabbitmqConnectQueue, parseMessage } from './GenericFunctions';\nimport type { TriggerOptions } from './types';\n\nexport class RabbitMQTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'RabbitMQ Trigger',\n\t\tname: 'rabbitmqTrigger',\n\t\ticon: 'file:rabbitmq.svg',\n\t\tgroup: ['trigger'],\n\t\tversion: 1,\n\t\tdescription: 'Listens to RabbitMQ messages',\n\t\teventTriggerDescription: '',\n\t\tdefaults: {\n\t\t\tname: 'RabbitMQ Trigger',\n\t\t},\n\t\ttriggerPanel: {\n\t\t\theader: '',\n\t\t\texecutionsHelp: {\n\t\t\t\tinactive:\n\t\t\t\t\t\"<b>While building your workflow</b>, click the 'execute step' button, then trigger a Rabbit MQ event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Once you're happy with your workflow</b>, <a data-key='activate'>activate</a> it. Then every time a change is detected, the workflow will execute. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t\t\tactive:\n\t\t\t\t\t\"<b>While building your workflow</b>, click the 'execute step' button, then trigger a Rabbit MQ event. This will trigger an execution, which will show up in this editor.<br /> <br /><b>Your workflow will also execute automatically</b>, since it's activated. Every time a change is detected, this node will trigger an execution. These executions will show up in the <a data-key='executions'>executions list</a>, but not in the editor.\",\n\t\t\t},\n\t\t\tactivationHint:\n\t\t\t\t\"Once you’ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won’t see those executions here).\",\n\t\t},\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'rabbitmq',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Queue / Topic',\n\t\t\t\tname: 'queue',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'queue-name',\n\t\t\t\tdescription: 'The name of the queue to read from',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tdefault: {},\n\t\t\t\tplaceholder: 'Add option',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Content Is Binary',\n\t\t\t\t\t\tname: 'contentIsBinary',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription: 'Whether to save the content as binary',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Delete From Queue When',\n\t\t\t\t\t\tname: 'acknowledge',\n\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Execution Finishes',\n\t\t\t\t\t\t\t\tvalue: 'executionFinishes',\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t'After the workflow execution finished. No matter if the execution was successful or not.',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Execution Finishes Successfully',\n\t\t\t\t\t\t\t\tvalue: 'executionFinishesSuccessfully',\n\t\t\t\t\t\t\t\tdescription: 'After the workflow execution finished successfully',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Immediately',\n\t\t\t\t\t\t\t\tvalue: 'immediately',\n\t\t\t\t\t\t\t\tdescription: 'As soon as the message got received',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'Specified Later in Workflow',\n\t\t\t\t\t\t\t\tvalue: 'laterMessageNode',\n\t\t\t\t\t\t\t\tdescription: 'Using a RabbitMQ node to remove the item from the queue',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t\tdefault: 'immediately',\n\t\t\t\t\t\tdescription: 'When to acknowledge the message',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'JSON Parse Body',\n\t\t\t\t\t\tname: 'jsonParseBody',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t\tcontentIsBinary: [true],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription: 'Whether to parse the body to an object',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Only Content',\n\t\t\t\t\t\tname: 'onlyContent',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t\tcontentIsBinary: [true],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t\tdescription: 'Whether to return only the content property',\n\t\t\t\t\t},\n\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Parallel Message Processing Limit',\n\t\t\t\t\t\tname: 'parallelMessages',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: -1,\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\thide: {\n\t\t\t\t\t\t\t\tacknowledge: ['immediately'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdescription: 'Max number of executions at a time. Use -1 for no limit.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Binding',\n\t\t\t\t\t\tname: 'binding',\n\t\t\t\t\t\tplaceholder: 'Add Binding',\n\t\t\t\t\t\tdescription: 'Add binding to queu',\n\t\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: {},\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'bindings',\n\t\t\t\t\t\t\t\tdisplayName: 'Binding',\n\t\t\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Exchange',\n\t\t\t\t\t\t\t\t\t\tname: 'exchange',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tplaceholder: 'exchange',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'RoutingKey',\n\t\t\t\t\t\t\t\t\t\tname: 'routingKey',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tplaceholder: 'routing-key',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t...rabbitDefaultOptions,\n\t\t\t\t].sort((a, b) => {\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a as INodeProperties).displayName.toLowerCase() <\n\t\t\t\t\t\t(b as INodeProperties).displayName.toLowerCase()\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn -1;\n\t\t\t\t\t}\n\t\t\t\t\tif (\n\t\t\t\t\t\t(a as INodeProperties).displayName.toLowerCase() >\n\t\t\t\t\t\t(b as INodeProperties).displayName.toLowerCase()\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn 1;\n\t\t\t\t\t}\n\t\t\t\t\treturn 0;\n\t\t\t\t}) as INodeProperties[],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t\"To delete an item from the queue, insert a RabbitMQ node later in the workflow and use the 'Delete from queue' operation\",\n\t\t\t\tname: 'laterMessageNode',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\t'/options.acknowledge': ['laterMessageNode'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst queue = this.getNodeParameter('queue') as string;\n\t\tconst options = this.getNodeParameter('options', {}) as TriggerOptions;\n\t\tconst channel = await rabbitmqConnectQueue.call(this, queue, options);\n\n\t\tif (this.getMode() === 'manual') {\n\t\t\tconst manualTriggerFunction = async () => {\n\t\t\t\t// Do only catch a single message when executing manually, else messages will leak\n\t\t\t\tawait channel.prefetch(1);\n\n\t\t\t\tconst processMessage = async (message: Message | null) => {\n\t\t\t\t\tif (message !== null) {\n\t\t\t\t\t\tconst item = await parseMessage(message, options, this.helpers);\n\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t\tthis.emit([[item]]);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.emitError(new Error('Connection got closed unexpectedly'));\n\t\t\t\t\t}\n\t\t\t\t};\n\n\t\t\t\tconst existingMessage = await channel.get(queue);\n\t\t\t\tif (existingMessage) await processMessage(existingMessage);\n\t\t\t\telse await channel.consume(queue, processMessage);\n\t\t\t};\n\n\t\t\tconst closeFunction = async () => {\n\t\t\t\tawait channel.close();\n\t\t\t\tawait channel.connection.close();\n\t\t\t\treturn;\n\t\t\t};\n\n\t\t\treturn {\n\t\t\t\tcloseFunction,\n\t\t\t\tmanualTriggerFunction,\n\t\t\t};\n\t\t}\n\n\t\tconst parallelMessages = options.parallelMessages ?? -1;\n\t\tif (isNaN(parallelMessages) || parallelMessages === 0 || parallelMessages < -1) {\n\t\t\tthrow new NodeOperationError(\n\t\t\t\tthis.getNode(),\n\t\t\t\t'Parallel message processing limit must be a number greater than zero (or -1 for no limit)',\n\t\t\t);\n\t\t}\n\n\t\tlet acknowledgeMode = options.acknowledge ?? 'immediately';\n\n\t\tif (parallelMessages !== -1 && acknowledgeMode === 'immediately') {\n\t\t\t// If parallel message limit is set, then the default mode is \"executionFinishes\"\n\t\t\t// unless acknowledgeMode got set specifically. Be aware that the mode \"immediately\"\n\t\t\t// can not be supported in this case.\n\t\t\tacknowledgeMode = 'executionFinishes';\n\t\t}\n\n\t\tconst messageTracker = new MessageTracker();\n\t\tlet closeGotCalled = false;\n\n\t\tif (parallelMessages !== -1) {\n\t\t\tawait channel.prefetch(parallelMessages);\n\t\t}\n\n\t\tchannel.on('close', () => {\n\t\t\tif (!closeGotCalled) {\n\t\t\t\tthis.emitError(new Error('Connection got closed unexpectedly'));\n\t\t\t}\n\t\t});\n\n\t\tconst consumerInfo = await channel.consume(queue, async (message) => {\n\t\t\tif (message !== null) {\n\t\t\t\ttry {\n\t\t\t\t\tif (acknowledgeMode !== 'immediately') {\n\t\t\t\t\t\tmessageTracker.received(message);\n\t\t\t\t\t}\n\n\t\t\t\t\tconst item = await parseMessage(message, options, this.helpers);\n\n\t\t\t\t\tlet responsePromise: IDeferredPromise<IRun> | undefined = undefined;\n\t\t\t\t\tlet responsePromiseHook: IDeferredPromise<IExecuteResponsePromiseData> | undefined =\n\t\t\t\t\t\tundefined;\n\t\t\t\t\tif (acknowledgeMode !== 'immediately' && acknowledgeMode !== 'laterMessageNode') {\n\t\t\t\t\t\tresponsePromise = this.helpers.createDeferredPromise();\n\t\t\t\t\t} else if (acknowledgeMode === 'laterMessageNode') {\n\t\t\t\t\t\tresponsePromiseHook = this.helpers.createDeferredPromise<IExecuteResponsePromiseData>();\n\t\t\t\t\t}\n\t\t\t\t\tif (responsePromiseHook) {\n\t\t\t\t\t\tthis.emit([[item]], responsePromiseHook, undefined);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.emit([[item]], undefined, responsePromise);\n\t\t\t\t\t}\n\t\t\t\t\tif (responsePromise && acknowledgeMode !== 'laterMessageNode') {\n\t\t\t\t\t\t// Acknowledge message after the execution finished\n\t\t\t\t\t\tawait responsePromise.promise.then(async (data: IRun) => {\n\t\t\t\t\t\t\tif (data.data.resultData.error) {\n\t\t\t\t\t\t\t\t// The execution did fail\n\t\t\t\t\t\t\t\tif (acknowledgeMode === 'executionFinishesSuccessfully') {\n\t\t\t\t\t\t\t\t\tchannel.nack(message);\n\t\t\t\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else if (responsePromiseHook && acknowledgeMode === 'laterMessageNode') {\n\t\t\t\t\t\tawait responsePromiseHook.promise.then(() => {\n\t\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Acknowledge message directly\n\t\t\t\t\t\tchannel.ack(message);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tconst workflow = this.getWorkflow();\n\t\t\t\t\tconst node = this.getNode();\n\t\t\t\t\tif (acknowledgeMode !== 'immediately') {\n\t\t\t\t\t\tmessageTracker.answered(message);\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.logger.error(\n\t\t\t\t\t\t`There was a problem with the RabbitMQ Trigger node \"${node.name}\" in workflow \"${workflow.id}\": \"${error.message}\"`,\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tnode: node.name,\n\t\t\t\t\t\t\tworkflowId: workflow.id,\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t\tconst consumerTag = consumerInfo.consumerTag;\n\n\t\t// The \"closeFunction\" function gets called by n8n whenever\n\t\t// the workflow gets deactivated and can so clean up.\n\t\tconst closeFunction = async () => {\n\t\t\tcloseGotCalled = true;\n\t\t\ttry {\n\t\t\t\treturn await messageTracker.closeChannel(channel, consumerTag);\n\t\t\t} catch (error) {\n\t\t\t\tconst workflow = this.getWorkflow();\n\t\t\t\tconst node = this.getNode();\n\t\t\t\tthis.logger.error(\n\t\t\t\t\t`There was a problem closing the RabbitMQ Trigger node connection \"${node.name}\" in workflow \"${workflow.id}\": \"${error.message}\"`,\n\t\t\t\t\t{\n\t\t\t\t\t\tnode: node.name,\n\t\t\t\t\t\tworkflowId: workflow.id,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}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,UACX,qEAAqE,KAAK,IAAI,kBAAkB,SAAS,EAAE,OAAO,MAAM,OAAO;AAAA,UAC/H;AAAA,YACC,MAAM,KAAK;AAAA,YACX,YAAY,SAAS;AAAA,UACtB;AAAA,QACD;AAAA,MACD;AAAA,IACD;AAEA,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;","names":["closeFunction"]}
|
|
@@ -34,6 +34,7 @@ module.exports = __toCommonJS(RespondToWebhook_node_exports);
|
|
|
34
34
|
var import_jsonwebtoken = __toESM(require("jsonwebtoken"));
|
|
35
35
|
var import_set = __toESM(require("lodash/set"));
|
|
36
36
|
var import_n8n_workflow = require("n8n-workflow");
|
|
37
|
+
var import_utils = require("./utils");
|
|
37
38
|
var import_utilities = require("../../utils/utilities");
|
|
38
39
|
const respondWithProperty = {
|
|
39
40
|
displayName: "Respond With",
|
|
@@ -91,13 +92,13 @@ class RespondToWebhook {
|
|
|
91
92
|
icon: { light: "file:webhook.svg", dark: "file:webhook.dark.svg" },
|
|
92
93
|
name: "respondToWebhook",
|
|
93
94
|
group: ["transform"],
|
|
94
|
-
version: [1, 1.1, 1.2],
|
|
95
|
+
version: [1, 1.1, 1.2, 1.3],
|
|
95
96
|
description: "Returns data for Webhook",
|
|
96
97
|
defaults: {
|
|
97
98
|
name: "Respond to Webhook"
|
|
98
99
|
},
|
|
99
100
|
inputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
100
|
-
outputs:
|
|
101
|
+
outputs: `={{(${import_utils.configuredOutputs})($nodeVersion)}}`,
|
|
101
102
|
credentials: [
|
|
102
103
|
{
|
|
103
104
|
name: "jwtAuth",
|
|
@@ -324,6 +325,7 @@ class RespondToWebhook {
|
|
|
324
325
|
import_n8n_workflow.CHAT_TRIGGER_NODE_TYPE,
|
|
325
326
|
import_n8n_workflow.WAIT_NODE_TYPE
|
|
326
327
|
];
|
|
328
|
+
let response;
|
|
327
329
|
try {
|
|
328
330
|
if (nodeVersion >= 1.1) {
|
|
329
331
|
const connectedNodes = this.getParentNodes(this.getNode().name);
|
|
@@ -428,7 +430,7 @@ class RespondToWebhook {
|
|
|
428
430
|
`The Response Data option "${respondWith}" is not supported!`
|
|
429
431
|
);
|
|
430
432
|
}
|
|
431
|
-
|
|
433
|
+
response = {
|
|
432
434
|
body: responseBody,
|
|
433
435
|
headers,
|
|
434
436
|
statusCode
|
|
@@ -445,6 +447,9 @@ class RespondToWebhook {
|
|
|
445
447
|
}
|
|
446
448
|
throw error;
|
|
447
449
|
}
|
|
450
|
+
if (nodeVersion >= 1.3) {
|
|
451
|
+
return [items, [{ json: { response } }]];
|
|
452
|
+
}
|
|
448
453
|
return [items];
|
|
449
454
|
}
|
|
450
455
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/RespondToWebhook/RespondToWebhook.node.ts"],"sourcesContent":["import jwt from 'jsonwebtoken';\nimport set from 'lodash/set';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tIN8nHttpFullResponse,\n\tIN8nHttpResponse,\n\tINodeExecutionData,\n\tINodeProperties,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\nimport {\n\tjsonParse,\n\tBINARY_ENCODING,\n\tNodeOperationError,\n\tNodeConnectionTypes,\n\tWEBHOOK_NODE_TYPE,\n\tFORM_TRIGGER_NODE_TYPE,\n\tCHAT_TRIGGER_NODE_TYPE,\n\tWAIT_NODE_TYPE,\n} from 'n8n-workflow';\nimport type { Readable } from 'stream';\n\nimport { formatPrivateKey, generatePairedItemData } from '../../utils/utilities';\n\nconst respondWithProperty: INodeProperties = {\n\tdisplayName: 'Respond With',\n\tname: 'respondWith',\n\ttype: 'options',\n\toptions: [\n\t\t{\n\t\t\tname: 'All Incoming Items',\n\t\t\tvalue: 'allIncomingItems',\n\t\t\tdescription: 'Respond with all input JSON items',\n\t\t},\n\t\t{\n\t\t\tname: 'Binary File',\n\t\t\tvalue: 'binary',\n\t\t\tdescription: 'Respond with incoming file binary data',\n\t\t},\n\t\t{\n\t\t\tname: 'First Incoming Item',\n\t\t\tvalue: 'firstIncomingItem',\n\t\t\tdescription: 'Respond with the first input JSON item',\n\t\t},\n\t\t{\n\t\t\tname: 'JSON',\n\t\t\tvalue: 'json',\n\t\t\tdescription: 'Respond with a custom JSON body',\n\t\t},\n\t\t{\n\t\t\tname: 'JWT Token',\n\t\t\tvalue: 'jwt',\n\t\t\tdescription: 'Respond with a JWT token',\n\t\t},\n\t\t{\n\t\t\tname: 'No Data',\n\t\t\tvalue: 'noData',\n\t\t\tdescription: 'Respond with an empty body',\n\t\t},\n\t\t{\n\t\t\tname: 'Redirect',\n\t\t\tvalue: 'redirect',\n\t\t\tdescription: 'Respond with a redirect to a given URL',\n\t\t},\n\t\t{\n\t\t\tname: 'Text',\n\t\t\tvalue: 'text',\n\t\t\tdescription: 'Respond with a simple text message body',\n\t\t},\n\t],\n\tdefault: 'firstIncomingItem',\n\tdescription: 'The data that should be returned',\n};\n\nexport class RespondToWebhook implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Respond to Webhook',\n\t\ticon: { light: 'file:webhook.svg', dark: 'file:webhook.dark.svg' },\n\t\tname: 'respondToWebhook',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1, 1.2],\n\t\tdescription: 'Returns data for Webhook',\n\t\tdefaults: {\n\t\t\tname: 'Respond to Webhook',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'jwtAuth',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Verify that the \"Webhook\" node\\'s \"Respond\" parameter is set to \"Using Respond to Webhook Node\". <a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.respondtowebhook/\" target=\"_blank\">More details',\n\t\t\t\tname: 'generalNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...respondWithProperty,\n\t\t\t\tdisplayOptions: { show: { '@version': [1, 1.1] } },\n\t\t\t},\n\t\t\t{\n\t\t\t\t...respondWithProperty,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { gte: 1.2 } }] } },\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Credentials',\n\t\t\t\tname: 'credentials',\n\t\t\t\ttype: 'credentials',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'When using expressions, note that this node will only run for the first item in the input data',\n\t\t\t\tname: 'webhookNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['json', 'text', 'jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Redirect URL',\n\t\t\t\tname: 'redirectURL',\n\t\t\t\ttype: 'string',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['redirect'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. http://www.n8n.io',\n\t\t\t\tdescription: 'The URL to redirect to',\n\t\t\t\tvalidateType: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Response Body',\n\t\t\t\tname: 'responseBody',\n\t\t\t\ttype: 'json',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '{\\n \"myField\": \"value\"\\n}',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 4,\n\t\t\t\t},\n\t\t\t\tdescription: 'The HTTP response JSON data',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Payload',\n\t\t\t\tname: 'payload',\n\t\t\t\ttype: 'json',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '{\\n \"myField\": \"value\"\\n}',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 4,\n\t\t\t\t},\n\t\t\t\tvalidateType: 'object',\n\t\t\t\tdescription: 'The payload to include in the JWT token',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Response Body',\n\t\t\t\tname: 'responseBody',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['text'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 2,\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. Workflow completed',\n\t\t\t\tdescription: 'The HTTP response text data',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Response Data Source',\n\t\t\t\tname: 'responseDataSource',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['binary'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Choose Automatically From Input',\n\t\t\t\t\t\tvalue: 'automatically',\n\t\t\t\t\t\tdescription: 'Use if input data will contain a single piece of binary data',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Specify Myself',\n\t\t\t\t\t\tvalue: 'set',\n\t\t\t\t\t\tdescription: 'Enter the name of the input field the binary data will be in',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'automatically',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Input Field Name',\n\t\t\t\tname: 'inputFieldName',\n\t\t\t\ttype: 'string',\n\t\t\t\trequired: true,\n\t\t\t\tdefault: 'data',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['binary'],\n\t\t\t\t\t\tresponseDataSource: ['set'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdescription: 'The name of the node input field with the binary data',\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tplaceholder: 'Add option',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Code',\n\t\t\t\t\t\tname: 'responseCode',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tminValue: 100,\n\t\t\t\t\t\t\tmaxValue: 599,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: 200,\n\t\t\t\t\t\tdescription: 'The HTTP response code to return. Defaults to 200.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Headers',\n\t\t\t\t\t\tname: 'responseHeaders',\n\t\t\t\t\t\tplaceholder: 'Add Response Header',\n\t\t\t\t\t\tdescription: 'Add headers to the webhook response',\n\t\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: {},\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'entries',\n\t\t\t\t\t\t\t\tdisplayName: 'Entries',\n\t\t\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tdescription: 'Name of the header',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\t\t\t\tname: 'value',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tdescription: 'Value of the header',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Put Response in Field',\n\t\t\t\t\t\tname: 'responseKey',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t['/respondWith']: ['allIncomingItems', 'firstIncomingItem'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tdescription: 'The name of the response field to put all items in',\n\t\t\t\t\t\tplaceholder: 'e.g. data',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst items = this.getInputData();\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tconst WEBHOOK_NODE_TYPES = [\n\t\t\tWEBHOOK_NODE_TYPE,\n\t\t\tFORM_TRIGGER_NODE_TYPE,\n\t\t\tCHAT_TRIGGER_NODE_TYPE,\n\t\t\tWAIT_NODE_TYPE,\n\t\t];\n\n\t\ttry {\n\t\t\tif (nodeVersion >= 1.1) {\n\t\t\t\tconst connectedNodes = this.getParentNodes(this.getNode().name);\n\t\t\t\tif (!connectedNodes.some(({ type }) => WEBHOOK_NODE_TYPES.includes(type))) {\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\tnew Error('No Webhook node found in the workflow'),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Insert a Webhook node to your workflow and set the “Respond” parameter to “Using Respond to Webhook Node” ',\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst respondWith = this.getNodeParameter('respondWith', 0) as string;\n\t\t\tconst options = this.getNodeParameter('options', 0, {});\n\n\t\t\tconst headers = {} as IDataObject;\n\t\t\tif (options.responseHeaders) {\n\t\t\t\tfor (const header of (options.responseHeaders as IDataObject).entries as IDataObject[]) {\n\t\t\t\t\tif (typeof header.name !== 'string') {\n\t\t\t\t\t\theader.name = header.name?.toString();\n\t\t\t\t\t}\n\t\t\t\t\theaders[header.name?.toLowerCase() as string] = header.value?.toString();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet statusCode = (options.responseCode as number) || 200;\n\t\t\tlet responseBody: IN8nHttpResponse | Readable;\n\t\t\tif (respondWith === 'json') {\n\t\t\t\tconst responseBodyParameter = this.getNodeParameter('responseBody', 0) as string;\n\t\t\t\tif (responseBodyParameter) {\n\t\t\t\t\tif (typeof responseBodyParameter === 'object') {\n\t\t\t\t\t\tresponseBody = responseBodyParameter;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponseBody = jsonParse(responseBodyParameter);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), error as Error, {\n\t\t\t\t\t\t\t\tmessage: \"Invalid JSON in 'Response Body' field\",\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Check that the syntax of the JSON in the 'Response Body' parameter is valid\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (respondWith === 'jwt') {\n\t\t\t\ttry {\n\t\t\t\t\tconst { keyType, secret, algorithm, privateKey } = await this.getCredentials<{\n\t\t\t\t\t\tkeyType: 'passphrase' | 'pemKey';\n\t\t\t\t\t\tprivateKey: string;\n\t\t\t\t\t\tsecret: string;\n\t\t\t\t\t\talgorithm: jwt.Algorithm;\n\t\t\t\t\t}>('jwtAuth');\n\n\t\t\t\t\tlet secretOrPrivateKey;\n\n\t\t\t\t\tif (keyType === 'passphrase') {\n\t\t\t\t\t\tsecretOrPrivateKey = secret;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsecretOrPrivateKey = formatPrivateKey(privateKey);\n\t\t\t\t\t}\n\t\t\t\t\tconst payload = this.getNodeParameter('payload', 0, {}) as IDataObject;\n\t\t\t\t\tconst token = jwt.sign(payload, secretOrPrivateKey, { algorithm });\n\t\t\t\t\tresponseBody = { token };\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), error as Error, {\n\t\t\t\t\t\tmessage: 'Error signing JWT token',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (respondWith === 'allIncomingItems') {\n\t\t\t\tconst respondItems = items.map((item) => item.json);\n\t\t\t\tresponseBody = options.responseKey\n\t\t\t\t\t? set({}, options.responseKey as string, respondItems)\n\t\t\t\t\t: respondItems;\n\t\t\t} else if (respondWith === 'firstIncomingItem') {\n\t\t\t\tresponseBody = options.responseKey\n\t\t\t\t\t? set({}, options.responseKey as string, items[0].json)\n\t\t\t\t\t: items[0].json;\n\t\t\t} else if (respondWith === 'text') {\n\t\t\t\tresponseBody = this.getNodeParameter('responseBody', 0) as string;\n\t\t\t} else if (respondWith === 'binary') {\n\t\t\t\tconst item = items[0];\n\n\t\t\t\tif (item.binary === undefined) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No binary data exists on the first item!');\n\t\t\t\t}\n\n\t\t\t\tlet responseBinaryPropertyName: string;\n\n\t\t\t\tconst responseDataSource = this.getNodeParameter('responseDataSource', 0) as string;\n\n\t\t\t\tif (responseDataSource === 'set') {\n\t\t\t\t\tresponseBinaryPropertyName = this.getNodeParameter('inputFieldName', 0) as string;\n\t\t\t\t} else {\n\t\t\t\t\tconst binaryKeys = Object.keys(item.binary);\n\t\t\t\t\tif (binaryKeys.length === 0) {\n\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t\t'No binary data exists on the first item!',\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tresponseBinaryPropertyName = binaryKeys[0];\n\t\t\t\t}\n\n\t\t\t\tconst binaryData = this.helpers.assertBinaryData(0, responseBinaryPropertyName);\n\t\t\t\tif (binaryData.id) {\n\t\t\t\t\tresponseBody = { binaryData };\n\t\t\t\t} else {\n\t\t\t\t\tresponseBody = Buffer.from(binaryData.data, BINARY_ENCODING);\n\t\t\t\t\theaders['content-length'] = (responseBody as Buffer).length;\n\t\t\t\t}\n\n\t\t\t\tif (!headers['content-type']) {\n\t\t\t\t\theaders['content-type'] = binaryData.mimeType;\n\t\t\t\t}\n\t\t\t} else if (respondWith === 'redirect') {\n\t\t\t\theaders.location = this.getNodeParameter('redirectURL', 0) as string;\n\t\t\t\tstatusCode = (options.responseCode as number) ?? 307;\n\t\t\t} else if (respondWith !== 'noData') {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t`The Response Data option \"${respondWith}\" is not supported!`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tconst response: IN8nHttpFullResponse = {\n\t\t\t\tbody: responseBody,\n\t\t\t\theaders,\n\t\t\t\tstatusCode,\n\t\t\t};\n\n\t\t\tthis.sendResponse(response);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\tconst itemData = generatePairedItemData(items.length);\n\t\t\t\tconst returnData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\t[{ json: { error: error.message } }],\n\t\t\t\t\t{ itemData },\n\t\t\t\t);\n\t\t\t\treturn [returnData];\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn [items];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgB;AAChB,iBAAgB;AAWhB,0BASO;AAGP,uBAAyD;AAEzD,MAAM,sBAAuC;AAAA,EAC5C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,IACR;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,EACD;AAAA,EACA,SAAS;AAAA,EACT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,aAAa,KAAK,QAAQ;AAAA,UAC/B,CAAC,EAAE,MAAM,EAAE,OAAO,MAAM,QAAQ,EAAE,CAAC;AAAA,UACnC,EAAE,SAAS;AAAA,QACZ;AACA,eAAO,CAAC,UAAU;AAAA,MACnB;AAEA,YAAM;AAAA,IACP;AAEA,WAAO,CAAC,KAAK;AAAA,EACd;AACD;","names":["jwt","set"]}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/RespondToWebhook/RespondToWebhook.node.ts"],"sourcesContent":["import jwt from 'jsonwebtoken';\nimport set from 'lodash/set';\nimport type {\n\tIDataObject,\n\tIExecuteFunctions,\n\tIN8nHttpFullResponse,\n\tIN8nHttpResponse,\n\tINodeExecutionData,\n\tINodeProperties,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\nimport {\n\tjsonParse,\n\tBINARY_ENCODING,\n\tNodeOperationError,\n\tNodeConnectionTypes,\n\tWEBHOOK_NODE_TYPE,\n\tFORM_TRIGGER_NODE_TYPE,\n\tCHAT_TRIGGER_NODE_TYPE,\n\tWAIT_NODE_TYPE,\n} from 'n8n-workflow';\nimport type { Readable } from 'stream';\n\nimport { configuredOutputs } from './utils';\nimport { formatPrivateKey, generatePairedItemData } from '../../utils/utilities';\n\nconst respondWithProperty: INodeProperties = {\n\tdisplayName: 'Respond With',\n\tname: 'respondWith',\n\ttype: 'options',\n\toptions: [\n\t\t{\n\t\t\tname: 'All Incoming Items',\n\t\t\tvalue: 'allIncomingItems',\n\t\t\tdescription: 'Respond with all input JSON items',\n\t\t},\n\t\t{\n\t\t\tname: 'Binary File',\n\t\t\tvalue: 'binary',\n\t\t\tdescription: 'Respond with incoming file binary data',\n\t\t},\n\t\t{\n\t\t\tname: 'First Incoming Item',\n\t\t\tvalue: 'firstIncomingItem',\n\t\t\tdescription: 'Respond with the first input JSON item',\n\t\t},\n\t\t{\n\t\t\tname: 'JSON',\n\t\t\tvalue: 'json',\n\t\t\tdescription: 'Respond with a custom JSON body',\n\t\t},\n\t\t{\n\t\t\tname: 'JWT Token',\n\t\t\tvalue: 'jwt',\n\t\t\tdescription: 'Respond with a JWT token',\n\t\t},\n\t\t{\n\t\t\tname: 'No Data',\n\t\t\tvalue: 'noData',\n\t\t\tdescription: 'Respond with an empty body',\n\t\t},\n\t\t{\n\t\t\tname: 'Redirect',\n\t\t\tvalue: 'redirect',\n\t\t\tdescription: 'Respond with a redirect to a given URL',\n\t\t},\n\t\t{\n\t\t\tname: 'Text',\n\t\t\tvalue: 'text',\n\t\t\tdescription: 'Respond with a simple text message body',\n\t\t},\n\t],\n\tdefault: 'firstIncomingItem',\n\tdescription: 'The data that should be returned',\n};\n\nexport class RespondToWebhook implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Respond to Webhook',\n\t\ticon: { light: 'file:webhook.svg', dark: 'file:webhook.dark.svg' },\n\t\tname: 'respondToWebhook',\n\t\tgroup: ['transform'],\n\t\tversion: [1, 1.1, 1.2, 1.3],\n\t\tdescription: 'Returns data for Webhook',\n\t\tdefaults: {\n\t\t\tname: 'Respond to Webhook',\n\t\t},\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: `={{(${configuredOutputs})($nodeVersion)}}`,\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'jwtAuth',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'Verify that the \"Webhook\" node\\'s \"Respond\" parameter is set to \"Using Respond to Webhook Node\". <a href=\"https://docs.n8n.io/integrations/builtin/core-nodes/n8n-nodes-base.respondtowebhook/\" target=\"_blank\">More details',\n\t\t\t\tname: 'generalNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\t...respondWithProperty,\n\t\t\t\tdisplayOptions: { show: { '@version': [1, 1.1] } },\n\t\t\t},\n\t\t\t{\n\t\t\t\t...respondWithProperty,\n\t\t\t\tnoDataExpression: true,\n\t\t\t\tdisplayOptions: { show: { '@version': [{ _cnd: { gte: 1.2 } }] } },\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Credentials',\n\t\t\t\tname: 'credentials',\n\t\t\t\ttype: 'credentials',\n\t\t\t\tdefault: '',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'When using expressions, note that this node will only run for the first item in the input data',\n\t\t\t\tname: 'webhookNotice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['json', 'text', 'jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Redirect URL',\n\t\t\t\tname: 'redirectURL',\n\t\t\t\ttype: 'string',\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['redirect'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. http://www.n8n.io',\n\t\t\t\tdescription: 'The URL to redirect to',\n\t\t\t\tvalidateType: 'url',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Response Body',\n\t\t\t\tname: 'responseBody',\n\t\t\t\ttype: 'json',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['json'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '{\\n \"myField\": \"value\"\\n}',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 4,\n\t\t\t\t},\n\t\t\t\tdescription: 'The HTTP response JSON data',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Payload',\n\t\t\t\tname: 'payload',\n\t\t\t\ttype: 'json',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['jwt'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '{\\n \"myField\": \"value\"\\n}',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 4,\n\t\t\t\t},\n\t\t\t\tvalidateType: 'object',\n\t\t\t\tdescription: 'The payload to include in the JWT token',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Response Body',\n\t\t\t\tname: 'responseBody',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['text'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\ttypeOptions: {\n\t\t\t\t\trows: 2,\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'e.g. Workflow completed',\n\t\t\t\tdescription: 'The HTTP response text data',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Response Data Source',\n\t\t\t\tname: 'responseDataSource',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['binary'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Choose Automatically From Input',\n\t\t\t\t\t\tvalue: 'automatically',\n\t\t\t\t\t\tdescription: 'Use if input data will contain a single piece of binary data',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Specify Myself',\n\t\t\t\t\t\tvalue: 'set',\n\t\t\t\t\t\tdescription: 'Enter the name of the input field the binary data will be in',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'automatically',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Input Field Name',\n\t\t\t\tname: 'inputFieldName',\n\t\t\t\ttype: 'string',\n\t\t\t\trequired: true,\n\t\t\t\tdefault: 'data',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\trespondWith: ['binary'],\n\t\t\t\t\t\tresponseDataSource: ['set'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdescription: 'The name of the node input field with the binary data',\n\t\t\t},\n\n\t\t\t{\n\t\t\t\tdisplayName: 'Options',\n\t\t\t\tname: 'options',\n\t\t\t\ttype: 'collection',\n\t\t\t\tplaceholder: 'Add option',\n\t\t\t\tdefault: {},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Code',\n\t\t\t\t\t\tname: 'responseCode',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tminValue: 100,\n\t\t\t\t\t\t\tmaxValue: 599,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: 200,\n\t\t\t\t\t\tdescription: 'The HTTP response code to return. Defaults to 200.',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Response Headers',\n\t\t\t\t\t\tname: 'responseHeaders',\n\t\t\t\t\t\tplaceholder: 'Add Response Header',\n\t\t\t\t\t\tdescription: 'Add headers to the webhook response',\n\t\t\t\t\t\ttype: 'fixedCollection',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tmultipleValues: true,\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: {},\n\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tname: 'entries',\n\t\t\t\t\t\t\t\tdisplayName: 'Entries',\n\t\t\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Name',\n\t\t\t\t\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tdescription: 'Name of the header',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Value',\n\t\t\t\t\t\t\t\t\t\tname: 'value',\n\t\t\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\t\t\tdescription: 'Value of the header',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Put Response in Field',\n\t\t\t\t\t\tname: 'responseKey',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t['/respondWith']: ['allIncomingItems', 'firstIncomingItem'],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\tdescription: 'The name of the response field to put all items in',\n\t\t\t\t\t\tplaceholder: 'e.g. data',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst items = this.getInputData();\n\t\tconst nodeVersion = this.getNode().typeVersion;\n\n\t\tconst WEBHOOK_NODE_TYPES = [\n\t\t\tWEBHOOK_NODE_TYPE,\n\t\t\tFORM_TRIGGER_NODE_TYPE,\n\t\t\tCHAT_TRIGGER_NODE_TYPE,\n\t\t\tWAIT_NODE_TYPE,\n\t\t];\n\n\t\tlet response: IN8nHttpFullResponse;\n\n\t\ttry {\n\t\t\tif (nodeVersion >= 1.1) {\n\t\t\t\tconst connectedNodes = this.getParentNodes(this.getNode().name);\n\t\t\t\tif (!connectedNodes.some(({ type }) => WEBHOOK_NODE_TYPES.includes(type))) {\n\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\tnew Error('No Webhook node found in the workflow'),\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t'Insert a Webhook node to your workflow and set the “Respond” parameter to “Using Respond to Webhook Node” ',\n\t\t\t\t\t\t},\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst respondWith = this.getNodeParameter('respondWith', 0) as string;\n\t\t\tconst options = this.getNodeParameter('options', 0, {});\n\n\t\t\tconst headers = {} as IDataObject;\n\t\t\tif (options.responseHeaders) {\n\t\t\t\tfor (const header of (options.responseHeaders as IDataObject).entries as IDataObject[]) {\n\t\t\t\t\tif (typeof header.name !== 'string') {\n\t\t\t\t\t\theader.name = header.name?.toString();\n\t\t\t\t\t}\n\t\t\t\t\theaders[header.name?.toLowerCase() as string] = header.value?.toString();\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tlet statusCode = (options.responseCode as number) || 200;\n\t\t\tlet responseBody: IN8nHttpResponse | Readable;\n\t\t\tif (respondWith === 'json') {\n\t\t\t\tconst responseBodyParameter = this.getNodeParameter('responseBody', 0) as string;\n\t\t\t\tif (responseBodyParameter) {\n\t\t\t\t\tif (typeof responseBodyParameter === 'object') {\n\t\t\t\t\t\tresponseBody = responseBodyParameter;\n\t\t\t\t\t} else {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tresponseBody = jsonParse(responseBodyParameter);\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), error as Error, {\n\t\t\t\t\t\t\t\tmessage: \"Invalid JSON in 'Response Body' field\",\n\t\t\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t\t\t\"Check that the syntax of the JSON in the 'Response Body' parameter is valid\",\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (respondWith === 'jwt') {\n\t\t\t\ttry {\n\t\t\t\t\tconst { keyType, secret, algorithm, privateKey } = await this.getCredentials<{\n\t\t\t\t\t\tkeyType: 'passphrase' | 'pemKey';\n\t\t\t\t\t\tprivateKey: string;\n\t\t\t\t\t\tsecret: string;\n\t\t\t\t\t\talgorithm: jwt.Algorithm;\n\t\t\t\t\t}>('jwtAuth');\n\n\t\t\t\t\tlet secretOrPrivateKey;\n\n\t\t\t\t\tif (keyType === 'passphrase') {\n\t\t\t\t\t\tsecretOrPrivateKey = secret;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tsecretOrPrivateKey = formatPrivateKey(privateKey);\n\t\t\t\t\t}\n\t\t\t\t\tconst payload = this.getNodeParameter('payload', 0, {}) as IDataObject;\n\t\t\t\t\tconst token = jwt.sign(payload, secretOrPrivateKey, { algorithm });\n\t\t\t\t\tresponseBody = { token };\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), error as Error, {\n\t\t\t\t\t\tmessage: 'Error signing JWT token',\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t} else if (respondWith === 'allIncomingItems') {\n\t\t\t\tconst respondItems = items.map((item) => item.json);\n\t\t\t\tresponseBody = options.responseKey\n\t\t\t\t\t? set({}, options.responseKey as string, respondItems)\n\t\t\t\t\t: respondItems;\n\t\t\t} else if (respondWith === 'firstIncomingItem') {\n\t\t\t\tresponseBody = options.responseKey\n\t\t\t\t\t? set({}, options.responseKey as string, items[0].json)\n\t\t\t\t\t: items[0].json;\n\t\t\t} else if (respondWith === 'text') {\n\t\t\t\tresponseBody = this.getNodeParameter('responseBody', 0) as string;\n\t\t\t} else if (respondWith === 'binary') {\n\t\t\t\tconst item = items[0];\n\n\t\t\t\tif (item.binary === undefined) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'No binary data exists on the first item!');\n\t\t\t\t}\n\n\t\t\t\tlet responseBinaryPropertyName: string;\n\n\t\t\t\tconst responseDataSource = this.getNodeParameter('responseDataSource', 0) as string;\n\n\t\t\t\tif (responseDataSource === 'set') {\n\t\t\t\t\tresponseBinaryPropertyName = this.getNodeParameter('inputFieldName', 0) as string;\n\t\t\t\t} else {\n\t\t\t\t\tconst binaryKeys = Object.keys(item.binary);\n\t\t\t\t\tif (binaryKeys.length === 0) {\n\t\t\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t\t\t'No binary data exists on the first item!',\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\t\t\t\t\tresponseBinaryPropertyName = binaryKeys[0];\n\t\t\t\t}\n\n\t\t\t\tconst binaryData = this.helpers.assertBinaryData(0, responseBinaryPropertyName);\n\t\t\t\tif (binaryData.id) {\n\t\t\t\t\tresponseBody = { binaryData };\n\t\t\t\t} else {\n\t\t\t\t\tresponseBody = Buffer.from(binaryData.data, BINARY_ENCODING);\n\t\t\t\t\theaders['content-length'] = (responseBody as Buffer).length;\n\t\t\t\t}\n\n\t\t\t\tif (!headers['content-type']) {\n\t\t\t\t\theaders['content-type'] = binaryData.mimeType;\n\t\t\t\t}\n\t\t\t} else if (respondWith === 'redirect') {\n\t\t\t\theaders.location = this.getNodeParameter('redirectURL', 0) as string;\n\t\t\t\tstatusCode = (options.responseCode as number) ?? 307;\n\t\t\t} else if (respondWith !== 'noData') {\n\t\t\t\tthrow new NodeOperationError(\n\t\t\t\t\tthis.getNode(),\n\t\t\t\t\t`The Response Data option \"${respondWith}\" is not supported!`,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tresponse = {\n\t\t\t\tbody: responseBody,\n\t\t\t\theaders,\n\t\t\t\tstatusCode,\n\t\t\t};\n\n\t\t\tthis.sendResponse(response);\n\t\t} catch (error) {\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\tconst itemData = generatePairedItemData(items.length);\n\t\t\t\tconst returnData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\t[{ json: { error: error.message } }],\n\t\t\t\t\t{ itemData },\n\t\t\t\t);\n\t\t\t\treturn [returnData];\n\t\t\t}\n\n\t\t\tthrow error;\n\t\t}\n\n\t\tif (nodeVersion >= 1.3) {\n\t\t\treturn [items, [{ json: { response } }]];\n\t\t}\n\n\t\treturn [items];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAgB;AAChB,iBAAgB;AAWhB,0BASO;AAGP,mBAAkC;AAClC,uBAAyD;AAEzD,MAAM,sBAAuC;AAAA,EAC5C,aAAa;AAAA,EACb,MAAM;AAAA,EACN,MAAM;AAAA,EACN,SAAS;AAAA,IACR;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,IACA;AAAA,MACC,MAAM;AAAA,MACN,OAAO;AAAA,MACP,aAAa;AAAA,IACd;AAAA,EACD;AAAA,EACA,SAAS;AAAA,EACT,aAAa;AACd;AAEO,MAAM,iBAAsC;AAAA,EAA5C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,M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EAAE,CAAC;AAAA,UACnC,EAAE,SAAS;AAAA,QACZ;AACA,eAAO,CAAC,UAAU;AAAA,MACnB;AAEA,YAAM;AAAA,IACP;AAEA,QAAI,eAAe,KAAK;AACvB,aAAO,CAAC,OAAO,CAAC,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC;AAAA,IACxC;AAEA,WAAO,CAAC,KAAK;AAAA,EACd;AACD;","names":["jwt","set"]}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
var utils_exports = {};
|
|
20
|
+
__export(utils_exports, {
|
|
21
|
+
configuredOutputs: () => configuredOutputs
|
|
22
|
+
});
|
|
23
|
+
module.exports = __toCommonJS(utils_exports);
|
|
24
|
+
const configuredOutputs = (version) => {
|
|
25
|
+
if (version >= 1.3) {
|
|
26
|
+
return [
|
|
27
|
+
{
|
|
28
|
+
type: "main",
|
|
29
|
+
displayName: "Input Data"
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
type: "main",
|
|
33
|
+
displayName: "Response"
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
}
|
|
37
|
+
return ["main"];
|
|
38
|
+
};
|
|
39
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
40
|
+
0 && (module.exports = {
|
|
41
|
+
configuredOutputs
|
|
42
|
+
});
|
|
43
|
+
//# sourceMappingURL=utils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../nodes/RespondToWebhook/utils.ts"],"sourcesContent":["export const configuredOutputs = (version: number) => {\n\tif (version >= 1.3) {\n\t\treturn [\n\t\t\t{\n\t\t\t\ttype: 'main',\n\t\t\t\tdisplayName: 'Input Data',\n\t\t\t},\n\t\t\t{\n\t\t\t\ttype: 'main',\n\t\t\t\tdisplayName: 'Response',\n\t\t\t},\n\t\t];\n\t}\n\n\treturn ['main'];\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,oBAAoB,CAAC,YAAoB;AACrD,MAAI,WAAW,KAAK;AACnB,WAAO;AAAA,MACN;AAAA,QACC,MAAM;AAAA,QACN,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,aAAa;AAAA,MACd;AAAA,IACD;AAAA,EACD;AAEA,SAAO,CAAC,MAAM;AACf;","names":[]}
|
|
@@ -54,7 +54,7 @@ class ScheduleTrigger {
|
|
|
54
54
|
outputs: [import_n8n_workflow.NodeConnectionTypes.Main],
|
|
55
55
|
properties: [
|
|
56
56
|
{
|
|
57
|
-
displayName: `This workflow will run on the schedule you define here once you <a data-key="activate">activate</a> it.<br><br>For testing, you can also trigger it manually: by going back to the canvas and clicking '
|
|
57
|
+
displayName: `This workflow will run on the schedule you define here once you <a data-key="activate">activate</a> it.<br><br>For testing, you can also trigger it manually: by going back to the canvas and clicking 'execute workflow'`,
|
|
58
58
|
name: "notice",
|
|
59
59
|
type: "notice",
|
|
60
60
|
default: ""
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Schedule/ScheduleTrigger.node.ts"],"sourcesContent":["import { sendAt } from 'cron';\nimport moment from 'moment-timezone';\nimport type {\n\tITriggerFunctions,\n\tINodeType,\n\tINodeTypeDescription,\n\tITriggerResponse,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport { intervalToRecurrence, recurrenceCheck, toCronExpression } from './GenericFunctions';\nimport type { IRecurrenceRule, Rule } from './SchedulerInterface';\n\nexport class ScheduleTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Schedule Trigger',\n\t\tname: 'scheduleTrigger',\n\t\ticon: 'fa:clock',\n\t\tgroup: ['trigger', 'schedule'],\n\t\tversion: [1, 1.1, 1.2],\n\t\tdescription: 'Triggers the workflow on a given schedule',\n\t\teventTriggerDescription: '',\n\t\tactivationMessage:\n\t\t\t'Your schedule trigger will now trigger executions on the schedule you have defined.',\n\t\tdefaults: {\n\t\t\tname: 'Schedule Trigger',\n\t\t\tcolor: '#31C49F',\n\t\t},\n\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'This workflow will run on the schedule you define here once you <a data-key=\"activate\">activate</a> it.<br><br>For testing, you can also trigger it manually: by going back to the canvas and clicking \\'test workflow\\'',\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Trigger Rules',\n\t\t\t\tname: 'rule',\n\t\t\t\tplaceholder: 'Add Rule',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t},\n\t\t\t\tdefault: {\n\t\t\t\t\tinterval: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'days',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'interval',\n\t\t\t\t\t\tdisplayName: 'Trigger Interval',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger Interval',\n\t\t\t\t\t\t\t\tname: 'field',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdefault: 'days',\n\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Seconds',\n\t\t\t\t\t\t\t\t\t\tvalue: 'seconds',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Minutes',\n\t\t\t\t\t\t\t\t\t\tvalue: 'minutes',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Hours',\n\t\t\t\t\t\t\t\t\t\tvalue: 'hours',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Days',\n\t\t\t\t\t\t\t\t\t\tvalue: 'days',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Weeks',\n\t\t\t\t\t\t\t\t\t\tvalue: 'weeks',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Months',\n\t\t\t\t\t\t\t\t\t\tvalue: 'months',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Custom (Cron)',\n\t\t\t\t\t\t\t\t\t\tvalue: 'cronExpression',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Seconds Between Triggers',\n\t\t\t\t\t\t\t\tname: 'secondsInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdefault: 30,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['seconds'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'Number of seconds between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Minutes Between Triggers',\n\t\t\t\t\t\t\t\tname: 'minutesInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdefault: 5,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['minutes'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'Number of minutes between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Hours Between Triggers',\n\t\t\t\t\t\t\t\tname: 'hoursInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['hours'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Number of hours between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Days Between Triggers',\n\t\t\t\t\t\t\t\tname: 'daysInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['days'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Number of days between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Weeks Between Triggers',\n\t\t\t\t\t\t\t\tname: 'weeksInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['weeks'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Would run every week unless specified otherwise',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Months Between Triggers',\n\t\t\t\t\t\t\t\tname: 'monthsInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Would run every month unless specified otherwise',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger at Day of Month',\n\t\t\t\t\t\t\t\tname: 'triggerAtDayOfMonth',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tminValue: 1,\n\t\t\t\t\t\t\t\t\tmaxValue: 31,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'The day of the month to trigger (1-31)',\n\t\t\t\t\t\t\t\thint: 'If a month doesn’t have this day, the node won’t trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger on Weekdays',\n\t\t\t\t\t\t\t\tname: 'triggerAtDay',\n\t\t\t\t\t\t\t\ttype: 'multiOptions',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['weeks'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tmaxValue: 7,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Monday',\n\t\t\t\t\t\t\t\t\t\tvalue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Tuesday',\n\t\t\t\t\t\t\t\t\t\tvalue: 2,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Wednesday',\n\t\t\t\t\t\t\t\t\t\tvalue: 3,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Thursday',\n\t\t\t\t\t\t\t\t\t\tvalue: 4,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Friday',\n\t\t\t\t\t\t\t\t\t\tvalue: 5,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Saturday',\n\t\t\t\t\t\t\t\t\t\tvalue: 6,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Sunday',\n\t\t\t\t\t\t\t\t\t\tvalue: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tdefault: [0],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger at Hour',\n\t\t\t\t\t\t\t\tname: 'triggerAtHour',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdefault: 0,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['days', 'weeks', 'months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Midnight',\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Midnight',\n\t\t\t\t\t\t\t\t\t\tvalue: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '1am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '1am',\n\t\t\t\t\t\t\t\t\t\tvalue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '2am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '2am',\n\t\t\t\t\t\t\t\t\t\tvalue: 2,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '3am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '3am',\n\t\t\t\t\t\t\t\t\t\tvalue: 3,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '4am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '4am',\n\t\t\t\t\t\t\t\t\t\tvalue: 4,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '5am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '5am',\n\t\t\t\t\t\t\t\t\t\tvalue: 5,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '6am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '6am',\n\t\t\t\t\t\t\t\t\t\tvalue: 6,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '7am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '7am',\n\t\t\t\t\t\t\t\t\t\tvalue: 7,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '8am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '8am',\n\t\t\t\t\t\t\t\t\t\tvalue: 8,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '9am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '9am',\n\t\t\t\t\t\t\t\t\t\tvalue: 9,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '10am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '10am',\n\t\t\t\t\t\t\t\t\t\tvalue: 10,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '11am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '11am',\n\t\t\t\t\t\t\t\t\t\tvalue: 11,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Noon',\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Noon',\n\t\t\t\t\t\t\t\t\t\tvalue: 12,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '1pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '1pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 13,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '2pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '2pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 14,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '3pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '3pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 15,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '4pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '4pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 16,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '5pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '5pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 17,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '6pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '6pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 18,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '7pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '7pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 19,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '8pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '8pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 20,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '9pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '9pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 21,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '10pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '10pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 22,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '11pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '11pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 23,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tdescription: 'The hour of the day to trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger at Minute',\n\t\t\t\t\t\t\t\tname: 'triggerAtMinute',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdefault: 0,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['hours', 'days', 'weeks', 'months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tminValue: 0,\n\t\t\t\t\t\t\t\t\tmaxValue: 59,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'The minute past the hour to trigger (0-59)',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t\t\t\t'You can find help generating your cron expression <a href=\"https://crontab.guru/examples.html\" target=\"_blank\">here</a>',\n\t\t\t\t\t\t\t\tname: 'notice',\n\t\t\t\t\t\t\t\ttype: 'notice',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['cronExpression'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Expression',\n\t\t\t\t\t\t\t\tname: 'expression',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\tplaceholder: 'eg. 0 15 * 1 sun',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['cronExpression'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\thint: 'Format: [Second] [Minute] [Hour] [Day of Month] [Month] [Day of Week]',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst { interval: intervals } = this.getNodeParameter('rule', []) as Rule;\n\t\tconst timezone = this.getTimezone();\n\t\tconst staticData = this.getWorkflowStaticData('node') as {\n\t\t\trecurrenceRules: number[];\n\t\t};\n\t\tif (!staticData.recurrenceRules) {\n\t\t\tstaticData.recurrenceRules = [];\n\t\t}\n\n\t\tconst executeTrigger = (recurrence: IRecurrenceRule) => {\n\t\t\tconst shouldTrigger = recurrenceCheck(recurrence, staticData.recurrenceRules, timezone);\n\t\t\tif (!shouldTrigger) return;\n\n\t\t\tconst momentTz = moment.tz(timezone);\n\t\t\tconst resultData = {\n\t\t\t\ttimestamp: momentTz.toISOString(true),\n\t\t\t\t'Readable date': momentTz.format('MMMM Do YYYY, h:mm:ss a'),\n\t\t\t\t'Readable time': momentTz.format('h:mm:ss a'),\n\t\t\t\t'Day of week': momentTz.format('dddd'),\n\t\t\t\tYear: momentTz.format('YYYY'),\n\t\t\t\tMonth: momentTz.format('MMMM'),\n\t\t\t\t'Day of month': momentTz.format('DD'),\n\t\t\t\tHour: momentTz.format('HH'),\n\t\t\t\tMinute: momentTz.format('mm'),\n\t\t\t\tSecond: momentTz.format('ss'),\n\t\t\t\tTimezone: `${timezone} (UTC${momentTz.format('Z')})`,\n\t\t\t};\n\n\t\t\tthis.emit([this.helpers.returnJsonArray([resultData])]);\n\t\t};\n\n\t\tconst rules = intervals.map((interval, i) => ({\n\t\t\tinterval,\n\t\t\tcronExpression: toCronExpression(interval),\n\t\t\trecurrence: intervalToRecurrence(interval, i),\n\t\t}));\n\n\t\tif (this.getMode() !== 'manual') {\n\t\t\tfor (const { interval, cronExpression, recurrence } of rules) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.helpers.registerCron(cronExpression, () => executeTrigger(recurrence));\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (interval.field === 'cronExpression') {\n\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Invalid cron expression', {\n\t\t\t\t\t\t\tdescription: 'More information on how to build them at https://crontab.guru/',\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {};\n\t\t} else {\n\t\t\tconst manualTriggerFunction = async () => {\n\t\t\t\tconst { interval, cronExpression, recurrence } = rules[0];\n\t\t\t\tif (interval.field === 'cronExpression') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsendAt(cronExpression);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Invalid cron expression', {\n\t\t\t\t\t\t\tdescription: 'More information on how to build them at https://crontab.guru/',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\texecuteTrigger(recurrence);\n\t\t\t};\n\n\t\t\treturn { manualTriggerFunction };\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,6BAAmB;AAOnB,0BAAwD;AAExD,8BAAwE;AAGjE,MAAM,gBAAqC;AAAA,EAA3C;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW,UAAU;AAAA,MAC7B,SAAS,CAAC,GAAG,KAAK,GAAG;AAAA,MACrB,aAAa;AAAA,MACb,yBAAyB;AAAA,MACzB,mBACC;AAAA,MACD,UAAU;AAAA,QACT,MAAM;AAAA,QACN,OAAO;AAAA,MACR;AAAA,MAEA,QAAQ,CAAC;AAAA,MACT,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,YAAY;AAAA,QACX;AAAA,UACC,aACC;AAAA,UACD,MAAM;AAAA,UACN,MAAM;AAAA,UACN,SAAS;AAAA,QACV;AAAA,QACA;AAAA,UACC,aAAa;AAA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AAa;AAAA,YACd,CAAC;AAAA,UACF,OAAO;AACN,kBAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AACA,aAAO,CAAC;AAAA,IACT,OAAO;AACN,YAAM,wBAAwB,YAAY;AACzC,cAAM,EAAE,UAAU,gBAAgB,WAAW,IAAI,MAAM,CAAC;AACxD,YAAI,SAAS,UAAU,kBAAkB;AACxC,cAAI;AACH,oCAAO,cAAc;AAAA,UACtB,SAAS,OAAO;AACf,kBAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,2BAA2B;AAAA,cACvE,aAAa;AAAA,YACd,CAAC;AAAA,UACF;AAAA,QACD;AACA,uBAAe,UAAU;AAAA,MAC1B;AAEA,aAAO,EAAE,sBAAsB;AAAA,IAChC;AAAA,EACD;AACD;","names":["moment"]}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Schedule/ScheduleTrigger.node.ts"],"sourcesContent":["import { sendAt } from 'cron';\nimport moment from 'moment-timezone';\nimport type {\n\tITriggerFunctions,\n\tINodeType,\n\tINodeTypeDescription,\n\tITriggerResponse,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError } from 'n8n-workflow';\n\nimport { intervalToRecurrence, recurrenceCheck, toCronExpression } from './GenericFunctions';\nimport type { IRecurrenceRule, Rule } from './SchedulerInterface';\n\nexport class ScheduleTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Schedule Trigger',\n\t\tname: 'scheduleTrigger',\n\t\ticon: 'fa:clock',\n\t\tgroup: ['trigger', 'schedule'],\n\t\tversion: [1, 1.1, 1.2],\n\t\tdescription: 'Triggers the workflow on a given schedule',\n\t\teventTriggerDescription: '',\n\t\tactivationMessage:\n\t\t\t'Your schedule trigger will now trigger executions on the schedule you have defined.',\n\t\tdefaults: {\n\t\t\tname: 'Schedule Trigger',\n\t\t\tcolor: '#31C49F',\n\t\t},\n\n\t\tinputs: [],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName:\n\t\t\t\t\t'This workflow will run on the schedule you define here once you <a data-key=\"activate\">activate</a> it.<br><br>For testing, you can also trigger it manually: by going back to the canvas and clicking \\'execute workflow\\'',\n\t\t\t\tname: 'notice',\n\t\t\t\ttype: 'notice',\n\t\t\t\tdefault: '',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Trigger Rules',\n\t\t\t\tname: 'rule',\n\t\t\t\tplaceholder: 'Add Rule',\n\t\t\t\ttype: 'fixedCollection',\n\t\t\t\ttypeOptions: {\n\t\t\t\t\tmultipleValues: true,\n\t\t\t\t},\n\t\t\t\tdefault: {\n\t\t\t\t\tinterval: [\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\tfield: 'days',\n\t\t\t\t\t\t},\n\t\t\t\t\t],\n\t\t\t\t},\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'interval',\n\t\t\t\t\t\tdisplayName: 'Trigger Interval',\n\t\t\t\t\t\tvalues: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger Interval',\n\t\t\t\t\t\t\t\tname: 'field',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdefault: 'days',\n\t\t\t\t\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-options-type-unsorted-items\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Seconds',\n\t\t\t\t\t\t\t\t\t\tvalue: 'seconds',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Minutes',\n\t\t\t\t\t\t\t\t\t\tvalue: 'minutes',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Hours',\n\t\t\t\t\t\t\t\t\t\tvalue: 'hours',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Days',\n\t\t\t\t\t\t\t\t\t\tvalue: 'days',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Weeks',\n\t\t\t\t\t\t\t\t\t\tvalue: 'weeks',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Months',\n\t\t\t\t\t\t\t\t\t\tvalue: 'months',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Custom (Cron)',\n\t\t\t\t\t\t\t\t\t\tvalue: 'cronExpression',\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Seconds Between Triggers',\n\t\t\t\t\t\t\t\tname: 'secondsInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdefault: 30,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['seconds'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'Number of seconds between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Minutes Between Triggers',\n\t\t\t\t\t\t\t\tname: 'minutesInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdefault: 5,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['minutes'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'Number of minutes between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Hours Between Triggers',\n\t\t\t\t\t\t\t\tname: 'hoursInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['hours'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Number of hours between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Days Between Triggers',\n\t\t\t\t\t\t\t\tname: 'daysInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['days'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Number of days between each workflow trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Weeks Between Triggers',\n\t\t\t\t\t\t\t\tname: 'weeksInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['weeks'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Would run every week unless specified otherwise',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Months Between Triggers',\n\t\t\t\t\t\t\t\tname: 'monthsInterval',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'Would run every month unless specified otherwise',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger at Day of Month',\n\t\t\t\t\t\t\t\tname: 'triggerAtDayOfMonth',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tminValue: 1,\n\t\t\t\t\t\t\t\t\tmaxValue: 31,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: 1,\n\t\t\t\t\t\t\t\tdescription: 'The day of the month to trigger (1-31)',\n\t\t\t\t\t\t\t\thint: 'If a month doesn’t have this day, the node won’t trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger on Weekdays',\n\t\t\t\t\t\t\t\tname: 'triggerAtDay',\n\t\t\t\t\t\t\t\ttype: 'multiOptions',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['weeks'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tmaxValue: 7,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Monday',\n\t\t\t\t\t\t\t\t\t\tvalue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Tuesday',\n\t\t\t\t\t\t\t\t\t\tvalue: 2,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Wednesday',\n\t\t\t\t\t\t\t\t\t\tvalue: 3,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Thursday',\n\t\t\t\t\t\t\t\t\t\tvalue: 4,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Friday',\n\t\t\t\t\t\t\t\t\t\tvalue: 5,\n\t\t\t\t\t\t\t\t\t},\n\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Saturday',\n\t\t\t\t\t\t\t\t\t\tvalue: 6,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Sunday',\n\t\t\t\t\t\t\t\t\t\tvalue: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tdefault: [0],\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger at Hour',\n\t\t\t\t\t\t\t\tname: 'triggerAtHour',\n\t\t\t\t\t\t\t\ttype: 'options',\n\t\t\t\t\t\t\t\tdefault: 0,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['days', 'weeks', 'months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\toptions: [\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Midnight',\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Midnight',\n\t\t\t\t\t\t\t\t\t\tvalue: 0,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '1am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '1am',\n\t\t\t\t\t\t\t\t\t\tvalue: 1,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '2am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '2am',\n\t\t\t\t\t\t\t\t\t\tvalue: 2,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '3am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '3am',\n\t\t\t\t\t\t\t\t\t\tvalue: 3,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '4am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '4am',\n\t\t\t\t\t\t\t\t\t\tvalue: 4,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '5am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '5am',\n\t\t\t\t\t\t\t\t\t\tvalue: 5,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '6am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '6am',\n\t\t\t\t\t\t\t\t\t\tvalue: 6,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '7am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '7am',\n\t\t\t\t\t\t\t\t\t\tvalue: 7,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '8am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '8am',\n\t\t\t\t\t\t\t\t\t\tvalue: 8,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '9am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '9am',\n\t\t\t\t\t\t\t\t\t\tvalue: 9,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '10am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '10am',\n\t\t\t\t\t\t\t\t\t\tvalue: 10,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '11am',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '11am',\n\t\t\t\t\t\t\t\t\t\tvalue: 11,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: 'Noon',\n\t\t\t\t\t\t\t\t\t\tdisplayName: 'Noon',\n\t\t\t\t\t\t\t\t\t\tvalue: 12,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '1pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '1pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 13,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '2pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '2pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 14,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '3pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '3pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 15,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '4pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '4pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 16,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '5pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '5pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 17,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '6pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '6pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 18,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '7pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '7pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 19,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '8pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '8pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 20,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '9pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '9pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 21,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '10pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '10pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 22,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t\tname: '11pm',\n\t\t\t\t\t\t\t\t\t\tdisplayName: '11pm',\n\t\t\t\t\t\t\t\t\t\tvalue: 23,\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t],\n\t\t\t\t\t\t\t\tdescription: 'The hour of the day to trigger',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Trigger at Minute',\n\t\t\t\t\t\t\t\tname: 'triggerAtMinute',\n\t\t\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\t\t\tdefault: 0,\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['hours', 'days', 'weeks', 'months'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\t\t\tminValue: 0,\n\t\t\t\t\t\t\t\t\tmaxValue: 59,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdescription: 'The minute past the hour to trigger (0-59)',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName:\n\t\t\t\t\t\t\t\t\t'You can find help generating your cron expression <a href=\"https://crontab.guru/examples.html\" target=\"_blank\">here</a>',\n\t\t\t\t\t\t\t\tname: 'notice',\n\t\t\t\t\t\t\t\ttype: 'notice',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['cronExpression'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tdisplayName: 'Expression',\n\t\t\t\t\t\t\t\tname: 'expression',\n\t\t\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t\t\t\tplaceholder: 'eg. 0 15 * 1 sun',\n\t\t\t\t\t\t\t\tdisplayOptions: {\n\t\t\t\t\t\t\t\t\tshow: {\n\t\t\t\t\t\t\t\t\t\tfield: ['cronExpression'],\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\thint: 'Format: [Second] [Minute] [Hour] [Day of Month] [Month] [Day of Week]',\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t],\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst { interval: intervals } = this.getNodeParameter('rule', []) as Rule;\n\t\tconst timezone = this.getTimezone();\n\t\tconst staticData = this.getWorkflowStaticData('node') as {\n\t\t\trecurrenceRules: number[];\n\t\t};\n\t\tif (!staticData.recurrenceRules) {\n\t\t\tstaticData.recurrenceRules = [];\n\t\t}\n\n\t\tconst executeTrigger = (recurrence: IRecurrenceRule) => {\n\t\t\tconst shouldTrigger = recurrenceCheck(recurrence, staticData.recurrenceRules, timezone);\n\t\t\tif (!shouldTrigger) return;\n\n\t\t\tconst momentTz = moment.tz(timezone);\n\t\t\tconst resultData = {\n\t\t\t\ttimestamp: momentTz.toISOString(true),\n\t\t\t\t'Readable date': momentTz.format('MMMM Do YYYY, h:mm:ss a'),\n\t\t\t\t'Readable time': momentTz.format('h:mm:ss a'),\n\t\t\t\t'Day of week': momentTz.format('dddd'),\n\t\t\t\tYear: momentTz.format('YYYY'),\n\t\t\t\tMonth: momentTz.format('MMMM'),\n\t\t\t\t'Day of month': momentTz.format('DD'),\n\t\t\t\tHour: momentTz.format('HH'),\n\t\t\t\tMinute: momentTz.format('mm'),\n\t\t\t\tSecond: momentTz.format('ss'),\n\t\t\t\tTimezone: `${timezone} (UTC${momentTz.format('Z')})`,\n\t\t\t};\n\n\t\t\tthis.emit([this.helpers.returnJsonArray([resultData])]);\n\t\t};\n\n\t\tconst rules = intervals.map((interval, i) => ({\n\t\t\tinterval,\n\t\t\tcronExpression: toCronExpression(interval),\n\t\t\trecurrence: intervalToRecurrence(interval, i),\n\t\t}));\n\n\t\tif (this.getMode() !== 'manual') {\n\t\t\tfor (const { interval, cronExpression, recurrence } of rules) {\n\t\t\t\ttry {\n\t\t\t\t\tthis.helpers.registerCron(cronExpression, () => executeTrigger(recurrence));\n\t\t\t\t} catch (error) {\n\t\t\t\t\tif (interval.field === 'cronExpression') {\n\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Invalid cron expression', {\n\t\t\t\t\t\t\tdescription: 'More information on how to build them at https://crontab.guru/',\n\t\t\t\t\t\t});\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\treturn {};\n\t\t} else {\n\t\t\tconst manualTriggerFunction = async () => {\n\t\t\t\tconst { interval, cronExpression, recurrence } = rules[0];\n\t\t\t\tif (interval.field === 'cronExpression') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tsendAt(cronExpression);\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Invalid cron expression', {\n\t\t\t\t\t\t\tdescription: 'More information on how to build them at https://crontab.guru/',\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\texecuteTrigger(recurrence);\n\t\t\t};\n\n\t\t\treturn { manualTriggerFunction };\n\t\t}\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAuB;AACvB,6BAAmB;AAOnB,0BAAwD;AAExD,8BAAwE;AAGjE,MAAM,gBAAqC;A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,CAAC,CAAC,CAAC;AAAA,IACvD;AAEA,UAAM,QAAQ,UAAU,IAAI,CAAC,UAAU,OAAO;AAAA,MAC7C;AAAA,MACA,oBAAgB,0CAAiB,QAAQ;AAAA,MACzC,gBAAY,8CAAqB,UAAU,CAAC;AAAA,IAC7C,EAAE;AAEF,QAAI,KAAK,QAAQ,MAAM,UAAU;AAChC,iBAAW,EAAE,UAAU,gBAAgB,WAAW,KAAK,OAAO;AAC7D,YAAI;AACH,eAAK,QAAQ,aAAa,gBAAgB,MAAM,eAAe,UAAU,CAAC;AAAA,QAC3E,SAAS,OAAO;AACf,cAAI,SAAS,UAAU,kBAAkB;AACxC,kBAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,2BAA2B;AAAA,cACvE,aAAa;AAAA,YACd,CAAC;AAAA,UACF,OAAO;AACN,kBAAM;AAAA,UACP;AAAA,QACD;AAAA,MACD;AACA,aAAO,CAAC;AAAA,IACT,OAAO;AACN,YAAM,wBAAwB,YAAY;AACzC,cAAM,EAAE,UAAU,gBAAgB,WAAW,IAAI,MAAM,CAAC;AACxD,YAAI,SAAS,UAAU,kBAAkB;AACxC,cAAI;AACH,oCAAO,cAAc;AAAA,UACtB,SAAS,OAAO;AACf,kBAAM,IAAI,uCAAmB,KAAK,QAAQ,GAAG,2BAA2B;AAAA,cACvE,aAAa;AAAA,YACd,CAAC;AAAA,UACF;AAAA,QACD;AACA,uBAAe,UAAU;AAAA,MAC1B;AAEA,aAAO,EAAE,sBAAsB;AAAA,IAChC;AAAA,EACD;AACD;","names":["moment"]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __create = Object.create;
|
|
2
3
|
var __defProp = Object.defineProperty;
|
|
3
4
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
5
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
8
|
var __export = (target, all) => {
|
|
7
9
|
for (var name in all)
|
|
@@ -15,14 +17,43 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
15
17
|
}
|
|
16
18
|
return to;
|
|
17
19
|
};
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
+
mod
|
|
27
|
+
));
|
|
18
28
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
29
|
var GenericFunctions_exports = {};
|
|
20
30
|
__export(GenericFunctions_exports, {
|
|
21
31
|
connect: () => connect,
|
|
22
32
|
destroy: () => destroy,
|
|
23
|
-
execute: () => execute
|
|
33
|
+
execute: () => execute,
|
|
34
|
+
getConnectionOptions: () => getConnectionOptions
|
|
24
35
|
});
|
|
25
36
|
module.exports = __toCommonJS(GenericFunctions_exports);
|
|
37
|
+
var import_pick = __toESM(require("lodash/pick"));
|
|
38
|
+
const commonConnectionFields = [
|
|
39
|
+
"account",
|
|
40
|
+
"database",
|
|
41
|
+
"schema",
|
|
42
|
+
"warehouse",
|
|
43
|
+
"role",
|
|
44
|
+
"clientSessionKeepAlive"
|
|
45
|
+
];
|
|
46
|
+
const getConnectionOptions = (credential) => {
|
|
47
|
+
const connectionOptions = (0, import_pick.default)(credential, commonConnectionFields);
|
|
48
|
+
if (credential.authentication === "keyPair") {
|
|
49
|
+
connectionOptions.authenticator = "SNOWFLAKE_JWT";
|
|
50
|
+
connectionOptions.privateKey = credential.privateKey;
|
|
51
|
+
} else {
|
|
52
|
+
connectionOptions.username = credential.username;
|
|
53
|
+
connectionOptions.password = credential.password;
|
|
54
|
+
}
|
|
55
|
+
return connectionOptions;
|
|
56
|
+
};
|
|
26
57
|
async function connect(conn) {
|
|
27
58
|
return await new Promise((resolve, reject) => {
|
|
28
59
|
conn.connect((error) => error ? reject(error) : resolve());
|
|
@@ -46,6 +77,7 @@ async function execute(conn, sqlText, binds) {
|
|
|
46
77
|
0 && (module.exports = {
|
|
47
78
|
connect,
|
|
48
79
|
destroy,
|
|
49
|
-
execute
|
|
80
|
+
execute,
|
|
81
|
+
getConnectionOptions
|
|
50
82
|
});
|
|
51
83
|
//# sourceMappingURL=GenericFunctions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Snowflake/GenericFunctions.ts"],"sourcesContent":["import type snowflake from 'snowflake-sdk';\n\nexport async function connect(conn: snowflake.Connection) {\n\treturn await new Promise<void>((resolve, reject) => {\n\t\tconn.connect((error) => (error ? reject(error) : resolve()));\n\t});\n}\n\nexport async function destroy(conn: snowflake.Connection) {\n\treturn await new Promise<void>((resolve, reject) => {\n\t\tconn.destroy((error) => (error ? reject(error) : resolve()));\n\t});\n}\n\nexport async function execute(\n\tconn: snowflake.Connection,\n\tsqlText: string,\n\tbinds: snowflake.InsertBinds,\n) {\n\treturn await new Promise<any[] | undefined>((resolve, reject) => {\n\t\tconn.execute({\n\t\t\tsqlText,\n\t\t\tbinds,\n\t\t\tcomplete: (error, _, rows) => (error ? reject(error) : resolve(rows)),\n\t\t});\n\t});\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Snowflake/GenericFunctions.ts"],"sourcesContent":["import pick from 'lodash/pick';\nimport type snowflake from 'snowflake-sdk';\n\nconst commonConnectionFields = [\n\t'account',\n\t'database',\n\t'schema',\n\t'warehouse',\n\t'role',\n\t'clientSessionKeepAlive',\n] as const;\n\nexport type SnowflakeCredential = Pick<\n\tsnowflake.ConnectionOptions,\n\t(typeof commonConnectionFields)[number]\n> &\n\t(\n\t\t| {\n\t\t\t\tauthentication: 'password';\n\t\t\t\tusername?: string;\n\t\t\t\tpassword?: string;\n\t\t }\n\t\t| {\n\t\t\t\tauthentication: 'keyPair';\n\t\t\t\tprivateKey: string;\n\t\t }\n\t);\n\nexport const getConnectionOptions = (credential: SnowflakeCredential) => {\n\tconst connectionOptions: snowflake.ConnectionOptions = pick(credential, commonConnectionFields);\n\tif (credential.authentication === 'keyPair') {\n\t\tconnectionOptions.authenticator = 'SNOWFLAKE_JWT';\n\t\tconnectionOptions.privateKey = credential.privateKey;\n\t} else {\n\t\tconnectionOptions.username = credential.username;\n\t\tconnectionOptions.password = credential.password;\n\t}\n\treturn connectionOptions;\n};\n\nexport async function connect(conn: snowflake.Connection) {\n\treturn await new Promise<void>((resolve, reject) => {\n\t\tconn.connect((error) => (error ? reject(error) : resolve()));\n\t});\n}\n\nexport async function destroy(conn: snowflake.Connection) {\n\treturn await new Promise<void>((resolve, reject) => {\n\t\tconn.destroy((error) => (error ? reject(error) : resolve()));\n\t});\n}\n\nexport async function execute(\n\tconn: snowflake.Connection,\n\tsqlText: string,\n\tbinds: snowflake.InsertBinds,\n) {\n\treturn await new Promise<any[] | undefined>((resolve, reject) => {\n\t\tconn.execute({\n\t\t\tsqlText,\n\t\t\tbinds,\n\t\t\tcomplete: (error, _, rows) => (error ? reject(error) : resolve(rows)),\n\t\t});\n\t});\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,kBAAiB;AAGjB,MAAM,yBAAyB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD;AAkBO,MAAM,uBAAuB,CAAC,eAAoC;AACxE,QAAM,wBAAiD,YAAAA,SAAK,YAAY,sBAAsB;AAC9F,MAAI,WAAW,mBAAmB,WAAW;AAC5C,sBAAkB,gBAAgB;AAClC,sBAAkB,aAAa,WAAW;AAAA,EAC3C,OAAO;AACN,sBAAkB,WAAW,WAAW;AACxC,sBAAkB,WAAW,WAAW;AAAA,EACzC;AACA,SAAO;AACR;AAEA,eAAsB,QAAQ,MAA4B;AACzD,SAAO,MAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AACnD,SAAK,QAAQ,CAAC,UAAW,QAAQ,OAAO,KAAK,IAAI,QAAQ,CAAE;AAAA,EAC5D,CAAC;AACF;AAEA,eAAsB,QAAQ,MAA4B;AACzD,SAAO,MAAM,IAAI,QAAc,CAAC,SAAS,WAAW;AACnD,SAAK,QAAQ,CAAC,UAAW,QAAQ,OAAO,KAAK,IAAI,QAAQ,CAAE;AAAA,EAC5D,CAAC;AACF;AAEA,eAAsB,QACrB,MACA,SACA,OACC;AACD,SAAO,MAAM,IAAI,QAA2B,CAAC,SAAS,WAAW;AAChE,SAAK,QAAQ;AAAA,MACZ;AAAA,MACA;AAAA,MACA,UAAU,CAAC,OAAO,GAAG,SAAU,QAAQ,OAAO,KAAK,IAAI,QAAQ,IAAI;AAAA,IACpE,CAAC;AAAA,EACF,CAAC;AACF;","names":["pick"]}
|
|
@@ -182,13 +182,11 @@ class Snowflake {
|
|
|
182
182
|
};
|
|
183
183
|
}
|
|
184
184
|
async execute() {
|
|
185
|
-
const credentials = await this.getCredentials(
|
|
186
|
-
|
|
187
|
-
);
|
|
188
|
-
const returnData = [];
|
|
189
|
-
let responseData;
|
|
190
|
-
const connection = import_snowflake_sdk.default.createConnection(credentials);
|
|
185
|
+
const credentials = await this.getCredentials("snowflake");
|
|
186
|
+
const connectionOptions = (0, import_GenericFunctions.getConnectionOptions)(credentials);
|
|
187
|
+
const connection = import_snowflake_sdk.default.createConnection(connectionOptions);
|
|
191
188
|
await (0, import_GenericFunctions.connect)(connection);
|
|
189
|
+
const returnData = [];
|
|
192
190
|
const items = this.getInputData();
|
|
193
191
|
const operation = this.getNodeParameter("operation", 0);
|
|
194
192
|
if (operation === "executeQuery") {
|
|
@@ -197,7 +195,7 @@ class Snowflake {
|
|
|
197
195
|
for (const resolvable of (0, import_utilities.getResolvables)(query)) {
|
|
198
196
|
query = query.replace(resolvable, this.evaluateExpression(resolvable, i));
|
|
199
197
|
}
|
|
200
|
-
responseData = await (0, import_GenericFunctions.execute)(connection, query, []);
|
|
198
|
+
const responseData = await (0, import_GenericFunctions.execute)(connection, query, []);
|
|
201
199
|
const executionData = this.helpers.constructExecutionMetaData(
|
|
202
200
|
this.helpers.returnJsonArray(responseData),
|
|
203
201
|
{ itemData: { item: i } }
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Snowflake/Snowflake.node.ts"],"sourcesContent":["import type {\n\tIExecuteFunctions,\n\tIDataObject,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\nimport snowflake from 'snowflake-sdk';\n\nimport { getResolvables } from '@utils/utilities';\n\nimport { connect, destroy, execute } from './GenericFunctions';\n\nexport class Snowflake implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Snowflake',\n\t\tname: 'snowflake',\n\t\ticon: 'file:snowflake.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tdescription: 'Get, add and update data in Snowflake',\n\t\tdefaults: {\n\t\t\tname: 'Snowflake',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tparameterPane: 'wide',\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'snowflake',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Operation',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Execute Query',\n\t\t\t\t\t\tvalue: 'executeQuery',\n\t\t\t\t\t\tdescription: 'Execute an SQL query',\n\t\t\t\t\t\taction: 'Execute a SQL query',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Insert',\n\t\t\t\t\t\tvalue: 'insert',\n\t\t\t\t\t\tdescription: 'Insert rows in database',\n\t\t\t\t\t\taction: 'Insert rows in database',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Update',\n\t\t\t\t\t\tvalue: 'update',\n\t\t\t\t\t\tdescription: 'Update rows in database',\n\t\t\t\t\t\taction: 'Update rows in database',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'insert',\n\t\t\t},\n\n\t\t\t// ----------------------------------\n\t\t\t// executeQuery\n\t\t\t// ----------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Query',\n\t\t\t\tname: 'query',\n\t\t\t\ttype: 'string',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'sqlEditor',\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['executeQuery'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'SELECT id, name FROM product WHERE id < 40',\n\t\t\t\trequired: true,\n\t\t\t\tdescription: 'The SQL query to execute',\n\t\t\t},\n\n\t\t\t// ----------------------------------\n\t\t\t// insert\n\t\t\t// ----------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Table',\n\t\t\t\tname: 'table',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['insert'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tdescription: 'Name of the table in which to insert data to',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Columns',\n\t\t\t\tname: 'columns',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['insert'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'id,name,description',\n\t\t\t\tdescription:\n\t\t\t\t\t'Comma-separated list of the properties which should used as columns for the new rows',\n\t\t\t},\n\n\t\t\t// ----------------------------------\n\t\t\t// update\n\t\t\t// ----------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Table',\n\t\t\t\tname: 'table',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['update'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tdescription: 'Name of the table in which to update data in',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Update Key',\n\t\t\t\tname: 'updateKey',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['update'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: 'id',\n\t\t\t\trequired: true,\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-id\n\t\t\t\tdescription:\n\t\t\t\t\t'Name of the property which decides which rows in the database should be updated. Normally that would be \"id\".',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Columns',\n\t\t\t\tname: 'columns',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['update'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'name,description',\n\t\t\t\tdescription:\n\t\t\t\t\t'Comma-separated list of the properties which should used as columns for rows to update',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst credentials = (await this.getCredentials(\n\t\t\t'snowflake',\n\t\t)) as unknown as snowflake.ConnectionOptions;\n\t\tconst returnData: INodeExecutionData[] = [];\n\t\tlet responseData;\n\n\t\tconst connection = snowflake.createConnection(credentials);\n\n\t\tawait connect(connection);\n\n\t\tconst items = this.getInputData();\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'executeQuery') {\n\t\t\t// ----------------------------------\n\t\t\t// executeQuery\n\t\t\t// ----------------------------------\n\n\t\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\t\tlet query = this.getNodeParameter('query', i) as string;\n\n\t\t\t\tfor (const resolvable of getResolvables(query)) {\n\t\t\t\t\tquery = query.replace(resolvable, this.evaluateExpression(resolvable, i) as string);\n\t\t\t\t}\n\n\t\t\t\tresponseData = await execute(connection, query, []);\n\t\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\tthis.helpers.returnJsonArray(responseData as IDataObject[]),\n\t\t\t\t\t{ itemData: { item: i } },\n\t\t\t\t);\n\t\t\t\treturnData.push(...executionData);\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'insert') {\n\t\t\t// ----------------------------------\n\t\t\t// insert\n\t\t\t// ----------------------------------\n\n\t\t\tconst table = this.getNodeParameter('table', 0) as string;\n\t\t\tconst columnString = this.getNodeParameter('columns', 0) as string;\n\t\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\t\t\tconst query = `INSERT INTO ${table}(${columns.join(',')}) VALUES (${columns\n\t\t\t\t.map((_column) => '?')\n\t\t\t\t.join(',')})`;\n\t\t\tconst data = this.helpers.copyInputItems(items, columns);\n\t\t\tconst binds = data.map((element) => Object.values(element));\n\t\t\tawait execute(connection, query, binds as unknown as snowflake.InsertBinds);\n\t\t\tdata.forEach((d, i) => {\n\t\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\tthis.helpers.returnJsonArray(d),\n\t\t\t\t\t{ itemData: { item: i } },\n\t\t\t\t);\n\t\t\t\treturnData.push(...executionData);\n\t\t\t});\n\t\t}\n\n\t\tif (operation === 'update') {\n\t\t\t// ----------------------------------\n\t\t\t// update\n\t\t\t// ----------------------------------\n\n\t\t\tconst table = this.getNodeParameter('table', 0) as string;\n\t\t\tconst updateKey = this.getNodeParameter('updateKey', 0) as string;\n\t\t\tconst columnString = this.getNodeParameter('columns', 0) as string;\n\t\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\n\t\t\tif (!columns.includes(updateKey)) {\n\t\t\t\tcolumns.unshift(updateKey);\n\t\t\t}\n\n\t\t\tconst query = `UPDATE ${table} SET ${columns\n\t\t\t\t.map((column) => `${column} = ?`)\n\t\t\t\t.join(',')} WHERE ${updateKey} = ?;`;\n\t\t\tconst data = this.helpers.copyInputItems(items, columns);\n\t\t\tconst binds = data.map((element) => Object.values(element).concat(element[updateKey]));\n\t\t\tfor (let i = 0; i < binds.length; i++) {\n\t\t\t\tawait execute(connection, query, binds[i] as unknown as snowflake.InsertBinds);\n\t\t\t}\n\t\t\tdata.forEach((d, i) => {\n\t\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\tthis.helpers.returnJsonArray(d),\n\t\t\t\t\t{ itemData: { item: i } },\n\t\t\t\t);\n\t\t\t\treturnData.push(...executionData);\n\t\t\t});\n\t\t}\n\n\t\tawait destroy(connection);\n\t\treturn [returnData];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAoC;AACpC,2BAAsB;AAEtB,uBAA+B;AAE/B,8BAA0C;AAEnC,MAAM,UAA+B;AAAA,EAArC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,OAAO;AAAA,MACf,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MA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AAC;AACvD,YAAM,UAAU,aAAa,MAAM,GAAG,EAAE,IAAI,CAAC,WAAW,OAAO,KAAK,CAAC;AAErE,UAAI,CAAC,QAAQ,SAAS,SAAS,GAAG;AACjC,gBAAQ,QAAQ,SAAS;AAAA,MAC1B;AAEA,YAAM,QAAQ,UAAU,KAAK,QAAQ,QACnC,IAAI,CAAC,WAAW,GAAG,MAAM,MAAM,EAC/B,KAAK,GAAG,CAAC,UAAU,SAAS;AAC9B,YAAM,OAAO,KAAK,QAAQ,eAAe,OAAO,OAAO;AACvD,YAAM,QAAQ,KAAK,IAAI,CAAC,YAAY,OAAO,OAAO,OAAO,EAAE,OAAO,QAAQ,SAAS,CAAC,CAAC;AACrF,eAAS,IAAI,GAAG,IAAI,MAAM,QAAQ,KAAK;AACtC,kBAAM,iCAAQ,YAAY,OAAO,MAAM,CAAC,CAAqC;AAAA,MAC9E;AACA,WAAK,QAAQ,CAAC,GAAG,MAAM;AACtB,cAAM,gBAAgB,KAAK,QAAQ;AAAA,UAClC,KAAK,QAAQ,gBAAgB,CAAC;AAAA,UAC9B,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;AAAA,QACzB;AACA,mBAAW,KAAK,GAAG,aAAa;AAAA,MACjC,CAAC;AAAA,IACF;AAEA,cAAM,iCAAQ,UAAU;AACxB,WAAO,CAAC,UAAU;AAAA,EACnB;AACD;","names":["snowflake"]}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Snowflake/Snowflake.node.ts"],"sourcesContent":["import type {\n\tIExecuteFunctions,\n\tIDataObject,\n\tINodeExecutionData,\n\tINodeType,\n\tINodeTypeDescription,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\nimport snowflake from 'snowflake-sdk';\n\nimport { getResolvables } from '@utils/utilities';\n\nimport {\n\tconnect,\n\tdestroy,\n\texecute,\n\tgetConnectionOptions,\n\ttype SnowflakeCredential,\n} from './GenericFunctions';\n\nexport class Snowflake implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Snowflake',\n\t\tname: 'snowflake',\n\t\ticon: 'file:snowflake.svg',\n\t\tgroup: ['input'],\n\t\tversion: 1,\n\t\tdescription: 'Get, add and update data in Snowflake',\n\t\tdefaults: {\n\t\t\tname: 'Snowflake',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tparameterPane: 'wide',\n\t\tcredentials: [\n\t\t\t{\n\t\t\t\tname: 'snowflake',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t],\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Operation',\n\t\t\t\tname: 'operation',\n\t\t\t\ttype: 'options',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Execute Query',\n\t\t\t\t\t\tvalue: 'executeQuery',\n\t\t\t\t\t\tdescription: 'Execute an SQL query',\n\t\t\t\t\t\taction: 'Execute a SQL query',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Insert',\n\t\t\t\t\t\tvalue: 'insert',\n\t\t\t\t\t\tdescription: 'Insert rows in database',\n\t\t\t\t\t\taction: 'Insert rows in database',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Update',\n\t\t\t\t\t\tvalue: 'update',\n\t\t\t\t\t\tdescription: 'Update rows in database',\n\t\t\t\t\t\taction: 'Update rows in database',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'insert',\n\t\t\t},\n\n\t\t\t// ----------------------------------\n\t\t\t// executeQuery\n\t\t\t// ----------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Query',\n\t\t\t\tname: 'query',\n\t\t\t\ttype: 'string',\n\t\t\t\tnoDataExpression: true,\n\t\t\t\ttypeOptions: {\n\t\t\t\t\teditor: 'sqlEditor',\n\t\t\t\t},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['executeQuery'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'SELECT id, name FROM product WHERE id < 40',\n\t\t\t\trequired: true,\n\t\t\t\tdescription: 'The SQL query to execute',\n\t\t\t},\n\n\t\t\t// ----------------------------------\n\t\t\t// insert\n\t\t\t// ----------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Table',\n\t\t\t\tname: 'table',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['insert'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tdescription: 'Name of the table in which to insert data to',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Columns',\n\t\t\t\tname: 'columns',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['insert'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'id,name,description',\n\t\t\t\tdescription:\n\t\t\t\t\t'Comma-separated list of the properties which should used as columns for the new rows',\n\t\t\t},\n\n\t\t\t// ----------------------------------\n\t\t\t// update\n\t\t\t// ----------------------------------\n\t\t\t{\n\t\t\t\tdisplayName: 'Table',\n\t\t\t\tname: 'table',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['update'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tdescription: 'Name of the table in which to update data in',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Update Key',\n\t\t\t\tname: 'updateKey',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['update'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: 'id',\n\t\t\t\trequired: true,\n\t\t\t\t// eslint-disable-next-line n8n-nodes-base/node-param-description-miscased-id\n\t\t\t\tdescription:\n\t\t\t\t\t'Name of the property which decides which rows in the database should be updated. Normally that would be \"id\".',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Columns',\n\t\t\t\tname: 'columns',\n\t\t\t\ttype: 'string',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\toperation: ['update'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tdefault: '',\n\t\t\t\tplaceholder: 'name,description',\n\t\t\t\tdescription:\n\t\t\t\t\t'Comma-separated list of the properties which should used as columns for rows to update',\n\t\t\t},\n\t\t],\n\t};\n\n\tasync execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]> {\n\t\tconst credentials = await this.getCredentials<SnowflakeCredential>('snowflake');\n\n\t\tconst connectionOptions = getConnectionOptions(credentials);\n\t\tconst connection = snowflake.createConnection(connectionOptions);\n\n\t\tawait connect(connection);\n\n\t\tconst returnData: INodeExecutionData[] = [];\n\t\tconst items = this.getInputData();\n\t\tconst operation = this.getNodeParameter('operation', 0);\n\n\t\tif (operation === 'executeQuery') {\n\t\t\t// ----------------------------------\n\t\t\t// executeQuery\n\t\t\t// ----------------------------------\n\n\t\t\tfor (let i = 0; i < items.length; i++) {\n\t\t\t\tlet query = this.getNodeParameter('query', i) as string;\n\n\t\t\t\tfor (const resolvable of getResolvables(query)) {\n\t\t\t\t\tquery = query.replace(resolvable, this.evaluateExpression(resolvable, i) as string);\n\t\t\t\t}\n\n\t\t\t\tconst responseData = await execute(connection, query, []);\n\t\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\tthis.helpers.returnJsonArray(responseData as IDataObject[]),\n\t\t\t\t\t{ itemData: { item: i } },\n\t\t\t\t);\n\t\t\t\treturnData.push(...executionData);\n\t\t\t}\n\t\t}\n\n\t\tif (operation === 'insert') {\n\t\t\t// ----------------------------------\n\t\t\t// insert\n\t\t\t// ----------------------------------\n\n\t\t\tconst table = this.getNodeParameter('table', 0) as string;\n\t\t\tconst columnString = this.getNodeParameter('columns', 0) as string;\n\t\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\t\t\tconst query = `INSERT INTO ${table}(${columns.join(',')}) VALUES (${columns\n\t\t\t\t.map((_column) => '?')\n\t\t\t\t.join(',')})`;\n\t\t\tconst data = this.helpers.copyInputItems(items, columns);\n\t\t\tconst binds = data.map((element) => Object.values(element));\n\t\t\tawait execute(connection, query, binds as unknown as snowflake.InsertBinds);\n\t\t\tdata.forEach((d, i) => {\n\t\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\tthis.helpers.returnJsonArray(d),\n\t\t\t\t\t{ itemData: { item: i } },\n\t\t\t\t);\n\t\t\t\treturnData.push(...executionData);\n\t\t\t});\n\t\t}\n\n\t\tif (operation === 'update') {\n\t\t\t// ----------------------------------\n\t\t\t// update\n\t\t\t// ----------------------------------\n\n\t\t\tconst table = this.getNodeParameter('table', 0) as string;\n\t\t\tconst updateKey = this.getNodeParameter('updateKey', 0) as string;\n\t\t\tconst columnString = this.getNodeParameter('columns', 0) as string;\n\t\t\tconst columns = columnString.split(',').map((column) => column.trim());\n\n\t\t\tif (!columns.includes(updateKey)) {\n\t\t\t\tcolumns.unshift(updateKey);\n\t\t\t}\n\n\t\t\tconst query = `UPDATE ${table} SET ${columns\n\t\t\t\t.map((column) => `${column} = ?`)\n\t\t\t\t.join(',')} WHERE ${updateKey} = ?;`;\n\t\t\tconst data = this.helpers.copyInputItems(items, columns);\n\t\t\tconst binds = data.map((element) => Object.values(element).concat(element[updateKey]));\n\t\t\tfor (let i = 0; i < binds.length; i++) {\n\t\t\t\tawait execute(connection, query, binds[i] as unknown as snowflake.InsertBinds);\n\t\t\t}\n\t\t\tdata.forEach((d, i) => {\n\t\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\t\tthis.helpers.returnJsonArray(d),\n\t\t\t\t\t{ itemData: { item: i } },\n\t\t\t\t);\n\t\t\t\treturnData.push(...executionData);\n\t\t\t});\n\t\t}\n\n\t\tawait destroy(connection);\n\t\treturn [returnData];\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAOA,0BAAoC;AACpC,2BAAsB;AAEtB,uBAA+B;AAE/B,8BAMO;AAEA,MAAM,UAA+B;AAAA,EAArC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,OAAO;AAAA,MACf,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,QACT,MAAM;AAAA,MACP;AAAA,MACA,cAAc;AAAA,MACd,QAAQ,CAAC,wCAAoB,IAAI;AAAA,MACjC,SAAS,CAAC,wCAAoB,IAAI;AAAA,MAClC,eAAe;AAAA,MACf,aAAa;AAAA,QACZ;AAAA,UACC,MAAM;AAAA,UACN,UAAU;AAAA,QACX;AAAA,MACD;AAAA,MACA,YAAY;AAAA,QACX;AAAA,UACC,aAAa;AAAA,UACb,MAAM;AAAA,UACN,MAAM;AAAA,UACN,kBAAkB;AAAA,UAClB,SAAS;AAAA,YACR;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,cACP,aAAa;AAAA,cACb,QAAQ;AAAA,YACT;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,cACP,aAAa;AAAA,cACb,QAAQ;AAAA,YACT;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,cACP,aAAa;AAAA,cACb,QAAQ;AAAA,YACT;AAAA,UACD;AAAA,UACA,SAAS;AAAA,QACV;AAAA;AAAA;AAAA;AAAA,QAKA;AAAA,UACC,aA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