@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,180 +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/functions.ts
8
- /**
9
- * segment/functions.ts — Custom Functions (source/destination/insert) +
10
- * deployments. 10 actions total (PLAN.md § 6.5).
11
- */
12
- const functionSchema = segmentLooseObjectSchema({
13
- id: segmentIdSchema,
14
- displayName: z.string().optional(),
15
- resourceType: z.enum([
16
- "source",
17
- "destination",
18
- "insert"
19
- ]).optional(),
20
- description: z.string().optional(),
21
- code: z.string().optional(),
22
- settings: z.array(z.record(z.string(), z.unknown())).optional()
23
- });
24
- const versionSchema = segmentLooseObjectSchema({
25
- id: segmentIdSchema,
26
- version: z.union([z.number(), z.string()]).optional(),
27
- createdAt: z.string().optional()
28
- });
29
- const deployedInstanceSchema = segmentLooseObjectSchema({
30
- id: segmentIdSchema,
31
- sourceId: z.string().optional(),
32
- destinationId: z.string().optional(),
33
- settings: z.record(z.string(), z.unknown()).optional()
34
- });
35
- const testResultSchema = segmentLooseObjectSchema({
36
- success: z.boolean().optional(),
37
- logs: z.array(z.string()).optional(),
38
- output: z.record(z.string(), z.unknown()).optional(),
39
- error: z.string().optional()
40
- });
41
- const listFunctions = crudList({
42
- id: "segment.functions.list",
43
- name: "List functions",
44
- description: "List custom functions in the workspace.",
45
- path: "/functions",
46
- itemsKey: "functions",
47
- item: functionSchema,
48
- extraInput: { resourceType: z.enum([
49
- "source",
50
- "destination",
51
- "insert"
52
- ]).optional() }
53
- });
54
- const getFunction = crudGet({
55
- id: "segment.functions.get",
56
- name: "Get function",
57
- description: "Fetch a custom function by id.",
58
- path: "/functions/{id}",
59
- output: functionSchema,
60
- unwrapKey: "function"
61
- });
62
- const createFunction = crudMutate({
63
- id: "segment.functions.create",
64
- name: "Create function",
65
- description: "Create a new custom function (source/destination/insert).",
66
- method: "POST",
67
- path: "/functions",
68
- bodyShape: {
69
- displayName: z.string().min(1),
70
- resourceType: z.enum([
71
- "source",
72
- "destination",
73
- "insert"
74
- ]),
75
- description: z.string().optional(),
76
- code: z.string().min(1),
77
- settings: z.array(z.record(z.string(), z.unknown())).optional()
78
- },
79
- output: functionSchema,
80
- unwrapKey: "function"
81
- });
82
- const updateFunction = crudMutate({
83
- id: "segment.functions.update",
84
- name: "Update function",
85
- description: "Patch a custom function — update code, metadata, or settings.",
86
- method: "PATCH",
87
- path: "/functions/{id}",
88
- bodyShape: {
89
- displayName: z.string().optional(),
90
- description: z.string().optional(),
91
- code: z.string().optional(),
92
- settings: z.array(z.record(z.string(), z.unknown())).optional()
93
- },
94
- output: functionSchema,
95
- unwrapKey: "function"
96
- });
97
- const deleteFunction = crudMutate({
98
- id: "segment.functions.delete",
99
- name: "Delete function",
100
- description: "Delete a custom function.",
101
- method: "DELETE",
102
- path: "/functions/{id}",
103
- output: z.object({}).catchall(z.unknown())
104
- });
105
- const deployFunction = segmentOperation({
106
- id: "segment.functions.deploy",
107
- name: "Deploy function",
108
- description: "Deploy the current code version of a function.",
109
- input: z.object({ id: segmentIdSchema }),
110
- output: versionSchema,
111
- needsApproval: true,
112
- run: async (input, credentials) => {
113
- const body = await createSegmentClient(credentials).publicApi.request(`/functions/${encodeURIComponent(input.id)}/deploy`, { method: "POST" });
114
- const rec = body;
115
- return versionSchema.parse(rec.data?.version ?? body);
116
- }
117
- });
118
- const listFunctionVersions = segmentOperation({
119
- id: "segment.functions.listVersions",
120
- name: "List function versions",
121
- description: "List every version of a function.",
122
- input: z.object({ id: segmentIdSchema }),
123
- output: z.object({ items: z.array(versionSchema) }),
124
- run: async (input, credentials) => {
125
- const rec = await createSegmentClient(credentials).publicApi.request(`/functions/${encodeURIComponent(input.id)}/versions`);
126
- return { items: (rec.data?.versions ?? rec.versions ?? []).map((entry) => versionSchema.parse(entry)) };
127
- }
128
- });
129
- const getFunctionVersion = segmentOperation({
130
- id: "segment.functions.getVersion",
131
- name: "Get function version",
132
- description: "Fetch a specific version of a function.",
133
- input: z.object({
134
- id: segmentIdSchema,
135
- versionId: segmentIdSchema
136
- }),
137
- output: versionSchema,
138
- run: async (input, credentials) => {
139
- const body = await createSegmentClient(credentials).publicApi.request(`/functions/${encodeURIComponent(input.id)}/versions/${encodeURIComponent(input.versionId)}`);
140
- const rec = body;
141
- return versionSchema.parse(rec.data?.version ?? body);
142
- }
143
- });
144
- const invokeFunctionTest = segmentOperation({
145
- id: "segment.functions.invokeTest",
146
- name: "Test function",
147
- description: "Synchronously invoke a function against a test payload.",
148
- input: z.object({
149
- id: segmentIdSchema,
150
- payload: z.record(z.string(), z.unknown()),
151
- settings: z.record(z.string(), z.unknown()).optional()
152
- }),
153
- output: testResultSchema,
154
- needsApproval: true,
155
- run: async (input, credentials) => {
156
- const body = await createSegmentClient(credentials).publicApi.request(`/functions/${encodeURIComponent(input.id)}/test`, {
157
- method: "POST",
158
- body: {
159
- payload: input.payload,
160
- settings: input.settings
161
- }
162
- });
163
- const rec = body;
164
- return testResultSchema.parse(rec.data?.result ?? body);
165
- }
166
- });
167
- const listDeployedFunctionInstances = segmentOperation({
168
- id: "segment.functions.listDeployedInstances",
169
- name: "List deployed function instances",
170
- description: "Instances of a function deployed to sources / destinations.",
171
- input: z.object({ id: segmentIdSchema }),
172
- output: z.object({ items: z.array(deployedInstanceSchema) }),
173
- run: async (input, credentials) => {
174
- const rec = await createSegmentClient(credentials).publicApi.request(`/functions/${encodeURIComponent(input.id)}/deployed`);
175
- return { items: (rec.data?.instances ?? rec.instances ?? []).map((entry) => deployedInstanceSchema.parse(entry)) };
176
- }
177
- });
178
-
179
- //#endregion
180
- export { createFunction, deleteFunction, deployFunction, functionSchema, getFunction, getFunctionVersion, invokeFunctionTest, listDeployedFunctionInstances, listFunctionVersions, listFunctions, updateFunction };
@@ -1,184 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/iam-groups.d.ts
5
- declare const iamGroupSchema: z.ZodObject<{
6
- id: z.ZodString;
7
- name: z.ZodOptional<z.ZodString>;
8
- description: z.ZodOptional<z.ZodString>;
9
- memberCount: z.ZodOptional<z.ZodNumber>;
10
- }, z.core.$catchall<z.ZodUnknown>>;
11
- declare const listGroups: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
12
- pageSize: z.ZodOptional<z.ZodNumber>;
13
- pageToken: z.ZodOptional<z.ZodString>;
14
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
15
- items: z.ZodArray<z.ZodObject<{
16
- id: z.ZodString;
17
- name: z.ZodOptional<z.ZodString>;
18
- description: z.ZodOptional<z.ZodString>;
19
- memberCount: z.ZodOptional<z.ZodNumber>;
20
- }, z.core.$catchall<z.ZodUnknown>>>;
21
- nextPageToken: z.ZodOptional<z.ZodString>;
22
- totalEntries: z.ZodOptional<z.ZodNumber>;
23
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
24
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
25
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
26
- us: "us";
27
- eu: "eu";
28
- }>>;
29
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
30
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
31
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
32
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
33
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
34
- }, z.core.$strip>>], undefined>;
35
- declare const getGroup: _keystrokehq_core0.Operation<z.ZodObject<{
36
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
37
- }, z.core.$strip>, z.ZodObject<{
38
- id: z.ZodString;
39
- name: z.ZodOptional<z.ZodString>;
40
- description: z.ZodOptional<z.ZodString>;
41
- memberCount: z.ZodOptional<z.ZodNumber>;
42
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
43
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
44
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
45
- us: "us";
46
- eu: "eu";
47
- }>>;
48
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
49
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
50
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
51
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
52
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
53
- }, z.core.$strip>>], undefined>;
54
- declare const createGroup: _keystrokehq_core0.Operation<z.ZodObject<{
55
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
56
- }, z.core.$strip>, z.ZodObject<{
57
- id: z.ZodString;
58
- name: z.ZodOptional<z.ZodString>;
59
- description: z.ZodOptional<z.ZodString>;
60
- memberCount: z.ZodOptional<z.ZodNumber>;
61
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke: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>>], undefined>;
73
- declare const updateGroup: _keystrokehq_core0.Operation<z.ZodObject<{
74
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
75
- }, z.core.$strip>, z.ZodObject<{
76
- id: z.ZodString;
77
- name: z.ZodOptional<z.ZodString>;
78
- description: z.ZodOptional<z.ZodString>;
79
- memberCount: z.ZodOptional<z.ZodNumber>;
80
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
81
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
82
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
83
- us: "us";
84
- eu: "eu";
85
- }>>;
86
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
87
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
88
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
89
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
90
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
91
- }, z.core.$strip>>], undefined>;
92
- declare const deleteGroup: _keystrokehq_core0.Operation<z.ZodObject<{
93
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
94
- }, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
95
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
96
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
97
- us: "us";
98
- eu: "eu";
99
- }>>;
100
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
101
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
102
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
103
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
104
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
105
- }, z.core.$strip>>], undefined>;
106
- declare const listGroupMembers: _keystrokehq_core0.Operation<z.ZodObject<{
107
- id: z.ZodString;
108
- }, z.core.$strip>, z.ZodObject<{
109
- items: z.ZodArray<z.ZodObject<{
110
- id: z.ZodString;
111
- email: z.ZodOptional<z.ZodString>;
112
- name: z.ZodOptional<z.ZodString>;
113
- }, z.core.$catchall<z.ZodUnknown>>>;
114
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke: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>>], undefined>;
126
- declare const addGroupMembers: _keystrokehq_core0.Operation<z.ZodObject<{
127
- id: z.ZodString;
128
- emails: z.ZodArray<z.ZodString>;
129
- }, z.core.$strip>, z.ZodObject<{
130
- added: z.ZodNumber;
131
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
132
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
133
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
134
- us: "us";
135
- eu: "eu";
136
- }>>;
137
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
138
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
139
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
140
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
141
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
142
- }, z.core.$strip>>], undefined>;
143
- declare const removeGroupMembers: _keystrokehq_core0.Operation<z.ZodObject<{
144
- id: z.ZodString;
145
- emails: z.ZodArray<z.ZodString>;
146
- }, z.core.$strip>, z.ZodObject<{
147
- removed: z.ZodNumber;
148
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
149
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
150
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
151
- us: "us";
152
- eu: "eu";
153
- }>>;
154
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
155
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
156
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
157
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
158
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
159
- }, z.core.$strip>>], undefined>;
160
- declare const replaceGroupPermissions: _keystrokehq_core0.Operation<z.ZodObject<{
161
- id: z.ZodString;
162
- permissions: z.ZodArray<z.ZodObject<{
163
- roleId: z.ZodString;
164
- resources: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
165
- }, z.core.$catchall<z.ZodUnknown>>>;
166
- }, z.core.$strip>, z.ZodObject<{
167
- items: z.ZodArray<z.ZodObject<{
168
- roleId: z.ZodString;
169
- resources: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
170
- }, z.core.$catchall<z.ZodUnknown>>>;
171
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
172
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
173
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
174
- us: "us";
175
- eu: "eu";
176
- }>>;
177
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
178
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
179
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
180
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
181
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
182
- }, z.core.$strip>>], undefined>;
183
- //#endregion
184
- export { addGroupMembers, createGroup, deleteGroup, getGroup, iamGroupSchema, listGroupMembers, listGroups, removeGroupMembers, replaceGroupPermissions, updateGroup };
@@ -1,144 +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/iam-groups.ts
8
- /**
9
- * segment/iam-groups.ts — IAM groups + members + permissions. 9 actions
10
- * (PLAN § 6.13).
11
- */
12
- const iamGroupSchema = segmentLooseObjectSchema({
13
- id: segmentIdSchema,
14
- name: z.string().optional(),
15
- description: z.string().optional(),
16
- memberCount: z.number().optional()
17
- });
18
- const memberSchema = segmentLooseObjectSchema({
19
- id: segmentIdSchema,
20
- email: z.string().optional(),
21
- name: z.string().optional()
22
- });
23
- const permissionSchema = segmentLooseObjectSchema({
24
- roleId: segmentIdSchema,
25
- resources: z.array(z.record(z.string(), z.unknown())).optional()
26
- });
27
- const listGroups = crudList({
28
- id: "segment.iam.groups.list",
29
- name: "List IAM groups",
30
- description: "List IAM groups in the workspace.",
31
- path: "/groups",
32
- itemsKey: "groups",
33
- item: iamGroupSchema
34
- });
35
- const getGroup = crudGet({
36
- id: "segment.iam.groups.get",
37
- name: "Get IAM group",
38
- description: "Fetch an IAM group.",
39
- path: "/groups/{id}",
40
- output: iamGroupSchema,
41
- unwrapKey: "group"
42
- });
43
- const createGroup = crudMutate({
44
- id: "segment.iam.groups.create",
45
- name: "Create IAM group",
46
- description: "Create a new IAM group.",
47
- method: "POST",
48
- path: "/groups",
49
- bodyShape: {
50
- name: z.string().min(1),
51
- description: z.string().optional(),
52
- memberEmails: z.array(z.string()).optional()
53
- },
54
- output: iamGroupSchema,
55
- unwrapKey: "group"
56
- });
57
- const updateGroup = crudMutate({
58
- id: "segment.iam.groups.update",
59
- name: "Update IAM group",
60
- description: "Patch an IAM group.",
61
- method: "PATCH",
62
- path: "/groups/{id}",
63
- bodyShape: {
64
- name: z.string().optional(),
65
- description: z.string().optional()
66
- },
67
- output: iamGroupSchema,
68
- unwrapKey: "group"
69
- });
70
- const deleteGroup = crudMutate({
71
- id: "segment.iam.groups.delete",
72
- name: "Delete IAM group",
73
- description: "Delete an IAM group.",
74
- method: "DELETE",
75
- path: "/groups/{id}",
76
- output: z.object({}).catchall(z.unknown())
77
- });
78
- const listGroupMembers = segmentOperation({
79
- id: "segment.iam.groups.listMembers",
80
- name: "List IAM group members",
81
- description: "List the members of an IAM group.",
82
- input: z.object({ id: segmentIdSchema }),
83
- output: z.object({ items: z.array(memberSchema) }),
84
- run: async (input, credentials) => {
85
- const rec = await createSegmentClient(credentials).publicApi.request(`/groups/${encodeURIComponent(input.id)}/members`);
86
- return { items: (rec.data?.members ?? rec.members ?? []).map((entry) => memberSchema.parse(entry)) };
87
- }
88
- });
89
- const addGroupMembers = segmentOperation({
90
- id: "segment.iam.groups.addMembers",
91
- name: "Add IAM group members",
92
- description: "Add members to an IAM group by email.",
93
- input: z.object({
94
- id: segmentIdSchema,
95
- emails: z.array(z.string().min(1)).min(1)
96
- }),
97
- output: z.object({ added: z.number() }),
98
- needsApproval: true,
99
- run: async (input, credentials) => {
100
- await createSegmentClient(credentials).publicApi.request(`/groups/${encodeURIComponent(input.id)}/members`, {
101
- method: "POST",
102
- body: { emails: input.emails }
103
- });
104
- return { added: input.emails.length };
105
- }
106
- });
107
- const removeGroupMembers = segmentOperation({
108
- id: "segment.iam.groups.removeMembers",
109
- name: "Remove IAM group members",
110
- description: "Remove members from an IAM group.",
111
- input: z.object({
112
- id: segmentIdSchema,
113
- emails: z.array(z.string().min(1)).min(1)
114
- }),
115
- output: z.object({ removed: z.number() }),
116
- needsApproval: true,
117
- run: async (input, credentials) => {
118
- await createSegmentClient(credentials).publicApi.request(`/groups/${encodeURIComponent(input.id)}/members`, {
119
- method: "DELETE",
120
- body: { emails: input.emails }
121
- });
122
- return { removed: input.emails.length };
123
- }
124
- });
125
- const replaceGroupPermissions = segmentOperation({
126
- id: "segment.iam.groups.replacePermissions",
127
- name: "Replace IAM group permissions",
128
- description: "Replace the permission set on an IAM group.",
129
- input: z.object({
130
- id: segmentIdSchema,
131
- permissions: z.array(permissionSchema).min(1)
132
- }),
133
- output: z.object({ items: z.array(permissionSchema) }),
134
- needsApproval: true,
135
- run: async (input, credentials) => {
136
- return { items: ((await createSegmentClient(credentials).publicApi.request(`/groups/${encodeURIComponent(input.id)}/permissions`, {
137
- method: "PUT",
138
- body: { permissions: input.permissions }
139
- })).data?.permissions ?? input.permissions).map((entry) => permissionSchema.parse(entry)) };
140
- }
141
- });
142
-
143
- //#endregion
144
- export { addGroupMembers, createGroup, deleteGroup, getGroup, iamGroupSchema, listGroupMembers, listGroups, removeGroupMembers, replaceGroupPermissions, updateGroup };
@@ -1,138 +0,0 @@
1
- import { z } from "zod";
2
- import * as _keystrokehq_core0 from "@keystrokehq/core";
3
-
4
- //#region src/iam-users.d.ts
5
- declare const iamUserSchema: z.ZodObject<{
6
- id: z.ZodString;
7
- email: z.ZodOptional<z.ZodString>;
8
- name: z.ZodOptional<z.ZodString>;
9
- }, z.core.$catchall<z.ZodUnknown>>;
10
- declare const iamInviteSchema: z.ZodObject<{
11
- id: z.ZodString;
12
- email: z.ZodOptional<z.ZodString>;
13
- status: z.ZodOptional<z.ZodString>;
14
- createdAt: z.ZodOptional<z.ZodString>;
15
- }, z.core.$catchall<z.ZodUnknown>>;
16
- declare const listUsers: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
17
- pageSize: z.ZodOptional<z.ZodNumber>;
18
- pageToken: z.ZodOptional<z.ZodString>;
19
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
20
- items: z.ZodArray<z.ZodObject<{
21
- id: z.ZodString;
22
- email: z.ZodOptional<z.ZodString>;
23
- name: z.ZodOptional<z.ZodString>;
24
- }, z.core.$catchall<z.ZodUnknown>>>;
25
- nextPageToken: z.ZodOptional<z.ZodString>;
26
- totalEntries: z.ZodOptional<z.ZodNumber>;
27
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
28
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
29
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
30
- us: "us";
31
- eu: "eu";
32
- }>>;
33
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
34
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
35
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
36
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
37
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
38
- }, z.core.$strip>>], undefined>;
39
- declare const getUser: _keystrokehq_core0.Operation<z.ZodObject<{
40
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
41
- }, z.core.$strip>, z.ZodObject<{
42
- id: z.ZodString;
43
- email: z.ZodOptional<z.ZodString>;
44
- name: z.ZodOptional<z.ZodString>;
45
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
46
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
47
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
48
- us: "us";
49
- eu: "eu";
50
- }>>;
51
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
52
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
53
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
54
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
55
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
56
- }, z.core.$strip>>], undefined>;
57
- declare const inviteUser: _keystrokehq_core0.Operation<z.ZodObject<{
58
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
59
- }, z.core.$strip>, z.ZodObject<{
60
- id: z.ZodString;
61
- email: z.ZodOptional<z.ZodString>;
62
- status: z.ZodOptional<z.ZodString>;
63
- createdAt: z.ZodOptional<z.ZodString>;
64
- }, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
65
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
66
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
67
- us: "us";
68
- eu: "eu";
69
- }>>;
70
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
71
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
72
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
73
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
74
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
75
- }, z.core.$strip>>], undefined>;
76
- declare const listInvites: _keystrokehq_core0.Operation<z.ZodIntersection<z.ZodObject<{
77
- pageSize: z.ZodOptional<z.ZodNumber>;
78
- pageToken: z.ZodOptional<z.ZodString>;
79
- }, z.core.$strip>, z.ZodObject<{}, z.core.$strip>>, z.ZodObject<{
80
- items: z.ZodArray<z.ZodObject<{
81
- id: z.ZodString;
82
- email: z.ZodOptional<z.ZodString>;
83
- status: z.ZodOptional<z.ZodString>;
84
- createdAt: z.ZodOptional<z.ZodString>;
85
- }, z.core.$catchall<z.ZodUnknown>>>;
86
- nextPageToken: z.ZodOptional<z.ZodString>;
87
- totalEntries: z.ZodOptional<z.ZodNumber>;
88
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
89
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
90
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
91
- us: "us";
92
- eu: "eu";
93
- }>>;
94
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
95
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
96
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
97
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
98
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
99
- }, z.core.$strip>>], undefined>;
100
- declare const deleteInvite: _keystrokehq_core0.Operation<z.ZodObject<{
101
- [x: string]: z.core.$ZodType<unknown, unknown, z.core.$ZodTypeInternals<unknown, unknown>>;
102
- }, z.core.$strip>, z.ZodObject<{}, z.core.$catchall<z.ZodUnknown>>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", z.ZodObject<{
103
- SEGMENT_PUBLIC_API_TOKEN: z.ZodString;
104
- SEGMENT_REGION: z.ZodDefault<z.ZodEnum<{
105
- us: "us";
106
- eu: "eu";
107
- }>>;
108
- SEGMENT_DEFAULT_WRITE_KEY: z.ZodOptional<z.ZodString>;
109
- SEGMENT_WRITE_KEYS_JSON: z.ZodOptional<z.ZodString>;
110
- SEGMENT_PROFILE_API_TOKEN: z.ZodOptional<z.ZodString>;
111
- SEGMENT_PROFILE_SPACE_ID: z.ZodOptional<z.ZodString>;
112
- SEGMENT_WEBHOOK_SHARED_SECRET: z.ZodOptional<z.ZodString>;
113
- }, z.core.$strip>>], undefined>;
114
- declare const replaceUserPermissions: _keystrokehq_core0.Operation<z.ZodObject<{
115
- id: z.ZodString;
116
- permissions: z.ZodArray<z.ZodObject<{
117
- roleId: z.ZodString;
118
- resources: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
119
- }, z.core.$catchall<z.ZodUnknown>>>;
120
- }, z.core.$strip>, z.ZodObject<{
121
- items: z.ZodArray<z.ZodObject<{
122
- roleId: z.ZodString;
123
- resources: z.ZodOptional<z.ZodArray<z.ZodRecord<z.ZodString, z.ZodUnknown>>>;
124
- }, z.core.$catchall<z.ZodUnknown>>>;
125
- }, z.core.$strip>, readonly [_keystrokehq_core0.CredentialSet<"keystroke:segment", 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>;
137
- //#endregion
138
- export { deleteInvite, getUser, iamInviteSchema, iamUserSchema, inviteUser, listInvites, listUsers, replaceUserPermissions };