n8n-nodes-nexlogiq-commerce 1.0.0
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 +59 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +21 -0
- package/dist/nodes/NexlogiqCommerce/NexlogiqCommerce.node.d.ts +5 -0
- package/dist/nodes/NexlogiqCommerce/NexlogiqCommerce.node.js +271 -0
- package/dist/nodes/Shopify nexlogiq/CustomerDescription.d.ts +3 -0
- package/dist/nodes/Shopify nexlogiq/CustomerDescription.js +299 -0
- package/dist/nodes/Shopify nexlogiq/CustomerInterface.d.ts +14 -0
- package/dist/nodes/Shopify nexlogiq/CustomerInterface.js +4 -0
- package/dist/nodes/Shopify nexlogiq/DraftOrderDescription.d.ts +3 -0
- package/dist/nodes/Shopify nexlogiq/DraftOrderDescription.js +180 -0
- package/dist/nodes/Shopify nexlogiq/GenericFunctions.d.ts +14 -0
- package/dist/nodes/Shopify nexlogiq/GenericFunctions.js +236 -0
- package/dist/nodes/Shopify nexlogiq/OrderDescription.d.ts +3 -0
- package/dist/nodes/Shopify nexlogiq/OrderDescription.js +278 -0
- package/dist/nodes/Shopify nexlogiq/OrderInterface.d.ts +42 -0
- package/dist/nodes/Shopify nexlogiq/OrderInterface.js +2 -0
- package/dist/nodes/Shopify nexlogiq/ProductDescription.d.ts +3 -0
- package/dist/nodes/Shopify nexlogiq/ProductDescription.js +742 -0
- package/dist/nodes/Shopify nexlogiq/ProductInterface.d.ts +59 -0
- package/dist/nodes/Shopify nexlogiq/ProductInterface.js +2 -0
- package/dist/nodes/Shopify nexlogiq/RefundDescription.d.ts +3 -0
- package/dist/nodes/Shopify nexlogiq/RefundDescription.js +104 -0
- package/dist/nodes/Shopify nexlogiq/Shopify.node.d.ts +5 -0
- package/dist/nodes/Shopify nexlogiq/Shopify.node.js +397 -0
- package/dist/nodes/Shopify nexlogiq/ShopifyTrigger.node.d.ts +12 -0
- package/dist/nodes/Shopify nexlogiq/ShopifyTrigger.node.js +413 -0
- package/dist/nodes/Shopify nexlogiq/WebhookDescription.d.ts +3 -0
- package/dist/nodes/Shopify nexlogiq/WebhookDescription.js +105 -0
- package/dist/nodes/Shopify nexlogiq/graphql.d.ts +7 -0
- package/dist/nodes/Shopify nexlogiq/graphql.js +35 -0
- package/dist/nodes/WooCommerce nexlogiq/GenericFunctions.d.ts +15 -0
- package/dist/nodes/WooCommerce nexlogiq/GenericFunctions.js +216 -0
- package/dist/nodes/WooCommerce nexlogiq/OrderDescription.d.ts +3 -0
- package/dist/nodes/WooCommerce nexlogiq/OrderDescription.js +352 -0
- package/dist/nodes/WooCommerce nexlogiq/OrderInterface.d.ts +60 -0
- package/dist/nodes/WooCommerce nexlogiq/OrderInterface.js +2 -0
- package/dist/nodes/WooCommerce nexlogiq/ProductDescription.d.ts +3 -0
- package/dist/nodes/WooCommerce nexlogiq/ProductDescription.js +1360 -0
- package/dist/nodes/WooCommerce nexlogiq/ProductInterface.d.ts +14 -0
- package/dist/nodes/WooCommerce nexlogiq/ProductInterface.js +2 -0
- package/dist/nodes/WooCommerce nexlogiq/RefundDescription.d.ts +3 -0
- package/dist/nodes/WooCommerce nexlogiq/RefundDescription.js +43 -0
- package/dist/nodes/WooCommerce nexlogiq/WebhookDescription.d.ts +3 -0
- package/dist/nodes/WooCommerce nexlogiq/WebhookDescription.js +57 -0
- package/dist/nodes/WooCommerce nexlogiq/WooCommerce.node.d.ts +11 -0
- package/dist/nodes/WooCommerce nexlogiq/WooCommerce.node.js +358 -0
- package/dist/nodes/WooCommerce nexlogiq/WooCommerceTrigger.node.d.ts +12 -0
- package/dist/nodes/WooCommerce nexlogiq/WooCommerceTrigger.node.js +181 -0
- package/dist/nodes/WooCommerce nexlogiq/descriptions/CustomerDescription.d.ts +3 -0
- package/dist/nodes/WooCommerce nexlogiq/descriptions/CustomerDescription.js +180 -0
- package/dist/nodes/WooCommerce nexlogiq/descriptions/index.d.ts +1 -0
- package/dist/nodes/WooCommerce nexlogiq/descriptions/index.js +17 -0
- package/dist/nodes/WooCommerce nexlogiq/descriptions/shared.d.ts +3 -0
- package/dist/nodes/WooCommerce nexlogiq/descriptions/shared.js +182 -0
- package/dist/tests/shopify-generic.test.d.ts +1 -0
- package/dist/tests/shopify-generic.test.js +51 -0
- package/dist/tests/woocommerce-generic.test.d.ts +1 -0
- package/dist/tests/woocommerce-generic.test.js +70 -0
- package/nodes/NexlogiqCommerce/NexlogiqCommerce.node.ts +269 -0
- package/nodes/NexlogiqCommerce/logo.png +0 -0
- package/nodes/Shopify nexlogiq/CustomerDescription.ts +303 -0
- package/nodes/Shopify nexlogiq/CustomerInterface.ts +20 -0
- package/nodes/Shopify nexlogiq/DraftOrderDescription.ts +180 -0
- package/nodes/Shopify nexlogiq/GenericFunctions.ts +299 -0
- package/nodes/Shopify nexlogiq/OrderDescription.ts +280 -0
- package/nodes/Shopify nexlogiq/OrderInterface.ts +45 -0
- package/nodes/Shopify nexlogiq/ProductDescription.ts +764 -0
- package/nodes/Shopify nexlogiq/ProductInterface.ts +64 -0
- package/nodes/Shopify nexlogiq/RefundDescription.ts +104 -0
- package/nodes/Shopify nexlogiq/Shopify.node.json +18 -0
- package/nodes/Shopify nexlogiq/Shopify.node.ts +440 -0
- package/nodes/Shopify nexlogiq/ShopifyTrigger.node.json +25 -0
- package/nodes/Shopify nexlogiq/ShopifyTrigger.node.ts +424 -0
- package/nodes/Shopify nexlogiq/WebhookDescription.ts +105 -0
- package/nodes/Shopify nexlogiq/__schema__/v1.0.0/order/get.json +9 -0
- package/nodes/Shopify nexlogiq/__schema__/v1.0.0/order/getAll.json +218 -0
- package/nodes/Shopify nexlogiq/__schema__/v1.0.0/product/create.json +189 -0
- package/nodes/Shopify nexlogiq/__schema__/v1.0.0/product/get.json +206 -0
- package/nodes/Shopify nexlogiq/__schema__/v1.0.0/product/getAll.json +168 -0
- package/nodes/Shopify nexlogiq/__schema__/v1.0.0/product/update.json +212 -0
- package/nodes/Shopify nexlogiq/graphql.ts +32 -0
- package/nodes/Shopify nexlogiq/shopify.svg +1 -0
- package/nodes/WooCommerce nexlogiq/GenericFunctions.ts +226 -0
- package/nodes/WooCommerce nexlogiq/OrderDescription.ts +353 -0
- package/nodes/WooCommerce nexlogiq/OrderInterface.ts +66 -0
- package/nodes/WooCommerce nexlogiq/ProductDescription.ts +1366 -0
- package/nodes/WooCommerce nexlogiq/ProductInterface.ts +25 -0
- package/nodes/WooCommerce nexlogiq/RefundDescription.ts +43 -0
- package/nodes/WooCommerce nexlogiq/WebhookDescription.ts +57 -0
- package/nodes/WooCommerce nexlogiq/WooCommerce.node.json +18 -0
- package/nodes/WooCommerce nexlogiq/WooCommerce.node.ts +333 -0
- package/nodes/WooCommerce nexlogiq/WooCommerceTrigger.node.json +18 -0
- package/nodes/WooCommerce nexlogiq/WooCommerceTrigger.node.ts +198 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/customer/get.json +156 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/customer/getAll.json +150 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/order/create.json +340 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/order/get.json +549 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/order/getAll.json +528 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/product/create.json +301 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/product/get.json +380 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/product/getAll.json +395 -0
- package/nodes/WooCommerce nexlogiq/__schema__/v1.0.0/product/update.json +390 -0
- package/nodes/WooCommerce nexlogiq/descriptions/CustomerDescription.ts +181 -0
- package/nodes/WooCommerce nexlogiq/descriptions/index.ts +1 -0
- package/nodes/WooCommerce nexlogiq/descriptions/shared.ts +185 -0
- package/nodes/WooCommerce nexlogiq/wooCommerce.svg +1 -0
- package/package.json +44 -0
package/README.md
ADDED
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
# nexlogiq n8n nodes
|
|
2
|
+
|
|
3
|
+
Custom n8n node families included in this package:
|
|
4
|
+
|
|
5
|
+
- `nexlogiqShopify`
|
|
6
|
+
- `nexlogiqWooCommerce`
|
|
7
|
+
- `nexlogiqCommerce` (unified router)
|
|
8
|
+
- `nexlogiqShopifyTrigger`
|
|
9
|
+
- `nexlogiqWooCommerceTrigger`
|
|
10
|
+
|
|
11
|
+
## Dynamic credentials contract
|
|
12
|
+
|
|
13
|
+
Action nodes now support **per-item dynamic credentials** via input JSON and keep static node fields as secure fallback.
|
|
14
|
+
|
|
15
|
+
- Shopify default path: `credentials.shopify`
|
|
16
|
+
- `shopDomain` (or `shopUrl`), `accessToken`, optional `apiVersion`
|
|
17
|
+
- WooCommerce default path: `credentials.woocommerce`
|
|
18
|
+
- `storeUrl`, `consumerKey`, `consumerSecret`
|
|
19
|
+
|
|
20
|
+
You can override the JSON path with each node's **Credential Source Path** parameter.
|
|
21
|
+
|
|
22
|
+
Example input item:
|
|
23
|
+
|
|
24
|
+
```json
|
|
25
|
+
{
|
|
26
|
+
"credentials": {
|
|
27
|
+
"shopify": {
|
|
28
|
+
"shopDomain": "your-store.myshopify.com",
|
|
29
|
+
"accessToken": "shpat_xxx",
|
|
30
|
+
"apiVersion": "2025-10"
|
|
31
|
+
},
|
|
32
|
+
"woocommerce": {
|
|
33
|
+
"storeUrl": "https://shop.example.com",
|
|
34
|
+
"consumerKey": "ck_xxx",
|
|
35
|
+
"consumerSecret": "cs_xxx"
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
## Standalone/no-input behavior
|
|
42
|
+
|
|
43
|
+
Shopify, WooCommerce, and NexlogiqCommerce action nodes execute once even when no input items are provided (useful as standalone action nodes). If input exists, they execute per item and preserve paired-item linkage.
|
|
44
|
+
|
|
45
|
+
## Supported operations
|
|
46
|
+
|
|
47
|
+
- Shopify: customers, orders, products, draft orders, refunds, webhooks (+ trigger)
|
|
48
|
+
- WooCommerce: customers, orders, products, refunds, webhooks (+ trigger)
|
|
49
|
+
- Unified NexlogiqCommerce routes by platform/resource/operation with explicit unsupported-combination errors.
|
|
50
|
+
|
|
51
|
+
## Build and test
|
|
52
|
+
|
|
53
|
+
```bash
|
|
54
|
+
npm install
|
|
55
|
+
npm run build
|
|
56
|
+
npm test
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
Tests include credential extraction, recursive mapping, pagination safeguards, and GraphQL error handling.
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export * from './nodes/Shopify nexlogiq/Shopify.node';
|
|
2
|
+
export * from './nodes/Shopify nexlogiq/ShopifyTrigger.node';
|
|
3
|
+
export * from './nodes/WooCommerce nexlogiq/WooCommerce.node';
|
|
4
|
+
export * from './nodes/WooCommerce nexlogiq/WooCommerceTrigger.node';
|
|
5
|
+
export * from './nodes/NexlogiqCommerce/NexlogiqCommerce.node';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./nodes/Shopify nexlogiq/Shopify.node"), exports);
|
|
18
|
+
__exportStar(require("./nodes/Shopify nexlogiq/ShopifyTrigger.node"), exports);
|
|
19
|
+
__exportStar(require("./nodes/WooCommerce nexlogiq/WooCommerce.node"), exports);
|
|
20
|
+
__exportStar(require("./nodes/WooCommerce nexlogiq/WooCommerceTrigger.node"), exports);
|
|
21
|
+
__exportStar(require("./nodes/NexlogiqCommerce/NexlogiqCommerce.node"), exports);
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { type IExecuteFunctions, type INodeExecutionData, type INodeType, type INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class NexlogiqCommerce implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NexlogiqCommerce = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const CustomerDescription_1 = require("../Shopify nexlogiq/CustomerDescription");
|
|
6
|
+
const DraftOrderDescription_1 = require("../Shopify nexlogiq/DraftOrderDescription");
|
|
7
|
+
const OrderDescription_1 = require("../Shopify nexlogiq/OrderDescription");
|
|
8
|
+
const ProductDescription_1 = require("../Shopify nexlogiq/ProductDescription");
|
|
9
|
+
const RefundDescription_1 = require("../Shopify nexlogiq/RefundDescription");
|
|
10
|
+
const WebhookDescription_1 = require("../Shopify nexlogiq/WebhookDescription");
|
|
11
|
+
const graphql_1 = require("../Shopify nexlogiq/graphql");
|
|
12
|
+
const GenericFunctions_1 = require("../Shopify nexlogiq/GenericFunctions");
|
|
13
|
+
const CustomerDescription_2 = require("../WooCommerce nexlogiq/descriptions/CustomerDescription");
|
|
14
|
+
const OrderDescription_2 = require("../WooCommerce nexlogiq/OrderDescription");
|
|
15
|
+
const ProductDescription_2 = require("../WooCommerce nexlogiq/ProductDescription");
|
|
16
|
+
const RefundDescription_2 = require("../WooCommerce nexlogiq/RefundDescription");
|
|
17
|
+
const WebhookDescription_2 = require("../WooCommerce nexlogiq/WebhookDescription");
|
|
18
|
+
const GenericFunctions_2 = require("../WooCommerce nexlogiq/GenericFunctions");
|
|
19
|
+
function injectProps(items, platform, resource) {
|
|
20
|
+
return items.map((item) => {
|
|
21
|
+
const originalShow = item.displayOptions?.show || {};
|
|
22
|
+
return {
|
|
23
|
+
...item,
|
|
24
|
+
displayOptions: {
|
|
25
|
+
...item.displayOptions,
|
|
26
|
+
show: {
|
|
27
|
+
...originalShow,
|
|
28
|
+
platform: [platform],
|
|
29
|
+
resource: [resource],
|
|
30
|
+
},
|
|
31
|
+
},
|
|
32
|
+
};
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
class NexlogiqCommerce {
|
|
36
|
+
constructor() {
|
|
37
|
+
this.description = {
|
|
38
|
+
displayName: 'Nexlogiq Commerce OS',
|
|
39
|
+
name: 'nexlogiqCommerce',
|
|
40
|
+
icon: 'file:logo.png',
|
|
41
|
+
group: ['output'],
|
|
42
|
+
version: 1,
|
|
43
|
+
subtitle: '={{$parameter["platform"] + ": " + $parameter["resource"]}}',
|
|
44
|
+
description: 'Unified SaaS Engine for Shopify and WooCommerce',
|
|
45
|
+
defaults: { name: 'Nexlogiq Commerce OS' },
|
|
46
|
+
inputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
47
|
+
outputs: [n8n_workflow_1.NodeConnectionTypes.Main],
|
|
48
|
+
properties: [
|
|
49
|
+
{
|
|
50
|
+
displayName: 'Platform',
|
|
51
|
+
name: 'platform',
|
|
52
|
+
type: 'options',
|
|
53
|
+
options: [
|
|
54
|
+
{ name: 'Shopify', value: 'shopify' },
|
|
55
|
+
{ name: 'WooCommerce', value: 'woocommerce' },
|
|
56
|
+
],
|
|
57
|
+
default: 'shopify',
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
displayName: 'Credential Source Path',
|
|
61
|
+
name: 'credentialSourcePath',
|
|
62
|
+
type: 'string',
|
|
63
|
+
default: 'credentials',
|
|
64
|
+
description: 'Item JSON path to provider credentials object',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Store URL / Shop Domain',
|
|
68
|
+
name: 'storeUrl',
|
|
69
|
+
type: 'string',
|
|
70
|
+
default: '',
|
|
71
|
+
description: 'Static fallback. Shopify accepts shop domain; WooCommerce accepts full store URL.',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
displayName: 'API Key / Access Token / Consumer Key',
|
|
75
|
+
name: 'apiKey',
|
|
76
|
+
type: 'string',
|
|
77
|
+
typeOptions: { password: true },
|
|
78
|
+
default: '',
|
|
79
|
+
description: 'Static fallback credential value',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
displayName: 'API Secret / Consumer Secret',
|
|
83
|
+
name: 'apiSecret',
|
|
84
|
+
type: 'string',
|
|
85
|
+
typeOptions: { password: true },
|
|
86
|
+
default: '',
|
|
87
|
+
displayOptions: { show: { platform: ['woocommerce'] } },
|
|
88
|
+
},
|
|
89
|
+
{
|
|
90
|
+
displayName: 'API Version',
|
|
91
|
+
name: 'apiVersion',
|
|
92
|
+
type: 'string',
|
|
93
|
+
default: '2025-10',
|
|
94
|
+
displayOptions: { show: { platform: ['shopify'] } },
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
displayName: 'Resource',
|
|
98
|
+
name: 'resource',
|
|
99
|
+
type: 'options',
|
|
100
|
+
noDataExpression: true,
|
|
101
|
+
options: [
|
|
102
|
+
{ name: 'Customer', value: 'customer' },
|
|
103
|
+
{ name: 'Draft Order', value: 'draftOrder', displayOptions: { show: { platform: ['shopify'] } } },
|
|
104
|
+
{ name: 'Order', value: 'order' },
|
|
105
|
+
{ name: 'Product', value: 'product' },
|
|
106
|
+
{ name: 'Refund', value: 'refund' },
|
|
107
|
+
{ name: 'Webhook', value: 'webhook' },
|
|
108
|
+
],
|
|
109
|
+
default: 'product',
|
|
110
|
+
},
|
|
111
|
+
...injectProps(CustomerDescription_1.customerOperations, 'shopify', 'customer'),
|
|
112
|
+
...injectProps(CustomerDescription_1.customerFields, 'shopify', 'customer'),
|
|
113
|
+
...injectProps(DraftOrderDescription_1.draftOrderOperations, 'shopify', 'draftOrder'),
|
|
114
|
+
...injectProps(DraftOrderDescription_1.draftOrderFields, 'shopify', 'draftOrder'),
|
|
115
|
+
...injectProps(OrderDescription_1.orderOperations, 'shopify', 'order'),
|
|
116
|
+
...injectProps(OrderDescription_1.orderFields, 'shopify', 'order'),
|
|
117
|
+
...injectProps(ProductDescription_1.productOperations, 'shopify', 'product'),
|
|
118
|
+
...injectProps(ProductDescription_1.productFields, 'shopify', 'product'),
|
|
119
|
+
...injectProps(RefundDescription_1.refundOperations, 'shopify', 'refund'),
|
|
120
|
+
...injectProps(RefundDescription_1.refundFields, 'shopify', 'refund'),
|
|
121
|
+
...injectProps(WebhookDescription_1.webhookOperations, 'shopify', 'webhook'),
|
|
122
|
+
...injectProps(WebhookDescription_1.webhookFields, 'shopify', 'webhook'),
|
|
123
|
+
...injectProps(CustomerDescription_2.customerOperations, 'woocommerce', 'customer'),
|
|
124
|
+
...injectProps(CustomerDescription_2.customerFields, 'woocommerce', 'customer'),
|
|
125
|
+
...injectProps(OrderDescription_2.orderOperations, 'woocommerce', 'order'),
|
|
126
|
+
...injectProps(OrderDescription_2.orderFields, 'woocommerce', 'order'),
|
|
127
|
+
...injectProps(ProductDescription_2.productOperations, 'woocommerce', 'product'),
|
|
128
|
+
...injectProps(ProductDescription_2.productFields, 'woocommerce', 'product'),
|
|
129
|
+
...injectProps(RefundDescription_2.refundOperations, 'woocommerce', 'refund'),
|
|
130
|
+
...injectProps(RefundDescription_2.refundFields, 'woocommerce', 'refund'),
|
|
131
|
+
...injectProps(WebhookDescription_2.webhookOperations, 'woocommerce', 'webhook'),
|
|
132
|
+
...injectProps(WebhookDescription_2.webhookFields, 'woocommerce', 'webhook'),
|
|
133
|
+
],
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
async execute() {
|
|
137
|
+
const inputItems = this.getInputData();
|
|
138
|
+
const executionCount = Math.max(inputItems.length, 1);
|
|
139
|
+
const returnData = [];
|
|
140
|
+
for (let i = 0; i < executionCount; i++) {
|
|
141
|
+
this.__itemIndex = i;
|
|
142
|
+
const platform = this.getNodeParameter('platform', i, this.getNodeParameter('platform', 0));
|
|
143
|
+
const resource = this.getNodeParameter('resource', i, this.getNodeParameter('resource', 0));
|
|
144
|
+
const operation = this.getNodeParameter('operation', i, this.getNodeParameter('operation', 0));
|
|
145
|
+
try {
|
|
146
|
+
let responseData;
|
|
147
|
+
if (platform === 'shopify') {
|
|
148
|
+
if (resource === 'customer' && operation === 'getAll') {
|
|
149
|
+
responseData = await GenericFunctions_1.shopifyGraphqlConnectionAllItems.call(this, graphql_1.SHOPIFY_GQL.customers, ['customers'], { limit: 250 }, i);
|
|
150
|
+
}
|
|
151
|
+
else if (resource === 'order' && operation === 'getAll') {
|
|
152
|
+
responseData = await GenericFunctions_1.shopifyGraphqlConnectionAllItems.call(this, graphql_1.SHOPIFY_GQL.orders, ['orders'], { limit: 250 }, i);
|
|
153
|
+
}
|
|
154
|
+
else if (resource === 'product' && operation === 'getAll') {
|
|
155
|
+
responseData = await GenericFunctions_1.shopifyGraphqlConnectionAllItems.call(this, graphql_1.SHOPIFY_GQL.products, ['products'], { limit: 250 }, i);
|
|
156
|
+
}
|
|
157
|
+
else if (resource === 'draftOrder' && operation === 'getAll') {
|
|
158
|
+
responseData = await GenericFunctions_1.shopifyGraphqlConnectionAllItems.call(this, graphql_1.SHOPIFY_GQL.draftOrders, ['draftOrders'], { limit: 250 }, i);
|
|
159
|
+
}
|
|
160
|
+
else if (resource === 'webhook' && operation === 'getAll') {
|
|
161
|
+
responseData = await GenericFunctions_1.shopifyGraphqlConnectionAllItems.call(this, graphql_1.SHOPIFY_GQL.webhookSubscriptions, ['webhookSubscriptions'], { limit: 250 }, i);
|
|
162
|
+
}
|
|
163
|
+
else if (resource === 'customer' && operation === 'get') {
|
|
164
|
+
const customerId = this.getNodeParameter('customerId', i);
|
|
165
|
+
responseData = (await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/customers/${customerId}.json`, {}, {}, undefined, {}, i)).customer;
|
|
166
|
+
}
|
|
167
|
+
else if (resource === 'order' && operation === 'get') {
|
|
168
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
169
|
+
responseData = (await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/orders/${orderId}.json`, {}, {}, undefined, {}, i)).order;
|
|
170
|
+
}
|
|
171
|
+
else if (resource === 'product' && operation === 'get') {
|
|
172
|
+
const productId = this.getNodeParameter('productId', i);
|
|
173
|
+
responseData = (await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/products/${productId}.json`, {}, {}, undefined, {}, i)).product;
|
|
174
|
+
}
|
|
175
|
+
else if (resource === 'draftOrder' && operation === 'get') {
|
|
176
|
+
const draftOrderId = this.getNodeParameter('draftOrderId', i);
|
|
177
|
+
responseData = (await GenericFunctions_1.shopifyApiRequest.call(this, 'GET', `/draft_orders/${draftOrderId}.json`, {}, {}, undefined, {}, i)).draft_order;
|
|
178
|
+
}
|
|
179
|
+
else if (resource === 'refund' && operation === 'create') {
|
|
180
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
181
|
+
const lineItems = this.getNodeParameter('refund_line_items', i, {});
|
|
182
|
+
const currency = this.getNodeParameter('currency', i, 'USD');
|
|
183
|
+
responseData = (await GenericFunctions_1.shopifyApiRequest.call(this, 'POST', `/orders/${orderId}/refunds.json`, {
|
|
184
|
+
refund: {
|
|
185
|
+
currency,
|
|
186
|
+
refund_line_items: (lineItems.item ?? []).map((item) => ({
|
|
187
|
+
line_item_id: item.line_item_id,
|
|
188
|
+
quantity: item.quantity,
|
|
189
|
+
restock_type: 'return',
|
|
190
|
+
})),
|
|
191
|
+
},
|
|
192
|
+
}, {}, undefined, {}, i)).refund;
|
|
193
|
+
}
|
|
194
|
+
else if (resource === 'webhook' && operation === 'create') {
|
|
195
|
+
const topic = this.getNodeParameter('topic', i);
|
|
196
|
+
const address = this.getNodeParameter('address', i);
|
|
197
|
+
responseData = (await GenericFunctions_1.shopifyApiRequest.call(this, 'POST', '/webhooks.json', { webhook: { topic, address, format: 'json' } }, {}, undefined, {}, i)).webhook;
|
|
198
|
+
}
|
|
199
|
+
else if (resource === 'webhook' && operation === 'delete') {
|
|
200
|
+
const webhookId = this.getNodeParameter('webhookId', i);
|
|
201
|
+
await GenericFunctions_1.shopifyApiRequest.call(this, 'DELETE', `/webhooks/${webhookId}.json`, {}, {}, undefined, {}, i);
|
|
202
|
+
responseData = { success: true, id: webhookId };
|
|
203
|
+
}
|
|
204
|
+
else {
|
|
205
|
+
const endpoint = `/${resource === 'draftOrder' ? 'draft_orders' : `${resource}s`}.json`;
|
|
206
|
+
if (operation === 'getAll')
|
|
207
|
+
responseData = await GenericFunctions_1.shopifyApiRequestAllItems.call(this, `${resource === 'draftOrder' ? 'draft_orders' : `${resource}s`}`, 'GET', endpoint, {}, {}, i);
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
else if (platform === 'woocommerce') {
|
|
211
|
+
if (resource === 'customer' && operation === 'getAll') {
|
|
212
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequestAllItems.call(this, 'GET', '/customers', {}, {}, i);
|
|
213
|
+
}
|
|
214
|
+
else if (resource === 'order' && operation === 'getAll') {
|
|
215
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequestAllItems.call(this, 'GET', '/orders', {}, {}, i);
|
|
216
|
+
}
|
|
217
|
+
else if (resource === 'product' && operation === 'getAll') {
|
|
218
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequestAllItems.call(this, 'GET', '/products', {}, {}, i);
|
|
219
|
+
}
|
|
220
|
+
else if (resource === 'webhook' && operation === 'getAll') {
|
|
221
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequestAllItems.call(this, 'GET', '/webhooks', {}, {}, i);
|
|
222
|
+
}
|
|
223
|
+
else if (resource === 'customer' && operation === 'get') {
|
|
224
|
+
const customerId = this.getNodeParameter('customerId', i);
|
|
225
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequest.call(this, 'GET', `/customers/${customerId}`, {}, {}, i);
|
|
226
|
+
}
|
|
227
|
+
else if (resource === 'order' && operation === 'get') {
|
|
228
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
229
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequest.call(this, 'GET', `/orders/${orderId}`, {}, {}, i);
|
|
230
|
+
}
|
|
231
|
+
else if (resource === 'product' && operation === 'get') {
|
|
232
|
+
const productId = this.getNodeParameter('productId', i);
|
|
233
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequest.call(this, 'GET', `/products/${productId}`, {}, {}, i);
|
|
234
|
+
}
|
|
235
|
+
else if (resource === 'refund' && operation === 'create') {
|
|
236
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
237
|
+
const amount = this.getNodeParameter('amount', i);
|
|
238
|
+
const reason = this.getNodeParameter('reason', i, '');
|
|
239
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequest.call(this, 'POST', `/orders/${orderId}/refunds`, { amount, reason }, {}, i);
|
|
240
|
+
}
|
|
241
|
+
else if (resource === 'webhook' && operation === 'create') {
|
|
242
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequest.call(this, 'POST', '/webhooks', {
|
|
243
|
+
topic: this.getNodeParameter('topic', i),
|
|
244
|
+
delivery_url: this.getNodeParameter('deliveryUrl', i),
|
|
245
|
+
}, {}, i);
|
|
246
|
+
}
|
|
247
|
+
else if (resource === 'webhook' && operation === 'delete') {
|
|
248
|
+
const webhookId = this.getNodeParameter('webhookId', i);
|
|
249
|
+
responseData = await GenericFunctions_2.wooCommerceApiRequest.call(this, 'DELETE', `/webhooks/${webhookId}`, {}, { force: true }, i);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (responseData === undefined) {
|
|
253
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unsupported combination: ${platform}/${resource}/${operation}`, { itemIndex: i });
|
|
254
|
+
}
|
|
255
|
+
const normalized = (Array.isArray(responseData) ? responseData : [responseData]).filter(Boolean);
|
|
256
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray(normalized), { itemData: { item: inputItems.length ? i : 0 } });
|
|
257
|
+
returnData.push(...executionData);
|
|
258
|
+
}
|
|
259
|
+
catch (error) {
|
|
260
|
+
if (this.continueOnFail()) {
|
|
261
|
+
const executionData = this.helpers.constructExecutionMetaData(this.helpers.returnJsonArray([{ error: error.message }]), { itemData: { item: inputItems.length ? i : 0 } });
|
|
262
|
+
returnData.push(...executionData);
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
throw error;
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
return [returnData];
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
exports.NexlogiqCommerce = NexlogiqCommerce;
|
|
@@ -0,0 +1,299 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.customerFields = exports.customerOperations = void 0;
|
|
4
|
+
exports.customerOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: ['customer'],
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
options: [
|
|
16
|
+
{
|
|
17
|
+
name: 'Create',
|
|
18
|
+
value: 'create',
|
|
19
|
+
description: 'Create a new customer',
|
|
20
|
+
action: 'Create a customer',
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
name: 'Delete',
|
|
24
|
+
value: 'delete',
|
|
25
|
+
description: 'Delete a customer',
|
|
26
|
+
action: 'Delete a customer',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'Get',
|
|
30
|
+
value: 'get',
|
|
31
|
+
description: 'Get a customer',
|
|
32
|
+
action: 'Get a customer',
|
|
33
|
+
},
|
|
34
|
+
{
|
|
35
|
+
name: 'Get Many',
|
|
36
|
+
value: 'getAll',
|
|
37
|
+
description: 'Get many customers',
|
|
38
|
+
action: 'Get many customers',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Update',
|
|
42
|
+
value: 'update',
|
|
43
|
+
description: 'Update a customer',
|
|
44
|
+
action: 'Update a customer',
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
|
+
default: 'create',
|
|
48
|
+
},
|
|
49
|
+
];
|
|
50
|
+
exports.customerFields = [
|
|
51
|
+
/* -------------------------------------------------------------------------- */
|
|
52
|
+
/* customer:create */
|
|
53
|
+
/* -------------------------------------------------------------------------- */
|
|
54
|
+
{
|
|
55
|
+
displayName: 'First Name',
|
|
56
|
+
name: 'firstName',
|
|
57
|
+
type: 'string',
|
|
58
|
+
default: '',
|
|
59
|
+
displayOptions: {
|
|
60
|
+
show: {
|
|
61
|
+
resource: ['customer'],
|
|
62
|
+
operation: ['create'],
|
|
63
|
+
},
|
|
64
|
+
},
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
displayName: 'Last Name',
|
|
69
|
+
name: 'lastName',
|
|
70
|
+
type: 'string',
|
|
71
|
+
default: '',
|
|
72
|
+
displayOptions: {
|
|
73
|
+
show: {
|
|
74
|
+
resource: ['customer'],
|
|
75
|
+
operation: ['create'],
|
|
76
|
+
},
|
|
77
|
+
},
|
|
78
|
+
required: true,
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Email',
|
|
82
|
+
name: 'email',
|
|
83
|
+
type: 'string',
|
|
84
|
+
default: '',
|
|
85
|
+
placeholder: 'name@email.com',
|
|
86
|
+
displayOptions: {
|
|
87
|
+
show: {
|
|
88
|
+
resource: ['customer'],
|
|
89
|
+
operation: ['create'],
|
|
90
|
+
},
|
|
91
|
+
},
|
|
92
|
+
required: true,
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Additional Fields',
|
|
96
|
+
name: 'additionalFields',
|
|
97
|
+
type: 'collection',
|
|
98
|
+
placeholder: 'Add Field',
|
|
99
|
+
default: {},
|
|
100
|
+
displayOptions: {
|
|
101
|
+
show: {
|
|
102
|
+
resource: ['customer'],
|
|
103
|
+
operation: ['create'],
|
|
104
|
+
},
|
|
105
|
+
},
|
|
106
|
+
options: [
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Phone',
|
|
109
|
+
name: 'phone',
|
|
110
|
+
type: 'string',
|
|
111
|
+
default: '',
|
|
112
|
+
description: 'The unique phone number (E.164 format) for this customer',
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
displayName: 'Note',
|
|
116
|
+
name: 'note',
|
|
117
|
+
type: 'string',
|
|
118
|
+
default: '',
|
|
119
|
+
description: 'A note about the customer',
|
|
120
|
+
},
|
|
121
|
+
{
|
|
122
|
+
displayName: 'Tags',
|
|
123
|
+
name: 'tags',
|
|
124
|
+
type: 'string',
|
|
125
|
+
default: '',
|
|
126
|
+
description: 'Tags that the shop owner has attached to the customer, formatted as a string of comma-separated values',
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
displayName: 'Verified Email',
|
|
130
|
+
name: 'verified_email',
|
|
131
|
+
type: 'boolean',
|
|
132
|
+
default: true,
|
|
133
|
+
description: 'Whether the customer has verified their email address',
|
|
134
|
+
},
|
|
135
|
+
],
|
|
136
|
+
},
|
|
137
|
+
/* -------------------------------------------------------------------------- */
|
|
138
|
+
/* customer:update */
|
|
139
|
+
/* -------------------------------------------------------------------------- */
|
|
140
|
+
{
|
|
141
|
+
displayName: 'Customer ID',
|
|
142
|
+
name: 'customerId',
|
|
143
|
+
type: 'string',
|
|
144
|
+
default: '',
|
|
145
|
+
required: true,
|
|
146
|
+
displayOptions: {
|
|
147
|
+
show: {
|
|
148
|
+
resource: ['customer'],
|
|
149
|
+
operation: ['update'],
|
|
150
|
+
},
|
|
151
|
+
},
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
displayName: 'Update Fields',
|
|
155
|
+
name: 'updateFields',
|
|
156
|
+
type: 'collection',
|
|
157
|
+
placeholder: 'Add Field',
|
|
158
|
+
default: {},
|
|
159
|
+
displayOptions: {
|
|
160
|
+
show: {
|
|
161
|
+
resource: ['customer'],
|
|
162
|
+
operation: ['update'],
|
|
163
|
+
},
|
|
164
|
+
},
|
|
165
|
+
options: [
|
|
166
|
+
{
|
|
167
|
+
displayName: 'First Name',
|
|
168
|
+
name: 'first_name',
|
|
169
|
+
type: 'string',
|
|
170
|
+
default: '',
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
displayName: 'Last Name',
|
|
174
|
+
name: 'last_name',
|
|
175
|
+
type: 'string',
|
|
176
|
+
default: '',
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
displayName: 'Email',
|
|
180
|
+
name: 'email',
|
|
181
|
+
type: 'string',
|
|
182
|
+
default: '',
|
|
183
|
+
},
|
|
184
|
+
{
|
|
185
|
+
displayName: 'Phone',
|
|
186
|
+
name: 'phone',
|
|
187
|
+
type: 'string',
|
|
188
|
+
default: '',
|
|
189
|
+
},
|
|
190
|
+
{
|
|
191
|
+
displayName: 'Note',
|
|
192
|
+
name: 'note',
|
|
193
|
+
type: 'string',
|
|
194
|
+
default: '',
|
|
195
|
+
},
|
|
196
|
+
{
|
|
197
|
+
displayName: 'Tags',
|
|
198
|
+
name: 'tags',
|
|
199
|
+
type: 'string',
|
|
200
|
+
default: '',
|
|
201
|
+
},
|
|
202
|
+
],
|
|
203
|
+
},
|
|
204
|
+
/* -------------------------------------------------------------------------- */
|
|
205
|
+
/* customer:get */
|
|
206
|
+
/* -------------------------------------------------------------------------- */
|
|
207
|
+
{
|
|
208
|
+
displayName: 'Customer ID',
|
|
209
|
+
name: 'customerId',
|
|
210
|
+
type: 'string',
|
|
211
|
+
default: '',
|
|
212
|
+
required: true,
|
|
213
|
+
displayOptions: {
|
|
214
|
+
show: {
|
|
215
|
+
resource: ['customer'],
|
|
216
|
+
operation: ['get'],
|
|
217
|
+
},
|
|
218
|
+
},
|
|
219
|
+
},
|
|
220
|
+
/* -------------------------------------------------------------------------- */
|
|
221
|
+
/* customer:delete */
|
|
222
|
+
/* -------------------------------------------------------------------------- */
|
|
223
|
+
{
|
|
224
|
+
displayName: 'Customer ID',
|
|
225
|
+
name: 'customerId',
|
|
226
|
+
type: 'string',
|
|
227
|
+
default: '',
|
|
228
|
+
required: true,
|
|
229
|
+
displayOptions: {
|
|
230
|
+
show: {
|
|
231
|
+
resource: ['customer'],
|
|
232
|
+
operation: ['delete'],
|
|
233
|
+
},
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
/* -------------------------------------------------------------------------- */
|
|
237
|
+
/* customer:getAll */
|
|
238
|
+
/* -------------------------------------------------------------------------- */
|
|
239
|
+
{
|
|
240
|
+
displayName: 'Return All',
|
|
241
|
+
name: 'returnAll',
|
|
242
|
+
type: 'boolean',
|
|
243
|
+
displayOptions: {
|
|
244
|
+
show: {
|
|
245
|
+
resource: ['customer'],
|
|
246
|
+
operation: ['getAll'],
|
|
247
|
+
},
|
|
248
|
+
},
|
|
249
|
+
default: false,
|
|
250
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
251
|
+
},
|
|
252
|
+
{
|
|
253
|
+
displayName: 'Limit',
|
|
254
|
+
name: 'limit',
|
|
255
|
+
type: 'number',
|
|
256
|
+
displayOptions: {
|
|
257
|
+
show: {
|
|
258
|
+
resource: ['customer'],
|
|
259
|
+
operation: ['getAll'],
|
|
260
|
+
returnAll: [false],
|
|
261
|
+
},
|
|
262
|
+
},
|
|
263
|
+
typeOptions: {
|
|
264
|
+
minValue: 1,
|
|
265
|
+
maxValue: 250,
|
|
266
|
+
},
|
|
267
|
+
default: 50,
|
|
268
|
+
description: 'Max number of results to return',
|
|
269
|
+
},
|
|
270
|
+
{
|
|
271
|
+
displayName: 'Options',
|
|
272
|
+
name: 'options',
|
|
273
|
+
type: 'collection',
|
|
274
|
+
placeholder: 'Add Field',
|
|
275
|
+
default: {},
|
|
276
|
+
displayOptions: {
|
|
277
|
+
show: {
|
|
278
|
+
resource: ['customer'],
|
|
279
|
+
operation: ['getAll'],
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
options: [
|
|
283
|
+
{
|
|
284
|
+
displayName: 'Query (Search)',
|
|
285
|
+
name: 'query',
|
|
286
|
+
type: 'string',
|
|
287
|
+
default: '',
|
|
288
|
+
description: 'Text to search for in the customer\'s fields (name, email, etc.)',
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
displayName: 'IDs',
|
|
292
|
+
name: 'ids',
|
|
293
|
+
type: 'string',
|
|
294
|
+
default: '',
|
|
295
|
+
description: 'Comma-separated list of customer IDs',
|
|
296
|
+
},
|
|
297
|
+
],
|
|
298
|
+
},
|
|
299
|
+
];
|