@solution25/n8n-nodes-shopware 1.4.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 +80 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.d.ts +16 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.js +78 -0
- package/dist/credentials/ShopwareOAuth2Api.credentials.js.map +1 -0
- package/dist/nodes/Shopware/Shopware.node.d.ts +4 -0
- package/dist/nodes/Shopware/Shopware.node.js +23 -0
- package/dist/nodes/Shopware/Shopware.node.js.map +1 -0
- package/dist/nodes/Shopware/Shopware.node.json +18 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.js +98 -0
- package/dist/nodes/Shopware/test/v1/node/customer/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.d.ts +6 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.js +44 -0
- package/dist/nodes/Shopware/test/v1/node/helpers.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.js +111 -0
- package/dist/nodes/Shopware/test/v1/node/order/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.d.ts +1 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.js +96 -0
- package/dist/nodes/Shopware/test/v1/node/product/getMany.test.js.map +1 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.d.ts +10 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.js +23 -0
- package/dist/nodes/Shopware/v1/ShopwareV1.node.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/category/Category.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.js +211 -0
- package/dist/nodes/Shopware/v1/actions/category/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/category/deleteCategory.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.d.ts +1 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.js +21 -0
- package/dist/nodes/Shopware/v1/actions/category/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/category/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.js +164 -0
- package/dist/nodes/Shopware/v1/actions/category/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/types.d.ts +19 -0
- package/dist/nodes/Shopware/v1/actions/category/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/category/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.js +120 -0
- package/dist/nodes/Shopware/v1/actions/category/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/customer/Customer.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.js +301 -0
- package/dist/nodes/Shopware/v1/actions/customer/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/customer/deleteCustomer.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.d.ts +4 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.js +30 -0
- package/dist/nodes/Shopware/v1/actions/customer/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/customer/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.js +319 -0
- package/dist/nodes/Shopware/v1/actions/customer/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.d.ts +54 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/customer/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.js +287 -0
- package/dist/nodes/Shopware/v1/actions/customer/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/fields.d.ts +5 -0
- package/dist/nodes/Shopware/v1/actions/fields.js +26 -0
- package/dist/nodes/Shopware/v1/actions/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/node.type.d.ts +9 -0
- package/dist/nodes/Shopware/v1/actions/node.type.js +3 -0
- package/dist/nodes/Shopware/v1/actions/node.type.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/order/Order.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.js +861 -0
- package/dist/nodes/Shopware/v1/actions/order/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/order/deleteOrder.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.js +25 -0
- package/dist/nodes/Shopware/v1/actions/order/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/order/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.js +226 -0
- package/dist/nodes/Shopware/v1/actions/order/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/types.d.ts +171 -0
- package/dist/nodes/Shopware/v1/actions/order/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/order/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.js +723 -0
- package/dist/nodes/Shopware/v1/actions/order/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.d.ts +8 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.js +98 -0
- package/dist/nodes/Shopware/v1/actions/product/Product.resource.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.js +335 -0
- package/dist/nodes/Shopware/v1/actions/product/create.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.js +47 -0
- package/dist/nodes/Shopware/v1/actions/product/deleteProduct.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.d.ts +7 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.js +33 -0
- package/dist/nodes/Shopware/v1/actions/product/fields.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.js +77 -0
- package/dist/nodes/Shopware/v1/actions/product/get.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.js +319 -0
- package/dist/nodes/Shopware/v1/actions/product/getMany.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/types.d.ts +66 -0
- package/dist/nodes/Shopware/v1/actions/product/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/product/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.d.ts +27 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.js +287 -0
- package/dist/nodes/Shopware/v1/actions/product/update.operation.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/router.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/router.js +78 -0
- package/dist/nodes/Shopware/v1/actions/router.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/types.d.ts +97 -0
- package/dist/nodes/Shopware/v1/actions/types.js +3 -0
- package/dist/nodes/Shopware/v1/actions/types.js.map +1 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.d.ts +2 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.js +93 -0
- package/dist/nodes/Shopware/v1/actions/versionDescription.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.d.ts +14 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.js +261 -0
- package/dist/nodes/Shopware/v1/helpers/handlers.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.d.ts +1 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.js +3 -0
- package/dist/nodes/Shopware/v1/helpers/interfaces.js.map +1 -0
- package/dist/nodes/Shopware/v1/helpers/utils.d.ts +16 -0
- package/dist/nodes/Shopware/v1/helpers/utils.js +354 -0
- package/dist/nodes/Shopware/v1/helpers/utils.js.map +1 -0
- package/dist/nodes/Shopware/v1/methods/index.d.ts +1 -0
- package/dist/nodes/Shopware/v1/methods/index.js +38 -0
- package/dist/nodes/Shopware/v1/methods/index.js.map +1 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.d.ts +18 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.js +143 -0
- package/dist/nodes/Shopware/v1/methods/loadOptions.js.map +1 -0
- package/dist/nodes/Shopware/v1/transport/index.d.ts +2 -0
- package/dist/nodes/Shopware/v1/transport/index.js +25 -0
- package/dist/nodes/Shopware/v1/transport/index.js.map +1 -0
- package/dist/package.json +63 -0
- package/dist/shopware.png +0 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +63 -0
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const transport_1 = require("../../transport");
|
|
7
|
+
const fields_1 = require("./fields");
|
|
8
|
+
const utils_1 = require("../../helpers/utils");
|
|
9
|
+
const properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Customer Number',
|
|
12
|
+
name: 'customerNumber',
|
|
13
|
+
type: 'string',
|
|
14
|
+
required: true,
|
|
15
|
+
default: '',
|
|
16
|
+
placeholder: 'e.g. 2a88d9b59d474...',
|
|
17
|
+
description: 'Unique customer number',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'First Name',
|
|
21
|
+
name: 'firstName',
|
|
22
|
+
type: 'string',
|
|
23
|
+
required: true,
|
|
24
|
+
default: '',
|
|
25
|
+
description: 'Customer first name',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
displayName: 'Last Name',
|
|
29
|
+
name: 'lastName',
|
|
30
|
+
type: 'string',
|
|
31
|
+
required: true,
|
|
32
|
+
default: '',
|
|
33
|
+
description: 'Customer last name',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Email',
|
|
37
|
+
name: 'email',
|
|
38
|
+
type: 'string',
|
|
39
|
+
required: true,
|
|
40
|
+
default: '',
|
|
41
|
+
placeholder: 'e.g. name@email.com',
|
|
42
|
+
description: 'Customer email',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Payment Method',
|
|
46
|
+
name: 'paymentMethod',
|
|
47
|
+
type: 'options',
|
|
48
|
+
required: true,
|
|
49
|
+
typeOptions: {
|
|
50
|
+
loadOptionsMethod: 'getPaymentMethods',
|
|
51
|
+
},
|
|
52
|
+
default: '',
|
|
53
|
+
description: 'Select the payment method from the list',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Language',
|
|
57
|
+
name: 'language',
|
|
58
|
+
type: 'options',
|
|
59
|
+
required: true,
|
|
60
|
+
typeOptions: {
|
|
61
|
+
loadOptionsMethod: 'getLanguages',
|
|
62
|
+
},
|
|
63
|
+
default: '',
|
|
64
|
+
description: 'Select the language from the list',
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
displayName: 'Salutation',
|
|
68
|
+
name: 'salutation',
|
|
69
|
+
type: 'options',
|
|
70
|
+
typeOptions: {
|
|
71
|
+
loadOptionsMethod: 'getSalutations',
|
|
72
|
+
},
|
|
73
|
+
default: '',
|
|
74
|
+
description: 'Select the salutation from the list',
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
displayName: 'Group',
|
|
78
|
+
name: 'group',
|
|
79
|
+
type: 'options',
|
|
80
|
+
required: true,
|
|
81
|
+
typeOptions: {
|
|
82
|
+
loadOptionsMethod: 'getCustomerGroups',
|
|
83
|
+
},
|
|
84
|
+
default: '',
|
|
85
|
+
description: 'Select the customer group from the list',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
displayName: 'Sales Channel',
|
|
89
|
+
name: 'salesChannel',
|
|
90
|
+
type: 'options',
|
|
91
|
+
required: true,
|
|
92
|
+
typeOptions: {
|
|
93
|
+
loadOptionsMethod: 'getSalesChannels',
|
|
94
|
+
},
|
|
95
|
+
default: '',
|
|
96
|
+
description: 'Select the sales channel from the list',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
displayName: 'Addresses',
|
|
100
|
+
name: 'addresses',
|
|
101
|
+
placeholder: 'Add Address',
|
|
102
|
+
type: 'fixedCollection',
|
|
103
|
+
typeOptions: {
|
|
104
|
+
multipleValues: true,
|
|
105
|
+
},
|
|
106
|
+
description: 'Customer addresses',
|
|
107
|
+
default: {},
|
|
108
|
+
options: [
|
|
109
|
+
{
|
|
110
|
+
name: 'address',
|
|
111
|
+
displayName: 'Address',
|
|
112
|
+
values: [
|
|
113
|
+
{
|
|
114
|
+
displayName: 'Country',
|
|
115
|
+
name: 'country',
|
|
116
|
+
type: 'options',
|
|
117
|
+
typeOptions: {
|
|
118
|
+
loadOptionsMethod: 'getCountries',
|
|
119
|
+
},
|
|
120
|
+
required: true,
|
|
121
|
+
default: '',
|
|
122
|
+
description: 'Choose the country from the list',
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'First Name',
|
|
126
|
+
name: 'firstName',
|
|
127
|
+
type: 'string',
|
|
128
|
+
required: true,
|
|
129
|
+
default: '',
|
|
130
|
+
description: 'Customer first name',
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
displayName: 'Last Name',
|
|
134
|
+
name: 'lastName',
|
|
135
|
+
type: 'string',
|
|
136
|
+
required: true,
|
|
137
|
+
default: '',
|
|
138
|
+
description: 'Customer last name',
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
displayName: 'City',
|
|
142
|
+
name: 'city',
|
|
143
|
+
type: 'string',
|
|
144
|
+
required: true,
|
|
145
|
+
default: '',
|
|
146
|
+
placeholder: 'e.g. München',
|
|
147
|
+
description: "Name of the customer's city",
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Street',
|
|
151
|
+
name: 'street',
|
|
152
|
+
type: 'string',
|
|
153
|
+
required: true,
|
|
154
|
+
default: '',
|
|
155
|
+
placeholder: 'e.g. Schillerstraße',
|
|
156
|
+
description: "Name of the customer's city",
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Set as Default Shipping Address',
|
|
160
|
+
name: 'defaultShippingAddress',
|
|
161
|
+
type: 'boolean',
|
|
162
|
+
default: false,
|
|
163
|
+
description: 'Whether to set the current address as default shipping address',
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
displayName: 'Set as Default Billing Address',
|
|
167
|
+
name: 'defaultBillingAddress',
|
|
168
|
+
type: 'boolean',
|
|
169
|
+
default: false,
|
|
170
|
+
description: 'Whether to set the current address as default billing address',
|
|
171
|
+
},
|
|
172
|
+
],
|
|
173
|
+
},
|
|
174
|
+
],
|
|
175
|
+
},
|
|
176
|
+
];
|
|
177
|
+
const displayOptions = {
|
|
178
|
+
show: {
|
|
179
|
+
resource: ['customer'],
|
|
180
|
+
operation: ['create'],
|
|
181
|
+
},
|
|
182
|
+
};
|
|
183
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, properties);
|
|
184
|
+
async function execute(items) {
|
|
185
|
+
const returnData = [];
|
|
186
|
+
for (let i = 0; i < items.length; i++) {
|
|
187
|
+
try {
|
|
188
|
+
let defaultShippingAddressId = null;
|
|
189
|
+
let defaultBillingAddressId = null;
|
|
190
|
+
const nodeAddresses = this.getNodeParameter('addresses', i).address;
|
|
191
|
+
const email = this.getNodeParameter('email', i);
|
|
192
|
+
if (email.indexOf('@') === -1) {
|
|
193
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Invalid email address', {
|
|
194
|
+
description: `The email address '${email}' in the 'email' field isn't valid`,
|
|
195
|
+
itemIndex: i,
|
|
196
|
+
});
|
|
197
|
+
}
|
|
198
|
+
if (!nodeAddresses || nodeAddresses.length === 0) {
|
|
199
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Missing default address', {
|
|
200
|
+
description: 'At least one address must be provided',
|
|
201
|
+
itemIndex: i,
|
|
202
|
+
});
|
|
203
|
+
}
|
|
204
|
+
let salutationId = this.getNodeParameter('salutation', i);
|
|
205
|
+
if (!salutationId) {
|
|
206
|
+
salutationId = await utils_1.getDefaultSalutationId.call(this);
|
|
207
|
+
}
|
|
208
|
+
const addresses = nodeAddresses.map((address) => {
|
|
209
|
+
const addressId = (0, utils_1.uuidv7)();
|
|
210
|
+
if (address.defaultShippingAddress) {
|
|
211
|
+
if (defaultShippingAddressId) {
|
|
212
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Duplicate default shipping address', {
|
|
213
|
+
description: 'Only one address can be a default shipping address',
|
|
214
|
+
itemIndex: i,
|
|
215
|
+
});
|
|
216
|
+
}
|
|
217
|
+
defaultShippingAddressId = addressId;
|
|
218
|
+
}
|
|
219
|
+
if (address.defaultBillingAddress) {
|
|
220
|
+
if (defaultBillingAddressId) {
|
|
221
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Duplicate default billing address', {
|
|
222
|
+
description: 'Only one address can be a default billing address',
|
|
223
|
+
itemIndex: i,
|
|
224
|
+
});
|
|
225
|
+
}
|
|
226
|
+
defaultBillingAddressId = addressId;
|
|
227
|
+
}
|
|
228
|
+
return {
|
|
229
|
+
id: addressId,
|
|
230
|
+
countryId: address.country,
|
|
231
|
+
firstName: address.firstName,
|
|
232
|
+
lastName: address.lastName,
|
|
233
|
+
city: address.city,
|
|
234
|
+
street: address.street,
|
|
235
|
+
salutationId
|
|
236
|
+
};
|
|
237
|
+
});
|
|
238
|
+
if (!defaultShippingAddressId) {
|
|
239
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Missing default shipping address', {
|
|
240
|
+
description: 'Customer must have a default shipping address',
|
|
241
|
+
itemIndex: i,
|
|
242
|
+
});
|
|
243
|
+
}
|
|
244
|
+
if (!defaultBillingAddressId) {
|
|
245
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), 'Missing default billing address', {
|
|
246
|
+
description: 'Customer must have a default billing address',
|
|
247
|
+
itemIndex: i,
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
const createBody = {
|
|
251
|
+
firstName: this.getNodeParameter('firstName', i),
|
|
252
|
+
lastName: this.getNodeParameter('lastName', i),
|
|
253
|
+
email,
|
|
254
|
+
customerNumber: this.getNodeParameter('customerNumber', i),
|
|
255
|
+
defaultPaymentMethodId: this.getNodeParameter('paymentMethod', i),
|
|
256
|
+
languageId: this.getNodeParameter('language', i),
|
|
257
|
+
salesChannelId: this.getNodeParameter('salesChannel', i),
|
|
258
|
+
salutationId,
|
|
259
|
+
groupId: this.getNodeParameter('group', i),
|
|
260
|
+
defaultShippingAddressId,
|
|
261
|
+
defaultBillingAddressId,
|
|
262
|
+
addresses,
|
|
263
|
+
};
|
|
264
|
+
const searchBody = {
|
|
265
|
+
fields: fields_1.customerFields,
|
|
266
|
+
includes: {
|
|
267
|
+
customer: fields_1.customerFields,
|
|
268
|
+
},
|
|
269
|
+
filter: [{ type: 'equals', field: 'customerNumber', value: createBody.customerNumber }],
|
|
270
|
+
};
|
|
271
|
+
for (const key in createBody) {
|
|
272
|
+
const typedKey = key;
|
|
273
|
+
if (Array.isArray(createBody[typedKey]) &&
|
|
274
|
+
createBody[typedKey].length === 0) {
|
|
275
|
+
delete createBody[typedKey];
|
|
276
|
+
}
|
|
277
|
+
else if (createBody[typedKey] === '') {
|
|
278
|
+
delete createBody[typedKey];
|
|
279
|
+
}
|
|
280
|
+
}
|
|
281
|
+
await transport_1.apiRequest.call(this, 'POST', `/customer`, createBody);
|
|
282
|
+
const response = await transport_1.apiRequest.call(this, 'POST', `/search/customer`, searchBody);
|
|
283
|
+
const executionData = this.helpers.constructExecutionMetaData((0, utils_1.wrapData)(response.data), {
|
|
284
|
+
itemData: { item: i },
|
|
285
|
+
});
|
|
286
|
+
returnData.push(...executionData);
|
|
287
|
+
}
|
|
288
|
+
catch (error) {
|
|
289
|
+
if (this.continueOnFail()) {
|
|
290
|
+
returnData.push({ json: { error: error.message } });
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
if (error instanceof n8n_workflow_1.NodeOperationError) {
|
|
294
|
+
throw error;
|
|
295
|
+
}
|
|
296
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
return returnData;
|
|
300
|
+
}
|
|
301
|
+
//# sourceMappingURL=create.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"create.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Shopware/v1/actions/customer/create.operation.ts"],"names":[],"mappings":";;;AAoMA,0BAiJC;AAjVD,+CAQsB;AAEtB,+CAA6C;AAC7C,qCAA0C;AAC1C,+CAA+E;AAE/E,MAAM,UAAU,GAAsB;IACrC;QACC,WAAW,EAAE,iBAAiB;QAC9B,IAAI,EAAE,gBAAgB;QACtB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,uBAAuB;QACpC,WAAW,EAAE,wBAAwB;KACrC;IACD;QACC,WAAW,EAAE,YAAY;QACzB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,qBAAqB;KAClC;IACD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,UAAU;QAChB,IAAI,EAAE,QAAQ;QACd,QAAQ,EAAE,IAAI;QACd,OAAO,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,EAAE,EAAE,CAAC,CAAC;gBACpD,SAAS;YACV,CAAC;YAED,IAAI,KAAK,YAAY,iCAAkB,EAAE,CAAC;gBACzC,MAAM,KAAK,CAAC;YACb,CAAC;YAED,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type INodeExecutionData, type INodeProperties, type IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
4
|
+
displayName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
7
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
8
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
9
|
+
description?: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
12
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
isNodeSetting?: boolean;
|
|
15
|
+
noDataExpression?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
18
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
19
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
20
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
21
|
+
requiresDataPath?: "single" | "multiple";
|
|
22
|
+
doNotInherit?: boolean;
|
|
23
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
24
|
+
ignoreValidationDuringExecution?: boolean;
|
|
25
|
+
allowArbitraryValues?: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
export declare function execute(this: IExecuteFunctions, items: INodeExecutionData[]): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const transport_1 = require("../../transport");
|
|
7
|
+
const utils_1 = require("../../helpers/utils");
|
|
8
|
+
const properties = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'Customer ID',
|
|
11
|
+
name: 'id',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: '',
|
|
14
|
+
placeholder: 'e.g. 2a88d9b59d474...',
|
|
15
|
+
required: true,
|
|
16
|
+
description: 'ID of the customer to delete. You can find the ID in the URL when viewing the customer in Shopware Admin (e.g. https://your-domain.com/admin#/sw/customer/detail/<customerId>).',
|
|
17
|
+
},
|
|
18
|
+
];
|
|
19
|
+
const displayOptions = {
|
|
20
|
+
show: {
|
|
21
|
+
resource: ['customer'],
|
|
22
|
+
operation: ['deleteCustomer'],
|
|
23
|
+
},
|
|
24
|
+
};
|
|
25
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, properties);
|
|
26
|
+
async function execute(items) {
|
|
27
|
+
const returnData = [];
|
|
28
|
+
for (let i = 0; i < items.length; i++) {
|
|
29
|
+
try {
|
|
30
|
+
const id = this.getNodeParameter('id', i);
|
|
31
|
+
await transport_1.apiRequest.call(this, 'DELETE', `/customer/${id}`);
|
|
32
|
+
const executionData = this.helpers.constructExecutionMetaData((0, utils_1.wrapData)({ success: true, id, message: `Customer ${id} deleted successfully` }), {
|
|
33
|
+
itemData: { item: i },
|
|
34
|
+
});
|
|
35
|
+
returnData.push(...executionData);
|
|
36
|
+
}
|
|
37
|
+
catch (error) {
|
|
38
|
+
if (this.continueOnFail()) {
|
|
39
|
+
returnData.push({ json: { error: error.message } });
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
return returnData;
|
|
46
|
+
}
|
|
47
|
+
//# sourceMappingURL=deleteCustomer.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"deleteCustomer.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Shopware/v1/actions/customer/deleteCustomer.operation.ts"],"names":[],"mappings":";;;AAiCA,0BA+BC;AAhED,+CAOsB;AACtB,+CAA6C;AAC7C,+CAA+C;AAE/C,MAAM,UAAU,GAAsB;IACrC;QACC,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,IAAI;QACd,WAAW,EACV,uLAAuL;KACxL;CACD,CAAC;AAEF,MAAM,cAAc,GAAG;IACtB,IAAI,EAAE;QACL,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,SAAS,EAAE,CAAC,gBAAgB,CAAC;KAC7B;CACD,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,mCAAoB,EAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAErE,KAAK,UAAU,OAAO,CAE5B,KAA2B;IAE3B,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACvC,IAAI,CAAC;YACJ,MAAM,EAAE,GAAG,IAAI,CAAC,gBAAgB,CAAC,IAAI,EAAE,CAAC,CAAW,CAAC;YAEpD,MAAM,sBAAU,CAAC,IAAI,CAAC,IAAI,EAAE,QAAQ,EAAE,aAAa,EAAE,EAAE,CAAC,CAAC;YAEzD,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,0BAA0B,CAC5D,IAAA,gBAAQ,EAAC,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE,OAAO,EAAE,YAAY,EAAE,uBAAuB,EAAE,CAAC,EAC/E;gBACC,QAAQ,EAAE,EAAE,IAAI,EAAE,CAAC,EAAE;aACrB,CACD,CAAC;YAEF,UAAU,CAAC,IAAI,CAAC,GAAG,aAAa,CAAC,CAAC;QACnC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YAChB,IAAI,IAAI,CAAC,cAAc,EAAE,EAAE,CAAC;gBAC3B,UAAU,CAAC,IAAI,CAAC,EAAE,IAAI,EAAE,EAAE,KAAK,EAAE,KAAK,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;gBACpD,SAAS;YACV,CAAC;YAED,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.countryOptionFields = exports.customerGroupOptionFields = exports.languageOptionFields = exports.customerFields = void 0;
|
|
4
|
+
exports.customerFields = [
|
|
5
|
+
'id',
|
|
6
|
+
'customerNumber',
|
|
7
|
+
'firstName',
|
|
8
|
+
'lastName',
|
|
9
|
+
'email',
|
|
10
|
+
'company',
|
|
11
|
+
'active',
|
|
12
|
+
'guest',
|
|
13
|
+
'birthday',
|
|
14
|
+
'createdAt',
|
|
15
|
+
'updatedAt',
|
|
16
|
+
'groupId',
|
|
17
|
+
'salesChannelId',
|
|
18
|
+
'languageId',
|
|
19
|
+
'salutationId',
|
|
20
|
+
'defaultBillingAddressId',
|
|
21
|
+
'defaultShippingAddressId',
|
|
22
|
+
'defaultPaymentMethodId',
|
|
23
|
+
'lastLogin',
|
|
24
|
+
'orderCount',
|
|
25
|
+
'orderTotalAmount',
|
|
26
|
+
];
|
|
27
|
+
exports.languageOptionFields = ['id', 'name'];
|
|
28
|
+
exports.customerGroupOptionFields = ['id', 'name'];
|
|
29
|
+
exports.countryOptionFields = ['id', 'name'];
|
|
30
|
+
//# sourceMappingURL=fields.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fields.js","sourceRoot":"","sources":["../../../../../../nodes/Shopware/v1/actions/customer/fields.ts"],"names":[],"mappings":";;;AAAa,QAAA,cAAc,GAAG;IAC7B,IAAI;IACJ,gBAAgB;IAChB,WAAW;IACX,UAAU;IACV,OAAO;IACP,SAAS;IACT,QAAQ;IACR,OAAO;IACP,UAAU;IACV,WAAW;IACX,WAAW;IACX,SAAS;IACT,gBAAgB;IAChB,YAAY;IACZ,cAAc;IACd,yBAAyB;IACzB,0BAA0B;IAC1B,wBAAwB;IACxB,WAAW;IACX,YAAY;IACZ,kBAAkB;CAClB,CAAC;AAEW,QAAA,oBAAoB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAEtC,QAAA,yBAAyB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;AAE3C,QAAA,mBAAmB,GAAG,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type INodeExecutionData, type INodeProperties, type IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
4
|
+
displayName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
7
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
8
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
9
|
+
description?: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
12
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
isNodeSetting?: boolean;
|
|
15
|
+
noDataExpression?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
18
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
19
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
20
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
21
|
+
requiresDataPath?: "single" | "multiple";
|
|
22
|
+
doNotInherit?: boolean;
|
|
23
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
24
|
+
ignoreValidationDuringExecution?: boolean;
|
|
25
|
+
allowArbitraryValues?: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
export declare function execute(this: IExecuteFunctions, items: INodeExecutionData[]): Promise<INodeExecutionData[]>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.description = void 0;
|
|
4
|
+
exports.execute = execute;
|
|
5
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
6
|
+
const transport_1 = require("../../transport");
|
|
7
|
+
const fields_1 = require("./fields");
|
|
8
|
+
const utils_1 = require("../../helpers/utils");
|
|
9
|
+
const properties = [
|
|
10
|
+
{
|
|
11
|
+
displayName: 'Customer ID',
|
|
12
|
+
name: 'id',
|
|
13
|
+
type: 'string',
|
|
14
|
+
default: '',
|
|
15
|
+
placeholder: 'e.g. 2a88d9b59d474...',
|
|
16
|
+
required: true,
|
|
17
|
+
description: 'ID of the customer to get. You can find the ID in the URL when viewing the customer in Shopware Admin (e.g. https://your-domain.com/admin#/sw/customer/detail/<customerId>).',
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
displayName: 'Filters',
|
|
21
|
+
name: 'filters',
|
|
22
|
+
type: 'collection',
|
|
23
|
+
placeholder: 'Add Filter',
|
|
24
|
+
default: {},
|
|
25
|
+
options: [
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Fields',
|
|
28
|
+
name: 'fields',
|
|
29
|
+
type: 'string',
|
|
30
|
+
default: '',
|
|
31
|
+
description: 'Fields the customer will return, formatted as a string of comma-separated values. By default all the fields are returned.',
|
|
32
|
+
},
|
|
33
|
+
]
|
|
34
|
+
}
|
|
35
|
+
];
|
|
36
|
+
const displayOptions = {
|
|
37
|
+
show: {
|
|
38
|
+
resource: ['customer'],
|
|
39
|
+
operation: ['get'],
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.description = (0, n8n_workflow_1.updateDisplayOptions)(displayOptions, properties);
|
|
43
|
+
async function execute(items) {
|
|
44
|
+
const returnData = [];
|
|
45
|
+
for (let i = 0; i < items.length; i++) {
|
|
46
|
+
try {
|
|
47
|
+
let fields = fields_1.customerFields;
|
|
48
|
+
const id = this.getNodeParameter('id', i);
|
|
49
|
+
const filters = this.getNodeParameter('filters', i);
|
|
50
|
+
const shrinkedFields = filters.fields;
|
|
51
|
+
if (shrinkedFields) {
|
|
52
|
+
fields = shrinkedFields.split(',').map((field) => field.trim());
|
|
53
|
+
}
|
|
54
|
+
const body = {
|
|
55
|
+
fields,
|
|
56
|
+
includes: {
|
|
57
|
+
customer: fields,
|
|
58
|
+
},
|
|
59
|
+
filter: [{ type: 'equals', field: 'id', value: id }],
|
|
60
|
+
};
|
|
61
|
+
const response = await transport_1.apiRequest.call(this, 'POST', `/search/customer`, body);
|
|
62
|
+
const executionData = this.helpers.constructExecutionMetaData((0, utils_1.wrapData)(response.data), {
|
|
63
|
+
itemData: { item: i },
|
|
64
|
+
});
|
|
65
|
+
returnData.push(...executionData);
|
|
66
|
+
}
|
|
67
|
+
catch (error) {
|
|
68
|
+
if (this.continueOnFail()) {
|
|
69
|
+
returnData.push({ json: { error: error.message } });
|
|
70
|
+
continue;
|
|
71
|
+
}
|
|
72
|
+
throw new n8n_workflow_1.NodeApiError(this.getNode(), error);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
return returnData;
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=get.operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get.operation.js","sourceRoot":"","sources":["../../../../../../nodes/Shopware/v1/actions/customer/get.operation.ts"],"names":[],"mappings":";;;AAmDA,0BA6CC;AAhGD,+CAOsB;AACtB,+CAA6C;AAC7C,qCAA0C;AAC1C,+CAA+C;AAE/C,MAAM,UAAU,GAAsB;IACrC;QACC,WAAW,EAAE,aAAa;QAC1B,IAAI,EAAE,IAAI;QACV,IAAI,EAAE,QAAQ;QACd,OAAO,EAAE,EAAE;QACX,WAAW,EAAE,uBAAuB;QACpC,QAAQ,EAAE,IAAI;QACd,WAAW,EACV,oLAAoL;KACrL;IACD;QACC,WAAW,EAAE,SAAS;QACtB,IAAI,EAAE,SAAS;QACf,IAAI,EAAE,YAAY;QAClB,WAAW,EAAE,YAAY;QACzB,OAAO,EAAE,EAAE;QACX,OAAO,EAAE;YACR;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EACV,2HAA2H;aAC5H;SACD;KACD;CACD,CAAC;AAEF,MAAM,cAAc,GAAG;IACtB,IAAI,EAAE;QACL,QAAQ,EAAE,CAAC,UAAU,CAAC;QACtB,SAAS,EAAE,CAAC,KAAK,CAAC;KAClB;CACD,CAAC;AAEW,QAAA,WAAW,GAAG,IAAA,mCAAoB,EAAC,cAAc,EAAE,UAAU,CAAC,CAAC;AAErE,KAAK,UAAU,OAAO,CAE5B,KAA2B;IAE3B,MAAM,UAAU,GAAyB,EAAE,CAAC;IAE5C,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,KAAK,C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AAE,EAAE,CAAC,CAAC;gBACpD,SAAS;YACV,CAAC;YAED,MAAM,IAAI,2BAAY,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,KAAmB,CAAC,CAAC;QAC7D,CAAC;IACF,CAAC;IAED,OAAO,UAAU,CAAC;AACnB,CAAC"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { type INodeExecutionData, type INodeProperties, type IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
export declare const description: {
|
|
3
|
+
displayOptions: import("n8n-workflow").IDisplayOptions;
|
|
4
|
+
displayName: string;
|
|
5
|
+
name: string;
|
|
6
|
+
type: import("n8n-workflow").NodePropertyTypes;
|
|
7
|
+
typeOptions?: import("n8n-workflow").INodePropertyTypeOptions;
|
|
8
|
+
default: import("n8n-workflow").NodeParameterValueType;
|
|
9
|
+
description?: string;
|
|
10
|
+
hint?: string;
|
|
11
|
+
disabledOptions?: import("n8n-workflow").IDisplayOptions;
|
|
12
|
+
options?: Array<import("n8n-workflow").INodePropertyOptions | INodeProperties | import("n8n-workflow").INodePropertyCollection>;
|
|
13
|
+
placeholder?: string;
|
|
14
|
+
isNodeSetting?: boolean;
|
|
15
|
+
noDataExpression?: boolean;
|
|
16
|
+
required?: boolean;
|
|
17
|
+
routing?: import("n8n-workflow").INodePropertyRouting;
|
|
18
|
+
credentialTypes?: Array<"extends:oAuth2Api" | "extends:oAuth1Api" | "has:authenticate" | "has:genericAuth">;
|
|
19
|
+
extractValue?: import("n8n-workflow").INodePropertyValueExtractor;
|
|
20
|
+
modes?: import("n8n-workflow").INodePropertyMode[];
|
|
21
|
+
requiresDataPath?: "single" | "multiple";
|
|
22
|
+
doNotInherit?: boolean;
|
|
23
|
+
validateType?: import("n8n-workflow").FieldType;
|
|
24
|
+
ignoreValidationDuringExecution?: boolean;
|
|
25
|
+
allowArbitraryValues?: boolean;
|
|
26
|
+
}[];
|
|
27
|
+
export declare function execute(this: IExecuteFunctions, items: INodeExecutionData[]): Promise<INodeExecutionData[]>;
|