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
package/LICENSE ADDED
@@ -0,0 +1,46 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab.
4
+
5
+ Licensor:
6
+ Velocity BPA, LLC
7
+ https://velobpa.com
8
+
9
+ Licensed Work:
10
+ This repository and all source code, documentation, and associated artifacts
11
+ contained herein, including all n8n community nodes published by Velocity BPA.
12
+
13
+ Additional Use Grant:
14
+ You may use, modify, and run the Licensed Work free of charge for:
15
+ - Personal use
16
+ - Educational use
17
+ - Research use
18
+ - Internal business use, provided such use does not involve resale,
19
+ redistribution, or offering the Licensed Work as part of a commercial
20
+ product or service.
21
+
22
+ Commercial Use Restriction:
23
+ Commercial Use of the Licensed Work is prohibited without a valid
24
+ Commercial License issued by the Licensor.
25
+
26
+ Commercial Use includes, but is not limited to:
27
+ - Use of the Licensed Work within any Software-as-a-Service (SaaS),
28
+ Platform-as-a-Service (PaaS), or hosted application that is sold,
29
+ licensed, or monetized in any form
30
+ - Offering the Licensed Work as part of a managed services engagement
31
+ - Bundling or redistributing the Licensed Work with a paid product
32
+ - Reselling, sublicensing, or white-labeling the Licensed Work
33
+ - Embedding the Licensed Work into any commercial automation platform,
34
+ integration product, or solution offering
35
+
36
+ Change Date:
37
+ January 1, 2030
38
+
39
+ Change License:
40
+ Apache License, Version 2.0
41
+
42
+ For commercial licensing inquiries:
43
+ licensing@velobpa.com
44
+
45
+ Business Source License 1.1 full text:
46
+ https://mariadb.com/bsl11/
package/README.md ADDED
@@ -0,0 +1,419 @@
1
+ # n8n-nodes-segment
2
+
3
+ > [Velocity BPA Licensing Notice]
4
+ >
5
+ > This n8n node is licensed under the Business Source License 1.1 (BSL 1.1).
6
+ >
7
+ > Use of this node by for-profit organizations in production environments requires a commercial license from Velocity BPA.
8
+ >
9
+ > For licensing information, visit https://velobpa.com/licensing or contact licensing@velobpa.com.
10
+
11
+ A comprehensive n8n community node for Segment, the leading Customer Data Platform (CDP). This integration provides 16 resources and 80+ operations for collecting, managing, and controlling customer data across marketing, analytics, and data warehouse destinations.
12
+
13
+ ![n8n](https://img.shields.io/badge/n8n-community--node-orange)
14
+ ![Segment](https://img.shields.io/badge/Segment-CDP-52BD95)
15
+ ![License](https://img.shields.io/badge/license-BSL--1.1-blue)
16
+
17
+ ## Features
18
+
19
+ - **Tracking API Integration**: Send track, identify, page, screen, group, and alias events
20
+ - **Batch Event Processing**: Efficiently send up to 2,500 events per batch (500KB max)
21
+ - **Source & Destination Management**: Create, configure, and manage data sources and destinations
22
+ - **Tracking Plans**: Implement and enforce data governance with schema validation
23
+ - **Custom Functions**: Deploy serverless functions for data transformation
24
+ - **Personas Support**: Manage audiences, computed traits, and identity resolution spaces
25
+ - **Privacy Compliance**: GDPR-compliant user deletion and data suppression
26
+ - **IAM Management**: Control workspace users and permissions
27
+ - **Audit Trail**: Monitor all workspace changes and activities
28
+ - **Regional Support**: US and EU data residency options
29
+
30
+ ## Installation
31
+
32
+ ### Community Nodes (Recommended)
33
+
34
+ 1. Open n8n
35
+ 2. Go to **Settings** > **Community Nodes**
36
+ 3. Click **Install a community node**
37
+ 4. Enter `n8n-nodes-segment`
38
+ 5. Click **Install**
39
+
40
+ ### Manual Installation
41
+
42
+ ```bash
43
+ # Navigate to your n8n installation
44
+ cd ~/.n8n
45
+
46
+ # Install the package
47
+ npm install n8n-nodes-segment
48
+
49
+ # Restart n8n
50
+ ```
51
+
52
+ ### Development Installation
53
+
54
+ ```bash
55
+ # Clone the repository
56
+ git clone https://github.com/Velocity-BPA/n8n-nodes-segment.git
57
+ cd n8n-nodes-segment
58
+
59
+ # Install dependencies
60
+ npm install
61
+
62
+ # Build the project
63
+ npm run build
64
+
65
+ # Create symlink to n8n custom nodes directory
66
+ mkdir -p ~/.n8n/custom
67
+ ln -s $(pwd) ~/.n8n/custom/n8n-nodes-segment
68
+
69
+ # Restart n8n
70
+ n8n start
71
+ ```
72
+
73
+ ## Credentials Setup
74
+
75
+ ### Required Credentials
76
+
77
+ | Credential | Description | Required For |
78
+ |-----------|-------------|--------------|
79
+ | Write Key | Source-specific API key for tracking | Tracking API (track, identify, etc.) |
80
+ | Public API Token | Workspace API token | Public API (sources, destinations, etc.) |
81
+
82
+ ### Configuration Options
83
+
84
+ | Option | Description | Default |
85
+ |--------|-------------|---------|
86
+ | Region | Data residency region (US or EU) | US |
87
+ | Tracking Base URL | Custom tracking API endpoint | Auto-configured |
88
+ | Public Base URL | Custom public API endpoint | https://api.segmentapis.com |
89
+
90
+ ### Getting Your Credentials
91
+
92
+ 1. **Write Key**:
93
+ - Go to Segment > Sources > [Your Source] > Settings > API Keys
94
+ - Copy the Write Key
95
+
96
+ 2. **Public API Token**:
97
+ - Go to Segment > Settings > Access Management > Tokens
98
+ - Create a new token with appropriate permissions
99
+
100
+ ## Resources & Operations
101
+
102
+ ### Track (Tracking API)
103
+ | Operation | Description |
104
+ |-----------|-------------|
105
+ | Track | Track a user action/event |
106
+ | Identify | Identify a user with traits |
107
+ | Page | Track a page view |
108
+ | Screen | Track a screen view (mobile) |
109
+ | Group | Associate user with group |
110
+ | Alias | Merge two user identities |
111
+ | Batch | Send batch of events |
112
+
113
+ ### Sources
114
+ | Operation | Description |
115
+ |-----------|-------------|
116
+ | Create | Create new source |
117
+ | Get | Get source by ID |
118
+ | Get Many | List all sources |
119
+ | Update | Update source settings |
120
+ | Delete | Delete source |
121
+ | Get Schema | Get source schema |
122
+ | Update Schema | Update schema settings |
123
+ | Get Connected Destinations | List connected destinations |
124
+
125
+ ### Destinations
126
+ | Operation | Description |
127
+ |-----------|-------------|
128
+ | Create | Create destination |
129
+ | Get | Get destination by ID |
130
+ | Get Many | List all destinations |
131
+ | Update | Update destination settings |
132
+ | Delete | Delete destination |
133
+ | Get Subscriptions | Get event subscriptions |
134
+
135
+ ### Warehouses
136
+ | Operation | Description |
137
+ |-----------|-------------|
138
+ | Create | Create warehouse connection |
139
+ | Get | Get warehouse by ID |
140
+ | Get Many | List data warehouses |
141
+ | Update | Update warehouse settings |
142
+ | Delete | Delete warehouse |
143
+ | Get Connection State | Get connection status |
144
+ | Add Source | Connect source to warehouse |
145
+ | Remove Source | Disconnect source |
146
+
147
+ ### Tracking Plans
148
+ | Operation | Description |
149
+ |-----------|-------------|
150
+ | Create | Create tracking plan |
151
+ | Get | Get tracking plan by ID |
152
+ | Get Many | List tracking plans |
153
+ | Update | Update tracking plan |
154
+ | Delete | Delete tracking plan |
155
+ | Get Rules | Get plan rules/schema |
156
+ | Update Rules | Update rules |
157
+ | Connect Source | Connect source to plan |
158
+ | Disconnect Source | Disconnect source |
159
+
160
+ ### Functions
161
+ | Operation | Description |
162
+ |-----------|-------------|
163
+ | Create | Create source/destination function |
164
+ | Get | Get function by ID |
165
+ | Get Many | List all functions |
166
+ | Update | Update function code |
167
+ | Delete | Delete function |
168
+ | Deploy | Deploy function |
169
+ | Get Logs | Get function logs |
170
+
171
+ ### Spaces (Personas)
172
+ | Operation | Description |
173
+ |-----------|-------------|
174
+ | Get | Get space by ID |
175
+ | Get Many | List Personas spaces |
176
+ | Get Traits | Get computed traits |
177
+ | Get Audiences | Get audiences |
178
+ | Create Audience | Create audience |
179
+ | Update Audience | Update audience |
180
+ | Delete Audience | Delete audience |
181
+
182
+ ### Users (IAM)
183
+ | Operation | Description |
184
+ |-----------|-------------|
185
+ | Get | Get user by ID |
186
+ | Get Many | List workspace users |
187
+ | Invite | Invite user to workspace |
188
+ | Delete | Remove user from workspace |
189
+ | Get Permissions | Get user permissions |
190
+ | List Groups | List user groups |
191
+
192
+ ### Regulations (Privacy)
193
+ | Operation | Description |
194
+ |-----------|-------------|
195
+ | Create Deletion | Create user deletion request (GDPR) |
196
+ | Get Deletion | Get deletion status |
197
+ | List Deletions | List deletion requests |
198
+ | Create Suppression | Suppress user data |
199
+ | List Suppressions | List suppressions |
200
+
201
+ ### Catalog
202
+ | Operation | Description |
203
+ |-----------|-------------|
204
+ | List Sources | List available source types |
205
+ | Get Source | Get source type details |
206
+ | List Destinations | List available destinations |
207
+ | Get Destination | Get destination details |
208
+
209
+ ### Transformations
210
+ | Operation | Description |
211
+ |-----------|-------------|
212
+ | Create | Create transformation |
213
+ | Get | Get transformation by ID |
214
+ | Get Many | List transformations |
215
+ | Update | Update transformation |
216
+ | Delete | Delete transformation |
217
+
218
+ ### Computed Traits
219
+ | Operation | Description |
220
+ |-----------|-------------|
221
+ | Create | Create computed trait |
222
+ | Get | Get trait by ID |
223
+ | Get Many | List computed traits |
224
+ | Update | Update trait definition |
225
+ | Delete | Delete trait |
226
+
227
+ ### Audiences
228
+ | Operation | Description |
229
+ |-----------|-------------|
230
+ | Create | Create audience |
231
+ | Get | Get audience by ID |
232
+ | Get Many | List audiences |
233
+ | Update | Update audience |
234
+ | Delete | Delete audience |
235
+ | Get Preview | Preview audience members |
236
+
237
+ ### Labels
238
+ | Operation | Description |
239
+ |-----------|-------------|
240
+ | Create | Create label |
241
+ | Get Many | List labels |
242
+ | Delete | Delete label |
243
+ | Add to Source | Add label to source |
244
+ | Remove from Source | Remove label |
245
+
246
+ ### Audit Trail
247
+ | Operation | Description |
248
+ |-----------|-------------|
249
+ | Get | Get audit event by ID |
250
+ | Get Many | List audit events |
251
+
252
+ ### Workspace
253
+ | Operation | Description |
254
+ |-----------|-------------|
255
+ | Get | Get workspace info |
256
+ | Get Many | List accessible workspaces |
257
+
258
+ ## Trigger Node
259
+
260
+ The Segment Trigger node polls for changes in your Segment workspace:
261
+
262
+ | Trigger | Description |
263
+ |---------|-------------|
264
+ | Source Created | New source created |
265
+ | Source Updated | Source configuration changed |
266
+ | Destination Created | New destination created |
267
+ | Destination Updated | Destination configuration changed |
268
+ | Tracking Plan Created | New tracking plan created |
269
+ | Tracking Plan Updated | Tracking plan changed |
270
+ | Audience Created | New audience created |
271
+ | Function Deployed | Function deployed |
272
+ | Audit Event | New audit events |
273
+
274
+ ## Usage Examples
275
+
276
+ ### Track User Event
277
+
278
+ ```javascript
279
+ // Track a purchase event
280
+ {
281
+ "resource": "track",
282
+ "operation": "track",
283
+ "userId": "user_123",
284
+ "event": "Item Purchased",
285
+ "properties": {
286
+ "item_id": "SKU-001",
287
+ "price": 29.99,
288
+ "currency": "USD"
289
+ }
290
+ }
291
+ ```
292
+
293
+ ### Identify User
294
+
295
+ ```javascript
296
+ // Identify a user with traits
297
+ {
298
+ "resource": "track",
299
+ "operation": "identify",
300
+ "userId": "user_123",
301
+ "traits": {
302
+ "email": "user@example.com",
303
+ "name": "John Doe",
304
+ "plan": "premium"
305
+ }
306
+ }
307
+ ```
308
+
309
+ ### Create GDPR Deletion Request
310
+
311
+ ```javascript
312
+ // Delete user data for GDPR compliance
313
+ {
314
+ "resource": "regulations",
315
+ "operation": "createDeletion",
316
+ "regulationType": "SUPPRESS_AND_DELETE",
317
+ "subjectType": "USER_ID",
318
+ "subjectIds": ["user_123", "user_456"]
319
+ }
320
+ ```
321
+
322
+ ## Segment Concepts
323
+
324
+ | Concept | Description |
325
+ |---------|-------------|
326
+ | Source | Data collection point (website, app, server) |
327
+ | Destination | Integration receiving data (analytics, warehouse) |
328
+ | Warehouse | Data warehouse for raw data |
329
+ | Tracking Plan | Schema definition for events |
330
+ | Function | Custom code for transformations |
331
+ | Space | Personas identity resolution workspace |
332
+ | Audience | User segment for targeting |
333
+ | Computed Trait | Calculated user attribute |
334
+ | Write Key | Source-specific API key |
335
+
336
+ ## Error Handling
337
+
338
+ The node handles various Segment API errors:
339
+
340
+ | Error Code | Description | Resolution |
341
+ |-----------|-------------|------------|
342
+ | 400 | Bad Request | Check request parameters |
343
+ | 401 | Unauthorized | Verify API credentials |
344
+ | 403 | Forbidden | Check API token permissions |
345
+ | 404 | Not Found | Verify resource ID |
346
+ | 429 | Rate Limited | Implement backoff/retry |
347
+ | 500 | Server Error | Retry after delay |
348
+
349
+ ## Security Best Practices
350
+
351
+ 1. **Rotate API Keys**: Regularly rotate Write Keys and API tokens
352
+ 2. **Minimal Permissions**: Grant only necessary permissions to API tokens
353
+ 3. **Secure Storage**: Use n8n's credential encryption for sensitive data
354
+ 4. **Data Residency**: Choose appropriate region (US/EU) for compliance
355
+ 5. **Audit Logging**: Monitor audit trail for suspicious activity
356
+
357
+ ## Development
358
+
359
+ ```bash
360
+ # Install dependencies
361
+ npm install
362
+
363
+ # Build
364
+ npm run build
365
+
366
+ # Run tests
367
+ npm test
368
+
369
+ # Run tests with coverage
370
+ npm run test:coverage
371
+
372
+ # Lint code
373
+ npm run lint
374
+
375
+ # Fix linting issues
376
+ npm run lint:fix
377
+ ```
378
+
379
+ ## Author
380
+
381
+ **Velocity BPA**
382
+ - Website: [velobpa.com](https://velobpa.com)
383
+ - GitHub: [Velocity-BPA](https://github.com/Velocity-BPA)
384
+
385
+ ## Licensing
386
+
387
+ This n8n community node is licensed under the **Business Source License 1.1**.
388
+
389
+ ### Free Use
390
+ Permitted for personal, educational, research, and internal business use.
391
+
392
+ ### Commercial Use
393
+ Use of this node within any SaaS, PaaS, hosted platform, managed service,
394
+ or paid automation offering requires a commercial license.
395
+
396
+ For licensing inquiries:
397
+ **licensing@velobpa.com**
398
+
399
+ See [LICENSE](LICENSE), [COMMERCIAL_LICENSE.md](COMMERCIAL_LICENSE.md), and [LICENSING_FAQ.md](LICENSING_FAQ.md) for details.
400
+
401
+ ## Contributing
402
+
403
+ 1. Fork the repository
404
+ 2. Create a feature branch (`git checkout -b feature/amazing-feature`)
405
+ 3. Commit your changes (`git commit -m 'Add amazing feature'`)
406
+ 4. Push to the branch (`git push origin feature/amazing-feature`)
407
+ 5. Open a Pull Request
408
+
409
+ ## Support
410
+
411
+ - **Documentation**: [Segment API Docs](https://segment.com/docs/connections/sources/)
412
+ - **Issues**: [GitHub Issues](https://github.com/Velocity-BPA/n8n-nodes-segment/issues)
413
+ - **Email**: support@velobpa.com
414
+
415
+ ## Acknowledgments
416
+
417
+ - [Segment](https://segment.com) for their comprehensive CDP platform
418
+ - [n8n](https://n8n.io) for the workflow automation platform
419
+ - The open-source community for continuous inspiration
@@ -0,0 +1,10 @@
1
+ import type { IAuthenticateGeneric, ICredentialTestRequest, ICredentialType, INodeProperties } from 'n8n-workflow';
2
+ export declare class SegmentApi implements ICredentialType {
3
+ name: string;
4
+ displayName: string;
5
+ documentationUrl: string;
6
+ properties: INodeProperties[];
7
+ authenticate: IAuthenticateGeneric;
8
+ test: ICredentialTestRequest;
9
+ }
10
+ //# sourceMappingURL=SegmentApi.credentials.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentApi.credentials.d.ts","sourceRoot":"","sources":["../../credentials/SegmentApi.credentials.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACX,oBAAoB,EACpB,sBAAsB,EACtB,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,UAAW,YAAW,eAAe;IACjD,IAAI,SAAgB;IACpB,WAAW,SAAiB;IAC5B,gBAAgB,SAA+B;IAC/C,UAAU,EAAE,eAAe,EAAE,CAuD3B;IAEF,YAAY,EAAE,oBAAoB,CAGhC;IAEF,IAAI,EAAE,sBAAsB,CAS1B;CACF"}
@@ -0,0 +1,88 @@
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.SegmentApi = void 0;
10
+ class SegmentApi {
11
+ constructor() {
12
+ this.name = 'segmentApi';
13
+ this.displayName = 'Segment API';
14
+ this.documentationUrl = 'https://segment.com/docs/';
15
+ this.properties = [
16
+ {
17
+ displayName: 'Region',
18
+ name: 'region',
19
+ type: 'options',
20
+ options: [
21
+ {
22
+ name: 'United States',
23
+ value: 'us',
24
+ },
25
+ {
26
+ name: 'European Union',
27
+ value: 'eu',
28
+ },
29
+ ],
30
+ default: 'us',
31
+ description: 'The region where your Segment data is stored',
32
+ },
33
+ {
34
+ displayName: 'Write Key',
35
+ name: 'writeKey',
36
+ type: 'string',
37
+ typeOptions: {
38
+ password: true,
39
+ },
40
+ default: '',
41
+ description: 'The Write Key for your Segment source (used for Tracking API)',
42
+ hint: 'Found in your Segment source settings',
43
+ },
44
+ {
45
+ displayName: 'Public API Token',
46
+ name: 'publicApiToken',
47
+ type: 'string',
48
+ typeOptions: {
49
+ password: true,
50
+ },
51
+ default: '',
52
+ description: 'The API token for Segment Public API (used for workspace management)',
53
+ hint: 'Generate in Segment Settings > Access Management > Tokens',
54
+ },
55
+ {
56
+ displayName: 'Tracking API Base URL',
57
+ name: 'trackingBaseUrl',
58
+ type: 'string',
59
+ default: '',
60
+ placeholder: 'https://api.segment.io/v1',
61
+ description: 'Override the default Tracking API base URL (leave empty to use region default)',
62
+ },
63
+ {
64
+ displayName: 'Public API Base URL',
65
+ name: 'publicBaseUrl',
66
+ type: 'string',
67
+ default: 'https://api.segmentapis.com',
68
+ description: 'The base URL for the Segment Public API',
69
+ },
70
+ ];
71
+ this.authenticate = {
72
+ type: 'generic',
73
+ properties: {},
74
+ };
75
+ this.test = {
76
+ request: {
77
+ baseURL: '={{$credentials.publicBaseUrl || "https://api.segmentapis.com"}}',
78
+ url: '/workspaces',
79
+ method: 'GET',
80
+ headers: {
81
+ Authorization: '=Bearer {{$credentials.publicApiToken}}',
82
+ },
83
+ },
84
+ };
85
+ }
86
+ }
87
+ exports.SegmentApi = SegmentApi;
88
+ //# sourceMappingURL=SegmentApi.credentials.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"SegmentApi.credentials.js","sourceRoot":"","sources":["../../credentials/SegmentApi.credentials.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AASH,MAAa,UAAU;IAAvB;QACC,SAAI,GAAG,YAAY,CAAC;QACpB,gBAAW,GAAG,aAAa,CAAC;QAC5B,qBAAgB,GAAG,2BAA2B,CAAC;QAC/C,eAAU,GAAsB;YAC/B;gBACC,WAAW,EAAE,QAAQ;gBACrB,IAAI,EAAE,QAAQ;gBACd,IAAI,EAAE,SAAS;gBACf,OAAO,EAAE;oBACR;wBACC,IAAI,EAAE,eAAe;wBACrB,KAAK,EAAE,IAAI;qBACX;oBACD;wBACC,IAAI,EAAE,gBAAgB;wBACtB,KAAK,EAAE,IAAI;qBACX;iBACD;gBACD,OAAO,EAAE,IAAI;gBACb,WAAW,EAAE,8CAA8C;aAC3D;YACD;gBACC,WAAW,EAAE,WAAW;gBACxB,IAAI,EAAE,UAAU;gBAChB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,+DAA+D;gBAC5E,IAAI,EAAE,uCAAuC;aAC7C;YACD;gBACC,WAAW,EAAE,kBAAkB;gBAC/B,IAAI,EAAE,gBAAgB;gBACtB,IAAI,EAAE,QAAQ;gBACd,WAAW,EAAE;oBACZ,QAAQ,EAAE,IAAI;iBACd;gBACD,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,sEAAsE;gBACnF,IAAI,EAAE,2DAA2D;aACjE;YACD;gBACC,WAAW,EAAE,uBAAuB;gBACpC,IAAI,EAAE,iBAAiB;gBACvB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,EAAE;gBACX,WAAW,EAAE,2BAA2B;gBACxC,WAAW,EAAE,gFAAgF;aAC7F;YACD;gBACC,WAAW,EAAE,qBAAqB;gBAClC,IAAI,EAAE,eAAe;gBACrB,IAAI,EAAE,QAAQ;gBACd,OAAO,EAAE,6BAA6B;gBACtC,WAAW,EAAE,yCAAyC;aACtD;SACD,CAAC;QAEF,iBAAY,GAAyB;YACpC,IAAI,EAAE,SAAS;YACf,UAAU,EAAE,EAAE;SACd,CAAC;QAEF,SAAI,GAA2B;YAC9B,OAAO,EAAE;gBACR,OAAO,EAAE,kEAAkE;gBAC3E,GAAG,EAAE,aAAa;gBAClB,MAAM,EAAE,KAAK;gBACb,OAAO,EAAE;oBACR,aAAa,EAAE,yCAAyC;iBACxD;aACD;SACD,CAAC;IACH,CAAC;CAAA;AA5ED,gCA4EC"}
@@ -0,0 +1,4 @@
1
+ export * from './nodes/Segment/Segment.node';
2
+ export * from './nodes/Segment/SegmentTrigger.node';
3
+ export * from './credentials/SegmentApi.credentials';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":"AAOA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,qCAAqC,CAAC;AACpD,cAAc,sCAAsC,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
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
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ __exportStar(require("./nodes/Segment/Segment.node"), exports);
24
+ __exportStar(require("./nodes/Segment/SegmentTrigger.node"), exports);
25
+ __exportStar(require("./credentials/SegmentApi.credentials"), exports);
26
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../index.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;;;;;;;;;;;;;;AAEH,+DAA6C;AAC7C,sEAAoD;AACpD,uEAAqD"}
@@ -0,0 +1,6 @@
1
+ import type { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
2
+ export declare class Segment implements INodeType {
3
+ description: INodeTypeDescription;
4
+ execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
5
+ }
6
+ //# sourceMappingURL=Segment.node.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Segment.node.d.ts","sourceRoot":"","sources":["../../../nodes/Segment/Segment.node.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,MAAM,cAAc,CAAC;AAqEtB,qBAAa,OAAQ,YAAW,SAAS;IACxC,WAAW,EAAE,oBAAoB,CA+I/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CAmFvE"}