@keystrokehq/segment 0.0.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 +232 -0
- package/dist/_official/index.d.mts +2 -0
- package/dist/_official/index.mjs +3 -0
- package/dist/_runtime/index.d.mts +1 -0
- package/dist/_runtime/index.mjs +1 -0
- package/dist/audiences.d.mts +282 -0
- package/dist/audiences.mjs +205 -0
- package/dist/client.d.mts +90 -0
- package/dist/client.mjs +337 -0
- package/dist/common-CdGiJbjq.mjs +56 -0
- package/dist/computed-traits.d.mts +215 -0
- package/dist/computed-traits.mjs +149 -0
- package/dist/connection.d.mts +2 -0
- package/dist/connection.mjs +3 -0
- package/dist/crud-SWa_79Hg.mjs +140 -0
- package/dist/deletion-suppression.d.mts +191 -0
- package/dist/deletion-suppression.mjs +103 -0
- package/dist/delivery-overview.d.mts +79 -0
- package/dist/delivery-overview.mjs +54 -0
- package/dist/destination-filters.d.mts +190 -0
- package/dist/destination-filters.mjs +115 -0
- package/dist/destinations.d.mts +473 -0
- package/dist/destinations.mjs +257 -0
- package/dist/edge-functions.d.mts +168 -0
- package/dist/edge-functions.mjs +72 -0
- package/dist/errors-4FGnrowW.mjs +27 -0
- package/dist/events-catalog.d.mts +111 -0
- package/dist/events-catalog.mjs +65 -0
- package/dist/events.d.mts +167 -0
- package/dist/events.mjs +134 -0
- package/dist/factory-CvfKfzMq.mjs +8 -0
- package/dist/functions.d.mts +347 -0
- package/dist/functions.mjs +180 -0
- package/dist/iam-groups.d.mts +284 -0
- package/dist/iam-groups.mjs +144 -0
- package/dist/iam-users.d.mts +205 -0
- package/dist/iam-users.mjs +91 -0
- package/dist/index.d.mts +1 -0
- package/dist/index.mjs +1 -0
- package/dist/integration-B5zYasBZ.mjs +25 -0
- package/dist/integration-D2yRaKFR.d.mts +67 -0
- package/dist/labels.d.mts +100 -0
- package/dist/labels.mjs +58 -0
- package/dist/monitoring.d.mts +182 -0
- package/dist/monitoring.mjs +88 -0
- package/dist/profiles-sync.d.mts +127 -0
- package/dist/profiles-sync.mjs +89 -0
- package/dist/profiles.d.mts +197 -0
- package/dist/profiles.mjs +137 -0
- package/dist/reverse-etl.d.mts +448 -0
- package/dist/reverse-etl.mjs +228 -0
- package/dist/roles.d.mts +48 -0
- package/dist/roles.mjs +25 -0
- package/dist/schemas/index.d.mts +57 -0
- package/dist/schemas/index.mjs +3 -0
- package/dist/sources.d.mts +560 -0
- package/dist/sources.mjs +259 -0
- package/dist/tracking-plans.d.mts +351 -0
- package/dist/tracking-plans.mjs +160 -0
- package/dist/tracking.d.mts +499 -0
- package/dist/tracking.mjs +255 -0
- package/dist/transformations.d.mts +188 -0
- package/dist/transformations.mjs +83 -0
- package/dist/triggers.d.mts +54 -0
- package/dist/triggers.mjs +341 -0
- package/dist/usage.d.mts +70 -0
- package/dist/usage.mjs +55 -0
- package/dist/verification.d.mts +17 -0
- package/dist/verification.mjs +51 -0
- package/dist/warehouses.d.mts +341 -0
- package/dist/warehouses.mjs +176 -0
- package/dist/workspaces.d.mts +95 -0
- package/dist/workspaces.mjs +67 -0
- package/package.json +188 -0
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/profiles-sync.d.ts
|
|
6
|
+
declare const getProfilesSyncConfig: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
spaceId: z.ZodString;
|
|
8
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
9
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
10
|
+
warehouseId: z.ZodOptional<z.ZodString>;
|
|
11
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
12
|
+
schemaName: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
14
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
15
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
16
|
+
us: "us";
|
|
17
|
+
eu: "eu";
|
|
18
|
+
}>>;
|
|
19
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
20
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
21
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
22
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
23
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
24
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
25
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
26
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
27
|
+
us: "us";
|
|
28
|
+
eu: "eu";
|
|
29
|
+
}>>;
|
|
30
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
31
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
32
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
33
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
34
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
35
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
36
|
+
declare const updateProfilesSyncConfig: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
37
|
+
spaceId: z.ZodString;
|
|
38
|
+
warehouseId: z.ZodOptional<z.ZodString>;
|
|
39
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
40
|
+
schemaName: z.ZodOptional<z.ZodString>;
|
|
41
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
42
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
43
|
+
warehouseId: z.ZodOptional<z.ZodString>;
|
|
44
|
+
enabled: z.ZodOptional<z.ZodBoolean>;
|
|
45
|
+
schemaName: z.ZodOptional<z.ZodString>;
|
|
46
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
47
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
48
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
49
|
+
us: "us";
|
|
50
|
+
eu: "eu";
|
|
51
|
+
}>>;
|
|
52
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
53
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
54
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
55
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
56
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
57
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
58
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
59
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
60
|
+
us: "us";
|
|
61
|
+
eu: "eu";
|
|
62
|
+
}>>;
|
|
63
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
64
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
65
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
66
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
67
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
68
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
69
|
+
declare const getProfilesSyncSelectiveSync: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
70
|
+
spaceId: z.ZodString;
|
|
71
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
72
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
73
|
+
items: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
74
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
75
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
76
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
77
|
+
us: "us";
|
|
78
|
+
eu: "eu";
|
|
79
|
+
}>>;
|
|
80
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
81
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
82
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
83
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
84
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
85
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
86
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
87
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
88
|
+
us: "us";
|
|
89
|
+
eu: "eu";
|
|
90
|
+
}>>;
|
|
91
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
92
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
93
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
94
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
95
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
96
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
97
|
+
declare const updateProfilesSyncSelectiveSync: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
98
|
+
spaceId: z.ZodString;
|
|
99
|
+
items: z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
100
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
101
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
102
|
+
items: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
103
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
104
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
105
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
106
|
+
us: "us";
|
|
107
|
+
eu: "eu";
|
|
108
|
+
}>>;
|
|
109
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
110
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
111
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
112
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
113
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
114
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
115
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
116
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
117
|
+
us: "us";
|
|
118
|
+
eu: "eu";
|
|
119
|
+
}>>;
|
|
120
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
121
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
122
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
123
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
124
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
126
|
+
//#endregion
|
|
127
|
+
export { getProfilesSyncConfig, getProfilesSyncSelectiveSync, updateProfilesSyncConfig, updateProfilesSyncSelectiveSync };
|
|
@@ -0,0 +1,89 @@
|
|
|
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-CvfKfzMq.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/profiles-sync.ts
|
|
7
|
+
/**
|
|
8
|
+
* segment/profiles-sync.ts — Profiles Sync warehouse + selective sync.
|
|
9
|
+
* 4 actions (PLAN § 6.19).
|
|
10
|
+
*/
|
|
11
|
+
const profilesSyncConfigSchema = segmentLooseObjectSchema({
|
|
12
|
+
spaceId: z.string().optional(),
|
|
13
|
+
warehouseId: z.string().optional(),
|
|
14
|
+
enabled: z.boolean().optional(),
|
|
15
|
+
schemaName: z.string().optional()
|
|
16
|
+
});
|
|
17
|
+
const selectiveSyncSchema = segmentLooseObjectSchema({
|
|
18
|
+
spaceId: z.string().optional(),
|
|
19
|
+
items: z.array(z.record(z.string(), z.unknown())).optional()
|
|
20
|
+
});
|
|
21
|
+
const getProfilesSyncConfig = segmentOperation({
|
|
22
|
+
id: "segment.profilesSync.getConfig",
|
|
23
|
+
name: "Get profiles-sync config",
|
|
24
|
+
description: "Read the profiles-sync warehouse config for a space.",
|
|
25
|
+
input: z.object({ spaceId: segmentIdSchema }),
|
|
26
|
+
output: profilesSyncConfigSchema,
|
|
27
|
+
run: async (input, credentials) => {
|
|
28
|
+
const body = await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}/profiles-warehouse`);
|
|
29
|
+
const rec = body;
|
|
30
|
+
return profilesSyncConfigSchema.parse(rec.data ?? body);
|
|
31
|
+
}
|
|
32
|
+
});
|
|
33
|
+
const updateProfilesSyncConfig = segmentOperation({
|
|
34
|
+
id: "segment.profilesSync.updateConfig",
|
|
35
|
+
name: "Update profiles-sync config",
|
|
36
|
+
description: "Patch the profiles-sync warehouse config.",
|
|
37
|
+
input: z.object({
|
|
38
|
+
spaceId: segmentIdSchema,
|
|
39
|
+
warehouseId: z.string().optional(),
|
|
40
|
+
enabled: z.boolean().optional(),
|
|
41
|
+
schemaName: z.string().optional()
|
|
42
|
+
}),
|
|
43
|
+
output: profilesSyncConfigSchema,
|
|
44
|
+
needsApproval: true,
|
|
45
|
+
run: async (input, credentials) => {
|
|
46
|
+
const client = createSegmentClient(credentials);
|
|
47
|
+
const { spaceId, ...body } = input;
|
|
48
|
+
const response = await client.publicApi.request(`/spaces/${encodeURIComponent(spaceId)}/profiles-warehouse`, {
|
|
49
|
+
method: "PATCH",
|
|
50
|
+
body
|
|
51
|
+
});
|
|
52
|
+
const rec = response;
|
|
53
|
+
return profilesSyncConfigSchema.parse(rec.data ?? response);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
const getProfilesSyncSelectiveSync = segmentOperation({
|
|
57
|
+
id: "segment.profilesSync.getSelectiveSync",
|
|
58
|
+
name: "Get profiles-sync selective sync",
|
|
59
|
+
description: "Read the profiles-sync selective sync allowlist.",
|
|
60
|
+
input: z.object({ spaceId: segmentIdSchema }),
|
|
61
|
+
output: selectiveSyncSchema,
|
|
62
|
+
run: async (input, credentials) => {
|
|
63
|
+
const body = await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}/profiles-warehouse/selective-sync`);
|
|
64
|
+
const rec = body;
|
|
65
|
+
return selectiveSyncSchema.parse(rec.data ?? body);
|
|
66
|
+
}
|
|
67
|
+
});
|
|
68
|
+
const updateProfilesSyncSelectiveSync = segmentOperation({
|
|
69
|
+
id: "segment.profilesSync.updateSelectiveSync",
|
|
70
|
+
name: "Update profiles-sync selective sync",
|
|
71
|
+
description: "Patch the profiles-sync selective sync allowlist.",
|
|
72
|
+
input: z.object({
|
|
73
|
+
spaceId: segmentIdSchema,
|
|
74
|
+
items: z.array(z.record(z.string(), z.unknown()))
|
|
75
|
+
}),
|
|
76
|
+
output: selectiveSyncSchema,
|
|
77
|
+
needsApproval: true,
|
|
78
|
+
run: async (input, credentials) => {
|
|
79
|
+
const response = await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}/profiles-warehouse/selective-sync`, {
|
|
80
|
+
method: "PATCH",
|
|
81
|
+
body: { items: input.items }
|
|
82
|
+
});
|
|
83
|
+
const rec = response;
|
|
84
|
+
return selectiveSyncSchema.parse(rec.data ?? response);
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
//#endregion
|
|
89
|
+
export { getProfilesSyncConfig, getProfilesSyncSelectiveSync, updateProfilesSyncConfig, updateProfilesSyncSelectiveSync };
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import * as _keystrokehq_core_credential_set0 from "@keystrokehq/core/credential-set";
|
|
3
|
+
import * as _keystrokehq_core0 from "@keystrokehq/core";
|
|
4
|
+
|
|
5
|
+
//#region src/profiles.d.ts
|
|
6
|
+
declare const getProfileTraits: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
7
|
+
profileId: z.ZodString;
|
|
8
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
9
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
10
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
11
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
12
|
+
traits: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
13
|
+
cursor: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
14
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
15
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
16
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
17
|
+
us: "us";
|
|
18
|
+
eu: "eu";
|
|
19
|
+
}>>;
|
|
20
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
21
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
22
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
23
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
24
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<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>], undefined>;
|
|
37
|
+
declare const getProfileEvents: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
38
|
+
profileId: z.ZodString;
|
|
39
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
40
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
41
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
42
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
43
|
+
data: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
44
|
+
cursor: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
45
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"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>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
57
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
58
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
59
|
+
us: "us";
|
|
60
|
+
eu: "eu";
|
|
61
|
+
}>>;
|
|
62
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
63
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
64
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
65
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
66
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
67
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
68
|
+
declare const getProfileExternalIds: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
69
|
+
profileId: z.ZodString;
|
|
70
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
72
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
73
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
74
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
75
|
+
id: z.ZodOptional<z.ZodString>;
|
|
76
|
+
type: z.ZodOptional<z.ZodString>;
|
|
77
|
+
source_id: z.ZodOptional<z.ZodString>;
|
|
78
|
+
collection: z.ZodOptional<z.ZodString>;
|
|
79
|
+
created_at: z.ZodOptional<z.ZodString>;
|
|
80
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
81
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
82
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
83
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
84
|
+
us: "us";
|
|
85
|
+
eu: "eu";
|
|
86
|
+
}>>;
|
|
87
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
88
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
89
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
90
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
91
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
92
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
93
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
94
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
95
|
+
us: "us";
|
|
96
|
+
eu: "eu";
|
|
97
|
+
}>>;
|
|
98
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
99
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
100
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
101
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
102
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
103
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
104
|
+
declare const getProfileLinks: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
105
|
+
profileId: z.ZodString;
|
|
106
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
107
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
108
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
109
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
110
|
+
data: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
111
|
+
source_id: z.ZodOptional<z.ZodString>;
|
|
112
|
+
source_name: z.ZodOptional<z.ZodString>;
|
|
113
|
+
}, z.core.$catchall<z.ZodUnknown>>>>;
|
|
114
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
115
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
116
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
117
|
+
us: "us";
|
|
118
|
+
eu: "eu";
|
|
119
|
+
}>>;
|
|
120
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
121
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
122
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
123
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
124
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
125
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
126
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
127
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
128
|
+
us: "us";
|
|
129
|
+
eu: "eu";
|
|
130
|
+
}>>;
|
|
131
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
132
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
133
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
134
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
135
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
136
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
137
|
+
declare const getProfileMetadata: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
138
|
+
profileId: z.ZodString;
|
|
139
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
140
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
141
|
+
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
142
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", z.ZodObject<{
|
|
143
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
144
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
145
|
+
us: "us";
|
|
146
|
+
eu: "eu";
|
|
147
|
+
}>>;
|
|
148
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
149
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
150
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
151
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
152
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
153
|
+
}, z.core.$strip>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
154
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
155
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
156
|
+
us: "us";
|
|
157
|
+
eu: "eu";
|
|
158
|
+
}>>;
|
|
159
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
160
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
161
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
162
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
163
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
164
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
165
|
+
declare const listProfilesByAudience: _keystrokehq_core0.Operation<z.ZodObject<{
|
|
166
|
+
audienceKey: z.ZodString;
|
|
167
|
+
spaceId: z.ZodOptional<z.ZodString>;
|
|
168
|
+
cursor: z.ZodOptional<z.ZodString>;
|
|
169
|
+
limit: z.ZodOptional<z.ZodNumber>;
|
|
170
|
+
}, z.core.$strip>, z.ZodObject<{
|
|
171
|
+
data: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
|
|
172
|
+
cursor: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
173
|
+
}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"segment", 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>, readonly _keystrokehq_core_credential_set0.CredentialConnection<z.ZodObject<{
|
|
185
|
+
SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
|
|
186
|
+
SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
|
|
187
|
+
us: "us";
|
|
188
|
+
eu: "eu";
|
|
189
|
+
}>>;
|
|
190
|
+
SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
|
|
191
|
+
SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
|
|
192
|
+
SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
|
|
193
|
+
SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
|
|
194
|
+
SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
|
|
195
|
+
}, z.core.$strip>>[] | undefined>], undefined>;
|
|
196
|
+
//#endregion
|
|
197
|
+
export { getProfileEvents, getProfileExternalIds, getProfileLinks, getProfileMetadata, getProfileTraits, listProfilesByAudience };
|
|
@@ -0,0 +1,137 @@
|
|
|
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-CvfKfzMq.mjs";
|
|
4
|
+
import { z } from "zod";
|
|
5
|
+
|
|
6
|
+
//#region src/profiles.ts
|
|
7
|
+
/**
|
|
8
|
+
* segment/profiles.ts — Profile API reads. 6 actions (PLAN § 6.24). All
|
|
9
|
+
* operations require `SEGMENT_PROFILE_API_TOKEN` + a `spaceId` (per-call or
|
|
10
|
+
* from `SEGMENT_PROFILE_SPACE_ID`). See client.ts for the preflight error.
|
|
11
|
+
*/
|
|
12
|
+
const traitsSchema = segmentLooseObjectSchema({
|
|
13
|
+
traits: z.record(z.string(), z.unknown()).optional(),
|
|
14
|
+
cursor: z.record(z.string(), z.unknown()).optional()
|
|
15
|
+
});
|
|
16
|
+
const eventsSchema = segmentLooseObjectSchema({
|
|
17
|
+
data: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
18
|
+
cursor: z.record(z.string(), z.unknown()).optional()
|
|
19
|
+
});
|
|
20
|
+
const externalIdsSchema = segmentLooseObjectSchema({ data: z.array(segmentLooseObjectSchema({
|
|
21
|
+
id: z.string().optional(),
|
|
22
|
+
type: z.string().optional(),
|
|
23
|
+
source_id: z.string().optional(),
|
|
24
|
+
collection: z.string().optional(),
|
|
25
|
+
created_at: z.string().optional()
|
|
26
|
+
})).optional() });
|
|
27
|
+
const linksSchema = segmentLooseObjectSchema({ data: z.array(segmentLooseObjectSchema({
|
|
28
|
+
source_id: z.string().optional(),
|
|
29
|
+
source_name: z.string().optional()
|
|
30
|
+
})).optional() });
|
|
31
|
+
const metadataSchema = segmentLooseObjectSchema({ metadata: z.record(z.string(), z.unknown()).optional() });
|
|
32
|
+
const profilesListSchema = segmentLooseObjectSchema({
|
|
33
|
+
data: z.array(z.record(z.string(), z.unknown())).optional(),
|
|
34
|
+
cursor: z.record(z.string(), z.unknown()).optional()
|
|
35
|
+
});
|
|
36
|
+
const profileInputBaseSchema = z.object({
|
|
37
|
+
profileId: segmentIdSchema,
|
|
38
|
+
spaceId: segmentIdSchema.optional(),
|
|
39
|
+
cursor: z.string().optional(),
|
|
40
|
+
limit: z.number().int().positive().max(200).optional()
|
|
41
|
+
});
|
|
42
|
+
function profileQuery(input) {
|
|
43
|
+
return {
|
|
44
|
+
...input.cursor !== void 0 ? { "next.cursor": input.cursor } : {},
|
|
45
|
+
...input.limit !== void 0 ? { limit: input.limit } : {}
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
const getProfileTraits = segmentOperation({
|
|
49
|
+
id: "segment.profiles.getTraits",
|
|
50
|
+
name: "Get profile traits",
|
|
51
|
+
description: "Read traits for a profile from the Profile API.",
|
|
52
|
+
input: profileInputBaseSchema,
|
|
53
|
+
output: traitsSchema,
|
|
54
|
+
run: async (input, credentials) => {
|
|
55
|
+
return createSegmentClient(credentials).profiles.request(`/spaces/{spaceId}/collections/users/profiles/${encodeURIComponent(input.profileId)}/traits`, {
|
|
56
|
+
...input.spaceId !== void 0 ? { spaceId: input.spaceId } : {},
|
|
57
|
+
query: profileQuery(input)
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
});
|
|
61
|
+
const getProfileEvents = segmentOperation({
|
|
62
|
+
id: "segment.profiles.getEvents",
|
|
63
|
+
name: "Get profile events",
|
|
64
|
+
description: "Read the event stream for a profile.",
|
|
65
|
+
input: profileInputBaseSchema,
|
|
66
|
+
output: eventsSchema,
|
|
67
|
+
run: async (input, credentials) => {
|
|
68
|
+
return createSegmentClient(credentials).profiles.request(`/spaces/{spaceId}/collections/users/profiles/${encodeURIComponent(input.profileId)}/events`, {
|
|
69
|
+
...input.spaceId !== void 0 ? { spaceId: input.spaceId } : {},
|
|
70
|
+
query: profileQuery(input)
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
});
|
|
74
|
+
const getProfileExternalIds = segmentOperation({
|
|
75
|
+
id: "segment.profiles.getExternalIds",
|
|
76
|
+
name: "Get profile external ids",
|
|
77
|
+
description: "List external ids associated with a profile.",
|
|
78
|
+
input: profileInputBaseSchema,
|
|
79
|
+
output: externalIdsSchema,
|
|
80
|
+
run: async (input, credentials) => {
|
|
81
|
+
return createSegmentClient(credentials).profiles.request(`/spaces/{spaceId}/collections/users/profiles/${encodeURIComponent(input.profileId)}/external_ids`, {
|
|
82
|
+
...input.spaceId !== void 0 ? { spaceId: input.spaceId } : {},
|
|
83
|
+
query: profileQuery(input)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
});
|
|
87
|
+
const getProfileLinks = segmentOperation({
|
|
88
|
+
id: "segment.profiles.getLinks",
|
|
89
|
+
name: "Get profile links",
|
|
90
|
+
description: "List data sources linked into this profile.",
|
|
91
|
+
input: profileInputBaseSchema,
|
|
92
|
+
output: linksSchema,
|
|
93
|
+
run: async (input, credentials) => {
|
|
94
|
+
return createSegmentClient(credentials).profiles.request(`/spaces/{spaceId}/collections/users/profiles/${encodeURIComponent(input.profileId)}/links`, {
|
|
95
|
+
...input.spaceId !== void 0 ? { spaceId: input.spaceId } : {},
|
|
96
|
+
query: profileQuery(input)
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
const getProfileMetadata = segmentOperation({
|
|
101
|
+
id: "segment.profiles.getMetadata",
|
|
102
|
+
name: "Get profile metadata",
|
|
103
|
+
description: "Read profile-level metadata.",
|
|
104
|
+
input: z.object({
|
|
105
|
+
profileId: segmentIdSchema,
|
|
106
|
+
spaceId: segmentIdSchema.optional()
|
|
107
|
+
}),
|
|
108
|
+
output: metadataSchema,
|
|
109
|
+
run: async (input, credentials) => {
|
|
110
|
+
return createSegmentClient(credentials).profiles.request(`/spaces/{spaceId}/collections/users/profiles/${encodeURIComponent(input.profileId)}/metadata`, { ...input.spaceId !== void 0 ? { spaceId: input.spaceId } : {} });
|
|
111
|
+
}
|
|
112
|
+
});
|
|
113
|
+
const listProfilesByAudience = segmentOperation({
|
|
114
|
+
id: "segment.profiles.listProfilesByAudience",
|
|
115
|
+
name: "List profiles by audience",
|
|
116
|
+
description: "List the profiles in an audience (via Profile API).",
|
|
117
|
+
input: z.object({
|
|
118
|
+
audienceKey: segmentIdSchema,
|
|
119
|
+
spaceId: segmentIdSchema.optional(),
|
|
120
|
+
cursor: z.string().optional(),
|
|
121
|
+
limit: z.number().int().positive().max(200).optional()
|
|
122
|
+
}),
|
|
123
|
+
output: profilesListSchema,
|
|
124
|
+
run: async (input, credentials) => {
|
|
125
|
+
return createSegmentClient(credentials).profiles.request("/spaces/{spaceId}/collections/users/profiles", {
|
|
126
|
+
...input.spaceId !== void 0 ? { spaceId: input.spaceId } : {},
|
|
127
|
+
query: {
|
|
128
|
+
audience: input.audienceKey,
|
|
129
|
+
...input.cursor !== void 0 ? { "next.cursor": input.cursor } : {},
|
|
130
|
+
...input.limit !== void 0 ? { limit: input.limit } : {}
|
|
131
|
+
}
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
//#endregion
|
|
137
|
+
export { getProfileEvents, getProfileExternalIds, getProfileLinks, getProfileMetadata, getProfileTraits, listProfilesByAudience };
|