n8n-nodes-commercetools 0.1.5 → 0.1.7

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/LICENSE.md CHANGED
@@ -1,4 +1,4 @@
1
- Copyright 2022 n8n
1
+ Copyright 2025 jjtech-digital
2
2
 
3
3
  Permission is hereby granted, free of charge, to any person obtaining a copy of
4
4
  this software and associated documentation files (the "Software"), to deal in
package/README.md CHANGED
@@ -1,247 +1,397 @@
1
1
  ![Banner image](https://user-images.githubusercontent.com/10284570/173569848-c624317f-42b1-45a6-ab09-f0ea3c247648.png)
2
2
 
3
- # n8n-nodes-starter
4
3
 
5
- This starter repository helps you build custom integrations for [n8n](https://n8n.io). It includes example nodes, credentials, the node linter, and all the tooling you need to get started.
4
+ # n8n-nodes-commercetools
6
5
 
7
- ## Quick Start
8
-
9
- > [!TIP]
10
- > **New to building n8n nodes?** The fastest way to get started is with `npm create @n8n/node`. This command scaffolds a complete node package for you using the [@n8n/node-cli](https://www.npmjs.com/package/@n8n/node-cli).
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, and utilities to interact with the Commercetools API.
11
7
 
12
- **To create a new node package from scratch:**
13
8
 
14
- ```bash
15
- npm create @n8n/node
16
- ```
9
+ ## Quick Start
17
10
 
18
- **Already using this starter? Start developing with:**
11
+ **To start developing and testing the Commercetools node:**
19
12
 
20
13
  ```bash
14
+ npm install
21
15
  npm run dev
22
16
  ```
23
17
 
24
- This starts n8n with your nodes loaded and hot reload enabled.
18
+ This will start n8n with the Commercetools node loaded and hot reload enabled.
25
19
 
26
- ## What's Included
27
20
 
28
- This starter repository includes two example nodes to learn from:
29
21
 
30
- - **[Example Node](nodes/Example/)** - A simple starter node that shows the basic structure with a custom `execute` method
31
- - **[GitHub Issues Node](nodes/GithubIssues/)** - A complete, production-ready example built using the **declarative style**:
32
- - **Low-code approach** - Define operations declaratively without writing request logic
33
- - Multiple resources (Issues, Comments)
34
- - Multiple operations (Get, Get All, Create)
35
- - Two authentication methods (OAuth2 and Personal Access Token)
36
- - List search functionality for dynamic dropdowns
37
- - Proper error handling and typing
38
- - Ideal for HTTP API-based integrations
39
22
 
40
- > [!TIP]
41
- > The declarative/low-code style (used in GitHub Issues) is the recommended approach for building nodes that interact with HTTP APIs. It significantly reduces boilerplate code and handles requests automatically.
42
23
 
43
- Browse these examples to understand both approaches, then modify them or create your own.
44
24
 
45
- ## Finding Inspiration
46
25
 
47
- Looking for more examples? Check out these resources:
26
+ ## Configuration Options
48
27
 
49
- - **[npm Community Nodes](https://www.npmjs.com/search?q=keywords:n8n-community-node-package)** - Browse thousands of community-built nodes on npm using the `n8n-community-node-package` tag
50
- - **[n8n Built-in Nodes](https://github.com/n8n-io/n8n/tree/master/packages/nodes-base/nodes)** - Study the source code of n8n's official nodes for production-ready patterns and best practices
51
- - **[n8n Credentials](https://github.com/n8n-io/n8n/tree/master/packages/nodes-base/credentials)** - See how authentication is implemented for various services
28
+ Below are the main configuration options and parameters available for the Commercetools node (resource: product or category):
52
29
 
53
- These are excellent resources to understand how to structure your nodes, handle different API patterns, and implement advanced features.
30
+ ### Common Parameters
31
+ - **resource**: Select 'product' or 'category' to access respective operations.
32
+ - **operation**: Choose the desired operation (e.g., create, query, get, update, delete, etc.).
33
+ - **Credentials**: Select your configured Commercetools OAuth2 credentials.
54
34
 
55
- ## Prerequisites
35
+ ### Product Operation-Specific Parameters
56
36
 
57
- Before you begin, install the following on your development machine:
37
+ #### Create Product
38
+ - **productDraft**: JSON object with product details (name, slug, productType, masterVariant, etc.).
39
+ - **additionalFieldsCreate**: Optional fields for additional product properties.
58
40
 
59
- ### Required
41
+ #### Query Products
42
+ - **returnAll**: Boolean to return all products (up to 500 per request).
43
+ - **limit**: Number of products to return per request.
44
+ - **offset**: Pagination offset.
45
+ - **additionalFields**: Optional filters, sorting, and predicate variables.
60
46
 
61
- - **[Node.js](https://nodejs.org/)** (v22 or higher) and npm
62
- - Linux/Mac/WSL: Install via [nvm](https://github.com/nvm-sh/nvm)
63
- - Windows: Follow [Microsoft's NodeJS guide](https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-windows)
64
- - **[git](https://git-scm.com/downloads)**
47
+ #### Search Products
48
+ - **searchRequest**: JSON object for advanced search queries.
49
+ - **additionalFieldsSearch**: Optional search parameters (limit, offset, staged, etc.).
65
50
 
66
- ### Recommended
51
+ #### Get Product / Get By Key
52
+ - **productId** or **productKey**: ID or key of the product to retrieve.
53
+ - **additionalFieldsGet**: Optional fields for expanded data.
67
54
 
68
- - Follow n8n's [development environment setup guide](https://docs.n8n.io/integrations/creating-nodes/build/node-development-environment/)
55
+ #### Update Product / Update By Key
56
+ - **productId** or **productKey**: ID or key of the product to update.
57
+ - **version**: Product version (required for updates).
58
+ - **actions**: Array of update actions (JSON).
59
+ - **actionsUi**: UI-based update actions.
60
+ - **additionalFieldsUpdate**: Optional fields (dataErasure, dryRun, etc.).
69
61
 
70
- > [!NOTE]
71
- > The `@n8n/node-cli` is included as a dev dependency and will be installed automatically when you run `npm install`. The CLI includes n8n for local development, so you don't need to install n8n globally.
62
+ #### Delete Product / Delete By Key
63
+ - **productId** or **productKey**: ID or key of the product to delete.
64
+ - **version**: Product version (required for deletion).
65
+ - **additionalFieldsDelete**: Optional fields (dataErasure, etc.).
72
66
 
73
- ## Getting Started with this Starter
67
+ #### Query Product Selections
68
+ - **productId** or **productKey**: ID or key of the product.
69
+ - **additionalFieldsSelections**: Optional fields (expand, limit, offset, withTotal, customParameters).
74
70
 
75
- Follow these steps to create your own n8n community node package:
71
+ #### Upload Product Image
72
+ - **productId**: ID of the product to upload the image to.
73
+ - **binaryPropertyName**: Name of the binary property containing the image.
74
+ - **additionalFieldsUpload**: Optional fields (variantId, sku, staged, filename, externalUrl, label, customParameters).
76
75
 
77
- ### 1. Create Your Repository
76
+ ### Category Operation-Specific Parameters
78
77
 
79
- [Generate a new repository](https://github.com/n8n-io/n8n-nodes-starter/generate) from this template, then clone it:
78
+ #### Create Category
79
+ - **categoryDraft**: JSON object with category details (name, slug, parent, orderHint, etc.).
80
+ - **additionalFieldsCreate**: Optional fields for additional category properties.
80
81
 
81
- ```bash
82
- git clone https://github.com/<your-organization>/<your-repo-name>.git
83
- cd <your-repo-name>
84
- ```
82
+ #### Query Categories
83
+ - **returnAll**: Boolean to return all categories (up to 500 per request).
84
+ - **limit**: Number of categories to return per request.
85
+ - **offset**: Pagination offset.
86
+ - **additionalFields**: Optional filters, sorting, and predicate variables.
85
87
 
86
- ### 2. Install Dependencies
88
+ #### Get Category / Get By Key
89
+ - **categoryId** or **categoryKey**: ID or key of the category to retrieve.
90
+ - **additionalFieldsGet**: Optional fields for expanded data.
87
91
 
88
- ```bash
89
- npm install
90
- ```
92
+ #### Update Category / Update By Key
93
+ - **categoryId** or **categoryKey**: ID or key of the category to update.
94
+ - **version**: Category version (required for updates).
95
+ - **actions**: Array of update actions (JSON).
96
+ - **actionsUi**: UI-based update actions.
97
+ - **additionalFieldsUpdate**: Optional fields (dataErasure, dryRun, etc.).
91
98
 
92
- This installs all required dependencies including the `@n8n/node-cli`.
99
+ #### Delete Category / Delete By Key
100
+ - **categoryId** or **categoryKey**: ID or key of the category to delete.
101
+ - **version**: Category version (required for deletion).
102
+ - **additionalFieldsDelete**: Optional fields (dataErasure, etc.).
93
103
 
94
- ### 3. Explore the Examples
104
+ Refer to the node UI in n8n for detailed descriptions and validation for each parameter.
95
105
 
96
- Browse the example nodes in [nodes/](nodes/) and [credentials/](credentials/) to understand the structure:
106
+ Below is a sample workflow using the Commercetools node in n8n to create and query a product.
97
107
 
98
- - Start with [nodes/Example/](nodes/Example/) for a basic node
99
- - Study [nodes/GithubIssues/](nodes/GithubIssues/) for a real-world implementation
108
+ ### Example: Create a Product
100
109
 
101
- ### 4. Build Your Node
110
+ 1. Add the **Commercetools** node to your workflow.
111
+ 2. Select the **Create Product** operation.
112
+ 3. Fill in the required product draft fields (e.g., name, slug, product type, etc.).
113
+ 4. Select your configured Commercetools credentials.
114
+ 5. Run the workflow to create a new product in your Commercetools project.
102
115
 
103
- Edit the example nodes to fit your use case, or create new node files by copying the structure from [nodes/Example/](nodes/Example/).
116
+ **Sample Input (Product Draft):**
117
+ ```json
118
+ {
119
+ "name": { "en": "Sample Product" },
120
+ "slug": { "en": "sample-product" },
121
+ "productType": { "id": "your-product-type-id" },
122
+ "masterVariant": {
123
+ "sku": "SKU123",
124
+ "prices": [ { "value": { "currencyCode": "USD", "centAmount": 1000 } } ]
125
+ }
126
+ }
127
+ ```
104
128
 
105
- > [!TIP]
106
- > If you want to scaffold a completely new node package, use `npm create @n8n/node` to start fresh with the CLI's interactive generator.
107
129
 
108
- ### 5. Configure Your Package
130
+ ### Example: Query Products
131
+
132
+ 1. Add the **Commercetools** node to your workflow.
133
+ 2. Select the **Query Products** operation.
134
+ 3. Optionally set filters, sorting, and pagination parameters.
135
+ 4. Select your configured Commercetools credentials.
136
+ 5. Run the workflow to retrieve products from your Commercetools project.
137
+
138
+ **Sample Output:**
139
+ ```json
140
+ [
141
+ {
142
+ "id": "product-id-1",
143
+ "name": { "en": "Sample Product" },
144
+ "slug": { "en": "sample-product" }
145
+ // ...other product fields
146
+ }
147
+ // ...more products
148
+ ]
149
+ ```
109
150
 
110
- Update `package.json` with your details:
151
+ ### Example: Create a Category
152
+
153
+ 1. Add the **Commercetools** node to your workflow.
154
+ 2. Select the **Create Category** operation.
155
+ 3. Fill in the required category draft fields (e.g., name, slug, parent, orderHint, etc.).
156
+ 4. Select your configured Commercetools credentials.
157
+ 5. Run the workflow to create a new category in your Commercetools project.
158
+
159
+ **Sample Input (Category Draft):**
160
+ ```json
161
+ {
162
+ "name": { "en": "Sample Category" },
163
+ "slug": { "en": "sample-category" },
164
+ "orderHint": "0.1"
165
+ }
166
+ ```
111
167
 
112
- - `name` - Your package name (must start with `n8n-nodes-`)
113
- - `author` - Your name and email
114
- - `repository` - Your repository URL
115
- - `description` - What your node does
168
+ ### Example: Query Categories
169
+
170
+ 1. Add the **Commercetools** node to your workflow.
171
+ 2. Select the **Query Categories** operation.
172
+ 3. Optionally set filters, sorting, and pagination parameters.
173
+ 4. Select your configured Commercetools credentials.
174
+ 5. Run the workflow to retrieve categories from your Commercetools project.
175
+
176
+ **Sample Output:**
177
+ ```json
178
+ [
179
+ {
180
+ "id": "category-id-1",
181
+ "name": { "en": "Sample Category" },
182
+ "slug": { "en": "sample-category" }
183
+ // ...other category fields
184
+ }
185
+ // ...more categories
186
+ ]
187
+ ```
116
188
 
117
- Make sure your node is registered in the `n8n.nodes` array.
189
+ You can chain Commercetools node operations with other n8n nodes to build advanced workflows for product and category management, automation, and integration.
118
190
 
119
- ### 6. Develop and Test Locally
120
191
 
121
- Start n8n with your node loaded:
192
+ ## Credential Setup
122
193
 
123
- ```bash
124
- npm run dev
125
- ```
194
+ To use the Commercetools node for both product and category operations, you must configure OAuth2 credentials for your Commercetools project in n8n. Follow these steps:
126
195
 
127
- This command runs `n8n-node dev` which:
196
+ 1. **Obtain Commercetools API credentials:**
197
+ - Log in to your Commercetools Merchant Center.
198
+ - Go to the API Clients section and create a new API client.
199
+ - Note the following values:
200
+ - `Client ID`
201
+ - `Client Secret`
202
+ - `Project Key`
203
+ - `Scopes` (ensure you have the required scopes for product and category operations)
204
+ - `Region` (e.g., `australia-southeast1.gcp`)
128
205
 
129
- - Builds your node with watch mode
130
- - Starts n8n with your node available
131
- - Automatically rebuilds when you make changes
132
- - Opens n8n in your browser (usually http://localhost:5678)
206
+ 2. **Add credentials in n8n:**
207
+ - In n8n, go to **Credentials** > **Create New**.
208
+ - Search for and select **Commercetools OAuth2 API**.
209
+ - Fill in the required fields:
210
+ - **Client ID**
211
+ - **Client Secret**
212
+ - **Project Key**
213
+ - **Region**
214
+ - **Scopes**
215
+ - Save the credentials.
133
216
 
134
- You can now test your node in n8n workflows!
217
+ 3. **Use credentials in your workflow:**
218
+ - When adding the Commercetools node to your workflow, select the credentials you just created from the credentials dropdown.
135
219
 
136
- > [!NOTE]
137
- > Learn more about CLI commands in the [@n8n/node-cli documentation](https://www.npmjs.com/package/@n8n/node-cli).
220
+ Your Commercetools node is now authenticated and ready to use for both product and category operations in n8n workflows.
138
221
 
139
- ### 7. Lint Your Code
140
222
 
141
- Check for errors:
223
+ ## Features & Supported Operations
142
224
 
143
- ```bash
144
- npm run lint
145
- ```
225
+ The Commercetools node for n8n enables you to interact with the Commercetools API for product and category management. The following operations are supported:
146
226
 
147
- Auto-fix issues when possible:
227
+ ### Product Operations
228
+ - **Create Product**
229
+ Create a new product in your Commercetools project.
148
230
 
149
- ```bash
150
- npm run lint:fix
151
- ```
231
+ - **Query Products**
232
+ Retrieve a list of products with support for pagination, sorting, filtering, and predicate variables.
152
233
 
153
- ### 8. Build for Production
234
+ - **Search Products**
235
+ Perform advanced product searches using the Commercetools search endpoint.
154
236
 
155
- When ready to publish:
237
+ - **Get Product (by ID or Key)**
238
+ Retrieve detailed information for a specific product by its ID or key.
156
239
 
157
- ```bash
158
- npm run build
159
- ```
240
+ - **Update Product (by ID or Key)**
241
+ Update an existing product using one or more update actions.
160
242
 
161
- This compiles your TypeScript code to the `dist/` folder.
243
+ - **Delete Product (by ID or Key)**
244
+ Delete a product from your project.
162
245
 
163
- ### 9. Prepare for Publishing
246
+ - **Query Product Selections (by ID or Key)**
247
+ Retrieve product selection assignments for a product.
164
248
 
165
- Before publishing:
249
+ - **Upload Product Image**
250
+ Upload an image to a product, either from binary data or an external URL.
166
251
 
167
- 1. **Update documentation**: Replace this README with your node's documentation. Use [README_TEMPLATE.md](README_TEMPLATE.md) as a starting point.
168
- 2. **Update the LICENSE**: Add your details to the [LICENSE](LICENSE.md) file.
169
- 3. **Test thoroughly**: Ensure your node works in different scenarios.
252
+ ### Category Operations
253
+ - **Create Category**
254
+ Create a new category in your Commercetools project.
170
255
 
171
- ### 10. Publish to npm
256
+ - **Query Categories**
257
+ Retrieve a list of categories with support for pagination, sorting, and filtering.
172
258
 
173
- Publish your package to make it available to the n8n community:
259
+ - **Get Category (by ID or Key)**
260
+ Retrieve detailed information for a specific category by its ID or key.
174
261
 
175
- ```bash
176
- npm publish
177
- ```
262
+ - **Update Category (by ID or Key)**
263
+ Update an existing category using one or more update actions.
178
264
 
179
- Learn more about [publishing to npm](https://docs.npmjs.com/packages-and-modules/contributing-packages-to-the-registry).
265
+ - **Delete Category (by ID or Key)**
266
+ Delete a category from your project.
180
267
 
181
- ### 11. Submit for Verification (Optional)
268
+ ### Check Product & Category Existence
269
+ - **By ID:** Use the "HEAD" operation with a product or category ID to check if it exists.
270
+ - **By Key:** Use the "HEAD by Key" operation with a product or category key.
271
+ - **By Query:** Use the "HEAD by Query" operation to check if any product or category matches a specific query.
182
272
 
183
- Get your node verified for n8n Cloud:
273
+ Each operation supports additional parameters for fine-tuned control, such as staged changes, data erasure, dry run, and more.
184
274
 
185
- 1. Ensure your node meets the [requirements](https://docs.n8n.io/integrations/creating-nodes/deploy/submit-community-nodes/):
186
- - Uses MIT license ✅ (included in this starter)
187
- - No external package dependencies
188
- - Follows n8n's design guidelines
189
- - Passes quality and security review
275
+ ## What's Included
190
276
 
191
- 2. Submit through the [n8n Creator Portal](https://creators.n8n.io/nodes)
277
+ - **Commercetools Node**: Located in `nodes/Commercetools/`, this node provides operations for interacting with the Commercetools API, including product management and authentication via OAuth2.
278
+ - **Credentials**: OAuth2 credentials for Commercetools in `credentials/CommerceToolsOAuth2Api.credentials.ts`.
279
+ - **Utilities and Descriptions**: Helper functions and operation definitions for Commercetools API requests.
192
280
 
193
- **Benefits of verification:**
194
281
 
195
- - Available directly in n8n Cloud
196
- - Discoverable in the n8n nodes panel
197
- - Verified badge for quality assurance
198
- - Increased visibility in the n8n community
199
282
 
200
- ## Available Scripts
283
+ ## Prerequisites
284
+
285
+ - **[Node.js](https://nodejs.org/)** (v22 or higher) and npm
286
+ - **[git](https://git-scm.com/downloads)**
287
+
201
288
 
202
- This starter includes several npm scripts to streamline development:
289
+ ## Usage
290
+
291
+ 1. **Install dependencies**
292
+ ```bash
293
+ npm install
294
+ ```
295
+ 2. **Start development server**
296
+ ```bash
297
+ npm run dev
298
+ ```
299
+ This will build the node and launch n8n locally with hot reload enabled. Access n8n at [http://localhost:5678](http://localhost:5678).
300
+ 3. **Configure Commercetools credentials**
301
+ - Go to n8n's credentials section and add your Commercetools OAuth2 credentials.
302
+ 4. **Use the Commercetools node in your workflow**
303
+ - Add the Commercetools node to your workflow and select the desired operation (e.g., product management).
304
+ 5. **Lint and build**
305
+ - Lint: `npm run lint`
306
+ - Auto-fix: `npm run lint:fix`
307
+ - Build: `npm run build`
308
+ 6. **Publish**
309
+ - When ready, publish your package to npm:
310
+ ```bash
311
+ npm publish
312
+ ```
313
+
314
+
315
+ ## Available Scripts
203
316
 
204
317
  | Script | Description |
205
318
  | --------------------- | ---------------------------------------------------------------- |
206
- | `npm run dev` | Start n8n with your node and watch for changes (runs `n8n-node dev`) |
207
- | `npm run build` | Compile TypeScript to JavaScript for production (runs `n8n-node build`) |
319
+ | `npm run dev` | Start n8n with the Commercetools node and watch for changes |
320
+ | `npm run build` | Compile TypeScript to JavaScript for production |
208
321
  | `npm run build:watch` | Build in watch mode (auto-rebuild on changes) |
209
- | `npm run lint` | Check your code for errors and style issues (runs `n8n-node lint`) |
210
- | `npm run lint:fix` | Automatically fix linting issues when possible (runs `n8n-node lint --fix`) |
211
- | `npm run release` | Create a new release (runs `n8n-node release`) |
322
+ | `npm run lint` | Check your code for errors and style issues |
323
+ | `npm run lint:fix` | Automatically fix linting issues when possible |
324
+ | `npm run release` | Create a new release |
325
+
326
+
212
327
 
213
- > [!TIP]
214
- > These scripts use the [@n8n/node-cli](https://www.npmjs.com/package/@n8n/node-cli) under the hood. You can also run CLI commands directly, e.g., `npx n8n-node dev`.
215
328
 
216
- ## Troubleshooting
329
+ ## Error Handling & Troubleshooting
217
330
 
218
- ### My node doesn't appear in n8n
331
+ Here are common errors and troubleshooting tips for the Commercetools node (products and categories):
219
332
 
220
- 1. Make sure you ran `npm install` to install dependencies
221
- 2. Check that your node is listed in `package.json` under `n8n.nodes`
222
- 3. Restart the dev server with `npm run dev`
223
- 4. Check the console for any error messages
333
+ - **Authentication Errors:**
334
+ - Ensure your OAuth2 credentials (Client ID, Client Secret, Project Key, Region, Scopes) are correct and have the required permissions.
335
+ - If you see an authentication error, re-authorize or recreate your credentials in n8n.
224
336
 
225
- ### Linting errors
337
+ - **Missing or Invalid Parameters:**
338
+ - Double-check required fields for each operation:
339
+ - For products: productDraft, productId/productKey, version, etc.
340
+ - For categories: categoryDraft, categoryId/categoryKey, version, etc.
341
+ - The node will display a clear error if a required parameter is missing or invalid.
226
342
 
227
- Run `npm run lint:fix` to automatically fix most common issues. For remaining errors, check the [n8n node development guidelines](https://docs.n8n.io/integrations/creating-nodes/).
343
+ - **API Errors:**
344
+ - Errors from the Commercetools API (e.g., 404 Not Found, 400 Bad Request) will be shown in the node output or n8n error panel.
345
+ - Review the error message for details and check your input data.
228
346
 
229
- ### TypeScript errors
347
+ - **Not Found (Product/Category):**
348
+ - For get, update, delete, or existence checks, ensure the productId/productKey or categoryId/categoryKey is correct and the item exists in your project.
349
+
350
+ - **Version Mismatch:**
351
+ - For update and delete operations, the version must match the current version in Commercetools. Retrieve the latest version before updating or deleting (applies to both products and categories).
352
+
353
+ - **Binary Data Issues (Image Upload):**
354
+ - Ensure the binary property name matches the uploaded file and the file is present in the workflow (product image upload only).
355
+
356
+ - **General Node Issues:**
357
+ - If the node does not appear in n8n, ensure dependencies are installed, the node is registered in `package.json`, and the dev server is running.
358
+ - Check the n8n console and logs for error details.
359
+
360
+ For linting or TypeScript errors, use the provided scripts or consult the [n8n node development guidelines](https://docs.n8n.io/integrations/creating-nodes/).
230
361
 
231
- Make sure you're using Node.js v22 or higher and have run `npm install` to get all type definitions.
232
362
 
233
363
  ## Resources
234
364
 
235
- - **[n8n Node Documentation](https://docs.n8n.io/integrations/creating-nodes/)** - Complete guide to building nodes
236
- - **[n8n Community Forum](https://community.n8n.io/)** - Get help and share your nodes
237
- - **[@n8n/node-cli Documentation](https://www.npmjs.com/package/@n8n/node-cli)** - CLI tool reference
238
- - **[n8n Creator Portal](https://creators.n8n.io/nodes)** - Submit your node for verification
239
- - **[Submit Community Nodes Guide](https://docs.n8n.io/integrations/creating-nodes/deploy/submit-community-nodes/)** - Verification requirements and process
365
+ - **[n8n Node Documentation](https://docs.n8n.io/integrations/creating-nodes/)**
366
+ - **[n8n Community Forum](https://community.n8n.io/)**
367
+ - **[@n8n/node-cli Documentation](https://www.npmjs.com/package/@n8n/node-cli)**
368
+
240
369
 
241
370
  ## Contributing
242
371
 
243
- Have suggestions for improving this starter? [Open an issue](https://github.com/n8n-io/n8n-nodes-starter/issues) or submit a pull request!
372
+ Contributions and suggestions for improving the Commercetools node are welcome. Please open an issue or submit a pull request.
373
+
374
+
375
+
376
+ ## Changelog
377
+
378
+ All notable changes to this project will be documented in the `CHANGELOG.md` file. Below is a summary of recent updates:
379
+
380
+
381
+ ### [Unreleased]
382
+ - Added category-related APIs to Commercetools node (create, query, get, update, delete, existence checks)
383
+ - Updated documentation to include category operations in features, configuration, usage examples, credential setup, and troubleshooting
384
+ - Documentation improvements and structure updates
385
+ - Added detailed usage examples and troubleshooting section
386
+ - Enhanced configuration options and parameter documentation
387
+
388
+ ### v1.0.0
389
+ - Initial release of the Commercetools node for n8n
390
+ - Supports product management operations: create, query, search, get, update, delete, product selections, image upload, and existence checks
391
+ - OAuth2 credential integration
392
+
393
+ Refer to `CHANGELOG.md` for a complete version history and details.
244
394
 
245
395
  ## License
246
396
 
247
- [MIT](https://github.com/n8n-io/n8n-nodes-starter/blob/master/LICENSE.md)
397
+ [MIT](LICENSE.md)
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Commercetools = void 0;
4
4
  const n8n_workflow_1 = require("n8n-workflow");
5
5
  const Commercetools_description_1 = require("./descriptions/Commercetools.description");
6
+ const category_operations_1 = require("./operations/category.operations");
6
7
  const product_operations_1 = require("./operations/product.operations");
7
8
  class Commercetools {
8
9
  constructor() {
@@ -19,11 +20,6 @@ class Commercetools {
19
20
  try {
20
21
  const resource = this.getNodeParameter('resource', itemIndex);
21
22
  const operation = this.getNodeParameter('operation', itemIndex);
22
- if (resource !== 'product') {
23
- throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unsupported resource: ${resource}`, {
24
- itemIndex,
25
- });
26
- }
27
23
  const credentials = (await this.getCredentials('commerceToolsOAuth2Api'));
28
24
  const projectKey = credentials.projectKey;
29
25
  const region = credentials.region || 'australia-southeast1.gcp';
@@ -33,12 +29,27 @@ class Commercetools {
33
29
  });
34
30
  }
35
31
  const baseUrl = `https://api.${region}.commercetools.com/${projectKey}`;
36
- const results = await product_operations_1.executeProductOperation.call(this, {
37
- operation,
38
- itemIndex,
39
- baseUrl,
40
- items,
41
- });
32
+ let results = [];
33
+ if (resource === 'product') {
34
+ results = await product_operations_1.executeProductOperation.call(this, {
35
+ operation,
36
+ itemIndex,
37
+ baseUrl,
38
+ items,
39
+ });
40
+ }
41
+ else if (resource === 'category') {
42
+ results = await category_operations_1.executeCategoryOperation.call(this, {
43
+ operation,
44
+ itemIndex,
45
+ baseUrl,
46
+ });
47
+ }
48
+ else {
49
+ throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unsupported resource: ${resource}`, {
50
+ itemIndex,
51
+ });
52
+ }
42
53
  returnData.push(...results);
43
54
  }
44
55
  catch (error) {
@@ -1 +1 @@
1
- {"version":3,"file":"Commercetools.node.js","sourceRoot":"","sources":["../../../nodes/Commercetools/Commercetools.node.ts"],"names":[],"mappings":";;;AAOA,+CAAkD;AAElD,wFAAoF;AACpF,wEAA0E;AAE1E,MAAa,aAAa;IAA1B;QACC,gBAAW,GAAyB;YACnC,GAAG,oDAAwB;YAC3B,IAAI,EAAE,wBAAwB;YAC9B,YAAY,EAAE,IAAI;SAClB,CAAC;IA2DH,CAAC;IAxDA,KAAK,CAAC,OAAO;QACZ,MAAM,KAAK,GAAG,IA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