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,150 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INodeProperties,
|
|
3
|
+
} from 'n8n-workflow';
|
|
4
|
+
|
|
5
|
+
export const customerOperations: INodeProperties[] = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: [
|
|
14
|
+
'customer',
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Create',
|
|
21
|
+
value: 'create',
|
|
22
|
+
description: 'Create a customer',
|
|
23
|
+
action: 'Create a customer',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Delete',
|
|
27
|
+
value: 'delete',
|
|
28
|
+
description: 'Delete a customer',
|
|
29
|
+
action: 'Delete a customer',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Get',
|
|
33
|
+
value: 'get',
|
|
34
|
+
description: 'Get a customer',
|
|
35
|
+
action: 'Get a customer',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Get All',
|
|
39
|
+
value: 'getAll',
|
|
40
|
+
description: 'Get all customers',
|
|
41
|
+
action: 'Get all customers',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Update',
|
|
45
|
+
value: 'update',
|
|
46
|
+
description: 'Update a customer',
|
|
47
|
+
action: 'Update a customer',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
default: 'create',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export const customerFields: INodeProperties[] = [
|
|
55
|
+
/* -------------------------------------------------------------------------- */
|
|
56
|
+
/* customer:create */
|
|
57
|
+
/* -------------------------------------------------------------------------- */
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Name',
|
|
60
|
+
name: 'name',
|
|
61
|
+
type: 'string',
|
|
62
|
+
required: true,
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
resource: [
|
|
66
|
+
'customer',
|
|
67
|
+
],
|
|
68
|
+
operation: [
|
|
69
|
+
'create',
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
default: '',
|
|
74
|
+
description: 'The name of the customer',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Email',
|
|
78
|
+
name: 'email',
|
|
79
|
+
type: 'string',
|
|
80
|
+
required: true,
|
|
81
|
+
displayOptions: {
|
|
82
|
+
show: {
|
|
83
|
+
resource: [
|
|
84
|
+
'customer',
|
|
85
|
+
],
|
|
86
|
+
operation: [
|
|
87
|
+
'create',
|
|
88
|
+
],
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
default: '',
|
|
92
|
+
description: 'The email of the customer',
|
|
93
|
+
},
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Additional Fields',
|
|
96
|
+
name: 'additionalFields',
|
|
97
|
+
type: 'collection',
|
|
98
|
+
placeholder: 'Add Field',
|
|
99
|
+
default: {},
|
|
100
|
+
displayOptions: {
|
|
101
|
+
show: {
|
|
102
|
+
resource: [
|
|
103
|
+
'customer',
|
|
104
|
+
],
|
|
105
|
+
operation: [
|
|
106
|
+
'create',
|
|
107
|
+
'update',
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
},
|
|
111
|
+
options: [
|
|
112
|
+
{
|
|
113
|
+
displayName: 'Identification',
|
|
114
|
+
name: 'identification',
|
|
115
|
+
type: 'string',
|
|
116
|
+
default: '',
|
|
117
|
+
description: 'Document number / ID',
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
displayName: 'Phone',
|
|
121
|
+
name: 'phone',
|
|
122
|
+
type: 'string',
|
|
123
|
+
default: '',
|
|
124
|
+
},
|
|
125
|
+
],
|
|
126
|
+
},
|
|
127
|
+
/* -------------------------------------------------------------------------- */
|
|
128
|
+
/* customer:get/delete */
|
|
129
|
+
/* -------------------------------------------------------------------------- */
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Customer ID',
|
|
132
|
+
name: 'customerId',
|
|
133
|
+
type: 'string',
|
|
134
|
+
required: true,
|
|
135
|
+
default: '',
|
|
136
|
+
displayOptions: {
|
|
137
|
+
show: {
|
|
138
|
+
resource: [
|
|
139
|
+
'customer',
|
|
140
|
+
],
|
|
141
|
+
operation: [
|
|
142
|
+
'get',
|
|
143
|
+
'delete',
|
|
144
|
+
'update',
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
},
|
|
148
|
+
description: 'The ID of the customer',
|
|
149
|
+
},
|
|
150
|
+
];
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INodeProperties,
|
|
3
|
+
} from 'n8n-workflow';
|
|
4
|
+
|
|
5
|
+
export const extraOperations: INodeProperties[] = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: [
|
|
14
|
+
'category',
|
|
15
|
+
'coupon',
|
|
16
|
+
'productImage',
|
|
17
|
+
'productVariant',
|
|
18
|
+
'checkout',
|
|
19
|
+
'location',
|
|
20
|
+
'cart',
|
|
21
|
+
'page',
|
|
22
|
+
],
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
options: [
|
|
26
|
+
{
|
|
27
|
+
name: 'Get All',
|
|
28
|
+
value: 'getAll',
|
|
29
|
+
description: 'Get all items',
|
|
30
|
+
action: 'Get all items',
|
|
31
|
+
displayOptions: {
|
|
32
|
+
show: {
|
|
33
|
+
resource: ['category', 'coupon', 'productImage', 'productVariant', 'checkout', 'location', 'cart', 'page'],
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Get',
|
|
39
|
+
value: 'get',
|
|
40
|
+
description: 'Get an item',
|
|
41
|
+
action: 'Get an item',
|
|
42
|
+
displayOptions: {
|
|
43
|
+
show: {
|
|
44
|
+
resource: ['category', 'coupon', 'productImage', 'productVariant', 'checkout', 'location', 'cart', 'page'],
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Create',
|
|
50
|
+
value: 'create',
|
|
51
|
+
description: 'Create an item',
|
|
52
|
+
action: 'Create an item',
|
|
53
|
+
displayOptions: {
|
|
54
|
+
show: {
|
|
55
|
+
resource: ['category', 'coupon', 'productImage', 'productVariant', 'checkout', 'location', 'cart', 'page'],
|
|
56
|
+
},
|
|
57
|
+
},
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
name: 'Update',
|
|
61
|
+
value: 'update',
|
|
62
|
+
description: 'Update an item',
|
|
63
|
+
action: 'Update an item',
|
|
64
|
+
displayOptions: {
|
|
65
|
+
show: {
|
|
66
|
+
resource: ['category', 'coupon', 'productImage', 'productVariant', 'checkout', 'location', 'cart', 'page'],
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'Delete',
|
|
72
|
+
value: 'delete',
|
|
73
|
+
description: 'Delete an item',
|
|
74
|
+
action: 'Delete an item',
|
|
75
|
+
displayOptions: {
|
|
76
|
+
show: {
|
|
77
|
+
resource: ['category', 'coupon', 'productImage', 'productVariant', 'checkout', 'location', 'cart', 'page'],
|
|
78
|
+
},
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
],
|
|
82
|
+
default: 'getAll',
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
export const extraFields: INodeProperties[] = [
|
|
87
|
+
/* -------------------------------------------------------------------------- */
|
|
88
|
+
/* productImage / productVariant */
|
|
89
|
+
/* -------------------------------------------------------------------------- */
|
|
90
|
+
{
|
|
91
|
+
displayName: 'Product ID',
|
|
92
|
+
name: 'productId',
|
|
93
|
+
type: 'string',
|
|
94
|
+
required: true,
|
|
95
|
+
default: '',
|
|
96
|
+
displayOptions: {
|
|
97
|
+
show: {
|
|
98
|
+
resource: [
|
|
99
|
+
'productImage',
|
|
100
|
+
'productVariant',
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
description: 'The ID of the product the item belongs to',
|
|
105
|
+
},
|
|
106
|
+
/* -------------------------------------------------------------------------- */
|
|
107
|
+
/* Common ID Field */
|
|
108
|
+
/* -------------------------------------------------------------------------- */
|
|
109
|
+
{
|
|
110
|
+
displayName: 'ID',
|
|
111
|
+
name: 'id',
|
|
112
|
+
type: 'string',
|
|
113
|
+
default: '',
|
|
114
|
+
displayOptions: {
|
|
115
|
+
show: {
|
|
116
|
+
operation: [
|
|
117
|
+
'get',
|
|
118
|
+
'delete',
|
|
119
|
+
'update',
|
|
120
|
+
],
|
|
121
|
+
resource: [
|
|
122
|
+
'category',
|
|
123
|
+
'coupon',
|
|
124
|
+
'productImage',
|
|
125
|
+
'productVariant',
|
|
126
|
+
'checkout',
|
|
127
|
+
'location',
|
|
128
|
+
'cart',
|
|
129
|
+
'page',
|
|
130
|
+
],
|
|
131
|
+
},
|
|
132
|
+
},
|
|
133
|
+
description: 'The ID of the resource',
|
|
134
|
+
},
|
|
135
|
+
/* -------------------------------------------------------------------------- */
|
|
136
|
+
/* Common Name/JSON Body */
|
|
137
|
+
/* -------------------------------------------------------------------------- */
|
|
138
|
+
{
|
|
139
|
+
displayName: 'JSON Body',
|
|
140
|
+
name: 'jsonBody',
|
|
141
|
+
type: 'json',
|
|
142
|
+
default: '{}',
|
|
143
|
+
displayOptions: {
|
|
144
|
+
show: {
|
|
145
|
+
operation: [
|
|
146
|
+
'create',
|
|
147
|
+
'update',
|
|
148
|
+
],
|
|
149
|
+
resource: [
|
|
150
|
+
'category',
|
|
151
|
+
'coupon',
|
|
152
|
+
'productImage',
|
|
153
|
+
'productVariant',
|
|
154
|
+
'checkout',
|
|
155
|
+
'location',
|
|
156
|
+
'cart',
|
|
157
|
+
'page',
|
|
158
|
+
],
|
|
159
|
+
},
|
|
160
|
+
},
|
|
161
|
+
description: 'The properties to send formatted as JSON',
|
|
162
|
+
},
|
|
163
|
+
];
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import {
|
|
2
|
+
OptionsWithUri,
|
|
3
|
+
} from 'request';
|
|
4
|
+
|
|
5
|
+
import {
|
|
6
|
+
IExecuteFunctions,
|
|
7
|
+
IHookFunctions,
|
|
8
|
+
ILoadOptionsFunctions,
|
|
9
|
+
IDataObject,
|
|
10
|
+
NodeApiError,
|
|
11
|
+
JsonObject,
|
|
12
|
+
IRequestOptions,
|
|
13
|
+
} from 'n8n-workflow';
|
|
14
|
+
|
|
15
|
+
export async function tiendanubeApiRequest(
|
|
16
|
+
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
|
17
|
+
method: string,
|
|
18
|
+
resource: string,
|
|
19
|
+
body: any = {},
|
|
20
|
+
qs: IDataObject = {},
|
|
21
|
+
uri?: string,
|
|
22
|
+
option: IDataObject = {},
|
|
23
|
+
): Promise<any> {
|
|
24
|
+
const credentials = await this.getCredentials('tiendanubeApi');
|
|
25
|
+
|
|
26
|
+
let options: OptionsWithUri = {
|
|
27
|
+
headers: {
|
|
28
|
+
'Content-Type': 'application/json',
|
|
29
|
+
'User-Agent': credentials.userAgent as string || 'n8n-node',
|
|
30
|
+
'Authentication': `bearer ${credentials.accessToken}`,
|
|
31
|
+
},
|
|
32
|
+
method,
|
|
33
|
+
qs,
|
|
34
|
+
body,
|
|
35
|
+
uri: uri || `https://api.tiendanube.com/v1/${credentials.storeId}/${resource}`,
|
|
36
|
+
json: true,
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
options = Object.assign({}, options, option);
|
|
40
|
+
if (Object.keys(options.qs).length === 0) {
|
|
41
|
+
delete options.qs;
|
|
42
|
+
}
|
|
43
|
+
if (Object.keys(options.body).length === 0) {
|
|
44
|
+
delete options.body;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
try {
|
|
48
|
+
// Cast to any because n8n-workflow types might be strict about what request library options are allowed
|
|
49
|
+
return await this.helpers.request(options as any);
|
|
50
|
+
} catch (error) {
|
|
51
|
+
throw new NodeApiError(this.getNode(), error as JsonObject);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INodeProperties,
|
|
3
|
+
} from 'n8n-workflow';
|
|
4
|
+
|
|
5
|
+
export const orderOperations: INodeProperties[] = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: [
|
|
14
|
+
'order',
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Get',
|
|
21
|
+
value: 'get',
|
|
22
|
+
description: 'Get an order',
|
|
23
|
+
action: 'Get an order',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Get All',
|
|
27
|
+
value: 'getAll',
|
|
28
|
+
description: 'Get all orders',
|
|
29
|
+
action: 'Get all orders',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Update',
|
|
33
|
+
value: 'update',
|
|
34
|
+
description: 'Update an order',
|
|
35
|
+
action: 'Update an order',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Open',
|
|
39
|
+
value: 'open',
|
|
40
|
+
description: 'Open an order',
|
|
41
|
+
action: 'Open an order',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Close',
|
|
45
|
+
value: 'close',
|
|
46
|
+
description: 'Close an order',
|
|
47
|
+
action: 'Close an order',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Cancel',
|
|
51
|
+
value: 'cancel',
|
|
52
|
+
description: 'Cancel an order',
|
|
53
|
+
action: 'Cancel an order',
|
|
54
|
+
},
|
|
55
|
+
],
|
|
56
|
+
default: 'get',
|
|
57
|
+
},
|
|
58
|
+
];
|
|
59
|
+
|
|
60
|
+
export const orderFields: INodeProperties[] = [
|
|
61
|
+
/* -------------------------------------------------------------------------- */
|
|
62
|
+
/* order:get/update */
|
|
63
|
+
/* -------------------------------------------------------------------------- */
|
|
64
|
+
{
|
|
65
|
+
displayName: 'Order ID',
|
|
66
|
+
name: 'orderId',
|
|
67
|
+
type: 'string',
|
|
68
|
+
required: true,
|
|
69
|
+
default: '',
|
|
70
|
+
displayOptions: {
|
|
71
|
+
show: {
|
|
72
|
+
resource: [
|
|
73
|
+
'order',
|
|
74
|
+
],
|
|
75
|
+
operation: [
|
|
76
|
+
'get',
|
|
77
|
+
'update',
|
|
78
|
+
'open',
|
|
79
|
+
'close',
|
|
80
|
+
'cancel',
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
description: 'The ID of the order',
|
|
85
|
+
},
|
|
86
|
+
/* -------------------------------------------------------------------------- */
|
|
87
|
+
/* order:getAll */
|
|
88
|
+
/* -------------------------------------------------------------------------- */
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Return All',
|
|
91
|
+
name: 'returnAll',
|
|
92
|
+
type: 'boolean',
|
|
93
|
+
displayOptions: {
|
|
94
|
+
show: {
|
|
95
|
+
resource: [
|
|
96
|
+
'order',
|
|
97
|
+
],
|
|
98
|
+
operation: [
|
|
99
|
+
'getAll',
|
|
100
|
+
],
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
default: false,
|
|
104
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
105
|
+
},
|
|
106
|
+
{
|
|
107
|
+
displayName: 'Limit',
|
|
108
|
+
name: 'limit',
|
|
109
|
+
type: 'number',
|
|
110
|
+
displayOptions: {
|
|
111
|
+
show: {
|
|
112
|
+
resource: [
|
|
113
|
+
'order',
|
|
114
|
+
],
|
|
115
|
+
operation: [
|
|
116
|
+
'getAll',
|
|
117
|
+
],
|
|
118
|
+
returnAll: [
|
|
119
|
+
false,
|
|
120
|
+
],
|
|
121
|
+
},
|
|
122
|
+
},
|
|
123
|
+
typeOptions: {
|
|
124
|
+
minValue: 1,
|
|
125
|
+
maxValue: 500,
|
|
126
|
+
},
|
|
127
|
+
default: 50,
|
|
128
|
+
description: 'Max number of results to return',
|
|
129
|
+
},
|
|
130
|
+
];
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import {
|
|
2
|
+
INodeProperties,
|
|
3
|
+
} from 'n8n-workflow';
|
|
4
|
+
|
|
5
|
+
export const productOperations: INodeProperties[] = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: {
|
|
12
|
+
show: {
|
|
13
|
+
resource: [
|
|
14
|
+
'product',
|
|
15
|
+
],
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
options: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Create',
|
|
21
|
+
value: 'create',
|
|
22
|
+
description: 'Create a new product',
|
|
23
|
+
action: 'Create a product',
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
name: 'Delete',
|
|
27
|
+
value: 'delete',
|
|
28
|
+
description: 'Delete a product',
|
|
29
|
+
action: 'Delete a product',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Get',
|
|
33
|
+
value: 'get',
|
|
34
|
+
description: 'Get a product',
|
|
35
|
+
action: 'Get a product',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Get All',
|
|
39
|
+
value: 'getAll',
|
|
40
|
+
description: 'Get all products',
|
|
41
|
+
action: 'Get all products',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Update',
|
|
45
|
+
value: 'update',
|
|
46
|
+
description: 'Update a product',
|
|
47
|
+
action: 'Update a product',
|
|
48
|
+
},
|
|
49
|
+
],
|
|
50
|
+
default: 'create',
|
|
51
|
+
},
|
|
52
|
+
];
|
|
53
|
+
|
|
54
|
+
export const productFields: INodeProperties[] = [
|
|
55
|
+
/* -------------------------------------------------------------------------- */
|
|
56
|
+
/* product:create */
|
|
57
|
+
/* -------------------------------------------------------------------------- */
|
|
58
|
+
{
|
|
59
|
+
displayName: 'Name',
|
|
60
|
+
name: 'name',
|
|
61
|
+
type: 'json',
|
|
62
|
+
required: true,
|
|
63
|
+
displayOptions: {
|
|
64
|
+
show: {
|
|
65
|
+
resource: [
|
|
66
|
+
'product',
|
|
67
|
+
],
|
|
68
|
+
operation: [
|
|
69
|
+
'create',
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
default: '{"es": "Mi Producto"}',
|
|
74
|
+
description: 'The name of the product (can be a JSON object with languages)',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Additional Fields',
|
|
78
|
+
name: 'additionalFields',
|
|
79
|
+
type: 'collection',
|
|
80
|
+
placeholder: 'Add Field',
|
|
81
|
+
default: {},
|
|
82
|
+
displayOptions: {
|
|
83
|
+
show: {
|
|
84
|
+
resource: [
|
|
85
|
+
'product',
|
|
86
|
+
],
|
|
87
|
+
operation: [
|
|
88
|
+
'create',
|
|
89
|
+
'update',
|
|
90
|
+
],
|
|
91
|
+
},
|
|
92
|
+
},
|
|
93
|
+
options: [
|
|
94
|
+
{
|
|
95
|
+
displayName: 'Description',
|
|
96
|
+
name: 'description',
|
|
97
|
+
type: 'json',
|
|
98
|
+
default: '{"es": "Descripción..."}',
|
|
99
|
+
description: 'Product description',
|
|
100
|
+
},
|
|
101
|
+
{
|
|
102
|
+
displayName: 'Handle',
|
|
103
|
+
name: 'handle',
|
|
104
|
+
type: 'json',
|
|
105
|
+
default: '{"es": "mi-producto"}',
|
|
106
|
+
description: 'Product handle/slug',
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Brand',
|
|
110
|
+
name: 'brand',
|
|
111
|
+
type: 'string',
|
|
112
|
+
default: '',
|
|
113
|
+
},
|
|
114
|
+
],
|
|
115
|
+
},
|
|
116
|
+
/* -------------------------------------------------------------------------- */
|
|
117
|
+
/* product:get/delete */
|
|
118
|
+
/* -------------------------------------------------------------------------- */
|
|
119
|
+
{
|
|
120
|
+
displayName: 'Product ID',
|
|
121
|
+
name: 'productId',
|
|
122
|
+
type: 'string',
|
|
123
|
+
required: true,
|
|
124
|
+
default: '',
|
|
125
|
+
displayOptions: {
|
|
126
|
+
show: {
|
|
127
|
+
resource: [
|
|
128
|
+
'product',
|
|
129
|
+
],
|
|
130
|
+
operation: [
|
|
131
|
+
'get',
|
|
132
|
+
'delete',
|
|
133
|
+
'update',
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
description: 'The ID of the product',
|
|
138
|
+
},
|
|
139
|
+
];
|