@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.
Files changed (79) hide show
  1. package/README.md +52 -173
  2. package/dist/{client.mjs → client-DQfeZzLR.mjs} +28 -3
  3. package/dist/credential-sets/index.d.mts +2 -0
  4. package/dist/credential-sets/index.mjs +3 -0
  5. package/dist/index.d.mts +4 -1
  6. package/dist/index.mjs +5 -1
  7. package/dist/operations/index.d.mts +2 -0
  8. package/dist/operations/index.mjs +3 -0
  9. package/dist/schemas/index.mjs +1 -1
  10. package/dist/{integration-CliT2xe3.mjs → segment.credential-set-BTTrkHO7.mjs} +16 -9
  11. package/dist/{integration-DWeMeBqQ.d.mts → segment.credential-set-BgROtI_9.d.mts} +28 -27
  12. package/dist/{triggers.d.mts → triggers/index.d.mts} +72 -6
  13. package/dist/{triggers.mjs → triggers/index.mjs} +186 -7
  14. package/dist/workspace-list-spaces.operation-DKWX3vl5.mjs +5200 -0
  15. package/dist/workspace-list-spaces.operation-QbDIgfRG.d.mts +6548 -0
  16. package/package.json +14 -126
  17. package/dist/_official/index.d.mts +0 -2
  18. package/dist/_official/index.mjs +0 -3
  19. package/dist/_runtime/index.d.mts +0 -1
  20. package/dist/_runtime/index.mjs +0 -1
  21. package/dist/audiences.d.mts +0 -193
  22. package/dist/audiences.mjs +0 -205
  23. package/dist/client.d.mts +0 -90
  24. package/dist/computed-traits.d.mts +0 -148
  25. package/dist/computed-traits.mjs +0 -149
  26. package/dist/connection.d.mts +0 -2
  27. package/dist/connection.mjs +0 -3
  28. package/dist/crud-DGM2Ekdr.mjs +0 -140
  29. package/dist/deletion-suppression.d.mts +0 -135
  30. package/dist/deletion-suppression.mjs +0 -103
  31. package/dist/delivery-overview.d.mts +0 -56
  32. package/dist/delivery-overview.mjs +0 -54
  33. package/dist/destination-filters.d.mts +0 -134
  34. package/dist/destination-filters.mjs +0 -115
  35. package/dist/destinations.d.mts +0 -318
  36. package/dist/destinations.mjs +0 -257
  37. package/dist/edge-functions.d.mts +0 -112
  38. package/dist/edge-functions.mjs +0 -72
  39. package/dist/errors-4FGnrowW.mjs +0 -27
  40. package/dist/events-catalog.d.mts +0 -77
  41. package/dist/events-catalog.mjs +0 -65
  42. package/dist/events.d.mts +0 -167
  43. package/dist/events.mjs +0 -134
  44. package/dist/factory-Dqb49Dfj.mjs +0 -8
  45. package/dist/functions.d.mts +0 -236
  46. package/dist/functions.mjs +0 -180
  47. package/dist/iam-groups.d.mts +0 -184
  48. package/dist/iam-groups.mjs +0 -144
  49. package/dist/iam-users.d.mts +0 -138
  50. package/dist/iam-users.mjs +0 -91
  51. package/dist/labels.d.mts +0 -66
  52. package/dist/labels.mjs +0 -58
  53. package/dist/monitoring.d.mts +0 -126
  54. package/dist/monitoring.mjs +0 -88
  55. package/dist/profiles-sync.d.mts +0 -82
  56. package/dist/profiles-sync.mjs +0 -89
  57. package/dist/profiles.d.mts +0 -130
  58. package/dist/profiles.mjs +0 -137
  59. package/dist/reverse-etl.d.mts +0 -315
  60. package/dist/reverse-etl.mjs +0 -228
  61. package/dist/roles.d.mts +0 -36
  62. package/dist/roles.mjs +0 -25
  63. package/dist/sources.d.mts +0 -383
  64. package/dist/sources.mjs +0 -259
  65. package/dist/tracking-plans.d.mts +0 -229
  66. package/dist/tracking-plans.mjs +0 -160
  67. package/dist/tracking.d.mts +0 -410
  68. package/dist/tracking.mjs +0 -255
  69. package/dist/transformations.d.mts +0 -132
  70. package/dist/transformations.mjs +0 -83
  71. package/dist/usage.d.mts +0 -47
  72. package/dist/usage.mjs +0 -55
  73. package/dist/verification.d.mts +0 -17
  74. package/dist/verification.mjs +0 -51
  75. package/dist/warehouses.d.mts +0 -219
  76. package/dist/warehouses.mjs +0 -176
  77. package/dist/workspaces.d.mts +0 -61
  78. package/dist/workspaces.mjs +0 -67
  79. /package/dist/{common-CdGiJbjq.mjs → common-DUU0airJ.mjs} +0 -0
@@ -1,176 +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/warehouses.ts
8
- /**
9
- * segment/warehouses.ts — Warehouses + selective sync + connection tests.
10
- * 11 actions total (PLAN.md § 6.6).
11
- */
12
- const warehouseSchema = segmentLooseObjectSchema({
13
- id: segmentIdSchema,
14
- name: z.string().optional(),
15
- enabled: z.boolean().optional(),
16
- metadata: z.record(z.string(), z.unknown()).optional(),
17
- settings: z.record(z.string(), z.unknown()).optional()
18
- });
19
- const connectedSourceSchema = segmentLooseObjectSchema({
20
- id: segmentIdSchema,
21
- name: z.string().optional(),
22
- enabled: z.boolean().optional()
23
- });
24
- const selectiveSyncSchema = segmentLooseObjectSchema({
25
- warehouseId: z.string().optional(),
26
- items: z.array(z.record(z.string(), z.unknown())).optional()
27
- });
28
- const connectionTestResultSchema = segmentLooseObjectSchema({
29
- success: z.boolean().optional(),
30
- message: z.string().optional(),
31
- details: z.record(z.string(), z.unknown()).optional()
32
- });
33
- const listWarehouses = crudList({
34
- id: "segment.warehouses.list",
35
- name: "List warehouses",
36
- description: "List warehouses in the workspace.",
37
- path: "/warehouses",
38
- itemsKey: "warehouses",
39
- item: warehouseSchema
40
- });
41
- const getWarehouse = crudGet({
42
- id: "segment.warehouses.get",
43
- name: "Get warehouse",
44
- description: "Fetch a warehouse by id.",
45
- path: "/warehouses/{id}",
46
- output: warehouseSchema,
47
- unwrapKey: "warehouse"
48
- });
49
- const createWarehouse = crudMutate({
50
- id: "segment.warehouses.create",
51
- name: "Create warehouse",
52
- description: "Provision a new warehouse destination.",
53
- method: "POST",
54
- path: "/warehouses",
55
- bodyShape: {
56
- name: z.string().min(1),
57
- metadataId: z.string().min(1),
58
- settings: z.record(z.string(), z.unknown()),
59
- enabled: z.boolean().optional()
60
- },
61
- output: warehouseSchema,
62
- unwrapKey: "warehouse"
63
- });
64
- const updateWarehouse = crudMutate({
65
- id: "segment.warehouses.update",
66
- name: "Update warehouse",
67
- description: "Patch a warehouse.",
68
- method: "PATCH",
69
- path: "/warehouses/{id}",
70
- bodyShape: {
71
- name: z.string().optional(),
72
- enabled: z.boolean().optional(),
73
- settings: z.record(z.string(), z.unknown()).optional()
74
- },
75
- output: warehouseSchema,
76
- unwrapKey: "warehouse"
77
- });
78
- const deleteWarehouse = crudMutate({
79
- id: "segment.warehouses.delete",
80
- name: "Delete warehouse",
81
- description: "Delete a warehouse.",
82
- method: "DELETE",
83
- path: "/warehouses/{id}",
84
- output: z.object({}).catchall(z.unknown())
85
- });
86
- const listConnectedSources = segmentOperation({
87
- id: "segment.warehouses.listConnectedSources",
88
- name: "List connected sources",
89
- description: "Sources currently syncing data into this warehouse.",
90
- input: z.object({ id: segmentIdSchema }),
91
- output: z.object({ items: z.array(connectedSourceSchema) }),
92
- run: async (input, credentials) => {
93
- const rec = await createSegmentClient(credentials).publicApi.request(`/warehouses/${encodeURIComponent(input.id)}/connected-sources`);
94
- return { items: (rec.data?.sources ?? rec.sources ?? []).map((entry) => connectedSourceSchema.parse(entry)) };
95
- }
96
- });
97
- const connectSourceToWarehouse = segmentOperation({
98
- id: "segment.warehouses.connectSource",
99
- name: "Connect source",
100
- description: "Attach a source to this warehouse.",
101
- input: z.object({
102
- id: segmentIdSchema,
103
- sourceId: segmentIdSchema
104
- }),
105
- output: z.object({ connected: z.literal(true) }),
106
- needsApproval: true,
107
- run: async (input, credentials) => {
108
- await createSegmentClient(credentials).publicApi.request(`/warehouses/${encodeURIComponent(input.id)}/connected-sources`, {
109
- method: "POST",
110
- body: { sourceId: input.sourceId }
111
- });
112
- return { connected: true };
113
- }
114
- });
115
- const disconnectSourceFromWarehouse = segmentOperation({
116
- id: "segment.warehouses.disconnectSource",
117
- name: "Disconnect source",
118
- description: "Remove a source from this warehouse.",
119
- input: z.object({
120
- id: segmentIdSchema,
121
- sourceId: segmentIdSchema
122
- }),
123
- output: z.object({ disconnected: z.literal(true) }),
124
- needsApproval: true,
125
- run: async (input, credentials) => {
126
- await createSegmentClient(credentials).publicApi.request(`/warehouses/${encodeURIComponent(input.id)}/connected-sources/${encodeURIComponent(input.sourceId)}`, { method: "DELETE" });
127
- return { disconnected: true };
128
- }
129
- });
130
- const getSelectiveSync = segmentOperation({
131
- id: "segment.warehouses.getSelectiveSync",
132
- name: "Get selective sync config",
133
- description: "Read the selective-sync allowlist for a warehouse.",
134
- input: z.object({ id: segmentIdSchema }),
135
- output: selectiveSyncSchema,
136
- run: async (input, credentials) => {
137
- const body = await createSegmentClient(credentials).publicApi.request(`/warehouses/${encodeURIComponent(input.id)}/selective-sync`);
138
- const rec = body;
139
- return selectiveSyncSchema.parse(rec.data ?? body);
140
- }
141
- });
142
- const updateSelectiveSync = segmentOperation({
143
- id: "segment.warehouses.updateSelectiveSync",
144
- name: "Update selective sync config",
145
- description: "Patch the selective-sync allowlist for a warehouse.",
146
- input: z.object({
147
- id: segmentIdSchema,
148
- items: z.array(z.record(z.string(), z.unknown()))
149
- }),
150
- output: selectiveSyncSchema,
151
- needsApproval: true,
152
- run: async (input, credentials) => {
153
- const body = await createSegmentClient(credentials).publicApi.request(`/warehouses/${encodeURIComponent(input.id)}/selective-sync`, {
154
- method: "PATCH",
155
- body: { items: input.items }
156
- });
157
- const rec = body;
158
- return selectiveSyncSchema.parse(rec.data ?? body);
159
- }
160
- });
161
- const testWarehouseConnection = segmentOperation({
162
- id: "segment.warehouses.testConnection",
163
- name: "Test warehouse connection",
164
- description: "Run a synchronous connection test against a warehouse. Can take 30+ seconds.",
165
- input: z.object({ id: segmentIdSchema }),
166
- output: connectionTestResultSchema,
167
- needsApproval: true,
168
- run: async (input, credentials) => {
169
- const body = await createSegmentClient(credentials).publicApi.request(`/warehouses/${encodeURIComponent(input.id)}/connect`, { method: "POST" });
170
- const rec = body;
171
- return connectionTestResultSchema.parse(rec.data ?? body);
172
- }
173
- });
174
-
175
- //#endregion
176
- export { connectSourceToWarehouse, createWarehouse, deleteWarehouse, disconnectSourceFromWarehouse, getSelectiveSync, getWarehouse, listConnectedSources, listWarehouses, testWarehouseConnection, updateSelectiveSync, updateWarehouse, warehouseSchema };
@@ -1,61 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/workspaces.d.ts
5
- declare const getWorkspace: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
6
- id: z.ZodString;
7
- name: z.ZodOptional<z.ZodString>;
8
- slug: z.ZodOptional<z.ZodString>;
9
- region: z.ZodOptional<z.ZodString>;
10
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
11
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
12
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
13
- us: "us";
14
- eu: "eu";
15
- }>>;
16
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
17
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
18
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
19
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
20
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
21
- }, z.core.$strip>>], undefined>;
22
- declare const listSpaces: _keystrokehq_core0.Operation<z.ZodObject<{}, z.core.$strip>, z.ZodObject<{
23
- items: z.ZodArray<z.ZodObject<{
24
- id: z.ZodString;
25
- name: z.ZodOptional<z.ZodString>;
26
- slug: z.ZodOptional<z.ZodString>;
27
- description: z.ZodOptional<z.ZodString>;
28
- }, z.core.$catchall<z.ZodUnknown>>>;
29
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
30
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
31
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
32
- us: "us";
33
- eu: "eu";
34
- }>>;
35
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
36
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
37
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
38
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
39
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
40
- }, z.core.$strip>>], undefined>;
41
- declare const getSpace: _keystrokehq_core0.Operation<z.ZodObject<{
42
- spaceId: z.ZodString;
43
- }, z.core.$strip>, z.ZodObject<{
44
- id: z.ZodString;
45
- name: z.ZodOptional<z.ZodString>;
46
- slug: z.ZodOptional<z.ZodString>;
47
- description: z.ZodOptional<z.ZodString>;
48
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
49
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
50
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
51
- us: "us";
52
- eu: "eu";
53
- }>>;
54
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
55
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
56
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
57
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
58
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
59
- }, z.core.$strip>>], undefined>;
60
- //#endregion
61
- export { getSpace, getWorkspace, listSpaces };
@@ -1,67 +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 { z } from "zod";
5
-
6
- //#region src/workspaces.ts
7
- /**
8
- * segment/workspaces.ts
9
- *
10
- * Public API workspace + Engage space metadata. Spaces are Segment's Engage
11
- * tenants — `spaceId` is required on every audience/computed-trait/profile
12
- * action.
13
- */
14
- const workspaceSchema = segmentLooseObjectSchema({
15
- id: segmentIdSchema,
16
- name: z.string().optional(),
17
- slug: z.string().optional(),
18
- region: z.string().optional()
19
- });
20
- const spaceSchema = segmentLooseObjectSchema({
21
- id: segmentIdSchema,
22
- name: z.string().optional(),
23
- slug: z.string().optional(),
24
- description: z.string().optional()
25
- });
26
- const spacesEnvelopeSchema = z.object({ data: z.object({ spaces: z.array(spaceSchema) }) });
27
- const getWorkspace = segmentOperation({
28
- id: "segment.workspace.get",
29
- name: "Get workspace",
30
- description: "Fetch metadata about the authenticated Segment workspace.",
31
- input: z.object({}),
32
- output: workspaceSchema,
33
- run: async (_input, credentials) => {
34
- const body = await createSegmentClient(credentials).publicApi.request("/");
35
- const record = body.data?.workspace ?? body;
36
- return workspaceSchema.parse(record);
37
- }
38
- });
39
- const listSpaces = segmentOperation({
40
- id: "segment.workspace.listSpaces",
41
- name: "List spaces",
42
- description: "List Engage / Unify spaces in the workspace.",
43
- input: z.object({}),
44
- output: z.object({ items: z.array(spaceSchema) }),
45
- run: async (_input, credentials) => {
46
- const body = await createSegmentClient(credentials).publicApi.request("/spaces");
47
- const parsed = spacesEnvelopeSchema.safeParse(body);
48
- if (parsed.success) return { items: parsed.data.data.spaces };
49
- const flat = z.object({ spaces: z.array(spaceSchema) }).safeParse(body);
50
- return { items: flat.success ? flat.data.spaces : [] };
51
- }
52
- });
53
- const getSpace = segmentOperation({
54
- id: "segment.workspace.getSpace",
55
- name: "Get space",
56
- description: "Fetch metadata about a single Engage / Unify space.",
57
- input: z.object({ spaceId: segmentIdSchema }),
58
- output: spaceSchema,
59
- run: async (input, credentials) => {
60
- const body = await createSegmentClient(credentials).publicApi.request(`/spaces/${encodeURIComponent(input.spaceId)}`);
61
- const record = body.data?.space ?? body;
62
- return spaceSchema.parse(record);
63
- }
64
- });
65
-
66
- //#endregion
67
- export { getSpace, getWorkspace, listSpaces };