n8n-nodes-commercetools 1.0.15 → 1.0.17

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 (107) hide show
  1. package/LICENSE.md +19 -19
  2. package/README.md +20 -14
  3. package/dist/credentials/CommerceToolsOAuth2Api.credentials.d.ts +9 -0
  4. package/dist/credentials/CommerceToolsOAuth2Api.credentials.js +230 -0
  5. package/dist/credentials/CommerceToolsOAuth2Api.credentials.js.map +1 -0
  6. package/dist/icons/github.dark.svg +3 -3
  7. package/dist/icons/github.svg +3 -3
  8. package/dist/nodes/Commercetools/Commercetools.node.d.ts +7 -0
  9. package/dist/nodes/Commercetools/Commercetools.node.js +122 -0
  10. package/dist/nodes/Commercetools/Commercetools.node.js.map +1 -0
  11. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.d.ts +22 -0
  12. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js +75 -0
  13. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js.map +1 -0
  14. package/dist/nodes/Commercetools/generated/operations.json +40468 -0
  15. package/dist/nodes/Commercetools/utils/awsDelete.utils.d.ts +3 -0
  16. package/dist/nodes/Commercetools/utils/awsDelete.utils.js +91 -0
  17. package/dist/nodes/Commercetools/utils/awsDelete.utils.js.map +1 -0
  18. package/dist/nodes/Commercetools/utils/awsInfra.utils.d.ts +19 -0
  19. package/dist/nodes/Commercetools/utils/awsInfra.utils.js +245 -0
  20. package/dist/nodes/Commercetools/utils/awsInfra.utils.js.map +1 -0
  21. package/dist/nodes/Commercetools/utils/bodyBuilder.utils.d.ts +7 -0
  22. package/dist/nodes/Commercetools/utils/bodyBuilder.utils.js +149 -0
  23. package/dist/nodes/Commercetools/utils/bodyBuilder.utils.js.map +1 -0
  24. package/dist/nodes/Commercetools/utils/cloudVerification.utils.d.ts +4 -0
  25. package/dist/nodes/Commercetools/utils/cloudVerification.utils.js +100 -0
  26. package/dist/nodes/Commercetools/utils/cloudVerification.utils.js.map +1 -0
  27. package/dist/nodes/Commercetools/utils/gcpDelete.utils.d.ts +3 -0
  28. package/dist/nodes/Commercetools/utils/gcpDelete.utils.js +64 -0
  29. package/dist/nodes/Commercetools/utils/gcpDelete.utils.js.map +1 -0
  30. package/dist/nodes/Commercetools/utils/gcpInfra.utils.d.ts +20 -0
  31. package/dist/nodes/Commercetools/utils/gcpInfra.utils.js +256 -0
  32. package/dist/nodes/Commercetools/utils/gcpInfra.utils.js.map +1 -0
  33. package/dist/nodes/Commercetools/utils/imageUpload.utils.d.ts +4 -0
  34. package/dist/nodes/Commercetools/utils/imageUpload.utils.js +103 -0
  35. package/dist/nodes/Commercetools/utils/imageUpload.utils.js.map +1 -0
  36. package/dist/nodes/Commercetools/utils/subscription.utils.d.ts +15 -0
  37. package/dist/nodes/Commercetools/utils/subscription.utils.js +104 -0
  38. package/dist/nodes/Commercetools/utils/subscription.utils.js.map +1 -0
  39. package/dist/nodes/Commercetools/utils/urlBuilder.utils.d.ts +5 -0
  40. package/dist/nodes/Commercetools/utils/urlBuilder.utils.js +77 -0
  41. package/dist/nodes/Commercetools/utils/urlBuilder.utils.js.map +1 -0
  42. package/dist/nodes/Commercetools/utils/webhookMethods.utils.d.ts +8 -0
  43. package/dist/nodes/Commercetools/utils/webhookMethods.utils.js +184 -0
  44. package/dist/nodes/Commercetools/utils/webhookMethods.utils.js.map +1 -0
  45. package/dist/scripts/collection/fieldExtractors.d.ts +3 -0
  46. package/dist/scripts/collection/fieldExtractors.js +62 -0
  47. package/dist/scripts/collection/fieldExtractors.js.map +1 -0
  48. package/dist/scripts/collection/findFolder.d.ts +2 -0
  49. package/dist/scripts/collection/findFolder.js +32 -0
  50. package/dist/scripts/collection/findFolder.js.map +1 -0
  51. package/dist/scripts/collection/helpers.d.ts +4 -0
  52. package/dist/scripts/collection/helpers.js +35 -0
  53. package/dist/scripts/collection/helpers.js.map +1 -0
  54. package/dist/scripts/collection/postmanTypes.d.ts +27 -0
  55. package/dist/scripts/collection/postmanTypes.js +3 -0
  56. package/dist/scripts/collection/postmanTypes.js.map +1 -0
  57. package/dist/scripts/collection/types.d.ts +32 -0
  58. package/dist/scripts/collection/types.js +3 -0
  59. package/dist/scripts/collection/types.js.map +1 -0
  60. package/dist/scripts/collection/walkItems.d.ts +3 -0
  61. package/dist/scripts/collection/walkItems.js +147 -0
  62. package/dist/scripts/collection/walkItems.js.map +1 -0
  63. package/dist/scripts/generate.d.ts +1 -0
  64. package/dist/scripts/generate.js +197 -0
  65. package/dist/scripts/generate.js.map +1 -0
  66. package/dist/scripts/generateCtpRegistry.d.ts +24 -0
  67. package/dist/scripts/generateCtpRegistry.js +167 -0
  68. package/dist/scripts/generateCtpRegistry.js.map +1 -0
  69. package/dist/scripts/generateProperties.d.ts +9 -0
  70. package/dist/scripts/generateProperties.js +46 -0
  71. package/dist/scripts/generateProperties.js.map +1 -0
  72. package/dist/scripts/generateSubscriptionProperties.d.ts +1 -0
  73. package/dist/scripts/generateSubscriptionProperties.js +123 -0
  74. package/dist/scripts/generateSubscriptionProperties.js.map +1 -0
  75. package/dist/scripts/operationUtils.d.ts +3 -0
  76. package/dist/scripts/operationUtils.js +25 -0
  77. package/dist/scripts/operationUtils.js.map +1 -0
  78. package/dist/scripts/parseCollection.d.ts +5 -0
  79. package/dist/scripts/parseCollection.js +19 -0
  80. package/dist/scripts/parseCollection.js.map +1 -0
  81. package/dist/scripts/properties/bodyFields.d.ts +5 -0
  82. package/dist/scripts/properties/bodyFields.js +58 -0
  83. package/dist/scripts/properties/bodyFields.js.map +1 -0
  84. package/dist/scripts/properties/helpers.d.ts +15 -0
  85. package/dist/scripts/properties/helpers.js +164 -0
  86. package/dist/scripts/properties/helpers.js.map +1 -0
  87. package/dist/scripts/properties/idFields.d.ts +3 -0
  88. package/dist/scripts/properties/idFields.js +147 -0
  89. package/dist/scripts/properties/idFields.js.map +1 -0
  90. package/dist/scripts/properties/imageAndQuery.d.ts +4 -0
  91. package/dist/scripts/properties/imageAndQuery.js +123 -0
  92. package/dist/scripts/properties/imageAndQuery.js.map +1 -0
  93. package/dist/scripts/properties/resourceAndOperation.d.ts +5 -0
  94. package/dist/scripts/properties/resourceAndOperation.js +66 -0
  95. package/dist/scripts/properties/resourceAndOperation.js.map +1 -0
  96. package/dist/scripts/properties/versionAndActions.d.ts +4 -0
  97. package/dist/scripts/properties/versionAndActions.js +75 -0
  98. package/dist/scripts/properties/versionAndActions.js.map +1 -0
  99. package/dist/scripts/utils/download.d.ts +1 -0
  100. package/dist/scripts/utils/download.js +76 -0
  101. package/dist/scripts/utils/download.js.map +1 -0
  102. package/dist/scripts/utils/patches.d.ts +9 -0
  103. package/dist/scripts/utils/patches.js +94 -0
  104. package/dist/scripts/utils/patches.js.map +1 -0
  105. package/dist/tsconfig.tsbuildinfo +1 -0
  106. package/package.json +1 -1
  107. package/dist/package.json +0 -81
package/LICENSE.md CHANGED
@@ -1,19 +1,19 @@
1
- Copyright 2025 jjtech-digital
2
-
3
- Permission is hereby granted, free of charge, to any person obtaining a copy of
4
- this software and associated documentation files (the "Software"), to deal in
5
- the Software without restriction, including without limitation the rights to
6
- use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
- of the Software, and to permit persons to whom the Software is furnished to do
8
- so, subject to the following conditions:
9
-
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
-
13
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
- SOFTWARE.
1
+ Copyright 2025 jjtech-digital
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy of
4
+ this software and associated documentation files (the "Software"), to deal in
5
+ the Software without restriction, including without limitation the rights to
6
+ use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
7
+ of the Software, and to permit persons to whom the Software is furnished to do
8
+ so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
package/README.md CHANGED
@@ -269,16 +269,18 @@ A hash of `{ events, hasAWS, hasGCP }` is stored in workflow static data. When `
269
269
  When `awsAccessKeyId` and `awsSecretAccessKey` are present in the credential, the node automatically provisions:
270
270
 
271
271
  - SQS queue (14-day retention, long polling)
272
- - Lambda function (Node.js) with `WEBHOOK_URL` env var
272
+ - Lambda function (Node.js 22.x) with `WEBHOOK_URL` env var
273
273
  - IAM role with SQS receive/delete and CloudWatch Logs policies
274
274
  - Event source mapping (SQS → Lambda, batch size 10)
275
275
 
276
276
  The Lambda forwards each SQS message to the n8n webhook URL as a POST request. All resources are deleted when the trigger is deactivated or its configuration changes.
277
277
 
278
+ Uses **AWS SDK for JavaScript v3** (`@aws-sdk/client-sqs`, `@aws-sdk/client-lambda`, `@aws-sdk/client-iam`, `@aws-sdk/client-sts`, `@aws-sdk/client-cloudwatch-logs`).
279
+
278
280
  **Requirements:**
279
281
 
280
282
  - Publicly reachable n8n webhook URL
281
- - AWS credentials with permissions for: SQS, Lambda, IAM, CloudWatch Logs
283
+ - AWS credentials with permissions for: SQS, Lambda, IAM, STS, CloudWatch Logs
282
284
 
283
285
  > ⚠️ AWS costs may apply.
284
286
 
@@ -356,7 +358,7 @@ npm run dev
356
358
  # Regenerate operations from the latest Postman collection + rebuild event registry
357
359
  npm run generate
358
360
 
359
- # Build
361
+ # Build (cross-platform — also copies lambda handlers to dist/ via scripts/copyLambda.js)
360
362
  npm run build
361
363
 
362
364
  # Build and watch
@@ -365,6 +367,9 @@ npm run build:watch
365
367
  # Lint
366
368
  npm run lint
367
369
  npm run lint:fix
370
+
371
+ # Run tests
372
+ npm test
368
373
  ```
369
374
 
370
375
  ### Code generation pipeline
@@ -458,10 +463,14 @@ nodes/Commercetools/
458
463
  ├── subscription.utils.ts Subscription CRUD + body building + event routing
459
464
  ├── webhookMethods.utils.ts Webhook lifecycle: checkExists / create / delete
460
465
  ├── cloudVerification.utils.ts AWS + GCP infrastructure existence checks
461
- ├── awsInfra.utils.ts AWS SQS / Lambda / IAM provisioning
462
- ├── awsDelete.utils.ts AWS infrastructure teardown
466
+ ├── awsInfra.utils.ts AWS SQS / Lambda / IAM provisioning (SDK v3)
467
+ ├── awsDelete.utils.ts AWS infrastructure teardown (SDK v3)
463
468
  ├── gcpInfra.utils.ts GCP Pub/Sub / Cloud Functions provisioning
464
469
  └── gcpDelete.utils.ts GCP infrastructure teardown
470
+
471
+ scripts/
472
+ ├── copyLambda.js Cross-platform postbuild: copies lambda/*.js → dist/
473
+ └── ...
465
474
  ```
466
475
 
467
476
  ---
@@ -494,8 +503,9 @@ New API endpoints and fields appear in the node automatically without manual dev
494
503
  | GCP: private key / PEM errors | Use the **Service Account JSON** field; paste the entire `.json` key file, not individual fields |
495
504
  | GCP: deploy timeout on first activation | GCP API enablement takes time on cold projects — retry after a minute |
496
505
  | GCP: `gcpRegion` missing error on activation | Open the credential and select a GCP Region — the field is required for Cloud Functions deployment |
497
- | AWS: wrong queue ARN in GovCloud / China regions | ARN is now fetched from `GetQueueAttributes` (not constructed manually) — update to v1.0.14 to fix |
506
+ | AWS: wrong queue ARN in GovCloud / China regions | ARN is fetched from `GetQueueAttributes` (not constructed manually) |
498
507
  | AWS: `credentials are invalid` or `permissions denied` | Verify the IAM user has SQS, Lambda, IAM, STS, and CloudWatch Logs permissions |
508
+ | Build: `The syntax of the command is incorrect` on Windows | Ensure you are on v1.0.15+ — the postbuild script is now cross-platform (`scripts/copyLambda.js`) |
499
509
  | Trigger: malformed webhook payload crashes execution | Update to v1.0.14 — invalid JSON payloads are now silently dropped instead of crashing the context |
500
510
  | Subscription: `subscriptionId is empty` error | The subscription ID was not persisted in static data — deactivate and reactivate the workflow |
501
511
  | Update operation: zero value (`0`) silently dropped | Update to v1.0.14 — `quantity: 0` and `centAmount: 0` are now sent correctly |
@@ -508,14 +518,10 @@ New API endpoints and fields appear in the node automatically without manual dev
508
518
 
509
519
  | Version | Changes |
510
520
  | ------- | ----------------------------------------------------------------------------------------------------------------------------|
511
- | v1.0.14 | Two-pass refactor: modular `scripts/` and `nodes/` structure; 60+ bug fixes across AWS/GCP provisioning, subscription management, body building, SSRF guard, and error handling; all files under 300 lines |
512
- | v1.0.13 | Added Standalone Prices, Stores, Product Tailoring, Customer Groups, Product Selections, Cart Discounts, and Discount Codes |
513
- | v1.0.12 | Added Approval Rules, Approval Flows, and Associate Endpoints |
514
- | v1.0.11 | Added Quotes, Quote Requests, Staged Quotes, Messages, and API Extensions |
515
- | v1.0.10 | Added Claude AI agents and skills for automated development assistance |
516
-
517
-
518
-
521
+ | v1.0.17 | Fix: Updated TypeScript configuration to ensure proper compilation of nodes and generated files |
522
+ | v1.0.16 | Readme Update |
523
+ | v1.0.15 | Migrated AWS infrastructure to SDK v3 (`@aws-sdk/client-*`); cross-platform postbuild script (`scripts/copyLambda.js`) fixes Windows build; lambda handlers now correctly copied to `dist/`; CI workflow adds test step and npm cache; ESLint allows `console.warn`/`console.error` for infrastructure logging |
524
+ | v1.0.14 | Added Product Discounts, Product Types, Product Projections, Tax Categories, Attribute Groups, API Clients, Recurring Orders, Recurrence Policies, Discount Groups, and In-Store Endpoints |
519
525
  ---
520
526
 
521
527
  ## License
@@ -0,0 +1,9 @@
1
+ import type { ICredentialType, INodeProperties, Icon } from 'n8n-workflow';
2
+ export declare class CommerceToolsOAuth2Api implements ICredentialType {
3
+ name: string;
4
+ extends: string[];
5
+ displayName: string;
6
+ icon: Icon;
7
+ documentationUrl: string;
8
+ properties: INodeProperties[];
9
+ }
@@ -0,0 +1,230 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommerceToolsOAuth2Api = void 0;
4
+ class CommerceToolsOAuth2Api {
5
+ constructor() {
6
+ this.name = 'commerceToolsOAuth2Api';
7
+ this.extends = ['oAuth2Api'];
8
+ this.displayName = 'commercetools OAuth2 API';
9
+ this.icon = 'file:../nodes/Commercetools/Commercetools.svg';
10
+ this.documentationUrl = 'https://docs.commercetools.com/api/authorization';
11
+ this.properties = [
12
+ {
13
+ displayName: 'Project Key',
14
+ name: 'projectKey',
15
+ type: 'string',
16
+ default: '',
17
+ placeholder: 'your-project-key',
18
+ description: 'The project key from commercetools Merchant Center',
19
+ required: true,
20
+ },
21
+ {
22
+ displayName: 'Region',
23
+ name: 'region',
24
+ type: 'options',
25
+ options: [
26
+ {
27
+ name: 'Australia (Southeast 1)',
28
+ value: 'australia-southeast1.gcp',
29
+ },
30
+ {
31
+ name: 'Europe (West)',
32
+ value: 'europe-west1.gcp',
33
+ },
34
+ {
35
+ name: 'North America (US Central)',
36
+ value: 'us-central1.gcp',
37
+ },
38
+ ],
39
+ default: 'australia-southeast1.gcp',
40
+ description: 'The commercetools region. Determines both the OAuth token endpoint and the API base URL.',
41
+ },
42
+ {
43
+ displayName: 'Event Provider',
44
+ name: 'eventProvider',
45
+ type: 'options',
46
+ options: [
47
+ {
48
+ name: 'None',
49
+ value: 'none',
50
+ },
51
+ {
52
+ name: 'AWS EventBridge',
53
+ value: 'aws',
54
+ },
55
+ {
56
+ name: 'Google Cloud Pub/Sub',
57
+ value: 'gcp',
58
+ },
59
+ ],
60
+ default: 'none',
61
+ description: 'Choose the event provider for webhook integration',
62
+ },
63
+ {
64
+ displayName: 'Webhook Secret',
65
+ name: 'webhookSecret',
66
+ type: 'string',
67
+ typeOptions: { password: true },
68
+ default: '',
69
+ placeholder: 'Optional shared secret for webhook validation',
70
+ description: 'If set, incoming webhook requests must include this value in the X-Webhook-Secret header',
71
+ },
72
+ {
73
+ displayName: 'AWS Client Access Key',
74
+ name: 'awsAccessKeyId',
75
+ type: 'string',
76
+ default: '',
77
+ placeholder: 'your-aws-client-id',
78
+ description: 'AWS Access Key ID for EventBridge authentication',
79
+ displayOptions: {
80
+ show: {
81
+ eventProvider: ['aws'],
82
+ },
83
+ },
84
+ },
85
+ {
86
+ displayName: 'AWS Client Secret',
87
+ name: 'awsSecretAccessKey',
88
+ type: 'string',
89
+ typeOptions: { password: true },
90
+ default: '',
91
+ placeholder: 'your-aws-client-secret',
92
+ description: 'AWS Secret Access Key for EventBridge authentication',
93
+ displayOptions: {
94
+ show: {
95
+ eventProvider: ['aws'],
96
+ },
97
+ },
98
+ },
99
+ {
100
+ displayName: 'AWS Region',
101
+ name: 'awsRegion',
102
+ type: 'options',
103
+ options: [
104
+ { name: 'us-east-1', value: 'us-east-1' },
105
+ { name: 'us-east-2', value: 'us-east-2' },
106
+ { name: 'us-west-1', value: 'us-west-1' },
107
+ { name: 'us-west-2', value: 'us-west-2' },
108
+ { name: 'eu-west-1', value: 'eu-west-1' },
109
+ { name: 'eu-west-2', value: 'eu-west-2' },
110
+ { name: 'eu-west-3', value: 'eu-west-3' },
111
+ { name: 'eu-central-1', value: 'eu-central-1' },
112
+ { name: 'eu-central-2', value: 'eu-central-2' },
113
+ { name: 'eu-north-1', value: 'eu-north-1' },
114
+ { name: 'ap-southeast-1', value: 'ap-southeast-1' },
115
+ { name: 'ap-southeast-2', value: 'ap-southeast-2' },
116
+ { name: 'ap-northeast-1', value: 'ap-northeast-1' },
117
+ { name: 'ap-northeast-2', value: 'ap-northeast-2' },
118
+ { name: 'ap-south-1', value: 'ap-south-1' },
119
+ { name: 'sa-east-1', value: 'sa-east-1' },
120
+ { name: 'ca-central-1', value: 'ca-central-1' },
121
+ { name: 'me-south-1', value: 'me-south-1' },
122
+ { name: 'af-south-1', value: 'af-south-1' },
123
+ ],
124
+ default: 'us-east-1',
125
+ description: 'AWS Region for EventBridge',
126
+ displayOptions: {
127
+ show: {
128
+ eventProvider: ['aws'],
129
+ },
130
+ },
131
+ },
132
+ {
133
+ displayName: 'Service Account JSON',
134
+ name: 'serviceAccountJson',
135
+ type: 'string',
136
+ typeOptions: {
137
+ password: true,
138
+ rows: 6,
139
+ },
140
+ default: '',
141
+ placeholder: 'Paste the entire contents of your downloaded GCP service account .json key file',
142
+ description: 'The full JSON key file downloaded from GCP Console → IAM → Service Accounts → Keys',
143
+ displayOptions: {
144
+ show: {
145
+ eventProvider: ['gcp'],
146
+ },
147
+ },
148
+ },
149
+ {
150
+ displayName: 'GCP Region',
151
+ name: 'gcpRegion',
152
+ type: 'options',
153
+ options: [
154
+ { name: 'asia-east1', value: 'asia-east1' },
155
+ { name: 'asia-east2', value: 'asia-east2' },
156
+ { name: 'asia-northeast1', value: 'asia-northeast1' },
157
+ { name: 'asia-northeast2', value: 'asia-northeast2' },
158
+ { name: 'asia-northeast3', value: 'asia-northeast3' },
159
+ { name: 'asia-south1', value: 'asia-south1' },
160
+ { name: 'asia-south2', value: 'asia-south2' },
161
+ { name: 'asia-southeast1', value: 'asia-southeast1' },
162
+ { name: 'asia-southeast2', value: 'asia-southeast2' },
163
+ { name: 'australia-southeast1', value: 'australia-southeast1' },
164
+ { name: 'australia-southeast2', value: 'australia-southeast2' },
165
+ { name: 'europe-central2', value: 'europe-central2' },
166
+ { name: 'europe-north1', value: 'europe-north1' },
167
+ { name: 'europe-southwest1', value: 'europe-southwest1' },
168
+ { name: 'europe-west1', value: 'europe-west1' },
169
+ { name: 'europe-west2', value: 'europe-west2' },
170
+ { name: 'europe-west3', value: 'europe-west3' },
171
+ { name: 'europe-west4', value: 'europe-west4' },
172
+ { name: 'europe-west6', value: 'europe-west6' },
173
+ { name: 'europe-west8', value: 'europe-west8' },
174
+ { name: 'europe-west9', value: 'europe-west9' },
175
+ { name: 'southamerica-east1', value: 'southamerica-east1' },
176
+ { name: 'southamerica-west1', value: 'southamerica-west1' },
177
+ { name: 'us-central1', value: 'us-central1' },
178
+ { name: 'us-east1', value: 'us-east1' },
179
+ { name: 'us-east4', value: 'us-east4' },
180
+ { name: 'us-east5', value: 'us-east5' },
181
+ { name: 'us-south1', value: 'us-south1' },
182
+ { name: 'us-west1', value: 'us-west1' },
183
+ { name: 'us-west2', value: 'us-west2' },
184
+ { name: 'us-west3', value: 'us-west3' },
185
+ { name: 'us-west4', value: 'us-west4' },
186
+ ],
187
+ default: 'europe-west1',
188
+ description: 'The GCP region for Pub/Sub resources',
189
+ displayOptions: {
190
+ show: {
191
+ eventProvider: ['gcp'],
192
+ },
193
+ },
194
+ },
195
+ {
196
+ displayName: 'Grant Type',
197
+ name: 'grantType',
198
+ type: 'hidden',
199
+ default: 'clientCredentials',
200
+ },
201
+ {
202
+ displayName: 'Authorization URL',
203
+ name: 'authUrl',
204
+ type: 'hidden',
205
+ default: '={{ `https://auth.${$self["region"]}.commercetools.com` }}',
206
+ },
207
+ {
208
+ displayName: 'Access Token URL',
209
+ name: 'accessTokenUrl',
210
+ type: 'hidden',
211
+ default: '={{ `https://auth.${$self["region"]}.commercetools.com/oauth/token` }}',
212
+ required: true,
213
+ },
214
+ {
215
+ displayName: 'Auth URI Query Parameters',
216
+ name: 'authQueryParameters',
217
+ type: 'hidden',
218
+ default: 'grant_type=client_credentials',
219
+ },
220
+ {
221
+ displayName: 'Authentication',
222
+ name: 'authentication',
223
+ type: 'hidden',
224
+ default: 'header',
225
+ },
226
+ ];
227
+ }
228
+ }
229
+ exports.CommerceToolsOAuth2Api = CommerceToolsOAuth2Api;
230
+ //# sourceMappingURL=CommerceToolsOAuth2Api.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommerceToolsOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/CommerceToolsOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAYA,MAAa,sBAAsB;IAAnC;QACC,SAAI,GAAG,wBAAwB,CAAC;QAEhC,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAGxB,gBAAW,GAAG,0BAA0B,CAAC;QAEzC,SAAI,GAAS,+CAA+C,CAAC;QAE7D,qBAAgB,GAAG,kDAAkD,CAAC;QAEtE,eAAU,GAAsB;YAE/B;gBACC,WAAW,EAAE,aAAa;gBAC1B,IAAI,EAAE,YAAY;gBAClB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,kBAAkB;gBAC/B,WAAW,EAAE,oDAAoD;gBACjE,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,yBAAyB;wBAC/B,KAAK,EAAE,0BAA0B;qBACjC;oBACD;wBACC,IAAI,EAAE,eAAe;wBACrB,KAAK,EAAE,kBAAkB;qBACzB;oBACD;wBACC,IAAI,EAAE,4BAA4B;wBAClC,KAAK,EAAE,iBAAiB;qBACxB;iBACD;gBACD,OAAO,EAAE,0BAA0B;gBACnC,WAAW,EACV,0FAA0F;aAC3F;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,MAAM;wBACZ,KAAK,EAAE,MAAM;qBACb;oBACD;wBACC,IAAI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,cAAc,EAAE;oBACf,IAAI,EAAE;wBACL,aAAa,EAAE,CAAC,KAAK,CAAC;qBACtB;iBACD;aACD;YAGD;gBACC,WAAW,EAAE,YAAY;gBACzB,IAAI,EAAE,WAAW;gBACjB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,mBAAmB;aAC5B;YACD;gBACC,WAAW,EAAE,mBAAmB;gBAChC,IAAI,EAAE,SAAS;gBACf,IAAI,EAAE,QAAQ;gBAEd,OAAO,EAAE,4DAA4D;aACrE;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,wEAAwE;gBACjF,QAAQ,EAAE,IAAI;aACd;YACD;gBACC,WAAW,EAAE,2BAA2B;gBACxC,IAAI,EAAE,qBAAqB;gBAC3B,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,+BAA+B;aACxC;YACD;gBACC,WAAW,EAAE,gBAAgB;gBAC7B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,QAAQ;aACjB;SACD,CAAC;IACH,CAAC;CAAA;AA5OD,wDA4OC"}
@@ -1,3 +1,3 @@
1
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20.0165 0C8.94791 0 0 9.01388 0 20.1653C0 29.0792 5.73324 36.6246 13.6868 39.2952C14.6812 39.496 15.0454 38.8613 15.0454 38.3274C15.0454 37.8599 15.0126 36.2575 15.0126 34.5879C9.4445 35.79 8.28498 32.1841 8.28498 32.1841C7.39015 29.847 6.06429 29.2463 6.06429 29.2463C4.24185 28.011 6.19704 28.011 6.19704 28.011C8.21861 28.1446 9.27938 30.081 9.27938 30.081C11.0686 33.1522 13.9518 32.2844 15.1118 31.7502C15.2773 30.4481 15.8079 29.5467 16.3713 29.046C11.9303 28.5785 7.25781 26.8425 7.25781 19.0967C7.25781 16.8932 8.05267 15.0905 9.31216 13.6884C9.11344 13.1877 8.41732 11.1174 9.51128 8.34644C9.51128 8.34644 11.2014 7.81217 15.0122 10.4164C16.6438 9.97495 18.3263 9.7504 20.0165 9.74851C21.7067 9.74851 23.4295 9.98246 25.0205 10.4164C28.8317 7.81217 30.5218 8.34644 30.5218 8.34644C31.6158 11.1174 30.9192 13.1877 30.7205 13.6884C32.0132 15.0905 32.7753 16.8932 32.7753 19.0967C32.7753 26.8425 28.1028 28.5449 23.6287 29.046C24.358 29.6802 24.9873 30.882 24.9873 32.7851C24.9873 35.4893 24.9545 37.6596 24.9545 38.327C24.9545 38.8613 25.3192 39.496 26.3132 39.2956C34.2667 36.6242 39.9999 29.0792 39.9999 20.1653C40.0327 9.01388 31.052 0 20.0165 0Z" fill="white"/>
3
- </svg>
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M20.0165 0C8.94791 0 0 9.01388 0 20.1653C0 29.0792 5.73324 36.6246 13.6868 39.2952C14.6812 39.496 15.0454 38.8613 15.0454 38.3274C15.0454 37.8599 15.0126 36.2575 15.0126 34.5879C9.4445 35.79 8.28498 32.1841 8.28498 32.1841C7.39015 29.847 6.06429 29.2463 6.06429 29.2463C4.24185 28.011 6.19704 28.011 6.19704 28.011C8.21861 28.1446 9.27938 30.081 9.27938 30.081C11.0686 33.1522 13.9518 32.2844 15.1118 31.7502C15.2773 30.4481 15.8079 29.5467 16.3713 29.046C11.9303 28.5785 7.25781 26.8425 7.25781 19.0967C7.25781 16.8932 8.05267 15.0905 9.31216 13.6884C9.11344 13.1877 8.41732 11.1174 9.51128 8.34644C9.51128 8.34644 11.2014 7.81217 15.0122 10.4164C16.6438 9.97495 18.3263 9.7504 20.0165 9.74851C21.7067 9.74851 23.4295 9.98246 25.0205 10.4164C28.8317 7.81217 30.5218 8.34644 30.5218 8.34644C31.6158 11.1174 30.9192 13.1877 30.7205 13.6884C32.0132 15.0905 32.7753 16.8932 32.7753 19.0967C32.7753 26.8425 28.1028 28.5449 23.6287 29.046C24.358 29.6802 24.9873 30.882 24.9873 32.7851C24.9873 35.4893 24.9545 37.6596 24.9545 38.327C24.9545 38.8613 25.3192 39.496 26.3132 39.2956C34.2667 36.6242 39.9999 29.0792 39.9999 20.1653C40.0327 9.01388 31.052 0 20.0165 0Z" fill="white"/>
3
+ </svg>
@@ -1,3 +1,3 @@
1
- <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
- <path fill-rule="evenodd" clip-rule="evenodd" d="M20.0165 0C8.94791 0 0 9.01388 0 20.1653C0 29.0792 5.73324 36.6246 13.6868 39.2952C14.6812 39.496 15.0454 38.8613 15.0454 38.3274C15.0454 37.8599 15.0126 36.2575 15.0126 34.5879C9.4445 35.79 8.28498 32.1841 8.28498 32.1841C7.39015 29.847 6.06429 29.2463 6.06429 29.2463C4.24185 28.011 6.19704 28.011 6.19704 28.011C8.21861 28.1446 9.27938 30.081 9.27938 30.081C11.0686 33.1522 13.9518 32.2844 15.1118 31.7502C15.2773 30.4481 15.8079 29.5467 16.3713 29.046C11.9303 28.5785 7.25781 26.8425 7.25781 19.0967C7.25781 16.8932 8.05267 15.0905 9.31216 13.6884C9.11344 13.1877 8.41732 11.1174 9.51128 8.34644C9.51128 8.34644 11.2014 7.81217 15.0122 10.4164C16.6438 9.97495 18.3263 9.7504 20.0165 9.74851C21.7067 9.74851 23.4295 9.98246 25.0205 10.4164C28.8317 7.81217 30.5218 8.34644 30.5218 8.34644C31.6158 11.1174 30.9192 13.1877 30.7205 13.6884C32.0132 15.0905 32.7753 16.8932 32.7753 19.0967C32.7753 26.8425 28.1028 28.5449 23.6287 29.046C24.358 29.6802 24.9873 30.882 24.9873 32.7851C24.9873 35.4893 24.9545 37.6596 24.9545 38.327C24.9545 38.8613 25.3192 39.496 26.3132 39.2956C34.2667 36.6242 39.9999 29.0792 39.9999 20.1653C40.0327 9.01388 31.052 0 20.0165 0Z" fill="#24292F"/>
3
- </svg>
1
+ <svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path fill-rule="evenodd" clip-rule="evenodd" d="M20.0165 0C8.94791 0 0 9.01388 0 20.1653C0 29.0792 5.73324 36.6246 13.6868 39.2952C14.6812 39.496 15.0454 38.8613 15.0454 38.3274C15.0454 37.8599 15.0126 36.2575 15.0126 34.5879C9.4445 35.79 8.28498 32.1841 8.28498 32.1841C7.39015 29.847 6.06429 29.2463 6.06429 29.2463C4.24185 28.011 6.19704 28.011 6.19704 28.011C8.21861 28.1446 9.27938 30.081 9.27938 30.081C11.0686 33.1522 13.9518 32.2844 15.1118 31.7502C15.2773 30.4481 15.8079 29.5467 16.3713 29.046C11.9303 28.5785 7.25781 26.8425 7.25781 19.0967C7.25781 16.8932 8.05267 15.0905 9.31216 13.6884C9.11344 13.1877 8.41732 11.1174 9.51128 8.34644C9.51128 8.34644 11.2014 7.81217 15.0122 10.4164C16.6438 9.97495 18.3263 9.7504 20.0165 9.74851C21.7067 9.74851 23.4295 9.98246 25.0205 10.4164C28.8317 7.81217 30.5218 8.34644 30.5218 8.34644C31.6158 11.1174 30.9192 13.1877 30.7205 13.6884C32.0132 15.0905 32.7753 16.8932 32.7753 19.0967C32.7753 26.8425 28.1028 28.5449 23.6287 29.046C24.358 29.6802 24.9873 30.882 24.9873 32.7851C24.9873 35.4893 24.9545 37.6596 24.9545 38.327C24.9545 38.8613 25.3192 39.496 26.3132 39.2956C34.2667 36.6242 39.9999 29.0792 39.9999 20.1653C40.0327 9.01388 31.052 0 20.0165 0Z" fill="#24292F"/>
3
+ </svg>
@@ -0,0 +1,7 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ import { isMainUpdateOp } from '../../scripts/operationUtils';
3
+ export declare class Commercetools implements INodeType {
4
+ description: INodeTypeDescription;
5
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
6
+ }
7
+ export { isMainUpdateOp };
@@ -0,0 +1,122 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.isMainUpdateOp = exports.Commercetools = void 0;
7
+ const n8n_workflow_1 = require("n8n-workflow");
8
+ const properties_1 = require("./generated/properties");
9
+ const operations_json_1 = __importDefault(require("./generated/operations.json"));
10
+ const operationUtils_1 = require("../../scripts/operationUtils");
11
+ Object.defineProperty(exports, "isMainUpdateOp", { enumerable: true, get: function () { return operationUtils_1.isMainUpdateOp; } });
12
+ const urlBuilder_utils_1 = require("./utils/urlBuilder.utils");
13
+ const bodyBuilder_utils_1 = require("./utils/bodyBuilder.utils");
14
+ const imageUpload_utils_1 = require("./utils/imageUpload.utils");
15
+ class Commercetools {
16
+ constructor() {
17
+ this.description = {
18
+ displayName: 'commercetools',
19
+ name: 'commercetools',
20
+ icon: 'file:Commercetools.svg',
21
+ group: ['transform'],
22
+ version: 1,
23
+ subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
24
+ description: 'Interact with the commercetools API. Operations are auto-generated from the official Postman collection.',
25
+ defaults: { name: 'commercetools' },
26
+ inputs: ['main'],
27
+ outputs: ['main'],
28
+ credentials: [{ name: 'commerceToolsOAuth2Api', required: true }],
29
+ usableAsTool: true,
30
+ properties: properties_1.generatedProperties,
31
+ };
32
+ }
33
+ async execute() {
34
+ const items = this.getInputData();
35
+ const returnData = [];
36
+ const credentials = await this.getCredentials('commerceToolsOAuth2Api');
37
+ for (let i = 0; i < items.length; i++) {
38
+ try {
39
+ const result = await executeOperation.call(this, i, credentials);
40
+ returnData.push({ json: result });
41
+ }
42
+ catch (error) {
43
+ if (this.continueOnFail()) {
44
+ returnData.push({ json: { error: error.message }, pairedItem: i });
45
+ continue;
46
+ }
47
+ throw error;
48
+ }
49
+ }
50
+ return [returnData];
51
+ }
52
+ }
53
+ exports.Commercetools = Commercetools;
54
+ async function executeOperation(i, creds) {
55
+ const projectKey = creds.projectKey;
56
+ const region = creds.region;
57
+ const baseUrl = `https://api.${region}.commercetools.com`;
58
+ const resource = this.getNodeParameter('resource', i);
59
+ const operation = this.getNodeParameter('operation', i);
60
+ const opDef = operations_json_1.default[operation];
61
+ if (!opDef) {
62
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation "${operation}". Re-run npm run generate to sync.`);
63
+ }
64
+ const fullUrl = urlBuilder_utils_1.buildUrl.call(this, i, opDef, projectKey, baseUrl, operation);
65
+ if (opDef.isImageUpload || /\/images$/.test(opDef.urlTemplate)) {
66
+ return imageUpload_utils_1.executeImageUpload.call(this, i, opDef, fullUrl);
67
+ }
68
+ const queryParams = {};
69
+ if (opDef.method === 'DELETE' && operation !== 'deleteCustomObjectByContainerAndKey') {
70
+ queryParams.version = String((0, urlBuilder_utils_1.safeGet)(this, 'version', i, 1));
71
+ }
72
+ if (['GET', 'HEAD'].includes(opDef.method)) {
73
+ const filters = (0, urlBuilder_utils_1.safeGet)(this, `queryParams__${operation}`, i, {});
74
+ for (const [k, v] of Object.entries(filters)) {
75
+ if (v !== null && v !== undefined && v !== '')
76
+ queryParams[k] = String(v);
77
+ }
78
+ for (const paramName of opDef.queryParams) {
79
+ const val = (0, urlBuilder_utils_1.safeGet)(this, `reqParam__${operation}__${paramName}`, i, '');
80
+ if (val !== '')
81
+ queryParams[paramName] = val;
82
+ }
83
+ }
84
+ const body = (0, bodyBuilder_utils_1.buildRequestBody)(this, i, opDef, resource, operation);
85
+ if (opDef.method === 'HEAD') {
86
+ return executeHeadCheck.call(this, fullUrl, queryParams, opDef.name);
87
+ }
88
+ const options = {
89
+ method: opDef.method,
90
+ url: fullUrl,
91
+ qs: Object.keys(queryParams).length > 0 ? queryParams : undefined,
92
+ json: true,
93
+ };
94
+ const isSearchOp = opDef.isSearch || /\/search$/.test(opDef.urlTemplate);
95
+ if (body && (isSearchOp || Object.keys(body).length > 0)) {
96
+ options.body = body;
97
+ }
98
+ try {
99
+ return await this.helpers.httpRequestWithAuthentication.call(this, 'commerceToolsOAuth2Api', options);
100
+ }
101
+ catch (err) {
102
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: err.message }, { message: `[${opDef.name}]: ${err.message}` });
103
+ }
104
+ }
105
+ async function executeHeadCheck(fullUrl, queryParams, opName) {
106
+ var _a;
107
+ try {
108
+ await this.helpers.httpRequestWithAuthentication.call(this, 'commerceToolsOAuth2Api', {
109
+ method: 'HEAD',
110
+ url: fullUrl,
111
+ qs: Object.keys(queryParams).length > 0 ? queryParams : undefined,
112
+ });
113
+ return { exists: true, statusCode: 200, url: fullUrl };
114
+ }
115
+ catch (err) {
116
+ const statusCode = (_a = err === null || err === void 0 ? void 0 : err.statusCode) !== null && _a !== void 0 ? _a : 404;
117
+ if (statusCode === 404)
118
+ return { exists: false, statusCode: 404, url: fullUrl };
119
+ throw new n8n_workflow_1.NodeApiError(this.getNode(), { message: err.message }, { message: `[${opName}]: ${err.message}` });
120
+ }
121
+ }
122
+ //# sourceMappingURL=Commercetools.node.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Commercetools.node.js","sourceRoot":"","sources":["../../../nodes/Commercetools/Commercetools.node.ts"],"names":[],"mappings":";;;;;;AA0BA,+CAAgE;AAChE,uDAA6D;AAE7D,kFAAwD;AACxD,iEAA8D;AA2JrD,+FA3JA,+BAAc,OA2JA;AA1JvB,+DAA6D;AAC7D,iEAA6D;AAC7D,iEAA+D;AAE/D,MAAa,aAAa;IAA1B;QACC,gBAAW,GAAyB;YACnC,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,eAAe;YACrB,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,WAAW,CAAC;YACpB,OAAO,EAAE,CAAC;YACV,QAAQ,EAAE,8DAA8D;YACxE,WAAW,EACV,0GA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AAU,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;QAChF,MAAM,IAAI,2BAAY,CACrB,IAAI,CAAC,OAAO,EAAE,EACd,EAAE,OAAO,EAAG,GAAa,CAAC,OAAO,EAAE,EACnC,EAAE,OAAO,EAAE,IAAI,MAAM,MAAO,GAAa,CAAC,OAAO,EAAE,EAAE,CACrD,CAAC;IACH,CAAC;AACF,CAAC"}
@@ -0,0 +1,22 @@
1
+ import type { IDataObject, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from 'n8n-workflow';
2
+ import type { AWSResponse } from './utils/awsInfra.utils';
3
+ import type { GCPResponse } from './utils/gcpInfra.utils';
4
+ export type StaticSubscriptionData = IDataObject & {
5
+ subscriptionId?: string;
6
+ awsInfrastructure?: AWSResponse;
7
+ gcpInfrastructure?: GCPResponse;
8
+ configHash?: string;
9
+ events?: string[];
10
+ lastVerifiedAt?: number;
11
+ };
12
+ export declare class CommercetoolsTrigger implements INodeType {
13
+ description: INodeTypeDescription;
14
+ webhookMethods: {
15
+ default: {
16
+ checkExists: (this: import("n8n-workflow").IHookFunctions) => Promise<boolean>;
17
+ create: (this: import("n8n-workflow").IHookFunctions) => Promise<boolean>;
18
+ delete: (this: import("n8n-workflow").IHookFunctions) => Promise<boolean>;
19
+ };
20
+ };
21
+ webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
22
+ }
@@ -0,0 +1,75 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CommercetoolsTrigger = void 0;
4
+ const crypto_1 = require("crypto");
5
+ const n8n_workflow_1 = require("n8n-workflow");
6
+ const subscription_properties_1 = require("./generated/subscription.properties");
7
+ const webhookMethods_utils_1 = require("./utils/webhookMethods.utils");
8
+ class CommercetoolsTrigger {
9
+ constructor() {
10
+ this.description = {
11
+ usableAsTool: true,
12
+ displayName: 'commercetools Trigger',
13
+ name: 'commercetoolsTrigger',
14
+ icon: 'file:Commercetools.svg',
15
+ group: ['trigger'],
16
+ version: 1,
17
+ description: 'Listen for commercetools events. Automatically provisions AWS SQS + Lambda or GCP Pub/Sub + Cloud Functions when the respective credentials are provided.',
18
+ defaults: {
19
+ name: 'commercetools Trigger',
20
+ },
21
+ codex: {
22
+ categories: ['commercetools', 'Integration', 'Customer', 'Product'],
23
+ subcategories: {
24
+ commercetools: ['Customer', 'Product'],
25
+ },
26
+ alias: ['commercetools'],
27
+ },
28
+ inputs: [],
29
+ outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
30
+ credentials: [
31
+ {
32
+ name: 'commerceToolsOAuth2Api',
33
+ required: true,
34
+ },
35
+ ],
36
+ webhooks: [
37
+ {
38
+ name: 'default',
39
+ httpMethod: 'POST',
40
+ responseMode: 'onReceived',
41
+ path: 'commercetools-events',
42
+ ndvHideUrl: false,
43
+ },
44
+ ],
45
+ properties: [...subscription_properties_1.triggerProperties],
46
+ };
47
+ this.webhookMethods = webhookMethods_utils_1.triggerMethods;
48
+ }
49
+ async webhook() {
50
+ var _a;
51
+ const req = this.getRequestObject();
52
+ const credentials = await this.getCredentials('commerceToolsOAuth2Api');
53
+ const secret = credentials.webhookSecret;
54
+ if (secret) {
55
+ const incoming = (_a = req.headers['x-webhook-secret']) !== null && _a !== void 0 ? _a : '';
56
+ const expected = Buffer.from(secret, 'utf8');
57
+ const received = Buffer.from(incoming, 'utf8');
58
+ if (expected.length !== received.length || !(0, crypto_1.timingSafeEqual)(expected, received)) {
59
+ return { noWebhookResponse: true };
60
+ }
61
+ }
62
+ let processedBody;
63
+ try {
64
+ processedBody = typeof req.body === 'string' ? JSON.parse(req.body) : req.body;
65
+ }
66
+ catch {
67
+ return { noWebhookResponse: true };
68
+ }
69
+ return {
70
+ workflowData: [this.helpers.returnJsonArray(processedBody)],
71
+ };
72
+ }
73
+ }
74
+ exports.CommercetoolsTrigger = CommercetoolsTrigger;
75
+ //# sourceMappingURL=CommercetoolsTrigger.node.js.map