n8n-nodes-tiendanube-alldo 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 +43 -0
- package/credentials/TiendanubeApi.credentials.ts +36 -0
- package/dist/credentials/TiendanubeApi.credentials.js +36 -0
- package/dist/credentials/TiendanubeApi.credentials.js.map +1 -0
- package/dist/nodes/Tiendanube/CustomerDescription.js +149 -0
- package/dist/nodes/Tiendanube/CustomerDescription.js.map +1 -0
- package/dist/nodes/Tiendanube/ExtraDescription.js +162 -0
- package/dist/nodes/Tiendanube/ExtraDescription.js.map +1 -0
- package/dist/nodes/Tiendanube/GenericFunctions.js +34 -0
- package/dist/nodes/Tiendanube/GenericFunctions.js.map +1 -0
- package/dist/nodes/Tiendanube/OrderDescription.js +129 -0
- package/dist/nodes/Tiendanube/OrderDescription.js.map +1 -0
- package/dist/nodes/Tiendanube/ProductDescription.js +138 -0
- package/dist/nodes/Tiendanube/ProductDescription.js.map +1 -0
- package/dist/nodes/Tiendanube/Tiendanube.node.js +244 -0
- package/dist/nodes/Tiendanube/Tiendanube.node.js.map +1 -0
- package/dist/nodes/TiendanubeTrigger/TiendanubeTrigger.node.js +133 -0
- package/dist/nodes/TiendanubeTrigger/TiendanubeTrigger.node.js.map +1 -0
- package/index.ts +4 -0
- package/nodes/Tiendanube/CustomerDescription.ts +150 -0
- package/nodes/Tiendanube/ExtraDescription.ts +163 -0
- package/nodes/Tiendanube/GenericFunctions.ts +53 -0
- package/nodes/Tiendanube/OrderDescription.ts +130 -0
- package/nodes/Tiendanube/ProductDescription.ts +139 -0
- package/nodes/Tiendanube/Tiendanube.node.ts +271 -0
- package/nodes/TiendanubeTrigger/TiendanubeTrigger.node.ts +144 -0
- package/package.json +47 -0
- package/tsconfig.json +34 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.productFields = exports.productOperations = void 0;
|
|
4
|
+
exports.productOperations = [
|
|
5
|
+
{
|
|
6
|
+
displayName: 'Operation',
|
|
7
|
+
name: 'operation',
|
|
8
|
+
type: 'options',
|
|
9
|
+
noDataExpression: true,
|
|
10
|
+
displayOptions: {
|
|
11
|
+
show: {
|
|
12
|
+
resource: [
|
|
13
|
+
'product',
|
|
14
|
+
],
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
options: [
|
|
18
|
+
{
|
|
19
|
+
name: 'Create',
|
|
20
|
+
value: 'create',
|
|
21
|
+
description: 'Create a new product',
|
|
22
|
+
action: 'Create a product',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
name: 'Delete',
|
|
26
|
+
value: 'delete',
|
|
27
|
+
description: 'Delete a product',
|
|
28
|
+
action: 'Delete a product',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Get',
|
|
32
|
+
value: 'get',
|
|
33
|
+
description: 'Get a product',
|
|
34
|
+
action: 'Get a product',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Get All',
|
|
38
|
+
value: 'getAll',
|
|
39
|
+
description: 'Get all products',
|
|
40
|
+
action: 'Get all products',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Update',
|
|
44
|
+
value: 'update',
|
|
45
|
+
description: 'Update a product',
|
|
46
|
+
action: 'Update a product',
|
|
47
|
+
},
|
|
48
|
+
],
|
|
49
|
+
default: 'create',
|
|
50
|
+
},
|
|
51
|
+
];
|
|
52
|
+
exports.productFields = [
|
|
53
|
+
/* -------------------------------------------------------------------------- */
|
|
54
|
+
/* product:create */
|
|
55
|
+
/* -------------------------------------------------------------------------- */
|
|
56
|
+
{
|
|
57
|
+
displayName: 'Name',
|
|
58
|
+
name: 'name',
|
|
59
|
+
type: 'json',
|
|
60
|
+
required: true,
|
|
61
|
+
displayOptions: {
|
|
62
|
+
show: {
|
|
63
|
+
resource: [
|
|
64
|
+
'product',
|
|
65
|
+
],
|
|
66
|
+
operation: [
|
|
67
|
+
'create',
|
|
68
|
+
],
|
|
69
|
+
},
|
|
70
|
+
},
|
|
71
|
+
default: '{"es": "Mi Producto"}',
|
|
72
|
+
description: 'The name of the product (can be a JSON object with languages)',
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
displayName: 'Additional Fields',
|
|
76
|
+
name: 'additionalFields',
|
|
77
|
+
type: 'collection',
|
|
78
|
+
placeholder: 'Add Field',
|
|
79
|
+
default: {},
|
|
80
|
+
displayOptions: {
|
|
81
|
+
show: {
|
|
82
|
+
resource: [
|
|
83
|
+
'product',
|
|
84
|
+
],
|
|
85
|
+
operation: [
|
|
86
|
+
'create',
|
|
87
|
+
'update',
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
options: [
|
|
92
|
+
{
|
|
93
|
+
displayName: 'Description',
|
|
94
|
+
name: 'description',
|
|
95
|
+
type: 'json',
|
|
96
|
+
default: '{"es": "Descripción..."}',
|
|
97
|
+
description: 'Product description',
|
|
98
|
+
},
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Handle',
|
|
101
|
+
name: 'handle',
|
|
102
|
+
type: 'json',
|
|
103
|
+
default: '{"es": "mi-producto"}',
|
|
104
|
+
description: 'Product handle/slug',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Brand',
|
|
108
|
+
name: 'brand',
|
|
109
|
+
type: 'string',
|
|
110
|
+
default: '',
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
/* -------------------------------------------------------------------------- */
|
|
115
|
+
/* product:get/delete */
|
|
116
|
+
/* -------------------------------------------------------------------------- */
|
|
117
|
+
{
|
|
118
|
+
displayName: 'Product ID',
|
|
119
|
+
name: 'productId',
|
|
120
|
+
type: 'string',
|
|
121
|
+
required: true,
|
|
122
|
+
default: '',
|
|
123
|
+
displayOptions: {
|
|
124
|
+
show: {
|
|
125
|
+
resource: [
|
|
126
|
+
'product',
|
|
127
|
+
],
|
|
128
|
+
operation: [
|
|
129
|
+
'get',
|
|
130
|
+
'delete',
|
|
131
|
+
'update',
|
|
132
|
+
],
|
|
133
|
+
},
|
|
134
|
+
},
|
|
135
|
+
description: 'The ID of the product',
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
//# sourceMappingURL=ProductDescription.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ProductDescription.js","sourceRoot":"","sources":["../../../nodes/Tiendanube/ProductDescription.ts"],"names":[],"mappings":";;;AAIa,QAAA,iBAAiB,GAAsB;IAChD;QACI,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACZ,IAAI,EAAE;gBACF,QAAQ,EAAE;oBACN,SAAS;iBACZ;aACJ;SACJ;QACD,OAAO,EAAE;YACL;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,sBAAsB;gBACnC,MAAM,EAAE,kBAAkB;aAC7B;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,kBAAkB;aAC7B;YACD;gBACI,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,eAAe;gBAC5B,MAAM,EAAE,eAAe;aAC1B;YACD;gBACI,IAAI,EAAE,SAAS;gBACf,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,kBAAkB;aAC7B;YACD;gBACI,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,kBAAkB;gBAC/B,MAAM,EAAE,kBAAkB;aAC7B;SACJ;QACD,OAAO,EAAE,QAAQ;KACpB;CACJ,CAAC;AAEW,QAAA,aAAa,G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Q,EAAE;oBACN,SAAS;iBACZ;gBACD,SAAS,EAAE;oBACP,KAAK;oBACL,QAAQ;oBACR,QAAQ;iBACX;aACJ;SACJ;QACD,WAAW,EAAE,uBAAuB;KACvC;CACJ,CAAC"}
|
|
@@ -0,0 +1,244 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.Tiendanube = void 0;
|
|
4
|
+
const GenericFunctions_1 = require("./GenericFunctions");
|
|
5
|
+
const ProductDescription_1 = require("./ProductDescription");
|
|
6
|
+
const OrderDescription_1 = require("./OrderDescription");
|
|
7
|
+
const CustomerDescription_1 = require("./CustomerDescription");
|
|
8
|
+
const ExtraDescription_1 = require("./ExtraDescription");
|
|
9
|
+
class Tiendanube {
|
|
10
|
+
description = {
|
|
11
|
+
displayName: 'Tiendanube',
|
|
12
|
+
name: 'tiendanube',
|
|
13
|
+
icon: 'file:tiendanube.svg',
|
|
14
|
+
group: ['transform'],
|
|
15
|
+
version: 1,
|
|
16
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
17
|
+
description: 'Consume Tiendanube (Nuvemshop) API',
|
|
18
|
+
defaults: {
|
|
19
|
+
name: 'Tiendanube',
|
|
20
|
+
},
|
|
21
|
+
inputs: ['main'],
|
|
22
|
+
outputs: ['main'],
|
|
23
|
+
credentials: [
|
|
24
|
+
{
|
|
25
|
+
name: 'tiendanubeApi',
|
|
26
|
+
required: true,
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
properties: [
|
|
30
|
+
{
|
|
31
|
+
displayName: 'Resource',
|
|
32
|
+
name: 'resource',
|
|
33
|
+
type: 'options',
|
|
34
|
+
noDataExpression: true,
|
|
35
|
+
options: [
|
|
36
|
+
{
|
|
37
|
+
name: 'Product',
|
|
38
|
+
value: 'product',
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: 'Order',
|
|
42
|
+
value: 'order',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Customer',
|
|
46
|
+
value: 'customer',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Category',
|
|
50
|
+
value: 'category',
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Coupon',
|
|
54
|
+
value: 'coupon',
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: 'Product Image',
|
|
58
|
+
value: 'productImage',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
name: 'Product Variant',
|
|
62
|
+
value: 'productVariant',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
name: 'Abandoned Checkout',
|
|
66
|
+
value: 'checkout',
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
name: 'Location',
|
|
70
|
+
value: 'location',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'Cart',
|
|
74
|
+
value: 'cart',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: 'Page',
|
|
78
|
+
value: 'page',
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
default: 'product',
|
|
82
|
+
},
|
|
83
|
+
...ProductDescription_1.productOperations,
|
|
84
|
+
...ProductDescription_1.productFields,
|
|
85
|
+
...OrderDescription_1.orderOperations,
|
|
86
|
+
...OrderDescription_1.orderFields,
|
|
87
|
+
...CustomerDescription_1.customerOperations,
|
|
88
|
+
...CustomerDescription_1.customerFields,
|
|
89
|
+
...ExtraDescription_1.extraOperations,
|
|
90
|
+
...ExtraDescription_1.extraFields,
|
|
91
|
+
],
|
|
92
|
+
};
|
|
93
|
+
async execute() {
|
|
94
|
+
const items = this.getInputData();
|
|
95
|
+
const returnData = [];
|
|
96
|
+
const length = items.length;
|
|
97
|
+
let responseData;
|
|
98
|
+
const resource = this.getNodeParameter('resource', 0);
|
|
99
|
+
const operation = this.getNodeParameter('operation', 0);
|
|
100
|
+
for (let i = 0; i < length; i++) {
|
|
101
|
+
try {
|
|
102
|
+
if (resource === 'product') {
|
|
103
|
+
if (operation === 'create') {
|
|
104
|
+
const name = this.getNodeParameter('name', i);
|
|
105
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
106
|
+
const body = {
|
|
107
|
+
name,
|
|
108
|
+
...additionalFields,
|
|
109
|
+
};
|
|
110
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'POST', 'products', body);
|
|
111
|
+
}
|
|
112
|
+
if (operation === 'get') {
|
|
113
|
+
const productId = this.getNodeParameter('productId', i);
|
|
114
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', `products/${productId}`);
|
|
115
|
+
}
|
|
116
|
+
if (operation === 'getAll') {
|
|
117
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', 'products');
|
|
118
|
+
}
|
|
119
|
+
if (operation === 'delete') {
|
|
120
|
+
const productId = this.getNodeParameter('productId', i);
|
|
121
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'DELETE', `products/${productId}`);
|
|
122
|
+
responseData = { success: true };
|
|
123
|
+
}
|
|
124
|
+
if (operation === 'update') {
|
|
125
|
+
const productId = this.getNodeParameter('productId', i);
|
|
126
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
127
|
+
const body = {
|
|
128
|
+
...additionalFields,
|
|
129
|
+
};
|
|
130
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'PUT', `products/${productId}`, body);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
else if (resource === 'order') {
|
|
134
|
+
if (operation === 'get') {
|
|
135
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
136
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', `orders/${orderId}`);
|
|
137
|
+
}
|
|
138
|
+
if (operation === 'getAll') {
|
|
139
|
+
const returnAll = this.getNodeParameter('returnAll', i);
|
|
140
|
+
const qs = {};
|
|
141
|
+
if (!returnAll) {
|
|
142
|
+
qs.limit = this.getNodeParameter('limit', i);
|
|
143
|
+
}
|
|
144
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', 'orders', {}, qs);
|
|
145
|
+
}
|
|
146
|
+
if (operation === 'update') {
|
|
147
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
148
|
+
const body = {};
|
|
149
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'PUT', `orders/${orderId}`, body);
|
|
150
|
+
}
|
|
151
|
+
if (['open', 'close', 'cancel'].includes(operation)) {
|
|
152
|
+
const orderId = this.getNodeParameter('orderId', i);
|
|
153
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'POST', `orders/${orderId}/${operation}`);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
else if (resource === 'customer') {
|
|
157
|
+
if (operation === 'create') {
|
|
158
|
+
const name = this.getNodeParameter('name', i);
|
|
159
|
+
const email = this.getNodeParameter('email', i);
|
|
160
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
161
|
+
const body = {
|
|
162
|
+
name,
|
|
163
|
+
email,
|
|
164
|
+
...additionalFields,
|
|
165
|
+
};
|
|
166
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'POST', 'customers', body);
|
|
167
|
+
}
|
|
168
|
+
if (operation === 'get') {
|
|
169
|
+
const customerId = this.getNodeParameter('customerId', i);
|
|
170
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', `customers/${customerId}`);
|
|
171
|
+
}
|
|
172
|
+
if (operation === 'getAll') {
|
|
173
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', 'customers');
|
|
174
|
+
}
|
|
175
|
+
if (operation === 'delete') {
|
|
176
|
+
const customerId = this.getNodeParameter('customerId', i);
|
|
177
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'DELETE', `customers/${customerId}`);
|
|
178
|
+
responseData = { success: true };
|
|
179
|
+
}
|
|
180
|
+
if (operation === 'update') {
|
|
181
|
+
const customerId = this.getNodeParameter('customerId', i);
|
|
182
|
+
const additionalFields = this.getNodeParameter('additionalFields', i);
|
|
183
|
+
const body = {
|
|
184
|
+
...additionalFields,
|
|
185
|
+
};
|
|
186
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'PUT', `customers/${customerId}`, body);
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
else {
|
|
190
|
+
// Generic handler for 'extra' resources
|
|
191
|
+
const endpointMap = {
|
|
192
|
+
'category': 'categories',
|
|
193
|
+
'coupon': 'coupons',
|
|
194
|
+
'productImage': 'products/{productId}/images',
|
|
195
|
+
'productVariant': 'products/{productId}/variants',
|
|
196
|
+
'checkout': 'checkouts',
|
|
197
|
+
'location': 'shipping_carriers',
|
|
198
|
+
'cart': 'carts',
|
|
199
|
+
'page': 'pages',
|
|
200
|
+
};
|
|
201
|
+
let endpoint = endpointMap[resource];
|
|
202
|
+
const id = this.getNodeParameter('id', i, '');
|
|
203
|
+
const jsonBody = this.getNodeParameter('jsonBody', i, {});
|
|
204
|
+
const productId = this.getNodeParameter('productId', i, '');
|
|
205
|
+
if (endpoint.includes('{productId}')) {
|
|
206
|
+
endpoint = endpoint.replace('{productId}', productId);
|
|
207
|
+
}
|
|
208
|
+
if (operation === 'getAll') {
|
|
209
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', endpoint);
|
|
210
|
+
}
|
|
211
|
+
if (operation === 'get') {
|
|
212
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', `${endpoint}/${id}`);
|
|
213
|
+
}
|
|
214
|
+
if (operation === 'create') {
|
|
215
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'POST', endpoint, jsonBody);
|
|
216
|
+
}
|
|
217
|
+
if (operation === 'update') {
|
|
218
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'PUT', `${endpoint}/${id}`, jsonBody);
|
|
219
|
+
}
|
|
220
|
+
if (operation === 'delete') {
|
|
221
|
+
responseData = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'DELETE', `${endpoint}/${id}`);
|
|
222
|
+
responseData = { success: true };
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
if (Array.isArray(responseData)) {
|
|
226
|
+
responseData.forEach((item) => returnData.push({ json: item }));
|
|
227
|
+
}
|
|
228
|
+
else if (responseData !== undefined) {
|
|
229
|
+
returnData.push({ json: responseData });
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
catch (error) {
|
|
233
|
+
if (this.continueOnFail()) {
|
|
234
|
+
returnData.push({ json: { error: error.message } });
|
|
235
|
+
continue;
|
|
236
|
+
}
|
|
237
|
+
throw error;
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return [returnData];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
exports.Tiendanube = Tiendanube;
|
|
244
|
+
//# sourceMappingURL=Tiendanube.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Tiendanube.node.js","sourceRoot":"","sources":["../../../nodes/Tiendanube/Tiendanube.node.ts"],"names":[],"mappings":";;;AAQA,yDAE4B;AAE5B,6DAG8B;AAE9B,yDAG4B;AAE5B,+DAG+B;AAE/B,yDAG4B;AAE5B,MAAa,UAAU;IACnB,WAAW,GAAyB;QAChC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,YAAY;QAClB,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,CAAC,WAAW,CAAC;QACpB,OAAO,EAAE,CAAC;QACV,QAAQ,EAAE,8DAA8D;QACxE,WAAW,EAAE,oCAAoC;QACjD,QAAQ,EAAE;YACN,IAAI,EAAE,YAAY;SACrB;QACD,MAAM,EAAE,CAAC,MAAM,CAAC;QAChB,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE;YACT;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
exports.TiendanubeTrigger = void 0;
|
|
4
|
+
const GenericFunctions_1 = require("../Tiendanube/GenericFunctions");
|
|
5
|
+
class TiendanubeTrigger {
|
|
6
|
+
description = {
|
|
7
|
+
displayName: 'Tiendanube Trigger',
|
|
8
|
+
name: 'tiendanubeTrigger',
|
|
9
|
+
icon: 'file:tiendanube.svg',
|
|
10
|
+
group: ['trigger'],
|
|
11
|
+
version: 1,
|
|
12
|
+
description: 'Handle Tiendanube Webhooks',
|
|
13
|
+
defaults: {
|
|
14
|
+
name: 'Tiendanube Trigger',
|
|
15
|
+
},
|
|
16
|
+
inputs: [],
|
|
17
|
+
outputs: ['main'],
|
|
18
|
+
credentials: [
|
|
19
|
+
{
|
|
20
|
+
name: 'tiendanubeApi',
|
|
21
|
+
required: true,
|
|
22
|
+
},
|
|
23
|
+
],
|
|
24
|
+
webhooks: [
|
|
25
|
+
{
|
|
26
|
+
name: 'default',
|
|
27
|
+
httpMethod: 'POST',
|
|
28
|
+
responseMode: 'onReceived',
|
|
29
|
+
path: 'webhook',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
properties: [
|
|
33
|
+
{
|
|
34
|
+
displayName: 'Event',
|
|
35
|
+
name: 'event',
|
|
36
|
+
type: 'options',
|
|
37
|
+
required: true,
|
|
38
|
+
default: 'order/created',
|
|
39
|
+
description: 'The event to listen to',
|
|
40
|
+
options: [
|
|
41
|
+
{
|
|
42
|
+
name: 'Order Created',
|
|
43
|
+
value: 'order/created',
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Order Updated',
|
|
47
|
+
value: 'order/updated',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Product Created',
|
|
51
|
+
value: 'product/created',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
name: 'Product Updated',
|
|
55
|
+
value: 'product/updated',
|
|
56
|
+
},
|
|
57
|
+
{
|
|
58
|
+
name: 'Product Deleted',
|
|
59
|
+
value: 'product/deleted',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Customer Created',
|
|
63
|
+
value: 'customer/created',
|
|
64
|
+
},
|
|
65
|
+
{
|
|
66
|
+
name: 'Customer Updated',
|
|
67
|
+
value: 'customer/updated',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
name: 'Checkout Created',
|
|
71
|
+
value: 'checkout/created',
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: 'Checkout Updated',
|
|
75
|
+
value: 'checkout/updated',
|
|
76
|
+
},
|
|
77
|
+
],
|
|
78
|
+
},
|
|
79
|
+
],
|
|
80
|
+
};
|
|
81
|
+
webhookMethods = {
|
|
82
|
+
default: {
|
|
83
|
+
async checkExists() {
|
|
84
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
85
|
+
const event = this.getNodeParameter('event');
|
|
86
|
+
// Get all webhooks to check if ours exists
|
|
87
|
+
const webhooks = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', 'webhooks');
|
|
88
|
+
for (const webhook of webhooks) {
|
|
89
|
+
if (webhook.url === webhookUrl && webhook.event === event) {
|
|
90
|
+
return true;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return false;
|
|
94
|
+
},
|
|
95
|
+
async create() {
|
|
96
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
97
|
+
const event = this.getNodeParameter('event');
|
|
98
|
+
const body = {
|
|
99
|
+
url: webhookUrl,
|
|
100
|
+
event: event,
|
|
101
|
+
};
|
|
102
|
+
await GenericFunctions_1.tiendanubeApiRequest.call(this, 'POST', 'webhooks', body);
|
|
103
|
+
return true;
|
|
104
|
+
},
|
|
105
|
+
async delete() {
|
|
106
|
+
const webhookUrl = this.getNodeWebhookUrl('default');
|
|
107
|
+
const event = this.getNodeParameter('event');
|
|
108
|
+
const webhooks = await GenericFunctions_1.tiendanubeApiRequest.call(this, 'GET', 'webhooks');
|
|
109
|
+
for (const webhook of webhooks) {
|
|
110
|
+
if (webhook.url === webhookUrl && webhook.event === event) {
|
|
111
|
+
await GenericFunctions_1.tiendanubeApiRequest.call(this, 'DELETE', `webhooks/${webhook.id}`);
|
|
112
|
+
return true;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
return false;
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
};
|
|
119
|
+
async webhook() {
|
|
120
|
+
const req = this.getRequestObject();
|
|
121
|
+
return {
|
|
122
|
+
workflowData: [
|
|
123
|
+
[
|
|
124
|
+
{
|
|
125
|
+
json: req.body,
|
|
126
|
+
},
|
|
127
|
+
],
|
|
128
|
+
],
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
exports.TiendanubeTrigger = TiendanubeTrigger;
|
|
133
|
+
//# sourceMappingURL=TiendanubeTrigger.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"TiendanubeTrigger.node.js","sourceRoot":"","sources":["../../../nodes/TiendanubeTrigger/TiendanubeTrigger.node.ts"],"names":[],"mappings":";;;AASA,qEAEwC;AAExC,MAAa,iBAAiB;IAC1B,WAAW,GAAyB;QAChC,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,mBAAmB;QACzB,IAAI,EAAE,qBAAqB;QAC3B,KAAK,EAAE,CAAC,SAAS,CAAC;QAClB,OAAO,EAAE,CAAC;QACV,WAAW,EAAE,4BAA4B;QACzC,QAAQ,EAAE;YACN,IAAI,EAAE,oBAAoB;SAC7B;QACD,MAAM,EAAE,EAAE;QACV,OAAO,EAAE,CAAC,MAAM,CAAC;QACjB,WAAW,EAAE;YACT;gBACI,IAAI,EAAE,eAAe;gBACrB,QAAQ,EAAE,IAAI;aACjB;SACJ;QACD,QAAQ,EAAE;YACN;gBACI,IAAI,EAAE,SAAS;gBACf,UAAU,EAAE,MAAM;gBAClB,YAAY,EAAE,YAAY;gBAC1B,IAAI,EAAE,SAAS;aAClB;SACJ;QACD,UAAU,EAAE;YACR;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