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.
Files changed (96) hide show
  1. package/LICENSE +46 -0
  2. package/README.md +419 -0
  3. package/dist/credentials/SegmentApi.credentials.d.ts +10 -0
  4. package/dist/credentials/SegmentApi.credentials.d.ts.map +1 -0
  5. package/dist/credentials/SegmentApi.credentials.js +88 -0
  6. package/dist/credentials/SegmentApi.credentials.js.map +1 -0
  7. package/dist/index.d.ts +4 -0
  8. package/dist/index.d.ts.map +1 -0
  9. package/dist/index.js +26 -0
  10. package/dist/index.js.map +1 -0
  11. package/dist/nodes/Segment/Segment.node.d.ts +6 -0
  12. package/dist/nodes/Segment/Segment.node.d.ts.map +1 -0
  13. package/dist/nodes/Segment/Segment.node.js +283 -0
  14. package/dist/nodes/Segment/Segment.node.js.map +1 -0
  15. package/dist/nodes/Segment/SegmentTrigger.node.d.ts +6 -0
  16. package/dist/nodes/Segment/SegmentTrigger.node.d.ts.map +1 -0
  17. package/dist/nodes/Segment/SegmentTrigger.node.js +257 -0
  18. package/dist/nodes/Segment/SegmentTrigger.node.js.map +1 -0
  19. package/dist/nodes/Segment/actions/audiences/index.d.ts +5 -0
  20. package/dist/nodes/Segment/actions/audiences/index.d.ts.map +1 -0
  21. package/dist/nodes/Segment/actions/audiences/index.js +304 -0
  22. package/dist/nodes/Segment/actions/audiences/index.js.map +1 -0
  23. package/dist/nodes/Segment/actions/auditTrail/index.d.ts +5 -0
  24. package/dist/nodes/Segment/actions/auditTrail/index.d.ts.map +1 -0
  25. package/dist/nodes/Segment/actions/auditTrail/index.js +192 -0
  26. package/dist/nodes/Segment/actions/auditTrail/index.js.map +1 -0
  27. package/dist/nodes/Segment/actions/catalog/index.d.ts +5 -0
  28. package/dist/nodes/Segment/actions/catalog/index.d.ts.map +1 -0
  29. package/dist/nodes/Segment/actions/catalog/index.js +144 -0
  30. package/dist/nodes/Segment/actions/catalog/index.js.map +1 -0
  31. package/dist/nodes/Segment/actions/computedTraits/index.d.ts +5 -0
  32. package/dist/nodes/Segment/actions/computedTraits/index.d.ts.map +1 -0
  33. package/dist/nodes/Segment/actions/computedTraits/index.js +257 -0
  34. package/dist/nodes/Segment/actions/computedTraits/index.js.map +1 -0
  35. package/dist/nodes/Segment/actions/destinations/index.d.ts +5 -0
  36. package/dist/nodes/Segment/actions/destinations/index.d.ts.map +1 -0
  37. package/dist/nodes/Segment/actions/destinations/index.js +297 -0
  38. package/dist/nodes/Segment/actions/destinations/index.js.map +1 -0
  39. package/dist/nodes/Segment/actions/functions/index.d.ts +5 -0
  40. package/dist/nodes/Segment/actions/functions/index.d.ts.map +1 -0
  41. package/dist/nodes/Segment/actions/functions/index.js +389 -0
  42. package/dist/nodes/Segment/actions/functions/index.js.map +1 -0
  43. package/dist/nodes/Segment/actions/labels/index.d.ts +5 -0
  44. package/dist/nodes/Segment/actions/labels/index.d.ts.map +1 -0
  45. package/dist/nodes/Segment/actions/labels/index.js +221 -0
  46. package/dist/nodes/Segment/actions/labels/index.js.map +1 -0
  47. package/dist/nodes/Segment/actions/regulations/index.d.ts +5 -0
  48. package/dist/nodes/Segment/actions/regulations/index.d.ts.map +1 -0
  49. package/dist/nodes/Segment/actions/regulations/index.js +322 -0
  50. package/dist/nodes/Segment/actions/regulations/index.js.map +1 -0
  51. package/dist/nodes/Segment/actions/sources/index.d.ts +5 -0
  52. package/dist/nodes/Segment/actions/sources/index.d.ts.map +1 -0
  53. package/dist/nodes/Segment/actions/sources/index.js +371 -0
  54. package/dist/nodes/Segment/actions/sources/index.js.map +1 -0
  55. package/dist/nodes/Segment/actions/spaces/index.d.ts +5 -0
  56. package/dist/nodes/Segment/actions/spaces/index.d.ts.map +1 -0
  57. package/dist/nodes/Segment/actions/spaces/index.js +328 -0
  58. package/dist/nodes/Segment/actions/spaces/index.js.map +1 -0
  59. package/dist/nodes/Segment/actions/track/index.d.ts +5 -0
  60. package/dist/nodes/Segment/actions/track/index.d.ts.map +1 -0
  61. package/dist/nodes/Segment/actions/track/index.js +499 -0
  62. package/dist/nodes/Segment/actions/track/index.js.map +1 -0
  63. package/dist/nodes/Segment/actions/trackingPlans/index.d.ts +5 -0
  64. package/dist/nodes/Segment/actions/trackingPlans/index.d.ts.map +1 -0
  65. package/dist/nodes/Segment/actions/trackingPlans/index.js +340 -0
  66. package/dist/nodes/Segment/actions/trackingPlans/index.js.map +1 -0
  67. package/dist/nodes/Segment/actions/transformations/index.d.ts +5 -0
  68. package/dist/nodes/Segment/actions/transformations/index.d.ts.map +1 -0
  69. package/dist/nodes/Segment/actions/transformations/index.js +280 -0
  70. package/dist/nodes/Segment/actions/transformations/index.js.map +1 -0
  71. package/dist/nodes/Segment/actions/users/index.d.ts +5 -0
  72. package/dist/nodes/Segment/actions/users/index.d.ts.map +1 -0
  73. package/dist/nodes/Segment/actions/users/index.js +233 -0
  74. package/dist/nodes/Segment/actions/users/index.js.map +1 -0
  75. package/dist/nodes/Segment/actions/warehouses/index.d.ts +5 -0
  76. package/dist/nodes/Segment/actions/warehouses/index.d.ts.map +1 -0
  77. package/dist/nodes/Segment/actions/warehouses/index.js +313 -0
  78. package/dist/nodes/Segment/actions/warehouses/index.js.map +1 -0
  79. package/dist/nodes/Segment/actions/workspace/index.d.ts +5 -0
  80. package/dist/nodes/Segment/actions/workspace/index.d.ts.map +1 -0
  81. package/dist/nodes/Segment/actions/workspace/index.js +100 -0
  82. package/dist/nodes/Segment/actions/workspace/index.js.map +1 -0
  83. package/dist/nodes/Segment/constants/index.d.ts +23 -0
  84. package/dist/nodes/Segment/constants/index.d.ts.map +1 -0
  85. package/dist/nodes/Segment/constants/index.js +720 -0
  86. package/dist/nodes/Segment/constants/index.js.map +1 -0
  87. package/dist/nodes/Segment/segment.svg +6 -0
  88. package/dist/nodes/Segment/transport/index.d.ts +35 -0
  89. package/dist/nodes/Segment/transport/index.d.ts.map +1 -0
  90. package/dist/nodes/Segment/transport/index.js +127 -0
  91. package/dist/nodes/Segment/transport/index.js.map +1 -0
  92. package/dist/nodes/Segment/utils/index.d.ts +67 -0
  93. package/dist/nodes/Segment/utils/index.d.ts.map +1 -0
  94. package/dist/nodes/Segment/utils/index.js +216 -0
  95. package/dist/nodes/Segment/utils/index.js.map +1 -0
  96. package/package.json +73 -0
@@ -0,0 +1,144 @@
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.catalogFields = exports.catalogOperations = void 0;
10
+ exports.executeCatalog = executeCatalog;
11
+ const transport_1 = require("../../transport");
12
+ exports.catalogOperations = [
13
+ {
14
+ displayName: 'Operation',
15
+ name: 'operation',
16
+ type: 'options',
17
+ noDataExpression: true,
18
+ displayOptions: {
19
+ show: {
20
+ resource: ['catalog'],
21
+ },
22
+ },
23
+ options: [
24
+ {
25
+ name: 'Get Destination',
26
+ value: 'getDestination',
27
+ description: 'Get destination type details from catalog',
28
+ action: 'Get catalog destination',
29
+ },
30
+ {
31
+ name: 'Get Source',
32
+ value: 'getSource',
33
+ description: 'Get source type details from catalog',
34
+ action: 'Get catalog source',
35
+ },
36
+ {
37
+ name: 'List Destinations',
38
+ value: 'listDestinations',
39
+ description: 'List available destination types',
40
+ action: 'List catalog destinations',
41
+ },
42
+ {
43
+ name: 'List Sources',
44
+ value: 'listSources',
45
+ description: 'List available source types',
46
+ action: 'List catalog sources',
47
+ },
48
+ ],
49
+ default: 'listSources',
50
+ },
51
+ ];
52
+ exports.catalogFields = [
53
+ // Metadata ID for get operations
54
+ {
55
+ displayName: 'Metadata ID',
56
+ name: 'metadataId',
57
+ type: 'string',
58
+ required: true,
59
+ default: '',
60
+ description: 'The catalog metadata ID of the source/destination type',
61
+ displayOptions: {
62
+ show: {
63
+ resource: ['catalog'],
64
+ operation: ['getSource', 'getDestination'],
65
+ },
66
+ },
67
+ },
68
+ // Pagination
69
+ {
70
+ displayName: 'Return All',
71
+ name: 'returnAll',
72
+ type: 'boolean',
73
+ default: false,
74
+ description: 'Whether to return all results or only up to a given limit',
75
+ displayOptions: {
76
+ show: {
77
+ resource: ['catalog'],
78
+ operation: ['listSources', 'listDestinations'],
79
+ },
80
+ },
81
+ },
82
+ {
83
+ displayName: 'Limit',
84
+ name: 'limit',
85
+ type: 'number',
86
+ default: 50,
87
+ description: 'Max number of results to return',
88
+ typeOptions: {
89
+ minValue: 1,
90
+ maxValue: 200,
91
+ },
92
+ displayOptions: {
93
+ show: {
94
+ resource: ['catalog'],
95
+ operation: ['listSources', 'listDestinations'],
96
+ returnAll: [false],
97
+ },
98
+ },
99
+ },
100
+ ];
101
+ async function executeCatalog(index) {
102
+ const operation = this.getNodeParameter('operation', index);
103
+ let response;
104
+ if (operation === 'listSources') {
105
+ const returnAll = this.getNodeParameter('returnAll', index);
106
+ if (returnAll) {
107
+ response = await transport_1.publicApiRequestAllItems.call(this, 'GET', '/catalog/sources', 'sourcesCatalog');
108
+ }
109
+ else {
110
+ const limit = this.getNodeParameter('limit', index);
111
+ const result = await transport_1.publicApiRequest.call(this, 'GET', '/catalog/sources', {}, { count: limit });
112
+ response = result.sourcesCatalog;
113
+ }
114
+ }
115
+ else if (operation === 'getSource') {
116
+ const metadataId = this.getNodeParameter('metadataId', index);
117
+ const result = await transport_1.publicApiRequest.call(this, 'GET', `/catalog/sources/${metadataId}`);
118
+ response = result.sourceCatalog;
119
+ }
120
+ else if (operation === 'listDestinations') {
121
+ const returnAll = this.getNodeParameter('returnAll', index);
122
+ if (returnAll) {
123
+ response = await transport_1.publicApiRequestAllItems.call(this, 'GET', '/catalog/destinations', 'destinationsCatalog');
124
+ }
125
+ else {
126
+ const limit = this.getNodeParameter('limit', index);
127
+ const result = await transport_1.publicApiRequest.call(this, 'GET', '/catalog/destinations', {}, { count: limit });
128
+ response = result.destinationsCatalog;
129
+ }
130
+ }
131
+ else if (operation === 'getDestination') {
132
+ const metadataId = this.getNodeParameter('metadataId', index);
133
+ const result = await transport_1.publicApiRequest.call(this, 'GET', `/catalog/destinations/${metadataId}`);
134
+ response = result.destinationCatalog;
135
+ }
136
+ else {
137
+ throw new Error(`Unknown operation: ${operation}`);
138
+ }
139
+ const executionData = Array.isArray(response)
140
+ ? response.map((item) => ({ json: item }))
141
+ : [{ json: response }];
142
+ return executionData;
143
+ }
144
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Segment/actions/catalog/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAgGH,wCAyDC;AAtJD,+CAA6E;AAEhE,QAAA,iBAAiB,GAAsB;IACnD;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,SAAS,CAAC;aACrB;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,iBAAiB;gBACvB,KAAK,EAAE,gBAAgB;gBACvB,WAAW,EAAE,2CAA2C;gBACxD,MAAM,EAAE,yBAAyB;aACjC;YACD;gBACC,IAAI,EAAE,YAAY;gBAClB,KAAK,EAAE,WAAW;gBAClB,WAAW,EAAE,sCAAsC;gBACnD,MAAM,EAAE,oBAAoB;aAC5B;YACD;gBACC,IAAI,EAAE,mBAAmB;gBACzB,KAAK,EAAE,kBAAkB;gBACzB,WAAW,EAAE,kCAAkC;gBAC/C,MAAM,EAAE,2BAA2B;aACnC;YACD;gBACC,IAAI,EAAE,cAAc;gBACpB,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,6BAA6B;gBAC1C,MAAM,EAAE,sBAAsB;aAC9B;SACD;QACD,OAAO,EAAE,aAAa;KACtB;CACD,CAAC;AAEW,QAAA,aAAa,GAAsB;IAC/C,iCAAiC;IACjC;Q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,KAAK,EAAE,CAAC,CAAC;YACvG,QAAQ,GAAG,MAAM,CAAC,mBAAoC,CAAC;QACxD,CAAC;IAEF,CAAC;SAAM,IAAI,SAAS,KAAK,gBAAgB,EAAE,CAAC;QAC3C,MAAM,UAAU,GAAG,IAAI,CAAC,gBAAgB,CAAC,YAAY,EAAE,KAAK,CAAW,CAAC;QACxE,MAAM,MAAM,GAAG,MAAM,4BAAgB,CAAC,IAAI,CAAC,IAAI,EAAE,KAAK,EAAE,yBAAyB,UAAU,EAAE,CAAC,CAAC;QAC/F,QAAQ,GAAG,MAAM,CAAC,kBAAiC,CAAC;IACrD,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 computedTraitsOperations: INodeProperties[];
3
+ export declare const computedTraitsFields: INodeProperties[];
4
+ export declare function executeComputedTraits(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/computedTraits/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAGxG,eAAO,MAAM,wBAAwB,EAAE,eAAe,EA6CrD,CAAC;AAEF,eAAO,MAAM,oBAAoB,EAAE,eAAe,EA4IjD,CAAC;AAEF,wBAAsB,qBAAqB,CAC1C,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,EAAE,CAAC,CA0F/B"}
@@ -0,0 +1,257 @@
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.computedTraitsFields = exports.computedTraitsOperations = void 0;
10
+ exports.executeComputedTraits = executeComputedTraits;
11
+ const transport_1 = require("../../transport");
12
+ exports.computedTraitsOperations = [
13
+ {
14
+ displayName: 'Operation',
15
+ name: 'operation',
16
+ type: 'options',
17
+ noDataExpression: true,
18
+ displayOptions: {
19
+ show: {
20
+ resource: ['computedTraits'],
21
+ },
22
+ },
23
+ options: [
24
+ {
25
+ name: 'Create',
26
+ value: 'create',
27
+ description: 'Create a computed trait',
28
+ action: 'Create a computed trait',
29
+ },
30
+ {
31
+ name: 'Delete',
32
+ value: 'delete',
33
+ description: 'Delete a computed trait',
34
+ action: 'Delete a computed trait',
35
+ },
36
+ {
37
+ name: 'Get',
38
+ value: 'get',
39
+ description: 'Get a computed trait by ID',
40
+ action: 'Get a computed trait',
41
+ },
42
+ {
43
+ name: 'Get Many',
44
+ value: 'getAll',
45
+ description: 'List all computed traits',
46
+ action: 'List all computed traits',
47
+ },
48
+ {
49
+ name: 'Update',
50
+ value: 'update',
51
+ description: 'Update a computed trait',
52
+ action: 'Update a computed trait',
53
+ },
54
+ ],
55
+ default: 'getAll',
56
+ },
57
+ ];
58
+ exports.computedTraitsFields = [
59
+ // Space ID
60
+ {
61
+ displayName: 'Space ID',
62
+ name: 'spaceId',
63
+ type: 'string',
64
+ required: true,
65
+ default: '',
66
+ description: 'The ID of the Personas space',
67
+ displayOptions: {
68
+ show: {
69
+ resource: ['computedTraits'],
70
+ },
71
+ },
72
+ },
73
+ // Computed Trait ID
74
+ {
75
+ displayName: 'Computed Trait ID',
76
+ name: 'computedTraitId',
77
+ type: 'string',
78
+ required: true,
79
+ default: '',
80
+ description: 'The unique identifier of the computed trait',
81
+ displayOptions: {
82
+ show: {
83
+ resource: ['computedTraits'],
84
+ operation: ['get', 'update', 'delete'],
85
+ },
86
+ },
87
+ },
88
+ // Create fields
89
+ {
90
+ displayName: 'Name',
91
+ name: 'name',
92
+ type: 'string',
93
+ required: true,
94
+ default: '',
95
+ description: 'Name of the computed trait',
96
+ displayOptions: {
97
+ show: {
98
+ resource: ['computedTraits'],
99
+ operation: ['create'],
100
+ },
101
+ },
102
+ },
103
+ {
104
+ displayName: 'Enabled',
105
+ name: 'enabled',
106
+ type: 'boolean',
107
+ default: true,
108
+ description: 'Whether the computed trait is enabled',
109
+ displayOptions: {
110
+ show: {
111
+ resource: ['computedTraits'],
112
+ operation: ['create'],
113
+ },
114
+ },
115
+ },
116
+ {
117
+ displayName: 'Definition (JSON)',
118
+ name: 'definition',
119
+ type: 'json',
120
+ default: '{}',
121
+ description: 'The computed trait definition in JSON format',
122
+ displayOptions: {
123
+ show: {
124
+ resource: ['computedTraits'],
125
+ operation: ['create'],
126
+ },
127
+ },
128
+ },
129
+ // Update fields
130
+ {
131
+ displayName: 'Update Fields',
132
+ name: 'updateFields',
133
+ type: 'collection',
134
+ placeholder: 'Add Field',
135
+ default: {},
136
+ displayOptions: {
137
+ show: {
138
+ resource: ['computedTraits'],
139
+ operation: ['update'],
140
+ },
141
+ },
142
+ options: [
143
+ {
144
+ displayName: 'Name',
145
+ name: 'name',
146
+ type: 'string',
147
+ default: '',
148
+ description: 'Updated name for the computed trait',
149
+ },
150
+ {
151
+ displayName: 'Enabled',
152
+ name: 'enabled',
153
+ type: 'boolean',
154
+ default: true,
155
+ description: 'Whether the computed trait is enabled',
156
+ },
157
+ {
158
+ displayName: 'Description',
159
+ name: 'description',
160
+ type: 'string',
161
+ default: '',
162
+ description: 'Description of the computed trait',
163
+ },
164
+ ],
165
+ },
166
+ // Pagination
167
+ {
168
+ displayName: 'Return All',
169
+ name: 'returnAll',
170
+ type: 'boolean',
171
+ default: false,
172
+ description: 'Whether to return all results or only up to a given limit',
173
+ displayOptions: {
174
+ show: {
175
+ resource: ['computedTraits'],
176
+ operation: ['getAll'],
177
+ },
178
+ },
179
+ },
180
+ {
181
+ displayName: 'Limit',
182
+ name: 'limit',
183
+ type: 'number',
184
+ default: 50,
185
+ description: 'Max number of results to return',
186
+ typeOptions: {
187
+ minValue: 1,
188
+ maxValue: 200,
189
+ },
190
+ displayOptions: {
191
+ show: {
192
+ resource: ['computedTraits'],
193
+ operation: ['getAll'],
194
+ returnAll: [false],
195
+ },
196
+ },
197
+ },
198
+ ];
199
+ async function executeComputedTraits(index) {
200
+ const operation = this.getNodeParameter('operation', index);
201
+ const spaceId = this.getNodeParameter('spaceId', index);
202
+ let response;
203
+ if (operation === 'getAll') {
204
+ const returnAll = this.getNodeParameter('returnAll', index);
205
+ if (returnAll) {
206
+ response = await transport_1.publicApiRequestAllItems.call(this, 'GET', `/spaces/${spaceId}/computed-traits`, 'computedTraits');
207
+ }
208
+ else {
209
+ const limit = this.getNodeParameter('limit', index);
210
+ const result = await transport_1.publicApiRequest.call(this, 'GET', `/spaces/${spaceId}/computed-traits`, {}, { count: limit });
211
+ response = result.computedTraits;
212
+ }
213
+ }
214
+ else if (operation === 'get') {
215
+ const computedTraitId = this.getNodeParameter('computedTraitId', index);
216
+ const result = await transport_1.publicApiRequest.call(this, 'GET', `/spaces/${spaceId}/computed-traits/${computedTraitId}`);
217
+ response = result.computedTrait;
218
+ }
219
+ else if (operation === 'create') {
220
+ const name = this.getNodeParameter('name', index);
221
+ const enabled = this.getNodeParameter('enabled', index);
222
+ const definition = this.getNodeParameter('definition', index);
223
+ const body = {
224
+ name,
225
+ enabled,
226
+ definition: typeof definition === 'string' ? JSON.parse(definition) : definition,
227
+ };
228
+ const result = await transport_1.publicApiRequest.call(this, 'POST', `/spaces/${spaceId}/computed-traits`, body);
229
+ response = result.computedTrait;
230
+ }
231
+ else if (operation === 'update') {
232
+ const computedTraitId = this.getNodeParameter('computedTraitId', index);
233
+ const updateFields = this.getNodeParameter('updateFields', index);
234
+ const body = {};
235
+ if (updateFields.name)
236
+ body.name = updateFields.name;
237
+ if (updateFields.enabled !== undefined)
238
+ body.enabled = updateFields.enabled;
239
+ if (updateFields.description)
240
+ body.description = updateFields.description;
241
+ const result = await transport_1.publicApiRequest.call(this, 'PATCH', `/spaces/${spaceId}/computed-traits/${computedTraitId}`, body);
242
+ response = result.computedTrait;
243
+ }
244
+ else if (operation === 'delete') {
245
+ const computedTraitId = this.getNodeParameter('computedTraitId', index);
246
+ await transport_1.publicApiRequest.call(this, 'DELETE', `/spaces/${spaceId}/computed-traits/${computedTraitId}`);
247
+ response = { success: true, computedTraitId };
248
+ }
249
+ else {
250
+ throw new Error(`Unknown operation: ${operation}`);
251
+ }
252
+ const executionData = Array.isArray(response)
253
+ ? response.map((item) => ({ json: item }))
254
+ : [{ json: response }];
255
+ return executionData;
256
+ }
257
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../nodes/Segment/actions/computedTraits/index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAkMH,sDA6FC;AA5RD,+CAA6E;AAEhE,QAAA,wBAAwB,GAAsB;IAC1D;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,gBAAgB,CAAC;aAC5B;SACD;QACD,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,QAAQ;gBACd,KAAK,EAAE,QAAQ;gBACf,WAAW,EAAE,yBAAyB;gBACtC,MAAM,EAAE,y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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 destinationsOperations: INodeProperties[];
3
+ export declare const destinationsFields: INodeProperties[];
4
+ export declare function executeDestinations(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/destinations/index.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,iBAAiB,EAAe,kBAAkB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAIxG,eAAO,MAAM,sBAAsB,EAAE,eAAe,EAmDnD,CAAC;AAEF,eAAO,MAAM,kBAAkB,EAAE,eAAe,EAyJ/C,CAAC;AAEF,wBAAsB,mBAAmB,CACxC,IAAI,EAAE,iBAAiB,EACvB,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,kBAAkB,EAAE,CAAC,CAuG/B"}