n8n-nodes-base 1.88.0 → 1.90.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.
Files changed (80) hide show
  1. package/dist/credentials/Aws.credentials.js +16 -2
  2. package/dist/credentials/Aws.credentials.js.map +1 -1
  3. package/dist/credentials/CustomerIoApi.credentials.js +2 -2
  4. package/dist/credentials/CustomerIoApi.credentials.js.map +1 -1
  5. package/dist/nodes/Airtable/v2/actions/record/update.operation.js +15 -3
  6. package/dist/nodes/Airtable/v2/actions/record/update.operation.js.map +1 -1
  7. package/dist/nodes/Aws/__tests__/credentials.js +35 -0
  8. package/dist/nodes/Aws/__tests__/credentials.js.map +1 -0
  9. package/dist/nodes/Code/Pyodide.js +16 -1
  10. package/dist/nodes/Code/Pyodide.js.map +1 -1
  11. package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js +1 -1
  12. package/dist/nodes/EmailReadImap/v2/EmailReadImapV2.node.js.map +1 -1
  13. package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow/methods/localResourceMapping.js +3 -1
  14. package/dist/nodes/ExecuteWorkflow/ExecuteWorkflow/methods/localResourceMapping.js.map +1 -1
  15. package/dist/nodes/Form/formCompletionUtils.js +1 -3
  16. package/dist/nodes/Form/formCompletionUtils.js.map +1 -1
  17. package/dist/nodes/Form/utils.js +2 -7
  18. package/dist/nodes/Form/utils.js.map +1 -1
  19. package/dist/nodes/Freshdesk/Freshdesk.node.js +3 -6
  20. package/dist/nodes/Freshdesk/Freshdesk.node.js.map +1 -1
  21. package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js +12 -4
  22. package/dist/nodes/Google/Sheet/GoogleSheetsTrigger.node.js.map +1 -1
  23. package/dist/nodes/HttpRequest/V3/Description.js +8 -0
  24. package/dist/nodes/HttpRequest/V3/Description.js.map +1 -1
  25. package/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js +23 -5
  26. package/dist/nodes/HttpRequest/V3/HttpRequestV3.node.js.map +1 -1
  27. package/dist/nodes/HttpRequest/shared/optimizeResponse.js +387 -0
  28. package/dist/nodes/HttpRequest/shared/optimizeResponse.js.map +1 -0
  29. package/dist/nodes/Hubspot/V2/HubspotV2.node.js +10 -2
  30. package/dist/nodes/Hubspot/V2/HubspotV2.node.js.map +1 -1
  31. package/dist/nodes/Jira/GenericFunctions.js +7 -3
  32. package/dist/nodes/Jira/GenericFunctions.js.map +1 -1
  33. package/dist/nodes/Jira/Jira.node.js +4 -6
  34. package/dist/nodes/Jira/Jira.node.js.map +1 -1
  35. package/dist/nodes/LinkedIn/GenericFunctions.js +1 -1
  36. package/dist/nodes/LinkedIn/GenericFunctions.js.map +1 -1
  37. package/dist/nodes/Microsoft/AzureCosmosDb/test/credentials.js +36 -0
  38. package/dist/nodes/Microsoft/AzureCosmosDb/test/credentials.js.map +1 -0
  39. package/dist/nodes/Microsoft/Excel/test/credentials.js +36 -0
  40. package/dist/nodes/Microsoft/Excel/test/credentials.js.map +1 -0
  41. package/dist/nodes/Microsoft/Storage/test/credentials.js +57 -0
  42. package/dist/nodes/Microsoft/Storage/test/credentials.js.map +1 -0
  43. package/dist/nodes/Microsoft/Teams/test/credentials.js +36 -0
  44. package/dist/nodes/Microsoft/Teams/test/credentials.js.map +1 -0
  45. package/dist/nodes/Postgres/v2/helpers/utils.js +3 -1
  46. package/dist/nodes/Postgres/v2/helpers/utils.js.map +1 -1
  47. package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js +57 -48
  48. package/dist/nodes/RespondToWebhook/RespondToWebhook.node.js.map +1 -1
  49. package/dist/nodes/SplitInBatches/v3/SplitInBatchesV3.node.js +1 -1
  50. package/dist/nodes/SplitInBatches/v3/SplitInBatchesV3.node.js.map +1 -1
  51. package/dist/nodes/Supabase/GenericFunctions.js +13 -4
  52. package/dist/nodes/Supabase/GenericFunctions.js.map +1 -1
  53. package/dist/nodes/Supabase/RowDescription.js +1 -0
  54. package/dist/nodes/Supabase/RowDescription.js.map +1 -1
  55. package/dist/nodes/Supabase/Supabase.node.js +17 -0
  56. package/dist/nodes/Supabase/Supabase.node.js.map +1 -1
  57. package/dist/nodes/Telegram/TelegramTrigger.node.js +4 -60
  58. package/dist/nodes/Telegram/TelegramTrigger.node.js.map +1 -1
  59. package/dist/nodes/Telegram/util/triggerUtils.js +88 -0
  60. package/dist/nodes/Telegram/util/triggerUtils.js.map +1 -0
  61. package/dist/nodes/Wait/Wait.node.js +5 -6
  62. package/dist/nodes/Wait/Wait.node.js.map +1 -1
  63. package/dist/nodes/Wordpress/__tests__/workflow/credentials.js +36 -0
  64. package/dist/nodes/Wordpress/__tests__/workflow/credentials.js.map +1 -0
  65. package/dist/test/globalSetup.js +3 -0
  66. package/dist/test/globalSetup.js.map +1 -1
  67. package/dist/test/nodes/ExecuteWorkflow.js +3 -2
  68. package/dist/test/nodes/ExecuteWorkflow.js.map +1 -1
  69. package/dist/test/nodes/Helpers.js +4 -15
  70. package/dist/test/nodes/Helpers.js.map +1 -1
  71. package/dist/test/nodes/TriggerHelpers.js +5 -2
  72. package/dist/test/nodes/TriggerHelpers.js.map +1 -1
  73. package/dist/test/nodes/credentials-helper.js +9 -13
  74. package/dist/test/nodes/credentials-helper.js.map +1 -1
  75. package/dist/types/nodes.json +6 -6
  76. package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js +6 -1
  77. package/dist/utils/workflowInputsResourceMapping/GenericFunctions.js.map +1 -1
  78. package/package.json +14 -11
  79. package/dist/test/nodes/FakeCredentialsMap.js +0 -313
  80. package/dist/test/nodes/FakeCredentialsMap.js.map +0 -1
@@ -453,13 +453,27 @@ class Aws {
453
453
  body = "";
454
454
  }
455
455
  path = endpoint.pathname + endpoint.search;
456
+ const requestWithForm = requestOptions;
457
+ let bodyContent = body !== "" ? body : void 0;
458
+ let contentTypeHeader = void 0;
459
+ if (requestWithForm.form) {
460
+ const params = new URLSearchParams();
461
+ for (const key in requestWithForm.form) {
462
+ params.append(key, requestWithForm.form[key]);
463
+ }
464
+ bodyContent = params.toString();
465
+ contentTypeHeader = "application/x-www-form-urlencoded";
466
+ }
456
467
  const signOpts = {
457
468
  ...requestOptions,
458
- headers: requestOptions.headers ?? {},
469
+ headers: {
470
+ ...requestOptions.headers ?? {},
471
+ ...contentTypeHeader && { "content-type": contentTypeHeader }
472
+ },
459
473
  host: endpoint.host,
460
474
  method,
461
475
  path,
462
- body: body !== "" ? body : void 0,
476
+ body: bodyContent,
463
477
  region
464
478
  };
465
479
  const securityHeaders = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../../credentials/Aws.credentials.ts"],"sourcesContent":["import type { Request } from 'aws4';\nimport { sign } from 'aws4';\nimport type {\n\tICredentialDataDecryptedObject,\n\tICredentialTestRequest,\n\tICredentialType,\n\tIDataObject,\n\tIHttpRequestOptions,\n\tINodeProperties,\n\tIRequestOptions,\n} from 'n8n-workflow';\nimport { isObjectEmpty } from 'n8n-workflow';\n\nexport const regions = [\n\t{\n\t\tname: 'af-south-1',\n\t\tdisplayName: 'Africa',\n\t\tlocation: 'Cape Town',\n\t},\n\t{\n\t\tname: 'ap-east-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Hong Kong',\n\t},\n\t{\n\t\tname: 'ap-south-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Mumbai',\n\t},\n\t{\n\t\tname: 'ap-south-2',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Hyderabad',\n\t},\n\t{\n\t\tname: 'ap-southeast-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Singapore',\n\t},\n\t{\n\t\tname: 'ap-southeast-2',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Sydney',\n\t},\n\t{\n\t\tname: 'ap-southeast-3',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Jakarta',\n\t},\n\t{\n\t\tname: 'ap-southeast-4',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Melbourne',\n\t},\n\t{\n\t\tname: 'ap-southeast-5',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Malaysia',\n\t},\n\t{\n\t\tname: 'ap-southeast-7',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Thailand',\n\t},\n\t{\n\t\tname: 'ap-northeast-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Tokyo',\n\t},\n\t{\n\t\tname: 'ap-northeast-2',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Seoul',\n\t},\n\t{\n\t\tname: 'ap-northeast-3',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Osaka',\n\t},\n\t{\n\t\tname: 'ca-central-1',\n\t\tdisplayName: 'Canada',\n\t\tlocation: 'Central',\n\t},\n\t{\n\t\tname: 'ca-west-1',\n\t\tdisplayName: 'Canada West',\n\t\tlocation: 'Calgary',\n\t},\n\t{\n\t\tname: 'cn-north-1',\n\t\tdisplayName: 'China',\n\t\tlocation: 'Beijing',\n\t},\n\t{\n\t\tname: 'cn-northwest-1',\n\t\tdisplayName: 'China',\n\t\tlocation: 'Ningxia',\n\t},\n\t{\n\t\tname: 'eu-central-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Frankfurt',\n\t},\n\t{\n\t\tname: 'eu-central-2',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Zurich',\n\t},\n\t{\n\t\tname: 'eu-north-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Stockholm',\n\t},\n\t{\n\t\tname: 'eu-south-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Milan',\n\t},\n\t{\n\t\tname: 'eu-south-2',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Spain',\n\t},\n\t{\n\t\tname: 'eu-west-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Ireland',\n\t},\n\t{\n\t\tname: 'eu-west-2',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'London',\n\t},\n\t{\n\t\tname: 'eu-west-3',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Paris',\n\t},\n\t{\n\t\tname: 'il-central-1',\n\t\tdisplayName: 'Israel',\n\t\tlocation: 'Tel Aviv',\n\t},\n\t{\n\t\tname: 'me-central-1',\n\t\tdisplayName: 'Middle East',\n\t\tlocation: 'UAE',\n\t},\n\t{\n\t\tname: 'me-south-1',\n\t\tdisplayName: 'Middle East',\n\t\tlocation: 'Bahrain',\n\t},\n\t{\n\t\tname: 'mx-central-1',\n\t\tdisplayName: 'Mexico',\n\t\tlocation: 'Central',\n\t},\n\t{\n\t\tname: 'sa-east-1',\n\t\tdisplayName: 'South America',\n\t\tlocation: 'São Paulo',\n\t},\n\t{\n\t\tname: 'us-east-1',\n\t\tdisplayName: 'US East',\n\t\tlocation: 'N. Virginia',\n\t},\n\t{\n\t\tname: 'us-east-2',\n\t\tdisplayName: 'US East',\n\t\tlocation: 'Ohio',\n\t},\n\t{\n\t\tname: 'us-gov-east-1',\n\t\tdisplayName: 'US East',\n\t\tlocation: 'GovCloud',\n\t},\n\t{\n\t\tname: 'us-west-1',\n\t\tdisplayName: 'US West',\n\t\tlocation: 'N. California',\n\t},\n\t{\n\t\tname: 'us-west-2',\n\t\tdisplayName: 'US West',\n\t\tlocation: 'Oregon',\n\t},\n\t{\n\t\tname: 'us-gov-west-1',\n\t\tdisplayName: 'US West',\n\t\tlocation: 'GovCloud',\n\t},\n] as const;\n\nexport type AWSRegion = (typeof regions)[number]['name'];\nexport type AwsCredentialsType = {\n\tregion: AWSRegion;\n\taccessKeyId: string;\n\tsecretAccessKey: string;\n\ttemporaryCredentials: boolean;\n\tcustomEndpoints: boolean;\n\tsessionToken?: string;\n\trekognitionEndpoint?: string;\n\tlambdaEndpoint?: string;\n\tsnsEndpoint?: string;\n\tsesEndpoint?: string;\n\tsqsEndpoint?: string;\n\ts3Endpoint?: string;\n\tssmEndpoint?: string;\n};\n\n// Some AWS services are global and don't have a region\n// https://docs.aws.amazon.com/general/latest/gr/rande.html#global-endpoints\n// Example: iam.amazonaws.com (global), s3.us-east-1.amazonaws.com (regional)\nfunction parseAwsUrl(url: URL): { region: AWSRegion | null; service: string } {\n\tconst [service, region] = url.hostname.replace('amazonaws.com', '').split('.');\n\treturn { service, region: region as AWSRegion };\n}\n\nexport class Aws implements ICredentialType {\n\tname = 'aws';\n\n\tdisplayName = 'AWS';\n\n\tdocumentationUrl = 'aws';\n\n\ticon = { light: 'file:icons/AWS.svg', dark: 'file:icons/AWS.dark.svg' } as const;\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Region',\n\t\t\tname: 'region',\n\t\t\ttype: 'options',\n\t\t\toptions: regions.map((r) => ({\n\t\t\t\tname: `${r.displayName} (${r.location}) - ${r.name}`,\n\t\t\t\tvalue: r.name,\n\t\t\t})),\n\t\t\tdefault: 'us-east-1',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Access Key ID',\n\t\t\tname: 'accessKeyId',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Secret Access Key',\n\t\t\tname: 'secretAccessKey',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Temporary Security Credentials',\n\t\t\tname: 'temporaryCredentials',\n\t\t\tdescription: 'Support for temporary credentials from AWS STS',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Session Token',\n\t\t\tname: 'sessionToken',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\ttemporaryCredentials: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Custom Endpoints',\n\t\t\tname: 'customEndpoints',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Rekognition Endpoint',\n\t\t\tname: 'rekognitionEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Rekognition using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://rekognition.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Lambda Endpoint',\n\t\t\tname: 'lambdaEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Lambda using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://lambda.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SNS Endpoint',\n\t\t\tname: 'snsEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and SNS using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://sns.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SES Endpoint',\n\t\t\tname: 'sesEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and SES using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://email.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SQS Endpoint',\n\t\t\tname: 'sqsEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and SQS using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://sqs.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'S3 Endpoint',\n\t\t\tname: 's3Endpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and S3 using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://s3.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SSM Endpoint',\n\t\t\tname: 'ssmEndpoint',\n\t\t\tdescription: 'Endpoint for AWS Systems Manager (SSM)',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://ssm.{region}.amazonaws.com',\n\t\t},\n\t];\n\n\tasync authenticate(\n\t\trawCredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\tconst credentials = rawCredentials as AwsCredentialsType;\n\t\tlet endpoint: URL;\n\t\tlet service = requestOptions.qs?.service as string;\n\t\tlet path = (requestOptions.qs?.path as string) ?? '';\n\t\tconst method = requestOptions.method;\n\t\tlet body = requestOptions.body;\n\n\t\tlet region = credentials.region;\n\t\tif (requestOptions.qs?._region) {\n\t\t\tregion = requestOptions.qs._region as AWSRegion;\n\t\t\tdelete requestOptions.qs._region;\n\t\t}\n\n\t\tlet query = requestOptions.qs?.query as IDataObject;\n\t\t// ! Workaround as we still use the IRequestOptions interface which uses uri instead of url\n\t\t// ! To change when we replace the interface with IHttpRequestOptions\n\t\tconst requestWithUri = requestOptions as unknown as IRequestOptions;\n\t\tif (requestWithUri.uri) {\n\t\t\trequestOptions.url = requestWithUri.uri;\n\t\t\tendpoint = new URL(requestOptions.url);\n\t\t\tif (service === 'sts') {\n\t\t\t\ttry {\n\t\t\t\t\tif (requestWithUri.qs?.Action !== 'GetCallerIdentity') {\n\t\t\t\t\t\tquery = requestWithUri.qs as IDataObject;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpoint.searchParams.set('Action', 'GetCallerIdentity');\n\t\t\t\t\t\tendpoint.searchParams.set('Version', '2011-06-15');\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst parsed = parseAwsUrl(endpoint);\n\t\t\tservice = parsed.service;\n\t\t\tif (parsed.region) {\n\t\t\t\tregion = parsed.region;\n\t\t\t}\n\t\t} else {\n\t\t\tif (!requestOptions.baseURL && !requestOptions.url) {\n\t\t\t\tlet endpointString: string;\n\t\t\t\tif (service === 'lambda' && credentials.lambdaEndpoint) {\n\t\t\t\t\tendpointString = credentials.lambdaEndpoint;\n\t\t\t\t} else if (service === 'sns' && credentials.snsEndpoint) {\n\t\t\t\t\tendpointString = credentials.snsEndpoint;\n\t\t\t\t} else if (service === 'sqs' && credentials.sqsEndpoint) {\n\t\t\t\t\tendpointString = credentials.sqsEndpoint;\n\t\t\t\t} else if (service === 's3' && credentials.s3Endpoint) {\n\t\t\t\t\tendpointString = credentials.s3Endpoint;\n\t\t\t\t} else if (service === 'ses' && credentials.sesEndpoint) {\n\t\t\t\t\tendpointString = credentials.sesEndpoint;\n\t\t\t\t} else if (service === 'rekognition' && credentials.rekognitionEndpoint) {\n\t\t\t\t\tendpointString = credentials.rekognitionEndpoint;\n\t\t\t\t} else if (service === 'sqs' && credentials.sqsEndpoint) {\n\t\t\t\t\tendpointString = credentials.sqsEndpoint;\n\t\t\t\t} else if (service) {\n\t\t\t\t\tendpointString = `https://${service}.${region}.amazonaws.com`;\n\t\t\t\t} else if (service === 'ssm' && credentials.ssmEndpoint) {\n\t\t\t\t\tendpointString = credentials.ssmEndpoint;\n\t\t\t\t}\n\t\t\t\tendpoint = new URL(endpointString!.replace('{region}', region) + path);\n\t\t\t} else {\n\t\t\t\t// If no endpoint is set, we try to decompose the path and use the default endpoint\n\t\t\t\tconst customUrl = new URL(`${requestOptions.baseURL!}${requestOptions.url}${path}`);\n\t\t\t\tconst parsed = parseAwsUrl(customUrl);\n\t\t\t\tservice = parsed.service;\n\t\t\t\tif (parsed.region) {\n\t\t\t\t\tregion = parsed.region;\n\t\t\t\t}\n\t\t\t\tif (service === 'sts') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcustomUrl.searchParams.set('Action', 'GetCallerIdentity');\n\t\t\t\t\t\tcustomUrl.searchParams.set('Version', '2011-06-15');\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tendpoint = customUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (query && Object.keys(query).length !== 0) {\n\t\t\tObject.keys(query).forEach((key) => {\n\t\t\t\tendpoint.searchParams.append(key, query[key] as string);\n\t\t\t});\n\t\t}\n\n\t\tif (body && typeof body === 'object' && isObjectEmpty(body)) {\n\t\t\tbody = '';\n\t\t}\n\n\t\tpath = endpoint.pathname + endpoint.search;\n\n\t\tconst signOpts = {\n\t\t\t...requestOptions,\n\t\t\theaders: requestOptions.headers ?? {},\n\t\t\thost: endpoint.host,\n\t\t\tmethod,\n\t\t\tpath,\n\t\t\tbody: body !== '' ? body : undefined,\n\t\t\tregion,\n\t\t} as Request;\n\n\t\tconst securityHeaders = {\n\t\t\taccessKeyId: `${credentials.accessKeyId}`.trim(),\n\t\t\tsecretAccessKey: `${credentials.secretAccessKey}`.trim(),\n\t\t\tsessionToken: credentials.temporaryCredentials\n\t\t\t\t? `${credentials.sessionToken}`.trim()\n\t\t\t\t: undefined,\n\t\t};\n\t\ttry {\n\t\t\tsign(signOpts, securityHeaders);\n\t\t} catch (err) {\n\t\t\tconsole.error(err);\n\t\t}\n\t\tconst options: IHttpRequestOptions = {\n\t\t\t...requestOptions,\n\t\t\theaders: signOpts.headers,\n\t\t\tmethod,\n\t\t\turl: endpoint.origin + path,\n\t\t\tbody: signOpts.body,\n\t\t\tqs: undefined, // override since it's already in the url\n\t\t};\n\n\t\treturn options;\n\t}\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '=https://sts.{{$credentials.region}}.amazonaws.com',\n\t\t\turl: '?Action=GetCallerIdentity&Version=2011-06-15',\n\t\t\tmethod: 'POST',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;AAUrB,0BAA8B;AAEvB,MAAM,UAAU;AAAA,EACtB;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;A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AEpC,UAAM,WAAW;AAAA,MAChB,GAAG;AAAA,MACH,SAAS,eAAe,WAAW,CAAC;AAAA,MACpC,MAAM,SAAS;AAAA,MACf;AAAA,MACA;AAAA,MACA,MAAM,SAAS,KAAK,OAAO;AAAA,MAC3B;AAAA,IACD;AAEA,UAAM,kBAAkB;AAAA,MACvB,aAAa,GAAG,YAAY,WAAW,GAAG,KAAK;AAAA,MAC/C,iBAAiB,GAAG,YAAY,eAAe,GAAG,KAAK;AAAA,MACvD,cAAc,YAAY,uBACvB,GAAG,YAAY,YAAY,GAAG,KAAK,IACnC;AAAA,IACJ;AACA,QAAI;AACH,4BAAK,UAAU,eAAe;AAAA,IAC/B,SAAS,KAAK;AACb,cAAQ,MAAM,GAAG;AAAA,IAClB;AACA,UAAM,UAA+B;AAAA,MACpC,GAAG;AAAA,MACH,SAAS,SAAS;AAAA,MAClB;AAAA,MACA,KAAK,SAAS,SAAS;AAAA,MACvB,MAAM,SAAS;AAAA,MACf,IAAI;AAAA;AAAA,IACL;AAEA,WAAO;AAAA,EACR;AASD;","names":[]}
1
+ {"version":3,"sources":["../../credentials/Aws.credentials.ts"],"sourcesContent":["import type { Request } from 'aws4';\nimport { sign } from 'aws4';\nimport type {\n\tICredentialDataDecryptedObject,\n\tICredentialTestRequest,\n\tICredentialType,\n\tIDataObject,\n\tIHttpRequestOptions,\n\tINodeProperties,\n\tIRequestOptions,\n} from 'n8n-workflow';\nimport { isObjectEmpty } from 'n8n-workflow';\n\nexport const regions = [\n\t{\n\t\tname: 'af-south-1',\n\t\tdisplayName: 'Africa',\n\t\tlocation: 'Cape Town',\n\t},\n\t{\n\t\tname: 'ap-east-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Hong Kong',\n\t},\n\t{\n\t\tname: 'ap-south-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Mumbai',\n\t},\n\t{\n\t\tname: 'ap-south-2',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Hyderabad',\n\t},\n\t{\n\t\tname: 'ap-southeast-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Singapore',\n\t},\n\t{\n\t\tname: 'ap-southeast-2',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Sydney',\n\t},\n\t{\n\t\tname: 'ap-southeast-3',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Jakarta',\n\t},\n\t{\n\t\tname: 'ap-southeast-4',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Melbourne',\n\t},\n\t{\n\t\tname: 'ap-southeast-5',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Malaysia',\n\t},\n\t{\n\t\tname: 'ap-southeast-7',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Thailand',\n\t},\n\t{\n\t\tname: 'ap-northeast-1',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Tokyo',\n\t},\n\t{\n\t\tname: 'ap-northeast-2',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Seoul',\n\t},\n\t{\n\t\tname: 'ap-northeast-3',\n\t\tdisplayName: 'Asia Pacific',\n\t\tlocation: 'Osaka',\n\t},\n\t{\n\t\tname: 'ca-central-1',\n\t\tdisplayName: 'Canada',\n\t\tlocation: 'Central',\n\t},\n\t{\n\t\tname: 'ca-west-1',\n\t\tdisplayName: 'Canada West',\n\t\tlocation: 'Calgary',\n\t},\n\t{\n\t\tname: 'cn-north-1',\n\t\tdisplayName: 'China',\n\t\tlocation: 'Beijing',\n\t},\n\t{\n\t\tname: 'cn-northwest-1',\n\t\tdisplayName: 'China',\n\t\tlocation: 'Ningxia',\n\t},\n\t{\n\t\tname: 'eu-central-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Frankfurt',\n\t},\n\t{\n\t\tname: 'eu-central-2',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Zurich',\n\t},\n\t{\n\t\tname: 'eu-north-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Stockholm',\n\t},\n\t{\n\t\tname: 'eu-south-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Milan',\n\t},\n\t{\n\t\tname: 'eu-south-2',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Spain',\n\t},\n\t{\n\t\tname: 'eu-west-1',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Ireland',\n\t},\n\t{\n\t\tname: 'eu-west-2',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'London',\n\t},\n\t{\n\t\tname: 'eu-west-3',\n\t\tdisplayName: 'Europe',\n\t\tlocation: 'Paris',\n\t},\n\t{\n\t\tname: 'il-central-1',\n\t\tdisplayName: 'Israel',\n\t\tlocation: 'Tel Aviv',\n\t},\n\t{\n\t\tname: 'me-central-1',\n\t\tdisplayName: 'Middle East',\n\t\tlocation: 'UAE',\n\t},\n\t{\n\t\tname: 'me-south-1',\n\t\tdisplayName: 'Middle East',\n\t\tlocation: 'Bahrain',\n\t},\n\t{\n\t\tname: 'mx-central-1',\n\t\tdisplayName: 'Mexico',\n\t\tlocation: 'Central',\n\t},\n\t{\n\t\tname: 'sa-east-1',\n\t\tdisplayName: 'South America',\n\t\tlocation: 'São Paulo',\n\t},\n\t{\n\t\tname: 'us-east-1',\n\t\tdisplayName: 'US East',\n\t\tlocation: 'N. Virginia',\n\t},\n\t{\n\t\tname: 'us-east-2',\n\t\tdisplayName: 'US East',\n\t\tlocation: 'Ohio',\n\t},\n\t{\n\t\tname: 'us-gov-east-1',\n\t\tdisplayName: 'US East',\n\t\tlocation: 'GovCloud',\n\t},\n\t{\n\t\tname: 'us-west-1',\n\t\tdisplayName: 'US West',\n\t\tlocation: 'N. California',\n\t},\n\t{\n\t\tname: 'us-west-2',\n\t\tdisplayName: 'US West',\n\t\tlocation: 'Oregon',\n\t},\n\t{\n\t\tname: 'us-gov-west-1',\n\t\tdisplayName: 'US West',\n\t\tlocation: 'GovCloud',\n\t},\n] as const;\n\nexport type AWSRegion = (typeof regions)[number]['name'];\nexport type AwsCredentialsType = {\n\tregion: AWSRegion;\n\taccessKeyId: string;\n\tsecretAccessKey: string;\n\ttemporaryCredentials: boolean;\n\tcustomEndpoints: boolean;\n\tsessionToken?: string;\n\trekognitionEndpoint?: string;\n\tlambdaEndpoint?: string;\n\tsnsEndpoint?: string;\n\tsesEndpoint?: string;\n\tsqsEndpoint?: string;\n\ts3Endpoint?: string;\n\tssmEndpoint?: string;\n};\n\n// Some AWS services are global and don't have a region\n// https://docs.aws.amazon.com/general/latest/gr/rande.html#global-endpoints\n// Example: iam.amazonaws.com (global), s3.us-east-1.amazonaws.com (regional)\nfunction parseAwsUrl(url: URL): { region: AWSRegion | null; service: string } {\n\tconst [service, region] = url.hostname.replace('amazonaws.com', '').split('.');\n\treturn { service, region: region as AWSRegion };\n}\n\nexport class Aws implements ICredentialType {\n\tname = 'aws';\n\n\tdisplayName = 'AWS';\n\n\tdocumentationUrl = 'aws';\n\n\ticon = { light: 'file:icons/AWS.svg', dark: 'file:icons/AWS.dark.svg' } as const;\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Region',\n\t\t\tname: 'region',\n\t\t\ttype: 'options',\n\t\t\toptions: regions.map((r) => ({\n\t\t\t\tname: `${r.displayName} (${r.location}) - ${r.name}`,\n\t\t\t\tvalue: r.name,\n\t\t\t})),\n\t\t\tdefault: 'us-east-1',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Access Key ID',\n\t\t\tname: 'accessKeyId',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Secret Access Key',\n\t\t\tname: 'secretAccessKey',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Temporary Security Credentials',\n\t\t\tname: 'temporaryCredentials',\n\t\t\tdescription: 'Support for temporary credentials from AWS STS',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Session Token',\n\t\t\tname: 'sessionToken',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\ttemporaryCredentials: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\ttypeOptions: {\n\t\t\t\tpassword: true,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Custom Endpoints',\n\t\t\tname: 'customEndpoints',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Rekognition Endpoint',\n\t\t\tname: 'rekognitionEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Rekognition using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://rekognition.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Lambda Endpoint',\n\t\t\tname: 'lambdaEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and Lambda using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://lambda.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SNS Endpoint',\n\t\t\tname: 'snsEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and SNS using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://sns.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SES Endpoint',\n\t\t\tname: 'sesEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and SES using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://email.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SQS Endpoint',\n\t\t\tname: 'sqsEndpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and SQS using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://sqs.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'S3 Endpoint',\n\t\t\tname: 's3Endpoint',\n\t\t\tdescription:\n\t\t\t\t'If you use Amazon VPC to host n8n, you can establish a connection between your VPC and S3 using a VPC endpoint. Leave blank to use the default endpoint.',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://s3.{region}.amazonaws.com',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'SSM Endpoint',\n\t\t\tname: 'ssmEndpoint',\n\t\t\tdescription: 'Endpoint for AWS Systems Manager (SSM)',\n\t\t\ttype: 'string',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tcustomEndpoints: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdefault: '',\n\t\t\tplaceholder: 'https://ssm.{region}.amazonaws.com',\n\t\t},\n\t];\n\n\tasync authenticate(\n\t\trawCredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\tconst credentials = rawCredentials as AwsCredentialsType;\n\t\tlet endpoint: URL;\n\t\tlet service = requestOptions.qs?.service as string;\n\t\tlet path = (requestOptions.qs?.path as string) ?? '';\n\t\tconst method = requestOptions.method;\n\t\tlet body = requestOptions.body;\n\n\t\tlet region = credentials.region;\n\t\tif (requestOptions.qs?._region) {\n\t\t\tregion = requestOptions.qs._region as AWSRegion;\n\t\t\tdelete requestOptions.qs._region;\n\t\t}\n\n\t\tlet query = requestOptions.qs?.query as IDataObject;\n\t\t// ! Workaround as we still use the IRequestOptions interface which uses uri instead of url\n\t\t// ! To change when we replace the interface with IHttpRequestOptions\n\t\tconst requestWithUri = requestOptions as unknown as IRequestOptions;\n\t\tif (requestWithUri.uri) {\n\t\t\trequestOptions.url = requestWithUri.uri;\n\t\t\tendpoint = new URL(requestOptions.url);\n\t\t\tif (service === 'sts') {\n\t\t\t\ttry {\n\t\t\t\t\tif (requestWithUri.qs?.Action !== 'GetCallerIdentity') {\n\t\t\t\t\t\tquery = requestWithUri.qs as IDataObject;\n\t\t\t\t\t} else {\n\t\t\t\t\t\tendpoint.searchParams.set('Action', 'GetCallerIdentity');\n\t\t\t\t\t\tendpoint.searchParams.set('Version', '2011-06-15');\n\t\t\t\t\t}\n\t\t\t\t} catch (err) {\n\t\t\t\t\tconsole.error(err);\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst parsed = parseAwsUrl(endpoint);\n\t\t\tservice = parsed.service;\n\t\t\tif (parsed.region) {\n\t\t\t\tregion = parsed.region;\n\t\t\t}\n\t\t} else {\n\t\t\tif (!requestOptions.baseURL && !requestOptions.url) {\n\t\t\t\tlet endpointString: string;\n\t\t\t\tif (service === 'lambda' && credentials.lambdaEndpoint) {\n\t\t\t\t\tendpointString = credentials.lambdaEndpoint;\n\t\t\t\t} else if (service === 'sns' && credentials.snsEndpoint) {\n\t\t\t\t\tendpointString = credentials.snsEndpoint;\n\t\t\t\t} else if (service === 'sqs' && credentials.sqsEndpoint) {\n\t\t\t\t\tendpointString = credentials.sqsEndpoint;\n\t\t\t\t} else if (service === 's3' && credentials.s3Endpoint) {\n\t\t\t\t\tendpointString = credentials.s3Endpoint;\n\t\t\t\t} else if (service === 'ses' && credentials.sesEndpoint) {\n\t\t\t\t\tendpointString = credentials.sesEndpoint;\n\t\t\t\t} else if (service === 'rekognition' && credentials.rekognitionEndpoint) {\n\t\t\t\t\tendpointString = credentials.rekognitionEndpoint;\n\t\t\t\t} else if (service === 'sqs' && credentials.sqsEndpoint) {\n\t\t\t\t\tendpointString = credentials.sqsEndpoint;\n\t\t\t\t} else if (service) {\n\t\t\t\t\tendpointString = `https://${service}.${region}.amazonaws.com`;\n\t\t\t\t} else if (service === 'ssm' && credentials.ssmEndpoint) {\n\t\t\t\t\tendpointString = credentials.ssmEndpoint;\n\t\t\t\t}\n\t\t\t\tendpoint = new URL(endpointString!.replace('{region}', region) + path);\n\t\t\t} else {\n\t\t\t\t// If no endpoint is set, we try to decompose the path and use the default endpoint\n\t\t\t\tconst customUrl = new URL(`${requestOptions.baseURL!}${requestOptions.url}${path}`);\n\t\t\t\tconst parsed = parseAwsUrl(customUrl);\n\t\t\t\tservice = parsed.service;\n\t\t\t\tif (parsed.region) {\n\t\t\t\t\tregion = parsed.region;\n\t\t\t\t}\n\t\t\t\tif (service === 'sts') {\n\t\t\t\t\ttry {\n\t\t\t\t\t\tcustomUrl.searchParams.set('Action', 'GetCallerIdentity');\n\t\t\t\t\t\tcustomUrl.searchParams.set('Version', '2011-06-15');\n\t\t\t\t\t} catch (err) {\n\t\t\t\t\t\tconsole.error(err);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tendpoint = customUrl;\n\t\t\t}\n\t\t}\n\n\t\tif (query && Object.keys(query).length !== 0) {\n\t\t\tObject.keys(query).forEach((key) => {\n\t\t\t\tendpoint.searchParams.append(key, query[key] as string);\n\t\t\t});\n\t\t}\n\n\t\tif (body && typeof body === 'object' && isObjectEmpty(body)) {\n\t\t\tbody = '';\n\t\t}\n\n\t\tpath = endpoint.pathname + endpoint.search;\n\n\t\t// ! aws4.sign *must* have the body to sign, but we might have .form instead of .body\n\t\tconst requestWithForm = requestOptions as unknown as { form?: Record<string, string> };\n\t\tlet bodyContent = body !== '' ? body : undefined;\n\t\tlet contentTypeHeader: string | undefined = undefined;\n\t\tif (requestWithForm.form) {\n\t\t\tconst params = new URLSearchParams();\n\t\t\tfor (const key in requestWithForm.form) {\n\t\t\t\tparams.append(key, requestWithForm.form[key]);\n\t\t\t}\n\t\t\tbodyContent = params.toString();\n\t\t\tcontentTypeHeader = 'application/x-www-form-urlencoded';\n\t\t}\n\n\t\tconst signOpts = {\n\t\t\t...requestOptions,\n\t\t\theaders: {\n\t\t\t\t...(requestOptions.headers ?? {}),\n\t\t\t\t...(contentTypeHeader && { 'content-type': contentTypeHeader }),\n\t\t\t},\n\t\t\thost: endpoint.host,\n\t\t\tmethod,\n\t\t\tpath,\n\t\t\tbody: bodyContent,\n\t\t\tregion,\n\t\t} as Request;\n\n\t\tconst securityHeaders = {\n\t\t\taccessKeyId: `${credentials.accessKeyId}`.trim(),\n\t\t\tsecretAccessKey: `${credentials.secretAccessKey}`.trim(),\n\t\t\tsessionToken: credentials.temporaryCredentials\n\t\t\t\t? `${credentials.sessionToken}`.trim()\n\t\t\t\t: undefined,\n\t\t};\n\t\ttry {\n\t\t\tsign(signOpts, securityHeaders);\n\t\t} catch (err) {\n\t\t\tconsole.error(err);\n\t\t}\n\t\tconst options: IHttpRequestOptions = {\n\t\t\t...requestOptions,\n\t\t\theaders: signOpts.headers,\n\t\t\tmethod,\n\t\t\turl: endpoint.origin + path,\n\t\t\tbody: signOpts.body,\n\t\t\tqs: undefined, // override since it's already in the url\n\t\t};\n\n\t\treturn options;\n\t}\n\n\ttest: ICredentialTestRequest = {\n\t\trequest: {\n\t\t\tbaseURL: '=https://sts.{{$credentials.region}}.amazonaws.com',\n\t\t\turl: '?Action=GetCallerIdentity&Version=2011-06-15',\n\t\t\tmethod: 'POST',\n\t\t},\n\t};\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAqB;AAUrB,0BAA8B;AAEvB,MAAM,UAAU;AAAA,EACtB;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAAA,IACN,aAAa;AAAA,IACb,UAAU;AAAA,EACX;AAAA,EACA;AAAA,IACC,MAAM;AAA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AA,MACA;AAAA,MACA,MAAM;AAAA,MACN;AAAA,IACD;AAEA,UAAM,kBAAkB;AAAA,MACvB,aAAa,GAAG,YAAY,WAAW,GAAG,KAAK;AAAA,MAC/C,iBAAiB,GAAG,YAAY,eAAe,GAAG,KAAK;AAAA,MACvD,cAAc,YAAY,uBACvB,GAAG,YAAY,YAAY,GAAG,KAAK,IACnC;AAAA,IACJ;AACA,QAAI;AACH,4BAAK,UAAU,eAAe;AAAA,IAC/B,SAAS,KAAK;AACb,cAAQ,MAAM,GAAG;AAAA,IAClB;AACA,UAAM,UAA+B;AAAA,MACpC,GAAG;AAAA,MACH,SAAS,SAAS;AAAA,MAClB;AAAA,MACA,KAAK,SAAS,SAAS;AAAA,MACvB,MAAM,SAAS;AAAA,MACf,IAAI;AAAA;AAAA,IACL;AAEA,WAAO;AAAA,EACR;AASD;","names":[]}
@@ -75,12 +75,12 @@ class CustomerIoApi {
75
75
  }
76
76
  async authenticate(credentials, requestOptions) {
77
77
  const url = new URL(requestOptions.url ? requestOptions.url : requestOptions.uri);
78
- if (url.hostname === "track.customer.io" || url.hostname === "api.customer.io") {
78
+ if (url.hostname === "track.customer.io" || url.hostname === "track-eu.customer.io" || url.hostname === "api.customer.io" || url.hostname === "api-eu.customer.io") {
79
79
  const basicAuthKey = Buffer.from(
80
80
  `${credentials.trackingSiteId}:${credentials.trackingApiKey}`
81
81
  ).toString("base64");
82
82
  Object.assign(requestOptions.headers, { Authorization: `Basic ${basicAuthKey}` });
83
- } else if (url.hostname === "beta-api.customer.io") {
83
+ } else if (url.hostname === "beta-api.customer.io" || url.hostname === "beta-api-eu.customer.io") {
84
84
  Object.assign(requestOptions.headers, {
85
85
  Authorization: `Bearer ${credentials.appApiKey}`
86
86
  });
@@ -1 +1 @@
1
- {"version":3,"sources":["../../credentials/CustomerIoApi.credentials.ts"],"sourcesContent":["import { ApplicationError } from 'n8n-workflow';\nimport type {\n\tICredentialDataDecryptedObject,\n\tICredentialType,\n\tIHttpRequestOptions,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class CustomerIoApi implements ICredentialType {\n\tname = 'customerIoApi';\n\n\tdisplayName = 'Customer.io API';\n\n\tdocumentationUrl = 'customerIo';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Tracking API Key',\n\t\t\tname: 'trackingApiKey',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t\tdescription: 'Required for tracking API',\n\t\t\trequired: true,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Region',\n\t\t\tname: 'region',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'EU region',\n\t\t\t\t\tvalue: 'track-eu.customer.io',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Global region',\n\t\t\t\t\tvalue: 'track.customer.io',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'track.customer.io',\n\t\t\tdescription: 'Should be set based on your account region',\n\t\t\thint: 'The region will be omitted when being used with the HTTP node',\n\t\t\trequired: true,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Tracking Site ID',\n\t\t\tname: 'trackingSiteId',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Required for tracking API',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'App API Key',\n\t\t\tname: 'appApiKey',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t\tdescription: 'Required for App API',\n\t\t},\n\t];\n\n\tasync authenticate(\n\t\tcredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\t// @ts-ignore\n\t\tconst url = new URL(requestOptions.url ? requestOptions.url : requestOptions.uri);\n\t\tif (url.hostname === 'track.customer.io' || url.hostname === 'api.customer.io') {\n\t\t\tconst basicAuthKey = Buffer.from(\n\t\t\t\t`${credentials.trackingSiteId}:${credentials.trackingApiKey}`,\n\t\t\t).toString('base64');\n\t\t\t// @ts-ignore\n\t\t\tObject.assign(requestOptions.headers, { Authorization: `Basic ${basicAuthKey}` });\n\t\t} else if (url.hostname === 'beta-api.customer.io') {\n\t\t\t// @ts-ignore\n\t\t\tObject.assign(requestOptions.headers, {\n\t\t\t\tAuthorization: `Bearer ${credentials.appApiKey as string}`,\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new ApplicationError('Unknown way of authenticating', { level: 'warning' });\n\t\t}\n\n\t\treturn requestOptions;\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,0BAAiC;AAQ1B,MAAM,cAAyC;AAAA,EAA/C;AACN,gBAAO;AAEP,uBAAc;AAEd,4BAAmB;AAEnB,sBAAgC;AAAA,MAC/B;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,SAAS;AAAA,QACT,aAAa;AAAA,QACb,UAAU;AAAA,MACX;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,UACR;AAAA,YACC,MAAM;AAAA,YACN,OAAO;AAAA,UACR;AAAA,UACA;AAAA,YACC,MAAM;AAAA,YACN,OAAO;AAAA,UACR;AAAA,QACD;AAAA,QACA,SAAS;AAAA,QACT,aAAa;AAAA,QACb,MAAM;AAAA,QACN,UAAU;AAAA,MACX;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,MACA;AAAA,QACC,aAAa;AAAA,QACb,MAAM;AAAA,QACN,MAAM;AAAA,QACN,aAAa,EAAE,UAAU,KAAK;AAAA,QAC9B,SAAS;AAAA,QACT,aAAa;AAAA,MACd;AAAA,IACD;AAAA;AAAA,EAEA,MAAM,aACL,aACA,gBAC+B;AAE/B,UAAM,MAAM,IAAI,IAAI,eAAe,MAAM,eAAe,MAAM,eAAe,GAAG;AAChF,QAAI,IAAI,aAAa,uBAAuB,IAAI,aAAa,mBAAmB;AAC/E,YAAM,eAAe,OAAO;AAAA,QAC3B,GAAG,YAAY,cAAc,IAAI,YAAY,cAAc;AAAA,MAC5D,EAAE,SAAS,QAAQ;AAEnB,aAAO,OAAO,eAAe,SAAS,EAAE,eAAe,SAAS,YAAY,GAAG,CAAC;AAAA,IACjF,WAAW,IAAI,aAAa,wBAAwB;AAEnD,aAAO,OAAO,eAAe,SAAS;AAAA,QACrC,eAAe,UAAU,YAAY,SAAmB;AAAA,MACzD,CAAC;AAAA,IACF,OAAO;AACN,YAAM,IAAI,qCAAiB,iCAAiC,EAAE,OAAO,UAAU,CAAC;AAAA,IACjF;AAEA,WAAO;AAAA,EACR;AACD;","names":[]}
1
+ {"version":3,"sources":["../../credentials/CustomerIoApi.credentials.ts"],"sourcesContent":["import { ApplicationError } from 'n8n-workflow';\nimport type {\n\tICredentialDataDecryptedObject,\n\tICredentialType,\n\tIHttpRequestOptions,\n\tINodeProperties,\n} from 'n8n-workflow';\n\nexport class CustomerIoApi implements ICredentialType {\n\tname = 'customerIoApi';\n\n\tdisplayName = 'Customer.io API';\n\n\tdocumentationUrl = 'customerIo';\n\n\tproperties: INodeProperties[] = [\n\t\t{\n\t\t\tdisplayName: 'Tracking API Key',\n\t\t\tname: 'trackingApiKey',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t\tdescription: 'Required for tracking API',\n\t\t\trequired: true,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Region',\n\t\t\tname: 'region',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'EU region',\n\t\t\t\t\tvalue: 'track-eu.customer.io',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Global region',\n\t\t\t\t\tvalue: 'track.customer.io',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'track.customer.io',\n\t\t\tdescription: 'Should be set based on your account region',\n\t\t\thint: 'The region will be omitted when being used with the HTTP node',\n\t\t\trequired: true,\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Tracking Site ID',\n\t\t\tname: 'trackingSiteId',\n\t\t\ttype: 'string',\n\t\t\tdefault: '',\n\t\t\tdescription: 'Required for tracking API',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'App API Key',\n\t\t\tname: 'appApiKey',\n\t\t\ttype: 'string',\n\t\t\ttypeOptions: { password: true },\n\t\t\tdefault: '',\n\t\t\tdescription: 'Required for App API',\n\t\t},\n\t];\n\n\tasync authenticate(\n\t\tcredentials: ICredentialDataDecryptedObject,\n\t\trequestOptions: IHttpRequestOptions,\n\t): Promise<IHttpRequestOptions> {\n\t\t// @ts-ignore\n\t\tconst url = new URL(requestOptions.url ? requestOptions.url : requestOptions.uri);\n\t\tif (\n\t\t\turl.hostname === 'track.customer.io' ||\n\t\t\turl.hostname === 'track-eu.customer.io' ||\n\t\t\turl.hostname === 'api.customer.io' ||\n\t\t\turl.hostname === 'api-eu.customer.io'\n\t\t) {\n\t\t\tconst basicAuthKey = Buffer.from(\n\t\t\t\t`${credentials.trackingSiteId}:${credentials.trackingApiKey}`,\n\t\t\t).toString('base64');\n\t\t\t// @ts-ignore\n\t\t\tObject.assign(requestOptions.headers, { Authorization: `Basic ${basicAuthKey}` });\n\t\t} else if (\n\t\t\turl.hostname === 'beta-api.customer.io' ||\n\t\t\turl.hostname === 'beta-api-eu.customer.io'\n\t\t) {\n\t\t\t// @ts-ignore\n\t\t\tObject.assign(requestOptions.headers, {\n\t\t\t\tAuthorization: `Bearer ${credentials.appApiKey as string}`,\n\t\t\t});\n\t\t} else {\n\t\t\tthrow new ApplicationError('Unknown way of authenticating', { level: 'warning' });\n\t\t}\n\n\t\treturn requestOptions;\n\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AAG,CAAC;AAAA,IACjF,WACC,IAAI,aAAa,0BACjB,IAAI,aAAa,2BAChB;AAED,aAAO,OAAO,eAAe,SAAS;AAAA,QACrC,eAAe,UAAU,YAAY,SAAmB;AAAA,MACzD,CAAC;AAAA,IACF,OAAO;AACN,YAAM,IAAI,qCAAiB,iCAAiC,EAAE,OAAO,UAAU,CAAC;AAAA,IACjF;AAEA,WAAO;AAAA,EACR;AACD;","names":[]}
@@ -81,6 +81,7 @@ async function execute(items, base, table) {
81
81
  try {
82
82
  const records = [];
83
83
  const options = this.getNodeParameter("options", i, {});
84
+ const typecast = options.typecast ? true : false;
84
85
  if (dataMode === "autoMapInputData") {
85
86
  if (columnsToMatchOn.includes("id")) {
86
87
  const { id, ...fields } = items[i].json;
@@ -104,11 +105,22 @@ async function execute(items, base, table) {
104
105
  }
105
106
  }
106
107
  if (dataMode === "defineBelow") {
108
+ const getNodeParameterOptions = typecast ? { skipValidation: true } : void 0;
107
109
  if (columnsToMatchOn.includes("id")) {
108
- const { id, ...fields } = this.getNodeParameter("columns.value", i, []);
110
+ const { id, ...fields } = this.getNodeParameter(
111
+ "columns.value",
112
+ i,
113
+ [],
114
+ getNodeParameterOptions
115
+ );
109
116
  records.push({ id, fields });
110
117
  } else {
111
- const fields = this.getNodeParameter("columns.value", i, []);
118
+ const fields = this.getNodeParameter(
119
+ "columns.value",
120
+ i,
121
+ [],
122
+ getNodeParameterOptions
123
+ );
112
124
  const matches = (0, import_utils.findMatches)(
113
125
  tableData,
114
126
  columnsToMatchOn,
@@ -121,7 +133,7 @@ async function execute(items, base, table) {
121
133
  }
122
134
  }
123
135
  }
124
- const body = { typecast: options.typecast ? true : false };
136
+ const body = { typecast };
125
137
  const responseData = await import_transport.batchUpdate.call(this, endpoint, body, records);
126
138
  const executionData = this.helpers.constructExecutionMetaData(
127
139
  (0, import_utilities.wrapData)(responseData.records),
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../../nodes/Airtable/v2/actions/record/update.operation.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tINodeExecutionData,\n\tINodeProperties,\n\tNodeApiError,\n\tIExecuteFunctions,\n} from 'n8n-workflow';\n\nimport { updateDisplayOptions, wrapData } from '../../../../../utils/utilities';\nimport type { UpdateRecord } from '../../helpers/interfaces';\nimport { findMatches, processAirtableError, removeIgnored } from '../../helpers/utils';\nimport { apiRequestAllItems, batchUpdate } from '../../transport';\nimport { insertUpdateOptions } from '../common.descriptions';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Columns',\n\t\tname: 'columns',\n\t\ttype: 'resourceMapper',\n\t\tnoDataExpression: true,\n\t\tdefault: {\n\t\t\tmappingMode: 'defineBelow',\n\t\t\tvalue: null,\n\t\t},\n\t\trequired: true,\n\t\ttypeOptions: {\n\t\t\tloadOptionsDependsOn: ['table.value', 'base.value'],\n\t\t\tresourceMapper: {\n\t\t\t\tresourceMapperMethod: 'getColumnsWithRecordId',\n\t\t\t\tmode: 'update',\n\t\t\t\tfieldWords: {\n\t\t\t\t\tsingular: 'column',\n\t\t\t\t\tplural: 'columns',\n\t\t\t\t},\n\t\t\t\taddAllFields: true,\n\t\t\t\tmultiKeyMatch: true,\n\t\t\t},\n\t\t},\n\t},\n\t...insertUpdateOptions,\n];\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['record'],\n\t\toperation: ['update'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(\n\tthis: IExecuteFunctions,\n\titems: INodeExecutionData[],\n\tbase: string,\n\ttable: string,\n): Promise<INodeExecutionData[]> {\n\tconst returnData: INodeExecutionData[] = [];\n\n\tconst endpoint = `${base}/${table}`;\n\n\tconst dataMode = this.getNodeParameter('columns.mappingMode', 0) as string;\n\n\tconst columnsToMatchOn = this.getNodeParameter('columns.matchingColumns', 0) as string[];\n\n\tlet tableData: UpdateRecord[] = [];\n\tif (!columnsToMatchOn.includes('id')) {\n\t\tconst response = await apiRequestAllItems.call(\n\t\t\tthis,\n\t\t\t'GET',\n\t\t\tendpoint,\n\t\t\t{},\n\t\t\t{ fields: columnsToMatchOn },\n\t\t);\n\t\ttableData = response.records as UpdateRecord[];\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\tlet recordId = '';\n\t\ttry {\n\t\t\tconst records: UpdateRecord[] = [];\n\t\t\tconst options = this.getNodeParameter('options', i, {});\n\n\t\t\tif (dataMode === 'autoMapInputData') {\n\t\t\t\tif (columnsToMatchOn.includes('id')) {\n\t\t\t\t\tconst { id, ...fields } = items[i].json;\n\t\t\t\t\trecordId = id as string;\n\n\t\t\t\t\trecords.push({\n\t\t\t\t\t\tid: recordId,\n\t\t\t\t\t\tfields: removeIgnored(fields, options.ignoreFields as string),\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst matches = findMatches(\n\t\t\t\t\t\ttableData,\n\t\t\t\t\t\tcolumnsToMatchOn,\n\t\t\t\t\t\titems[i].json,\n\t\t\t\t\t\toptions.updateAllMatches as boolean,\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\tconst id = match.id as string;\n\t\t\t\t\t\tconst fields = items[i].json;\n\t\t\t\t\t\trecords.push({ id, fields: removeIgnored(fields, options.ignoreFields as string) });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dataMode === 'defineBelow') {\n\t\t\t\tif (columnsToMatchOn.includes('id')) {\n\t\t\t\t\tconst { id, ...fields } = this.getNodeParameter('columns.value', i, []) as IDataObject;\n\t\t\t\t\trecords.push({ id: id as string, fields });\n\t\t\t\t} else {\n\t\t\t\t\tconst fields = this.getNodeParameter('columns.value', i, []) as IDataObject;\n\n\t\t\t\t\tconst matches = findMatches(\n\t\t\t\t\t\ttableData,\n\t\t\t\t\t\tcolumnsToMatchOn,\n\t\t\t\t\t\tfields,\n\t\t\t\t\t\toptions.updateAllMatches as boolean,\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\tconst id = match.id as string;\n\t\t\t\t\t\trecords.push({ id, fields: removeIgnored(fields, columnsToMatchOn) });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst body: IDataObject = { typecast: options.typecast ? true : false };\n\n\t\t\tconst responseData = await batchUpdate.call(this, endpoint, body, records);\n\n\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\twrapData(responseData.records as IDataObject[]),\n\t\t\t\t{ itemData: { item: i } },\n\t\t\t);\n\n\t\t\treturnData.push(...executionData);\n\t\t} catch (error) {\n\t\t\terror = processAirtableError(error as NodeApiError, recordId, i);\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { message: error.message, error } });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\treturn returnData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,uBAA+C;AAE/C,mBAAiE;AACjE,uBAAgD;AAChD,oBAAoC;AAEpC,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR,aAAa;AAAA,MACb,OAAO;AAAA,IACR;AAAA,IACA,UAAU;AAAA,IACV,aAAa;AAAA,MACZ,sBAAsB,CAAC,eAAe,YAAY;AAAA,MAClD,gBAAgB;AAAA,QACf,sBAAsB;AAAA,QACtB,MAAM;AAAA,QACN,YAAY;AAAA,UACX,UAAU;AAAA,UACV,QAAQ;AAAA,QACT;AAAA,QACA,cAAc;AAAA,QACd,eAAe;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG;AACJ;AAEA,MAAM,iBAAiB;AAAA,EACtB,MAAM;AAAA,IACL,UAAU,CAAC,QAAQ;AAAA,IACnB,WAAW,CAAC,QAAQ;AAAA,EACrB;AACD;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AI,iBAAiB,SAAS,IAAI,GAAG;AACpC,gBAAM,EAAE,IAAI,GAAG,OAAO,IAAI,KAAK,iBAAiB,iBAAiB,GAAG,CAAC,CAAC;AACtE,kBAAQ,KAAK,EAAE,IAAkB,OAAO,CAAC;AAAA,QAC1C,OAAO;AACN,gBAAM,SAAS,KAAK,iBAAiB,iBAAiB,GAAG,CAAC,CAAC;AAE3D,gBAAM,cAAU;AAAA,YACf;AAAA,YACA;AAAA,YACA;AAAA,YACA,QAAQ;AAAA,UACT;AAEA,qBAAW,SAAS,SAAS;AAC5B,kBAAM,KAAK,MAAM;AACjB,oBAAQ,KAAK,EAAE,IAAI,YAAQ,4BAAc,QAAQ,gBAAgB,EAAE,CAAC;AAAA,UACrE;AAAA,QACD;AAAA,MACD;AAEA,YAAM,OAAoB,EAAE,UAAU,QAAQ,WAAW,OAAO,MAAM;AAEtE,YAAM,eAAe,MAAM,6BAAY,KAAK,MAAM,UAAU,MAAM,OAAO;AAEzE,YAAM,gBAAgB,KAAK,QAAQ;AAAA,YAClC,2BAAS,aAAa,OAAwB;AAAA,QAC9C,EAAE,UAAU,EAAE,MAAM,EAAE,EAAE;AAAA,MACzB;AAEA,iBAAW,KAAK,GAAG,aAAa;AAAA,IACjC,SAAS,OAAO;AACf,kBAAQ,mCAAqB,OAAuB,UAAU,CAAC;AAC/D,UAAI,KAAK,eAAe,GAAG;AAC1B,mBAAW,KAAK,EAAE,MAAM,EAAE,SAAS,MAAM,SAAS,MAAM,EAAE,CAAC;AAC3D;AAAA,MACD;AACA,YAAM;AAAA,IACP;AAAA,EACD;AAEA,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../../../../../../nodes/Airtable/v2/actions/record/update.operation.ts"],"sourcesContent":["import type {\n\tIDataObject,\n\tINodeExecutionData,\n\tINodeProperties,\n\tNodeApiError,\n\tIExecuteFunctions,\n} from 'n8n-workflow';\n\nimport { updateDisplayOptions, wrapData } from '../../../../../utils/utilities';\nimport type { UpdateRecord } from '../../helpers/interfaces';\nimport { findMatches, processAirtableError, removeIgnored } from '../../helpers/utils';\nimport { apiRequestAllItems, batchUpdate } from '../../transport';\nimport { insertUpdateOptions } from '../common.descriptions';\n\nconst properties: INodeProperties[] = [\n\t{\n\t\tdisplayName: 'Columns',\n\t\tname: 'columns',\n\t\ttype: 'resourceMapper',\n\t\tnoDataExpression: true,\n\t\tdefault: {\n\t\t\tmappingMode: 'defineBelow',\n\t\t\tvalue: null,\n\t\t},\n\t\trequired: true,\n\t\ttypeOptions: {\n\t\t\tloadOptionsDependsOn: ['table.value', 'base.value'],\n\t\t\tresourceMapper: {\n\t\t\t\tresourceMapperMethod: 'getColumnsWithRecordId',\n\t\t\t\tmode: 'update',\n\t\t\t\tfieldWords: {\n\t\t\t\t\tsingular: 'column',\n\t\t\t\t\tplural: 'columns',\n\t\t\t\t},\n\t\t\t\taddAllFields: true,\n\t\t\t\tmultiKeyMatch: true,\n\t\t\t},\n\t\t},\n\t},\n\t...insertUpdateOptions,\n];\n\nconst displayOptions = {\n\tshow: {\n\t\tresource: ['record'],\n\t\toperation: ['update'],\n\t},\n};\n\nexport const description = updateDisplayOptions(displayOptions, properties);\n\nexport async function execute(\n\tthis: IExecuteFunctions,\n\titems: INodeExecutionData[],\n\tbase: string,\n\ttable: string,\n): Promise<INodeExecutionData[]> {\n\tconst returnData: INodeExecutionData[] = [];\n\n\tconst endpoint = `${base}/${table}`;\n\n\tconst dataMode = this.getNodeParameter('columns.mappingMode', 0) as string;\n\n\tconst columnsToMatchOn = this.getNodeParameter('columns.matchingColumns', 0) as string[];\n\n\tlet tableData: UpdateRecord[] = [];\n\tif (!columnsToMatchOn.includes('id')) {\n\t\tconst response = await apiRequestAllItems.call(\n\t\t\tthis,\n\t\t\t'GET',\n\t\t\tendpoint,\n\t\t\t{},\n\t\t\t{ fields: columnsToMatchOn },\n\t\t);\n\t\ttableData = response.records as UpdateRecord[];\n\t}\n\n\tfor (let i = 0; i < items.length; i++) {\n\t\tlet recordId = '';\n\t\ttry {\n\t\t\tconst records: UpdateRecord[] = [];\n\t\t\tconst options = this.getNodeParameter('options', i, {});\n\t\t\tconst typecast = options.typecast ? true : false;\n\n\t\t\tif (dataMode === 'autoMapInputData') {\n\t\t\t\tif (columnsToMatchOn.includes('id')) {\n\t\t\t\t\tconst { id, ...fields } = items[i].json;\n\t\t\t\t\trecordId = id as string;\n\n\t\t\t\t\trecords.push({\n\t\t\t\t\t\tid: recordId,\n\t\t\t\t\t\tfields: removeIgnored(fields, options.ignoreFields as string),\n\t\t\t\t\t});\n\t\t\t\t} else {\n\t\t\t\t\tconst matches = findMatches(\n\t\t\t\t\t\ttableData,\n\t\t\t\t\t\tcolumnsToMatchOn,\n\t\t\t\t\t\titems[i].json,\n\t\t\t\t\t\toptions.updateAllMatches as boolean,\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\tconst id = match.id as string;\n\t\t\t\t\t\tconst fields = items[i].json;\n\t\t\t\t\t\trecords.push({ id, fields: removeIgnored(fields, options.ignoreFields as string) });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (dataMode === 'defineBelow') {\n\t\t\t\tconst getNodeParameterOptions = typecast ? { skipValidation: true } : undefined;\n\t\t\t\tif (columnsToMatchOn.includes('id')) {\n\t\t\t\t\tconst { id, ...fields } = this.getNodeParameter(\n\t\t\t\t\t\t'columns.value',\n\t\t\t\t\t\ti,\n\t\t\t\t\t\t[],\n\t\t\t\t\t\tgetNodeParameterOptions,\n\t\t\t\t\t) as IDataObject;\n\t\t\t\t\trecords.push({ id: id as string, fields });\n\t\t\t\t} else {\n\t\t\t\t\tconst fields = this.getNodeParameter(\n\t\t\t\t\t\t'columns.value',\n\t\t\t\t\t\ti,\n\t\t\t\t\t\t[],\n\t\t\t\t\t\tgetNodeParameterOptions,\n\t\t\t\t\t) as IDataObject;\n\n\t\t\t\t\tconst matches = findMatches(\n\t\t\t\t\t\ttableData,\n\t\t\t\t\t\tcolumnsToMatchOn,\n\t\t\t\t\t\tfields,\n\t\t\t\t\t\toptions.updateAllMatches as boolean,\n\t\t\t\t\t);\n\n\t\t\t\t\tfor (const match of matches) {\n\t\t\t\t\t\tconst id = match.id as string;\n\t\t\t\t\t\trecords.push({ id, fields: removeIgnored(fields, columnsToMatchOn) });\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst body: IDataObject = { typecast };\n\n\t\t\tconst responseData = await batchUpdate.call(this, endpoint, body, records);\n\n\t\t\tconst executionData = this.helpers.constructExecutionMetaData(\n\t\t\t\twrapData(responseData.records as IDataObject[]),\n\t\t\t\t{ itemData: { item: i } },\n\t\t\t);\n\n\t\t\treturnData.push(...executionData);\n\t\t} catch (error) {\n\t\t\terror = processAirtableError(error as NodeApiError, recordId, i);\n\t\t\tif (this.continueOnFail()) {\n\t\t\t\treturnData.push({ json: { message: error.message, error } });\n\t\t\t\tcontinue;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\treturn returnData;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAQA,uBAA+C;AAE/C,mBAAiE;AACjE,uBAAgD;AAChD,oBAAoC;AAEpC,MAAM,aAAgC;AAAA,EACrC;AAAA,IACC,aAAa;AAAA,IACb,MAAM;AAAA,IACN,MAAM;AAAA,IACN,kBAAkB;AAAA,IAClB,SAAS;AAAA,MACR,aAAa;AAAA,MACb,OAAO;AAAA,IACR;AAAA,IACA,UAAU;AAAA,IACV,aAAa;AAAA,MACZ,sBAAsB,CAAC,eAAe,YAAY;AAAA,MAClD,gBAAgB;AAAA,QACf,sBAAsB;AAAA,QACtB,MAAM;AAAA,QACN,YAAY;AAAA,UACX,UAAU;AAAA,UACV,QAAQ;AAAA,QACT;AAAA,QACA,cAAc;AAAA,QACd,eAAe;AAAA,MAChB;AAAA,IACD;AAAA,EACD;AAAA,EACA,GAAG;AACJ;AAEA,MAAM,iBAAiB;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 @@
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 credentials_exports = {};
20
+ __export(credentials_exports, {
21
+ credentials: () => credentials
22
+ });
23
+ module.exports = __toCommonJS(credentials_exports);
24
+ const credentials = {
25
+ aws: {
26
+ region: "eu-central-1",
27
+ accessKeyId: "key",
28
+ secretAccessKey: "secret"
29
+ }
30
+ };
31
+ // Annotate the CommonJS export names for ESM import in node:
32
+ 0 && (module.exports = {
33
+ credentials
34
+ });
35
+ //# sourceMappingURL=credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../nodes/Aws/__tests__/credentials.ts"],"sourcesContent":["export const credentials = {\n\taws: {\n\t\tregion: 'eu-central-1',\n\t\taccessKeyId: 'key',\n\t\tsecretAccessKey: 'secret',\n\t},\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAO,MAAM,cAAc;AAAA,EAC1B,KAAK;AAAA,IACJ,QAAQ;AAAA,IACR,aAAa;AAAA,IACb,iBAAiB;AAAA,EAClB;AACD;","names":[]}
@@ -32,12 +32,27 @@ __export(Pyodide_exports, {
32
32
  });
33
33
  module.exports = __toCommonJS(Pyodide_exports);
34
34
  var import_node_path = require("node:path");
35
+ var import_node_vm = require("node:vm");
35
36
  let pyodideInstance;
36
37
  async function LoadPyodide(packageCacheDir) {
37
38
  if (pyodideInstance === void 0) {
38
39
  const { loadPyodide } = await import("pyodide");
40
+ const { XMLHttpRequest } = await import("xmlhttprequest-ssl");
39
41
  const indexURL = (0, import_node_path.dirname)(require.resolve("pyodide"));
40
- pyodideInstance = await loadPyodide({ indexURL, packageCacheDir });
42
+ const context = (0, import_node_vm.createContext)({
43
+ loadPyodide,
44
+ indexURL,
45
+ packageCacheDir,
46
+ jsglobals: {
47
+ Object,
48
+ console,
49
+ XMLHttpRequest
50
+ }
51
+ });
52
+ pyodideInstance = await (0, import_node_vm.runInContext)(
53
+ "loadPyodide({ indexURL, packageCacheDir, jsglobals })",
54
+ context
55
+ );
41
56
  await pyodideInstance.runPythonAsync(`
42
57
  from _pyodide_core import jsproxy_typedict
43
58
  from js import Object
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../nodes/Code/Pyodide.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport type { PyodideInterface } from 'pyodide';\n\nlet pyodideInstance: PyodideInterface | undefined;\n\nexport async function LoadPyodide(packageCacheDir: string): Promise<PyodideInterface> {\n\tif (pyodideInstance === undefined) {\n\t\tconst { loadPyodide } = await import('pyodide');\n\t\tconst indexURL = dirname(require.resolve('pyodide'));\n\t\tpyodideInstance = await loadPyodide({ indexURL, packageCacheDir });\n\n\t\tawait pyodideInstance.runPythonAsync(`\nfrom _pyodide_core import jsproxy_typedict\nfrom js import Object\n`);\n\t}\n\n\treturn pyodideInstance;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AAGxB,IAAI;AAEJ,eAAsB,YAAY,iBAAoD;AACrF,MAAI,oBAAoB,QAAW;AAClC,UAAM,EAAE,YAAY,IAAI,MAAM,OAAO,SAAS;AAC9C,UAAM,eAAW,0BAAQ,gBAAgB,SAAS,CAAC;AACnD,sBAAkB,MAAM,YAAY,EAAE,UAAU,gBAAgB,CAAC;AAEjE,UAAM,gBAAgB,eAAe;AAAA;AAAA;AAAA,CAGtC;AAAA,EACA;AAEA,SAAO;AACR;","names":[]}
1
+ {"version":3,"sources":["../../../nodes/Code/Pyodide.ts"],"sourcesContent":["import { dirname } from 'node:path';\nimport { createContext, runInContext } from 'node:vm';\nimport type { PyodideInterface } from 'pyodide';\n\nlet pyodideInstance: PyodideInterface | undefined;\n\nexport async function LoadPyodide(packageCacheDir: string): Promise<PyodideInterface> {\n\tif (pyodideInstance === undefined) {\n\t\tconst { loadPyodide } = await import('pyodide');\n\t\tconst { XMLHttpRequest } = await import('xmlhttprequest-ssl');\n\t\tconst indexURL = dirname(require.resolve('pyodide'));\n\t\tconst context = createContext({\n\t\t\tloadPyodide,\n\t\t\tindexURL,\n\t\t\tpackageCacheDir,\n\t\t\tjsglobals: {\n\t\t\t\tObject,\n\t\t\t\tconsole,\n\t\t\t\tXMLHttpRequest,\n\t\t\t},\n\t\t});\n\t\tpyodideInstance = (await runInContext(\n\t\t\t'loadPyodide({ indexURL, packageCacheDir, jsglobals })',\n\t\t\tcontext,\n\t\t)) as PyodideInterface;\n\n\t\tawait pyodideInstance.runPythonAsync(`\nfrom _pyodide_core import jsproxy_typedict\nfrom js import Object\n`);\n\t}\n\n\treturn pyodideInstance;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,uBAAwB;AACxB,qBAA4C;AAG5C,IAAI;AAEJ,eAAsB,YAAY,iBAAoD;AACrF,MAAI,oBAAoB,QAAW;AAClC,UAAM,EAAE,YAAY,IAAI,MAAM,OAAO,SAAS;AAC9C,UAAM,EAAE,eAAe,IAAI,MAAM,OAAO,oBAAoB;AAC5D,UAAM,eAAW,0BAAQ,gBAAgB,SAAS,CAAC;AACnD,UAAM,cAAU,8BAAc;AAAA,MAC7B;AAAA,MACA;AAAA,MACA;AAAA,MACA,WAAW;AAAA,QACV;AAAA,QACA;AAAA,QACA;AAAA,MACD;AAAA,IACD,CAAC;AACD,sBAAmB,UAAM;AAAA,MACxB;AAAA,MACA;AAAA,IACD;AAEA,UAAM,gBAAgB,eAAe;AAAA;AAAA;AAAA,CAGtC;AAAA,EACA;AAEA,SAAO;AACR;","names":[]}
@@ -35,8 +35,8 @@ var import_imap = require("@n8n/imap");
35
35
  var import_isEmpty = __toESM(require("lodash/isEmpty"));
36
36
  var import_n8n_workflow = require("n8n-workflow");
37
37
  var import_rfc2047 = __toESM(require("rfc2047"));
38
- var import_utils = require("./utils");
39
38
  var import_Imap = require("../../../credentials/Imap.credentials");
39
+ var import_utils = require("./utils");
40
40
  const versionDescription = {
41
41
  displayName: "Email Trigger (IMAP)",
42
42
  name: "emailReadImap",
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../nodes/EmailReadImap/v2/EmailReadImapV2.node.ts"],"sourcesContent":["import type { ImapSimple, ImapSimpleOptions, Message, MessagePart } from '@n8n/imap';\nimport { connect as imapConnect } from '@n8n/imap';\nimport isEmpty from 'lodash/isEmpty';\nimport type {\n\tITriggerFunctions,\n\tIBinaryData,\n\tICredentialsDecrypted,\n\tICredentialTestFunctions,\n\tIDataObject,\n\tINodeCredentialTestResult,\n\tINodeType,\n\tINodeTypeBaseDescription,\n\tINodeTypeDescription,\n\tITriggerResponse,\n\tJsonObject,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError, TriggerCloseError } from 'n8n-workflow';\nimport rfc2047 from 'rfc2047';\n\nimport { getNewEmails } from './utils';\nimport type { ICredentialsDataImap } from '../../../credentials/Imap.credentials';\nimport { isCredentialsDataImap } from '../../../credentials/Imap.credentials';\n\nconst versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Email Trigger (IMAP)',\n\tname: 'emailReadImap',\n\ticon: 'fa:inbox',\n\ticonColor: 'green',\n\tgroup: ['trigger'],\n\tversion: 2,\n\tdescription: 'Triggers the workflow when a new email is received',\n\teventTriggerDescription: 'Waiting for you to receive an email',\n\tdefaults: {\n\t\tname: 'Email Trigger (IMAP)',\n\t\tcolor: '#44AA22',\n\t},\n\ttriggerPanel: {\n\t\theader: '',\n\t\texecutionsHelp: {\n\t\t\tinactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'listen' button, then send an email to make an event happen. 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 an email is received, 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\tactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'listen' button, then send an email to make an event happen. 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 an email is received, 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},\n\t\tactivationHint:\n\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},\n\tusableAsTool: true,\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'imap',\n\t\t\trequired: true,\n\t\t\ttestedBy: 'imapConnectionTest',\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Mailbox Name',\n\t\t\tname: 'mailbox',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'INBOX',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Action',\n\t\t\tname: 'postProcessAction',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Mark as Read',\n\t\t\t\t\tvalue: 'read',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Nothing',\n\t\t\t\t\tvalue: 'nothing',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'read',\n\t\t\tdescription:\n\t\t\t\t'What to do after the email has been received. If \"nothing\" gets selected it will be processed multiple times.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Download Attachments',\n\t\t\tname: 'downloadAttachments',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Whether attachments of emails should be downloaded. Only set if needed as it increases processing.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Format',\n\t\t\tname: 'format',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'RAW',\n\t\t\t\t\tvalue: 'raw',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email message data with body content in the raw field as a base64url encoded string; the payload field is not used',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Resolved',\n\t\t\t\t\tvalue: 'resolved',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email with all data resolved and attachments saved as binary data',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Simple',\n\t\t\t\t\tvalue: 'simple',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email; do not use if you wish to gather inline attachments',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'simple',\n\t\t\tdescription: 'The format to return the message in',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['resolved'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t\tdownloadAttachments: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Email Rules',\n\t\t\t\t\tname: 'customEmailConfig',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '[\"UNSEEN\"]',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Custom email fetching rules. See <a href=\"https://github.com/mscdex/node-imap\">node-imap</a>\\'s search function for more details.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Force Reconnect Every Minutes',\n\t\t\t\t\tname: 'forceReconnect',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 60,\n\t\t\t\t\tdescription: 'Sets an interval (in minutes) to force a reconnection',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\nexport class EmailReadImapV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync imapConnectionTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tif (isCredentialsDataImap(credential.data)) {\n\t\t\t\t\tconst credentials = credential.data as ICredentialsDataImap;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\t\t\t\timap: {\n\t\t\t\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\t\t\t\tport: credentials.port,\n\t\t\t\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\t\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (credentials.secure) {\n\t\t\t\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst connection = await imapConnect(config);\n\t\t\t\t\t\tawait connection.getBoxes();\n\t\t\t\t\t\tconnection.end();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\t\tmessage: (error as Error).message,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\t\tmessage: 'Connection successful!',\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: 'Credentials are no IMAP credentials.',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst credentialsObject = await this.getCredentials('imap');\n\t\tconst credentials = isCredentialsDataImap(credentialsObject) ? credentialsObject : undefined;\n\t\tif (!credentials) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Credentials are not valid for imap node.');\n\t\t}\n\t\tconst mailbox = this.getNodeParameter('mailbox') as string;\n\t\tconst postProcessAction = this.getNodeParameter('postProcessAction') as string;\n\t\tconst options = this.getNodeParameter('options', {}) as IDataObject;\n\n\t\tconst staticData = this.getWorkflowStaticData('node');\n\t\tthis.logger.debug('Loaded static data for node \"EmailReadImap\"', { staticData });\n\n\t\tlet connection: ImapSimple;\n\t\tlet closeFunctionWasCalled = false;\n\t\tlet isCurrentlyReconnecting = false;\n\n\t\t// Returns the email text\n\n\t\tconst getText = async (\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t\tsubtype: string,\n\t\t): Promise<string> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst textParts = parts.filter((part) => {\n\t\t\t\treturn (\n\t\t\t\t\tpart.type.toUpperCase() === 'TEXT' && part.subtype.toUpperCase() === subtype.toUpperCase()\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tconst part = textParts[0];\n\t\t\tif (!part) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst partData = await connection.getPartData(message, part);\n\t\t\t\treturn partData.toString();\n\t\t\t} catch {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t};\n\n\t\t// Returns the email attachments\n\t\tconst getAttachment = async (\n\t\t\timapConnection: ImapSimple,\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t): Promise<IBinaryData[]> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\t// Check if the message has attachments and if so get them\n\t\t\tconst attachmentParts = parts.filter(\n\t\t\t\t(part) => part.disposition?.type?.toUpperCase() === 'ATTACHMENT',\n\t\t\t);\n\n\t\t\tconst decodeFilename = (filename: string) => {\n\t\t\t\tconst regex = /=\\?([\\w-]+)\\?Q\\?.*\\?=/i;\n\t\t\t\tif (regex.test(filename)) {\n\t\t\t\t\treturn rfc2047.decode(filename);\n\t\t\t\t}\n\t\t\t\treturn filename;\n\t\t\t};\n\n\t\t\tconst attachmentPromises = [];\n\t\t\tlet attachmentPromise;\n\t\t\tfor (const attachmentPart of attachmentParts) {\n\t\t\t\tattachmentPromise = imapConnection\n\t\t\t\t\t.getPartData(message, attachmentPart)\n\t\t\t\t\t.then(async (partData) => {\n\t\t\t\t\t\t// if filename contains utf-8 encoded characters, decode it\n\t\t\t\t\t\tconst fileName = decodeFilename(\n\t\t\t\t\t\t\t((attachmentPart.disposition as IDataObject)?.params as IDataObject)\n\t\t\t\t\t\t\t\t?.filename as string,\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Return it in the format n8n expects\n\t\t\t\t\t\treturn await this.helpers.prepareBinaryData(partData.buffer, fileName);\n\t\t\t\t\t});\n\n\t\t\t\tattachmentPromises.push(attachmentPromise);\n\t\t\t}\n\n\t\t\treturn await Promise.all(attachmentPromises);\n\t\t};\n\n\t\tconst returnedPromise = this.helpers.createDeferredPromise();\n\n\t\tconst establishConnection = async (): Promise<ImapSimple> => {\n\t\t\tlet searchCriteria = ['UNSEEN'] as Array<string | string[]>;\n\t\t\tif (options.customEmailConfig !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tsearchCriteria = JSON.parse(options.customEmailConfig as string) as Array<\n\t\t\t\t\t\tstring | string[]\n\t\t\t\t\t>;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Custom email config is not valid JSON.');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\timap: {\n\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\tport: credentials.port,\n\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t},\n\t\t\t\tonMail: async () => {\n\t\t\t\t\tif (connection) {\n\t\t\t\t\t\tif (staticData.lastMessageUid !== undefined) {\n\t\t\t\t\t\t\tsearchCriteria.push(['UID', `${staticData.lastMessageUid as number}:*`]);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A short explanation about UIDs and how they work\n\t\t\t\t\t\t\t * can be found here: https://dev.to/kehers/imap-new-messages-since-last-check-44gm\n\t\t\t\t\t\t\t * TL;DR:\n\t\t\t\t\t\t\t * - You cannot filter using ['UID', 'CURRENT ID + 1:*'] because IMAP\n\t\t\t\t\t\t\t * won't return correct results if current id + 1 does not yet exist.\n\t\t\t\t\t\t\t * - UIDs can change but this is not being treated here.\n\t\t\t\t\t\t\t * If the mailbox is recreated (lets say you remove all emails, remove\n\t\t\t\t\t\t\t * the mail box and create another with same name, UIDs will change)\n\t\t\t\t\t\t\t * - You can check if UIDs changed in the above example\n\t\t\t\t\t\t\t * by checking UIDValidity.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tthis.logger.debug('Querying for new messages on node \"EmailReadImap\"', {\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst returnData = await getNewEmails.call(\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\tconnection,\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t\tstaticData,\n\t\t\t\t\t\t\t\tpostProcessAction,\n\t\t\t\t\t\t\t\tgetText,\n\t\t\t\t\t\t\t\tgetAttachment,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (returnData.length) {\n\t\t\t\t\t\t\t\tthis.emit([returnData]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthis.logger.error('Email Read Imap node encountered an error fetching new emails', {\n\t\t\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy\n\t\t\t\t\t\t\t// if it receives an error before the workflow got activated\n\t\t\t\t\t\t\tawait returnedPromise.promise.then(() => {\n\t\t\t\t\t\t\t\tthis.emitError(error as Error);\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\tonUpdate: async (seqNo: number, info) => {\n\t\t\t\t\tthis.logger.debug(`Email Read Imap:update ${seqNo}`, info);\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t}\n\n\t\t\tif (credentials.secure) {\n\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t}\n\n\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t}\n\n\t\t\t// Connect to the IMAP server and open the mailbox\n\t\t\t// that we get informed whenever a new email arrives\n\t\t\treturn await imapConnect(config).then(async (conn) => {\n\t\t\t\tconn.on('close', async (_hadError: boolean) => {\n\t\t\t\t\tif (isCurrentlyReconnecting) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Connected closed for forced reconnecting');\n\t\t\t\t\t} else if (closeFunctionWasCalled) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Shutting down workflow - connected closed');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.logger.error('Email Read Imap: Connected closed unexpectedly');\n\t\t\t\t\t\tthis.emitError(new Error('Imap connection closed unexpectedly'));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconn.on('error', async (error) => {\n\t\t\t\t\tconst errorCode = ((error as JsonObject).code as string).toUpperCase();\n\t\t\t\t\tthis.logger.debug(`IMAP connection experienced an error: (${errorCode})`, {\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t});\n\t\t\t\t\tthis.emitError(error as Error);\n\t\t\t\t});\n\t\t\t\treturn conn;\n\t\t\t});\n\t\t};\n\n\t\tconnection = await establishConnection();\n\n\t\tawait connection.openBox(mailbox);\n\n\t\tlet reconnectionInterval: NodeJS.Timeout | undefined;\n\n\t\tconst handleReconnect = async () => {\n\t\t\tthis.logger.debug('Forcing reconnect to IMAP server');\n\t\t\ttry {\n\t\t\t\tisCurrentlyReconnecting = true;\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t\tconnection = await establishConnection();\n\t\t\t\tawait connection.openBox(mailbox);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error(error as string);\n\t\t\t} finally {\n\t\t\t\tisCurrentlyReconnecting = false;\n\t\t\t}\n\t\t};\n\n\t\tif (options.forceReconnect !== undefined) {\n\t\t\treconnectionInterval = setInterval(\n\t\t\t\thandleReconnect,\n\t\t\t\t(options.forceReconnect as number) * 1000 * 60,\n\t\t\t);\n\t\t}\n\n\t\t// When workflow and so node gets set to inactive close the connection\n\t\tconst closeFunction = async () => {\n\t\t\tcloseFunctionWasCalled = true;\n\t\t\tif (reconnectionInterval) {\n\t\t\t\tclearInterval(reconnectionInterval);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TriggerCloseError(this.getNode(), { cause: error as Error, level: 'warning' });\n\t\t\t}\n\t\t};\n\n\t\t// Resolve returned-promise so that waiting errors can be emitted\n\t\treturnedPromise.resolve();\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,kBAAuC;AACvC,qBAAoB;AAcpB,0BAA2E;AAC3E,qBAAoB;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A,MACjC,SAAS,OAAO;AACf,aAAK,OAAO,MAAM,KAAe;AAAA,MAClC,UAAE;AACD,kCAA0B;AAAA,MAC3B;AAAA,IACD;AAEA,QAAI,QAAQ,mBAAmB,QAAW;AACzC,6BAAuB;AAAA,QACtB;AAAA,QACC,QAAQ,iBAA4B,MAAO;AAAA,MAC7C;AAAA,IACD;AAGA,UAAM,gBAAgB,YAAY;AACjC,+BAAyB;AACzB,UAAI,sBAAsB;AACzB,sBAAc,oBAAoB;AAAA,MACnC;AACA,UAAI;AACH,YAAI,WAAW,SAAU,OAAM,WAAW,SAAS,KAAK;AACxD,mBAAW,IAAI;AAAA,MAChB,SAAS,OAAO;AACf,cAAM,IAAI,sCAAkB,KAAK,QAAQ,GAAG,EAAE,OAAO,OAAgB,OAAO,UAAU,CAAC;AAAA,MACxF;AAAA,IACD;AAGA,oBAAgB,QAAQ;AAExB,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;","names":["isEmpty","imapConnect","part","rfc2047"]}
1
+ {"version":3,"sources":["../../../../nodes/EmailReadImap/v2/EmailReadImapV2.node.ts"],"sourcesContent":["import type { ImapSimple, ImapSimpleOptions, Message, MessagePart } from '@n8n/imap';\nimport { connect as imapConnect } from '@n8n/imap';\nimport isEmpty from 'lodash/isEmpty';\nimport type {\n\tITriggerFunctions,\n\tIBinaryData,\n\tICredentialsDecrypted,\n\tICredentialTestFunctions,\n\tIDataObject,\n\tINodeCredentialTestResult,\n\tINodeType,\n\tINodeTypeBaseDescription,\n\tINodeTypeDescription,\n\tITriggerResponse,\n\tJsonObject,\n} from 'n8n-workflow';\nimport { NodeConnectionTypes, NodeOperationError, TriggerCloseError } from 'n8n-workflow';\nimport rfc2047 from 'rfc2047';\n\nimport type { ICredentialsDataImap } from '@credentials/Imap.credentials';\nimport { isCredentialsDataImap } from '@credentials/Imap.credentials';\n\nimport { getNewEmails } from './utils';\n\nconst versionDescription: INodeTypeDescription = {\n\tdisplayName: 'Email Trigger (IMAP)',\n\tname: 'emailReadImap',\n\ticon: 'fa:inbox',\n\ticonColor: 'green',\n\tgroup: ['trigger'],\n\tversion: 2,\n\tdescription: 'Triggers the workflow when a new email is received',\n\teventTriggerDescription: 'Waiting for you to receive an email',\n\tdefaults: {\n\t\tname: 'Email Trigger (IMAP)',\n\t\tcolor: '#44AA22',\n\t},\n\ttriggerPanel: {\n\t\theader: '',\n\t\texecutionsHelp: {\n\t\t\tinactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'listen' button, then send an email to make an event happen. 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 an email is received, 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\tactive:\n\t\t\t\t\"<b>While building your workflow</b>, click the 'listen' button, then send an email to make an event happen. 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 an email is received, 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},\n\t\tactivationHint:\n\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},\n\tusableAsTool: true,\n\tinputs: [],\n\toutputs: [NodeConnectionTypes.Main],\n\tcredentials: [\n\t\t{\n\t\t\tname: 'imap',\n\t\t\trequired: true,\n\t\t\ttestedBy: 'imapConnectionTest',\n\t\t},\n\t],\n\tproperties: [\n\t\t{\n\t\t\tdisplayName: 'Mailbox Name',\n\t\t\tname: 'mailbox',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'INBOX',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Action',\n\t\t\tname: 'postProcessAction',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'Mark as Read',\n\t\t\t\t\tvalue: 'read',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Nothing',\n\t\t\t\t\tvalue: 'nothing',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'read',\n\t\t\tdescription:\n\t\t\t\t'What to do after the email has been received. If \"nothing\" gets selected it will be processed multiple times.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Download Attachments',\n\t\t\tname: 'downloadAttachments',\n\t\t\ttype: 'boolean',\n\t\t\tdefault: false,\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Whether attachments of emails should be downloaded. Only set if needed as it increases processing.',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Format',\n\t\t\tname: 'format',\n\t\t\ttype: 'options',\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tname: 'RAW',\n\t\t\t\t\tvalue: 'raw',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email message data with body content in the raw field as a base64url encoded string; the payload field is not used',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Resolved',\n\t\t\t\t\tvalue: 'resolved',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email with all data resolved and attachments saved as binary data',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tname: 'Simple',\n\t\t\t\t\tvalue: 'simple',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Returns the full email; do not use if you wish to gather inline attachments',\n\t\t\t\t},\n\t\t\t],\n\t\t\tdefault: 'simple',\n\t\t\tdescription: 'The format to return the message in',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['resolved'],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Property Prefix Name',\n\t\t\tname: 'dataPropertyAttachmentsPrefixName',\n\t\t\ttype: 'string',\n\t\t\tdefault: 'attachment_',\n\t\t\tdisplayOptions: {\n\t\t\t\tshow: {\n\t\t\t\t\tformat: ['simple'],\n\t\t\t\t\tdownloadAttachments: [true],\n\t\t\t\t},\n\t\t\t},\n\t\t\tdescription:\n\t\t\t\t'Prefix for name of the binary property to which to write the attachments. An index starting with 0 will be added. So if name is \"attachment_\" the first attachment is saved to \"attachment_0\"',\n\t\t},\n\t\t{\n\t\t\tdisplayName: 'Options',\n\t\t\tname: 'options',\n\t\t\ttype: 'collection',\n\t\t\tplaceholder: 'Add option',\n\t\t\tdefault: {},\n\t\t\toptions: [\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Custom Email Rules',\n\t\t\t\t\tname: 'customEmailConfig',\n\t\t\t\t\ttype: 'string',\n\t\t\t\t\tdefault: '[\"UNSEEN\"]',\n\t\t\t\t\tdescription:\n\t\t\t\t\t\t'Custom email fetching rules. See <a href=\"https://github.com/mscdex/node-imap\">node-imap</a>\\'s search function for more details.',\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tdisplayName: 'Force Reconnect Every Minutes',\n\t\t\t\t\tname: 'forceReconnect',\n\t\t\t\t\ttype: 'number',\n\t\t\t\t\tdefault: 60,\n\t\t\t\t\tdescription: 'Sets an interval (in minutes) to force a reconnection',\n\t\t\t\t},\n\t\t\t],\n\t\t},\n\t],\n};\n\nexport class EmailReadImapV2 implements INodeType {\n\tdescription: INodeTypeDescription;\n\n\tconstructor(baseDescription: INodeTypeBaseDescription) {\n\t\tthis.description = {\n\t\t\t...baseDescription,\n\t\t\t...versionDescription,\n\t\t};\n\t}\n\n\tmethods = {\n\t\tcredentialTest: {\n\t\t\tasync imapConnectionTest(\n\t\t\t\tthis: ICredentialTestFunctions,\n\t\t\t\tcredential: ICredentialsDecrypted,\n\t\t\t): Promise<INodeCredentialTestResult> {\n\t\t\t\tif (isCredentialsDataImap(credential.data)) {\n\t\t\t\t\tconst credentials = credential.data as ICredentialsDataImap;\n\t\t\t\t\ttry {\n\t\t\t\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\t\t\t\timap: {\n\t\t\t\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\t\t\t\tport: credentials.port,\n\t\t\t\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t};\n\t\t\t\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\t\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (credentials.secure) {\n\t\t\t\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tconst connection = await imapConnect(config);\n\t\t\t\t\t\tawait connection.getBoxes();\n\t\t\t\t\t\tconnection.end();\n\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\t\tmessage: (error as Error).message,\n\t\t\t\t\t\t};\n\t\t\t\t\t}\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'OK',\n\t\t\t\t\t\tmessage: 'Connection successful!',\n\t\t\t\t\t};\n\t\t\t\t} else {\n\t\t\t\t\treturn {\n\t\t\t\t\t\tstatus: 'Error',\n\t\t\t\t\t\tmessage: 'Credentials are no IMAP credentials.',\n\t\t\t\t\t};\n\t\t\t\t}\n\t\t\t},\n\t\t},\n\t};\n\n\tasync trigger(this: ITriggerFunctions): Promise<ITriggerResponse> {\n\t\tconst credentialsObject = await this.getCredentials('imap');\n\t\tconst credentials = isCredentialsDataImap(credentialsObject) ? credentialsObject : undefined;\n\t\tif (!credentials) {\n\t\t\tthrow new NodeOperationError(this.getNode(), 'Credentials are not valid for imap node.');\n\t\t}\n\t\tconst mailbox = this.getNodeParameter('mailbox') as string;\n\t\tconst postProcessAction = this.getNodeParameter('postProcessAction') as string;\n\t\tconst options = this.getNodeParameter('options', {}) as IDataObject;\n\n\t\tconst staticData = this.getWorkflowStaticData('node');\n\t\tthis.logger.debug('Loaded static data for node \"EmailReadImap\"', { staticData });\n\n\t\tlet connection: ImapSimple;\n\t\tlet closeFunctionWasCalled = false;\n\t\tlet isCurrentlyReconnecting = false;\n\n\t\t// Returns the email text\n\n\t\tconst getText = async (\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t\tsubtype: string,\n\t\t): Promise<string> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\tconst textParts = parts.filter((part) => {\n\t\t\t\treturn (\n\t\t\t\t\tpart.type.toUpperCase() === 'TEXT' && part.subtype.toUpperCase() === subtype.toUpperCase()\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tconst part = textParts[0];\n\t\t\tif (!part) {\n\t\t\t\treturn '';\n\t\t\t}\n\n\t\t\ttry {\n\t\t\t\tconst partData = await connection.getPartData(message, part);\n\t\t\t\treturn partData.toString();\n\t\t\t} catch {\n\t\t\t\treturn '';\n\t\t\t}\n\t\t};\n\n\t\t// Returns the email attachments\n\t\tconst getAttachment = async (\n\t\t\timapConnection: ImapSimple,\n\t\t\tparts: MessagePart[],\n\t\t\tmessage: Message,\n\t\t): Promise<IBinaryData[]> => {\n\t\t\tif (!message.attributes.struct) {\n\t\t\t\treturn [];\n\t\t\t}\n\n\t\t\t// Check if the message has attachments and if so get them\n\t\t\tconst attachmentParts = parts.filter(\n\t\t\t\t(part) => part.disposition?.type?.toUpperCase() === 'ATTACHMENT',\n\t\t\t);\n\n\t\t\tconst decodeFilename = (filename: string) => {\n\t\t\t\tconst regex = /=\\?([\\w-]+)\\?Q\\?.*\\?=/i;\n\t\t\t\tif (regex.test(filename)) {\n\t\t\t\t\treturn rfc2047.decode(filename);\n\t\t\t\t}\n\t\t\t\treturn filename;\n\t\t\t};\n\n\t\t\tconst attachmentPromises = [];\n\t\t\tlet attachmentPromise;\n\t\t\tfor (const attachmentPart of attachmentParts) {\n\t\t\t\tattachmentPromise = imapConnection\n\t\t\t\t\t.getPartData(message, attachmentPart)\n\t\t\t\t\t.then(async (partData) => {\n\t\t\t\t\t\t// if filename contains utf-8 encoded characters, decode it\n\t\t\t\t\t\tconst fileName = decodeFilename(\n\t\t\t\t\t\t\t((attachmentPart.disposition as IDataObject)?.params as IDataObject)\n\t\t\t\t\t\t\t\t?.filename as string,\n\t\t\t\t\t\t);\n\t\t\t\t\t\t// Return it in the format n8n expects\n\t\t\t\t\t\treturn await this.helpers.prepareBinaryData(partData.buffer, fileName);\n\t\t\t\t\t});\n\n\t\t\t\tattachmentPromises.push(attachmentPromise);\n\t\t\t}\n\n\t\t\treturn await Promise.all(attachmentPromises);\n\t\t};\n\n\t\tconst returnedPromise = this.helpers.createDeferredPromise();\n\n\t\tconst establishConnection = async (): Promise<ImapSimple> => {\n\t\t\tlet searchCriteria = ['UNSEEN'] as Array<string | string[]>;\n\t\t\tif (options.customEmailConfig !== undefined) {\n\t\t\t\ttry {\n\t\t\t\t\tsearchCriteria = JSON.parse(options.customEmailConfig as string) as Array<\n\t\t\t\t\t\tstring | string[]\n\t\t\t\t\t>;\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthrow new NodeOperationError(this.getNode(), 'Custom email config is not valid JSON.');\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tconst config: ImapSimpleOptions = {\n\t\t\t\timap: {\n\t\t\t\t\tuser: credentials.user,\n\t\t\t\t\tpassword: credentials.password,\n\t\t\t\t\thost: credentials.host.trim(),\n\t\t\t\t\tport: credentials.port,\n\t\t\t\t\ttls: credentials.secure,\n\t\t\t\t\tauthTimeout: 20000,\n\t\t\t\t},\n\t\t\t\tonMail: async () => {\n\t\t\t\t\tif (connection) {\n\t\t\t\t\t\tif (staticData.lastMessageUid !== undefined) {\n\t\t\t\t\t\t\tsearchCriteria.push(['UID', `${staticData.lastMessageUid as number}:*`]);\n\t\t\t\t\t\t\t/**\n\t\t\t\t\t\t\t * A short explanation about UIDs and how they work\n\t\t\t\t\t\t\t * can be found here: https://dev.to/kehers/imap-new-messages-since-last-check-44gm\n\t\t\t\t\t\t\t * TL;DR:\n\t\t\t\t\t\t\t * - You cannot filter using ['UID', 'CURRENT ID + 1:*'] because IMAP\n\t\t\t\t\t\t\t * won't return correct results if current id + 1 does not yet exist.\n\t\t\t\t\t\t\t * - UIDs can change but this is not being treated here.\n\t\t\t\t\t\t\t * If the mailbox is recreated (lets say you remove all emails, remove\n\t\t\t\t\t\t\t * the mail box and create another with same name, UIDs will change)\n\t\t\t\t\t\t\t * - You can check if UIDs changed in the above example\n\t\t\t\t\t\t\t * by checking UIDValidity.\n\t\t\t\t\t\t\t */\n\t\t\t\t\t\t\tthis.logger.debug('Querying for new messages on node \"EmailReadImap\"', {\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\tconst returnData = await getNewEmails.call(\n\t\t\t\t\t\t\t\tthis,\n\t\t\t\t\t\t\t\tconnection,\n\t\t\t\t\t\t\t\tsearchCriteria,\n\t\t\t\t\t\t\t\tstaticData,\n\t\t\t\t\t\t\t\tpostProcessAction,\n\t\t\t\t\t\t\t\tgetText,\n\t\t\t\t\t\t\t\tgetAttachment,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\tif (returnData.length) {\n\t\t\t\t\t\t\t\tthis.emit([returnData]);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} catch (error) {\n\t\t\t\t\t\t\tthis.logger.error('Email Read Imap node encountered an error fetching new emails', {\n\t\t\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t// Wait with resolving till the returnedPromise got resolved, else n8n will be unhappy\n\t\t\t\t\t\t\t// if it receives an error before the workflow got activated\n\t\t\t\t\t\t\tawait returnedPromise.promise.then(() => {\n\t\t\t\t\t\t\t\tthis.emitError(error as Error);\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\tonUpdate: async (seqNo: number, info) => {\n\t\t\t\t\tthis.logger.debug(`Email Read Imap:update ${seqNo}`, info);\n\t\t\t\t},\n\t\t\t};\n\n\t\t\tconst tlsOptions: IDataObject = {};\n\n\t\t\tif (credentials.allowUnauthorizedCerts) {\n\t\t\t\ttlsOptions.rejectUnauthorized = false;\n\t\t\t}\n\n\t\t\tif (credentials.secure) {\n\t\t\t\ttlsOptions.servername = credentials.host.trim();\n\t\t\t}\n\n\t\t\tif (!isEmpty(tlsOptions)) {\n\t\t\t\tconfig.imap.tlsOptions = tlsOptions;\n\t\t\t}\n\n\t\t\t// Connect to the IMAP server and open the mailbox\n\t\t\t// that we get informed whenever a new email arrives\n\t\t\treturn await imapConnect(config).then(async (conn) => {\n\t\t\t\tconn.on('close', async (_hadError: boolean) => {\n\t\t\t\t\tif (isCurrentlyReconnecting) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Connected closed for forced reconnecting');\n\t\t\t\t\t} else if (closeFunctionWasCalled) {\n\t\t\t\t\t\tthis.logger.debug('Email Read Imap: Shutting down workflow - connected closed');\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.logger.error('Email Read Imap: Connected closed unexpectedly');\n\t\t\t\t\t\tthis.emitError(new Error('Imap connection closed unexpectedly'));\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tconn.on('error', async (error) => {\n\t\t\t\t\tconst errorCode = ((error as JsonObject).code as string).toUpperCase();\n\t\t\t\t\tthis.logger.debug(`IMAP connection experienced an error: (${errorCode})`, {\n\t\t\t\t\t\terror: error as Error,\n\t\t\t\t\t});\n\t\t\t\t\tthis.emitError(error as Error);\n\t\t\t\t});\n\t\t\t\treturn conn;\n\t\t\t});\n\t\t};\n\n\t\tconnection = await establishConnection();\n\n\t\tawait connection.openBox(mailbox);\n\n\t\tlet reconnectionInterval: NodeJS.Timeout | undefined;\n\n\t\tconst handleReconnect = async () => {\n\t\t\tthis.logger.debug('Forcing reconnect to IMAP server');\n\t\t\ttry {\n\t\t\t\tisCurrentlyReconnecting = true;\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t\tconnection = await establishConnection();\n\t\t\t\tawait connection.openBox(mailbox);\n\t\t\t} catch (error) {\n\t\t\t\tthis.logger.error(error as string);\n\t\t\t} finally {\n\t\t\t\tisCurrentlyReconnecting = false;\n\t\t\t}\n\t\t};\n\n\t\tif (options.forceReconnect !== undefined) {\n\t\t\treconnectionInterval = setInterval(\n\t\t\t\thandleReconnect,\n\t\t\t\t(options.forceReconnect as number) * 1000 * 60,\n\t\t\t);\n\t\t}\n\n\t\t// When workflow and so node gets set to inactive close the connection\n\t\tconst closeFunction = async () => {\n\t\t\tcloseFunctionWasCalled = true;\n\t\t\tif (reconnectionInterval) {\n\t\t\t\tclearInterval(reconnectionInterval);\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tif (connection.closeBox) await connection.closeBox(false);\n\t\t\t\tconnection.end();\n\t\t\t} catch (error) {\n\t\t\t\tthrow new TriggerCloseError(this.getNode(), { cause: error as Error, level: 'warning' });\n\t\t\t}\n\t\t};\n\n\t\t// Resolve returned-promise so that waiting errors can be emitted\n\t\treturnedPromise.resolve();\n\n\t\treturn {\n\t\t\tcloseFunction,\n\t\t};\n\t}\n}\n"],"mappings":";;;;;;;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AW,SAAU,OAAM,WAAW,SAAS,KAAK;AACxD,mBAAW,IAAI;AACf,qBAAa,MAAM,oBAAoB;AACvC,cAAM,WAAW,QAAQ,OAAO;AAAA,MACjC,SAAS,OAAO;AACf,aAAK,OAAO,MAAM,KAAe;AAAA,MAClC,UAAE;AACD,kCAA0B;AAAA,MAC3B;AAAA,IACD;AAEA,QAAI,QAAQ,mBAAmB,QAAW;AACzC,6BAAuB;AAAA,QACtB;AAAA,QACC,QAAQ,iBAA4B,MAAO;AAAA,MAC7C;AAAA,IACD;AAGA,UAAM,gBAAgB,YAAY;AACjC,+BAAyB;AACzB,UAAI,sBAAsB;AACzB,sBAAc,oBAAoB;AAAA,MACnC;AACA,UAAI;AACH,YAAI,WAAW,SAAU,OAAM,WAAW,SAAS,KAAK;AACxD,mBAAW,IAAI;AAAA,MAChB,SAAS,OAAO;AACf,cAAM,IAAI,sCAAkB,KAAK,QAAQ,GAAG,EAAE,OAAO,OAAgB,OAAO,UAAU,CAAC;AAAA,MACxF;AAAA,IACD;AAGA,oBAAgB,QAAQ;AAExB,WAAO;AAAA,MACN;AAAA,IACD;AAAA,EACD;AACD;","names":["isEmpty","imapConnect","part","rfc2047"]}
@@ -26,7 +26,9 @@ async function loadSubWorkflowInputs() {
26
26
  const { fields, dataMode, subworkflowInfo } = await import_GenericFunctions.loadWorkflowInputMappings.bind(this)();
27
27
  let emptyFieldsNotice;
28
28
  if (fields.length === 0) {
29
- const subworkflowLink = subworkflowInfo?.id ? `<a href="/workflow/${subworkflowInfo?.id}" target="_blank">sub-workflow\u2019s trigger</a>` : "sub-workflow\u2019s trigger";
29
+ const { triggerId, workflowId } = subworkflowInfo ?? {};
30
+ const path = (workflowId ?? "") + (triggerId ? `/${triggerId.slice(0, 6)}` : "");
31
+ const subworkflowLink = workflowId ? `<a href="/workflow/${path}" target="_blank">sub-workflow\u2019s trigger</a>` : "sub-workflow\u2019s trigger";
30
32
  switch (dataMode) {
31
33
  case "passthrough":
32
34
  emptyFieldsNotice = `This sub-workflow will consume all input data passed to it. You can define specific expected input in the ${subworkflowLink}.`;
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../../nodes/ExecuteWorkflow/ExecuteWorkflow/methods/localResourceMapping.ts"],"sourcesContent":["import type { ILocalLoadOptionsFunctions, ResourceMapperFields } from 'n8n-workflow';\n\nimport { loadWorkflowInputMappings } from '@utils/workflowInputsResourceMapping/GenericFunctions';\n\nexport async function loadSubWorkflowInputs(\n\tthis: ILocalLoadOptionsFunctions,\n): Promise<ResourceMapperFields> {\n\tconst { fields, dataMode, subworkflowInfo } = await loadWorkflowInputMappings.bind(this)();\n\tlet emptyFieldsNotice: string | undefined;\n\tif (fields.length === 0) {\n\t\tconst subworkflowLink = subworkflowInfo?.id\n\t\t\t? `<a href=\"/workflow/${subworkflowInfo?.id}\" target=\"_blank\">sub-workflow’s trigger</a>`\n\t\t\t: 'sub-workflow’s trigger';\n\n\t\tswitch (dataMode) {\n\t\t\tcase 'passthrough':\n\t\t\t\temptyFieldsNotice = `This sub-workflow will consume all input data passed to it. You can define specific expected input in the ${subworkflowLink}.`;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\temptyFieldsNotice = `The sub-workflow isn't set up to accept any inputs. Change this in the ${subworkflowLink}.`;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn { fields, emptyFieldsNotice };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,8BAA0C;AAE1C,eAAsB,wBAEW;AAChC,QAAM,EAAE,QAAQ,UAAU,gBAAgB,IAAI,MAAM,kDAA0B,KAAK,IAAI,EAAE;AACzF,MAAI;AACJ,MAAI,OAAO,WAAW,GAAG;AACxB,UAAM,kBAAkB,iBAAiB,KACtC,sBAAsB,iBAAiB,EAAE,sDACzC;AAEH,YAAQ,UAAU;AAAA,MACjB,KAAK;AACJ,4BAAoB,6GAA6G,eAAe;AAChJ;AAAA,MACD;AACC,4BAAoB,0EAA0E,eAAe;AAC7G;AAAA,IACF;AAAA,EACD;AACA,SAAO,EAAE,QAAQ,kBAAkB;AACpC;","names":[]}
1
+ {"version":3,"sources":["../../../../../nodes/ExecuteWorkflow/ExecuteWorkflow/methods/localResourceMapping.ts"],"sourcesContent":["import type { ILocalLoadOptionsFunctions, ResourceMapperFields } from 'n8n-workflow';\n\nimport { loadWorkflowInputMappings } from '@utils/workflowInputsResourceMapping/GenericFunctions';\n\nexport async function loadSubWorkflowInputs(\n\tthis: ILocalLoadOptionsFunctions,\n): Promise<ResourceMapperFields> {\n\tconst { fields, dataMode, subworkflowInfo } = await loadWorkflowInputMappings.bind(this)();\n\tlet emptyFieldsNotice: string | undefined;\n\tif (fields.length === 0) {\n\t\tconst { triggerId, workflowId } = subworkflowInfo ?? {};\n\t\tconst path = (workflowId ?? '') + (triggerId ? `/${triggerId.slice(0, 6)}` : '');\n\t\tconst subworkflowLink = workflowId\n\t\t\t? `<a href=\"/workflow/${path}\" target=\"_blank\">sub-workflow’s trigger</a>`\n\t\t\t: 'sub-workflow’s trigger';\n\n\t\tswitch (dataMode) {\n\t\t\tcase 'passthrough':\n\t\t\t\temptyFieldsNotice = `This sub-workflow will consume all input data passed to it. You can define specific expected input in the ${subworkflowLink}.`;\n\t\t\t\tbreak;\n\t\t\tdefault:\n\t\t\t\temptyFieldsNotice = `The sub-workflow isn't set up to accept any inputs. Change this in the ${subworkflowLink}.`;\n\t\t\t\tbreak;\n\t\t}\n\t}\n\treturn { fields, emptyFieldsNotice };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,8BAA0C;AAE1C,eAAsB,wBAEW;AAChC,QAAM,EAAE,QAAQ,UAAU,gBAAgB,IAAI,MAAM,kDAA0B,KAAK,IAAI,EAAE;AACzF,MAAI;AACJ,MAAI,OAAO,WAAW,GAAG;AACxB,UAAM,EAAE,WAAW,WAAW,IAAI,mBAAmB,CAAC;AACtD,UAAM,QAAQ,cAAc,OAAO,YAAY,IAAI,UAAU,MAAM,GAAG,CAAC,CAAC,KAAK;AAC7E,UAAM,kBAAkB,aACrB,sBAAsB,IAAI,sDAC1B;AAEH,YAAQ,UAAU;AAAA,MACjB,KAAK;AACJ,4BAAoB,6GAA6G,eAAe;AAChJ;AAAA,MACD;AACC,4BAAoB,0EAA0E,eAAe;AAC7G;AAAA,IACF;AAAA,EACD;AACA,SAAO,EAAE,QAAQ,kBAAkB;AACpC;","names":[]}
@@ -30,9 +30,7 @@ const getBinaryDataFromNode = (context, nodeName) => {
30
30
  const binaryResponse = async (context) => {
31
31
  const inputDataFieldName = context.getNodeParameter("inputDataFieldName", "");
32
32
  const parentNodes = context.getParentNodes(context.getNode().name);
33
- const binaryNode = parentNodes.find(
34
- (node) => getBinaryDataFromNode(context, node?.name)?.hasOwnProperty(inputDataFieldName)
35
- );
33
+ const binaryNode = parentNodes.reverse().find((node) => getBinaryDataFromNode(context, node?.name)?.hasOwnProperty(inputDataFieldName));
36
34
  if (!binaryNode) {
37
35
  throw new import_n8n_workflow.OperationalError(`No binary data with field ${inputDataFieldName} found.`);
38
36
  }
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../nodes/Form/formCompletionUtils.ts"],"sourcesContent":["import { type Response } from 'express';\nimport {\n\ttype NodeTypeAndVersion,\n\ttype IWebhookFunctions,\n\ttype IWebhookResponseData,\n\ttype IBinaryData,\n\ttype IDataObject,\n\tOperationalError,\n} from 'n8n-workflow';\n\nimport { sanitizeCustomCss, sanitizeHtml } from './utils';\n\nconst getBinaryDataFromNode = (context: IWebhookFunctions, nodeName: string): IDataObject => {\n\treturn context.evaluateExpression(`{{ $('${nodeName}').first().binary }}`) as IDataObject;\n};\n\nexport const binaryResponse = async (\n\tcontext: IWebhookFunctions,\n): Promise<{ data: string | Buffer; fileName: string; type: string }> => {\n\tconst inputDataFieldName = context.getNodeParameter('inputDataFieldName', '') as string;\n\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\tconst binaryNode = parentNodes.find((node) =>\n\t\tgetBinaryDataFromNode(context, node?.name)?.hasOwnProperty(inputDataFieldName),\n\t);\n\tif (!binaryNode) {\n\t\tthrow new OperationalError(`No binary data with field ${inputDataFieldName} found.`);\n\t}\n\tconst binaryData = getBinaryDataFromNode(context, binaryNode?.name)[\n\t\tinputDataFieldName\n\t] as IBinaryData;\n\n\treturn {\n\t\t// If a binaryData has an id, the following field is set:\n\t\t// N8N_DEFAULT_BINARY_DATA_MODE=filesystem\n\t\tdata: binaryData.id\n\t\t\t? await context.helpers.binaryToBuffer(await context.helpers.getBinaryStream(binaryData.id))\n\t\t\t: atob(binaryData.data),\n\t\tfileName: binaryData.fileName ?? 'file',\n\t\ttype: binaryData.mimeType,\n\t};\n};\n\nexport const renderFormCompletion = async (\n\tcontext: IWebhookFunctions,\n\tres: Response,\n\ttrigger: NodeTypeAndVersion,\n): Promise<IWebhookResponseData> => {\n\tconst completionTitle = context.getNodeParameter('completionTitle', '') as string;\n\tconst completionMessage = context.getNodeParameter('completionMessage', '') as string;\n\tconst redirectUrl = context.getNodeParameter('redirectUrl', '') as string;\n\tconst options = context.getNodeParameter('options', {}) as {\n\t\tformTitle: string;\n\t\tcustomCss?: string;\n\t};\n\tconst responseText = context.getNodeParameter('responseText', '') as string;\n\tconst binary =\n\t\tcontext.getNodeParameter('respondWith', '') === 'returnBinary'\n\t\t\t? await binaryResponse(context)\n\t\t\t: '';\n\n\tlet title = options.formTitle;\n\tif (!title) {\n\t\ttitle = context.evaluateExpression(`{{ $('${trigger?.name}').params.formTitle }}`) as string;\n\t}\n\tconst appendAttribution = context.evaluateExpression(\n\t\t`{{ $('${trigger?.name}').params.options?.appendAttribution === false ? false : true }}`,\n\t) as boolean;\n\n\tres.render('form-trigger-completion', {\n\t\ttitle: completionTitle,\n\t\tmessage: completionMessage,\n\t\tformTitle: title,\n\t\tappendAttribution,\n\t\tresponseText: sanitizeHtml(responseText),\n\t\tresponseBinary: encodeURIComponent(JSON.stringify(binary)),\n\t\tdangerous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C,MAAM,eAAe,OAAO,IAC5B;AAEJ,MAAI,QAAQ,QAAQ;AACpB,MAAI,CAAC,OAAO;AACX,YAAQ,QAAQ,mBAAmB,SAAS,SAAS,IAAI,wBAAwB;AAAA,EAClF;AACA,QAAM,oBAAoB,QAAQ;AAAA,IACjC,SAAS,SAAS,IAAI;AAAA,EACvB;AAEA,MAAI,OAAO,2BAA2B;AAAA,IACrC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA,kBAAc,2BAAa,YAAY;AAAA,IACvC,gBAAgB,mBAAmB,KAAK,UAAU,MAAM,CAAC;AAAA,IACzD,wBAAoB,gCAAkB,QAAQ,SAAS;AAAA,IACvD;AAAA,EACD,CAAC;AAED,SAAO,EAAE,mBAAmB,KAAK;AAClC;","names":[]}
1
+ {"version":3,"sources":["../../../nodes/Form/formCompletionUtils.ts"],"sourcesContent":["import { type Response } from 'express';\nimport {\n\ttype NodeTypeAndVersion,\n\ttype IWebhookFunctions,\n\ttype IWebhookResponseData,\n\ttype IBinaryData,\n\ttype IDataObject,\n\tOperationalError,\n} from 'n8n-workflow';\n\nimport { sanitizeCustomCss, sanitizeHtml } from './utils';\n\nconst getBinaryDataFromNode = (context: IWebhookFunctions, nodeName: string): IDataObject => {\n\treturn context.evaluateExpression(`{{ $('${nodeName}').first().binary }}`) as IDataObject;\n};\n\nexport const binaryResponse = async (\n\tcontext: IWebhookFunctions,\n): Promise<{ data: string | Buffer; fileName: string; type: string }> => {\n\tconst inputDataFieldName = context.getNodeParameter('inputDataFieldName', '') as string;\n\tconst parentNodes = context.getParentNodes(context.getNode().name);\n\tconst binaryNode = parentNodes\n\t\t.reverse()\n\t\t.find((node) => getBinaryDataFromNode(context, node?.name)?.hasOwnProperty(inputDataFieldName));\n\tif (!binaryNode) {\n\t\tthrow new OperationalError(`No binary data with field ${inputDataFieldName} found.`);\n\t}\n\tconst binaryData = getBinaryDataFromNode(context, binaryNode?.name)[\n\t\tinputDataFieldName\n\t] as IBinaryData;\n\n\treturn {\n\t\t// If a binaryData has an id, the following field is set:\n\t\t// N8N_DEFAULT_BINARY_DATA_MODE=filesystem\n\t\tdata: binaryData.id\n\t\t\t? await context.helpers.binaryToBuffer(await context.helpers.getBinaryStream(binaryData.id))\n\t\t\t: atob(binaryData.data),\n\t\tfileName: binaryData.fileName ?? 'file',\n\t\ttype: binaryData.mimeType,\n\t};\n};\n\nexport const renderFormCompletion = async (\n\tcontext: IWebhookFunctions,\n\tres: Response,\n\ttrigger: NodeTypeAndVersion,\n): Promise<IWebhookResponseData> => {\n\tconst completionTitle = context.getNodeParameter('completionTitle', '') as string;\n\tconst completionMessage = context.getNodeParameter('completionMessage', '') as string;\n\tconst redirectUrl = context.getNodeParameter('redirectUrl', '') as string;\n\tconst options = context.getNodeParameter('options', {}) as {\n\t\tformTitle: string;\n\t\tcustomCss?: string;\n\t};\n\tconst responseText = context.getNodeParameter('responseText', '') as string;\n\tconst binary =\n\t\tcontext.getNodeParameter('respondWith', '') === 'returnBinary'\n\t\t\t? await binaryResponse(context)\n\t\t\t: '';\n\n\tlet title = options.formTitle;\n\tif (!title) {\n\t\ttitle = context.evaluateExpression(`{{ $('${trigger?.name}').params.formTitle }}`) as string;\n\t}\n\tconst appendAttribution = context.evaluateExpression(\n\t\t`{{ $('${trigger?.name}').params.options?.appendAttribution === false ? false : true }}`,\n\t) as boolean;\n\n\tres.render('form-trigger-completion', {\n\t\ttitle: completionTitle,\n\t\tmessage: completionMessage,\n\t\tformTitle: title,\n\t\tappendAttribution,\n\t\tresponseText: sanitizeHtml(responseText),\n\t\tresponseBinary: encodeURIComponent(JSON.stringify(binary)),\n\t\tdangerousCustomCss: sanitizeCustomCss(options.customCss),\n\t\tredirectUrl,\n\t});\n\n\treturn { noWebhookResponse: true };\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,0BAOO;AAEP,mBAAgD;AAEhD,MAAM,wBAAwB,CAA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IAAI;AAAA,EACvB;AAEA,MAAI,OAAO,2BAA2B;AAAA,IACrC,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,IACX;AAAA,IACA,kBAAc,2BAAa,YAAY;AAAA,IACvC,gBAAgB,mBAAmB,KAAK,UAAU,MAAM,CAAC;AAAA,IACzD,wBAAoB,gCAAkB,QAAQ,SAAS;AAAA,IACvD;AAAA,EACD,CAAC;AAED,SAAO,EAAE,mBAAmB,KAAK;AAClC;","names":[]}
@@ -326,9 +326,8 @@ async function prepareFormReturnItem(context, formFields, mode, useWorkflowTimez
326
326
  const timezone = useWorkflowTimezone ? context.getTimezone() : "UTC";
327
327
  returnItem.json.submittedAt = import_luxon.DateTime.now().setZone(timezone).toISO();
328
328
  returnItem.json.formMode = mode;
329
- const workflowStaticData = context.getWorkflowStaticData("node");
330
- if (Object.keys(workflowStaticData || {}).length && context.getNode().type === import_n8n_workflow.FORM_TRIGGER_NODE_TYPE) {
331
- returnItem.json.formQueryParameters = workflowStaticData;
329
+ if (context.getNode().type === import_n8n_workflow.FORM_TRIGGER_NODE_TYPE && Object.keys(context.getRequestObject().query || {}).length) {
330
+ returnItem.json.formQueryParameters = context.getRequestObject().query;
332
331
  }
333
332
  return returnItem;
334
333
  }
@@ -352,10 +351,6 @@ function renderForm({
352
351
  let query = {};
353
352
  if (context.getNode().type === import_n8n_workflow.FORM_TRIGGER_NODE_TYPE) {
354
353
  query = context.getRequestObject().query;
355
- const workflowStaticData = context.getWorkflowStaticData("node");
356
- for (const key of Object.keys(query)) {
357
- workflowStaticData[key] = query[key];
358
- }
359
354
  } else if (context.getNode().type === import_n8n_workflow.FORM_NODE_TYPE) {
360
355
  const parentNodes = context.getParentNodes(context.getNode().name);
361
356
  const trigger = parentNodes.find(