n8n-nodes-commercetools 0.1.9 → 0.1.11
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.
- package/README.md +62 -8
- package/dist/credentials/CommerceToolsOAuth2Api.credentials.js +27 -0
- package/dist/credentials/CommerceToolsOAuth2Api.credentials.js.map +1 -1
- package/dist/nodes/Commercetools/Commercetools.node.js.map +1 -1
- package/dist/nodes/Commercetools/CommercetoolsTrigger.node.d.ts +19 -0
- package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js +73 -0
- package/dist/nodes/Commercetools/CommercetoolsTrigger.node.js.map +1 -0
- package/dist/nodes/Commercetools/CommercetoolsTrigger.node.json +21 -0
- package/dist/nodes/Commercetools/descriptions/Commercetools.description.js +68 -4993
- package/dist/nodes/Commercetools/descriptions/Commercetools.description.js.map +1 -1
- package/dist/nodes/Commercetools/descriptions/customer.description.d.ts +3 -0
- package/dist/nodes/Commercetools/descriptions/customer.description.js +1621 -0
- package/dist/nodes/Commercetools/descriptions/customer.description.js.map +1 -0
- package/dist/nodes/Commercetools/properties/category.properties.d.ts +4 -0
- package/dist/nodes/Commercetools/properties/category.properties.js +477 -0
- package/dist/nodes/Commercetools/properties/category.properties.js.map +1 -0
- package/dist/nodes/Commercetools/properties/product.properties.d.ts +5 -0
- package/dist/nodes/Commercetools/properties/product.properties.js +2873 -0
- package/dist/nodes/Commercetools/properties/product.properties.js.map +1 -0
- package/dist/nodes/Commercetools/properties/subscription.properties.d.ts +2 -0
- package/dist/nodes/Commercetools/properties/subscription.properties.js +29 -0
- package/dist/nodes/Commercetools/properties/subscription.properties.js.map +1 -0
- package/dist/nodes/Commercetools/utils/awsInfra.utils.d.ts +21 -0
- package/dist/nodes/Commercetools/utils/awsInfra.utils.js +467 -0
- package/dist/nodes/Commercetools/utils/awsInfra.utils.js.map +1 -0
- package/dist/nodes/Commercetools/utils/subscription.utils.d.ts +12 -0
- package/dist/nodes/Commercetools/utils/subscription.utils.js +79 -0
- package/dist/nodes/Commercetools/utils/subscription.utils.js.map +1 -0
- package/dist/nodes/Commercetools/utils/webhookMethods.utils.d.ts +8 -0
- package/dist/nodes/Commercetools/utils/webhookMethods.utils.js +217 -0
- package/dist/nodes/Commercetools/utils/webhookMethods.utils.js.map +1 -0
- package/dist/package.json +13 -5
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +61 -53
package/README.md
CHANGED
|
@@ -3,7 +3,16 @@
|
|
|
3
3
|
|
|
4
4
|
# n8n-nodes-commercetools
|
|
5
5
|
|
|
6
|
-
This repository provides a custom [n8n](https://n8n.io) node for integrating with [Commercetools](https://commercetools.com). It includes all required credentials, node definitions,
|
|
6
|
+
This repository provides a custom [n8n](https://n8n.io) node for integrating with [Commercetools](https://commercetools.com). It includes all required credentials, node definitions, utilities to interact with the Commercetools API, and **AWS SQS integration with Lambda processing**.
|
|
7
|
+
|
|
8
|
+
## Features
|
|
9
|
+
|
|
10
|
+
- **Complete Commercetools Integration**: Full support for products, categories, and customers
|
|
11
|
+
- **Webhook Product Trigger**: Native trigger for product events; send directly to n8n webhooks or route through AWS SQS/Lambda using the provided automation scripts
|
|
12
|
+
- **AWS SQS + Lambda**: Scalable, reliable event processing with AWS infrastructure (CloudFormation + helper scripts included)
|
|
13
|
+
- **Event Types**: Product Created, Published, and Deleted events
|
|
14
|
+
- **Monitoring**: CloudWatch alarms and logging for production use
|
|
15
|
+
- **Multi-Environment**: Support for dev, staging, and production deployments
|
|
7
16
|
|
|
8
17
|
|
|
9
18
|
## Quick Start
|
|
@@ -17,6 +26,51 @@ npm run dev
|
|
|
17
26
|
|
|
18
27
|
This will start n8n with the Commercetools node loaded and hot reload enabled.
|
|
19
28
|
|
|
29
|
+
## Webhook Trigger
|
|
30
|
+
|
|
31
|
+
Use the Commercetools Trigger node to receive events directly in n8n.
|
|
32
|
+
|
|
33
|
+
1. Add the **Commercetools Trigger** node and choose **Webhook** as the destination (use the SQS steps below if you prefer queue delivery).
|
|
34
|
+
2. Activate your workflow to generate the webhook URL and set the `WEBHOOK_URL` environment variable in your CommerceTools subscription or Lambda deployment so events post to this URL. The URL typically looks like `https://<n8n-host>/webhook/<path>/commercetools-product-events`.
|
|
35
|
+
3. In CommerceTools, create or update a subscription pointing to that webhook URL and enable the product event types you need (Created, Published, Deleted). If you deploy via Lambda + SQS, ensure the Lambda forwards the payloads to `WEBHOOK_URL` using the provided AWS infrastructure utilities.
|
|
36
|
+
|
|
37
|
+
## AWS SQS + Lambda Integration
|
|
38
|
+
|
|
39
|
+
For production-grade event processing, this node supports AWS SQS queues with Lambda function processing:
|
|
40
|
+
|
|
41
|
+
### Quick Deploy
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
# Deploy AWS infrastructure
|
|
45
|
+
cd aws
|
|
46
|
+
./deploy.sh deploy
|
|
47
|
+
|
|
48
|
+
# Get configuration values
|
|
49
|
+
./deploy.sh outputs
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### Configure SQS in n8n
|
|
53
|
+
|
|
54
|
+
1. Add CommerceTools Trigger node to your workflow
|
|
55
|
+
2. Select **"Amazon SQS"** as destination type
|
|
56
|
+
3. Configure with deployment outputs:
|
|
57
|
+
- **AWS Region**: Your deployment region
|
|
58
|
+
- **SQS Queue URL**: From deployment outputs
|
|
59
|
+
- **AWS Access Key ID** and **Secret**: Your AWS credentials
|
|
60
|
+
- **Lambda Function Name**: `commercetools-integration-dev-product-processor`
|
|
61
|
+
- **CTP Project Key**: `n8n-ct-integration`
|
|
62
|
+
- **Product Events**: Select `Product Published`
|
|
63
|
+
|
|
64
|
+
### Benefits of SQS Integration
|
|
65
|
+
|
|
66
|
+
- **Reliability**: Messages are persisted and retried automatically
|
|
67
|
+
- **Scalability**: Lambda scales automatically based on queue depth
|
|
68
|
+
- **Monitoring**: CloudWatch alarms for errors and failed messages
|
|
69
|
+
- **Dead Letter Queue**: Failed messages are preserved for investigation
|
|
70
|
+
- **Cost-Effective**: Pay only for what you use
|
|
71
|
+
|
|
72
|
+
See [aws/README.md](aws/README.md) for detailed configuration and customization options. Additional AWS resources: [AWS_AUTOMATION_PLAN.md](AWS_AUTOMATION_PLAN.md), [AWS_ATTRIBUTE_REFERENCE.md](AWS_ATTRIBUTE_REFERENCE.md), and [AUTOMATIC_SETUP.md](AUTOMATIC_SETUP.md).
|
|
73
|
+
|
|
20
74
|
|
|
21
75
|
|
|
22
76
|
|
|
@@ -505,6 +559,9 @@ To use the Commercetools node for both product and category operations, you must
|
|
|
505
559
|
- **Project Key**
|
|
506
560
|
- **Region**
|
|
507
561
|
- **Scopes**
|
|
562
|
+
- **AWS Client ID**
|
|
563
|
+
- **AWS Client Secret**
|
|
564
|
+
- The AWS fields map to your access key pair and are required for webhook/SQS delivery paths.
|
|
508
565
|
- Save the credentials.
|
|
509
566
|
|
|
510
567
|
3. **Use credentials in your workflow:**
|
|
@@ -673,13 +730,10 @@ All notable changes to this project will be documented in the `CHANGELOG.md` fil
|
|
|
673
730
|
|
|
674
731
|
|
|
675
732
|
### [Unreleased]
|
|
676
|
-
- Added
|
|
677
|
-
-
|
|
678
|
-
-
|
|
679
|
-
-
|
|
680
|
-
- Documentation improvements and structure updates
|
|
681
|
-
- Added detailed usage examples and troubleshooting section
|
|
682
|
-
- Enhanced configuration options and parameter documentation
|
|
733
|
+
- Added Commercetools webhook-based product trigger plus AWS automation/test guides
|
|
734
|
+
- Added AWS credential fields (client ID/secret) and environment-driven webhook URL support for trigger delivery
|
|
735
|
+
- Documented AWS deployment automation and attribute references for the CloudFormation scripts
|
|
736
|
+
- Refactored Commercetools product, category, and customer property definitions for easier maintenance
|
|
683
737
|
|
|
684
738
|
### v1.0.0
|
|
685
739
|
- Initial release of the Commercetools node for n8n
|
|
@@ -39,6 +39,33 @@ class CommerceToolsOAuth2Api {
|
|
|
39
39
|
default: 'australia-southeast1.gcp',
|
|
40
40
|
description: 'Region-specific auth host; determines the OAuth token endpoint used for client credentials grants',
|
|
41
41
|
},
|
|
42
|
+
{
|
|
43
|
+
displayName: 'AWS Client Access Key',
|
|
44
|
+
name: 'awsAccessKeyId',
|
|
45
|
+
type: 'string',
|
|
46
|
+
default: '',
|
|
47
|
+
placeholder: 'your-aws-client-id',
|
|
48
|
+
description: 'AWS Client ID for authentication',
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
displayName: 'AWS Client Secret',
|
|
52
|
+
name: 'awsSecretAccessKey',
|
|
53
|
+
type: 'string',
|
|
54
|
+
typeOptions: {
|
|
55
|
+
password: true,
|
|
56
|
+
},
|
|
57
|
+
default: '',
|
|
58
|
+
placeholder: 'your-aws-client-secret',
|
|
59
|
+
description: 'AWS Client Secret for authentication',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
displayName: 'AWS Region',
|
|
63
|
+
name: 'awsRegion',
|
|
64
|
+
type: 'string',
|
|
65
|
+
default: 'us-east-1',
|
|
66
|
+
placeholder: 'us-east-1',
|
|
67
|
+
description: 'AWS Region for authentication',
|
|
68
|
+
},
|
|
42
69
|
{
|
|
43
70
|
displayName: 'Grant Type',
|
|
44
71
|
name: 'grantType',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"CommerceToolsOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/CommerceToolsOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,sBAAsB;IAAnC;QACC,SAAI,GAAG,wBAAwB,CAAC;QAEhC,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBAAW,GAAG,0BAA0B,CAAC;QAEzC,SAAI,GAAS,iCAAiC,CAAC;QAE/C,qBAAgB,GAAG,kDAAkD,CAAC;QAEtE,eAAU,GAAsB;YAC/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,oCAAoC;gBACjD,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,mGAAmG;aACpG;YACD;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;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,qEAAqE;gBAC9E,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;
|
|
1
|
+
{"version":3,"file":"CommerceToolsOAuth2Api.credentials.js","sourceRoot":"","sources":["../../credentials/CommerceToolsOAuth2Api.credentials.ts"],"names":[],"mappings":";;;AAEA,MAAa,sBAAsB;IAAnC;QACC,SAAI,GAAG,wBAAwB,CAAC;QAEhC,YAAO,GAAG,CAAC,WAAW,CAAC,CAAC;QAExB,gBA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ACD;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;gBACd,OAAO,EAAE,EAAE;aACX;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,qEAAqE;gBAC9E,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;AAtGD,wDAsGC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Commercetools.node.js","sourceRoot":"","sources":["../../../nodes/Commercetools/Commercetools.node.ts"],"names":[],"mappings":";;;AAOA,+CAAkD;AAElD,wFAAoF;AACpF,0EAA4E;AAC5E,0EAA4E;AAC5E,wEAA0E;AAE1E,MAAa,aAAa;IAA1B;QACC,gBAAW,GAAyB;YACnC,GAAG,oDAAwB;YAC3B,IAAI,EAAE,wBAAwB;YAC9B,YAAY,EAAE,IAAI;SAClB,CAAC;
|
|
1
|
+
{"version":3,"file":"Commercetools.node.js","sourceRoot":"","sources":["../../../nodes/Commercetools/Commercetools.node.ts"],"names":[],"mappings":";;;AAOA,+CAAkD;AAElD,wFAAoF;AACpF,0EAA4E;AAC5E,0EAA4E;AAC5E,wEAA0E;AAE1E,MAAa,aAAa;IAA1B;QACC,gBAAW,GAAyB;YACnC,GAAG,oDAAwB;YAC3B,IAAI,EA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E;wBACnD,SAAS;wBACT,SAAS;wBACT,OAAO;qBACP,CAAC,CAAC;gBACJ,CAAC;qBAAM,IAAI,QAAQ,KAAK,UAAU,EAAE,CAAC;oBACpC,OAAO,GAAG,MAAM,8CAAwB,CAAC,IAAI,CAAC,IAAI,EAAE;wBACnD,SAAS;wBACT,SAAS;wBACT,OAAO;wBACP,KAAK;qBACL,CAAC,CAAC;gBACJ,CAAC;qBAAM,CAAC;oBACP,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,yBAAyB,QAAQ,EAAE,EAAE;wBACjF,SAAS;qBACT,CAAC,CAAC;gBACJ,CAAC;gBAED,UAAU,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC;YAC7B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;oBAC3B,UAAU,CAAC,IAAI,CAAC;wBACf,IAAI,EAAE;4BACL,KAAK,EAAG,KAAe,CAAC,OAAO;4BAC/B,SAAS;yBACT;qBACD,CAAC,CAAC;oBACH,SAAS;gBACV,CAAC;gBAED,IAAI,KAAK,YAAY,iCAAkB,EAAE,CAAC;oBACzC,MAAM,KAAK,CAAC;gBACb,CAAC;gBAED,MAAM,IAAI,iCAAkB,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAc,EAAE,EAAE,SAAS,EAAE,CAAC,CAAC;YAC7E,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AAnFD,sCAmFC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { IDataObject, INodeType, INodeTypeDescription, IWebhookFunctions, IWebhookResponseData } from 'n8n-workflow';
|
|
2
|
+
import { AWSResponse } from './utils/awsInfra.utils';
|
|
3
|
+
export type StaticSubscriptionData = IDataObject & {
|
|
4
|
+
subscriptionId?: string;
|
|
5
|
+
awsInfrastructure?: AWSResponse;
|
|
6
|
+
configHash?: string;
|
|
7
|
+
events?: string[];
|
|
8
|
+
};
|
|
9
|
+
export declare class CommercetoolsTrigger implements INodeType {
|
|
10
|
+
description: INodeTypeDescription;
|
|
11
|
+
webhookMethods: {
|
|
12
|
+
default: {
|
|
13
|
+
checkExists: (this: import("n8n-workflow").IHookFunctions) => Promise<boolean>;
|
|
14
|
+
create: (this: import("n8n-workflow").IHookFunctions) => Promise<boolean>;
|
|
15
|
+
delete: (this: import("n8n-workflow").IHookFunctions) => Promise<boolean>;
|
|
16
|
+
};
|
|
17
|
+
};
|
|
18
|
+
webhook(this: IWebhookFunctions): Promise<IWebhookResponseData>;
|
|
19
|
+
}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CommercetoolsTrigger = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const subscription_properties_1 = require("./properties/subscription.properties");
|
|
6
|
+
const webhookMethods_utils_1 = require("./utils/webhookMethods.utils");
|
|
7
|
+
class CommercetoolsTrigger {
|
|
8
|
+
constructor() {
|
|
9
|
+
this.description = {
|
|
10
|
+
displayName: 'Commercetools Trigger',
|
|
11
|
+
name: 'commercetoolsTrigger',
|
|
12
|
+
icon: 'file:Commercetools.svg',
|
|
13
|
+
group: ['trigger'],
|
|
14
|
+
version: 1,
|
|
15
|
+
description: 'Subscribe to Commercetools product events. Automatically creates AWS SQS + Lambda when AWS credentials are provided.',
|
|
16
|
+
defaults: {
|
|
17
|
+
name: 'Commercetools Trigger',
|
|
18
|
+
},
|
|
19
|
+
codex: {
|
|
20
|
+
categories: ['Commercetools', 'Integration', 'Product'],
|
|
21
|
+
subcategories: {
|
|
22
|
+
Commercetools: ['Product'],
|
|
23
|
+
},
|
|
24
|
+
alias: ['commercetools', 'Commercetools'],
|
|
25
|
+
},
|
|
26
|
+
inputs: [],
|
|
27
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
28
|
+
credentials: [
|
|
29
|
+
{
|
|
30
|
+
name: 'commerceToolsOAuth2Api',
|
|
31
|
+
required: true,
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
webhooks: [
|
|
35
|
+
{
|
|
36
|
+
name: 'default',
|
|
37
|
+
httpMethod: 'POST',
|
|
38
|
+
responseMode: 'onReceived',
|
|
39
|
+
path: 'commercetools-product-events',
|
|
40
|
+
ndvHideUrl: false,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
usableAsTool: true,
|
|
44
|
+
properties: subscription_properties_1.triggerProperties,
|
|
45
|
+
};
|
|
46
|
+
this.webhookMethods = webhookMethods_utils_1.triggerMethods;
|
|
47
|
+
}
|
|
48
|
+
async webhook() {
|
|
49
|
+
const req = this.getRequestObject();
|
|
50
|
+
let processedBody;
|
|
51
|
+
try {
|
|
52
|
+
if (typeof req.body === 'string') {
|
|
53
|
+
processedBody = JSON.parse(req.body);
|
|
54
|
+
}
|
|
55
|
+
else if (typeof req.body === 'object' && req.body !== null) {
|
|
56
|
+
processedBody = req.body;
|
|
57
|
+
}
|
|
58
|
+
else {
|
|
59
|
+
processedBody = req.body;
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
workflowData: [this.helpers.returnJsonArray(processedBody)],
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return {
|
|
67
|
+
workflowData: [this.helpers.returnJsonArray(req.body)],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
exports.CommercetoolsTrigger = CommercetoolsTrigger;
|
|
73
|
+
//# sourceMappingURL=CommercetoolsTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CommercetoolsTrigger.node.js","sourceRoot":"","sources":["../../../nodes/Commercetools/CommercetoolsTrigger.node.ts"],"names":[],"mappings":";;;AAOA,+CAAmD;AACnD,k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,KAAK,QAAQ,IAAI,GAAG,CAAC,IAAI,KAAK,IAAI,EAAE,CAAC;gBAC9D,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC;YAC1B,CAAC;iBAAM,CAAC;gBACP,aAAa,GAAG,GAAG,CAAC,IAAI,CAAC;YAC1B,CAAC;YAGD,OAAO;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,aAAa,CAAC,CAAC;aAC3D,CAAC;QAEH,CAAC;QAAC,MAAM,CAAC;YAER,OAAO;gBACN,YAAY,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,eAAe,CAAC,GAAG,CAAC,IAAmB,CAAC,CAAC;aACrE,CAAC;QACH,CAAC;IACF,CAAC;CACD;AAnED,oDAmEC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-commercetools",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Commercetools", "Integration", "Product"],
|
|
6
|
+
"subcategories": {
|
|
7
|
+
"Commercetools": ["Product"]
|
|
8
|
+
},
|
|
9
|
+
"resources": {
|
|
10
|
+
"primaryDocumentation": [
|
|
11
|
+
{
|
|
12
|
+
"url": "https://docs.commercetools.com/api"
|
|
13
|
+
}
|
|
14
|
+
],
|
|
15
|
+
"credentialDocumentation": [
|
|
16
|
+
{
|
|
17
|
+
"url": ""
|
|
18
|
+
}
|
|
19
|
+
]
|
|
20
|
+
}
|
|
21
|
+
}
|