n8n-nodes-commercetools 1.0.13 → 1.0.15

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 (39) hide show
  1. package/README.md +85 -12
  2. package/dist/nodes/Commercetools/generated/properties.js +25077 -10964
  3. package/dist/nodes/Commercetools/generated/properties.js.map +1 -1
  4. package/dist/nodes/Commercetools/generated/subscription.properties.d.ts +1 -1
  5. package/dist/nodes/Commercetools/generated/subscription.properties.js +287 -268
  6. package/dist/nodes/Commercetools/generated/subscription.properties.js.map +1 -1
  7. package/dist/nodes/Commercetools/lambda/awsHandler.js +108 -0
  8. package/dist/nodes/Commercetools/lambda/gcpHandler.js +94 -0
  9. package/dist/package.json +17 -11
  10. package/package.json +17 -11
  11. package/dist/credentials/CommerceToolsOAuth2Api.credentials.d.ts +0 -9
  12. package/dist/credentials/CommerceToolsOAuth2Api.credentials.js +0 -230
  13. package/dist/credentials/CommerceToolsOAuth2Api.credentials.js.map +0 -1
  14. package/dist/nodes/Commercetools/Commercetools.node.d.ts +0 -5
  15. package/dist/nodes/Commercetools/Commercetools.node.js +0 -408
  16. package/dist/nodes/Commercetools/Commercetools.node.js.map +0 -1
  17. package/dist/nodes/Commercetools/Commercetools.node.json +0 -18
  18. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.d.ts +0 -22
  19. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js +0 -69
  20. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js.map +0 -1
  21. package/dist/nodes/Commercetools/CommercetoolsTrigger.node.json +0 -21
  22. package/dist/nodes/Commercetools/generated/ctp-event-registry.json +0 -1418
  23. package/dist/nodes/Commercetools/generated/operations.json +0 -32705
  24. package/dist/nodes/Commercetools/utils/awsInfra.utils.d.ts +0 -19
  25. package/dist/nodes/Commercetools/utils/awsInfra.utils.js +0 -375
  26. package/dist/nodes/Commercetools/utils/awsInfra.utils.js.map +0 -1
  27. package/dist/nodes/Commercetools/utils/gcpInfra.utils.d.ts +0 -20
  28. package/dist/nodes/Commercetools/utils/gcpInfra.utils.js +0 -330
  29. package/dist/nodes/Commercetools/utils/gcpInfra.utils.js.map +0 -1
  30. package/dist/nodes/Commercetools/utils/subscription.utils.d.ts +0 -15
  31. package/dist/nodes/Commercetools/utils/subscription.utils.js +0 -109
  32. package/dist/nodes/Commercetools/utils/subscription.utils.js.map +0 -1
  33. package/dist/nodes/Commercetools/utils/webhookMethods.utils.d.ts +0 -8
  34. package/dist/nodes/Commercetools/utils/webhookMethods.utils.js +0 -235
  35. package/dist/nodes/Commercetools/utils/webhookMethods.utils.js.map +0 -1
  36. package/dist/scripts/parseCollection.d.ts +0 -33
  37. package/dist/scripts/parseCollection.js +0 -268
  38. package/dist/scripts/parseCollection.js.map +0 -1
  39. package/dist/tsconfig.tsbuildinfo +0 -1
package/README.md CHANGED
@@ -26,7 +26,7 @@ Operations are **auto-generated** from the official commercetools Postman collec
26
26
 
27
27
  ## Highlights
28
28
 
29
- - Full CRUD coverage for Products, Customers, Carts, Orders, Business Units, Categories, Channels, Associate Roles, Inventory, Reviews, Shopping Lists, Types, Custom Objects, Payments, Payment Methods, Shipping Methods, Zones, Subscriptions, States, Quotes, Quote Requests, Staged Quotes, Messages, API Extensions, Approval Rules, Approval Flows, Associate Endpoints, Standalone Prices, Stores, Product Tailoring, Customer Groups, Product Selections, Cart Discounts, and Discount Codes
29
+ - Full CRUD coverage for Products, Customers, Carts, Orders, Business Units, Categories, Channels, Associate Roles, Inventory, Reviews, Shopping Lists, Types, Custom Objects, Payments, Payment Methods, Shipping Methods, Zones, Subscriptions, States, Quotes, Quote Requests, Staged Quotes, Messages, API Extensions, Approval Rules, Approval Flows, Associate Endpoints, Standalone Prices, Stores, Product Tailoring, Customer Groups, Product Selections, Cart Discounts, Discount Codes, Product Discounts, Product Types, Product Projections, Tax Categories, Attribute Groups, API Clients, Recurring Orders, Recurrence Policies, Discount Groups, and In-Store Endpoints
30
30
  - Auto-generated operations from the official Postman collection — always in sync
31
31
  - Product image upload: downloads from a URL, posts raw binary to commercetools
32
32
  - Product, Order, and Business Unit search with structured query, sort, limit, and offset fields
@@ -96,6 +96,27 @@ Select a **Resource** and **Operation** to interact with the commercetools API.
96
96
  | **Product Selection** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
97
97
  | **Cart Discount** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
98
98
  | **Discount Code** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
99
+ | **Product Discount** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
100
+ | **Product Type** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
101
+ | **Product Projection** | Get by ID, Get by Key, Query, HEAD checks |
102
+ | **Tax Category** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
103
+ | **Attribute Group** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
104
+ | **API Client** | Create, Get by ID, Query, Delete, HEAD checks |
105
+ | **Recurring Order** | Create, Get by ID, Query, Update, Delete, HEAD checks |
106
+ | **Recurrence Policy** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
107
+ | **Discount Group** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
108
+ | **Store Business Unit** | Get by ID, Get by Key, Query, Update, HEAD checks |
109
+ | **Store Cart Discount** | Get by ID, Get by Key, Query, HEAD checks |
110
+ | **Store Cart** | Create, Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
111
+ | **Store Customer** | Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
112
+ | **Store Order** | Create, Get by ID, Get by Key, Query, Update, HEAD checks |
113
+ | **Store Quote Request** | Get by ID, Get by Key, Query, Update, HEAD checks |
114
+ | **Store Quote** | Get by ID, Get by Key, Query, Update, HEAD checks |
115
+ | **Store Shopping List** | Get by ID, Get by Key, Query, Update, Delete, HEAD checks |
116
+ | **Store Staged Quote** | Get by ID, Get by Key, Query, Update, HEAD checks |
117
+ | **Store Product Projection** | Get by ID, Get by Key, Query, HEAD checks |
118
+ | **Store Shipping Method** | Get matching methods for Cart, HEAD checks |
119
+ | **Store Product Tailoring** | Create, Get by Key, Update, Delete, Upload Image, HEAD checks |
99
120
 
100
121
  #### How field generation works
101
122
 
@@ -226,6 +247,10 @@ Listens for real-time commercetools events via webhook subscription. On activati
226
247
 
227
248
  **Product Selection** — created, deleted, product added/removed/excluded, variant selection/exclusion changed
228
249
 
250
+ **Cart Discounts** — no message triggers (change subscriptions only)
251
+
252
+ **Discount Codes** — no message triggers (change subscriptions only)
253
+
229
254
  #### Subscription routing
230
255
 
231
256
  Events are routed to the correct commercetools subscription arrays automatically using the generated event registry (produced by `generateCtpRegistry.ts` from the `@commercetools/platform-sdk` type declarations):
@@ -347,7 +372,13 @@ npm run lint:fix
347
372
  ```
348
373
  scripts/generate.ts (entry point: npm run generate)
349
374
 
350
- ├── parseCollection.ts
375
+ ├── parseCollection.ts (thin orchestrator)
376
+ │ ├── collection/postmanTypes.ts PostmanItem, PostmanCollection interfaces
377
+ │ ├── collection/types.ts BodyField, ParsedOperation interfaces
378
+ │ ├── collection/helpers.ts slugify, formatLabel, isLocalizedObject
379
+ │ ├── collection/fieldExtractors.ts extractFields, extractActionBodyFields
380
+ │ ├── collection/findFolder.ts findFolder (module-level cache — PERF-5)
381
+ │ └── collection/walkItems.ts walkItems (top-level exported function)
351
382
  │ Downloads Postman collection.json → ParsedOperation[]
352
383
  │ Detects per operation:
353
384
  │ isSearch POST .../search
@@ -359,7 +390,13 @@ scripts/generate.ts (entry point: npm run generate)
359
390
  │ bodyFields extracted from Postman body.raw JSON
360
391
  │ actionBodyFields fields from inside actions[0]
361
392
 
362
- ├── generateProperties.ts
393
+ ├── generateProperties.ts (thin orchestrator — PERF-4: Map index built once)
394
+ │ ├── properties/helpers.ts Constants + shared property builders
395
+ │ ├── properties/resourceAndOperation.ts Resource + Operation dropdowns
396
+ │ ├── properties/idFields.ts ID / Key / Container / path param fields
397
+ │ ├── properties/versionAndActions.ts Actions (JSON) + Actions (UI) fixedCollection
398
+ │ ├── properties/bodyFields.ts Create / Misc-POST / Search body fields
399
+ │ └── properties/imageAndQuery.ts Image upload fields + query-param Filters
363
400
  │ ParsedOperation[] → INodeProperties[]
364
401
  │ Emits in order:
365
402
  │ 1. Resource dropdown
@@ -383,7 +420,11 @@ scripts/generate.ts (entry point: npm run generate)
383
420
  │ Extracts: *MessagePayload type literals,
384
421
  │ MessageSubscriptionResourceTypeId values,
385
422
  │ ChangeSubscriptionResourceTypeId values
386
- Filters to allowedResources: [product, customer, cart, order, business-unit, category, channel, associate-role, inventory-entry, review, shopping-list, type, payment, quote, quote-request, staged-quote, approval-rule, approval-flow, standalone-price, store, product-tailoring, customer-group, product-selection]
423
+ │ Filters to allowedResources: [product, customer, cart, order, business-unit,
424
+ │ category, channel, associate-role, inventory-entry, review, shopping-list,
425
+ │ type, payment, quote, quote-request, staged-quote, approval-rule,
426
+ │ approval-flow, standalone-price, store, product-tailoring,
427
+ │ customer-group, product-selection]
387
428
  │ → nodes/Commercetools/generated/ctp-event-registry.json
388
429
 
389
430
  └── generateSubscriptionProperties.ts
@@ -396,6 +437,33 @@ scripts/generate.ts (entry point: npm run generate)
396
437
 
397
438
  Generated files are committed to the repository. The built node works without running `generate` unless the Postman collection or SDK has changed.
398
439
 
440
+ ### Node source layout
441
+
442
+ ```
443
+ nodes/Commercetools/
444
+ ├── Commercetools.node.ts Thin action-node orchestrator (~175 lines)
445
+ ├── CommercetoolsTrigger.node.ts Webhook trigger — receives and routes events
446
+ ├── generated/ Auto-generated (do not edit manually)
447
+ │ ├── properties.ts
448
+ │ ├── operations.json
449
+ │ ├── ctp-event-registry.json
450
+ │ └── subscription.properties.ts
451
+ ├── lambda/
452
+ │ ├── awsHandler.js Lambda: SQS → n8n webhook forwarder
453
+ │ └── gcpHandler.js Cloud Function: Pub/Sub → n8n webhook forwarder
454
+ └── utils/
455
+ ├── urlBuilder.utils.ts URL construction + path-param substitution
456
+ ├── bodyBuilder.utils.ts Request body assembly for all operation types
457
+ ├── imageUpload.utils.ts SSRF-guarded image download + CT binary POST
458
+ ├── subscription.utils.ts Subscription CRUD + body building + event routing
459
+ ├── webhookMethods.utils.ts Webhook lifecycle: checkExists / create / delete
460
+ ├── cloudVerification.utils.ts AWS + GCP infrastructure existence checks
461
+ ├── awsInfra.utils.ts AWS SQS / Lambda / IAM provisioning
462
+ ├── awsDelete.utils.ts AWS infrastructure teardown
463
+ ├── gcpInfra.utils.ts GCP Pub/Sub / Cloud Functions provisioning
464
+ └── gcpDelete.utils.ts GCP infrastructure teardown
465
+ ```
466
+
399
467
  ---
400
468
 
401
469
  ## Auto-Update Pipeline
@@ -425,6 +493,12 @@ New API endpoints and fields appear in the node automatically without manual dev
425
493
  | Business Unit Search: `Search Not Ready` | Business Unit Search must be activated on your project — call `PUT /{projectKey}/business-units/search/indexing-status` with `{ "activated": true }` then wait for indexing to complete |
426
494
  | GCP: private key / PEM errors | Use the **Service Account JSON** field; paste the entire `.json` key file, not individual fields |
427
495
  | GCP: deploy timeout on first activation | GCP API enablement takes time on cold projects — retry after a minute |
496
+ | 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 |
498
+ | AWS: `credentials are invalid` or `permissions denied` | Verify the IAM user has SQS, Lambda, IAM, STS, and CloudWatch Logs permissions |
499
+ | Trigger: malformed webhook payload crashes execution | Update to v1.0.14 — invalid JSON payloads are now silently dropped instead of crashing the context |
500
+ | Subscription: `subscriptionId is empty` error | The subscription ID was not persisted in static data — deactivate and reactivate the workflow |
501
+ | Update operation: zero value (`0`) silently dropped | Update to v1.0.14 — `quantity: 0` and `centAmount: 0` are now sent correctly |
428
502
  | Node not visible in n8n | Run `npm install` then `npm run dev` |
429
503
  | Trigger: `"A message with the name 'PaymentMethodCreated' is unknown for the TypeId 'payment'"` | CT Subscriptions API does not support `payment-method` as a resourceTypeId. Use CT API Extensions or a schedule-based polling trigger instead. |
430
504
 
@@ -432,14 +506,13 @@ New API endpoints and fields appear in the node automatically without manual dev
432
506
 
433
507
  ## Changelog
434
508
 
435
- | Version | Changes |
436
- | ------- | ------------------------------------------------------------------------------------------------ |
437
- | v1.0.12 | Added Approval Rules, Approval Flows, and Associate Endpoints |
438
- | v1.0.11 | Added Quotes, Quote Requests, Staged Quotes, Messages, and API Extensions |
439
- | v1.0.10 | Added Claude AI agents and skills for automated development assistance |
440
- | v1.0.9 | Added Zones, Subscriptions, and States |
441
- | v1.0.8 | Added Custom Objects, Payments, Payment Methods, and Shipping Methods |
442
-
509
+ | Version | Changes |
510
+ | ------- | ----------------------------------------------------------------------------------------------------------------------------|
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 |
443
516
 
444
517
 
445
518