@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.
- 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/segment.credential-set-BTTrkHO7.mjs +33 -0
- package/dist/{integration-CeShwMIi.d.mts → segment.credential-set-BgROtI_9.d.mts} +28 -37
- package/dist/{triggers.d.mts → triggers/index.d.mts} +72 -6
- package/dist/{triggers.mjs → triggers/index.mjs} +136 -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 +11 -123
- 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 -282
- package/dist/audiences.mjs +0 -205
- package/dist/client.d.mts +0 -90
- package/dist/computed-traits.d.mts +0 -215
- package/dist/computed-traits.mjs +0 -149
- package/dist/connection.d.mts +0 -2
- package/dist/connection.mjs +0 -3
- package/dist/crud-DV9e4Spi.mjs +0 -140
- package/dist/deletion-suppression.d.mts +0 -191
- package/dist/deletion-suppression.mjs +0 -103
- package/dist/delivery-overview.d.mts +0 -79
- package/dist/delivery-overview.mjs +0 -54
- package/dist/destination-filters.d.mts +0 -190
- package/dist/destination-filters.mjs +0 -115
- package/dist/destinations.d.mts +0 -473
- package/dist/destinations.mjs +0 -257
- package/dist/edge-functions.d.mts +0 -168
- package/dist/edge-functions.mjs +0 -72
- package/dist/errors-4FGnrowW.mjs +0 -27
- package/dist/events-catalog.d.mts +0 -111
- package/dist/events-catalog.mjs +0 -65
- package/dist/events.d.mts +0 -167
- package/dist/events.mjs +0 -134
- package/dist/factory-DRwj5eiU.mjs +0 -7
- package/dist/functions.d.mts +0 -347
- package/dist/functions.mjs +0 -180
- package/dist/iam-groups.d.mts +0 -284
- package/dist/iam-groups.mjs +0 -144
- package/dist/iam-users.d.mts +0 -205
- package/dist/iam-users.mjs +0 -91
- package/dist/integration-B9FOjHPc.mjs +0 -115
- package/dist/labels.d.mts +0 -100
- package/dist/labels.mjs +0 -58
- package/dist/monitoring.d.mts +0 -182
- package/dist/monitoring.mjs +0 -88
- package/dist/profiles-sync.d.mts +0 -127
- package/dist/profiles-sync.mjs +0 -89
- package/dist/profiles.d.mts +0 -197
- package/dist/profiles.mjs +0 -137
- package/dist/reverse-etl.d.mts +0 -448
- package/dist/reverse-etl.mjs +0 -228
- package/dist/roles.d.mts +0 -48
- package/dist/roles.mjs +0 -25
- package/dist/sources.d.mts +0 -560
- package/dist/sources.mjs +0 -259
- package/dist/tracking-plans.d.mts +0 -351
- package/dist/tracking-plans.mjs +0 -160
- package/dist/tracking.d.mts +0 -499
- package/dist/tracking.mjs +0 -255
- package/dist/transformations.d.mts +0 -188
- package/dist/transformations.mjs +0 -83
- package/dist/usage.d.mts +0 -70
- 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 -341
- package/dist/warehouses.mjs +0 -176
- package/dist/workspaces.d.mts +0 -95
- package/dist/workspaces.mjs +0 -67
- /package/dist/{common-CdGiJbjq.mjs → common-DUU0airJ.mjs} +0 -0
package/dist/client.d.mts
DELETED
|
@@ -1,90 +0,0 @@
|
|
|
1
|
-
import { n as SegmentRegion, t as SegmentCredentials } from "./integration-CeShwMIi.mjs";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
|
|
4
|
-
//#region src/client.d.ts
|
|
5
|
-
declare const PUBLIC_API_HOSTS: Readonly<Record<SegmentRegion, string>>;
|
|
6
|
-
declare const TRACKING_API_HOSTS: Readonly<Record<SegmentRegion, string>>;
|
|
7
|
-
declare const PROFILE_API_HOST = "https://profiles.segment.com/v1";
|
|
8
|
-
/** Segment-enforced hard limit for a single event body (Track/Identify/…). */
|
|
9
|
-
declare const MAX_EVENT_BYTES: number;
|
|
10
|
-
/** Segment-enforced hard limit for a `/v1/batch` envelope. */
|
|
11
|
-
declare const MAX_BATCH_BYTES: number;
|
|
12
|
-
type FetchLike = (input: string | URL, init?: RequestInit) => Promise<Response>;
|
|
13
|
-
interface CreateSegmentClientOptions {
|
|
14
|
-
/** Override the global `fetch` (for tests, custom timeouts, etc.). */
|
|
15
|
-
readonly fetch?: FetchLike;
|
|
16
|
-
/** Maximum number of retries on 429/5xx. Defaults to 3. */
|
|
17
|
-
readonly maxRetries?: number;
|
|
18
|
-
/** Maximum overall backoff between retries in ms. Defaults to 10_000. */
|
|
19
|
-
readonly maxBackoffMs?: number;
|
|
20
|
-
/** Sleep function (override for tests). */
|
|
21
|
-
readonly sleep?: (ms: number) => Promise<void>;
|
|
22
|
-
}
|
|
23
|
-
type QueryPrimitive = string | number | boolean;
|
|
24
|
-
type QueryValue = QueryPrimitive | readonly QueryPrimitive[] | undefined;
|
|
25
|
-
interface PublicRequestOptions {
|
|
26
|
-
readonly method?: 'GET' | 'POST' | 'PATCH' | 'PUT' | 'DELETE';
|
|
27
|
-
readonly query?: Readonly<Record<string, QueryValue>>;
|
|
28
|
-
readonly body?: unknown;
|
|
29
|
-
readonly timeoutMs?: number;
|
|
30
|
-
}
|
|
31
|
-
interface ListOptions<TOut> {
|
|
32
|
-
readonly itemsKey: string;
|
|
33
|
-
readonly items: z.ZodType<TOut>;
|
|
34
|
-
}
|
|
35
|
-
interface ListResult<T> {
|
|
36
|
-
readonly items: readonly T[];
|
|
37
|
-
readonly nextPageToken?: string;
|
|
38
|
-
readonly totalEntries?: number;
|
|
39
|
-
}
|
|
40
|
-
interface BatchSplitChunk<T> {
|
|
41
|
-
readonly events: readonly T[];
|
|
42
|
-
readonly bytes: number;
|
|
43
|
-
}
|
|
44
|
-
interface BatchSplitResult<T> {
|
|
45
|
-
readonly chunks: readonly BatchSplitChunk<T>[];
|
|
46
|
-
readonly rejected: readonly {
|
|
47
|
-
readonly event: T;
|
|
48
|
-
readonly bytes: number;
|
|
49
|
-
}[];
|
|
50
|
-
}
|
|
51
|
-
declare function splitBatch<T>(events: readonly T[], options?: {
|
|
52
|
-
readonly maxBatchBytes?: number;
|
|
53
|
-
readonly maxEventBytes?: number;
|
|
54
|
-
}): BatchSplitResult<T>;
|
|
55
|
-
interface PublicApiClient {
|
|
56
|
-
readonly baseUrl: string;
|
|
57
|
-
readonly request: <T>(path: string, options?: PublicRequestOptions) => Promise<T>;
|
|
58
|
-
readonly list: <T>(path: string, listOpts: ListOptions<T>, requestOpts?: PublicRequestOptions) => Promise<ListResult<T>>;
|
|
59
|
-
}
|
|
60
|
-
interface TrackingApiClient {
|
|
61
|
-
readonly baseUrl: string;
|
|
62
|
-
/** Send a single tracking event. `method` defaults to the endpoint path
|
|
63
|
-
* (e.g. `identify`, `track`). `sourceId` selects which write key to use. */
|
|
64
|
-
readonly send: (method: TrackingMethod, payload: Record<string, unknown>, options?: {
|
|
65
|
-
readonly sourceId?: string;
|
|
66
|
-
}) => Promise<void>;
|
|
67
|
-
readonly batch: (events: readonly Record<string, unknown>[], options?: {
|
|
68
|
-
readonly sourceId?: string;
|
|
69
|
-
}) => Promise<{
|
|
70
|
-
readonly chunksSent: number;
|
|
71
|
-
readonly rejected: readonly Record<string, unknown>[];
|
|
72
|
-
}>;
|
|
73
|
-
}
|
|
74
|
-
interface ProfileApiClient {
|
|
75
|
-
readonly baseUrl: string;
|
|
76
|
-
readonly request: <T>(path: string, options?: PublicRequestOptions & {
|
|
77
|
-
readonly spaceId?: string;
|
|
78
|
-
}) => Promise<T>;
|
|
79
|
-
}
|
|
80
|
-
type TrackingMethod = 'identify' | 'track' | 'page' | 'screen' | 'group' | 'alias' | 'batch';
|
|
81
|
-
interface SegmentClient {
|
|
82
|
-
readonly credentials: SegmentCredentials;
|
|
83
|
-
readonly region: SegmentRegion;
|
|
84
|
-
readonly publicApi: PublicApiClient;
|
|
85
|
-
readonly tracking: TrackingApiClient;
|
|
86
|
-
readonly profiles: ProfileApiClient;
|
|
87
|
-
}
|
|
88
|
-
declare function createSegmentClient(credentials: SegmentCredentials, options?: CreateSegmentClientOptions): SegmentClient;
|
|
89
|
-
//#endregion
|
|
90
|
-
export { BatchSplitChunk, BatchSplitResult, CreateSegmentClientOptions, FetchLike, ListOptions, ListResult, MAX_BATCH_BYTES, MAX_EVENT_BYTES, PROFILE_API_HOST, PUBLIC_API_HOSTS, ProfileApiClient, PublicApiClient, PublicRequestOptions, SegmentClient, TRACKING_API_HOSTS, TrackingApiClient, TrackingMethod, createSegmentClient, splitBatch };
|
|
@@ -1,215 +0,0 @@
|
|
|
1
|
-
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
2
|
-
import { z } from "zod";
|
|
3
|
-
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
4
|
-
|
|
5
|
-
//#region src/computed-traits.d.ts
|
|
6
|
-
declare const computedTraitSchema: z.ZodObject<{
|
|
7
|
-
id: z.ZodString;
|
|
8
|
-
key: z.ZodOptional<z.ZodString>;
|
|
9
|
-
name: z.ZodOptional<z.ZodString>;
|
|
10
|
-
description: z.ZodOptional<z.ZodString>;
|
|
11
|
-
definition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
12
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
13
|
-
}, z.core.$catchall<z.ZodUnknown>>;
|
|
14
|
-
declare const listComputedTraits: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
15
|
-
spaceId: z.ZodString;
|
|
16
|
-
pageSize: z.ZodOptional<z.ZodNumber>;
|
|
17
|
-
pageToken: z.ZodOptional<z.ZodString>;
|
|
18
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
19
|
-
items: z.ZodArray<z.ZodObject<{
|
|
20
|
-
id: z.ZodString;
|
|
21
|
-
key: z.ZodOptional<z.ZodString>;
|
|
22
|
-
name: z.ZodOptional<z.ZodString>;
|
|
23
|
-
description: z.ZodOptional<z.ZodString>;
|
|
24
|
-
definition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
25
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
26
|
-
}, z.core.$catchall<z.ZodUnknown>>>;
|
|
27
|
-
nextPageToken: z.ZodOptional<z.ZodString>;
|
|
28
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"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>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
40
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
41
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
42
|
-
us: "us";
|
|
43
|
-
eu: "eu";
|
|
44
|
-
}>>;
|
|
45
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
46
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
47
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
48
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
49
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
50
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
51
|
-
declare const getComputedTrait: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
52
|
-
spaceId: z.ZodString;
|
|
53
|
-
id: z.ZodString;
|
|
54
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
55
|
-
id: z.ZodString;
|
|
56
|
-
key: z.ZodOptional<z.ZodString>;
|
|
57
|
-
name: z.ZodOptional<z.ZodString>;
|
|
58
|
-
description: z.ZodOptional<z.ZodString>;
|
|
59
|
-
definition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
60
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
61
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
62
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
63
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
64
|
-
us: "us";
|
|
65
|
-
eu: "eu";
|
|
66
|
-
}>>;
|
|
67
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
68
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
69
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
70
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
71
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
72
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
73
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
74
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
75
|
-
us: "us";
|
|
76
|
-
eu: "eu";
|
|
77
|
-
}>>;
|
|
78
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
79
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
80
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
81
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
82
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
83
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
84
|
-
declare const createComputedTrait: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
85
|
-
spaceId: z.ZodString;
|
|
86
|
-
name: z.ZodString;
|
|
87
|
-
description: z.ZodOptional<z.ZodString>;
|
|
88
|
-
definition: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
89
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
90
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
91
|
-
id: z.ZodString;
|
|
92
|
-
key: z.ZodOptional<z.ZodString>;
|
|
93
|
-
name: z.ZodOptional<z.ZodString>;
|
|
94
|
-
description: z.ZodOptional<z.ZodString>;
|
|
95
|
-
definition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
96
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
97
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
98
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
99
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
100
|
-
us: "us";
|
|
101
|
-
eu: "eu";
|
|
102
|
-
}>>;
|
|
103
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
104
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
105
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
106
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
107
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
108
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
109
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
110
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
111
|
-
us: "us";
|
|
112
|
-
eu: "eu";
|
|
113
|
-
}>>;
|
|
114
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
115
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
116
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
117
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
118
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
119
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
120
|
-
declare const updateComputedTrait: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
121
|
-
spaceId: z.ZodString;
|
|
122
|
-
id: z.ZodString;
|
|
123
|
-
name: z.ZodOptional<z.ZodString>;
|
|
124
|
-
description: z.ZodOptional<z.ZodString>;
|
|
125
|
-
definition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
126
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
127
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
128
|
-
id: z.ZodString;
|
|
129
|
-
key: z.ZodOptional<z.ZodString>;
|
|
130
|
-
name: z.ZodOptional<z.ZodString>;
|
|
131
|
-
description: z.ZodOptional<z.ZodString>;
|
|
132
|
-
definition: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
133
|
-
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
134
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
135
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
136
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
137
|
-
us: "us";
|
|
138
|
-
eu: "eu";
|
|
139
|
-
}>>;
|
|
140
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
141
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
142
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
143
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
144
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
145
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
146
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
147
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
148
|
-
us: "us";
|
|
149
|
-
eu: "eu";
|
|
150
|
-
}>>;
|
|
151
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
152
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
153
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
154
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
155
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
156
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
157
|
-
declare const deleteComputedTrait: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
158
|
-
spaceId: z.ZodString;
|
|
159
|
-
id: z.ZodString;
|
|
160
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
161
|
-
deleted: z.ZodLiteral<true>;
|
|
162
|
-
}, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
163
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
164
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
165
|
-
us: "us";
|
|
166
|
-
eu: "eu";
|
|
167
|
-
}>>;
|
|
168
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
169
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
170
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
171
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
172
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
173
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
174
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
175
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
176
|
-
us: "us";
|
|
177
|
-
eu: "eu";
|
|
178
|
-
}>>;
|
|
179
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
180
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
181
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
182
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
183
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
184
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
185
|
-
declare const previewComputedTrait: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
186
|
-
spaceId: z.ZodString;
|
|
187
|
-
definition: z.ZodRecord<z.ZodString, z.ZodUnknown>;
|
|
188
|
-
}, z.core.$strip>, z.ZodObject<{
|
|
189
|
-
count: z.ZodOptional<z.ZodNumber>;
|
|
190
|
-
sample: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
191
|
-
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
192
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
193
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
194
|
-
us: "us";
|
|
195
|
-
eu: "eu";
|
|
196
|
-
}>>;
|
|
197
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
198
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
199
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
200
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
201
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
202
|
-
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
203
|
-
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
204
|
-
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
205
|
-
us: "us";
|
|
206
|
-
eu: "eu";
|
|
207
|
-
}>>;
|
|
208
|
-
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
209
|
-
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
210
|
-
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
211
|
-
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
212
|
-
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
213
|
-
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
214
|
-
//#endregion
|
|
215
|
-
export { computedTraitSchema, createComputedTrait, deleteComputedTrait, getComputedTrait, listComputedTraits, previewComputedTrait, updateComputedTrait };
|
package/dist/computed-traits.mjs
DELETED
|
@@ -1,149 +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-DRwj5eiU.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/computed-traits.ts
|
|
7
|
-
/**
|
|
8
|
-
* segment/computed-traits.ts — Engage computed traits. 6 actions (PLAN § 6.8).
|
|
9
|
-
*/
|
|
10
|
-
const computedTraitSchema = segmentLooseObjectSchema({
|
|
11
|
-
id: segmentIdSchema,
|
|
12
|
-
key: z.string().optional(),
|
|
13
|
-
name: z.string().optional(),
|
|
14
|
-
description: z.string().optional(),
|
|
15
|
-
definition: z.record(z.string(), z.unknown()).optional(),
|
|
16
|
-
enabled: z.boolean().optional()
|
|
17
|
-
});
|
|
18
|
-
const previewSchema = segmentLooseObjectSchema({
|
|
19
|
-
count: z.number().optional(),
|
|
20
|
-
sample: z.array(z.record(z.string(), z.unknown())).optional()
|
|
21
|
-
});
|
|
22
|
-
const listComputedTraits = segmentOperation({
|
|
23
|
-
id: "segment.computedTraits.list",
|
|
24
|
-
name: "List computed traits",
|
|
25
|
-
description: "List computed traits in an Engage space.",
|
|
26
|
-
input: z.object({
|
|
27
|
-
spaceId: segmentIdSchema,
|
|
28
|
-
pageSize: z.number().int().positive().max(200).optional(),
|
|
29
|
-
pageToken: z.string().optional()
|
|
30
|
-
}),
|
|
31
|
-
output: z.object({
|
|
32
|
-
items: z.array(computedTraitSchema),
|
|
33
|
-
nextPageToken: z.string().optional()
|
|
34
|
-
}),
|
|
35
|
-
run: async (input, credentials) => {
|
|
36
|
-
const result = await createSegmentClient(credentials).publicApi.list(`/spaces/${encodeURIComponent(input.spaceId)}/computed-traits`, {
|
|
37
|
-
itemsKey: "computedTraits",
|
|
38
|
-
items: computedTraitSchema
|
|
39
|
-
}, { query: {
|
|
40
|
-
count: input.pageSize,
|
|
41
|
-
cursor: input.pageToken
|
|
42
|
-
} });
|
|
43
|
-
return {
|
|
44
|
-
items: [...result.items],
|
|
45
|
-
...result.nextPageToken !== void 0 ? { nextPageToken: result.nextPageToken } : {}
|
|
46
|
-
};
|
|
47
|
-
}
|
|
48
|
-
});
|
|
49
|
-
const getComputedTrait = segmentOperation({
|
|
50
|
-
id: "segment.computedTraits.get",
|
|
51
|
-
name: "Get computed trait",
|
|
52
|
-
description: "Fetch a computed trait by id.",
|
|
53
|
-
input: z.object({
|
|
54
|
-
spaceId: segmentIdSchema,
|
|
55
|
-
id: segmentIdSchema
|
|
56
|
-
}),
|
|
57
|
-
output: computedTraitSchema,
|
|
58
|
-
run: async (input, credentials) => {
|
|
59
|
-
const body = await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}/computed-traits/${encodeURIComponent(input.id)}`);
|
|
60
|
-
const rec = body;
|
|
61
|
-
return computedTraitSchema.parse(rec.data?.computedTrait ?? body);
|
|
62
|
-
}
|
|
63
|
-
});
|
|
64
|
-
const createComputedTrait = segmentOperation({
|
|
65
|
-
id: "segment.computedTraits.create",
|
|
66
|
-
name: "Create computed trait",
|
|
67
|
-
description: "Create a computed trait definition.",
|
|
68
|
-
input: z.object({
|
|
69
|
-
spaceId: segmentIdSchema,
|
|
70
|
-
name: z.string().min(1),
|
|
71
|
-
description: z.string().optional(),
|
|
72
|
-
definition: z.record(z.string(), z.unknown()),
|
|
73
|
-
enabled: z.boolean().optional()
|
|
74
|
-
}),
|
|
75
|
-
output: computedTraitSchema,
|
|
76
|
-
needsApproval: true,
|
|
77
|
-
run: async (input, credentials) => {
|
|
78
|
-
const client = createSegmentClient(credentials);
|
|
79
|
-
const { spaceId, ...body } = input;
|
|
80
|
-
const response = await client.publicApi.request(`/spaces/${encodeURIComponent(spaceId)}/computed-traits`, {
|
|
81
|
-
method: "POST",
|
|
82
|
-
body
|
|
83
|
-
});
|
|
84
|
-
const rec = response;
|
|
85
|
-
return computedTraitSchema.parse(rec.data?.computedTrait ?? response);
|
|
86
|
-
}
|
|
87
|
-
});
|
|
88
|
-
const updateComputedTrait = segmentOperation({
|
|
89
|
-
id: "segment.computedTraits.update",
|
|
90
|
-
name: "Update computed trait",
|
|
91
|
-
description: "Patch a computed trait definition.",
|
|
92
|
-
input: z.object({
|
|
93
|
-
spaceId: segmentIdSchema,
|
|
94
|
-
id: segmentIdSchema,
|
|
95
|
-
name: z.string().optional(),
|
|
96
|
-
description: z.string().optional(),
|
|
97
|
-
definition: z.record(z.string(), z.unknown()).optional(),
|
|
98
|
-
enabled: z.boolean().optional()
|
|
99
|
-
}),
|
|
100
|
-
output: computedTraitSchema,
|
|
101
|
-
needsApproval: true,
|
|
102
|
-
run: async (input, credentials) => {
|
|
103
|
-
const client = createSegmentClient(credentials);
|
|
104
|
-
const { spaceId, id, ...body } = input;
|
|
105
|
-
const response = await client.publicApi.request(`/spaces/${encodeURIComponent(spaceId)}/computed-traits/${encodeURIComponent(id)}`, {
|
|
106
|
-
method: "PATCH",
|
|
107
|
-
body
|
|
108
|
-
});
|
|
109
|
-
const rec = response;
|
|
110
|
-
return computedTraitSchema.parse(rec.data?.computedTrait ?? response);
|
|
111
|
-
}
|
|
112
|
-
});
|
|
113
|
-
const deleteComputedTrait = segmentOperation({
|
|
114
|
-
id: "segment.computedTraits.delete",
|
|
115
|
-
name: "Delete computed trait",
|
|
116
|
-
description: "Delete a computed trait.",
|
|
117
|
-
input: z.object({
|
|
118
|
-
spaceId: segmentIdSchema,
|
|
119
|
-
id: segmentIdSchema
|
|
120
|
-
}),
|
|
121
|
-
output: z.object({ deleted: z.literal(true) }),
|
|
122
|
-
needsApproval: true,
|
|
123
|
-
run: async (input, credentials) => {
|
|
124
|
-
await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}/computed-traits/${encodeURIComponent(input.id)}`, { method: "DELETE" });
|
|
125
|
-
return { deleted: true };
|
|
126
|
-
}
|
|
127
|
-
});
|
|
128
|
-
const previewComputedTrait = segmentOperation({
|
|
129
|
-
id: "segment.computedTraits.preview",
|
|
130
|
-
name: "Preview computed trait",
|
|
131
|
-
description: "Preview the output of a computed trait definition without saving.",
|
|
132
|
-
input: z.object({
|
|
133
|
-
spaceId: segmentIdSchema,
|
|
134
|
-
definition: z.record(z.string(), z.unknown())
|
|
135
|
-
}),
|
|
136
|
-
output: previewSchema,
|
|
137
|
-
needsApproval: true,
|
|
138
|
-
run: async (input, credentials) => {
|
|
139
|
-
const body = await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}/computed-traits/previews`, {
|
|
140
|
-
method: "POST",
|
|
141
|
-
body: { definition: input.definition }
|
|
142
|
-
});
|
|
143
|
-
const rec = body;
|
|
144
|
-
return previewSchema.parse(rec.data?.preview ?? body);
|
|
145
|
-
}
|
|
146
|
-
});
|
|
147
|
-
|
|
148
|
-
//#endregion
|
|
149
|
-
export { computedTraitSchema, createComputedTrait, deleteComputedTrait, getComputedTrait, listComputedTraits, previewComputedTrait, updateComputedTrait };
|
package/dist/connection.d.mts
DELETED
package/dist/connection.mjs
DELETED
package/dist/crud-DV9e4Spi.mjs
DELETED
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { createSegmentClient } from "./client.mjs";
|
|
2
|
-
import { o as segmentPaginationInputSchema } from "./common-CdGiJbjq.mjs";
|
|
3
|
-
import { t as segmentOperation } from "./factory-DRwj5eiU.mjs";
|
|
4
|
-
import { z } from "zod";
|
|
5
|
-
|
|
6
|
-
//#region src/crud.ts
|
|
7
|
-
/**
|
|
8
|
-
* segment/crud.ts
|
|
9
|
-
*
|
|
10
|
-
* Package-internal helpers for declaring the five canonical Public API CRUD
|
|
11
|
-
* operations (list/get/create/update/delete) succinctly in each domain
|
|
12
|
-
* module. Not exported — if we did, it would create an alternate authoring
|
|
13
|
-
* surface that competes with the factory, which AUTHORING.md prohibits.
|
|
14
|
-
*
|
|
15
|
-
* Each helper returns an `Operation` produced by `segmentOperation(...)`.
|
|
16
|
-
* Domain files wire these alongside any domain-specific operations they
|
|
17
|
-
* define manually.
|
|
18
|
-
*/
|
|
19
|
-
function crudList(config) {
|
|
20
|
-
const extra = config.extraInput ? z.object(config.extraInput) : z.object({});
|
|
21
|
-
const input = segmentPaginationInputSchema.and(extra);
|
|
22
|
-
const output = z.object({
|
|
23
|
-
items: z.array(config.item),
|
|
24
|
-
nextPageToken: z.string().optional(),
|
|
25
|
-
totalEntries: z.number().int().nonnegative().optional()
|
|
26
|
-
});
|
|
27
|
-
return segmentOperation({
|
|
28
|
-
id: config.id,
|
|
29
|
-
name: config.name,
|
|
30
|
-
description: config.description,
|
|
31
|
-
input,
|
|
32
|
-
output,
|
|
33
|
-
run: async (parsed, credentials) => {
|
|
34
|
-
const client = createSegmentClient(credentials);
|
|
35
|
-
const { pageSize, pageToken, ...rest } = parsed;
|
|
36
|
-
const query = {};
|
|
37
|
-
if (pageSize !== void 0) query.count = pageSize;
|
|
38
|
-
if (pageToken !== void 0) query.cursor = pageToken;
|
|
39
|
-
for (const [k, v] of Object.entries(rest)) {
|
|
40
|
-
if (v === void 0) continue;
|
|
41
|
-
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") query[k] = v;
|
|
42
|
-
}
|
|
43
|
-
const result = await client.publicApi.list(config.path, {
|
|
44
|
-
itemsKey: config.itemsKey,
|
|
45
|
-
items: config.item
|
|
46
|
-
}, { query });
|
|
47
|
-
return {
|
|
48
|
-
items: [...result.items],
|
|
49
|
-
...result.nextPageToken !== void 0 ? { nextPageToken: result.nextPageToken } : {},
|
|
50
|
-
...result.totalEntries !== void 0 ? { totalEntries: result.totalEntries } : {}
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
});
|
|
54
|
-
}
|
|
55
|
-
function crudGet(config) {
|
|
56
|
-
const idField = config.idField ?? "id";
|
|
57
|
-
const pathParamKeys = Object.keys(config.pathParams ?? {});
|
|
58
|
-
const inputShape = {
|
|
59
|
-
[idField]: z.string().min(1),
|
|
60
|
-
...config.extraInput ?? {},
|
|
61
|
-
...Object.fromEntries(pathParamKeys.map((k) => [k, z.string().min(1)]))
|
|
62
|
-
};
|
|
63
|
-
return segmentOperation({
|
|
64
|
-
id: config.id,
|
|
65
|
-
name: config.name,
|
|
66
|
-
description: config.description,
|
|
67
|
-
input: z.object(inputShape),
|
|
68
|
-
output: config.output,
|
|
69
|
-
run: async (raw, credentials) => {
|
|
70
|
-
const client = createSegmentClient(credentials);
|
|
71
|
-
const input = raw;
|
|
72
|
-
let path = config.path.replace(`{${idField}}`, encodeURIComponent(String(input[idField])));
|
|
73
|
-
for (const [key, placeholder] of Object.entries(config.pathParams ?? {})) path = path.replace(placeholder, encodeURIComponent(String(input[key])));
|
|
74
|
-
const query = {};
|
|
75
|
-
for (const key of Object.keys(config.extraInput ?? {})) {
|
|
76
|
-
const v = input[key];
|
|
77
|
-
if (typeof v === "string" || typeof v === "number" || typeof v === "boolean") query[key] = v;
|
|
78
|
-
}
|
|
79
|
-
return unwrapAndParse(await client.publicApi.request(path, { query }), config.output, config.unwrapKey);
|
|
80
|
-
}
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
function crudMutate(config) {
|
|
84
|
-
const idField = config.idField ?? "id";
|
|
85
|
-
const includeId = config.includeId ?? config.method !== "POST";
|
|
86
|
-
const pathParamKeys = Object.keys(config.pathParams ?? {});
|
|
87
|
-
const bodyKeys = new Set(Object.keys(config.bodyShape ?? {}));
|
|
88
|
-
const queryKeys = new Set(Object.keys(config.queryShape ?? {}));
|
|
89
|
-
const inputShape = {
|
|
90
|
-
...includeId ? { [idField]: z.string().min(1) } : {},
|
|
91
|
-
...Object.fromEntries(pathParamKeys.map((k) => [k, z.string().min(1)])),
|
|
92
|
-
...config.bodyShape ?? {},
|
|
93
|
-
...config.queryShape ?? {}
|
|
94
|
-
};
|
|
95
|
-
return segmentOperation({
|
|
96
|
-
id: config.id,
|
|
97
|
-
name: config.name,
|
|
98
|
-
description: config.description,
|
|
99
|
-
input: z.object(inputShape),
|
|
100
|
-
output: config.output,
|
|
101
|
-
needsApproval: true,
|
|
102
|
-
run: async (raw, credentials) => {
|
|
103
|
-
const client = createSegmentClient(credentials);
|
|
104
|
-
const input = raw;
|
|
105
|
-
let path = config.path;
|
|
106
|
-
if (includeId) path = path.replace(`{${idField}}`, encodeURIComponent(String(input[idField])));
|
|
107
|
-
for (const [key, placeholder] of Object.entries(config.pathParams ?? {})) path = path.replace(placeholder, encodeURIComponent(String(input[key])));
|
|
108
|
-
const body = {};
|
|
109
|
-
const query = {};
|
|
110
|
-
for (const [k, v] of Object.entries(input)) {
|
|
111
|
-
if (v === void 0) continue;
|
|
112
|
-
if (bodyKeys.has(k)) body[k] = v;
|
|
113
|
-
else if (queryKeys.has(k) && (typeof v === "string" || typeof v === "number" || typeof v === "boolean")) query[k] = v;
|
|
114
|
-
}
|
|
115
|
-
return unwrapAndParse(await client.publicApi.request(path, {
|
|
116
|
-
method: config.method,
|
|
117
|
-
...Object.keys(body).length > 0 ? { body } : {},
|
|
118
|
-
...Object.keys(query).length > 0 ? { query } : {}
|
|
119
|
-
}), config.output, config.unwrapKey);
|
|
120
|
-
}
|
|
121
|
-
});
|
|
122
|
-
}
|
|
123
|
-
function unwrapAndParse(body, output, unwrapKey) {
|
|
124
|
-
if (body === void 0 || body === null) {
|
|
125
|
-
const parsed = output.safeParse({});
|
|
126
|
-
if (parsed.success) return parsed.data;
|
|
127
|
-
return output.parse(null);
|
|
128
|
-
}
|
|
129
|
-
if (!unwrapKey) return output.parse(body);
|
|
130
|
-
if (typeof body === "object") {
|
|
131
|
-
const record = body;
|
|
132
|
-
const data = record.data ?? record;
|
|
133
|
-
if (unwrapKey in data) return output.parse(data[unwrapKey]);
|
|
134
|
-
return output.parse(body);
|
|
135
|
-
}
|
|
136
|
-
return output.parse(body);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
//#endregion
|
|
140
|
-
export { crudList as n, crudMutate as r, crudGet as t };
|