n8n-nodes-commercetools 1.0.16 → 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 (104) hide show
  1. package/README.md +3 -3
  2. package/dist/credentials/CommerceToolsOAuth2Api.credentials.d.ts +9 -0
  3. package/dist/credentials/CommerceToolsOAuth2Api.credentials.js +230 -0
  4. package/dist/credentials/CommerceToolsOAuth2Api.credentials.js.map +1 -0
  5. package/dist/nodes/Commercetools/Commercetools.node.d.ts +7 -0
  6. package/dist/nodes/Commercetools/Commercetools.node.js +122 -0
  7. package/dist/nodes/Commercetools/Commercetools.node.js.map +1 -0
  8. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.d.ts +22 -0
  9. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js +75 -0
  10. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js.map +1 -0
  11. package/dist/nodes/Commercetools/generated/operations.json +40468 -0
  12. package/dist/nodes/Commercetools/utils/awsDelete.utils.d.ts +3 -0
  13. package/dist/nodes/Commercetools/utils/awsDelete.utils.js +91 -0
  14. package/dist/nodes/Commercetools/utils/awsDelete.utils.js.map +1 -0
  15. package/dist/nodes/Commercetools/utils/awsInfra.utils.d.ts +19 -0
  16. package/dist/nodes/Commercetools/utils/awsInfra.utils.js +245 -0
  17. package/dist/nodes/Commercetools/utils/awsInfra.utils.js.map +1 -0
  18. package/dist/nodes/Commercetools/utils/bodyBuilder.utils.d.ts +7 -0
  19. package/dist/nodes/Commercetools/utils/bodyBuilder.utils.js +149 -0
  20. package/dist/nodes/Commercetools/utils/bodyBuilder.utils.js.map +1 -0
  21. package/dist/nodes/Commercetools/utils/cloudVerification.utils.d.ts +4 -0
  22. package/dist/nodes/Commercetools/utils/cloudVerification.utils.js +100 -0
  23. package/dist/nodes/Commercetools/utils/cloudVerification.utils.js.map +1 -0
  24. package/dist/nodes/Commercetools/utils/gcpDelete.utils.d.ts +3 -0
  25. package/dist/nodes/Commercetools/utils/gcpDelete.utils.js +64 -0
  26. package/dist/nodes/Commercetools/utils/gcpDelete.utils.js.map +1 -0
  27. package/dist/nodes/Commercetools/utils/gcpInfra.utils.d.ts +20 -0
  28. package/dist/nodes/Commercetools/utils/gcpInfra.utils.js +256 -0
  29. package/dist/nodes/Commercetools/utils/gcpInfra.utils.js.map +1 -0
  30. package/dist/nodes/Commercetools/utils/imageUpload.utils.d.ts +4 -0
  31. package/dist/nodes/Commercetools/utils/imageUpload.utils.js +103 -0
  32. package/dist/nodes/Commercetools/utils/imageUpload.utils.js.map +1 -0
  33. package/dist/nodes/Commercetools/utils/subscription.utils.d.ts +15 -0
  34. package/dist/nodes/Commercetools/utils/subscription.utils.js +104 -0
  35. package/dist/nodes/Commercetools/utils/subscription.utils.js.map +1 -0
  36. package/dist/nodes/Commercetools/utils/urlBuilder.utils.d.ts +5 -0
  37. package/dist/nodes/Commercetools/utils/urlBuilder.utils.js +77 -0
  38. package/dist/nodes/Commercetools/utils/urlBuilder.utils.js.map +1 -0
  39. package/dist/nodes/Commercetools/utils/webhookMethods.utils.d.ts +8 -0
  40. package/dist/nodes/Commercetools/utils/webhookMethods.utils.js +184 -0
  41. package/dist/nodes/Commercetools/utils/webhookMethods.utils.js.map +1 -0
  42. package/dist/scripts/collection/fieldExtractors.d.ts +3 -0
  43. package/dist/scripts/collection/fieldExtractors.js +62 -0
  44. package/dist/scripts/collection/fieldExtractors.js.map +1 -0
  45. package/dist/scripts/collection/findFolder.d.ts +2 -0
  46. package/dist/scripts/collection/findFolder.js +32 -0
  47. package/dist/scripts/collection/findFolder.js.map +1 -0
  48. package/dist/scripts/collection/helpers.d.ts +4 -0
  49. package/dist/scripts/collection/helpers.js +35 -0
  50. package/dist/scripts/collection/helpers.js.map +1 -0
  51. package/dist/scripts/collection/postmanTypes.d.ts +27 -0
  52. package/dist/scripts/collection/postmanTypes.js +3 -0
  53. package/dist/scripts/collection/postmanTypes.js.map +1 -0
  54. package/dist/scripts/collection/types.d.ts +32 -0
  55. package/dist/scripts/collection/types.js +3 -0
  56. package/dist/scripts/collection/types.js.map +1 -0
  57. package/dist/scripts/collection/walkItems.d.ts +3 -0
  58. package/dist/scripts/collection/walkItems.js +147 -0
  59. package/dist/scripts/collection/walkItems.js.map +1 -0
  60. package/dist/scripts/generate.d.ts +1 -0
  61. package/dist/scripts/generate.js +197 -0
  62. package/dist/scripts/generate.js.map +1 -0
  63. package/dist/scripts/generateCtpRegistry.d.ts +24 -0
  64. package/dist/scripts/generateCtpRegistry.js +167 -0
  65. package/dist/scripts/generateCtpRegistry.js.map +1 -0
  66. package/dist/scripts/generateProperties.d.ts +9 -0
  67. package/dist/scripts/generateProperties.js +46 -0
  68. package/dist/scripts/generateProperties.js.map +1 -0
  69. package/dist/scripts/generateSubscriptionProperties.d.ts +1 -0
  70. package/dist/scripts/generateSubscriptionProperties.js +123 -0
  71. package/dist/scripts/generateSubscriptionProperties.js.map +1 -0
  72. package/dist/scripts/operationUtils.d.ts +3 -0
  73. package/dist/scripts/operationUtils.js +25 -0
  74. package/dist/scripts/operationUtils.js.map +1 -0
  75. package/dist/scripts/parseCollection.d.ts +5 -0
  76. package/dist/scripts/parseCollection.js +19 -0
  77. package/dist/scripts/parseCollection.js.map +1 -0
  78. package/dist/scripts/properties/bodyFields.d.ts +5 -0
  79. package/dist/scripts/properties/bodyFields.js +58 -0
  80. package/dist/scripts/properties/bodyFields.js.map +1 -0
  81. package/dist/scripts/properties/helpers.d.ts +15 -0
  82. package/dist/scripts/properties/helpers.js +164 -0
  83. package/dist/scripts/properties/helpers.js.map +1 -0
  84. package/dist/scripts/properties/idFields.d.ts +3 -0
  85. package/dist/scripts/properties/idFields.js +147 -0
  86. package/dist/scripts/properties/idFields.js.map +1 -0
  87. package/dist/scripts/properties/imageAndQuery.d.ts +4 -0
  88. package/dist/scripts/properties/imageAndQuery.js +123 -0
  89. package/dist/scripts/properties/imageAndQuery.js.map +1 -0
  90. package/dist/scripts/properties/resourceAndOperation.d.ts +5 -0
  91. package/dist/scripts/properties/resourceAndOperation.js +66 -0
  92. package/dist/scripts/properties/resourceAndOperation.js.map +1 -0
  93. package/dist/scripts/properties/versionAndActions.d.ts +4 -0
  94. package/dist/scripts/properties/versionAndActions.js +75 -0
  95. package/dist/scripts/properties/versionAndActions.js.map +1 -0
  96. package/dist/scripts/utils/download.d.ts +1 -0
  97. package/dist/scripts/utils/download.js +76 -0
  98. package/dist/scripts/utils/download.js.map +1 -0
  99. package/dist/scripts/utils/patches.d.ts +9 -0
  100. package/dist/scripts/utils/patches.js +94 -0
  101. package/dist/scripts/utils/patches.js.map +1 -0
  102. package/dist/tsconfig.tsbuildinfo +1 -0
  103. package/package.json +1 -1
  104. package/dist/package.json +0 -81
package/README.md CHANGED
@@ -518,10 +518,10 @@ New API endpoints and fields appear in the node automatically without manual dev
518
518
 
519
519
  | Version | Changes |
520
520
  | ------- | ----------------------------------------------------------------------------------------------------------------------------|
521
- | v1.0.16 | Readme Update |
521
+ | v1.0.17 | Fix: Updated TypeScript configuration to ensure proper compilation of nodes and generated files |
522
+ | v1.0.16 | Readme Update |
522
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 |
523
- | 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 |
524
- | v1.0.13 | Added Standalone Prices, Stores, Product Tailoring, Customer Groups, Product Selections, Cart Discounts, and Discount Codes |
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 |
525
525
  ---
526
526
 
527
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"],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E,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"}
@@ -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,0GAA0G;YAC3G,QAAQ,EAAE,EAAE,IAAI,EAAE,eAAe,EAAE;YACnC,MAAM,EAAE,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,CAAC,MAAM,CAAC;YACjB,WAAW,EAAE,CAAC,EAAE,IAAI,EAAE,wBAAwB,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;YACjE,YAAY,EAAE,IAAI;YAClB,UAAU,EAAE,gCAAmB;SAC/B,CAAC;IAsBH,CAAC;IApBA,KAAK,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,IAAI,CAAC,YAAY,EAAE,CAAC;QAClC,MAAM,UAAU,GAAyB,EAAE,CAAC;QAC5C,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,wBAAwB,CAAC,CAAC;QAExE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EA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gBAAgB,CAE9B,OAAe,EACf,WAAmC,EACnC,MAAc;;IAEd,IAAI,CAAC;QACJ,MAAM,IAAI,CAAC,OAAO,CAAC,6BAA6B,CAAC,IAAI,CAAC,IAAI,EAAE,wBAAwB,EAAE;YACrF,MAAM,EAAE,MAAM;YACd,GAAG,EAAE,OAAO;YACZ,EAAE,EAAE,MAAM,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS;SAC1C,CAAC,CAAC;QAC1B,OAAO,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,EAAE,GAAG,EAAE,GAAG,EAAE,OAAO,EAAE,CAAC;IACxD,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACvB,MAAM,UAAU,GAAG,MAAC,GAA+B,aAA/B,GAAG,uBAAH,GAAG,CAA8B,UAAU,mCAAI,GAAG,CAAC;QACvE,IAAI,UAAU,KAAK,GAAG;YAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,UAAU,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
@@ -0,0 +1 @@
1
+ {"version":3,"file":"CommercetoolsTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Commercetools/CommercetoolsTrigger.node.ts"],"names":[],"mappings":";;;AAiBA,mCAAyC;AAQzC,+CAAmD;AACnD,iFAAwE;AACxE,uEAA8D;AAa9D,MAAa,oBAAoB;IAAjC;QACC,gBAAW,GAAyB;YACnC,YAAY,EAAE,IAAI;YAClB,WAAW,EAAE,uBAAuB;YACpC,IAAI,EAAE,sBAAsB;YAC5B,IAAI,EAAE,wBAAwB;YAC9B,KAAK,EAAE,CAAC,SAAS,CAAC;YAClB,OAAO,EAAE,CAAC;YAEV,WAAW,EACV,2JAA2J;YAC5J,QAAQ,EAAE;gBACT,IAAI,EAAE,uBAAuB;aAC7B;YACD,KAAK,EAAE;gBACN,UAAU,EAAE,CAAC,eAAe,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,CAAC;gBACnE,aAAa,EAAE;oBACd,aAAa,EAAE,CA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