@keystrokehq/segment 0.0.15 → 0.0.16-integration-id-canonicalization.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +52 -173
- package/dist/{client.mjs → client-DQfeZzLR.mjs} +28 -3
- package/dist/credential-sets/index.d.mts +2 -0
- package/dist/credential-sets/index.mjs +3 -0
- package/dist/index.d.mts +4 -1
- package/dist/index.mjs +5 -1
- package/dist/operations/index.d.mts +2 -0
- package/dist/operations/index.mjs +3 -0
- package/dist/schemas/index.mjs +1 -1
- package/dist/{integration-CliT2xe3.mjs → segment.credential-set-BTTrkHO7.mjs} +16 -9
- package/dist/{integration-DWeMeBqQ.d.mts → segment.credential-set-BgROtI_9.d.mts} +28 -27
- package/dist/{triggers.d.mts → triggers/index.d.mts} +72 -6
- package/dist/{triggers.mjs → triggers/index.mjs} +186 -7
- package/dist/workspace-list-spaces.operation-DKWX3vl5.mjs +5200 -0
- package/dist/workspace-list-spaces.operation-DNIUfIuv.d.mts +6548 -0
- package/package.json +13 -125
- package/dist/_official/index.d.mts +0 -2
- package/dist/_official/index.mjs +0 -3
- package/dist/_runtime/index.d.mts +0 -1
- package/dist/_runtime/index.mjs +0 -1
- package/dist/audiences.d.mts +0 -193
- package/dist/audiences.mjs +0 -205
- package/dist/client.d.mts +0 -90
- package/dist/computed-traits.d.mts +0 -148
- package/dist/computed-traits.mjs +0 -149
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/crud-DGM2Ekdr.mjs +0 -140
- package/dist/deletion-suppression.d.mts +0 -135
- package/dist/deletion-suppression.mjs +0 -103
- package/dist/delivery-overview.d.mts +0 -56
- package/dist/delivery-overview.mjs +0 -54
- package/dist/destination-filters.d.mts +0 -134
- package/dist/destination-filters.mjs +0 -115
- package/dist/destinations.d.mts +0 -318
- package/dist/destinations.mjs +0 -257
- package/dist/edge-functions.d.mts +0 -112
- package/dist/edge-functions.mjs +0 -72
- package/dist/errors-4FGnrowW.mjs +0 -27
- package/dist/events-catalog.d.mts +0 -77
- package/dist/events-catalog.mjs +0 -65
- package/dist/events.d.mts +0 -167
- package/dist/events.mjs +0 -134
- package/dist/factory-Dqb49Dfj.mjs +0 -8
- package/dist/functions.d.mts +0 -236
- package/dist/functions.mjs +0 -180
- package/dist/iam-groups.d.mts +0 -184
- package/dist/iam-groups.mjs +0 -144
- package/dist/iam-users.d.mts +0 -138
- package/dist/iam-users.mjs +0 -91
- package/dist/labels.d.mts +0 -66
- package/dist/labels.mjs +0 -58
- package/dist/monitoring.d.mts +0 -126
- package/dist/monitoring.mjs +0 -88
- package/dist/profiles-sync.d.mts +0 -82
- package/dist/profiles-sync.mjs +0 -89
- package/dist/profiles.d.mts +0 -130
- package/dist/profiles.mjs +0 -137
- package/dist/reverse-etl.d.mts +0 -315
- package/dist/reverse-etl.mjs +0 -228
- package/dist/roles.d.mts +0 -36
- package/dist/roles.mjs +0 -25
- package/dist/sources.d.mts +0 -383
- package/dist/sources.mjs +0 -259
- package/dist/tracking-plans.d.mts +0 -229
- package/dist/tracking-plans.mjs +0 -160
- package/dist/tracking.d.mts +0 -410
- package/dist/tracking.mjs +0 -255
- package/dist/transformations.d.mts +0 -132
- package/dist/transformations.mjs +0 -83
- package/dist/usage.d.mts +0 -47
- package/dist/usage.mjs +0 -55
- package/dist/verification.d.mts +0 -17
- package/dist/verification.mjs +0 -51
- package/dist/warehouses.d.mts +0 -219
- package/dist/warehouses.mjs +0 -176
- package/dist/workspaces.d.mts +0 -61
- package/dist/workspaces.mjs +0 -67
- /package/dist/{common-CdGiJbjq.mjs → common-DUU0airJ.mjs} +0 -0
package/dist/destinations.mjs
DELETED
|
@@ -1,257 +0,0 @@
|
|
|
1
|
-
import { createSegmentClient } from "./client.mjs";
|
|
2
|
-
import { a as segmentLooseObjectSchema, n as segmentIdSchema } from "./common-CdGiJbjq.mjs";
|
|
3
|
-
import { t as segmentOperation } from "./factory-Dqb49Dfj.mjs";
|
|
4
|
-
import { n as crudList, r as crudMutate, t as crudGet } from "./crud-DGM2Ekdr.mjs";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
//#region src/destinations.ts
|
|
8
|
-
/**
|
|
9
|
-
* segment/destinations.ts — destination CRUD + catalog metadata +
|
|
10
|
-
* subscription CRUD + delivery metrics + event delivery failures.
|
|
11
|
-
* 14 actions total (PLAN.md § 6.3).
|
|
12
|
-
*/
|
|
13
|
-
const destinationSchema = segmentLooseObjectSchema({
|
|
14
|
-
id: segmentIdSchema,
|
|
15
|
-
name: z.string().optional(),
|
|
16
|
-
enabled: z.boolean().optional(),
|
|
17
|
-
sourceId: z.string().optional(),
|
|
18
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
19
|
-
settings: z.record(z.string(), z.unknown()).optional()
|
|
20
|
-
});
|
|
21
|
-
const destinationMetadataSchema = segmentLooseObjectSchema({
|
|
22
|
-
id: segmentIdSchema,
|
|
23
|
-
name: z.string().optional(),
|
|
24
|
-
description: z.string().optional(),
|
|
25
|
-
categories: z.array(z.string()).optional(),
|
|
26
|
-
website: z.string().optional()
|
|
27
|
-
});
|
|
28
|
-
const subscriptionSchema = segmentLooseObjectSchema({
|
|
29
|
-
id: segmentIdSchema,
|
|
30
|
-
name: z.string().optional(),
|
|
31
|
-
enabled: z.boolean().optional(),
|
|
32
|
-
actionId: z.string().optional(),
|
|
33
|
-
actionSlug: z.string().optional(),
|
|
34
|
-
trigger: z.string().optional(),
|
|
35
|
-
settings: z.record(z.string(), z.unknown()).optional()
|
|
36
|
-
});
|
|
37
|
-
const deliveryMetricsSchema = segmentLooseObjectSchema({
|
|
38
|
-
totalDelivered: z.number().optional(),
|
|
39
|
-
totalFailed: z.number().optional(),
|
|
40
|
-
totalRetried: z.number().optional(),
|
|
41
|
-
metrics: z.array(z.record(z.string(), z.unknown())).optional()
|
|
42
|
-
});
|
|
43
|
-
const deliveryFailureSchema = segmentLooseObjectSchema({
|
|
44
|
-
messageId: z.string().optional(),
|
|
45
|
-
eventType: z.string().optional(),
|
|
46
|
-
failureReason: z.string().optional(),
|
|
47
|
-
timestamp: z.string().optional()
|
|
48
|
-
});
|
|
49
|
-
const listDestinations = crudList({
|
|
50
|
-
id: "segment.destinations.list",
|
|
51
|
-
name: "List destinations",
|
|
52
|
-
description: "Paginated list of Segment destinations.",
|
|
53
|
-
path: "/destinations",
|
|
54
|
-
itemsKey: "destinations",
|
|
55
|
-
item: destinationSchema,
|
|
56
|
-
extraInput: { sourceId: z.string().optional() }
|
|
57
|
-
});
|
|
58
|
-
const getDestination = crudGet({
|
|
59
|
-
id: "segment.destinations.get",
|
|
60
|
-
name: "Get destination",
|
|
61
|
-
description: "Fetch a destination by id.",
|
|
62
|
-
path: "/destinations/{id}",
|
|
63
|
-
output: destinationSchema,
|
|
64
|
-
unwrapKey: "destination"
|
|
65
|
-
});
|
|
66
|
-
const createDestination = crudMutate({
|
|
67
|
-
id: "segment.destinations.create",
|
|
68
|
-
name: "Create destination",
|
|
69
|
-
description: "Create a Segment destination attached to a source.",
|
|
70
|
-
method: "POST",
|
|
71
|
-
path: "/destinations",
|
|
72
|
-
bodyShape: {
|
|
73
|
-
name: z.string().min(1),
|
|
74
|
-
sourceId: z.string().min(1),
|
|
75
|
-
metadata: z.record(z.string(), z.unknown()).optional(),
|
|
76
|
-
settings: z.record(z.string(), z.unknown()).optional(),
|
|
77
|
-
enabled: z.boolean().optional()
|
|
78
|
-
},
|
|
79
|
-
output: destinationSchema,
|
|
80
|
-
unwrapKey: "destination"
|
|
81
|
-
});
|
|
82
|
-
const updateDestination = crudMutate({
|
|
83
|
-
id: "segment.destinations.update",
|
|
84
|
-
name: "Update destination",
|
|
85
|
-
description: "Patch a destination.",
|
|
86
|
-
method: "PATCH",
|
|
87
|
-
path: "/destinations/{id}",
|
|
88
|
-
bodyShape: {
|
|
89
|
-
name: z.string().optional(),
|
|
90
|
-
enabled: z.boolean().optional(),
|
|
91
|
-
settings: z.record(z.string(), z.unknown()).optional()
|
|
92
|
-
},
|
|
93
|
-
output: destinationSchema,
|
|
94
|
-
unwrapKey: "destination"
|
|
95
|
-
});
|
|
96
|
-
const deleteDestination = crudMutate({
|
|
97
|
-
id: "segment.destinations.delete",
|
|
98
|
-
name: "Delete destination",
|
|
99
|
-
description: "Delete a destination.",
|
|
100
|
-
method: "DELETE",
|
|
101
|
-
path: "/destinations/{id}",
|
|
102
|
-
output: z.object({}).catchall(z.unknown())
|
|
103
|
-
});
|
|
104
|
-
const listDestinationMetadata = crudList({
|
|
105
|
-
id: "segment.destinations.listMetadata",
|
|
106
|
-
name: "List destination catalog entries",
|
|
107
|
-
description: "Public destination catalog — every destination type Segment supports.",
|
|
108
|
-
path: "/catalog/destinations",
|
|
109
|
-
itemsKey: "destinationsCatalog",
|
|
110
|
-
item: destinationMetadataSchema
|
|
111
|
-
});
|
|
112
|
-
const getDestinationMetadata = crudGet({
|
|
113
|
-
id: "segment.destinations.getMetadata",
|
|
114
|
-
name: "Get destination catalog entry",
|
|
115
|
-
description: "Fetch a destination catalog entry by id.",
|
|
116
|
-
path: "/catalog/destinations/{id}",
|
|
117
|
-
output: destinationMetadataSchema,
|
|
118
|
-
unwrapKey: "destinationMetadata"
|
|
119
|
-
});
|
|
120
|
-
const listSubscriptions = segmentOperation({
|
|
121
|
-
id: "segment.destinations.listSubscriptions",
|
|
122
|
-
name: "List subscriptions",
|
|
123
|
-
description: "List the action subscriptions (actions-based destinations).",
|
|
124
|
-
input: z.object({ id: segmentIdSchema }),
|
|
125
|
-
output: z.object({ items: z.array(subscriptionSchema) }),
|
|
126
|
-
run: async (input, credentials) => {
|
|
127
|
-
const rec = await createSegmentClient(credentials).publicApi.request(`/destinations/${encodeURIComponent(input.id)}/subscriptions`);
|
|
128
|
-
return { items: (rec.data?.subscriptions ?? rec.subscriptions ?? []).map((entry) => subscriptionSchema.parse(entry)) };
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
const createSubscription = crudMutate({
|
|
132
|
-
id: "segment.destinations.createSubscription",
|
|
133
|
-
name: "Create subscription",
|
|
134
|
-
description: "Create a destination action subscription.",
|
|
135
|
-
method: "POST",
|
|
136
|
-
path: "/destinations/{id}/subscriptions",
|
|
137
|
-
includeId: true,
|
|
138
|
-
idField: "id",
|
|
139
|
-
bodyShape: {
|
|
140
|
-
name: z.string().min(1),
|
|
141
|
-
actionId: z.string().min(1),
|
|
142
|
-
trigger: z.string().optional(),
|
|
143
|
-
settings: z.record(z.string(), z.unknown()).optional(),
|
|
144
|
-
enabled: z.boolean().optional()
|
|
145
|
-
},
|
|
146
|
-
output: subscriptionSchema,
|
|
147
|
-
unwrapKey: "subscription"
|
|
148
|
-
});
|
|
149
|
-
const updateSubscription = segmentOperation({
|
|
150
|
-
id: "segment.destinations.updateSubscription",
|
|
151
|
-
name: "Update subscription",
|
|
152
|
-
description: "Patch an action subscription on a destination.",
|
|
153
|
-
input: z.object({
|
|
154
|
-
destinationId: segmentIdSchema,
|
|
155
|
-
subscriptionId: segmentIdSchema,
|
|
156
|
-
name: z.string().optional(),
|
|
157
|
-
enabled: z.boolean().optional(),
|
|
158
|
-
settings: z.record(z.string(), z.unknown()).optional()
|
|
159
|
-
}),
|
|
160
|
-
output: subscriptionSchema,
|
|
161
|
-
needsApproval: true,
|
|
162
|
-
run: async (input, credentials) => {
|
|
163
|
-
const client = createSegmentClient(credentials);
|
|
164
|
-
const { destinationId, subscriptionId, ...body } = input;
|
|
165
|
-
const response = await client.publicApi.request(`/destinations/${encodeURIComponent(destinationId)}/subscriptions/${encodeURIComponent(subscriptionId)}`, {
|
|
166
|
-
method: "PATCH",
|
|
167
|
-
body
|
|
168
|
-
});
|
|
169
|
-
const rec = response;
|
|
170
|
-
return subscriptionSchema.parse(rec.data?.subscription ?? response);
|
|
171
|
-
}
|
|
172
|
-
});
|
|
173
|
-
const deleteSubscription = segmentOperation({
|
|
174
|
-
id: "segment.destinations.deleteSubscription",
|
|
175
|
-
name: "Delete subscription",
|
|
176
|
-
description: "Delete an action subscription from a destination.",
|
|
177
|
-
input: z.object({
|
|
178
|
-
destinationId: segmentIdSchema,
|
|
179
|
-
subscriptionId: segmentIdSchema
|
|
180
|
-
}),
|
|
181
|
-
output: z.object({ deleted: z.literal(true) }),
|
|
182
|
-
needsApproval: true,
|
|
183
|
-
run: async (input, credentials) => {
|
|
184
|
-
await createSegmentClient(credentials).publicApi.request(`/destinations/${encodeURIComponent(input.destinationId)}/subscriptions/${encodeURIComponent(input.subscriptionId)}`, { method: "DELETE" });
|
|
185
|
-
return { deleted: true };
|
|
186
|
-
}
|
|
187
|
-
});
|
|
188
|
-
const listDeliveryMetricsSummary = segmentOperation({
|
|
189
|
-
id: "segment.destinations.listDeliveryMetricsSummary",
|
|
190
|
-
name: "List delivery metrics summary",
|
|
191
|
-
description: "Summary of delivery metrics per destination over a window.",
|
|
192
|
-
input: z.object({
|
|
193
|
-
id: segmentIdSchema,
|
|
194
|
-
startTime: z.iso.datetime({ offset: true }).optional(),
|
|
195
|
-
endTime: z.iso.datetime({ offset: true }).optional()
|
|
196
|
-
}),
|
|
197
|
-
output: deliveryMetricsSchema,
|
|
198
|
-
run: async (input, credentials) => {
|
|
199
|
-
const body = await createSegmentClient(credentials).publicApi.request(`/destinations/${encodeURIComponent(input.id)}/delivery-metrics/summary`, { query: {
|
|
200
|
-
startTime: input.startTime,
|
|
201
|
-
endTime: input.endTime
|
|
202
|
-
} });
|
|
203
|
-
const rec = body;
|
|
204
|
-
return deliveryMetricsSchema.parse(rec.data ?? body);
|
|
205
|
-
}
|
|
206
|
-
});
|
|
207
|
-
const listDeliveryMetricsSeries = segmentOperation({
|
|
208
|
-
id: "segment.destinations.listDeliveryMetricsSeries",
|
|
209
|
-
name: "List delivery metrics series",
|
|
210
|
-
description: "Time-series delivery metrics per destination.",
|
|
211
|
-
input: z.object({
|
|
212
|
-
id: segmentIdSchema,
|
|
213
|
-
startTime: z.iso.datetime({ offset: true }).optional(),
|
|
214
|
-
endTime: z.iso.datetime({ offset: true }).optional(),
|
|
215
|
-
granularity: z.string().optional()
|
|
216
|
-
}),
|
|
217
|
-
output: deliveryMetricsSchema,
|
|
218
|
-
run: async (input, credentials) => {
|
|
219
|
-
const body = await createSegmentClient(credentials).publicApi.request(`/destinations/${encodeURIComponent(input.id)}/delivery-metrics/series`, { query: {
|
|
220
|
-
startTime: input.startTime,
|
|
221
|
-
endTime: input.endTime,
|
|
222
|
-
granularity: input.granularity
|
|
223
|
-
} });
|
|
224
|
-
const rec = body;
|
|
225
|
-
return deliveryMetricsSchema.parse(rec.data ?? body);
|
|
226
|
-
}
|
|
227
|
-
});
|
|
228
|
-
const listEventDeliveryFailures = segmentOperation({
|
|
229
|
-
id: "segment.destinations.listEventDeliveryFailures",
|
|
230
|
-
name: "List event delivery failures",
|
|
231
|
-
description: "Recent delivery failures for events dispatched to a destination.",
|
|
232
|
-
input: z.object({
|
|
233
|
-
id: segmentIdSchema,
|
|
234
|
-
pageSize: z.number().int().positive().max(200).optional(),
|
|
235
|
-
pageToken: z.string().optional()
|
|
236
|
-
}),
|
|
237
|
-
output: z.object({
|
|
238
|
-
items: z.array(deliveryFailureSchema),
|
|
239
|
-
nextPageToken: z.string().optional()
|
|
240
|
-
}),
|
|
241
|
-
run: async (input, credentials) => {
|
|
242
|
-
const result = await createSegmentClient(credentials).publicApi.list(`/destinations/${encodeURIComponent(input.id)}/event-delivery/failures`, {
|
|
243
|
-
itemsKey: "failures",
|
|
244
|
-
items: deliveryFailureSchema
|
|
245
|
-
}, { query: {
|
|
246
|
-
count: input.pageSize,
|
|
247
|
-
cursor: input.pageToken
|
|
248
|
-
} });
|
|
249
|
-
return {
|
|
250
|
-
items: [...result.items],
|
|
251
|
-
...result.nextPageToken !== void 0 ? { nextPageToken: result.nextPageToken } : {}
|
|
252
|
-
};
|
|
253
|
-
}
|
|
254
|
-
});
|
|
255
|
-
|
|
256
|
-
//#endregion
|
|
257
|
-
export { createDestination, createSubscription, deleteDestination, deleteSubscription, destinationSchema, getDestination, getDestinationMetadata, listDeliveryMetricsSeries, listDeliveryMetricsSummary, listDestinationMetadata, listDestinations, listEventDeliveryFailures, listSubscriptions, updateDestination, updateSubscription };
|
|
@@ -1,112 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/edge-functions.d.ts
|
|
5
|
-
declare const edgeFunctionSchema: z.ZodObject<{
|
|
6
|
-
id: z.ZodString;
|
|
7
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
8
|
-
description: z.ZodOptional<z.ZodString>;
|
|
9
|
-
code: z.ZodOptional<z.ZodString>;
|
|
10
|
-
deployedVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
11
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
12
|
-
declare const listEdgeFunctions: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
13
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
pageToken: z.ZodOptional<z.ZodString>;
|
|
15
|
-
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
16
|
-
items: z.ZodArray<z.ZodObject<{
|
|
17
|
-
id: z.ZodString;
|
|
18
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
19
|
-
description: z.ZodOptional<z.ZodString>;
|
|
20
|
-
code: z.ZodOptional<z.ZodString>;
|
|
21
|
-
deployedVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
22
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
23
|
-
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
24
|
-
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
25
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
26
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
27
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
28
|
-
us: "us";
|
|
29
|
-
eu: "eu";
|
|
30
|
-
}>>;
|
|
31
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
32
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
33
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
34
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
35
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
36
|
-
}, z.core.$strip>>], undefined>;
|
|
37
|
-
declare const getEdgeFunction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
38
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
39
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
40
|
-
id: z.ZodString;
|
|
41
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
42
|
-
description: z.ZodOptional<z.ZodString>;
|
|
43
|
-
code: z.ZodOptional<z.ZodString>;
|
|
44
|
-
deployedVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
45
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
46
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
47
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
48
|
-
us: "us";
|
|
49
|
-
eu: "eu";
|
|
50
|
-
}>>;
|
|
51
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
52
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
53
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
54
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
55
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, z.core.$strip>>], undefined>;
|
|
57
|
-
declare const upsertEdgeFunction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
58
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
59
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
60
|
-
id: z.ZodString;
|
|
61
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
62
|
-
description: z.ZodOptional<z.ZodString>;
|
|
63
|
-
code: z.ZodOptional<z.ZodString>;
|
|
64
|
-
deployedVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
65
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
66
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
67
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
68
|
-
us: "us";
|
|
69
|
-
eu: "eu";
|
|
70
|
-
}>>;
|
|
71
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
72
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
73
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
74
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
75
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
76
|
-
}, z.core.$strip>>], undefined>;
|
|
77
|
-
declare const deleteEdgeFunction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
78
|
-
[x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
|
|
79
|
-
}, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
80
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
81
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
82
|
-
us: "us";
|
|
83
|
-
eu: "eu";
|
|
84
|
-
}>>;
|
|
85
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
86
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
87
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
88
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
89
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
90
|
-
}, z.core.$strip>>], undefined>;
|
|
91
|
-
declare const deployEdgeFunction: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
92
|
-
id: z.ZodString;
|
|
93
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
94
|
-
id: z.ZodString;
|
|
95
|
-
displayName: z.ZodOptional<z.ZodString>;
|
|
96
|
-
description: z.ZodOptional<z.ZodString>;
|
|
97
|
-
code: z.ZodOptional<z.ZodString>;
|
|
98
|
-
deployedVersion: z.ZodOptional<z.ZodUnion<readonly [z.ZodNumber, z.ZodString]>>;
|
|
99
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
100
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
101
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
102
|
-
us: "us";
|
|
103
|
-
eu: "eu";
|
|
104
|
-
}>>;
|
|
105
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
106
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
107
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
108
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
109
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
110
|
-
}, z.core.$strip>>], undefined>;
|
|
111
|
-
//#endregion
|
|
112
|
-
export { deleteEdgeFunction, deployEdgeFunction, edgeFunctionSchema, getEdgeFunction, listEdgeFunctions, upsertEdgeFunction };
|
package/dist/edge-functions.mjs
DELETED
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
import { createSegmentClient } from "./client.mjs";
|
|
2
|
-
import { a as segmentLooseObjectSchema, n as segmentIdSchema } from "./common-CdGiJbjq.mjs";
|
|
3
|
-
import { t as segmentOperation } from "./factory-Dqb49Dfj.mjs";
|
|
4
|
-
import { n as crudList, r as crudMutate, t as crudGet } from "./crud-DGM2Ekdr.mjs";
|
|
5
|
-
import { z } from "zod";
|
|
6
|
-
|
|
7
|
-
//#region src/edge-functions.ts
|
|
8
|
-
/**
|
|
9
|
-
* segment/edge-functions.ts — Twilio Engage Edge Functions. 5 actions
|
|
10
|
-
* (PLAN § 6.17).
|
|
11
|
-
*/
|
|
12
|
-
const edgeFunctionSchema = segmentLooseObjectSchema({
|
|
13
|
-
id: segmentIdSchema,
|
|
14
|
-
displayName: z.string().optional(),
|
|
15
|
-
description: z.string().optional(),
|
|
16
|
-
code: z.string().optional(),
|
|
17
|
-
deployedVersion: z.union([z.number(), z.string()]).optional()
|
|
18
|
-
});
|
|
19
|
-
const listEdgeFunctions = crudList({
|
|
20
|
-
id: "segment.edgeFunctions.list",
|
|
21
|
-
name: "List edge functions",
|
|
22
|
-
description: "List Engage Edge Functions in the workspace.",
|
|
23
|
-
path: "/edge-functions",
|
|
24
|
-
itemsKey: "edgeFunctions",
|
|
25
|
-
item: edgeFunctionSchema
|
|
26
|
-
});
|
|
27
|
-
const getEdgeFunction = crudGet({
|
|
28
|
-
id: "segment.edgeFunctions.get",
|
|
29
|
-
name: "Get edge function",
|
|
30
|
-
description: "Fetch an Edge Function by id.",
|
|
31
|
-
path: "/edge-functions/{id}",
|
|
32
|
-
output: edgeFunctionSchema,
|
|
33
|
-
unwrapKey: "edgeFunction"
|
|
34
|
-
});
|
|
35
|
-
const upsertEdgeFunction = crudMutate({
|
|
36
|
-
id: "segment.edgeFunctions.upsert",
|
|
37
|
-
name: "Upsert edge function",
|
|
38
|
-
description: "Create or replace an Edge Function by id.",
|
|
39
|
-
method: "PUT",
|
|
40
|
-
path: "/edge-functions/{id}",
|
|
41
|
-
bodyShape: {
|
|
42
|
-
displayName: z.string().optional(),
|
|
43
|
-
description: z.string().optional(),
|
|
44
|
-
code: z.string().min(1)
|
|
45
|
-
},
|
|
46
|
-
output: edgeFunctionSchema,
|
|
47
|
-
unwrapKey: "edgeFunction"
|
|
48
|
-
});
|
|
49
|
-
const deleteEdgeFunction = crudMutate({
|
|
50
|
-
id: "segment.edgeFunctions.delete",
|
|
51
|
-
name: "Delete edge function",
|
|
52
|
-
description: "Delete an Edge Function.",
|
|
53
|
-
method: "DELETE",
|
|
54
|
-
path: "/edge-functions/{id}",
|
|
55
|
-
output: z.object({}).catchall(z.unknown())
|
|
56
|
-
});
|
|
57
|
-
const deployEdgeFunction = segmentOperation({
|
|
58
|
-
id: "segment.edgeFunctions.deploy",
|
|
59
|
-
name: "Deploy edge function",
|
|
60
|
-
description: "Deploy the current code of an Edge Function.",
|
|
61
|
-
input: z.object({ id: segmentIdSchema }),
|
|
62
|
-
output: edgeFunctionSchema,
|
|
63
|
-
needsApproval: true,
|
|
64
|
-
run: async (input, credentials) => {
|
|
65
|
-
const body = await createSegmentClient(credentials).publicApi.request(`/edge-functions/${encodeURIComponent(input.id)}/deploy`, { method: "POST" });
|
|
66
|
-
const rec = body;
|
|
67
|
-
return edgeFunctionSchema.parse(rec.data?.edgeFunction ?? body);
|
|
68
|
-
}
|
|
69
|
-
});
|
|
70
|
-
|
|
71
|
-
//#endregion
|
|
72
|
-
export { deleteEdgeFunction, deployEdgeFunction, edgeFunctionSchema, getEdgeFunction, listEdgeFunctions, upsertEdgeFunction };
|
package/dist/errors-4FGnrowW.mjs
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
//#region src/errors.ts
|
|
2
|
-
var SegmentApiError = class extends Error {
|
|
3
|
-
kind;
|
|
4
|
-
status;
|
|
5
|
-
requestId;
|
|
6
|
-
code;
|
|
7
|
-
retryable;
|
|
8
|
-
body;
|
|
9
|
-
constructor(init) {
|
|
10
|
-
super(init.message, init.cause !== void 0 ? { cause: init.cause } : void 0);
|
|
11
|
-
this.name = "SegmentApiError";
|
|
12
|
-
this.kind = init.kind;
|
|
13
|
-
this.status = init.status;
|
|
14
|
-
this.requestId = init.requestId;
|
|
15
|
-
this.code = init.code;
|
|
16
|
-
this.retryable = init.retryable ?? defaultRetryable(init.kind, init.status);
|
|
17
|
-
this.body = init.body;
|
|
18
|
-
}
|
|
19
|
-
};
|
|
20
|
-
function defaultRetryable(kind, status) {
|
|
21
|
-
if (kind === "rate_limit" || kind === "network") return true;
|
|
22
|
-
if (kind === "http" && typeof status === "number" && status >= 500 && status < 600) return true;
|
|
23
|
-
return false;
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
//#endregion
|
|
27
|
-
export { SegmentApiError as t };
|
|
@@ -1,77 +0,0 @@
|
|
|
1
|
-
import { z } from "zod";
|
|
2
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
3
|
-
|
|
4
|
-
//#region src/events-catalog.d.ts
|
|
5
|
-
declare const listEventVolume: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
6
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
7
|
-
pageToken: z.ZodOptional<z.ZodString>;
|
|
8
|
-
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
9
|
-
items: z.ZodArray<z.ZodObject<{
|
|
10
|
-
sourceId: z.ZodOptional<z.ZodString>;
|
|
11
|
-
date: z.ZodOptional<z.ZodString>;
|
|
12
|
-
eventName: z.ZodOptional<z.ZodString>;
|
|
13
|
-
count: z.ZodOptional<z.ZodNumber>;
|
|
14
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
15
|
-
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
16
|
-
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
18
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
19
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
20
|
-
us: "us";
|
|
21
|
-
eu: "eu";
|
|
22
|
-
}>>;
|
|
23
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
24
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
25
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
26
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
27
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>>], undefined>;
|
|
29
|
-
declare const listEventViolations: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
30
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
31
|
-
pageToken: z.ZodOptional<z.ZodString>;
|
|
32
|
-
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
33
|
-
items: z.ZodArray<z.ZodObject<{
|
|
34
|
-
eventName: z.ZodOptional<z.ZodString>;
|
|
35
|
-
violationCount: z.ZodOptional<z.ZodNumber>;
|
|
36
|
-
sourceId: z.ZodOptional<z.ZodString>;
|
|
37
|
-
trackingPlanId: z.ZodOptional<z.ZodString>;
|
|
38
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
39
|
-
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
40
|
-
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
41
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", 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>>], undefined>;
|
|
53
|
-
declare const listEventSchema: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
|
|
54
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
55
|
-
pageToken: z.ZodOptional<z.ZodString>;
|
|
56
|
-
}, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
|
|
57
|
-
items: z.ZodArray<z.ZodObject<{
|
|
58
|
-
eventName: z.ZodOptional<z.ZodString>;
|
|
59
|
-
schema: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
-
sourceId: z.ZodOptional<z.ZodString>;
|
|
61
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
62
|
-
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
63
|
-
totalEntries: z.ZodOptional<z.ZodNumber>;
|
|
64
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
|
|
65
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
66
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
67
|
-
us: "us";
|
|
68
|
-
eu: "eu";
|
|
69
|
-
}>>;
|
|
70
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
71
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
72
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
73
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
74
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
75
|
-
}, z.core.$strip>>], undefined>;
|
|
76
|
-
//#endregion
|
|
77
|
-
export { listEventSchema, listEventViolations, listEventVolume };
|
package/dist/events-catalog.mjs
DELETED
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { a as segmentLooseObjectSchema } from "./common-CdGiJbjq.mjs";
|
|
2
|
-
import { n as crudList } from "./crud-DGM2Ekdr.mjs";
|
|
3
|
-
import { z } from "zod";
|
|
4
|
-
|
|
5
|
-
//#region src/events-catalog.ts
|
|
6
|
-
/**
|
|
7
|
-
* segment/events-catalog.ts — workspace-wide event volume/violations/schema.
|
|
8
|
-
* 3 actions (PLAN § 6.16).
|
|
9
|
-
*/
|
|
10
|
-
const eventVolumeSchema = segmentLooseObjectSchema({
|
|
11
|
-
sourceId: z.string().optional(),
|
|
12
|
-
date: z.string().optional(),
|
|
13
|
-
eventName: z.string().optional(),
|
|
14
|
-
count: z.number().optional()
|
|
15
|
-
});
|
|
16
|
-
const eventViolationSchema = segmentLooseObjectSchema({
|
|
17
|
-
eventName: z.string().optional(),
|
|
18
|
-
violationCount: z.number().optional(),
|
|
19
|
-
sourceId: z.string().optional(),
|
|
20
|
-
trackingPlanId: z.string().optional()
|
|
21
|
-
});
|
|
22
|
-
const eventSchemaEntry = segmentLooseObjectSchema({
|
|
23
|
-
eventName: z.string().optional(),
|
|
24
|
-
schema: z.record(z.string(), z.unknown()).optional(),
|
|
25
|
-
sourceId: z.string().optional()
|
|
26
|
-
});
|
|
27
|
-
const listEventVolume = crudList({
|
|
28
|
-
id: "segment.events.listVolume",
|
|
29
|
-
name: "List event volume",
|
|
30
|
-
description: "Workspace event volume per source/event/day.",
|
|
31
|
-
path: "/events/volume",
|
|
32
|
-
itemsKey: "volume",
|
|
33
|
-
item: eventVolumeSchema,
|
|
34
|
-
extraInput: {
|
|
35
|
-
startTime: z.iso.datetime({ offset: true }).optional(),
|
|
36
|
-
endTime: z.iso.datetime({ offset: true }).optional(),
|
|
37
|
-
sourceId: z.string().optional()
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
const listEventViolations = crudList({
|
|
41
|
-
id: "segment.events.listViolations",
|
|
42
|
-
name: "List event violations",
|
|
43
|
-
description: "Tracking-plan violations observed workspace-wide.",
|
|
44
|
-
path: "/events/violations",
|
|
45
|
-
itemsKey: "violations",
|
|
46
|
-
item: eventViolationSchema,
|
|
47
|
-
extraInput: {
|
|
48
|
-
startTime: z.iso.datetime({ offset: true }).optional(),
|
|
49
|
-
endTime: z.iso.datetime({ offset: true }).optional(),
|
|
50
|
-
sourceId: z.string().optional(),
|
|
51
|
-
trackingPlanId: z.string().optional()
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
const listEventSchema = crudList({
|
|
55
|
-
id: "segment.events.listSchema",
|
|
56
|
-
name: "List event schema",
|
|
57
|
-
description: "Inferred event schema per source.",
|
|
58
|
-
path: "/events/schema",
|
|
59
|
-
itemsKey: "schema",
|
|
60
|
-
item: eventSchemaEntry,
|
|
61
|
-
extraInput: { sourceId: z.string().optional() }
|
|
62
|
-
});
|
|
63
|
-
|
|
64
|
-
//#endregion
|
|
65
|
-
export { listEventSchema, listEventViolations, listEventVolume };
|