n8n-nodes-segment 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/LICENSE +46 -0
- package/README.md +419 -0
- package/dist/credentials/SegmentApi.credentials.d.ts +10 -0
- package/dist/credentials/SegmentApi.credentials.d.ts.map +1 -0
- package/dist/credentials/SegmentApi.credentials.js +88 -0
- package/dist/credentials/SegmentApi.credentials.js.map +1 -0
- package/dist/index.d.ts +4 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +26 -0
- package/dist/index.js.map +1 -0
- package/dist/nodes/Segment/Segment.node.d.ts +6 -0
- package/dist/nodes/Segment/Segment.node.d.ts.map +1 -0
- package/dist/nodes/Segment/Segment.node.js +283 -0
- package/dist/nodes/Segment/Segment.node.js.map +1 -0
- package/dist/nodes/Segment/SegmentTrigger.node.d.ts +6 -0
- package/dist/nodes/Segment/SegmentTrigger.node.d.ts.map +1 -0
- package/dist/nodes/Segment/SegmentTrigger.node.js +257 -0
- package/dist/nodes/Segment/SegmentTrigger.node.js.map +1 -0
- package/dist/nodes/Segment/actions/audiences/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/audiences/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/audiences/index.js +304 -0
- package/dist/nodes/Segment/actions/audiences/index.js.map +1 -0
- package/dist/nodes/Segment/actions/auditTrail/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/auditTrail/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/auditTrail/index.js +192 -0
- package/dist/nodes/Segment/actions/auditTrail/index.js.map +1 -0
- package/dist/nodes/Segment/actions/catalog/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/catalog/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/catalog/index.js +144 -0
- package/dist/nodes/Segment/actions/catalog/index.js.map +1 -0
- package/dist/nodes/Segment/actions/computedTraits/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/computedTraits/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/computedTraits/index.js +257 -0
- package/dist/nodes/Segment/actions/computedTraits/index.js.map +1 -0
- package/dist/nodes/Segment/actions/destinations/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/destinations/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/destinations/index.js +297 -0
- package/dist/nodes/Segment/actions/destinations/index.js.map +1 -0
- package/dist/nodes/Segment/actions/functions/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/functions/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/functions/index.js +389 -0
- package/dist/nodes/Segment/actions/functions/index.js.map +1 -0
- package/dist/nodes/Segment/actions/labels/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/labels/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/labels/index.js +221 -0
- package/dist/nodes/Segment/actions/labels/index.js.map +1 -0
- package/dist/nodes/Segment/actions/regulations/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/regulations/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/regulations/index.js +322 -0
- package/dist/nodes/Segment/actions/regulations/index.js.map +1 -0
- package/dist/nodes/Segment/actions/sources/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/sources/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/sources/index.js +371 -0
- package/dist/nodes/Segment/actions/sources/index.js.map +1 -0
- package/dist/nodes/Segment/actions/spaces/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/spaces/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/spaces/index.js +328 -0
- package/dist/nodes/Segment/actions/spaces/index.js.map +1 -0
- package/dist/nodes/Segment/actions/track/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/track/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/track/index.js +499 -0
- package/dist/nodes/Segment/actions/track/index.js.map +1 -0
- package/dist/nodes/Segment/actions/trackingPlans/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/trackingPlans/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/trackingPlans/index.js +340 -0
- package/dist/nodes/Segment/actions/trackingPlans/index.js.map +1 -0
- package/dist/nodes/Segment/actions/transformations/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/transformations/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/transformations/index.js +280 -0
- package/dist/nodes/Segment/actions/transformations/index.js.map +1 -0
- package/dist/nodes/Segment/actions/users/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/users/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/users/index.js +233 -0
- package/dist/nodes/Segment/actions/users/index.js.map +1 -0
- package/dist/nodes/Segment/actions/warehouses/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/warehouses/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/warehouses/index.js +313 -0
- package/dist/nodes/Segment/actions/warehouses/index.js.map +1 -0
- package/dist/nodes/Segment/actions/workspace/index.d.ts +5 -0
- package/dist/nodes/Segment/actions/workspace/index.d.ts.map +1 -0
- package/dist/nodes/Segment/actions/workspace/index.js +100 -0
- package/dist/nodes/Segment/actions/workspace/index.js.map +1 -0
- package/dist/nodes/Segment/constants/index.d.ts +23 -0
- package/dist/nodes/Segment/constants/index.d.ts.map +1 -0
- package/dist/nodes/Segment/constants/index.js +720 -0
- package/dist/nodes/Segment/constants/index.js.map +1 -0
- package/dist/nodes/Segment/segment.svg +6 -0
- package/dist/nodes/Segment/transport/index.d.ts +35 -0
- package/dist/nodes/Segment/transport/index.d.ts.map +1 -0
- package/dist/nodes/Segment/transport/index.js +127 -0
- package/dist/nodes/Segment/transport/index.js.map +1 -0
- package/dist/nodes/Segment/utils/index.d.ts +67 -0
- package/dist/nodes/Segment/utils/index.d.ts.map +1 -0
- package/dist/nodes/Segment/utils/index.js +216 -0
- package/dist/nodes/Segment/utils/index.js.map +1 -0
- package/package.json +73 -0
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Velocity BPA, LLC
|
|
4
|
+
* Licensed under the Business Source License 1.1
|
|
5
|
+
* Commercial use requires a separate commercial license.
|
|
6
|
+
* See LICENSE file for details.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.functionsFields = exports.functionsOperations = void 0;
|
|
10
|
+
exports.executeFunctions = executeFunctions;
|
|
11
|
+
const transport_1 = require("../../transport");
|
|
12
|
+
const utils_1 = require("../../utils");
|
|
13
|
+
exports.functionsOperations = [
|
|
14
|
+
{
|
|
15
|
+
displayName: 'Operation',
|
|
16
|
+
name: 'operation',
|
|
17
|
+
type: 'options',
|
|
18
|
+
noDataExpression: true,
|
|
19
|
+
displayOptions: {
|
|
20
|
+
show: {
|
|
21
|
+
resource: ['functions'],
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
options: [
|
|
25
|
+
{
|
|
26
|
+
name: 'Create',
|
|
27
|
+
value: 'create',
|
|
28
|
+
description: 'Create a source or destination function',
|
|
29
|
+
action: 'Create a function',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Delete',
|
|
33
|
+
value: 'delete',
|
|
34
|
+
description: 'Delete a function',
|
|
35
|
+
action: 'Delete a function',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Deploy',
|
|
39
|
+
value: 'deploy',
|
|
40
|
+
description: 'Deploy a function',
|
|
41
|
+
action: 'Deploy a function',
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
name: 'Get',
|
|
45
|
+
value: 'get',
|
|
46
|
+
description: 'Get a function by ID',
|
|
47
|
+
action: 'Get a function',
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Get Logs',
|
|
51
|
+
value: 'getLogs',
|
|
52
|
+
description: 'Get function execution logs',
|
|
53
|
+
action: 'Get function logs',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
name: 'Get Many',
|
|
57
|
+
value: 'getAll',
|
|
58
|
+
description: 'List all functions',
|
|
59
|
+
action: 'List all functions',
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
name: 'Update',
|
|
63
|
+
value: 'update',
|
|
64
|
+
description: 'Update function code',
|
|
65
|
+
action: 'Update a function',
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
default: 'getAll',
|
|
69
|
+
},
|
|
70
|
+
];
|
|
71
|
+
exports.functionsFields = [
|
|
72
|
+
// Function ID field
|
|
73
|
+
{
|
|
74
|
+
displayName: 'Function ID',
|
|
75
|
+
name: 'functionId',
|
|
76
|
+
type: 'string',
|
|
77
|
+
required: true,
|
|
78
|
+
default: '',
|
|
79
|
+
description: 'The unique identifier of the function',
|
|
80
|
+
displayOptions: {
|
|
81
|
+
show: {
|
|
82
|
+
resource: ['functions'],
|
|
83
|
+
operation: ['get', 'update', 'delete', 'deploy', 'getLogs'],
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
},
|
|
87
|
+
// Create fields
|
|
88
|
+
{
|
|
89
|
+
displayName: 'Function Type',
|
|
90
|
+
name: 'resourceType',
|
|
91
|
+
type: 'options',
|
|
92
|
+
required: true,
|
|
93
|
+
options: [
|
|
94
|
+
{
|
|
95
|
+
name: 'Destination Function',
|
|
96
|
+
value: 'DESTINATION',
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
name: 'Insert Function',
|
|
100
|
+
value: 'INSERT_DESTINATION',
|
|
101
|
+
},
|
|
102
|
+
{
|
|
103
|
+
name: 'Source Function',
|
|
104
|
+
value: 'SOURCE',
|
|
105
|
+
},
|
|
106
|
+
],
|
|
107
|
+
default: 'SOURCE',
|
|
108
|
+
description: 'Type of function to create',
|
|
109
|
+
displayOptions: {
|
|
110
|
+
show: {
|
|
111
|
+
resource: ['functions'],
|
|
112
|
+
operation: ['create'],
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
{
|
|
117
|
+
displayName: 'Display Name',
|
|
118
|
+
name: 'displayName',
|
|
119
|
+
type: 'string',
|
|
120
|
+
required: true,
|
|
121
|
+
default: '',
|
|
122
|
+
description: 'Display name for the function',
|
|
123
|
+
displayOptions: {
|
|
124
|
+
show: {
|
|
125
|
+
resource: ['functions'],
|
|
126
|
+
operation: ['create'],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
displayName: 'Code',
|
|
132
|
+
name: 'code',
|
|
133
|
+
type: 'string',
|
|
134
|
+
typeOptions: {
|
|
135
|
+
rows: 10,
|
|
136
|
+
},
|
|
137
|
+
required: true,
|
|
138
|
+
default: '',
|
|
139
|
+
description: 'JavaScript code for the function',
|
|
140
|
+
displayOptions: {
|
|
141
|
+
show: {
|
|
142
|
+
resource: ['functions'],
|
|
143
|
+
operation: ['create'],
|
|
144
|
+
},
|
|
145
|
+
},
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
displayName: 'Description',
|
|
149
|
+
name: 'description',
|
|
150
|
+
type: 'string',
|
|
151
|
+
default: '',
|
|
152
|
+
description: 'Description of the function',
|
|
153
|
+
displayOptions: {
|
|
154
|
+
show: {
|
|
155
|
+
resource: ['functions'],
|
|
156
|
+
operation: ['create'],
|
|
157
|
+
},
|
|
158
|
+
},
|
|
159
|
+
},
|
|
160
|
+
{
|
|
161
|
+
displayName: 'Logo URL',
|
|
162
|
+
name: 'logoUrl',
|
|
163
|
+
type: 'string',
|
|
164
|
+
default: '',
|
|
165
|
+
description: 'URL for the function logo',
|
|
166
|
+
displayOptions: {
|
|
167
|
+
show: {
|
|
168
|
+
resource: ['functions'],
|
|
169
|
+
operation: ['create'],
|
|
170
|
+
},
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
// Update fields
|
|
174
|
+
{
|
|
175
|
+
displayName: 'Update Fields',
|
|
176
|
+
name: 'updateFields',
|
|
177
|
+
type: 'collection',
|
|
178
|
+
placeholder: 'Add Field',
|
|
179
|
+
default: {},
|
|
180
|
+
displayOptions: {
|
|
181
|
+
show: {
|
|
182
|
+
resource: ['functions'],
|
|
183
|
+
operation: ['update'],
|
|
184
|
+
},
|
|
185
|
+
},
|
|
186
|
+
options: [
|
|
187
|
+
{
|
|
188
|
+
displayName: 'Code',
|
|
189
|
+
name: 'code',
|
|
190
|
+
type: 'string',
|
|
191
|
+
typeOptions: {
|
|
192
|
+
rows: 10,
|
|
193
|
+
},
|
|
194
|
+
default: '',
|
|
195
|
+
description: 'JavaScript code for the function',
|
|
196
|
+
},
|
|
197
|
+
{
|
|
198
|
+
displayName: 'Description',
|
|
199
|
+
name: 'description',
|
|
200
|
+
type: 'string',
|
|
201
|
+
default: '',
|
|
202
|
+
description: 'Description of the function',
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
displayName: 'Display Name',
|
|
206
|
+
name: 'displayName',
|
|
207
|
+
type: 'string',
|
|
208
|
+
default: '',
|
|
209
|
+
description: 'Display name for the function',
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
displayName: 'Logo URL',
|
|
213
|
+
name: 'logoUrl',
|
|
214
|
+
type: 'string',
|
|
215
|
+
default: '',
|
|
216
|
+
description: 'URL for the function logo',
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
displayName: 'Settings (JSON)',
|
|
220
|
+
name: 'settings',
|
|
221
|
+
type: 'json',
|
|
222
|
+
default: '[]',
|
|
223
|
+
description: 'Function settings array as JSON',
|
|
224
|
+
},
|
|
225
|
+
],
|
|
226
|
+
},
|
|
227
|
+
// Filter for getAll
|
|
228
|
+
{
|
|
229
|
+
displayName: 'Function Type Filter',
|
|
230
|
+
name: 'resourceTypeFilter',
|
|
231
|
+
type: 'options',
|
|
232
|
+
options: [
|
|
233
|
+
{
|
|
234
|
+
name: 'All',
|
|
235
|
+
value: '',
|
|
236
|
+
},
|
|
237
|
+
{
|
|
238
|
+
name: 'Destination Function',
|
|
239
|
+
value: 'DESTINATION',
|
|
240
|
+
},
|
|
241
|
+
{
|
|
242
|
+
name: 'Insert Function',
|
|
243
|
+
value: 'INSERT_DESTINATION',
|
|
244
|
+
},
|
|
245
|
+
{
|
|
246
|
+
name: 'Source Function',
|
|
247
|
+
value: 'SOURCE',
|
|
248
|
+
},
|
|
249
|
+
],
|
|
250
|
+
default: '',
|
|
251
|
+
description: 'Filter functions by type',
|
|
252
|
+
displayOptions: {
|
|
253
|
+
show: {
|
|
254
|
+
resource: ['functions'],
|
|
255
|
+
operation: ['getAll'],
|
|
256
|
+
},
|
|
257
|
+
},
|
|
258
|
+
},
|
|
259
|
+
// Pagination
|
|
260
|
+
{
|
|
261
|
+
displayName: 'Return All',
|
|
262
|
+
name: 'returnAll',
|
|
263
|
+
type: 'boolean',
|
|
264
|
+
default: false,
|
|
265
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
266
|
+
displayOptions: {
|
|
267
|
+
show: {
|
|
268
|
+
resource: ['functions'],
|
|
269
|
+
operation: ['getAll', 'getLogs'],
|
|
270
|
+
},
|
|
271
|
+
},
|
|
272
|
+
},
|
|
273
|
+
{
|
|
274
|
+
displayName: 'Limit',
|
|
275
|
+
name: 'limit',
|
|
276
|
+
type: 'number',
|
|
277
|
+
default: 50,
|
|
278
|
+
description: 'Max number of results to return',
|
|
279
|
+
typeOptions: {
|
|
280
|
+
minValue: 1,
|
|
281
|
+
maxValue: 200,
|
|
282
|
+
},
|
|
283
|
+
displayOptions: {
|
|
284
|
+
show: {
|
|
285
|
+
resource: ['functions'],
|
|
286
|
+
operation: ['getAll', 'getLogs'],
|
|
287
|
+
returnAll: [false],
|
|
288
|
+
},
|
|
289
|
+
},
|
|
290
|
+
},
|
|
291
|
+
];
|
|
292
|
+
async function executeFunctions(index) {
|
|
293
|
+
const operation = this.getNodeParameter('operation', index);
|
|
294
|
+
let response;
|
|
295
|
+
if (operation === 'getAll') {
|
|
296
|
+
const returnAll = this.getNodeParameter('returnAll', index);
|
|
297
|
+
const resourceTypeFilter = this.getNodeParameter('resourceTypeFilter', index, '');
|
|
298
|
+
const qs = {};
|
|
299
|
+
if (resourceTypeFilter) {
|
|
300
|
+
qs.resourceType = resourceTypeFilter;
|
|
301
|
+
}
|
|
302
|
+
if (returnAll) {
|
|
303
|
+
response = await transport_1.publicApiRequestAllItems.call(this, 'GET', '/functions', 'functions', {}, qs);
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
const limit = this.getNodeParameter('limit', index);
|
|
307
|
+
qs.count = limit;
|
|
308
|
+
const result = await transport_1.publicApiRequest.call(this, 'GET', '/functions', {}, qs);
|
|
309
|
+
response = result.functions;
|
|
310
|
+
}
|
|
311
|
+
}
|
|
312
|
+
else if (operation === 'get') {
|
|
313
|
+
const functionId = this.getNodeParameter('functionId', index);
|
|
314
|
+
const result = await transport_1.publicApiRequest.call(this, 'GET', `/functions/${functionId}`);
|
|
315
|
+
response = result.function;
|
|
316
|
+
}
|
|
317
|
+
else if (operation === 'create') {
|
|
318
|
+
const resourceType = this.getNodeParameter('resourceType', index);
|
|
319
|
+
const displayName = this.getNodeParameter('displayName', index);
|
|
320
|
+
const code = this.getNodeParameter('code', index);
|
|
321
|
+
const description = this.getNodeParameter('description', index, '');
|
|
322
|
+
const logoUrl = this.getNodeParameter('logoUrl', index, '');
|
|
323
|
+
const body = {
|
|
324
|
+
resourceType,
|
|
325
|
+
displayName,
|
|
326
|
+
code,
|
|
327
|
+
};
|
|
328
|
+
if (description) {
|
|
329
|
+
body.description = description;
|
|
330
|
+
}
|
|
331
|
+
if (logoUrl) {
|
|
332
|
+
body.logoUrl = logoUrl;
|
|
333
|
+
}
|
|
334
|
+
const result = await transport_1.publicApiRequest.call(this, 'POST', '/functions', body);
|
|
335
|
+
response = result.function;
|
|
336
|
+
}
|
|
337
|
+
else if (operation === 'update') {
|
|
338
|
+
const functionId = this.getNodeParameter('functionId', index);
|
|
339
|
+
const updateFields = this.getNodeParameter('updateFields', index);
|
|
340
|
+
const body = {};
|
|
341
|
+
if (updateFields.displayName !== undefined) {
|
|
342
|
+
body.displayName = updateFields.displayName;
|
|
343
|
+
}
|
|
344
|
+
if (updateFields.code !== undefined) {
|
|
345
|
+
body.code = updateFields.code;
|
|
346
|
+
}
|
|
347
|
+
if (updateFields.description !== undefined) {
|
|
348
|
+
body.description = updateFields.description;
|
|
349
|
+
}
|
|
350
|
+
if (updateFields.logoUrl !== undefined) {
|
|
351
|
+
body.logoUrl = updateFields.logoUrl;
|
|
352
|
+
}
|
|
353
|
+
if (updateFields.settings) {
|
|
354
|
+
body.settings = (0, utils_1.parseJson)(updateFields.settings);
|
|
355
|
+
}
|
|
356
|
+
const result = await transport_1.publicApiRequest.call(this, 'PATCH', `/functions/${functionId}`, body);
|
|
357
|
+
response = result.function;
|
|
358
|
+
}
|
|
359
|
+
else if (operation === 'delete') {
|
|
360
|
+
const functionId = this.getNodeParameter('functionId', index);
|
|
361
|
+
await transport_1.publicApiRequest.call(this, 'DELETE', `/functions/${functionId}`);
|
|
362
|
+
response = { success: true, functionId };
|
|
363
|
+
}
|
|
364
|
+
else if (operation === 'deploy') {
|
|
365
|
+
const functionId = this.getNodeParameter('functionId', index);
|
|
366
|
+
const result = await transport_1.publicApiRequest.call(this, 'POST', `/functions/${functionId}/deploy`);
|
|
367
|
+
response = result;
|
|
368
|
+
}
|
|
369
|
+
else if (operation === 'getLogs') {
|
|
370
|
+
const functionId = this.getNodeParameter('functionId', index);
|
|
371
|
+
const returnAll = this.getNodeParameter('returnAll', index);
|
|
372
|
+
if (returnAll) {
|
|
373
|
+
response = await transport_1.publicApiRequestAllItems.call(this, 'GET', `/functions/${functionId}/logs`, 'logs');
|
|
374
|
+
}
|
|
375
|
+
else {
|
|
376
|
+
const limit = this.getNodeParameter('limit', index);
|
|
377
|
+
const result = await transport_1.publicApiRequest.call(this, 'GET', `/functions/${functionId}/logs`, {}, { count: limit });
|
|
378
|
+
response = result.logs;
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
383
|
+
}
|
|
384
|
+
const executionData = Array.isArray(response)
|
|
385
|
+
? response.map((item) => ({ json: item }))
|
|
386
|
+
: [{ json: response }];
|
|
387
|
+
return executionData;
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Segment/actions/functions/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AA+RH,4CAmIC;AA/ZD,+CAA6E;AAC7E,uCAAwC;AAE3B,QAAA,mBAAmB,GAAsB;IACrD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,WAAW,CAAC;aACvB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,yCAAyC;gBACtD,MAAM,EAAE,mBAAmB;aAC3B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,mBAAmB;gBAChC,MAAM,EAAE,mBAAmB;aAC3B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,mBAAmB;gBAChC,MAAM,EAAE,mBAAmB;aAC3B;YACD;gBACC,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,KAAK;gBACZ,WAAW,EAAE,sBAAsB;gBACnC,MAAM,EAAE,gBAAgB;aACxB;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,SAAS;gBAChB,WAAW,EAAE,6BAA6B;gBAC1C,MAAM,EAAE,mBAAmB;aAC3B;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,KAAK,EAAE,QAAQ;gBACf,W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C,gBAAgB,CAAC,OAAO,EAAE,KAAK,CAAW,CAAC;YAC9D,MAAM,MAAM,GAAG,MAAM,4BAAgB,CAAC,IAAI,CACzC,IAAI,EACJ,KAAK,EACL,cAAc,UAAU,OAAO,EAC/B,EAAE,EACF,EAAE,KAAK,EAAE,KAAK,EAAE,CAChB,CAAC;YACF,QAAQ,GAAG,MAAM,CAAC,IAAqB,CAAC;QACzC,CAAC;IACF,CAAC;SAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5C,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAExB,OAAO,aAAa,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const labelsOperations: INodeProperties[];
|
|
3
|
+
export declare const labelsFields: INodeProperties[];
|
|
4
|
+
export declare function executeLabels(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../nodes/Segment/actions/labels/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxG,eAAO,MAAM,gBAAgB,EAAE,eAAe,EA6C7C,CAAC;AAEF,eAAO,MAAM,YAAY,EAAE,eAAe,EA4FzC,CAAC;AAEF,wBAAsB,aAAa,CAClC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA6F/B"}
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
* Copyright (c) Velocity BPA, LLC
|
|
4
|
+
* Licensed under the Business Source License 1.1
|
|
5
|
+
* Commercial use requires a separate commercial license.
|
|
6
|
+
* See LICENSE file for details.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.labelsFields = exports.labelsOperations = void 0;
|
|
10
|
+
exports.executeLabels = executeLabels;
|
|
11
|
+
const transport_1 = require("../../transport");
|
|
12
|
+
exports.labelsOperations = [
|
|
13
|
+
{
|
|
14
|
+
displayName: 'Operation',
|
|
15
|
+
name: 'operation',
|
|
16
|
+
type: 'options',
|
|
17
|
+
noDataExpression: true,
|
|
18
|
+
displayOptions: {
|
|
19
|
+
show: {
|
|
20
|
+
resource: ['labels'],
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
options: [
|
|
24
|
+
{
|
|
25
|
+
name: 'Add to Source',
|
|
26
|
+
value: 'addToSource',
|
|
27
|
+
description: 'Add a label to a source',
|
|
28
|
+
action: 'Add label to source',
|
|
29
|
+
},
|
|
30
|
+
{
|
|
31
|
+
name: 'Create',
|
|
32
|
+
value: 'create',
|
|
33
|
+
description: 'Create a label',
|
|
34
|
+
action: 'Create a label',
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
name: 'Delete',
|
|
38
|
+
value: 'delete',
|
|
39
|
+
description: 'Delete a label',
|
|
40
|
+
action: 'Delete a label',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Get Many',
|
|
44
|
+
value: 'getAll',
|
|
45
|
+
description: 'List all labels',
|
|
46
|
+
action: 'List all labels',
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
name: 'Remove From Source',
|
|
50
|
+
value: 'removeFromSource',
|
|
51
|
+
description: 'Remove a label from a source',
|
|
52
|
+
action: 'Remove label from source',
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
default: 'getAll',
|
|
56
|
+
},
|
|
57
|
+
];
|
|
58
|
+
exports.labelsFields = [
|
|
59
|
+
// Label Key for create/delete
|
|
60
|
+
{
|
|
61
|
+
displayName: 'Label Key',
|
|
62
|
+
name: 'labelKey',
|
|
63
|
+
type: 'string',
|
|
64
|
+
required: true,
|
|
65
|
+
default: '',
|
|
66
|
+
description: 'The key of the label (e.g., "environment")',
|
|
67
|
+
displayOptions: {
|
|
68
|
+
show: {
|
|
69
|
+
resource: ['labels'],
|
|
70
|
+
operation: ['create', 'delete', 'addToSource', 'removeFromSource'],
|
|
71
|
+
},
|
|
72
|
+
},
|
|
73
|
+
},
|
|
74
|
+
// Label Value for create
|
|
75
|
+
{
|
|
76
|
+
displayName: 'Label Value',
|
|
77
|
+
name: 'labelValue',
|
|
78
|
+
type: 'string',
|
|
79
|
+
required: true,
|
|
80
|
+
default: '',
|
|
81
|
+
description: 'The value of the label (e.g., "production")',
|
|
82
|
+
displayOptions: {
|
|
83
|
+
show: {
|
|
84
|
+
resource: ['labels'],
|
|
85
|
+
operation: ['create', 'addToSource', 'removeFromSource'],
|
|
86
|
+
},
|
|
87
|
+
},
|
|
88
|
+
},
|
|
89
|
+
// Description for create
|
|
90
|
+
{
|
|
91
|
+
displayName: 'Description',
|
|
92
|
+
name: 'description',
|
|
93
|
+
type: 'string',
|
|
94
|
+
default: '',
|
|
95
|
+
description: 'Description of the label',
|
|
96
|
+
displayOptions: {
|
|
97
|
+
show: {
|
|
98
|
+
resource: ['labels'],
|
|
99
|
+
operation: ['create'],
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
// Source ID for add/remove operations
|
|
104
|
+
{
|
|
105
|
+
displayName: 'Source ID',
|
|
106
|
+
name: 'sourceId',
|
|
107
|
+
type: 'string',
|
|
108
|
+
required: true,
|
|
109
|
+
default: '',
|
|
110
|
+
description: 'The ID of the source to add/remove the label',
|
|
111
|
+
displayOptions: {
|
|
112
|
+
show: {
|
|
113
|
+
resource: ['labels'],
|
|
114
|
+
operation: ['addToSource', 'removeFromSource'],
|
|
115
|
+
},
|
|
116
|
+
},
|
|
117
|
+
},
|
|
118
|
+
// Pagination
|
|
119
|
+
{
|
|
120
|
+
displayName: 'Return All',
|
|
121
|
+
name: 'returnAll',
|
|
122
|
+
type: 'boolean',
|
|
123
|
+
default: false,
|
|
124
|
+
description: 'Whether to return all results or only up to a given limit',
|
|
125
|
+
displayOptions: {
|
|
126
|
+
show: {
|
|
127
|
+
resource: ['labels'],
|
|
128
|
+
operation: ['getAll'],
|
|
129
|
+
},
|
|
130
|
+
},
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
displayName: 'Limit',
|
|
134
|
+
name: 'limit',
|
|
135
|
+
type: 'number',
|
|
136
|
+
default: 50,
|
|
137
|
+
description: 'Max number of results to return',
|
|
138
|
+
typeOptions: {
|
|
139
|
+
minValue: 1,
|
|
140
|
+
maxValue: 200,
|
|
141
|
+
},
|
|
142
|
+
displayOptions: {
|
|
143
|
+
show: {
|
|
144
|
+
resource: ['labels'],
|
|
145
|
+
operation: ['getAll'],
|
|
146
|
+
returnAll: [false],
|
|
147
|
+
},
|
|
148
|
+
},
|
|
149
|
+
},
|
|
150
|
+
];
|
|
151
|
+
async function executeLabels(index) {
|
|
152
|
+
const operation = this.getNodeParameter('operation', index);
|
|
153
|
+
let response;
|
|
154
|
+
if (operation === 'getAll') {
|
|
155
|
+
const returnAll = this.getNodeParameter('returnAll', index);
|
|
156
|
+
if (returnAll) {
|
|
157
|
+
response = await transport_1.publicApiRequestAllItems.call(this, 'GET', '/labels', 'labels');
|
|
158
|
+
}
|
|
159
|
+
else {
|
|
160
|
+
const limit = this.getNodeParameter('limit', index);
|
|
161
|
+
const result = await transport_1.publicApiRequest.call(this, 'GET', '/labels', {}, { count: limit });
|
|
162
|
+
response = result.labels;
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
else if (operation === 'create') {
|
|
166
|
+
const labelKey = this.getNodeParameter('labelKey', index);
|
|
167
|
+
const labelValue = this.getNodeParameter('labelValue', index);
|
|
168
|
+
const description = this.getNodeParameter('description', index);
|
|
169
|
+
const body = {
|
|
170
|
+
label: {
|
|
171
|
+
key: labelKey,
|
|
172
|
+
value: labelValue,
|
|
173
|
+
},
|
|
174
|
+
};
|
|
175
|
+
if (description) {
|
|
176
|
+
body.label.description = description;
|
|
177
|
+
}
|
|
178
|
+
const result = await transport_1.publicApiRequest.call(this, 'POST', '/labels', body);
|
|
179
|
+
response = result.label;
|
|
180
|
+
}
|
|
181
|
+
else if (operation === 'delete') {
|
|
182
|
+
const labelKey = this.getNodeParameter('labelKey', index);
|
|
183
|
+
// Encode the label key for URL
|
|
184
|
+
const encodedKey = encodeURIComponent(labelKey);
|
|
185
|
+
await transport_1.publicApiRequest.call(this, 'DELETE', `/labels/${encodedKey}`);
|
|
186
|
+
response = { success: true, labelKey };
|
|
187
|
+
}
|
|
188
|
+
else if (operation === 'addToSource') {
|
|
189
|
+
const sourceId = this.getNodeParameter('sourceId', index);
|
|
190
|
+
const labelKey = this.getNodeParameter('labelKey', index);
|
|
191
|
+
const labelValue = this.getNodeParameter('labelValue', index);
|
|
192
|
+
const body = {
|
|
193
|
+
labels: [
|
|
194
|
+
{
|
|
195
|
+
key: labelKey,
|
|
196
|
+
value: labelValue,
|
|
197
|
+
},
|
|
198
|
+
],
|
|
199
|
+
};
|
|
200
|
+
const result = await transport_1.publicApiRequest.call(this, 'POST', `/sources/${sourceId}/labels`, body);
|
|
201
|
+
response = result;
|
|
202
|
+
}
|
|
203
|
+
else if (operation === 'removeFromSource') {
|
|
204
|
+
const sourceId = this.getNodeParameter('sourceId', index);
|
|
205
|
+
const labelKey = this.getNodeParameter('labelKey', index);
|
|
206
|
+
const labelValue = this.getNodeParameter('labelValue', index);
|
|
207
|
+
// Encode for URL
|
|
208
|
+
const encodedKey = encodeURIComponent(labelKey);
|
|
209
|
+
const encodedValue = encodeURIComponent(labelValue);
|
|
210
|
+
await transport_1.publicApiRequest.call(this, 'DELETE', `/sources/${sourceId}/labels/${encodedKey}:${encodedValue}`);
|
|
211
|
+
response = { success: true, sourceId, labelKey, labelValue };
|
|
212
|
+
}
|
|
213
|
+
else {
|
|
214
|
+
throw new Error(`Unknown operation: ${operation}`);
|
|
215
|
+
}
|
|
216
|
+
const executionData = Array.isArray(response)
|
|
217
|
+
? response.map((item) => ({ json: item }))
|
|
218
|
+
: [{ json: response }];
|
|
219
|
+
return executionData;
|
|
220
|
+
}
|
|
221
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Segment/actions/labels/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAkJH,sCAgGC;AA/OD,+CAA6E;AAEhE,QAAA,gBAAgB,GAAsB;IAClD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE;YACf,IAAI,EAAE;gBACL,QAAQ,EAAE,CAAC,QAAQ,CAAC;aACpB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,yBAAyB;gBACtC,MAAM,EAAE,qBAAqB;aAC7B;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,gBAAgB;gBAC7B,MAAM,EAAE,gBAAgB;aACxB;YACD;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,gBAAgB;gBAC7B,MAAM,EAAE,gBAAgB;aACxB;YACD;gBACC,IAAI,EAAE,UAAU;gBAChB,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B,IAAI,EACJ,QAAQ,EACR,YAAY,QAAQ,WAAW,UAAU,IAAI,YAAY,EAAE,CAC3D,CAAC;QACF,QAAQ,GAAG,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,QAAQ,EAAE,UAAU,EAAE,CAAC;IAE9D,CAAC;SAAM,CAAC;QACP,MAAM,IAAI,KAAK,CAAC,sBAAsB,SAAS,EAAE,CAAC,CAAC;IACpD,CAAC;IAED,MAAM,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC,QAAQ,CAAC;QAC5C,CAAC,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC;QAC1C,CAAC,CAAC,CAAC,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC,CAAC;IAExB,OAAO,aAAa,CAAC;AACtB,CAAC"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { IExecuteFunctions, INodeExecutionData, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare const regulationsOperations: INodeProperties[];
|
|
3
|
+
export declare const regulationsFields: INodeProperties[];
|
|
4
|
+
export declare function executeRegulations(this: IExecuteFunctions, index: number): Promise<INodeExecutionData[]>;
|
|
5
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../nodes/Segment/actions/regulations/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxG,eAAO,MAAM,qBAAqB,EAAE,eAAe,EA6ClD,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,eAAe,EA0L9C,CAAC;AAEF,wBAAsB,kBAAkB,CACvC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAoG/B"}
|