n8n-nodes-base 1.92.0 → 1.93.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/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 -0
- package/dist/methods/defined.json +6 -0
- package/dist/methods/referenced.json +3 -0
- 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/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/Interval/Interval.node.js +1 -1
- package/dist/nodes/Interval/Interval.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/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/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/types/credentials.json +6 -6
- package/dist/types/nodes.json +22 -17
- package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js +12 -2
- package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js.map +1 -1
- package/package.json +13 -9
- /package/dist/{credentials/icons/SharePoint.svg → nodes/Microsoft/SharePoint/microsoftSharePoint.svg} +0 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/PostBin/BinDescription.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { buildBinAPIURL, transformBinResponse } from './GenericFunctions';\n\n// Operations for the `Bin` resource:\nexport const binOperations: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['bin'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Create',\n\t\t\t\tvalue: 'create',\n\t\t\t\tdescription: 'Create bin',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '/
|
|
1
|
+
{"version":3,"sources":["../../../nodes/PostBin/BinDescription.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { buildBinAPIURL, transformBinResponse } from './GenericFunctions';\n\n// Operations for the `Bin` resource:\nexport const binOperations: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['bin'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Create',\n\t\t\t\tvalue: 'create',\n\t\t\t\tdescription: 'Create bin',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t\turl: '/api/bin',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [transformBinResponse],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Create a bin',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Get a bin',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [transformBinResponse],\n\t\t\t\t\t},\n\t\t\t\t\tsend: {\n\t\t\t\t\t\tpreSend: [\n\t\t\t\t\t\t\t// Parse binId before sending to make sure it's in the right format\n\t\t\t\t\t\t\tbuildBinAPIURL,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get a bin',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Delete',\n\t\t\t\tvalue: 'delete',\n\t\t\t\tdescription: 'Delete a bin',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'DELETE',\n\t\t\t\t\t},\n\t\t\t\t\tsend: {\n\t\t\t\t\t\tpreSend: [\n\t\t\t\t\t\t\t// Parse binId before sending to make sure it's in the right format\n\t\t\t\t\t\t\tbuildBinAPIURL,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Delete a bin',\n\t\t\t},\n\t\t],\n\t\tdefault: 'create',\n\t},\n];\n\n// Properties of the `Bin` resource\nexport const binFields: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Bin ID',\n\t\tname: 'binId',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\trequired: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['bin'],\n\t\t\t\toperation: ['get', 'delete'],\n\t\t\t},\n\t\t},\n\t\tdescription: 'Unique identifier for each bin',\n\t},\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,8BAAqD;AAG9C,MAAM,gBAAmC;AAAA,EAC/C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,KAAK;AAAA,MACjB;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,4CAAoB;AAAA,UACnC;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,UACT;AAAA,UACA,QAAQ;AAAA,YACP,aAAa,CAAC,4CAAoB;AAAA,UACnC;AAAA,UACA,MAAM;AAAA,YACL,SAAS;AAAA;AAAA,cAER;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,UACT;AAAA,UACA,MAAM;AAAA,YACL,SAAS;AAAA;AAAA,cAER;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,IACD;AAAA,IACA,SAAS;AAAA,EACV;AACD;AAGO,MAAM,YAA+B;AAAA,EAC3C;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,SAAS;AAAA,IACT,UAAU;AAAA,IACV,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,KAAK;AAAA,QAChB,WAAW,CAAC,OAAO,QAAQ;AAAA,MAC5B;AAAA,IACD;AAAA,IACA,aAAa;AAAA,EACd;AACD;","names":[]}
|
|
@@ -45,18 +45,18 @@ function parseBinId(context) {
|
|
|
45
45
|
}
|
|
46
46
|
async function buildBinAPIURL(requestOptions) {
|
|
47
47
|
const binId = parseBinId(this);
|
|
48
|
-
requestOptions.url = `/
|
|
48
|
+
requestOptions.url = `/api/bin/${binId}`;
|
|
49
49
|
return requestOptions;
|
|
50
50
|
}
|
|
51
51
|
async function buildBinTestURL(requestOptions) {
|
|
52
52
|
const binId = parseBinId(this);
|
|
53
|
-
requestOptions.url =
|
|
53
|
+
requestOptions.url = `/${binId}`;
|
|
54
54
|
return requestOptions;
|
|
55
55
|
}
|
|
56
56
|
async function buildRequestURL(requestOptions) {
|
|
57
57
|
const reqId = this.getNodeParameter("requestId", "shift");
|
|
58
58
|
const binId = parseBinId(this);
|
|
59
|
-
requestOptions.url = `/
|
|
59
|
+
requestOptions.url = `/api/bin/${binId}/req/${reqId}`;
|
|
60
60
|
return requestOptions;
|
|
61
61
|
}
|
|
62
62
|
async function transformBinResponse(items, _response) {
|
|
@@ -67,8 +67,8 @@ async function transformBinResponse(items, _response) {
|
|
|
67
67
|
nowIso: new Date(item.json.now).toISOString(),
|
|
68
68
|
expiresTimestamp: item.json.expires,
|
|
69
69
|
expiresIso: new Date(item.json.expires).toISOString(),
|
|
70
|
-
requestUrl: "https://www.
|
|
71
|
-
viewUrl: "https://www.
|
|
70
|
+
requestUrl: "https://www.postb.in/" + item.json.binId,
|
|
71
|
+
viewUrl: "https://www.postb.in/b/" + item.json.binId
|
|
72
72
|
}
|
|
73
73
|
);
|
|
74
74
|
return items;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/PostBin/GenericFunctions.ts"],"sourcesContent":["import type {\n\tIExecuteSingleFunctions,\n\tIHttpRequestOptions,\n\tIN8nHttpFullResponse,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { NodeApiError } from 'n8n-workflow';\n\n// Regular expressions used to extract binId from parameter value\nconst BIN_ID_REGEX = /\\b\\d{13}-\\d{13}\\b/g;\n\n/**\n * Extracts the PostBin Bin Id from the specified string.\n * This method should be able to extract bin Id from the\n * PostBin URL or from the string in the following format:\n * `Bin '<binId>'.`\n *\n */\nfunction parseBinId(context: IExecuteSingleFunctions) {\n\tconst binId = context.getNodeParameter('binId') as string;\n\t// Test if the Bin id is in the expected format\n\tBIN_ID_REGEX.lastIndex = 0;\n\tconst idMatch = BIN_ID_REGEX.exec(binId);\n\n\t// Return what is matched\n\tif (idMatch) {\n\t\treturn idMatch[0];\n\t}\n\n\t// If it's not recognized, error out\n\tthrow new NodeApiError(\n\t\tcontext.getNode(),\n\t\t{},\n\t\t{\n\t\t\tmessage: 'Bin ID format is not valid',\n\t\t\tdescription: 'Please check the provided Bin ID and try again.',\n\t\t\tparseXml: false,\n\t\t},\n\t);\n}\n\n/**\n * Creates correctly-formatted PostBin API URL based on the entered binId.\n * This function makes sure binId is in the expected format by parsing it\n * from current node parameter value.\n *\n */\nexport async function buildBinAPIURL(\n\tthis: IExecuteSingleFunctions,\n\trequestOptions: IHttpRequestOptions,\n): Promise<IHttpRequestOptions> {\n\tconst binId = parseBinId(this);\n\t// Assemble the PostBin API URL and put it back to requestOptions\n\trequestOptions.url = `/
|
|
1
|
+
{"version":3,"sources":["../../../nodes/PostBin/GenericFunctions.ts"],"sourcesContent":["import type {\n\tIExecuteSingleFunctions,\n\tIHttpRequestOptions,\n\tIN8nHttpFullResponse,\n\tINodeExecutionData,\n} from 'n8n-workflow';\nimport { NodeApiError } from 'n8n-workflow';\n\n// Regular expressions used to extract binId from parameter value\nconst BIN_ID_REGEX = /\\b\\d{13}-\\d{13}\\b/g;\n\n/**\n * Extracts the PostBin Bin Id from the specified string.\n * This method should be able to extract bin Id from the\n * PostBin URL or from the string in the following format:\n * `Bin '<binId>'.`\n *\n */\nfunction parseBinId(context: IExecuteSingleFunctions) {\n\tconst binId = context.getNodeParameter('binId') as string;\n\t// Test if the Bin id is in the expected format\n\tBIN_ID_REGEX.lastIndex = 0;\n\tconst idMatch = BIN_ID_REGEX.exec(binId);\n\n\t// Return what is matched\n\tif (idMatch) {\n\t\treturn idMatch[0];\n\t}\n\n\t// If it's not recognized, error out\n\tthrow new NodeApiError(\n\t\tcontext.getNode(),\n\t\t{},\n\t\t{\n\t\t\tmessage: 'Bin ID format is not valid',\n\t\t\tdescription: 'Please check the provided Bin ID and try again.',\n\t\t\tparseXml: false,\n\t\t},\n\t);\n}\n\n/**\n * Creates correctly-formatted PostBin API URL based on the entered binId.\n * This function makes sure binId is in the expected format by parsing it\n * from current node parameter value.\n *\n */\nexport async function buildBinAPIURL(\n\tthis: IExecuteSingleFunctions,\n\trequestOptions: IHttpRequestOptions,\n): Promise<IHttpRequestOptions> {\n\tconst binId = parseBinId(this);\n\t// Assemble the PostBin API URL and put it back to requestOptions\n\trequestOptions.url = `/api/bin/${binId}`;\n\n\treturn requestOptions;\n}\n\n/**\n * Creates correctly-formatted PostBin Bin test URL based on the entered binId.\n * This function makes sure binId is in the expected format by parsing it\n * from current node parameter value.\n *\n */\nexport async function buildBinTestURL(\n\tthis: IExecuteSingleFunctions,\n\trequestOptions: IHttpRequestOptions,\n): Promise<IHttpRequestOptions> {\n\tconst binId = parseBinId(this);\n\n\t// Assemble the PostBin API URL and put it back to requestOptions\n\trequestOptions.url = `/${binId}`;\n\treturn requestOptions;\n}\n\n/**\n * Creates correctly-formatted PostBin API URL based on the entered binId and reqId.\n * This function makes sure binId is in the expected format by parsing it\n * from current node parameter value.\n *\n */\nexport async function buildRequestURL(\n\tthis: IExecuteSingleFunctions,\n\trequestOptions: IHttpRequestOptions,\n): Promise<IHttpRequestOptions> {\n\tconst reqId = this.getNodeParameter('requestId', 'shift') as string;\n\tconst binId = parseBinId(this);\n\n\trequestOptions.url = `/api/bin/${binId}/req/${reqId}`;\n\treturn requestOptions;\n}\n\n/**\n * Converts the bin response data and adds additional properties\n *\n */\nexport async function transformBinResponse(\n\tthis: IExecuteSingleFunctions,\n\titems: INodeExecutionData[],\n\t_response: IN8nHttpFullResponse,\n): Promise<INodeExecutionData[]> {\n\titems.forEach(\n\t\t(item) =>\n\t\t\t(item.json = {\n\t\t\t\tbinId: item.json.binId,\n\t\t\t\tnowTimestamp: item.json.now,\n\t\t\t\tnowIso: new Date(item.json.now as string).toISOString(),\n\t\t\t\texpiresTimestamp: item.json.expires,\n\t\t\t\texpiresIso: new Date(item.json.expires as string).toISOString(),\n\t\t\t\trequestUrl: 'https://www.postb.in/' + (item.json.binId as string),\n\t\t\t\tviewUrl: 'https://www.postb.in/b/' + (item.json.binId as string),\n\t\t\t}),\n\t);\n\treturn items;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAMA,0BAA6B;AAG7B,MAAM,eAAe;AASrB,SAAS,WAAW,SAAkC;AACrD,QAAM,QAAQ,QAAQ,iBAAiB,OAAO;AAE9C,eAAa,YAAY;AACzB,QAAM,UAAU,aAAa,KAAK,KAAK;AAGvC,MAAI,SAAS;AACZ,WAAO,QAAQ,CAAC;AAAA,EACjB;AAGA,QAAM,IAAI;AAAA,IACT,QAAQ,QAAQ;AAAA,IAChB,CAAC;AAAA,IACD;AAAA,MACC,SAAS;AAAA,MACT,aAAa;AAAA,MACb,UAAU;AAAA,IACX;AAAA,EACD;AACD;AAQA,eAAsB,eAErB,gBAC+B;AAC/B,QAAM,QAAQ,WAAW,IAAI;AAE7B,iBAAe,MAAM,YAAY,KAAK;AAEtC,SAAO;AACR;AAQA,eAAsB,gBAErB,gBAC+B;AAC/B,QAAM,QAAQ,WAAW,IAAI;AAG7B,iBAAe,MAAM,IAAI,KAAK;AAC9B,SAAO;AACR;AAQA,eAAsB,gBAErB,gBAC+B;AAC/B,QAAM,QAAQ,KAAK,iBAAiB,aAAa,OAAO;AACxD,QAAM,QAAQ,WAAW,IAAI;AAE7B,iBAAe,MAAM,YAAY,KAAK,QAAQ,KAAK;AACnD,SAAO;AACR;AAMA,eAAsB,qBAErB,OACA,WACgC;AAChC,QAAM;AAAA,IACL,CAAC,SACC,KAAK,OAAO;AAAA,MACZ,OAAO,KAAK,KAAK;AAAA,MACjB,cAAc,KAAK,KAAK;AAAA,MACxB,QAAQ,IAAI,KAAK,KAAK,KAAK,GAAa,EAAE,YAAY;AAAA,MACtD,kBAAkB,KAAK,KAAK;AAAA,MAC5B,YAAY,IAAI,KAAK,KAAK,KAAK,OAAiB,EAAE,YAAY;AAAA,MAC9D,YAAY,0BAA2B,KAAK,KAAK;AAAA,MACjD,SAAS,4BAA6B,KAAK,KAAK;AAAA,IACjD;AAAA,EACF;AACA,SAAO;AACR;","names":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/PostBin/PostBin.node.ts"],"sourcesContent":["import type { INodeType, INodeTypeDescription } from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { binFields, binOperations } from './BinDescription';\nimport { requestFields, requestOperations } from './RequestDescription';\n\nexport class PostBin implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'PostBin',\n\t\tname: 'postBin',\n\t\ticon: 'file:postbin.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\t\tdescription: 'Consume PostBin API',\n\t\tdefaults: {\n\t\t\tname: 'PostBin',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [],\n\t\trequestDefaults: {\n\t\t\tbaseURL: 'https://www.
|
|
1
|
+
{"version":3,"sources":["../../../nodes/PostBin/PostBin.node.ts"],"sourcesContent":["import type { INodeType, INodeTypeDescription } from 'n8n-workflow';\nimport { NodeConnectionTypes } from 'n8n-workflow';\n\nimport { binFields, binOperations } from './BinDescription';\nimport { requestFields, requestOperations } from './RequestDescription';\n\nexport class PostBin implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'PostBin',\n\t\tname: 'postBin',\n\t\ticon: 'file:postbin.svg',\n\t\tgroup: ['transform'],\n\t\tversion: 1,\n\t\tsubtitle: '={{ $parameter[\"operation\"] + \": \" + $parameter[\"resource\"] }}',\n\t\tdescription: 'Consume PostBin API',\n\t\tdefaults: {\n\t\t\tname: 'PostBin',\n\t\t},\n\t\tusableAsTool: true,\n\t\tinputs: [NodeConnectionTypes.Main],\n\t\toutputs: [NodeConnectionTypes.Main],\n\t\tcredentials: [],\n\t\trequestDefaults: {\n\t\t\tbaseURL: 'https://www.postb.in',\n\t\t},\n\t\tproperties: [\n\t\t\t{\n\t\t\t\tdisplayName: 'Resource',\n\t\t\t\tname: 'resource',\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: 'Bin',\n\t\t\t\t\t\tvalue: 'bin',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Request',\n\t\t\t\t\t\tvalue: 'request',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'bin',\n\t\t\t\trequired: true,\n\t\t\t},\n\t\t\t...binOperations,\n\t\t\t...binFields,\n\t\t\t...requestOperations,\n\t\t\t...requestFields,\n\t\t],\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAAoC;AAEpC,4BAAyC;AACzC,gCAAiD;AAE1C,MAAM,QAA6B;AAAA,EAAnC;AACN,uBAAoC;AAAA,MACnC,aAAa;AAAA,MACb,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO,CAAC,WAAW;AAAA,MACnB,SAAS;AAAA,MACT,UAAU;AAAA,MACV,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,aAAa,CAAC;AAAA,MACd,iBAAiB;AAAA,QAChB,SAAS;AAAA,MACV;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,YACR;AAAA,YACA;AAAA,cACC,MAAM;AAAA,cACN,OAAO;AAAA,YACR;AAAA,UACD;AAAA,UACA,SAAS;AAAA,UACT,UAAU;AAAA,QACX;AAAA,QACA,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,QACH,GAAG;AAAA,MACJ;AAAA,IACD;AAAA;AACD;","names":[]}
|
|
@@ -42,7 +42,7 @@ const requestOperations = [
|
|
|
42
42
|
routing: {
|
|
43
43
|
request: {
|
|
44
44
|
method: "GET",
|
|
45
|
-
url: '=/
|
|
45
|
+
url: '=/api/bin/{{$parameter["binId"]}}/req/{{$parameter["requestId"]}}'
|
|
46
46
|
},
|
|
47
47
|
send: {
|
|
48
48
|
preSend: [
|
|
@@ -60,7 +60,7 @@ const requestOperations = [
|
|
|
60
60
|
routing: {
|
|
61
61
|
request: {
|
|
62
62
|
method: "GET",
|
|
63
|
-
url: '=/
|
|
63
|
+
url: '=/api/bin/{{$parameter["binId"]}}/req/shift'
|
|
64
64
|
},
|
|
65
65
|
send: {
|
|
66
66
|
preSend: [
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/PostBin/RequestDescription.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { buildBinTestURL, buildRequestURL } from './GenericFunctions';\n\n// Operations for the `Request` resource\nexport const requestOperations: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['request'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Get a request',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/
|
|
1
|
+
{"version":3,"sources":["../../../nodes/PostBin/RequestDescription.ts"],"sourcesContent":["import type { INodeProperties } from 'n8n-workflow';\n\nimport { buildBinTestURL, buildRequestURL } from './GenericFunctions';\n\n// Operations for the `Request` resource\nexport const requestOperations: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Operation',\n\t\tname: 'operation',\n\t\ttype: 'options',\n\t\tnoDataExpression: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['request'],\n\t\t\t},\n\t\t},\n\t\toptions: [\n\t\t\t{\n\t\t\t\tname: 'Get',\n\t\t\t\tvalue: 'get',\n\t\t\t\tdescription: 'Get a request',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/api/bin/{{$parameter[\"binId\"]}}/req/{{$parameter[\"requestId\"]}}',\n\t\t\t\t\t},\n\t\t\t\t\tsend: {\n\t\t\t\t\t\tpreSend: [\n\t\t\t\t\t\t\t// Parse binId before sending to make sure it's in the right format\n\t\t\t\t\t\t\tbuildRequestURL,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Get a request',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Remove First',\n\t\t\t\tvalue: 'removeFirst',\n\t\t\t\tdescription: 'Remove the first request from bin',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'GET',\n\t\t\t\t\t\turl: '=/api/bin/{{$parameter[\"binId\"]}}/req/shift',\n\t\t\t\t\t},\n\t\t\t\t\tsend: {\n\t\t\t\t\t\tpreSend: [\n\t\t\t\t\t\t\t// Parse binId before sending to make sure it's in the right format\n\t\t\t\t\t\t\tbuildRequestURL,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\taction: 'Remove First a request',\n\t\t\t},\n\t\t\t{\n\t\t\t\tname: 'Send',\n\t\t\t\tvalue: 'send',\n\t\t\t\tdescription: 'Send a test request to the bin',\n\t\t\t\trouting: {\n\t\t\t\t\trequest: {\n\t\t\t\t\t\tmethod: 'POST',\n\t\t\t\t\t},\n\t\t\t\t\tsend: {\n\t\t\t\t\t\tpreSend: [\n\t\t\t\t\t\t\t// Parse binId before sending to make sure it's in the right format\n\t\t\t\t\t\t\tbuildBinTestURL,\n\t\t\t\t\t\t],\n\t\t\t\t\t},\n\t\t\t\t\toutput: {\n\t\t\t\t\t\tpostReceive: [\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\ttype: 'set',\n\t\t\t\t\t\t\t\tproperties: {\n\t\t\t\t\t\t\t\t\tvalue: '={{ { \"requestId\": $response.body } }}',\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},\n\t\t\t\taction: 'Send a request',\n\t\t\t},\n\t\t],\n\t\tdefault: 'get',\n\t},\n];\n\n// Properties of the `Request` resource\nexport const requestFields: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Bin ID',\n\t\tname: 'binId',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\trequired: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['request'],\n\t\t\t\toperation: ['get', 'removeFirst', 'send'],\n\t\t\t},\n\t\t},\n\t\tdescription: 'Unique identifier for each bin',\n\t},\n\t{\n\t\tdisplayName: 'Bin Content',\n\t\tname: 'binContent',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\ttypeOptions: {\n\t\t\trows: 5,\n\t\t},\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['request'],\n\t\t\t\toperation: ['send'],\n\t\t\t},\n\t\t},\n\t\t// Content is sent in the body of POST requests\n\t\trouting: {\n\t\t\tsend: {\n\t\t\t\tproperty: 'content',\n\t\t\t\ttype: 'body',\n\t\t\t},\n\t\t},\n\t},\n\t{\n\t\tdisplayName: 'Request ID',\n\t\tname: 'requestId',\n\t\ttype: 'string',\n\t\tdefault: '',\n\t\trequired: true,\n\t\tdisplayOptions: {\n\t\t\tshow: {\n\t\t\t\tresource: ['request'],\n\t\t\t\toperation: ['get'],\n\t\t\t},\n\t\t},\n\t\tdescription: 'Unique identifier for each request',\n\t},\n];\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,8BAAiD;AAG1C,MAAM,oBAAuC;AAAA,EACnD;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,gBAAgB;AAAA,MACf,MAAM;AAAA,QACL,UAAU,CAAC,SAAS;AAAA,MACrB;AAAA,IACD;AAAA,IACA,SAAS;AAAA,MACR;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,MAAM;AAAA,YACL,SAAS;AAAA;AAAA,cAER;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,YACR,KAAK;AAAA,UACN;AAAA,UACA,MAAM;AAAA,YACL,SAAS;AAAA;AAAA,cAER;AAAA,YACD;AAAA,UACD;AAAA,QACD;AAAA,QACA,QAAQ;AAAA,MACT;AAAA,MACA;AAAA,QACC,MAAM;AAAA,QACN,OAAO;AAAA,QACP,aAAa;AAAA,QACb,SAAS;AAAA,UACR,SAAS;AAAA,YACR,QAAQ;AAAA,UACT;AAAA,UACA,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
|
40
40
|
header: "",
|
|
41
41
|
executionsHelp: {
|
|
42
|
-
inactive: "<b>While building your workflow</b>, click the '
|
|
43
|
-
active: "<b>While building your workflow</b>, click the '
|
|
42
|
+
inactive: "<b>While building your workflow</b>, click the 'execute step' button, then trigger a Postgres 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.",
|
|
43
|
+
active: "<b>While building your workflow</b>, click the 'execute step' button, then trigger a Postgres 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."
|
|
44
44
|
},
|
|
45
45
|
activationHint: "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)."
|
|
46
46
|
},
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../nodes/Postgres/PostgresTrigger.node.ts"],"sourcesContent":["import {\n\tTriggerCloseError,\n\ttype IDataObject,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ITriggerFunctions,\n\ttype ITriggerResponse,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport {\n\tpgTriggerFunction,\n\tinitDB,\n\tsearchSchema,\n\tsearchTables,\n\tprepareNames,\n} from './PostgresTrigger.functions';\n\nexport class PostgresTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Postgres Trigger',\n\t\tname: 'postgresTrigger',\n\t\ticon: 'file:postgres.svg',\n\t\tgroup: ['trigger'],\n\t\tversion: 1,\n\t\tdescription: 'Listens to Postgres messages',\n\t\teventTriggerDescription: '',\n\t\tdefaults: {\n\t\t\tname: 'Postgres 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 Postgres 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 Postgres 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: 'postgres',\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: 'Listen For',\n\t\t\t\tname: 'triggerMode',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Table Row Change Events',\n\t\t\t\t\t\tvalue: 'createTrigger',\n\t\t\t\t\t\tdescription: 'Insert, update or delete',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Advanced',\n\t\t\t\t\t\tvalue: 'listenTrigger',\n\t\t\t\t\t\tdescription: 'Listen to existing Postgres channel',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'createTrigger',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Schema Name',\n\t\t\t\tname: 'schema',\n\t\t\t\ttype: 'resourceLocator',\n\t\t\t\tdefault: { mode: 'list', value: 'public' },\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmodes: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'From List',\n\t\t\t\t\t\tname: 'list',\n\t\t\t\t\t\ttype: 'list',\n\t\t\t\t\t\tplaceholder: 'Select a schema',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tsearchListMethod: 'searchSchema',\n\t\t\t\t\t\t\tsearchFilterRequired: false,\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: 'Name',\n\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tplaceholder: 'e.g. public',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Table Name',\n\t\t\t\tname: 'tableName',\n\t\t\t\ttype: 'resourceLocator',\n\t\t\t\tdefault: { mode: 'list', value: '' },\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmodes: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'From List',\n\t\t\t\t\t\tname: 'list',\n\t\t\t\t\t\ttype: 'list',\n\t\t\t\t\t\tplaceholder: 'Select a table',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tsearchListMethod: 'searchTables',\n\t\t\t\t\t\t\tsearchFilterRequired: false,\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: 'Name',\n\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tplaceholder: 'e.g. table_name',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Channel Name',\n\t\t\t\tname: 'channelName',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tplaceholder: 'e.g. n8n_channel',\n\t\t\t\tdescription: 'Name of the channel to listen to',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['listenTrigger'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Event to listen for',\n\t\t\t\tname: 'firesOn',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\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: 'Insert',\n\t\t\t\t\t\tvalue: 'INSERT',\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},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Delete',\n\t\t\t\t\t\tvalue: 'DELETE',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'INSERT',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Additional Fields',\n\t\t\t\tname: 'additionalFields',\n\t\t\t\ttype: 'collection',\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\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\tdisplayName: 'Channel Name',\n\t\t\t\t\t\tname: 'channelName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tplaceholder: 'e.g. n8n_channel',\n\t\t\t\t\t\tdescription: 'Name of the channel to listen to',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Function Name',\n\t\t\t\t\t\tname: 'functionName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'Name of the function to create',\n\t\t\t\t\t\tplaceholder: 'e.g. n8n_trigger_function()',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Replace if Exists',\n\t\t\t\t\t\tname: 'replaceIfExists',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdescription: 'Whether to replace an existing function and trigger with the same name',\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Trigger Name',\n\t\t\t\t\t\tname: 'triggerName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'Name of the trigger to create',\n\t\t\t\t\t\tplaceholder: 'e.g. n8n_trigger',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\t\t\t\t],\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\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: 'Connection Timeout',\n\t\t\t\t\t\tname: 'connectionTimeout',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: 30,\n\t\t\t\t\t\tdescription: 'Number of seconds reserved for connecting to the database',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Delay Closing Idle Connection',\n\t\t\t\t\t\tname: 'delayClosingIdleConnection',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: 0,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Number of seconds to wait before idle connection would be eligible for closing',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tminValue: 0,\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\tmethods = {\n\t\tlistSearch: {\n\t\t\tsearchSchema,\n\t\t\tsearchTables,\n\t\t},\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst triggerMode = this.getNodeParameter('triggerMode', 0) as string;\n\t\tconst additionalFields = this.getNodeParameter('additionalFields', 0) as IDataObject;\n\n\t\t// initialize and connect to database\n\t\tconst { db } = await initDB.call(this);\n\t\tconst connection = await db.connect({ direct: true });\n\n\t\t// prepare and set up listener\n\t\tconst onNotification = async (data: IDataObject) => {\n\t\t\tif (data.payload) {\n\t\t\t\ttry {\n\t\t\t\t\tdata.payload = JSON.parse(data.payload as string) as IDataObject;\n\t\t\t\t} catch (error) {}\n\t\t\t}\n\t\t\tthis.emit([this.helpers.returnJsonArray([data])]);\n\t\t};\n\n\t\t// create trigger, function and channel or use existing channel\n\t\tconst pgNames = prepareNames(this.getNode().id, this.getMode(), additionalFields);\n\t\tif (triggerMode === 'createTrigger') {\n\t\t\tawait pgTriggerFunction.call(\n\t\t\t\tthis,\n\t\t\t\tdb,\n\t\t\t\tadditionalFields,\n\t\t\t\tpgNames.functionName,\n\t\t\t\tpgNames.triggerName,\n\t\t\t\tpgNames.channelName,\n\t\t\t);\n\t\t} else {\n\t\t\tpgNames.channelName = this.getNodeParameter('channelName', '') as string;\n\t\t}\n\n\t\t// listen to channel\n\t\tawait connection.none(`LISTEN ${pgNames.channelName}`);\n\n\t\tconst cleanUpDb = async () => {\n\t\t\ttry {\n\t\t\t\ttry {\n\t\t\t\t\t// check if the connection is healthy\n\t\t\t\t\tawait connection.query('SELECT 1');\n\t\t\t\t} catch {\n\t\t\t\t\t// connection already closed. Can't perform cleanup\n\n\t\t\t\t\tthrow new TriggerCloseError(this.getNode(), { level: 'warning' });\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.none('UNLISTEN $1:name', [pgNames.channelName]);\n\t\t\t\t\tif (triggerMode === 'createTrigger') {\n\t\t\t\t\t\tconst functionName = pgNames.functionName.includes('(')\n\t\t\t\t\t\t\t? pgNames.functionName.split('(')[0]\n\t\t\t\t\t\t\t: pgNames.functionName;\n\t\t\t\t\t\tawait connection.any('DROP FUNCTION IF EXISTS $1:name CASCADE', [functionName]);\n\n\t\t\t\t\t\tconst schema = this.getNodeParameter('schema', undefined, {\n\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t}) as string;\n\t\t\t\t\t\tconst table = this.getNodeParameter('tableName', undefined, {\n\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t}) as string;\n\n\t\t\t\t\t\tawait connection.any('DROP TRIGGER IF EXISTS $1:name ON $2:name.$3:name CASCADE', [\n\t\t\t\t\t\t\tpgNames.triggerName,\n\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\ttable,\n\t\t\t\t\t\t]);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new TriggerCloseError(this.getNode(), { cause: error as Error, level: 'error' });\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tconnection.client.removeListener('notification', onNotification);\n\t\t\t}\n\t\t};\n\n\t\tconnection.client.on('notification', onNotification);\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\tawait cleanUpDb();\n\t\t};\n\n\t\tconst manualTriggerFunction = async () => {\n\t\t\tawait new Promise(async (resolve, reject) => {\n\t\t\t\tconst timeoutHandler = setTimeout(async () => {\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\tawait (async () => {\n\t\t\t\t\t\t\t\tawait cleanUpDb();\n\t\t\t\t\t\t\t\treturn 'Aborted, no data received within 30secs. This 30sec timeout is only set for \"manually triggered execution\". Active Workflows will listen indefinitely.';\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}, 60000);\n\t\t\t\tconnection.client.on('notification', async (data: IDataObject) => {\n\t\t\t\t\tif (data.payload) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdata.payload = JSON.parse(data.payload as string) as IDataObject;\n\t\t\t\t\t\t} catch (error) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.emit([this.helpers.returnJsonArray([data])]);\n\t\t\t\t\tclearTimeout(timeoutHandler);\n\t\t\t\t\tresolve(true);\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t\tmanualTriggerFunction: this.getMode() === 'manual' ? manualTriggerFunction : undefined,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAQO;AAEP,6BAMO;AAEA,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,YAC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AA,YACC,IAAI;AAAA,cACH,OAAO,YAAY;AAClB,sBAAM,UAAU;AAChB,uBAAO;AAAA,cACR,GAAG;AAAA,YACJ;AAAA,UACD;AAAA,QACD,GAAG,GAAK;AACR,mBAAW,OAAO,GAAG,gBAAgB,OAAO,SAAsB;AACjE,cAAI,KAAK,SAAS;AACjB,gBAAI;AACH,mBAAK,UAAU,KAAK,MAAM,KAAK,OAAiB;AAAA,YACjD,SAAS,OAAO;AAAA,YAAC;AAAA,UAClB;AAEA,eAAK,KAAK,CAAC,KAAK,QAAQ,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAChD,uBAAa,cAAc;AAC3B,kBAAQ,IAAI;AAAA,QACb,CAAC;AAAA,MACF,CAAC;AAAA,IACF;AAEA,WAAO;AAAA,MACN;AAAA,MACA,uBAAuB,KAAK,QAAQ,MAAM,WAAW,wBAAwB;AAAA,IAC9E;AAAA,EACD;AACD;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../nodes/Postgres/PostgresTrigger.node.ts"],"sourcesContent":["import {\n\tTriggerCloseError,\n\ttype IDataObject,\n\ttype INodeType,\n\ttype INodeTypeDescription,\n\ttype ITriggerFunctions,\n\ttype ITriggerResponse,\n\tNodeConnectionTypes,\n} from 'n8n-workflow';\n\nimport {\n\tpgTriggerFunction,\n\tinitDB,\n\tsearchSchema,\n\tsearchTables,\n\tprepareNames,\n} from './PostgresTrigger.functions';\n\nexport class PostgresTrigger implements INodeType {\n\tdescription: INodeTypeDescription = {\n\t\tdisplayName: 'Postgres Trigger',\n\t\tname: 'postgresTrigger',\n\t\ticon: 'file:postgres.svg',\n\t\tgroup: ['trigger'],\n\t\tversion: 1,\n\t\tdescription: 'Listens to Postgres messages',\n\t\teventTriggerDescription: '',\n\t\tdefaults: {\n\t\t\tname: 'Postgres 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 Postgres 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 Postgres 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: 'postgres',\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: 'Listen For',\n\t\t\t\tname: 'triggerMode',\n\t\t\t\ttype: 'options',\n\t\t\t\toptions: [\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Table Row Change Events',\n\t\t\t\t\t\tvalue: 'createTrigger',\n\t\t\t\t\t\tdescription: 'Insert, update or delete',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Advanced',\n\t\t\t\t\t\tvalue: 'listenTrigger',\n\t\t\t\t\t\tdescription: 'Listen to existing Postgres channel',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'createTrigger',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Schema Name',\n\t\t\t\tname: 'schema',\n\t\t\t\ttype: 'resourceLocator',\n\t\t\t\tdefault: { mode: 'list', value: 'public' },\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmodes: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'From List',\n\t\t\t\t\t\tname: 'list',\n\t\t\t\t\t\ttype: 'list',\n\t\t\t\t\t\tplaceholder: 'Select a schema',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tsearchListMethod: 'searchSchema',\n\t\t\t\t\t\t\tsearchFilterRequired: false,\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: 'Name',\n\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tplaceholder: 'e.g. public',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Table Name',\n\t\t\t\tname: 'tableName',\n\t\t\t\ttype: 'resourceLocator',\n\t\t\t\tdefault: { mode: 'list', value: '' },\n\t\t\t\trequired: true,\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t\tmodes: [\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'From List',\n\t\t\t\t\t\tname: 'list',\n\t\t\t\t\t\ttype: 'list',\n\t\t\t\t\t\tplaceholder: 'Select a table',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tsearchListMethod: 'searchTables',\n\t\t\t\t\t\t\tsearchFilterRequired: false,\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: 'Name',\n\t\t\t\t\t\tname: 'name',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tplaceholder: 'e.g. table_name',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Channel Name',\n\t\t\t\tname: 'channelName',\n\t\t\t\ttype: 'string',\n\t\t\t\tdefault: '',\n\t\t\t\trequired: true,\n\t\t\t\tplaceholder: 'e.g. n8n_channel',\n\t\t\t\tdescription: 'Name of the channel to listen to',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['listenTrigger'],\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Event to listen for',\n\t\t\t\tname: 'firesOn',\n\t\t\t\ttype: 'options',\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\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: 'Insert',\n\t\t\t\t\t\tvalue: 'INSERT',\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},\n\t\t\t\t\t{\n\t\t\t\t\t\tname: 'Delete',\n\t\t\t\t\t\tvalue: 'DELETE',\n\t\t\t\t\t},\n\t\t\t\t],\n\t\t\t\tdefault: 'INSERT',\n\t\t\t},\n\t\t\t{\n\t\t\t\tdisplayName: 'Additional Fields',\n\t\t\t\tname: 'additionalFields',\n\t\t\t\ttype: 'collection',\n\t\t\t\tplaceholder: 'Add Field',\n\t\t\t\tdefault: {},\n\t\t\t\tdisplayOptions: {\n\t\t\t\t\tshow: {\n\t\t\t\t\t\ttriggerMode: ['createTrigger'],\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\tdisplayName: 'Channel Name',\n\t\t\t\t\t\tname: 'channelName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tplaceholder: 'e.g. n8n_channel',\n\t\t\t\t\t\tdescription: 'Name of the channel to listen to',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Function Name',\n\t\t\t\t\t\tname: 'functionName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'Name of the function to create',\n\t\t\t\t\t\tplaceholder: 'e.g. n8n_trigger_function()',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Replace if Exists',\n\t\t\t\t\t\tname: 'replaceIfExists',\n\t\t\t\t\t\ttype: 'boolean',\n\t\t\t\t\t\tdescription: 'Whether to replace an existing function and trigger with the same name',\n\t\t\t\t\t\tdefault: false,\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Trigger Name',\n\t\t\t\t\t\tname: 'triggerName',\n\t\t\t\t\t\ttype: 'string',\n\t\t\t\t\t\tdescription: 'Name of the trigger to create',\n\t\t\t\t\t\tplaceholder: 'e.g. n8n_trigger',\n\t\t\t\t\t\tdefault: '',\n\t\t\t\t\t},\n\t\t\t\t],\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\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: 'Connection Timeout',\n\t\t\t\t\t\tname: 'connectionTimeout',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: 30,\n\t\t\t\t\t\tdescription: 'Number of seconds reserved for connecting to the database',\n\t\t\t\t\t},\n\t\t\t\t\t{\n\t\t\t\t\t\tdisplayName: 'Delay Closing Idle Connection',\n\t\t\t\t\t\tname: 'delayClosingIdleConnection',\n\t\t\t\t\t\ttype: 'number',\n\t\t\t\t\t\tdefault: 0,\n\t\t\t\t\t\tdescription:\n\t\t\t\t\t\t\t'Number of seconds to wait before idle connection would be eligible for closing',\n\t\t\t\t\t\ttypeOptions: {\n\t\t\t\t\t\t\tminValue: 0,\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\tmethods = {\n\t\tlistSearch: {\n\t\t\tsearchSchema,\n\t\t\tsearchTables,\n\t\t},\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst triggerMode = this.getNodeParameter('triggerMode', 0) as string;\n\t\tconst additionalFields = this.getNodeParameter('additionalFields', 0) as IDataObject;\n\n\t\t// initialize and connect to database\n\t\tconst { db } = await initDB.call(this);\n\t\tconst connection = await db.connect({ direct: true });\n\n\t\t// prepare and set up listener\n\t\tconst onNotification = async (data: IDataObject) => {\n\t\t\tif (data.payload) {\n\t\t\t\ttry {\n\t\t\t\t\tdata.payload = JSON.parse(data.payload as string) as IDataObject;\n\t\t\t\t} catch (error) {}\n\t\t\t}\n\t\t\tthis.emit([this.helpers.returnJsonArray([data])]);\n\t\t};\n\n\t\t// create trigger, function and channel or use existing channel\n\t\tconst pgNames = prepareNames(this.getNode().id, this.getMode(), additionalFields);\n\t\tif (triggerMode === 'createTrigger') {\n\t\t\tawait pgTriggerFunction.call(\n\t\t\t\tthis,\n\t\t\t\tdb,\n\t\t\t\tadditionalFields,\n\t\t\t\tpgNames.functionName,\n\t\t\t\tpgNames.triggerName,\n\t\t\t\tpgNames.channelName,\n\t\t\t);\n\t\t} else {\n\t\t\tpgNames.channelName = this.getNodeParameter('channelName', '') as string;\n\t\t}\n\n\t\t// listen to channel\n\t\tawait connection.none(`LISTEN ${pgNames.channelName}`);\n\n\t\tconst cleanUpDb = async () => {\n\t\t\ttry {\n\t\t\t\ttry {\n\t\t\t\t\t// check if the connection is healthy\n\t\t\t\t\tawait connection.query('SELECT 1');\n\t\t\t\t} catch {\n\t\t\t\t\t// connection already closed. Can't perform cleanup\n\n\t\t\t\t\tthrow new TriggerCloseError(this.getNode(), { level: 'warning' });\n\t\t\t\t}\n\n\t\t\t\ttry {\n\t\t\t\t\tawait connection.none('UNLISTEN $1:name', [pgNames.channelName]);\n\t\t\t\t\tif (triggerMode === 'createTrigger') {\n\t\t\t\t\t\tconst functionName = pgNames.functionName.includes('(')\n\t\t\t\t\t\t\t? pgNames.functionName.split('(')[0]\n\t\t\t\t\t\t\t: pgNames.functionName;\n\t\t\t\t\t\tawait connection.any('DROP FUNCTION IF EXISTS $1:name CASCADE', [functionName]);\n\n\t\t\t\t\t\tconst schema = this.getNodeParameter('schema', undefined, {\n\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t}) as string;\n\t\t\t\t\t\tconst table = this.getNodeParameter('tableName', undefined, {\n\t\t\t\t\t\t\textractValue: true,\n\t\t\t\t\t\t}) as string;\n\n\t\t\t\t\t\tawait connection.any('DROP TRIGGER IF EXISTS $1:name ON $2:name.$3:name CASCADE', [\n\t\t\t\t\t\t\tpgNames.triggerName,\n\t\t\t\t\t\t\tschema,\n\t\t\t\t\t\t\ttable,\n\t\t\t\t\t\t]);\n\t\t\t\t\t}\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new TriggerCloseError(this.getNode(), { cause: error as Error, level: 'error' });\n\t\t\t\t}\n\t\t\t} finally {\n\t\t\t\tconnection.client.removeListener('notification', onNotification);\n\t\t\t}\n\t\t};\n\n\t\tconnection.client.on('notification', onNotification);\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\tawait cleanUpDb();\n\t\t};\n\n\t\tconst manualTriggerFunction = async () => {\n\t\t\tawait new Promise(async (resolve, reject) => {\n\t\t\t\tconst timeoutHandler = setTimeout(async () => {\n\t\t\t\t\treject(\n\t\t\t\t\t\tnew Error(\n\t\t\t\t\t\t\tawait (async () => {\n\t\t\t\t\t\t\t\tawait cleanUpDb();\n\t\t\t\t\t\t\t\treturn 'Aborted, no data received within 30secs. This 30sec timeout is only set for \"manually triggered execution\". Active Workflows will listen indefinitely.';\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}, 60000);\n\t\t\t\tconnection.client.on('notification', async (data: IDataObject) => {\n\t\t\t\t\tif (data.payload) {\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tdata.payload = JSON.parse(data.payload as string) as IDataObject;\n\t\t\t\t\t\t} catch (error) {}\n\t\t\t\t\t}\n\n\t\t\t\t\tthis.emit([this.helpers.returnJsonArray([data])]);\n\t\t\t\t\tclearTimeout(timeoutHandler);\n\t\t\t\t\tresolve(true);\n\t\t\t\t});\n\t\t\t});\n\t\t};\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t\tmanualTriggerFunction: this.getMode() === 'manual' ? manualTriggerFunction : undefined,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAQO;AAEP,6BAMO;AAEA,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,YACR;AAAA,cACC,MAAM;AAAA,cACN,OAA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AY;AAClB,sBAAM,UAAU;AAChB,uBAAO;AAAA,cACR,GAAG;AAAA,YACJ;AAAA,UACD;AAAA,QACD,GAAG,GAAK;AACR,mBAAW,OAAO,GAAG,gBAAgB,OAAO,SAAsB;AACjE,cAAI,KAAK,SAAS;AACjB,gBAAI;AACH,mBAAK,UAAU,KAAK,MAAM,KAAK,OAAiB;AAAA,YACjD,SAAS,OAAO;AAAA,YAAC;AAAA,UAClB;AAEA,eAAK,KAAK,CAAC,KAAK,QAAQ,gBAAgB,CAAC,IAAI,CAAC,CAAC,CAAC;AAChD,uBAAa,cAAc;AAC3B,kBAAQ,IAAI;AAAA,QACb,CAAC;AAAA,MACF,CAAC;AAAA,IACF;AAEA,WAAO;AAAA,MACN;AAAA,MACA,uBAAuB,KAAK,QAAQ,MAAM,WAAW,wBAAwB;AAAA,IAC9E;AAAA,EACD;AACD;","names":[]}
|
|
@@ -40,8 +40,8 @@ class RabbitMQTrigger {
|
|
|
40
40
|
triggerPanel: {
|
|
41
41
|
header: "",
|
|
42
42
|
executionsHelp: {
|
|
43
|
-
inactive: "<b>While building your workflow</b>, click the '
|
|
44
|
-
active: "<b>While building your workflow</b>, click the '
|
|
43
|
+
inactive: "<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.",
|
|
44
|
+
active: "<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."
|
|
45
45
|
},
|
|
46
46
|
activationHint: "Once you\u2019ve finished building your workflow, <a data-key='activate'>activate</a> it to have it also listen continuously (you just won\u2019t see those executions here)."
|
|
47
47
|
},
|
|
@@ -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;AAA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KAAK,MAAM;AAC5C,sBAAQ,IAAI,OAAO;AACnB,6BAAe,SAAS,OAAO;AAAA,YAChC,CAAC;AAAA,UACF,OAAO;AAEN,oBAAQ,IAAI,OAAO;AAAA,UACpB;AAAA,QACD,SAAS,OAAO;AACf,gBAAM,WAAW,KAAK,YAAY;AAClC,gBAAM,OAAO,KAAK,QAAQ;AAC1B,cAAI,oBAAoB,eAAe;AACtC,2BAAe,SAAS,OAAO;AAAA,UAChC;AAEA,eAAK,OAAO;AAAA,YACX,uDAAuD,KAAK,IAAI,kBAAkB,SAAS,EAAE,OAAO,MAAM,OAAO;AAAA,YACjH;AAAA,cACC,MAAM,KAAK;AAAA,cACX,YAAY,SAAS;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}\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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A,eAAK,OAAO;AAAA,YACX,uDAAuD,KAAK,IAAI,kBAAkB,SAAS,EAAE,OAAO,MAAM,OAAO;AAAA,YACjH;AAAA,cACC,MAAM,KAAK;AAAA,cACX,YAAY,SAAS;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"]}
|
|
@@ -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,O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;AAAA,MACD,WAAW,gBAAgB,YAAY;AACtC,gBAAQ,WAAW,KAAK,iBAAiB,eAAe,CAAC;AACzD,qBAAc,QAAQ,gBAA2B;AAAA,MAClD,WAAW,gBAAgB,UAAU;AACpC,cAAM,IAAI;AAAA,UACT,KAAK,QAAQ;AAAA,UACb,6BAA6B,WAAW;AAAA,QACzC;AAAA,MACD;AAEA,YAAM,WAAiC;AAAA,QACtC,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAEA,WAAK,aAAa,QAAQ;AAAA,IAC3B,SAAS,OAAO;AACf,UAAI,KAAK,eAAe,GAAG;AAC1B,cAAM,eAAW,yCAAuB,MAAM,MAAM;AACpD,cAAM,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,M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Ae,CAAC;AACzD,qBAAc,QAAQ,gBAA2B;AAAA,MAClD,WAAW,gBAAgB,UAAU;AACpC,cAAM,IAAI;AAAA,UACT,KAAK,QAAQ;AAAA,UACb,6BAA6B,WAAW;AAAA,QACzC;AAAA,MACD;AAEA,iBAAW;AAAA,QACV,MAAM;AAAA,QACN;AAAA,QACA;AAAA,MACD;AAEA,WAAK,aAAa,QAAQ;AAAA,IAC3B,SAAS,OAAO;AACf,UAAI,KAAK,eAAe,GAAG;AAC1B,cAAM,eAAW,yCAAuB,MAAM,MAAM;AACpD,cAAM,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,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":[]}
|