@bambuser/n8n-nodes-livecommerce 0.1.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/LICENSE +21 -0
- package/README.md +188 -0
- package/dist/credentials/BambuserApi.credentials.js +55 -0
- package/dist/credentials/bambuser.svg +13 -0
- package/dist/lib/resolveOrigin.js +14 -0
- package/dist/nodes/BambuserCalls/BambuserCalls.node.js +295 -0
- package/dist/nodes/BambuserCalls/bambuser-live.svg +3 -0
- package/dist/nodes/BambuserProductCatalog/BambuserProductCatalog.node.js +236 -0
- package/dist/nodes/BambuserProductCatalog/bambuser-vod.svg +12 -0
- package/dist/nodes/BambuserShopperData/BambuserShopperData.node.js +170 -0
- package/dist/nodes/BambuserShopperData/bambuser-vod.svg +12 -0
- package/dist/nodes/BambuserShows/BambuserShows.node.js +1432 -0
- package/dist/nodes/BambuserShows/bambuser-live.svg +3 -0
- package/dist/nodes/BambuserVod/BambuserVod.node.js +704 -0
- package/dist/nodes/BambuserVod/bambuser-vod.svg +12 -0
- package/dist/nodes/BambuserWebhookTrigger/BambuserWebhookTrigger.node.js +114 -0
- package/dist/nodes/BambuserWebhookTrigger/bambuser-webhook.svg +8 -0
- package/package.json +77 -0
|
@@ -0,0 +1,236 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BambuserProductCatalog = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const resolveOrigin_1 = require("../../lib/resolveOrigin");
|
|
6
|
+
const filterEmpty = (obj) => Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== '' && v !== undefined && v !== null));
|
|
7
|
+
const productsPath = (baseUrl, feedId) => feedId
|
|
8
|
+
? `${baseUrl}/product-catalog/feeds/${encodeURIComponent(feedId)}/products`
|
|
9
|
+
: `${baseUrl}/product-catalog/products`;
|
|
10
|
+
const buildOperationHandlers = (ctx, baseUrl) => ({
|
|
11
|
+
'product:search': async (i) => ({
|
|
12
|
+
method: 'GET',
|
|
13
|
+
url: `${baseUrl}/product-catalog/products`,
|
|
14
|
+
qs: filterEmpty({
|
|
15
|
+
q: ctx.getNodeParameter('q', i, ''),
|
|
16
|
+
limit: ctx.getNodeParameter('limit', i, 10),
|
|
17
|
+
page: ctx.getNodeParameter('page', i, 1),
|
|
18
|
+
sort: ctx.getNodeParameter('sort', i, ''),
|
|
19
|
+
feedId: ctx.getNodeParameter('feedId', i, ''),
|
|
20
|
+
locale: ctx.getNodeParameter('locale', i, 'en-US'),
|
|
21
|
+
format: ctx.getNodeParameter('format', i, 'raw'),
|
|
22
|
+
unifyVariantTitles: ctx.getNodeParameter('unifyVariantTitles', i, false) || undefined,
|
|
23
|
+
groupBySignificantAttributes: ctx.getNodeParameter('groupBySignificantAttributes', i, false) || undefined,
|
|
24
|
+
}),
|
|
25
|
+
}),
|
|
26
|
+
'product:count': async (i) => ({
|
|
27
|
+
method: 'GET',
|
|
28
|
+
url: `${baseUrl}/product-catalog/products/count`,
|
|
29
|
+
qs: filterEmpty({
|
|
30
|
+
q: ctx.getNodeParameter('q', i, ''),
|
|
31
|
+
feedId: ctx.getNodeParameter('feedId', i, ''),
|
|
32
|
+
locale: ctx.getNodeParameter('locale', i, 'en-US'),
|
|
33
|
+
}),
|
|
34
|
+
}),
|
|
35
|
+
'product:get': async (i) => ({
|
|
36
|
+
method: 'GET',
|
|
37
|
+
url: `${productsPath(baseUrl, ctx.getNodeParameter('feedId', i, ''))}/${ctx.getNodeParameter('productId', i)}`,
|
|
38
|
+
}),
|
|
39
|
+
'product:create': async (i) => ({
|
|
40
|
+
method: 'POST',
|
|
41
|
+
url: productsPath(baseUrl, ctx.getNodeParameter('feedId', i, '')),
|
|
42
|
+
headers: { 'Content-Type': 'application/json' },
|
|
43
|
+
body: JSON.parse(ctx.getNodeParameter('productBody', i)),
|
|
44
|
+
}),
|
|
45
|
+
'product:update': async (i) => ({
|
|
46
|
+
method: 'PATCH',
|
|
47
|
+
url: `${productsPath(baseUrl, ctx.getNodeParameter('feedId', i, ''))}/${ctx.getNodeParameter('productId', i)}`,
|
|
48
|
+
headers: { 'Content-Type': 'application/json' },
|
|
49
|
+
body: JSON.parse(ctx.getNodeParameter('productBody', i)),
|
|
50
|
+
}),
|
|
51
|
+
'product:delete': async (i) => ({
|
|
52
|
+
method: 'DELETE',
|
|
53
|
+
url: `${productsPath(baseUrl, ctx.getNodeParameter('feedId', i, ''))}/${ctx.getNodeParameter('productId', i)}`,
|
|
54
|
+
}),
|
|
55
|
+
});
|
|
56
|
+
class BambuserProductCatalog {
|
|
57
|
+
description = {
|
|
58
|
+
displayName: 'Bambuser Product Catalog',
|
|
59
|
+
name: 'bambuserProductCatalog',
|
|
60
|
+
icon: 'file:bambuser-vod.svg',
|
|
61
|
+
group: ['transform'],
|
|
62
|
+
version: 1,
|
|
63
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
64
|
+
description: 'Manage products in the Bambuser product catalog',
|
|
65
|
+
defaults: { name: 'Bambuser Product Catalog' },
|
|
66
|
+
inputs: ['main'],
|
|
67
|
+
outputs: ['main'],
|
|
68
|
+
credentials: [{ name: 'bambuserApi', required: true }],
|
|
69
|
+
properties: [
|
|
70
|
+
// ── Resource ───────────────────────────────────────────────────────────
|
|
71
|
+
{
|
|
72
|
+
displayName: 'Resource',
|
|
73
|
+
name: 'resource',
|
|
74
|
+
type: 'options',
|
|
75
|
+
noDataExpression: true,
|
|
76
|
+
options: [
|
|
77
|
+
{ name: 'Product', value: 'product' },
|
|
78
|
+
],
|
|
79
|
+
default: 'product',
|
|
80
|
+
},
|
|
81
|
+
// ── Operation ─────────────────────────────────────────────────────────
|
|
82
|
+
{
|
|
83
|
+
displayName: 'Operation',
|
|
84
|
+
name: 'operation',
|
|
85
|
+
type: 'options',
|
|
86
|
+
noDataExpression: true,
|
|
87
|
+
displayOptions: { show: { resource: ['product'] } },
|
|
88
|
+
options: [
|
|
89
|
+
{ name: 'Count', value: 'count', action: 'Count products matching a search query' },
|
|
90
|
+
{ name: 'Create', value: 'create', action: 'Create a product in the catalog' },
|
|
91
|
+
{ name: 'Delete', value: 'delete', action: 'Delete a product from the catalog' },
|
|
92
|
+
{ name: 'Get', value: 'get', action: 'Get a product by ID' },
|
|
93
|
+
{ name: 'Search', value: 'search', action: 'Search and list products' },
|
|
94
|
+
{ name: 'Update', value: 'update', action: 'Update a product in the catalog' },
|
|
95
|
+
],
|
|
96
|
+
default: 'search',
|
|
97
|
+
},
|
|
98
|
+
// ── productId ──────────────────────────────────────────────────────────
|
|
99
|
+
{
|
|
100
|
+
displayName: 'Product ID',
|
|
101
|
+
name: 'productId',
|
|
102
|
+
type: 'string',
|
|
103
|
+
required: true,
|
|
104
|
+
default: '',
|
|
105
|
+
displayOptions: { show: { resource: ['product'], operation: ['get', 'update', 'delete'] } },
|
|
106
|
+
},
|
|
107
|
+
// ── search query params ────────────────────────────────────────────────
|
|
108
|
+
{
|
|
109
|
+
displayName: 'Query',
|
|
110
|
+
name: 'q',
|
|
111
|
+
type: 'string',
|
|
112
|
+
default: '',
|
|
113
|
+
description: 'Free-text search query',
|
|
114
|
+
displayOptions: { show: { resource: ['product'], operation: ['search', 'count'] } },
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
displayName: 'Feed ID',
|
|
118
|
+
name: 'feedId',
|
|
119
|
+
type: 'string',
|
|
120
|
+
default: '',
|
|
121
|
+
description: 'Comma-separated feed IDs to scope the search',
|
|
122
|
+
displayOptions: { show: { resource: ['product'], operation: ['search', 'count'] } },
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
displayName: 'Feed ID',
|
|
126
|
+
name: 'feedId',
|
|
127
|
+
type: 'string',
|
|
128
|
+
default: '',
|
|
129
|
+
description: 'Optional. When set, scopes the operation to a specific feed (routes through /product-catalog/feeds/{feedId}/products). Leave empty to operate on the org-level catalog.',
|
|
130
|
+
displayOptions: { show: { resource: ['product'], operation: ['get', 'create', 'update', 'delete'] } },
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
displayName: 'Limit',
|
|
134
|
+
name: 'limit',
|
|
135
|
+
type: 'number',
|
|
136
|
+
description: 'Max number of results to return',
|
|
137
|
+
typeOptions: { minValue: 1, maxValue: 1000 },
|
|
138
|
+
default: 50,
|
|
139
|
+
displayOptions: { show: { resource: ['product'], operation: ['search'] } },
|
|
140
|
+
},
|
|
141
|
+
{
|
|
142
|
+
displayName: 'Page',
|
|
143
|
+
name: 'page',
|
|
144
|
+
type: 'number',
|
|
145
|
+
typeOptions: { minValue: 1 },
|
|
146
|
+
default: 1,
|
|
147
|
+
displayOptions: { show: { resource: ['product'], operation: ['search'] } },
|
|
148
|
+
},
|
|
149
|
+
{
|
|
150
|
+
displayName: 'Sort',
|
|
151
|
+
name: 'sort',
|
|
152
|
+
type: 'string',
|
|
153
|
+
default: '',
|
|
154
|
+
placeholder: 'title:asc',
|
|
155
|
+
description: 'Sort by field, optionally with :asc or :desc suffix',
|
|
156
|
+
displayOptions: { show: { resource: ['product'], operation: ['search'] } },
|
|
157
|
+
},
|
|
158
|
+
{
|
|
159
|
+
displayName: 'Locale',
|
|
160
|
+
name: 'locale',
|
|
161
|
+
type: 'string',
|
|
162
|
+
default: 'en-US',
|
|
163
|
+
displayOptions: { show: { resource: ['product'], operation: ['search', 'count'] } },
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
displayName: 'Format',
|
|
167
|
+
name: 'format',
|
|
168
|
+
type: 'options',
|
|
169
|
+
options: [
|
|
170
|
+
{ name: 'Raw', value: 'raw' },
|
|
171
|
+
{ name: 'psV1', value: 'psV1' },
|
|
172
|
+
],
|
|
173
|
+
default: 'raw',
|
|
174
|
+
displayOptions: { show: { resource: ['product'], operation: ['search'] } },
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
displayName: 'Unify Variant Titles',
|
|
178
|
+
name: 'unifyVariantTitles',
|
|
179
|
+
type: 'boolean',
|
|
180
|
+
default: false,
|
|
181
|
+
displayOptions: { show: { resource: ['product'], operation: ['search'] } },
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
displayName: 'Group by Significant Attributes',
|
|
185
|
+
name: 'groupBySignificantAttributes',
|
|
186
|
+
type: 'boolean',
|
|
187
|
+
default: false,
|
|
188
|
+
displayOptions: { show: { resource: ['product'], operation: ['search'] } },
|
|
189
|
+
},
|
|
190
|
+
// ── productBody (create / update) ──────────────────────────────────────
|
|
191
|
+
{
|
|
192
|
+
displayName: 'Product Data (JSON)',
|
|
193
|
+
name: 'productBody',
|
|
194
|
+
type: 'string',
|
|
195
|
+
required: true,
|
|
196
|
+
default: '{}',
|
|
197
|
+
placeholder: '{"title": "My Product", "uri": "https://example.com/product"}',
|
|
198
|
+
description: 'JSON object representing the product. Required fields for create: title, uri.',
|
|
199
|
+
typeOptions: { rows: 4 },
|
|
200
|
+
displayOptions: { show: { resource: ['product'], operation: ['create'] } },
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
displayName: 'Fields to Update (JSON)',
|
|
204
|
+
name: 'productBody',
|
|
205
|
+
type: 'string',
|
|
206
|
+
required: true,
|
|
207
|
+
default: '{}',
|
|
208
|
+
placeholder: '{"title": "Updated Title"}',
|
|
209
|
+
description: 'JSON object with fields to update. All fields are optional.',
|
|
210
|
+
typeOptions: { rows: 4 },
|
|
211
|
+
displayOptions: { show: { resource: ['product'], operation: ['update'] } },
|
|
212
|
+
},
|
|
213
|
+
],
|
|
214
|
+
usableAsTool: true,
|
|
215
|
+
};
|
|
216
|
+
async execute() {
|
|
217
|
+
const items = this.getInputData();
|
|
218
|
+
const credentials = await this.getCredentials('bambuserApi');
|
|
219
|
+
const origin = (0, resolveOrigin_1.resolveOrigin)(credentials.baseUrl, credentials.region);
|
|
220
|
+
const handlers = buildOperationHandlers(this, `${origin}/v1`);
|
|
221
|
+
const results = await Promise.all(items.map(async (_, i) => {
|
|
222
|
+
const resource = this.getNodeParameter('resource', i);
|
|
223
|
+
const operation = this.getNodeParameter('operation', i);
|
|
224
|
+
const key = `${resource}:${operation}`;
|
|
225
|
+
const handler = handlers[key];
|
|
226
|
+
if (!handler) {
|
|
227
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation "${operation}" for resource "${resource}"`, { itemIndex: i });
|
|
228
|
+
}
|
|
229
|
+
const requestOptions = await handler(i);
|
|
230
|
+
const responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'bambuserApi', requestOptions) ?? { success: true };
|
|
231
|
+
return { json: responseData };
|
|
232
|
+
}));
|
|
233
|
+
return [results];
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
exports.BambuserProductCatalog = BambuserProductCatalog;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 72">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="bvod-a">
|
|
4
|
+
<path d="M36.3354 72h-36V0h36z"/>
|
|
5
|
+
</clipPath>
|
|
6
|
+
<clipPath id="bvod-b">
|
|
7
|
+
<path d="M75.0005 72h-36V0h36z"/>
|
|
8
|
+
</clipPath>
|
|
9
|
+
</defs>
|
|
10
|
+
<circle cx="0.3354" cy="36" r="36" fill="#FB752B" clip-path="url(#bvod-a)"/>
|
|
11
|
+
<circle cx="39.0005" cy="36" r="36" fill="#FB752B" clip-path="url(#bvod-b)"/>
|
|
12
|
+
</svg>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BambuserShopperData = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const resolveOrigin_1 = require("../../lib/resolveOrigin");
|
|
6
|
+
const filterEmpty = (obj) => Object.fromEntries(Object.entries(obj).filter(([, v]) => v !== '' && v !== undefined && v !== null));
|
|
7
|
+
const buildOperationHandlers = (ctx, baseUrl) => ({
|
|
8
|
+
'shopperData:getMany': async (i) => ({
|
|
9
|
+
method: 'GET',
|
|
10
|
+
url: `${baseUrl}/shopper-data`,
|
|
11
|
+
qs: filterEmpty({
|
|
12
|
+
limit: ctx.getNodeParameter('limit', i, 25),
|
|
13
|
+
after: ctx.getNodeParameter('after', i, ''),
|
|
14
|
+
matchField: ctx.getNodeParameter('matchField', i, ''),
|
|
15
|
+
matchValue: ctx.getNodeParameter('matchValue', i, ''),
|
|
16
|
+
createdDateFrom: ctx.getNodeParameter('createdDateFrom', i, ''),
|
|
17
|
+
createdDateTo: ctx.getNodeParameter('createdDateTo', i, ''),
|
|
18
|
+
}),
|
|
19
|
+
}),
|
|
20
|
+
'shopperData:get': async (i) => ({
|
|
21
|
+
method: 'GET',
|
|
22
|
+
url: `${baseUrl}/shopper-data/${ctx.getNodeParameter('recordId', i)}`,
|
|
23
|
+
}),
|
|
24
|
+
'shopperData:deleteByFilter': async (i) => ({
|
|
25
|
+
method: 'DELETE',
|
|
26
|
+
url: `${baseUrl}/shopper-data`,
|
|
27
|
+
qs: filterEmpty({
|
|
28
|
+
matchField: ctx.getNodeParameter('matchField', i, ''),
|
|
29
|
+
matchValue: ctx.getNodeParameter('matchValue', i, ''),
|
|
30
|
+
createdDateFrom: ctx.getNodeParameter('createdDateFrom', i, ''),
|
|
31
|
+
createdDateTo: ctx.getNodeParameter('createdDateTo', i, ''),
|
|
32
|
+
}),
|
|
33
|
+
}),
|
|
34
|
+
'shopperData:delete': async (i) => ({
|
|
35
|
+
method: 'DELETE',
|
|
36
|
+
url: `${baseUrl}/shopper-data/${ctx.getNodeParameter('recordId', i)}`,
|
|
37
|
+
}),
|
|
38
|
+
});
|
|
39
|
+
class BambuserShopperData {
|
|
40
|
+
description = {
|
|
41
|
+
displayName: 'Bambuser Shopper Data',
|
|
42
|
+
name: 'bambuserShopperData',
|
|
43
|
+
icon: 'file:bambuser-vod.svg',
|
|
44
|
+
group: ['transform'],
|
|
45
|
+
version: 1,
|
|
46
|
+
subtitle: '={{$parameter["operation"] + ": " + $parameter["resource"]}}',
|
|
47
|
+
description: 'Manage GDPR shopper data records collected during Bambuser shows',
|
|
48
|
+
defaults: { name: 'Bambuser Shopper Data' },
|
|
49
|
+
inputs: ['main'],
|
|
50
|
+
outputs: ['main'],
|
|
51
|
+
credentials: [{ name: 'bambuserApi', required: true }],
|
|
52
|
+
properties: [
|
|
53
|
+
// ── Resource ───────────────────────────────────────────────────────────
|
|
54
|
+
{
|
|
55
|
+
displayName: 'Resource',
|
|
56
|
+
name: 'resource',
|
|
57
|
+
type: 'options',
|
|
58
|
+
noDataExpression: true,
|
|
59
|
+
options: [
|
|
60
|
+
{ name: 'Shopper Data', value: 'shopperData' },
|
|
61
|
+
],
|
|
62
|
+
default: 'shopperData',
|
|
63
|
+
},
|
|
64
|
+
// ── Operation ─────────────────────────────────────────────────────────
|
|
65
|
+
{
|
|
66
|
+
displayName: 'Operation',
|
|
67
|
+
name: 'operation',
|
|
68
|
+
type: 'options',
|
|
69
|
+
noDataExpression: true,
|
|
70
|
+
displayOptions: { show: { resource: ['shopperData'] } },
|
|
71
|
+
options: [
|
|
72
|
+
{ name: 'Delete', value: 'delete', action: 'Delete a shopper data record by ID' },
|
|
73
|
+
{ name: 'Delete by Filter', value: 'deleteByFilter', action: 'Delete shopper data records matching a filter gdpr erasure' },
|
|
74
|
+
{ name: 'Get', value: 'get', action: 'Get a shopper data record by ID' },
|
|
75
|
+
{ name: 'Get Many', value: 'getMany', action: 'List shopper data records' },
|
|
76
|
+
],
|
|
77
|
+
default: 'getMany',
|
|
78
|
+
},
|
|
79
|
+
// ── recordId ───────────────────────────────────────────────────────────
|
|
80
|
+
{
|
|
81
|
+
displayName: 'Record ID',
|
|
82
|
+
name: 'recordId',
|
|
83
|
+
type: 'string',
|
|
84
|
+
required: true,
|
|
85
|
+
default: '',
|
|
86
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['get', 'delete'] } },
|
|
87
|
+
},
|
|
88
|
+
// ── limit / after ──────────────────────────────────────────────────────
|
|
89
|
+
{
|
|
90
|
+
displayName: 'Limit',
|
|
91
|
+
name: 'limit',
|
|
92
|
+
type: 'number',
|
|
93
|
+
description: 'Max number of results to return',
|
|
94
|
+
typeOptions: { minValue: 1, maxValue: 100 },
|
|
95
|
+
default: 50,
|
|
96
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['getMany'] } },
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
displayName: 'After Cursor',
|
|
100
|
+
name: 'after',
|
|
101
|
+
type: 'string',
|
|
102
|
+
default: '',
|
|
103
|
+
description: 'Pagination cursor from the previous response',
|
|
104
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['getMany'] } },
|
|
105
|
+
},
|
|
106
|
+
// ── matchField / matchValue ────────────────────────────────────────────
|
|
107
|
+
{
|
|
108
|
+
displayName: 'Match Field',
|
|
109
|
+
name: 'matchField',
|
|
110
|
+
type: 'options',
|
|
111
|
+
options: [
|
|
112
|
+
{ name: 'None', value: '' },
|
|
113
|
+
{ name: 'Email', value: 'data.email' },
|
|
114
|
+
{ name: 'Phone', value: 'data.phone' },
|
|
115
|
+
],
|
|
116
|
+
default: '',
|
|
117
|
+
description: 'Filter records by this field. Must be set together with Match Value.',
|
|
118
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['getMany', 'deleteByFilter'] } },
|
|
119
|
+
},
|
|
120
|
+
{
|
|
121
|
+
displayName: 'Match Value',
|
|
122
|
+
name: 'matchValue',
|
|
123
|
+
type: 'string',
|
|
124
|
+
default: '',
|
|
125
|
+
description: 'Exact value to match against the selected Match Field',
|
|
126
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['getMany', 'deleteByFilter'] } },
|
|
127
|
+
},
|
|
128
|
+
// ── createdDateFrom / createdDateTo ────────────────────────────────────
|
|
129
|
+
{
|
|
130
|
+
displayName: 'Created Date From',
|
|
131
|
+
name: 'createdDateFrom',
|
|
132
|
+
type: 'string',
|
|
133
|
+
default: '',
|
|
134
|
+
placeholder: '2024-01-01T00:00:00Z',
|
|
135
|
+
description: 'Only include records created on or after this date',
|
|
136
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['getMany', 'deleteByFilter'] } },
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
displayName: 'Created Date To',
|
|
140
|
+
name: 'createdDateTo',
|
|
141
|
+
type: 'string',
|
|
142
|
+
default: '',
|
|
143
|
+
placeholder: '2024-12-31T23:59:59Z',
|
|
144
|
+
description: 'Only include records created before this date',
|
|
145
|
+
displayOptions: { show: { resource: ['shopperData'], operation: ['getMany', 'deleteByFilter'] } },
|
|
146
|
+
},
|
|
147
|
+
],
|
|
148
|
+
usableAsTool: true,
|
|
149
|
+
};
|
|
150
|
+
async execute() {
|
|
151
|
+
const items = this.getInputData();
|
|
152
|
+
const credentials = await this.getCredentials('bambuserApi');
|
|
153
|
+
const origin = (0, resolveOrigin_1.resolveOrigin)(credentials.baseUrl, credentials.region);
|
|
154
|
+
const handlers = buildOperationHandlers(this, `${origin}/v1`);
|
|
155
|
+
const results = await Promise.all(items.map(async (_, i) => {
|
|
156
|
+
const resource = this.getNodeParameter('resource', i);
|
|
157
|
+
const operation = this.getNodeParameter('operation', i);
|
|
158
|
+
const key = `${resource}:${operation}`;
|
|
159
|
+
const handler = handlers[key];
|
|
160
|
+
if (!handler) {
|
|
161
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown operation "${operation}" for resource "${resource}"`, { itemIndex: i });
|
|
162
|
+
}
|
|
163
|
+
const requestOptions = await handler(i);
|
|
164
|
+
const responseData = await this.helpers.httpRequestWithAuthentication.call(this, 'bambuserApi', requestOptions) ?? { success: true };
|
|
165
|
+
return { json: responseData };
|
|
166
|
+
}));
|
|
167
|
+
return [results];
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
exports.BambuserShopperData = BambuserShopperData;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 75 72">
|
|
2
|
+
<defs>
|
|
3
|
+
<clipPath id="bvod-a">
|
|
4
|
+
<path d="M36.3354 72h-36V0h36z"/>
|
|
5
|
+
</clipPath>
|
|
6
|
+
<clipPath id="bvod-b">
|
|
7
|
+
<path d="M75.0005 72h-36V0h36z"/>
|
|
8
|
+
</clipPath>
|
|
9
|
+
</defs>
|
|
10
|
+
<circle cx="0.3354" cy="36" r="36" fill="#FB752B" clip-path="url(#bvod-a)"/>
|
|
11
|
+
<circle cx="39.0005" cy="36" r="36" fill="#FB752B" clip-path="url(#bvod-b)"/>
|
|
12
|
+
</svg>
|