n8n-core 1.23.0 → 1.24.1

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.
@@ -36,11 +36,17 @@ async function doesNotExist(dir) {
36
36
  }
37
37
  exports.doesNotExist = doesNotExist;
38
38
  async function toBuffer(body) {
39
- return new Promise((resolve) => {
40
- if (Buffer.isBuffer(body))
41
- resolve(body);
42
- else
43
- body.pipe((0, concat_stream_1.default)(resolve));
39
+ if (Buffer.isBuffer(body))
40
+ return body;
41
+ return new Promise((resolve, reject) => {
42
+ body
43
+ .once('error', (cause) => {
44
+ if ('code' in cause && cause.code === 'Z_DATA_ERROR')
45
+ reject(new Error('Failed to decompress response', { cause }));
46
+ else
47
+ reject(cause);
48
+ })
49
+ .pipe((0, concat_stream_1.default)(resolve));
44
50
  });
45
51
  }
46
52
  exports.toBuffer = toBuffer;
@@ -1 +1 @@
1
- {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/BinaryData/utils.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAkC;AAGlC,kEAAyC;AAE5B,QAAA,YAAY,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAU,CAAC;AAErE,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,eAAe,EAAE,IAAI,CAAU,CAAC;AAEpE,SAAgB,cAAc,CAAC,KAAe;IAC7C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAY,CAAC,QAAQ,CAAC,CAA0B,CAAC,CAAC,CAAC;AAC9E,CAAC;AAFD,wCAEC;AAED,SAAgB,YAAY,CAAC,IAAY;IACxC,OAAO,YAAY,CAAC,QAAQ,CAAC,IAA6B,CAAC,CAAC;AAC7D,CAAC;AAFD,oCAEC;AAEM,KAAK,UAAU,SAAS,CAAC,GAAW;IAC1C,IAAI,CAAC;QACJ,MAAM,kBAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,kBAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;AACF,CAAC;AAND,8BAMC;AAEM,KAAK,UAAU,YAAY,CAAC,GAAW;IAC7C,IAAI,CAAC;QACJ,MAAM,kBAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAPD,oCAOC;AAEM,KAAK,UAAU,QAAQ,CAAC,IAAuB;IACrD,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,EAAE;QACtC,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;YAAE,OAAO,CAAC,IAAI,CAAC,CAAC;;YACpC,IAAI,CAAC,IAAI,CAAC,IAAA,uBAAY,EAAC,OAAO,CAAC,CAAC,CAAC;IACvC,CAAC,CAAC,CAAC;AACJ,CAAC;AALD,4BAKC"}
1
+ {"version":3,"file":"utils.js","sourceRoot":"","sources":["../../src/BinaryData/utils.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAkC;AAGlC,kEAAyC;AAE5B,QAAA,YAAY,GAAG,CAAC,SAAS,EAAE,YAAY,EAAE,IAAI,CAAU,CAAC;AAErE,MAAM,YAAY,GAAG,CAAC,YAAY,EAAE,eAAe,EAAE,IAAI,CAAU,CAAC;AAEpE,SAAgB,cAAc,CAAC,KAAe;IAC7C,OAAO,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,oBAAY,CAAC,QAAQ,CAAC,CAA0B,CAAC,CAAC,CAAC;AAC9E,CAAC;AAFD,wCAEC;AAED,SAAgB,YAAY,CAAC,IAAY;IACxC,OAAO,YAAY,CAAC,QAAQ,CAAC,IAA6B,CAAC,CAAC;AAC7D,CAAC;AAFD,oCAEC;AAEM,KAAK,UAAU,SAAS,CAAC,GAAW;IAC1C,IAAI,CAAC;QACJ,MAAM,kBAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;IACtB,CAAC;IAAC,MAAM,CAAC;QACR,MAAM,kBAAE,CAAC,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IAC1C,CAAC;AACF,CAAC;AAND,8BAMC;AAEM,KAAK,UAAU,YAAY,CAAC,GAAW;IAC7C,IAAI,CAAC;QACJ,MAAM,kBAAE,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QACrB,OAAO,KAAK,CAAC;IACd,CAAC;IAAC,MAAM,CAAC;QACR,OAAO,IAAI,CAAC;IACb,CAAC;AACF,CAAC;AAPD,oCAOC;AAEM,KAAK,UAAU,QAAQ,CAAC,IAAuB;IACrD,IAAI,MAAM,CAAC,QAAQ,CAAC,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IACvC,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC9C,IAAI;aACF,IAAI,CAAC,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;YACxB,IAAI,MAAM,IAAI,KAAK,IAAI,KAAK,CAAC,IAAI,KAAK,cAAc;gBACnD,MAAM,CAAC,IAAI,KAAK,CAAC,+BAA+B,EAAE,EAAE,KAAK,EAAE,CAAC,CAAC,CAAC;;gBAC1D,MAAM,CAAC,KAAK,CAAC,CAAC;QACpB,CAAC,CAAC;aACD,IAAI,CAAC,IAAA,uBAAY,EAAC,OAAO,CAAC,CAAC,CAAC;IAC/B,CAAC,CAAC,CAAC;AACJ,CAAC;AAXD,4BAWC"}
@@ -29,7 +29,7 @@ export declare function requestWithAuthentication(this: IAllExecuteFunctions, cr
29
29
  export declare function getAdditionalKeys(additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, runExecutionData: IRunExecutionData | null, options?: {
30
30
  secretsEnabled?: boolean;
31
31
  }): IWorkflowDataProxyAdditionalKeys;
32
- export declare function getCredentials(workflow: Workflow, node: INode, type: string, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, runExecutionData?: IRunExecutionData | null, runIndex?: number, connectionInputData?: INodeExecutionData[], itemIndex?: number): Promise<ICredentialDataDecryptedObject>;
32
+ export declare function getCredentials(workflow: Workflow, node: INode, type: string, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, executeData?: IExecuteData, runExecutionData?: IRunExecutionData | null, runIndex?: number, connectionInputData?: INodeExecutionData[], itemIndex?: number): Promise<ICredentialDataDecryptedObject>;
33
33
  export declare const validateValueAgainstSchema: (node: INode, nodeType: INodeType, parameterValue: string | number | boolean | object | null | undefined, parameterName: string, runIndex: number, itemIndex: number) => string | number | boolean | object | null | undefined;
34
34
  export declare function getNodeParameter(workflow: Workflow, runExecutionData: IRunExecutionData | null, runIndex: number, connectionInputData: INodeExecutionData[], node: INode, parameterName: string, itemIndex: number, mode: WorkflowExecuteMode, additionalKeys: IWorkflowDataProxyAdditionalKeys, executeData?: IExecuteData, fallbackValue?: any, options?: IGetNodeParameterOptions): NodeParameterValueType | object;
35
35
  export declare function continueOnFail(node: INode): boolean;
@@ -44,4 +44,4 @@ export declare function getExecuteSingleFunctions(workflow: Workflow, runExecuti
44
44
  export declare function getCredentialTestFunctions(): ICredentialTestFunctions;
45
45
  export declare function getLoadOptionsFunctions(workflow: Workflow, node: INode, path: string, additionalData: IWorkflowExecuteAdditionalData): ILoadOptionsFunctions;
46
46
  export declare function getExecuteHookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, activation: WorkflowActivateMode, webhookData?: IWebhookData): IHookFunctions;
47
- export declare function getExecuteWebhookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, webhookData: IWebhookData): IWebhookFunctions;
47
+ export declare function getExecuteWebhookFunctions(workflow: Workflow, node: INode, additionalData: IWorkflowExecuteAdditionalData, mode: WorkflowExecuteMode, webhookData: IWebhookData, closeFunctions: CloseFunction[]): IWebhookFunctions;
@@ -48,7 +48,6 @@ const url_1 = __importStar(require("url"));
48
48
  const BinaryData_service_1 = require("./BinaryData/BinaryData.service");
49
49
  const Constants_1 = require("./Constants");
50
50
  const ExtractValue_1 = require("./ExtractValue");
51
- const OAuth2Helper_1 = require("./OAuth2Helper");
52
51
  const ExecutionMetadata_1 = require("./ExecutionMetadata");
53
52
  const Secrets_1 = require("./Secrets");
54
53
  const typedi_1 = __importDefault(require("typedi"));
@@ -838,10 +837,9 @@ async function prepareBinaryData(binaryData, executionId, workflowId, filePath,
838
837
  return setBinaryDataBuffer(returnData, binaryData, workflowId, executionId);
839
838
  }
840
839
  async function requestOAuth2(credentialsType, requestOptions, node, additionalData, oAuth2Options, isN8nRequest = false) {
841
- var _a, _b;
842
- const credentials = await this.getCredentials(credentialsType);
843
- if (credentials.grantType === "authorizationCode" &&
844
- credentials.oauthTokenData === undefined) {
840
+ var _a, _b, _c;
841
+ const credentials = (await this.getCredentials(credentialsType));
842
+ if (credentials.grantType === 'authorizationCode' && credentials.oauthTokenData === undefined) {
845
843
  throw new n8n_workflow_1.ApplicationError('OAuth credentials not connected');
846
844
  }
847
845
  const oAuthClient = new client_oauth2_1.ClientOAuth2({
@@ -850,19 +848,21 @@ async function requestOAuth2(credentialsType, requestOptions, node, additionalDa
850
848
  accessTokenUri: credentials.accessTokenUrl,
851
849
  scopes: credentials.scope.split(' '),
852
850
  ignoreSSLIssues: credentials.ignoreSSLIssues,
851
+ authentication: (_a = credentials.authentication) !== null && _a !== void 0 ? _a : 'header',
853
852
  });
854
853
  let oauthTokenData = credentials.oauthTokenData;
855
- if (credentials.grantType === "clientCredentials" &&
854
+ if (credentials.grantType === 'clientCredentials' &&
856
855
  (oauthTokenData === undefined || Object.keys(oauthTokenData).length === 0)) {
857
- const { data } = await (0, OAuth2Helper_1.getClientCredentialsToken)(oAuthClient, credentials);
858
- if (!((_a = node.credentials) === null || _a === void 0 ? void 0 : _a[credentialsType])) {
856
+ const { data } = await oAuthClient.credentials.getToken();
857
+ if (!((_b = node.credentials) === null || _b === void 0 ? void 0 : _b[credentialsType])) {
859
858
  throw new n8n_workflow_1.ApplicationError('Node does not have credential type', {
860
859
  extra: { nodeName: node.name },
861
860
  tags: { credentialType: credentialsType },
862
861
  });
863
862
  }
864
863
  const nodeCredentials = node.credentials[credentialsType];
865
- await additionalData.credentialsHelper.updateCredentials(nodeCredentials, credentialsType, Object.assign(credentials, { oauthTokenData: data }));
864
+ credentials.oauthTokenData = data;
865
+ await additionalData.credentialsHelper.updateCredentials(nodeCredentials, credentialsType, credentials);
866
866
  oauthTokenData = data;
867
867
  }
868
868
  const accessToken = (0, get_1.default)(oauthTokenData, oAuth2Options === null || oAuth2Options === void 0 ? void 0 : oAuth2Options.property) || oauthTokenData.accessToken;
@@ -874,7 +874,7 @@ async function requestOAuth2(credentialsType, requestOptions, node, additionalDa
874
874
  }, (oAuth2Options === null || oAuth2Options === void 0 ? void 0 : oAuth2Options.tokenType) || oauthTokenData.tokenType);
875
875
  requestOptions.rejectUnauthorized = !credentials.ignoreSSLIssues;
876
876
  const newRequestOptions = token.sign(requestOptions);
877
- const newRequestHeaders = (newRequestOptions.headers = (_b = newRequestOptions.headers) !== null && _b !== void 0 ? _b : {});
877
+ const newRequestHeaders = (newRequestOptions.headers = (_c = newRequestOptions.headers) !== null && _c !== void 0 ? _c : {});
878
878
  if ((oAuth2Options === null || oAuth2Options === void 0 ? void 0 : oAuth2Options.keepBearer) === false && typeof newRequestHeaders.Authorization === 'string') {
879
879
  newRequestHeaders.Authorization = newRequestHeaders.Authorization.split(' ')[1];
880
880
  }
@@ -903,8 +903,8 @@ async function requestOAuth2(credentialsType, requestOptions, node, additionalDa
903
903
  }
904
904
  let newToken;
905
905
  n8n_workflow_1.LoggerProxy.debug(`OAuth2 token for "${credentialsType}" used by node "${node.name}" has been renewed.`);
906
- if ("clientCredentials" === credentials.grantType) {
907
- newToken = await (0, OAuth2Helper_1.getClientCredentialsToken)(token.client, credentials);
906
+ if (credentials.grantType === 'clientCredentials') {
907
+ newToken = await token.client.credentials.getToken();
908
908
  }
909
909
  else {
910
910
  newToken = await token.refresh(tokenRefreshOptions);
@@ -959,8 +959,8 @@ async function requestOAuth2(credentialsType, requestOptions, node, additionalDa
959
959
  }
960
960
  n8n_workflow_1.LoggerProxy.debug(`OAuth2 token for "${credentialsType}" used by node "${node.name}" expired. Should revalidate.`);
961
961
  let newToken;
962
- if ("clientCredentials" === credentials.grantType) {
963
- newToken = await (0, OAuth2Helper_1.getClientCredentialsToken)(token.client, credentials);
962
+ if (credentials.grantType === 'clientCredentials') {
963
+ newToken = await token.client.credentials.getToken();
964
964
  }
965
965
  else {
966
966
  newToken = await token.refresh(tokenRefreshOptions);
@@ -1181,6 +1181,8 @@ async function requestWithAuthentication(credentialsType, requestOptions, workfl
1181
1181
  throw error;
1182
1182
  }
1183
1183
  catch (error) {
1184
+ if (error instanceof n8n_workflow_1.ExecutionBaseError)
1185
+ throw error;
1184
1186
  throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
1185
1187
  }
1186
1188
  }
@@ -1236,7 +1238,7 @@ function getAdditionalKeys(additionalData, mode, runExecutionData, options) {
1236
1238
  };
1237
1239
  }
1238
1240
  exports.getAdditionalKeys = getAdditionalKeys;
1239
- async function getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex) {
1241
+ async function getCredentials(workflow, node, type, additionalData, mode, executeData, runExecutionData, runIndex, connectionInputData, itemIndex) {
1240
1242
  var _a, _b;
1241
1243
  const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
1242
1244
  if (nodeType === undefined) {
@@ -1288,7 +1290,7 @@ async function getCredentials(workflow, node, type, additionalData, mode, runExe
1288
1290
  const nodeCredentials = node.credentials
1289
1291
  ? node.credentials[type]
1290
1292
  : {};
1291
- const decryptedDataObject = await additionalData.credentialsHelper.getDecrypted(additionalData, nodeCredentials, type, mode, false, expressionResolveValues);
1293
+ const decryptedDataObject = await additionalData.credentialsHelper.getDecrypted(additionalData, nodeCredentials, type, mode, executeData, false, expressionResolveValues);
1292
1294
  return decryptedDataObject;
1293
1295
  }
1294
1296
  exports.getCredentials = getCredentials;
@@ -1597,6 +1599,102 @@ const addExecutionDataFunctions = async (type, nodeName, data, runExecutionData,
1597
1599
  });
1598
1600
  }
1599
1601
  };
1602
+ async function getInputConnectionData(workflow, runExecutionData, runIndex, connectionInputData, additionalData, executeData, mode, closeFunctions, inputName, itemIndex, inputIndex) {
1603
+ var _a;
1604
+ const node = this.getNode();
1605
+ const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
1606
+ const inputs = n8n_workflow_1.NodeHelpers.getNodeInputs(workflow, node, nodeType.description);
1607
+ let inputConfiguration = inputs.find((input) => {
1608
+ if (typeof input === 'string') {
1609
+ return input === inputName;
1610
+ }
1611
+ return input.type === inputName;
1612
+ });
1613
+ if (inputConfiguration === undefined) {
1614
+ throw new n8n_workflow_1.ApplicationError('Node does not have input of type', {
1615
+ extra: { nodeName: node.name, inputName },
1616
+ });
1617
+ }
1618
+ if (typeof inputConfiguration === 'string') {
1619
+ inputConfiguration = {
1620
+ type: inputConfiguration,
1621
+ };
1622
+ }
1623
+ const parentNodes = workflow.getParentNodes(node.name, inputName, 1);
1624
+ if (parentNodes.length === 0) {
1625
+ return inputConfiguration.maxConnections === 1 ? undefined : [];
1626
+ }
1627
+ const constParentNodes = parentNodes
1628
+ .map((nodeName) => {
1629
+ return workflow.getNode(nodeName);
1630
+ })
1631
+ .filter((connectedNode) => connectedNode.disabled !== true)
1632
+ .map(async (connectedNode) => {
1633
+ const nodeType = workflow.nodeTypes.getByNameAndVersion(connectedNode.type, connectedNode.typeVersion);
1634
+ if (!nodeType.supplyData) {
1635
+ throw new n8n_workflow_1.ApplicationError('Node does not have a `supplyData` method defined', {
1636
+ extra: { nodeName: connectedNode.name },
1637
+ });
1638
+ }
1639
+ const context = Object.assign({}, this);
1640
+ context.getNodeParameter = (parameterName, itemIndex, fallbackValue, options) => {
1641
+ return getNodeParameter(workflow, runExecutionData, runIndex, connectionInputData, connectedNode, parameterName, itemIndex, mode, getAdditionalKeys(additionalData, mode, runExecutionData), executeData, fallbackValue, { ...(options || {}), contextNode: node });
1642
+ };
1643
+ context.getNode = () => {
1644
+ return (0, n8n_workflow_1.deepCopy)(connectedNode);
1645
+ };
1646
+ context.getCredentials = async (key) => {
1647
+ try {
1648
+ return await getCredentials(workflow, connectedNode, key, additionalData, mode, executeData, runExecutionData, runIndex, connectionInputData, itemIndex);
1649
+ }
1650
+ catch (error) {
1651
+ let currentNodeRunIndex = 0;
1652
+ if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
1653
+ currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
1654
+ }
1655
+ await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
1656
+ throw error;
1657
+ }
1658
+ };
1659
+ try {
1660
+ const response = await nodeType.supplyData.call(context, itemIndex);
1661
+ if (response.closeFunction) {
1662
+ closeFunctions.push(response.closeFunction);
1663
+ }
1664
+ return response;
1665
+ }
1666
+ catch (error) {
1667
+ if (error.functionality === 'configuration-node')
1668
+ throw error;
1669
+ if (!(error instanceof n8n_workflow_1.ExecutionBaseError)) {
1670
+ error = new n8n_workflow_1.NodeOperationError(connectedNode, error, {
1671
+ itemIndex,
1672
+ });
1673
+ }
1674
+ let currentNodeRunIndex = 0;
1675
+ if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
1676
+ currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
1677
+ }
1678
+ await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
1679
+ throw new n8n_workflow_1.NodeOperationError(connectedNode, `Error in sub-node ${connectedNode.name}`, {
1680
+ itemIndex,
1681
+ functionality: 'configuration-node',
1682
+ description: error.message,
1683
+ });
1684
+ }
1685
+ });
1686
+ const nodes = await Promise.all(constParentNodes);
1687
+ if (inputConfiguration.required && nodes.length === 0) {
1688
+ throw new n8n_workflow_1.NodeOperationError(node, `A ${inputName} processor node must be connected!`);
1689
+ }
1690
+ if (inputConfiguration.maxConnections !== undefined &&
1691
+ nodes.length > inputConfiguration.maxConnections) {
1692
+ throw new n8n_workflow_1.NodeOperationError(node, `Only ${inputConfiguration.maxConnections} ${inputName} processor nodes are/is allowed to be connected!`);
1693
+ }
1694
+ return inputConfiguration.maxConnections === 1
1695
+ ? (_a = (nodes || [])[0]) === null || _a === void 0 ? void 0 : _a.response
1696
+ : nodes.map((node) => node.response);
1697
+ }
1600
1698
  const getCommonWorkflowFunctions = (workflow, node, additionalData) => ({
1601
1699
  logger: n8n_workflow_1.LoggerProxy,
1602
1700
  getExecutionId: () => additionalData.executionId,
@@ -1742,6 +1840,9 @@ const getRequestHelperFunctions = (workflow, node, additionalData) => {
1742
1840
  }
1743
1841
  makeAdditionalRequest = getResolvedValue(paginationOptions.continue, itemIndex, runIndex, executeData, additionalKeys, false);
1744
1842
  if (makeAdditionalRequest) {
1843
+ if (paginationOptions.requestInterval) {
1844
+ await (0, n8n_workflow_1.sleep)(paginationOptions.requestInterval);
1845
+ }
1745
1846
  if (tempResponseData.statusCode < 200 || tempResponseData.statusCode >= 300) {
1746
1847
  let data = tempResponseData.body;
1747
1848
  if ((data === null || data === void 0 ? void 0 : data.constructor.name) === 'IncomingMessage' &&
@@ -1962,7 +2063,7 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
1962
2063
  ...getCommonWorkflowFunctions(workflow, node, additionalData),
1963
2064
  ...executionCancellationFunctions(abortSignal),
1964
2065
  getMode: () => mode,
1965
- getCredentials: async (type, itemIndex) => getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex),
2066
+ getCredentials: async (type, itemIndex) => getCredentials(workflow, node, type, additionalData, mode, executeData, runExecutionData, runIndex, connectionInputData, itemIndex),
1966
2067
  getExecuteData: () => executeData,
1967
2068
  continueOnFail: () => continueOnFail(node),
1968
2069
  evaluateExpression: (expression, itemIndex) => {
@@ -1983,100 +2084,7 @@ function getExecuteFunctions(workflow, runExecutionData, runIndex, connectionInp
1983
2084
  return n8n_workflow_1.NodeHelpers.getContext(runExecutionData, type, node);
1984
2085
  },
1985
2086
  async getInputConnectionData(inputName, itemIndex, inputIndex) {
1986
- var _a;
1987
- const node = this.getNode();
1988
- const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
1989
- const inputs = n8n_workflow_1.NodeHelpers.getNodeInputs(workflow, node, nodeType.description);
1990
- let inputConfiguration = inputs.find((input) => {
1991
- if (typeof input === 'string') {
1992
- return input === inputName;
1993
- }
1994
- return input.type === inputName;
1995
- });
1996
- if (inputConfiguration === undefined) {
1997
- throw new n8n_workflow_1.ApplicationError('Node does not have input of type', {
1998
- extra: { nodeName: node.name, inputName },
1999
- });
2000
- }
2001
- if (typeof inputConfiguration === 'string') {
2002
- inputConfiguration = {
2003
- type: inputConfiguration,
2004
- };
2005
- }
2006
- const parentNodes = workflow.getParentNodes(node.name, inputName, 1);
2007
- if (parentNodes.length === 0) {
2008
- return inputConfiguration.maxConnections === 1 ? undefined : [];
2009
- }
2010
- const constParentNodes = parentNodes
2011
- .map((nodeName) => {
2012
- return workflow.getNode(nodeName);
2013
- })
2014
- .filter((connectedNode) => connectedNode.disabled !== true)
2015
- .map(async (connectedNode) => {
2016
- const nodeType = workflow.nodeTypes.getByNameAndVersion(connectedNode.type, connectedNode.typeVersion);
2017
- if (!nodeType.supplyData) {
2018
- throw new n8n_workflow_1.ApplicationError('Node does not have a `supplyData` method defined', {
2019
- extra: { nodeName: connectedNode.name },
2020
- });
2021
- }
2022
- const context = Object.assign({}, this);
2023
- context.getNodeParameter = (parameterName, itemIndex, fallbackValue, options) => {
2024
- return getNodeParameter(workflow, runExecutionData, runIndex, connectionInputData, connectedNode, parameterName, itemIndex, mode, getAdditionalKeys(additionalData, mode, runExecutionData), executeData, fallbackValue, { ...(options || {}), contextNode: node });
2025
- };
2026
- context.getNode = () => {
2027
- return (0, n8n_workflow_1.deepCopy)(connectedNode);
2028
- };
2029
- context.getCredentials = async (key) => {
2030
- try {
2031
- return await getCredentials(workflow, connectedNode, key, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex);
2032
- }
2033
- catch (error) {
2034
- let currentNodeRunIndex = 0;
2035
- if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
2036
- currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
2037
- }
2038
- await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
2039
- throw error;
2040
- }
2041
- };
2042
- try {
2043
- const response = await nodeType.supplyData.call(context, itemIndex);
2044
- if (response.closeFunction) {
2045
- closeFunctions.push(response.closeFunction);
2046
- }
2047
- return response;
2048
- }
2049
- catch (error) {
2050
- if (error.functionality === 'configuration-node')
2051
- throw error;
2052
- if (!(error instanceof n8n_workflow_1.ExecutionBaseError)) {
2053
- error = new n8n_workflow_1.NodeOperationError(connectedNode, error, {
2054
- itemIndex,
2055
- });
2056
- }
2057
- let currentNodeRunIndex = 0;
2058
- if (runExecutionData.resultData.runData.hasOwnProperty(node.name)) {
2059
- currentNodeRunIndex = runExecutionData.resultData.runData[node.name].length;
2060
- }
2061
- await addExecutionDataFunctions('input', connectedNode.name, error, runExecutionData, inputName, additionalData, node.name, runIndex, currentNodeRunIndex);
2062
- throw new n8n_workflow_1.NodeOperationError(connectedNode, `Error in sub-node ${connectedNode.name}`, {
2063
- itemIndex,
2064
- functionality: 'configuration-node',
2065
- description: error.message,
2066
- });
2067
- }
2068
- });
2069
- const nodes = await Promise.all(constParentNodes);
2070
- if (inputConfiguration.required && nodes.length === 0) {
2071
- throw new n8n_workflow_1.NodeOperationError(node, `A ${inputName} processor node must be connected!`);
2072
- }
2073
- if (inputConfiguration.maxConnections !== undefined &&
2074
- nodes.length > inputConfiguration.maxConnections) {
2075
- throw new n8n_workflow_1.NodeOperationError(node, `Only ${inputConfiguration.maxConnections} ${inputName} processor nodes are/is allowed to be connected!`);
2076
- }
2077
- return inputConfiguration.maxConnections === 1
2078
- ? (_a = (nodes || [])[0]) === null || _a === void 0 ? void 0 : _a.response
2079
- : nodes.map((node) => node.response);
2087
+ return getInputConnectionData.call(this, workflow, runExecutionData, runIndex, connectionInputData, additionalData, executeData, mode, closeFunctions, inputName, itemIndex, inputIndex);
2080
2088
  },
2081
2089
  getNodeOutputs() {
2082
2090
  const nodeType = workflow.nodeTypes.getByNameAndVersion(node.type, node.typeVersion);
@@ -2200,7 +2208,7 @@ function getExecuteSingleFunctions(workflow, runExecutionData, runIndex, connect
2200
2208
  getContext(type) {
2201
2209
  return n8n_workflow_1.NodeHelpers.getContext(runExecutionData, type, node);
2202
2210
  },
2203
- getCredentials: async (type) => getCredentials(workflow, node, type, additionalData, mode, runExecutionData, runIndex, connectionInputData, itemIndex),
2211
+ getCredentials: async (type) => getCredentials(workflow, node, type, additionalData, mode, executeData, runExecutionData, runIndex, connectionInputData, itemIndex),
2204
2212
  getInputData: (inputIndex = 0, inputName = 'main') => {
2205
2213
  if (!inputData.hasOwnProperty(inputName)) {
2206
2214
  return { json: {} };
@@ -2325,7 +2333,7 @@ function getExecuteHookFunctions(workflow, node, additionalData, mode, activatio
2325
2333
  })(workflow, node);
2326
2334
  }
2327
2335
  exports.getExecuteHookFunctions = getExecuteHookFunctions;
2328
- function getExecuteWebhookFunctions(workflow, node, additionalData, mode, webhookData) {
2336
+ function getExecuteWebhookFunctions(workflow, node, additionalData, mode, webhookData, closeFunctions) {
2329
2337
  return ((workflow, node) => {
2330
2338
  return {
2331
2339
  ...getCommonWorkflowFunctions(workflow, node, additionalData),
@@ -2342,6 +2350,26 @@ function getExecuteWebhookFunctions(workflow, node, additionalData, mode, webhoo
2342
2350
  }
2343
2351
  return additionalData.httpRequest.headers;
2344
2352
  },
2353
+ async getInputConnectionData(inputName, itemIndex, inputIndex) {
2354
+ var _a;
2355
+ const connectionInputData = [
2356
+ { json: ((_a = additionalData.httpRequest) === null || _a === void 0 ? void 0 : _a.body) || {} },
2357
+ ];
2358
+ const runExecutionData = {
2359
+ resultData: {
2360
+ runData: {},
2361
+ },
2362
+ };
2363
+ const executeData = {
2364
+ data: {
2365
+ main: [connectionInputData],
2366
+ },
2367
+ node,
2368
+ source: null,
2369
+ };
2370
+ const runIndex = 0;
2371
+ return getInputConnectionData.call(this, workflow, runExecutionData, runIndex, connectionInputData, additionalData, executeData, mode, closeFunctions, inputName, itemIndex, inputIndex);
2372
+ },
2345
2373
  getMode: () => mode,
2346
2374
  getNodeParameter: (parameterName, fallbackValue, options) => {
2347
2375
  const runExecutionData = null;