@keystrokehq/segment 0.0.15 → 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.
- 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-QbDIgfRG.d.mts +6548 -0
- package/package.json +14 -126
- 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
|
@@ -1,32 +1,13 @@
|
|
|
1
|
-
import
|
|
1
|
+
import { CredentialSet } from "@keystrokehq/core";
|
|
2
2
|
import { z } from "zod";
|
|
3
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
3
|
import { InferCredentialSetAuth } from "@keystrokehq/core/credential-set";
|
|
5
4
|
|
|
6
|
-
//#region src/
|
|
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
|
|
12
|
-
id: "segment";
|
|
13
|
-
name: string;
|
|
14
|
-
description: string;
|
|
15
|
-
credentialType: "manual";
|
|
16
|
-
auth: z.ZodObject<{
|
|
17
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
18
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
19
|
-
us: "us";
|
|
20
|
-
eu: "eu";
|
|
21
|
-
}>>;
|
|
22
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
23
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
24
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
25
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
26
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
27
|
-
}, z.core.$strip>;
|
|
28
|
-
};
|
|
29
|
-
declare const segmentBundle: _keystrokehq_integration_authoring_official0.OfficialIntegrationBundle<"segment", z.ZodObject<{
|
|
10
|
+
declare const segmentAuthSchema: z.ZodObject<{
|
|
30
11
|
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
31
12
|
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
32
13
|
us: "us";
|
|
@@ -37,8 +18,12 @@ declare const segmentBundle: _keystrokehq_integration_authoring_official0.Offici
|
|
|
37
18
|
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
38
19
|
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
39
20
|
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
40
|
-
}, z.core.$strip
|
|
41
|
-
|
|
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<{
|
|
42
27
|
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
43
28
|
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
44
29
|
us: "us";
|
|
@@ -49,8 +34,24 @@ declare const segment: _keystrokehq_core0.CredentialSet<"keystroke:segment", z.Z
|
|
|
49
34
|
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
50
35
|
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
51
36
|
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
52
|
-
}, z.core.$strip
|
|
53
|
-
|
|
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>;
|
|
54
55
|
type SegmentRegion = z.infer<typeof segmentRegionSchema>;
|
|
55
56
|
//#endregion
|
|
56
|
-
export {
|
|
57
|
+
export { segmentRegionSchema as a, segmentCredentialSet as i, SegmentRegion as n, segmentAuthSchema as r, SegmentCredentials as t };
|
|
@@ -1,11 +1,77 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { SegmentAudienceSyncEvent, SegmentDeletionRegulationEvent, SegmentDestinationCreatedEvent, SegmentFunctionVersionEvent, SegmentReverseEtlRunEvent, SegmentSourceCreatedEvent, SegmentTrackingPlanViolationEvent } from "./events.mjs";
|
|
3
|
-
import { IntegrationTriggerBindingOptions } from "@keystrokehq/integration-authoring";
|
|
1
|
+
import { i as segmentCredentialSet } from "../segment.credential-set-BgROtI_9.mjs";
|
|
4
2
|
import { BoundTrigger } from "@keystrokehq/core";
|
|
3
|
+
import { z } from "zod";
|
|
5
4
|
import { PollingTriggerManifest } from "@keystrokehq/core/trigger";
|
|
6
5
|
|
|
7
|
-
//#region src/
|
|
8
|
-
|
|
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,19 +1,198 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
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";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
import { pollingTrigger } from "@keystrokehq/core/trigger";
|
|
5
6
|
|
|
6
|
-
//#region
|
|
7
|
+
//#region ../../packages/integration-authoring/dist/index.mjs
|
|
8
|
+
const IntegrationConfigSchema = z.object({
|
|
9
|
+
id: z.string().min(1),
|
|
10
|
+
name: z.string().min(1),
|
|
11
|
+
description: z.string().optional()
|
|
12
|
+
});
|
|
13
|
+
function resolveMetadata(metadata, defaults) {
|
|
14
|
+
return {
|
|
15
|
+
id: metadata?.id ?? defaults.defaultId,
|
|
16
|
+
description: metadata?.description ?? defaults.defaultDescription
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
function resolveAuthorPayload(payload, mapPayload) {
|
|
20
|
+
if (!mapPayload) return payload;
|
|
21
|
+
return mapPayload(payload);
|
|
22
|
+
}
|
|
23
|
+
function createIntegrationTriggerBindingFactory(config) {
|
|
24
|
+
const bind = (options) => {
|
|
25
|
+
const resolvedMetadata = resolveMetadata(options, config);
|
|
26
|
+
const baseTrigger = config.createBaseTrigger(resolvedMetadata);
|
|
27
|
+
const userTransform = options?.transform;
|
|
28
|
+
return baseTrigger({ transform: userTransform || config.mapPayload ? (runtimePayload, request) => {
|
|
29
|
+
const authorPayload = resolveAuthorPayload(runtimePayload, config.mapPayload);
|
|
30
|
+
if (authorPayload === null) throw new Error(`Trigger "${resolvedMetadata.id}" mapPayload returned null after the trigger filter passed; tighten the trigger filter schema.`);
|
|
31
|
+
if (!userTransform) return authorPayload;
|
|
32
|
+
return userTransform(authorPayload, request);
|
|
33
|
+
} : void 0 });
|
|
34
|
+
};
|
|
35
|
+
return Object.freeze(bind);
|
|
36
|
+
}
|
|
37
|
+
function createPollingTriggerBindingFactory(config) {
|
|
38
|
+
return createIntegrationTriggerBindingFactory({
|
|
39
|
+
defaultId: config.defaultId,
|
|
40
|
+
defaultDescription: config.defaultDescription,
|
|
41
|
+
mapPayload: config.mapPayload,
|
|
42
|
+
createBaseTrigger: (metadata) => pollingTrigger({
|
|
43
|
+
id: metadata.id,
|
|
44
|
+
description: metadata.description,
|
|
45
|
+
schedule: config.schedule,
|
|
46
|
+
response: config.response,
|
|
47
|
+
poll: config.poll,
|
|
48
|
+
...config.credentialSets ? { credentialSets: config.credentialSets } : {},
|
|
49
|
+
...config.filter ? { filter: config.filter } : {}
|
|
50
|
+
})
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
//#endregion
|
|
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
|
|
7
186
|
function buildPollingBinding(definition, options) {
|
|
8
187
|
const schedule = options?.schedule ?? definition.defaultSchedule;
|
|
9
188
|
return createPollingTriggerBindingFactory({
|
|
10
189
|
defaultId: definition.defaultId,
|
|
11
190
|
defaultDescription: definition.defaultDescription,
|
|
12
191
|
schedule,
|
|
13
|
-
credentialSets: [
|
|
192
|
+
credentialSets: [segmentCredentialSet],
|
|
14
193
|
response: definition.eventSchema,
|
|
15
194
|
poll: async (ctx) => {
|
|
16
|
-
const credentials = ctx.credentials
|
|
195
|
+
const credentials = ctx.credentials.segment;
|
|
17
196
|
return definition.poll(credentials, ctx.lastPolledAt);
|
|
18
197
|
}
|
|
19
198
|
})({
|