@keystrokehq/segment 0.0.1 → 0.0.4

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.
@@ -16,7 +16,7 @@ declare const listTrackingPlans: _keystrokehq_core0.Operation<z.ZodIntersection<
16
16
  }, z.core.$catchall<z.ZodUnknown>>>;
17
17
  nextPageToken: z.ZodOptional<z.ZodString>;
18
18
  totalEntries: z.ZodOptional<z.ZodNumber>;
19
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
19
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
20
20
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
21
21
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
22
22
  us: "us";
@@ -47,7 +47,7 @@ declare const getTrackingPlan: _keystrokehq_core0.Operation<z.ZodObject<{
47
47
  name: z.ZodOptional<z.ZodString>;
48
48
  description: z.ZodOptional<z.ZodString>;
49
49
  type: z.ZodOptional<z.ZodString>;
50
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
50
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
51
51
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
52
52
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
53
53
  us: "us";
@@ -78,7 +78,7 @@ declare const createTrackingPlan: _keystrokehq_core0.Operation<z.ZodObject<{
78
78
  name: z.ZodOptional<z.ZodString>;
79
79
  description: z.ZodOptional<z.ZodString>;
80
80
  type: z.ZodOptional<z.ZodString>;
81
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
81
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
82
82
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
83
83
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
84
84
  us: "us";
@@ -109,7 +109,7 @@ declare const updateTrackingPlan: _keystrokehq_core0.Operation<z.ZodObject<{
109
109
  name: z.ZodOptional<z.ZodString>;
110
110
  description: z.ZodOptional<z.ZodString>;
111
111
  type: z.ZodOptional<z.ZodString>;
112
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
112
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
113
113
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
114
114
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
115
115
  us: "us";
@@ -134,7 +134,7 @@ declare const updateTrackingPlan: _keystrokehq_core0.Operation<z.ZodObject<{
134
134
  }, z.core.$strip>>[] | undefined>], undefined>;
135
135
  declare const deleteTrackingPlan: _keystrokehq_core0.Operation<z.ZodObject<{
136
136
  [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
137
- }, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
137
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
138
138
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
139
139
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
140
140
  us: "us";
@@ -166,7 +166,7 @@ declare const listTrackingPlanRules: _keystrokehq_core0.Operation<z.ZodObject<{
166
166
  version: z.ZodOptional<z.ZodNumber>;
167
167
  description: z.ZodOptional<z.ZodString>;
168
168
  }, z.core.$catchall<z.ZodUnknown>>>;
169
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
169
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
170
170
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
171
171
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
172
172
  us: "us";
@@ -204,7 +204,7 @@ declare const replaceTrackingPlanRules: _keystrokehq_core0.Operation<z.ZodObject
204
204
  version: z.ZodOptional<z.ZodNumber>;
205
205
  description: z.ZodOptional<z.ZodString>;
206
206
  }, z.core.$catchall<z.ZodUnknown>>>;
207
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
207
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
208
208
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
209
209
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
210
210
  us: "us";
@@ -234,7 +234,7 @@ declare const listTrackingPlanSources: _keystrokehq_core0.Operation<z.ZodObject<
234
234
  sourceId: z.ZodString;
235
235
  trackingPlanId: z.ZodOptional<z.ZodString>;
236
236
  }, z.core.$catchall<z.ZodUnknown>>>;
237
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
237
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
238
238
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
239
239
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
240
240
  us: "us";
@@ -263,7 +263,7 @@ declare const connectTrackingPlanSource: _keystrokehq_core0.Operation<z.ZodObjec
263
263
  }, z.core.$strip>, z.ZodObject<{
264
264
  sourceId: z.ZodString;
265
265
  trackingPlanId: z.ZodOptional<z.ZodString>;
266
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
266
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
267
267
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
268
268
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
269
269
  us: "us";
@@ -291,7 +291,7 @@ declare const disconnectTrackingPlanSource: _keystrokehq_core0.Operation<z.ZodOb
291
291
  sourceId: z.ZodString;
292
292
  }, z.core.$strip>, z.ZodObject<{
293
293
  removed: z.ZodLiteral<true>;
294
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
294
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
295
295
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
296
296
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
297
297
  us: "us";
@@ -324,7 +324,7 @@ declare const listTrackingPlanViolations: _keystrokehq_core0.Operation<z.ZodObje
324
324
  violationReason: z.ZodOptional<z.ZodString>;
325
325
  timestamp: z.ZodOptional<z.ZodString>;
326
326
  }, z.core.$catchall<z.ZodUnknown>>>;
327
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
327
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
328
328
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
329
329
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
330
330
  us: "us";
@@ -33,14 +33,14 @@ declare const identify: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodInte
33
33
  }, z.core.$strip>>, z.ZodObject<{
34
34
  sent: z.ZodBoolean;
35
35
  method: z.ZodEnum<{
36
+ group: "group";
36
37
  page: "page";
37
38
  screen: "screen";
38
39
  identify: "identify";
39
40
  track: "track";
40
- group: "group";
41
41
  alias: "alias";
42
42
  }>;
43
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
43
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
44
44
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
45
45
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
46
46
  us: "us";
@@ -94,14 +94,14 @@ declare const track: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodInterse
94
94
  }, z.core.$strip>>, z.ZodObject<{
95
95
  sent: z.ZodBoolean;
96
96
  method: z.ZodEnum<{
97
+ group: "group";
97
98
  page: "page";
98
99
  screen: "screen";
99
100
  identify: "identify";
100
101
  track: "track";
101
- group: "group";
102
102
  alias: "alias";
103
103
  }>;
104
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
104
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
105
105
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
106
106
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
107
107
  us: "us";
@@ -156,14 +156,14 @@ declare const page: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodIntersec
156
156
  }, z.core.$strip>>, z.ZodObject<{
157
157
  sent: z.ZodBoolean;
158
158
  method: z.ZodEnum<{
159
+ group: "group";
159
160
  page: "page";
160
161
  screen: "screen";
161
162
  identify: "identify";
162
163
  track: "track";
163
- group: "group";
164
164
  alias: "alias";
165
165
  }>;
166
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
166
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
167
167
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
168
168
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
169
169
  us: "us";
@@ -218,14 +218,14 @@ declare const screen: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodInters
218
218
  }, z.core.$strip>>, z.ZodObject<{
219
219
  sent: z.ZodBoolean;
220
220
  method: z.ZodEnum<{
221
+ group: "group";
221
222
  page: "page";
222
223
  screen: "screen";
223
224
  identify: "identify";
224
225
  track: "track";
225
- group: "group";
226
226
  alias: "alias";
227
227
  }>;
228
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
228
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
229
229
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
230
230
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
231
231
  us: "us";
@@ -279,14 +279,14 @@ declare const group: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodInterse
279
279
  }, z.core.$strip>>, z.ZodObject<{
280
280
  sent: z.ZodBoolean;
281
281
  method: z.ZodEnum<{
282
+ group: "group";
282
283
  page: "page";
283
284
  screen: "screen";
284
285
  identify: "identify";
285
286
  track: "track";
286
- group: "group";
287
287
  alias: "alias";
288
288
  }>;
289
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
289
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
290
290
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
291
291
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
292
292
  us: "us";
@@ -337,14 +337,14 @@ declare const alias: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<
337
337
  }, z.core.$strip>>, z.ZodObject<{
338
338
  sent: z.ZodBoolean;
339
339
  method: z.ZodEnum<{
340
+ group: "group";
340
341
  page: "page";
341
342
  screen: "screen";
342
343
  identify: "identify";
343
344
  track: "track";
344
- group: "group";
345
345
  alias: "alias";
346
346
  }>;
347
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
347
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
348
348
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
349
349
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
350
350
  us: "us";
@@ -390,11 +390,11 @@ declare const batch: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<
390
390
  }, z.core.$strip>, z.ZodObject<{
391
391
  events: z.ZodArray<z.ZodObject<{
392
392
  type: z.ZodEnum<{
393
+ group: "group";
393
394
  page: "page";
394
395
  screen: "screen";
395
396
  identify: "identify";
396
397
  track: "track";
397
- group: "group";
398
398
  alias: "alias";
399
399
  }>;
400
400
  }, z.core.$catchall<z.ZodUnknown>>>;
@@ -402,15 +402,15 @@ declare const batch: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<
402
402
  chunksSent: z.ZodNumber;
403
403
  rejected: z.ZodArray<z.ZodObject<{
404
404
  type: z.ZodEnum<{
405
+ group: "group";
405
406
  page: "page";
406
407
  screen: "screen";
407
408
  identify: "identify";
408
409
  track: "track";
409
- group: "group";
410
410
  alias: "alias";
411
411
  }>;
412
412
  }, z.core.$catchall<z.ZodUnknown>>>;
413
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
413
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
414
414
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
415
415
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
416
416
  us: "us";
@@ -465,14 +465,14 @@ declare const importEvent: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodI
465
465
  }, z.core.$strip>>, z.ZodObject<{
466
466
  sent: z.ZodBoolean;
467
467
  method: z.ZodEnum<{
468
+ group: "group";
468
469
  page: "page";
469
470
  screen: "screen";
470
471
  identify: "identify";
471
472
  track: "track";
472
- group: "group";
473
473
  alias: "alias";
474
474
  }>;
475
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
475
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
476
476
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
477
477
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
478
478
  us: "us";
@@ -31,7 +31,7 @@ declare const listTransformations: _keystrokehq_core0.Operation<z.ZodIntersectio
31
31
  }, z.core.$catchall<z.ZodUnknown>>>;
32
32
  nextPageToken: z.ZodOptional<z.ZodString>;
33
33
  totalEntries: z.ZodOptional<z.ZodNumber>;
34
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
34
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
35
35
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
36
36
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
37
37
  us: "us";
@@ -66,7 +66,7 @@ declare const getTransformation: _keystrokehq_core0.Operation<z.ZodObject<{
66
66
  newEventName: z.ZodOptional<z.ZodString>;
67
67
  propertyRenames: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
68
68
  propertyValueTransformations: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
69
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
69
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
70
70
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
71
71
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
72
72
  us: "us";
@@ -101,7 +101,7 @@ declare const createTransformation: _keystrokehq_core0.Operation<z.ZodObject<{
101
101
  newEventName: z.ZodOptional<z.ZodString>;
102
102
  propertyRenames: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
103
103
  propertyValueTransformations: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
104
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
104
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
105
105
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
106
106
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
107
107
  us: "us";
@@ -136,7 +136,7 @@ declare const updateTransformation: _keystrokehq_core0.Operation<z.ZodObject<{
136
136
  newEventName: z.ZodOptional<z.ZodString>;
137
137
  propertyRenames: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
138
138
  propertyValueTransformations: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
139
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
139
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
140
140
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
141
141
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
142
142
  us: "us";
@@ -161,7 +161,7 @@ declare const updateTransformation: _keystrokehq_core0.Operation<z.ZodObject<{
161
161
  }, z.core.$strip>>[] | undefined>], undefined>;
162
162
  declare const deleteTransformation: _keystrokehq_core0.Operation<z.ZodObject<{
163
163
  [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
164
- }, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
164
+ }, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
165
165
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
166
166
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
167
167
  us: "us";
@@ -1,21 +1,11 @@
1
- import { r as segment } from "./integration-D2yRaKFR.mjs";
2
- import { SegmentAudienceEvent, SegmentAudienceSyncEvent, SegmentComputedTraitEvent, SegmentDeletionRegulationEvent, SegmentDestinationCreatedEvent, SegmentFunctionVersionEvent, SegmentMonitoringEvent, SegmentReverseEtlRunEvent, SegmentSourceCreatedEvent, SegmentTrackingPlanViolationEvent, segmentAudienceWebhookEnvelopeSchema, segmentMonitoringAlertEnvelopeSchema } from "./events.mjs";
3
- import { z } from "zod";
1
+ import { r as segment } from "./integration-DJ9tRlCV.mjs";
2
+ import { SegmentAudienceSyncEvent, SegmentDeletionRegulationEvent, SegmentDestinationCreatedEvent, SegmentFunctionVersionEvent, SegmentReverseEtlRunEvent, SegmentSourceCreatedEvent, SegmentTrackingPlanViolationEvent } from "./events.mjs";
4
3
  import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
5
- import { BoundTrigger, WebhookRequest } from "@keystrokehq/core";
6
- import { PollingTriggerManifest, WebhookTriggerManifest } from "@keystrokehq/core/trigger";
4
+ import { BoundTrigger } from "@keystrokehq/core";
5
+ import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
7
6
 
8
7
  //#region src/triggers.d.ts
9
8
  type SegmentCredentialSets = readonly [typeof segment];
10
- type SegmentWebhookBindingOptions<TPayload, TOutput = TPayload> = IntegrationTriggerBindingOptions<TPayload, TOutput, WebhookRequest>;
11
- type SegmentWebhookBinding<TPayload> = <TOutput = TPayload>(options?: SegmentWebhookBindingOptions<TPayload, TOutput>) => BoundTrigger<z.output<typeof segmentAudienceWebhookEnvelopeSchema> | z.output<typeof segmentMonitoringAlertEnvelopeSchema>, SegmentCredentialSets, WebhookTriggerManifest, TOutput, WebhookRequest>;
12
- declare const webhooks: Readonly<{
13
- audienceEntered: SegmentWebhookBinding<SegmentAudienceEvent>;
14
- audienceExited: SegmentWebhookBinding<SegmentAudienceEvent>;
15
- computedTraitsUpdated: SegmentWebhookBinding<SegmentComputedTraitEvent>;
16
- functionsInvocationFailed: SegmentWebhookBinding<SegmentMonitoringEvent>;
17
- deliveryFailureSpike: SegmentWebhookBinding<SegmentMonitoringEvent>;
18
- }>;
19
9
  type SegmentPollingBindingOptions<TEvent, TOutput = TEvent> = IntegrationTriggerBindingOptions<TEvent, TOutput> & {
20
10
  readonly schedule?: string;
21
11
  };
@@ -51,4 +41,4 @@ declare const polling: Readonly<{
51
41
  deletionRegulationCompleted: typeof deletionRegulationCompleted;
52
42
  }>;
53
43
  //#endregion
54
- export { AudienceSyncPollParams, FunctionVersionPollParams, ReverseEtlRunPollParams, audienceSyncCompleted, deletionRegulationCompleted, destinationCreated, functionsDeploymentCompleted, polling, reverseEtlRunFailed, reverseEtlRunStarted, reverseEtlRunSucceeded, sourceCreated, trackingPlanViolationDetected, webhooks };
44
+ export { AudienceSyncPollParams, FunctionVersionPollParams, ReverseEtlRunPollParams, audienceSyncCompleted, deletionRegulationCompleted, destinationCreated, functionsDeploymentCompleted, polling, reverseEtlRunFailed, reverseEtlRunStarted, reverseEtlRunSucceeded, sourceCreated, trackingPlanViolationDetected };
package/dist/triggers.mjs CHANGED
@@ -1,176 +1,30 @@
1
1
  import { t as segment } from "./integration-B5zYasBZ.mjs";
2
2
  import { createSegmentClient } from "./client.mjs";
3
- import { segmentAudienceEventSchema, segmentAudienceSyncEventSchema, segmentAudienceWebhookEnvelopeSchema, segmentComputedTraitEventSchema, segmentDeletionRegulationEventSchema, segmentDestinationCreatedEventSchema, segmentFunctionVersionEventSchema, segmentMonitoringAlertEnvelopeSchema, segmentMonitoringEventSchema, segmentReverseEtlRunEventSchema, segmentSourceCreatedEventSchema, segmentTrackingPlanViolationEventSchema } from "./events.mjs";
4
- import { verifySegmentWebhookFromRequest } from "./verification.mjs";
5
- import { createPollingTriggerBindingFactory, createWebhookTriggerBindingFactory } from "@keystrokehq/integration-authoring";
3
+ import { segmentAudienceSyncEventSchema, segmentDeletionRegulationEventSchema, segmentDestinationCreatedEventSchema, segmentFunctionVersionEventSchema, segmentReverseEtlRunEventSchema, segmentSourceCreatedEventSchema, segmentTrackingPlanViolationEventSchema } from "./events.mjs";
4
+ import { createPollingTriggerBindingFactory } from "@keystrokehq/integration-authoring";
6
5
 
7
6
  //#region src/triggers.ts
8
- function isAudienceEntered(envelope) {
9
- const type = typeof envelope.type === "string" ? envelope.type.toLowerCase() : "";
10
- const properties = envelope.properties;
11
- const propsType = typeof properties?.type === "string" ? properties.type.toLowerCase() : "";
12
- if (!audienceKeyFromEnvelope(envelope)) return false;
13
- return type === "entered" || propsType === "entered" || audienceValueFromEnvelope(envelope) === true;
14
- }
15
- function isAudienceExited(envelope) {
16
- const type = typeof envelope.type === "string" ? envelope.type.toLowerCase() : "";
17
- const properties = envelope.properties;
18
- const propsType = typeof properties?.type === "string" ? properties.type.toLowerCase() : "";
19
- if (!audienceKeyFromEnvelope(envelope)) return false;
20
- return type === "exited" || propsType === "exited" || audienceValueFromEnvelope(envelope) === false;
21
- }
22
- function audienceKeyFromEnvelope(envelope) {
23
- const props = envelope.properties;
24
- if (props && typeof props.audience_key === "string") return props.audience_key;
25
- if (props && typeof props.audienceKey === "string") return props.audienceKey;
26
- if (typeof envelope.event === "string" && envelope.event.length > 0) return envelope.event;
27
- }
28
- function audienceValueFromEnvelope(envelope) {
29
- const props = envelope.properties;
30
- if (!props) return void 0;
31
- const key = audienceKeyFromEnvelope(envelope);
32
- if (!key) return void 0;
33
- const value = props[key];
34
- return typeof value === "boolean" ? value : void 0;
35
- }
36
- function mapAudienceEvent(envelope, type) {
37
- const audienceKey = audienceKeyFromEnvelope(envelope);
38
- if (!audienceKey) return null;
39
- return segmentAudienceEventSchema.parse({
40
- type,
41
- audienceKey,
42
- ...envelope.userId !== void 0 ? { userId: envelope.userId } : {},
43
- ...envelope.anonymousId !== void 0 ? { anonymousId: envelope.anonymousId } : {},
44
- ...envelope.userId !== void 0 ? { profileId: envelope.userId } : {},
45
- ...envelope.traits !== void 0 ? { traits: envelope.traits } : {},
46
- ...envelope.properties !== void 0 ? { properties: envelope.properties } : {},
47
- ...envelope.messageId !== void 0 ? { messageId: envelope.messageId } : {},
48
- ...envelope.timestamp !== void 0 ? { timestamp: envelope.timestamp } : {},
49
- raw: envelope
50
- });
51
- }
52
- function mapComputedTraitEvent(envelope) {
53
- const key = audienceKeyFromEnvelope(envelope);
54
- if (!key) return null;
55
- const props = envelope.properties;
56
- const value = props ? props[key] : void 0;
57
- return segmentComputedTraitEventSchema.parse({
58
- traitKey: key,
59
- value,
60
- ...envelope.userId !== void 0 ? { userId: envelope.userId } : {},
61
- ...envelope.userId !== void 0 ? { profileId: envelope.userId } : {},
62
- ...envelope.messageId !== void 0 ? { messageId: envelope.messageId } : {},
63
- ...envelope.timestamp !== void 0 ? { timestamp: envelope.timestamp } : {},
64
- raw: envelope
65
- });
66
- }
67
- function mapMonitoringEvent(envelope) {
68
- if (!envelope.id) return null;
69
- return segmentMonitoringEventSchema.parse({
70
- alertId: envelope.id,
71
- eventType: envelope.eventType ?? "unknown",
72
- ...envelope.severity !== void 0 ? { severity: envelope.severity } : {},
73
- ...envelope.firedAt !== void 0 ? { firedAt: envelope.firedAt } : {},
74
- ...envelope.sourceId !== void 0 ? { sourceId: envelope.sourceId } : {},
75
- ...envelope.destinationId !== void 0 ? { destinationId: envelope.destinationId } : {},
76
- ...envelope.functionId !== void 0 ? { functionId: envelope.functionId } : {},
77
- ...envelope.message !== void 0 ? { message: envelope.message } : {},
78
- raw: envelope
79
- });
80
- }
81
- function verifyAudienceRequest(request, credentials) {
82
- const secret = credentials.SEGMENT_WEBHOOK_SHARED_SECRET;
83
- if (!secret) throw new Error("Segment webhook triggers require SEGMENT_WEBHOOK_SHARED_SECRET. Set it on the connection and configure the same shared secret on the Segment-side Webhook destination.");
84
- if (!verifySegmentWebhookFromRequest(request, secret)) throw new Error("Invalid Segment webhook signature.");
85
- }
86
- function buildWebhookBinding(config) {
87
- return createWebhookTriggerBindingFactory({
88
- defaultName: config.defaultName,
89
- defaultDescription: config.defaultDescription,
90
- path: "/segment",
91
- method: "POST",
92
- payload: config.envelope,
93
- credentialSets: [segment],
94
- verify: (request, ctx) => {
95
- const credentials = ctx.credentials.segment;
96
- verifyAudienceRequest(request, credentials);
97
- },
98
- definitionFilter: config.filter,
99
- mapPayload: config.mapPayload,
100
- idempotencyKey: config.idempotencyKey,
101
- response: { successStatus: 200 }
102
- });
103
- }
104
- const audienceEnteredBinding = buildWebhookBinding({
105
- defaultName: "Segment audience entered",
106
- defaultDescription: "A profile entered a Segment Engage audience.",
107
- envelope: segmentAudienceWebhookEnvelopeSchema,
108
- filter: isAudienceEntered,
109
- mapPayload: (envelope) => mapAudienceEvent(envelope, "entered"),
110
- idempotencyKey: (env, payload) => payload?.messageId ?? `${payload?.audienceKey ?? env.event ?? "unknown"}:${payload?.userId ?? payload?.profileId ?? env.userId ?? "anon"}:${payload?.timestamp ?? env.timestamp ?? ""}:entered`
111
- });
112
- const audienceExitedBinding = buildWebhookBinding({
113
- defaultName: "Segment audience exited",
114
- defaultDescription: "A profile exited a Segment Engage audience.",
115
- envelope: segmentAudienceWebhookEnvelopeSchema,
116
- filter: isAudienceExited,
117
- mapPayload: (envelope) => mapAudienceEvent(envelope, "exited"),
118
- idempotencyKey: (env, payload) => payload?.messageId ?? `${payload?.audienceKey ?? env.event ?? "unknown"}:${payload?.userId ?? payload?.profileId ?? env.userId ?? "anon"}:${payload?.timestamp ?? env.timestamp ?? ""}:exited`
119
- });
120
- const computedTraitsUpdatedBinding = buildWebhookBinding({
121
- defaultName: "Segment computed trait updated",
122
- defaultDescription: "A profile computed trait value changed.",
123
- envelope: segmentAudienceWebhookEnvelopeSchema,
124
- filter: (envelope) => Boolean(audienceKeyFromEnvelope(envelope)),
125
- mapPayload: mapComputedTraitEvent,
126
- idempotencyKey: (env, payload) => payload?.messageId ?? `${payload?.traitKey ?? env.event ?? "unknown"}:${payload?.userId ?? payload?.profileId ?? env.userId ?? "anon"}:${payload?.timestamp ?? env.timestamp ?? ""}`
127
- });
128
- const functionsInvocationFailedBinding = buildWebhookBinding({
129
- defaultName: "Segment function invocation failed",
130
- defaultDescription: "A Segment Function invocation failure alert fired.",
131
- envelope: segmentMonitoringAlertEnvelopeSchema,
132
- filter: (envelope) => typeof envelope.eventType === "string" && envelope.eventType.toLowerCase().includes("function"),
133
- mapPayload: mapMonitoringEvent,
134
- idempotencyKey: (env, payload) => `${payload?.alertId ?? env.id ?? "unknown"}:${payload?.firedAt ?? env.firedAt ?? ""}`
135
- });
136
- const deliveryFailureSpikeBinding = buildWebhookBinding({
137
- defaultName: "Segment delivery failure spike",
138
- defaultDescription: "A destination delivery failure rate exceeded threshold.",
139
- envelope: segmentMonitoringAlertEnvelopeSchema,
140
- filter: (envelope) => typeof envelope.eventType === "string" && envelope.eventType.toLowerCase().includes("delivery"),
141
- mapPayload: mapMonitoringEvent,
142
- idempotencyKey: (env, payload) => `${payload?.alertId ?? env.id ?? "unknown"}:${payload?.firedAt ?? env.firedAt ?? ""}`
143
- });
144
- const webhooks = Object.freeze({
145
- audienceEntered: (options) => audienceEnteredBinding(options),
146
- audienceExited: (options) => audienceExitedBinding(options),
147
- computedTraitsUpdated: (options) => computedTraitsUpdatedBinding(options),
148
- functionsInvocationFailed: (options) => functionsInvocationFailedBinding(options),
149
- deliveryFailureSpike: (options) => deliveryFailureSpikeBinding(options)
150
- });
151
7
  function buildPollingBinding(definition, options) {
152
8
  const schedule = options?.schedule ?? definition.defaultSchedule;
153
9
  return createPollingTriggerBindingFactory({
154
- defaultName: definition.defaultName,
10
+ defaultId: definition.defaultId,
155
11
  defaultDescription: definition.defaultDescription,
156
12
  schedule,
157
13
  credentialSets: [segment],
158
14
  response: definition.eventSchema,
159
15
  poll: async (ctx) => {
160
- const credentials = ctx.credentials.segment;
16
+ const credentials = ctx.credentials["keystroke:segment"];
161
17
  return definition.poll(credentials, ctx.lastPolledAt);
162
- },
163
- idempotencyKey: (event) => definition.idempotencyKey(event)
18
+ }
164
19
  })({
165
- ...options?.name ? { name: options.name } : {},
20
+ ...options?.id ? { id: options.id } : {},
166
21
  ...options?.description ? { description: options.description } : {},
167
- ...options?.filter ? { filter: options.filter } : {},
168
22
  ...options?.transform ? { transform: options.transform } : {}
169
23
  });
170
24
  }
171
25
  function audienceSyncCompleted(params, options) {
172
26
  return buildPollingBinding({
173
- defaultName: "Segment audience sync completed",
27
+ defaultId: "segment.audience-sync-completed",
174
28
  defaultDescription: `Poll /spaces/${params.spaceId}/audiences/${params.audienceId}/syncs and emit the most recent completed sync.`,
175
29
  defaultSchedule: "5m",
176
30
  eventSchema: segmentAudienceSyncEventSchema,
@@ -185,13 +39,12 @@ function audienceSyncCompleted(params, options) {
185
39
  ...typeof obj.finishedAt === "string" ? { finishedAt: obj.finishedAt } : {},
186
40
  raw: obj
187
41
  });
188
- },
189
- idempotencyKey: (event) => `${event.audienceId}:${event.syncId}:${event.finishedAt ?? ""}`
42
+ }
190
43
  }, options);
191
44
  }
192
45
  function reverseEtlRunPollDefinition(params, status, label) {
193
46
  return {
194
- defaultName: `Segment reverse-ETL run ${label}`,
47
+ defaultId: `segment.reverse-etl-run-${label}`,
195
48
  defaultDescription: `Poll /reverse-etl-models/${params.modelId}/runs and emit the latest run that is ${status}.`,
196
49
  defaultSchedule: "5m",
197
50
  eventSchema: segmentReverseEtlRunEventSchema,
@@ -210,8 +63,7 @@ function reverseEtlRunPollDefinition(params, status, label) {
210
63
  ...typeof obj.error === "string" ? { error: obj.error } : {},
211
64
  raw: obj
212
65
  });
213
- },
214
- idempotencyKey: (event) => `${event.modelId}:${event.runId}:${status}:${event.finishedAt ?? event.startedAt ?? ""}`
66
+ }
215
67
  };
216
68
  }
217
69
  function reverseEtlRunSucceeded(params, options) {
@@ -225,7 +77,7 @@ function reverseEtlRunStarted(params, options) {
225
77
  }
226
78
  function functionsDeploymentCompleted(params, options) {
227
79
  return buildPollingBinding({
228
- defaultName: "Segment function deployment completed",
80
+ defaultId: "segment.functions-deployment-completed",
229
81
  defaultDescription: `Poll /functions/${params.functionId}/versions and emit the latest version.`,
230
82
  defaultSchedule: "5m",
231
83
  eventSchema: segmentFunctionVersionEventSchema,
@@ -238,13 +90,12 @@ function functionsDeploymentCompleted(params, options) {
238
90
  ...typeof obj.createdAt === "string" ? { createdAt: obj.createdAt } : {},
239
91
  raw: obj
240
92
  });
241
- },
242
- idempotencyKey: (event) => `${event.functionId}:${event.versionId}`
93
+ }
243
94
  }, options);
244
95
  }
245
96
  function trackingPlanViolationDetected(options) {
246
97
  return buildPollingBinding({
247
- defaultName: "Segment tracking plan violation detected",
98
+ defaultId: "segment.tracking-plan-violation-detected",
248
99
  defaultDescription: "Poll /events/violations and emit the most recent violation.",
249
100
  defaultSchedule: "10m",
250
101
  eventSchema: segmentTrackingPlanViolationEventSchema,
@@ -259,13 +110,12 @@ function trackingPlanViolationDetected(options) {
259
110
  ...typeof obj.messageId === "string" ? { messageId: obj.messageId } : {},
260
111
  raw: obj
261
112
  });
262
- },
263
- idempotencyKey: (event) => event.violationId
113
+ }
264
114
  }, options);
265
115
  }
266
116
  function sourceCreated(options) {
267
117
  return buildPollingBinding({
268
- defaultName: "Segment source created",
118
+ defaultId: "segment.source-created",
269
119
  defaultDescription: "Poll /sources and emit the most recent source.",
270
120
  defaultSchedule: "10m",
271
121
  eventSchema: segmentSourceCreatedEventSchema,
@@ -278,13 +128,12 @@ function sourceCreated(options) {
278
128
  ...typeof obj.createdAt === "string" ? { createdAt: obj.createdAt } : {},
279
129
  raw: obj
280
130
  });
281
- },
282
- idempotencyKey: (event) => event.sourceId
131
+ }
283
132
  }, options);
284
133
  }
285
134
  function destinationCreated(options) {
286
135
  return buildPollingBinding({
287
- defaultName: "Segment destination created",
136
+ defaultId: "segment.destination-created",
288
137
  defaultDescription: "Poll /destinations and emit the most recent destination.",
289
138
  defaultSchedule: "10m",
290
139
  eventSchema: segmentDestinationCreatedEventSchema,
@@ -298,13 +147,12 @@ function destinationCreated(options) {
298
147
  ...typeof obj.createdAt === "string" ? { createdAt: obj.createdAt } : {},
299
148
  raw: obj
300
149
  });
301
- },
302
- idempotencyKey: (event) => event.destinationId
150
+ }
303
151
  }, options);
304
152
  }
305
153
  function deletionRegulationCompleted(options) {
306
154
  return buildPollingBinding({
307
- defaultName: "Segment deletion regulation completed",
155
+ defaultId: "segment.deletion-regulation-completed",
308
156
  defaultDescription: "Poll /workspace/regulations for finished GDPR regulations.",
309
157
  defaultSchedule: "15m",
310
158
  eventSchema: segmentDeletionRegulationEventSchema,
@@ -321,8 +169,7 @@ function deletionRegulationCompleted(options) {
321
169
  ...typeof obj.finishedAt === "string" ? { finishedAt: obj.finishedAt } : {},
322
170
  raw: obj
323
171
  });
324
- },
325
- idempotencyKey: (event) => event.regulationId
172
+ }
326
173
  }, options);
327
174
  }
328
175
  const polling = Object.freeze({
@@ -338,4 +185,4 @@ const polling = Object.freeze({
338
185
  });
339
186
 
340
187
  //#endregion
341
- export { audienceSyncCompleted, deletionRegulationCompleted, destinationCreated, functionsDeploymentCompleted, polling, reverseEtlRunFailed, reverseEtlRunStarted, reverseEtlRunSucceeded, sourceCreated, trackingPlanViolationDetected, webhooks };
188
+ export { audienceSyncCompleted, deletionRegulationCompleted, destinationCreated, functionsDeploymentCompleted, polling, reverseEtlRunFailed, reverseEtlRunStarted, reverseEtlRunSucceeded, sourceCreated, trackingPlanViolationDetected };
package/dist/usage.d.mts CHANGED
@@ -13,7 +13,7 @@ declare const getDailyPerSourceUsage: _keystrokehq_core0.Operation<z.ZodObject<{
13
13
  sourceId: z.ZodOptional<z.ZodString>;
14
14
  callCount: z.ZodOptional<z.ZodNumber>;
15
15
  }, z.core.$catchall<z.ZodUnknown>>>;
16
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
16
+ }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
17
17
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
18
18
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
19
19
  us: "us";
@@ -43,7 +43,7 @@ declare const getMonthlyWorkspaceUsage: _keystrokehq_core0.Operation<z.ZodObject
43
43
  mtu: z.ZodOptional<z.ZodNumber>;
44
44
  events: z.ZodOptional<z.ZodNumber>;
45
45
  breakdowns: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
46
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
46
+ }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
47
47
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
48
48
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
49
49
  us: "us";