@keystrokehq/segment 0.0.9 → 0.0.16-integration-id-canonicalization.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 (80) hide show
  1. package/README.md +52 -173
  2. package/dist/{client.mjs → client-DQfeZzLR.mjs} +28 -3
  3. package/dist/credential-sets/index.d.mts +2 -0
  4. package/dist/credential-sets/index.mjs +3 -0
  5. package/dist/index.d.mts +4 -1
  6. package/dist/index.mjs +5 -1
  7. package/dist/operations/index.d.mts +2 -0
  8. package/dist/operations/index.mjs +3 -0
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/segment.credential-set-BTTrkHO7.mjs +33 -0
  11. package/dist/{integration-CeShwMIi.d.mts → segment.credential-set-BgROtI_9.d.mts} +28 -37
  12. package/dist/{triggers.d.mts → triggers/index.d.mts} +72 -6
  13. package/dist/{triggers.mjs → triggers/index.mjs} +136 -7
  14. package/dist/workspace-list-spaces.operation-DKWX3vl5.mjs +5200 -0
  15. package/dist/workspace-list-spaces.operation-QbDIgfRG.d.mts +6548 -0
  16. package/package.json +11 -123
  17. package/dist/_official/index.d.mts +0 -2
  18. package/dist/_official/index.mjs +0 -3
  19. package/dist/_runtime/index.d.mts +0 -1
  20. package/dist/_runtime/index.mjs +0 -1
  21. package/dist/audiences.d.mts +0 -282
  22. package/dist/audiences.mjs +0 -205
  23. package/dist/client.d.mts +0 -90
  24. package/dist/computed-traits.d.mts +0 -215
  25. package/dist/computed-traits.mjs +0 -149
  26. package/dist/connection.d.mts +0 -2
  27. package/dist/connection.mjs +0 -3
  28. package/dist/crud-DV9e4Spi.mjs +0 -140
  29. package/dist/deletion-suppression.d.mts +0 -191
  30. package/dist/deletion-suppression.mjs +0 -103
  31. package/dist/delivery-overview.d.mts +0 -79
  32. package/dist/delivery-overview.mjs +0 -54
  33. package/dist/destination-filters.d.mts +0 -190
  34. package/dist/destination-filters.mjs +0 -115
  35. package/dist/destinations.d.mts +0 -473
  36. package/dist/destinations.mjs +0 -257
  37. package/dist/edge-functions.d.mts +0 -168
  38. package/dist/edge-functions.mjs +0 -72
  39. package/dist/errors-4FGnrowW.mjs +0 -27
  40. package/dist/events-catalog.d.mts +0 -111
  41. package/dist/events-catalog.mjs +0 -65
  42. package/dist/events.d.mts +0 -167
  43. package/dist/events.mjs +0 -134
  44. package/dist/factory-DRwj5eiU.mjs +0 -7
  45. package/dist/functions.d.mts +0 -347
  46. package/dist/functions.mjs +0 -180
  47. package/dist/iam-groups.d.mts +0 -284
  48. package/dist/iam-groups.mjs +0 -144
  49. package/dist/iam-users.d.mts +0 -205
  50. package/dist/iam-users.mjs +0 -91
  51. package/dist/integration-B9FOjHPc.mjs +0 -115
  52. package/dist/labels.d.mts +0 -100
  53. package/dist/labels.mjs +0 -58
  54. package/dist/monitoring.d.mts +0 -182
  55. package/dist/monitoring.mjs +0 -88
  56. package/dist/profiles-sync.d.mts +0 -127
  57. package/dist/profiles-sync.mjs +0 -89
  58. package/dist/profiles.d.mts +0 -197
  59. package/dist/profiles.mjs +0 -137
  60. package/dist/reverse-etl.d.mts +0 -448
  61. package/dist/reverse-etl.mjs +0 -228
  62. package/dist/roles.d.mts +0 -48
  63. package/dist/roles.mjs +0 -25
  64. package/dist/sources.d.mts +0 -560
  65. package/dist/sources.mjs +0 -259
  66. package/dist/tracking-plans.d.mts +0 -351
  67. package/dist/tracking-plans.mjs +0 -160
  68. package/dist/tracking.d.mts +0 -499
  69. package/dist/tracking.mjs +0 -255
  70. package/dist/transformations.d.mts +0 -188
  71. package/dist/transformations.mjs +0 -83
  72. package/dist/usage.d.mts +0 -70
  73. package/dist/usage.mjs +0 -55
  74. package/dist/verification.d.mts +0 -17
  75. package/dist/verification.mjs +0 -51
  76. package/dist/warehouses.d.mts +0 -341
  77. package/dist/warehouses.mjs +0 -176
  78. package/dist/workspaces.d.mts +0 -95
  79. package/dist/workspaces.mjs +0 -67
  80. /package/dist/{common-CdGiJbjq.mjs → common-DUU0airJ.mjs} +0 -0
@@ -1,43 +1,13 @@
1
- import * as _keystrokehq_core0 from "@keystrokehq/core";
1
+ import { CredentialSet } from "@keystrokehq/core";
2
2
  import { z } from "zod";
3
- import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
4
3
  import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
5
4
 
6
- //#region src/integration.d.ts
5
+ //#region src/credential-sets/segment.credential-set.d.ts
7
6
  declare const segmentRegionSchema: z.ZodEnum<{
8
7
  us: "us";
9
8
  eu: "eu";
10
9
  }>;
11
- declare const segmentOfficialIntegration: {
12
- id: "segment";
13
- name: string;
14
- description: string;
15
- auth: z.ZodObject<{
16
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
17
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
18
- us: "us";
19
- eu: "eu";
20
- }>>;
21
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
22
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
23
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
24
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
25
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
26
- }, z.core.$strip>;
27
- };
28
- declare const segmentBundle: undefined<"segment", z.ZodObject<{
29
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
30
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
31
- us: "us";
32
- eu: "eu";
33
- }>>;
34
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
35
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
36
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
37
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
38
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
39
- }, z.core.$strip>>;
40
- declare const segment: _keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
10
+ declare const segmentAuthSchema: z.ZodObject<{
41
11
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
42
12
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
43
13
  us: "us";
@@ -48,7 +18,12 @@ declare const segment: _keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
48
18
  SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
49
19
  SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
50
20
  SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
51
- }, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
21
+ }, z.core.$strip>;
22
+ /**
23
+ * Segment integration — manual credential model spanning Public API, Tracking
24
+ * API, and Profile API surfaces on a single connection.
25
+ */
26
+ declare const segmentCredentialSet: CredentialSet<"segment", z.ZodObject<{
52
27
  SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
53
28
  SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
54
29
  us: "us";
@@ -59,8 +34,24 @@ declare const segment: _keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
59
34
  SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
60
35
  SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
61
36
  SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
62
- }, z.core.$strip>>[] | undefined>;
63
- type SegmentCredentials = InferCredentialSetAuth<typeof segment>;
37
+ }, z.core.$strip>, {
38
+ id: string;
39
+ kind: "manual";
40
+ label: string;
41
+ input: z.ZodObject<{
42
+ SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
43
+ SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
44
+ us: "us";
45
+ eu: "eu";
46
+ }>>;
47
+ SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
48
+ SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
49
+ SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
50
+ SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
51
+ SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
52
+ }, z.core.$strip>;
53
+ }[]>;
54
+ type SegmentCredentials = InferCredentialSetAuth<typeof segmentCredentialSet>;
64
55
  type SegmentRegion = z.infer<typeof segmentRegionSchema>;
65
56
  //#endregion
66
- export { segmentOfficialIntegration as a, segmentBundle as i, SegmentRegion as n, segment as r, SegmentCredentials as t };
57
+ export { segmentRegionSchema as a, segmentCredentialSet as i, SegmentRegion as n, segmentAuthSchema as r, SegmentCredentials as t };
@@ -1,11 +1,77 @@
1
- import { r as segment } from "./integration-CeShwMIi.mjs";
2
- import { SegmentAudienceSyncEvent, SegmentDeletionRegulationEvent, SegmentDestinationCreatedEvent, SegmentFunctionVersionEvent, SegmentReverseEtlRunEvent, SegmentSourceCreatedEvent, SegmentTrackingPlanViolationEvent } from "./events.mjs";
3
- import { BoundTrigger, Operation } from "@keystrokehq/core";
1
+ import { i as segmentCredentialSet } from "../segment.credential-set-BgROtI_9.mjs";
2
+ import { BoundTrigger } from "@keystrokehq/core";
4
3
  import { z } from "zod";
5
4
  import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
6
5
 
7
- //#region src/triggers.d.ts
8
- type SegmentCredentialSets = readonly [typeof segment];
6
+ //#region src/events/index.d.ts
7
+ declare const segmentReverseEtlRunEventSchema: z.ZodObject<{
8
+ runId: z.ZodString;
9
+ modelId: z.ZodString;
10
+ status: z.ZodEnum<{
11
+ IN_PROGRESS: "IN_PROGRESS";
12
+ SUCCEEDED: "SUCCEEDED";
13
+ FAILED: "FAILED";
14
+ }>;
15
+ startedAt: z.ZodOptional<z.ZodString>;
16
+ finishedAt: z.ZodOptional<z.ZodString>;
17
+ error: z.ZodOptional<z.ZodString>;
18
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
19
+ }, z.core.$strip>;
20
+ type SegmentReverseEtlRunEvent = z.infer<typeof segmentReverseEtlRunEventSchema>;
21
+ declare const segmentFunctionVersionEventSchema: z.ZodObject<{
22
+ functionId: z.ZodString;
23
+ versionId: z.ZodString;
24
+ createdAt: z.ZodOptional<z.ZodString>;
25
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
26
+ }, z.core.$strip>;
27
+ type SegmentFunctionVersionEvent = z.infer<typeof segmentFunctionVersionEventSchema>;
28
+ declare const segmentAudienceSyncEventSchema: z.ZodObject<{
29
+ syncId: z.ZodString;
30
+ audienceId: z.ZodString;
31
+ spaceId: z.ZodString;
32
+ status: z.ZodEnum<{
33
+ success: "success";
34
+ partial: "partial";
35
+ failed: "failed";
36
+ }>;
37
+ finishedAt: z.ZodOptional<z.ZodString>;
38
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
39
+ }, z.core.$strip>;
40
+ type SegmentAudienceSyncEvent = z.infer<typeof segmentAudienceSyncEventSchema>;
41
+ declare const segmentSourceCreatedEventSchema: z.ZodObject<{
42
+ sourceId: z.ZodString;
43
+ name: z.ZodOptional<z.ZodString>;
44
+ createdAt: z.ZodOptional<z.ZodString>;
45
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
46
+ }, z.core.$strip>;
47
+ type SegmentSourceCreatedEvent = z.infer<typeof segmentSourceCreatedEventSchema>;
48
+ declare const segmentDestinationCreatedEventSchema: z.ZodObject<{
49
+ destinationId: z.ZodString;
50
+ name: z.ZodOptional<z.ZodString>;
51
+ sourceId: z.ZodOptional<z.ZodString>;
52
+ createdAt: z.ZodOptional<z.ZodString>;
53
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
54
+ }, z.core.$strip>;
55
+ type SegmentDestinationCreatedEvent = z.infer<typeof segmentDestinationCreatedEventSchema>;
56
+ declare const segmentTrackingPlanViolationEventSchema: z.ZodObject<{
57
+ violationId: z.ZodString;
58
+ eventName: z.ZodOptional<z.ZodString>;
59
+ trackingPlanId: z.ZodOptional<z.ZodString>;
60
+ sourceId: z.ZodOptional<z.ZodString>;
61
+ messageId: z.ZodOptional<z.ZodString>;
62
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
63
+ }, z.core.$strip>;
64
+ type SegmentTrackingPlanViolationEvent = z.infer<typeof segmentTrackingPlanViolationEventSchema>;
65
+ declare const segmentDeletionRegulationEventSchema: z.ZodObject<{
66
+ regulationId: z.ZodString;
67
+ regulationType: z.ZodOptional<z.ZodString>;
68
+ finishedAt: z.ZodOptional<z.ZodString>;
69
+ raw: z.ZodRecord<z.ZodString, z.ZodUnknown>;
70
+ }, z.core.$strip>;
71
+ type SegmentDeletionRegulationEvent = z.infer<typeof segmentDeletionRegulationEventSchema>;
72
+ //#endregion
73
+ //#region src/triggers/polling.d.ts
74
+ type SegmentCredentialSets = readonly [typeof segmentCredentialSet];
9
75
  type SegmentPollingBindingOptions<TEvent, TOutput = TEvent> = IntegrationTriggerBindingOptions<TEvent, TOutput> & {
10
76
  readonly schedule?: string;
11
77
  };
@@ -41,4 +107,4 @@ declare const polling: Readonly<{
41
107
  deletionRegulationCompleted: typeof deletionRegulationCompleted;
42
108
  }>;
43
109
  //#endregion
44
- export { AudienceSyncPollParams, FunctionVersionPollParams, ReverseEtlRunPollParams, audienceSyncCompleted, deletionRegulationCompleted, destinationCreated, functionsDeploymentCompleted, polling, reverseEtlRunFailed, reverseEtlRunStarted, reverseEtlRunSucceeded, sourceCreated, trackingPlanViolationDetected };
110
+ export { type AudienceSyncPollParams, type FunctionVersionPollParams, type ReverseEtlRunPollParams, audienceSyncCompleted, deletionRegulationCompleted, destinationCreated, functionsDeploymentCompleted, polling, reverseEtlRunFailed, reverseEtlRunStarted, reverseEtlRunSucceeded, sourceCreated, trackingPlanViolationDetected };
@@ -1,7 +1,6 @@
1
- import { t as segment } from "./integration-B9FOjHPc.mjs";
2
- import { createSegmentClient } from "./client.mjs";
3
- import { segmentAudienceSyncEventSchema, segmentDeletionRegulationEventSchema, segmentDestinationCreatedEventSchema, segmentFunctionVersionEventSchema, segmentReverseEtlRunEventSchema, segmentSourceCreatedEventSchema, segmentTrackingPlanViolationEventSchema } from "./events.mjs";
4
- import { Operation } from "@keystrokehq/core";
1
+ import { n as segmentCredentialSet } from "../segment.credential-set-BTTrkHO7.mjs";
2
+ import { a as segmentLooseObjectSchema } from "../common-DUU0airJ.mjs";
3
+ import { t as createSegmentClient } from "../client-DQfeZzLR.mjs";
5
4
  import { z } from "zod";
6
5
  import { pollingTrigger } from "@keystrokehq/core/trigger";
7
6
 
@@ -53,17 +52,147 @@ function createPollingTriggerBindingFactory(config) {
53
52
  }
54
53
 
55
54
  //#endregion
56
- //#region src/triggers.ts
55
+ //#region src/events/index.ts
56
+ /**
57
+ * segment/events.ts
58
+ *
59
+ * Curated trigger-event schemas. Segment does not publish a unified webhook
60
+ * event catalog — each destination shape (Webhook destination, Monitoring
61
+ * alert webhook, Functions runtime webhook) carries its own body. We define
62
+ * the author-visible shapes here and parse the raw payload into them in
63
+ * `triggers.ts`.
64
+ */
65
+ /** Loose envelope a Segment Webhook destination delivers for Engage
66
+ * audiences: the destination wraps the Engage event as a Segment "track"
67
+ * call with properties carrying audience state. */
68
+ const segmentAudienceWebhookEnvelopeSchema = segmentLooseObjectSchema({
69
+ type: z.string().optional(),
70
+ event: z.string().optional(),
71
+ userId: z.string().optional(),
72
+ anonymousId: z.string().optional(),
73
+ messageId: z.string().optional(),
74
+ timestamp: z.string().optional(),
75
+ traits: z.record(z.string(), z.unknown()).optional(),
76
+ properties: z.record(z.string(), z.unknown()).optional(),
77
+ context: z.record(z.string(), z.unknown()).optional()
78
+ });
79
+ /** Monitoring alert webhook envelope (fired for delivery-failure spikes,
80
+ * function invocation errors, etc.). */
81
+ const segmentMonitoringAlertEnvelopeSchema = segmentLooseObjectSchema({
82
+ id: z.string().optional(),
83
+ subscriptionId: z.string().optional(),
84
+ eventType: z.string().optional(),
85
+ severity: z.string().optional(),
86
+ firedAt: z.string().optional(),
87
+ message: z.string().optional(),
88
+ sourceId: z.string().optional(),
89
+ destinationId: z.string().optional(),
90
+ functionId: z.string().optional(),
91
+ metadata: z.record(z.string(), z.unknown()).optional()
92
+ });
93
+ const segmentAudienceEventSchema = z.object({
94
+ type: z.enum(["entered", "exited"]),
95
+ audienceKey: z.string(),
96
+ userId: z.string().optional(),
97
+ anonymousId: z.string().optional(),
98
+ profileId: z.string().optional(),
99
+ traits: z.record(z.string(), z.unknown()).optional(),
100
+ properties: z.record(z.string(), z.unknown()).optional(),
101
+ messageId: z.string().optional(),
102
+ timestamp: z.string().optional(),
103
+ raw: segmentAudienceWebhookEnvelopeSchema
104
+ });
105
+ const segmentComputedTraitEventSchema = z.object({
106
+ traitKey: z.string(),
107
+ value: z.unknown(),
108
+ userId: z.string().optional(),
109
+ profileId: z.string().optional(),
110
+ messageId: z.string().optional(),
111
+ timestamp: z.string().optional(),
112
+ raw: segmentAudienceWebhookEnvelopeSchema
113
+ });
114
+ const segmentMonitoringEventSchema = z.object({
115
+ alertId: z.string(),
116
+ eventType: z.string(),
117
+ severity: z.string().optional(),
118
+ firedAt: z.string().optional(),
119
+ sourceId: z.string().optional(),
120
+ destinationId: z.string().optional(),
121
+ functionId: z.string().optional(),
122
+ message: z.string().optional(),
123
+ raw: segmentMonitoringAlertEnvelopeSchema
124
+ });
125
+ const segmentReverseEtlRunEventSchema = z.object({
126
+ runId: z.string(),
127
+ modelId: z.string(),
128
+ status: z.enum([
129
+ "IN_PROGRESS",
130
+ "SUCCEEDED",
131
+ "FAILED"
132
+ ]),
133
+ startedAt: z.string().optional(),
134
+ finishedAt: z.string().optional(),
135
+ error: z.string().optional(),
136
+ raw: z.record(z.string(), z.unknown())
137
+ });
138
+ const segmentFunctionVersionEventSchema = z.object({
139
+ functionId: z.string(),
140
+ versionId: z.string(),
141
+ createdAt: z.string().optional(),
142
+ raw: z.record(z.string(), z.unknown())
143
+ });
144
+ const segmentAudienceSyncEventSchema = z.object({
145
+ syncId: z.string(),
146
+ audienceId: z.string(),
147
+ spaceId: z.string(),
148
+ status: z.enum([
149
+ "success",
150
+ "partial",
151
+ "failed"
152
+ ]),
153
+ finishedAt: z.string().optional(),
154
+ raw: z.record(z.string(), z.unknown())
155
+ });
156
+ const segmentSourceCreatedEventSchema = z.object({
157
+ sourceId: z.string(),
158
+ name: z.string().optional(),
159
+ createdAt: z.string().optional(),
160
+ raw: z.record(z.string(), z.unknown())
161
+ });
162
+ const segmentDestinationCreatedEventSchema = z.object({
163
+ destinationId: z.string(),
164
+ name: z.string().optional(),
165
+ sourceId: z.string().optional(),
166
+ createdAt: z.string().optional(),
167
+ raw: z.record(z.string(), z.unknown())
168
+ });
169
+ const segmentTrackingPlanViolationEventSchema = z.object({
170
+ violationId: z.string(),
171
+ eventName: z.string().optional(),
172
+ trackingPlanId: z.string().optional(),
173
+ sourceId: z.string().optional(),
174
+ messageId: z.string().optional(),
175
+ raw: z.record(z.string(), z.unknown())
176
+ });
177
+ const segmentDeletionRegulationEventSchema = z.object({
178
+ regulationId: z.string(),
179
+ regulationType: z.string().optional(),
180
+ finishedAt: z.string().optional(),
181
+ raw: z.record(z.string(), z.unknown())
182
+ });
183
+
184
+ //#endregion
185
+ //#region src/triggers/polling.ts
57
186
  function buildPollingBinding(definition, options) {
58
187
  const schedule = options?.schedule ?? definition.defaultSchedule;
59
188
  return createPollingTriggerBindingFactory({
60
189
  defaultId: definition.defaultId,
61
190
  defaultDescription: definition.defaultDescription,
62
191
  schedule,
63
- credentialSets: [segment],
192
+ credentialSets: [segmentCredentialSet],
64
193
  response: definition.eventSchema,
65
194
  poll: async (ctx) => {
66
- const credentials = ctx.credentials["segment"];
195
+ const credentials = ctx.credentials.segment;
67
196
  return definition.poll(credentials, ctx.lastPolledAt);
68
197
  }
69
198
  })({