@zitadel/api 0.2.0 → 0.4.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 (89) hide show
  1. package/README.md +17 -3
  2. package/dist/api-factory-C5b1Gqwv.mjs +357 -0
  3. package/dist/api-factory-C5b1Gqwv.mjs.map +1 -0
  4. package/dist/api-factory-Dt5lUjyu.d.mts +212 -0
  5. package/dist/api-factory-Dt5lUjyu.d.mts.map +1 -0
  6. package/dist/{fetch-CtYe0OvX.d.mts → fetch-B-lgjlrf.d.mts} +22 -12
  7. package/dist/fetch-B-lgjlrf.d.mts.map +1 -0
  8. package/dist/generated/endpoints/zitadelNextGen.d.mts +2 -2
  9. package/dist/generated/endpoints/zitadelNextGen.mjs +192 -124
  10. package/dist/generated/endpoints/zitadelNextGen.mjs.map +1 -1
  11. package/dist/generated/endpoints/zitadelNextGen.msw.d.mts +3 -1
  12. package/dist/generated/endpoints/zitadelNextGen.msw.d.mts.map +1 -1
  13. package/dist/generated/endpoints/zitadelNextGen.msw.mjs +40 -7
  14. package/dist/generated/endpoints/zitadelNextGen.msw.mjs.map +1 -1
  15. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts +104 -28
  16. package/dist/generated/endpoints/zitadelNextGen.zod.d.mts.map +1 -1
  17. package/dist/generated/endpoints/zitadelNextGen.zod.mjs +117 -37
  18. package/dist/generated/endpoints/zitadelNextGen.zod.mjs.map +1 -1
  19. package/dist/generated/model/index.d.mts +2 -2
  20. package/dist/generated/model/index.mjs +5 -1
  21. package/dist/generated/model/index.mjs.map +1 -1
  22. package/dist/generated/operations.mjs +22 -1
  23. package/dist/generated/operations.mjs.map +1 -1
  24. package/dist/{index-D7-l5LV6.d.mts → index-DGQY1rfH.d.mts} +398 -10
  25. package/dist/index-DGQY1rfH.d.mts.map +1 -0
  26. package/dist/runtime/api-factory.d.mts +2 -51
  27. package/dist/runtime/api-factory.mjs +3 -62
  28. package/dist/runtime/auth.mjs +1 -1
  29. package/dist/runtime/auth.mjs.map +1 -1
  30. package/dist/runtime/base-url.d.mts +14 -0
  31. package/dist/runtime/base-url.d.mts.map +1 -1
  32. package/dist/runtime/base-url.mjs +22 -1
  33. package/dist/runtime/base-url.mjs.map +1 -1
  34. package/dist/runtime/config.d.mts +1 -1
  35. package/dist/runtime/config.mjs +1 -1
  36. package/dist/runtime/fetch.d.mts +2 -2
  37. package/dist/runtime/fetch.mjs +41 -17
  38. package/dist/runtime/fetch.mjs.map +1 -1
  39. package/dist/runtime/paging.d.mts +35 -0
  40. package/dist/runtime/paging.d.mts.map +1 -0
  41. package/dist/runtime/paging.mjs +38 -0
  42. package/dist/runtime/paging.mjs.map +1 -0
  43. package/dist/{zitadelNextGen-Cw3DrCn1.d.mts → zitadelNextGen-BVO4sdKD.d.mts} +69 -34
  44. package/dist/zitadelNextGen-BVO4sdKD.d.mts.map +1 -0
  45. package/package.json +7 -1
  46. package/src/generated/endpoints/zitadelNextGen.faker.ts +9 -6
  47. package/src/generated/endpoints/zitadelNextGen.msw.ts +16 -1
  48. package/src/generated/endpoints/zitadelNextGen.ts +212 -125
  49. package/src/generated/endpoints/zitadelNextGen.zod.ts +120 -36
  50. package/src/generated/model/createFlowDefinition201UserSchemaMetadata.ts +5 -0
  51. package/src/generated/model/deleteUserByID409.ts +20 -0
  52. package/src/generated/model/deleteUserByID409Details.ts +12 -0
  53. package/src/generated/model/deleteUserByIDDefault.ts +9 -0
  54. package/src/generated/model/evaluatePolicy200.ts +30 -0
  55. package/src/generated/model/evaluatePolicy200Violations.ts +14 -0
  56. package/src/generated/model/evaluatePolicyBody.ts +82 -0
  57. package/src/generated/model/evaluatePolicyDefault.ts +90 -0
  58. package/src/generated/model/evaluatePolicyParams.ts +15 -0
  59. package/src/generated/model/getFlowDefinition200UserSchemaMetadata.ts +5 -0
  60. package/src/generated/model/getFlowStepDefault.ts +9 -0
  61. package/src/generated/model/getMyUserSchema200Metadata.ts +5 -0
  62. package/src/generated/model/getSchemaById200Metadata.ts +5 -0
  63. package/src/generated/model/index.ts +8 -0
  64. package/src/generated/model/listFlowDefinitions200FlowDefinitionsItemUserSchemaMetadata.ts +5 -0
  65. package/src/generated/model/listSchemas200SchemasItemMetadata.ts +5 -0
  66. package/src/generated/model/listSchemasExpandItem.ts +28 -0
  67. package/src/generated/model/listSchemasParams.ts +5 -0
  68. package/src/generated/model/queryTeamsParams.ts +3 -2
  69. package/src/generated/model/queryUsersBodyFilterItem.ts +11 -3
  70. package/src/generated/model/queryUsersBodyFilterItemField.ts +12 -3
  71. package/src/generated/model/submitFlowStepDefault.ts +9 -0
  72. package/src/generated/operations.ts +24 -1
  73. package/src/generated/paging.ts +128 -0
  74. package/src/runtime/api-factory.spec.ts +278 -0
  75. package/src/runtime/api-factory.ts +93 -12
  76. package/src/runtime/auth.ts +1 -1
  77. package/src/runtime/base-url.spec.ts +40 -4
  78. package/src/runtime/base-url.ts +28 -0
  79. package/src/runtime/fetch.spec.ts +51 -0
  80. package/src/runtime/fetch.ts +69 -30
  81. package/src/runtime/paged.spec.ts +104 -0
  82. package/src/runtime/paged.ts +61 -0
  83. package/src/runtime/paging.spec.ts +94 -0
  84. package/src/runtime/paging.ts +58 -0
  85. package/dist/fetch-CtYe0OvX.d.mts.map +0 -1
  86. package/dist/index-D7-l5LV6.d.mts.map +0 -1
  87. package/dist/runtime/api-factory.d.mts.map +0 -1
  88. package/dist/runtime/api-factory.mjs.map +0 -1
  89. package/dist/zitadelNextGen-Cw3DrCn1.d.mts.map +0 -1
package/README.md CHANGED
@@ -20,30 +20,44 @@ const project = configureZitadel({
20
20
  export const api = getApi(project);
21
21
  ```
22
22
 
23
+ Every operation goes to the proxy path, or to the server URL a client is given,
24
+ followed by `/api/v1`, where the server serves the API: `getUser` calls
25
+ `/__nextgen/api/v1/users/{id}`. Give a server's origin, without `/api/v1`; one
26
+ that already ends in it keeps a single prefix. A `404` with the code
27
+ `req.not_found` means the server has no such operation: a server older than the
28
+ client does not serve the API under `/api/v1`.
29
+
23
30
  Subsequent `configureZitadel()` calls with the same values return the original
24
31
  handle; different values log a warning and keep the original — safe for HMR
25
32
  and framework double-mounts. The same handle is what you pass to the shared
26
33
  web components' `project` property.
27
34
 
35
+ Every paged list method also walks its cursor for you, one page at a time as
36
+ the loop asks: `client.listDeployments.items({ project_id })` yields every
37
+ deployment, `.pages(...)` every page, and `.all(...)` collects them into one
38
+ array. To change what every call returns, each page included, pass
39
+ `onResponse` or `onError` to `createZitadelClient`.
40
+
28
41
  ## Entry points
29
42
 
30
43
  | Import | What it carries |
31
44
  | --- | --- |
32
45
  | `@zitadel/api/config` | `configureZitadel()`, `getApi()` — the primary surface |
33
- | `@zitadel/api/client` | The client wrapper the SDKs consume |
46
+ | `@zitadel/api/client` | The client wrapper the SDKs consume; `pagedFunctions`, each paged function's typed readers of a page's items and cursor and the arguments of its next page |
34
47
  | `@zitadel/api/generated/endpoints/zitadelNextGen` | Generated endpoint functions (orval, from the OpenAPI source) |
35
48
  | `@zitadel/api/generated/model` | Generated request/response types |
36
49
  | `@zitadel/api/generated/endpoints/zitadelNextGen.zod` | Zod schemas per endpoint |
37
50
  | `@zitadel/api/generated/endpoints/zitadelNextGen.msw` | MSW handlers for tests |
38
51
  | `@zitadel/api/generated/operations` | Every operation as data: method, path, parameters, authentication, paging |
39
- | `@zitadel/api/runtime/base-url` | `setProxyPath()` / `getProxyPath()` — the low-level slot `configureZitadel()` writes; call it directly only when you manage configuration yourself |
52
+ | `@zitadel/api/runtime/base-url` | `API_PREFIX` and `apiBaseUrl()`, which put `/api/v1` after a base; `setProxyPath()` / `getProxyPath()` — the low-level slot `configureZitadel()` writes; call it directly only when you manage configuration yourself |
40
53
  | `@zitadel/api/runtime/auth` | `getApiAuthToken()` and bearer plumbing; `setApiCsrfToken()` / `getApiCsrfToken()` / `setApiCsrfRejectionHandler()` for session-cookie writes (see below) |
41
54
  | `@zitadel/api/runtime/fetch` | The shared `customFetch` interceptor |
55
+ | `@zitadel/api/runtime/paging` | `pages()`, the cursor walk behind every paged function's `pages`, `items` and `all`; `nextToken()`, a page's cursor to the next one; `itemsOf()`, a page's list |
42
56
 
43
57
  ### CSRF token for session-cookie writes
44
58
 
45
59
  A browser app that authenticates management calls with the
46
- `__nextgen_session` cookie (the Console does) must send the session's CSRF
60
+ session cookie (the Console does) must send the session's CSRF
47
61
  token on state-changing requests. Load it once per session from
48
62
  `GET /sessions/me/csrf`, passing your project as `project_id` so that a session
49
63
  of another app on the same host gets none, and hand it to
@@ -0,0 +1,357 @@
1
+ import { setProxyPath } from "./runtime/base-url.mjs";
2
+ import { setApiAuthToken } from "./runtime/auth.mjs";
3
+ import { setRequestPolicy } from "./runtime/fetch.mjs";
4
+ import { pages } from "./runtime/paging.mjs";
5
+ import { t as zitadelNextGen_exports } from "./generated/endpoints/zitadelNextGen.mjs";
6
+ //#region src/generated/paging.ts
7
+ /**
8
+ * The client functions that page (ADR 027), by name: a page's items and its
9
+ * cursor to the next one, each read off the page as the function's response
10
+ * type declares them, and the arguments that fetch the page a cursor names.
11
+ */
12
+ const paging = {
13
+ queryUsers: {
14
+ items: (page) => page.users,
15
+ next: (page) => page.next_page_token,
16
+ withToken: ([queryUsersBody, params, options], page_token) => [
17
+ {
18
+ ...queryUsersBody,
19
+ page_token
20
+ },
21
+ params,
22
+ options
23
+ ]
24
+ },
25
+ listUserIdentityLinks: {
26
+ items: (page) => page.identity_links,
27
+ next: (page) => page.next_page_token,
28
+ withToken: ([userId, params, options], page_token) => [
29
+ userId,
30
+ {
31
+ ...params,
32
+ page_token
33
+ },
34
+ options
35
+ ]
36
+ },
37
+ listUserPasskeys: {
38
+ items: (page) => page.passkeys,
39
+ next: (page) => page.next_page_token,
40
+ withToken: ([userId, params, options], page_token) => [
41
+ userId,
42
+ {
43
+ ...params,
44
+ page_token
45
+ },
46
+ options
47
+ ]
48
+ },
49
+ listUserTeams: {
50
+ items: (page) => page.teams,
51
+ next: (page) => page.next_page_token,
52
+ withToken: ([userId, params, options], page_token) => [
53
+ userId,
54
+ {
55
+ ...params,
56
+ page_token
57
+ },
58
+ options
59
+ ]
60
+ },
61
+ listMyIdentityLinks: {
62
+ items: (page) => page.identity_links,
63
+ next: (page) => page.next_page_token,
64
+ withToken: ([params, options], page_token) => [{
65
+ ...params,
66
+ page_token
67
+ }, options]
68
+ },
69
+ listMyPasskeys: {
70
+ items: (page) => page.passkeys,
71
+ next: (page) => page.next_page_token,
72
+ withToken: ([params, options], page_token) => [{
73
+ ...params,
74
+ page_token
75
+ }, options]
76
+ },
77
+ listMyProjects: {
78
+ items: (page) => page.projects,
79
+ next: (page) => page.next_page_token,
80
+ withToken: ([params, options], page_token) => [{
81
+ ...params,
82
+ page_token
83
+ }, options]
84
+ },
85
+ listMyTeams: {
86
+ items: (page) => page.teams,
87
+ next: (page) => page.next_page_token,
88
+ withToken: ([params, options], page_token) => [{
89
+ ...params,
90
+ page_token
91
+ }, options]
92
+ },
93
+ queryProjects: {
94
+ items: (page) => page.projects,
95
+ next: (page) => page.next_page_token,
96
+ withToken: ([queryProjectsBody, options], page_token) => [{
97
+ ...queryProjectsBody,
98
+ page_token
99
+ }, options]
100
+ },
101
+ listProjectAdmins: {
102
+ items: (page) => page.admins,
103
+ next: (page) => page.next_page_token,
104
+ withToken: ([projectId, params, options], page_token) => [
105
+ projectId,
106
+ {
107
+ ...params,
108
+ page_token
109
+ },
110
+ options
111
+ ]
112
+ },
113
+ listPreviews: {
114
+ items: (page) => page.previews,
115
+ next: (page) => page.next_page_token,
116
+ withToken: ([projectId, params, options], page_token) => [
117
+ projectId,
118
+ {
119
+ ...params,
120
+ page_token
121
+ },
122
+ options
123
+ ]
124
+ },
125
+ querySessions: {
126
+ items: (page) => page.sessions,
127
+ next: (page) => page.next_page_token,
128
+ withToken: ([querySessionsBody, params, options], page_token) => [
129
+ {
130
+ ...querySessionsBody,
131
+ page_token
132
+ },
133
+ params,
134
+ options
135
+ ]
136
+ },
137
+ listSchemas: {
138
+ items: (page) => page.schemas,
139
+ next: (page) => page.next_page_token,
140
+ withToken: ([params, options], page_token) => [{
141
+ ...params,
142
+ page_token
143
+ }, options]
144
+ },
145
+ listFlowDefinitions: {
146
+ items: (page) => page.flow_definitions,
147
+ next: (page) => page.next_page_token,
148
+ withToken: ([params, options], page_token) => [{
149
+ ...params,
150
+ page_token
151
+ }, options]
152
+ },
153
+ queryTeams: {
154
+ items: (page) => page.teams,
155
+ next: (page) => page.next_page_token,
156
+ withToken: ([queryTeamsBody, params, options], page_token) => [
157
+ {
158
+ ...queryTeamsBody,
159
+ page_token
160
+ },
161
+ params,
162
+ options
163
+ ]
164
+ },
165
+ queryIdps: {
166
+ items: (page) => page.idps,
167
+ next: (page) => page.next_page_token,
168
+ withToken: ([queryIdpsBody, params, options], page_token) => [
169
+ {
170
+ ...queryIdpsBody,
171
+ page_token
172
+ },
173
+ params,
174
+ options
175
+ ]
176
+ },
177
+ listIdpRevisions: {
178
+ items: (page) => page.revisions,
179
+ next: (page) => page.next_page_token,
180
+ withToken: ([id, params, options], page_token) => [
181
+ id,
182
+ {
183
+ ...params,
184
+ page_token
185
+ },
186
+ options
187
+ ]
188
+ },
189
+ listPolicies: {
190
+ items: (page) => page.policies,
191
+ next: (page) => page.next_page_token,
192
+ withToken: ([params, options], page_token) => [{
193
+ ...params,
194
+ page_token
195
+ }, options]
196
+ },
197
+ listPolicyRevisions: {
198
+ items: (page) => page.revisions,
199
+ next: (page) => page.next_page_token,
200
+ withToken: ([policyId, params, options], page_token) => [
201
+ policyId,
202
+ {
203
+ ...params,
204
+ page_token
205
+ },
206
+ options
207
+ ]
208
+ },
209
+ listReleases: {
210
+ items: (page) => page.releases,
211
+ next: (page) => page.next_page_token,
212
+ withToken: ([params, options], page_token) => [{
213
+ ...params,
214
+ page_token
215
+ }, options]
216
+ },
217
+ queryGrants: {
218
+ items: (page) => page.grants,
219
+ next: (page) => page.next_page_token,
220
+ withToken: ([queryGrantsBody, params, options], page_token) => [
221
+ {
222
+ ...queryGrantsBody,
223
+ page_token
224
+ },
225
+ params,
226
+ options
227
+ ]
228
+ },
229
+ listEvents: {
230
+ items: (page) => page.data,
231
+ next: (page) => page.next_page_token,
232
+ withToken: ([params, options], page_token) => [{
233
+ ...params,
234
+ page_token
235
+ }, options]
236
+ },
237
+ listDeployments: {
238
+ items: (page) => page.deployments,
239
+ next: (page) => page.next_page_token,
240
+ withToken: ([params, options], page_token) => [{
241
+ ...params,
242
+ page_token
243
+ }, options]
244
+ }
245
+ };
246
+ //#endregion
247
+ //#region src/runtime/paged.ts
248
+ /**
249
+ * The client's own use of the cursor walk: `pages`, `items` and `all` on one
250
+ * generated function. Internal to the package; `./paging` is what it exports.
251
+ */
252
+ /**
253
+ * `pages`, `items` and `all` for one generated function. Each takes the
254
+ * function's own arguments; the first page is fetched with them as given, so a
255
+ * `page_token` among them is where it starts. `send` fetches a page as the
256
+ * server answers it, so the cursor is read before `hooks.respond` sees the
257
+ * page, and every failure of the walk reaches `hooks.fail` once.
258
+ */
259
+ function paged(send, shape, hooks) {
260
+ async function* walk(args, take) {
261
+ const raw = pages(async (token) => {
262
+ return token === void 0 ? send(...args) : send(...shape.withToken(args, token));
263
+ }, { next: (page) => shape.next(page) ?? void 0 });
264
+ try {
265
+ for await (const page of raw) for (const value of take(await hooks.respond(page))) yield value;
266
+ } catch (error) {
267
+ hooks.fail(error);
268
+ }
269
+ }
270
+ return {
271
+ pages: (...args) => walk(args, (page) => [page]),
272
+ items: (...args) => walk(args, (page) => shape.items(page)),
273
+ all: async (...args) => {
274
+ const collected = [];
275
+ for await (const list of walk(args, (page) => [shape.items(page)])) collected.push(...list);
276
+ return collected;
277
+ }
278
+ };
279
+ }
280
+ //#endregion
281
+ //#region src/runtime/api-factory.ts
282
+ /**
283
+ * Factory for the typed Zitadel client every consumer reaches for.
284
+ *
285
+ * Wraps the orval-generated endpoints in a {@link Proxy} so each
286
+ * generated function sees the right base URL and (optionally) the
287
+ * right bearer token at call time — without the caller having to
288
+ * thread either through every operation, and without exposing the
289
+ * module-globals (`setProxyPath` / `setApiAuthToken`) as part of the
290
+ * public API.
291
+ *
292
+ * Per-instance isolation: multiple clients can coexist in one process
293
+ * (different servers, different tokens). Every call through a client,
294
+ * each page of a paged one included, sets that client's globals
295
+ * synchronously before invoking the underlying generated function,
296
+ * which reads them at the top of `customFetch` before any `await`. So
297
+ * clients can run in parallel across awaits without clobbering each
298
+ * other.
299
+ */
300
+ /**
301
+ * Build a typed Zitadel client pre-bound to a base URL and (optionally)
302
+ * a bearer token. Every method on the returned object mirrors a
303
+ * generated orval function, and one that pages also walks its pages:
304
+ *
305
+ * const client = createZitadelClient({ baseUrl, token });
306
+ * await client.createProject({ origins: [] });
307
+ * await client.createSchema(body, { project_id });
308
+ * for await (const deployment of client.listDeployments.items({ project_id })) { … }
309
+ */
310
+ function createZitadelClient(opts) {
311
+ let baseUrl = opts.baseUrl;
312
+ while (baseUrl.endsWith("/")) baseUrl = baseUrl.slice(0, -1);
313
+ const hooks = {
314
+ respond: (body) => opts.onResponse ? opts.onResponse(body) : body,
315
+ fail: (error) => {
316
+ opts.onError?.(error);
317
+ throw error;
318
+ }
319
+ };
320
+ const hooked = opts.onResponse !== void 0 || opts.onError !== void 0;
321
+ const bound = /* @__PURE__ */ new Map();
322
+ return new Proxy(zitadelNextGen_exports, { get(target, prop, receiver) {
323
+ const known = bound.get(prop);
324
+ if (known !== void 0) return known;
325
+ const value = Reflect.get(target, prop, receiver);
326
+ if (typeof value !== "function") return value;
327
+ const send = (...args) => {
328
+ setProxyPath(baseUrl);
329
+ setApiAuthToken(opts.token);
330
+ setRequestPolicy({
331
+ signal: opts.signal,
332
+ timeoutMs: opts.timeoutMs
333
+ });
334
+ return value(...args);
335
+ };
336
+ const call = (...args) => {
337
+ const result = send(...args);
338
+ return hooked && typeof result?.then === "function" ? Promise.resolve(result).then(hooks.respond).catch(hooks.fail) : result;
339
+ };
340
+ const fn = Object.hasOwn(paging, prop) ? Object.assign(call, paged(send, paging[prop], hooks)) : call;
341
+ bound.set(prop, fn);
342
+ return fn;
343
+ } });
344
+ }
345
+ /**
346
+ * Legacy entry point: builds a client with only the base URL set, no
347
+ * token. Components and SDKs that don't carry an auth token (browser
348
+ * flows authenticated by platform cookies) still consume this name.
349
+ * Equivalent to `createZitadelClient({ baseUrl: apiBase })`.
350
+ */
351
+ function createApi(apiBase) {
352
+ return createZitadelClient({ baseUrl: apiBase });
353
+ }
354
+ //#endregion
355
+ export { createZitadelClient as n, paging as r, createApi as t };
356
+
357
+ //# sourceMappingURL=api-factory-C5b1Gqwv.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"api-factory-C5b1Gqwv.mjs","names":["endpoints"],"sources":["../src/generated/paging.ts","../src/runtime/paged.ts","../src/runtime/api-factory.ts"],"sourcesContent":["// Code generated by packages/api/scripts/operations.ts from api/openapi. DO NOT EDIT: regenerate with moon run api:generate.\n\nimport type * as endpoints from \"./endpoints/zitadelNextGen\";\n\ntype Page<K extends keyof typeof endpoints> = Awaited<ReturnType<(typeof endpoints)[K]>>;\n\n/**\n * The client functions that page (ADR 027), by name: a page's items and its\n * cursor to the next one, each read off the page as the function's response\n * type declares them, and the arguments that fetch the page a cursor names.\n */\nexport const paging = {\n queryUsers: {\n items: (page: Page<\"queryUsers\">) => page.users,\n next: (page: Page<\"queryUsers\">) => page.next_page_token,\n withToken: ([queryUsersBody, params, options]: Parameters<(typeof endpoints)[\"queryUsers\"]>, page_token: string): Parameters<(typeof endpoints)[\"queryUsers\"]> => [{ ...queryUsersBody, page_token }, params, options],\n },\n listUserIdentityLinks: {\n items: (page: Page<\"listUserIdentityLinks\">) => page.identity_links,\n next: (page: Page<\"listUserIdentityLinks\">) => page.next_page_token,\n withToken: ([userId, params, options]: Parameters<(typeof endpoints)[\"listUserIdentityLinks\"]>, page_token: string): Parameters<(typeof endpoints)[\"listUserIdentityLinks\"]> => [userId, { ...params, page_token }, options],\n },\n listUserPasskeys: {\n items: (page: Page<\"listUserPasskeys\">) => page.passkeys,\n next: (page: Page<\"listUserPasskeys\">) => page.next_page_token,\n withToken: ([userId, params, options]: Parameters<(typeof endpoints)[\"listUserPasskeys\"]>, page_token: string): Parameters<(typeof endpoints)[\"listUserPasskeys\"]> => [userId, { ...params, page_token }, options],\n },\n listUserTeams: {\n items: (page: Page<\"listUserTeams\">) => page.teams,\n next: (page: Page<\"listUserTeams\">) => page.next_page_token,\n withToken: ([userId, params, options]: Parameters<(typeof endpoints)[\"listUserTeams\"]>, page_token: string): Parameters<(typeof endpoints)[\"listUserTeams\"]> => [userId, { ...params, page_token }, options],\n },\n listMyIdentityLinks: {\n items: (page: Page<\"listMyIdentityLinks\">) => page.identity_links,\n next: (page: Page<\"listMyIdentityLinks\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listMyIdentityLinks\"]>, page_token: string): Parameters<(typeof endpoints)[\"listMyIdentityLinks\"]> => [{ ...params, page_token }, options],\n },\n listMyPasskeys: {\n items: (page: Page<\"listMyPasskeys\">) => page.passkeys,\n next: (page: Page<\"listMyPasskeys\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listMyPasskeys\"]>, page_token: string): Parameters<(typeof endpoints)[\"listMyPasskeys\"]> => [{ ...params, page_token }, options],\n },\n listMyProjects: {\n items: (page: Page<\"listMyProjects\">) => page.projects,\n next: (page: Page<\"listMyProjects\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listMyProjects\"]>, page_token: string): Parameters<(typeof endpoints)[\"listMyProjects\"]> => [{ ...params, page_token }, options],\n },\n listMyTeams: {\n items: (page: Page<\"listMyTeams\">) => page.teams,\n next: (page: Page<\"listMyTeams\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listMyTeams\"]>, page_token: string): Parameters<(typeof endpoints)[\"listMyTeams\"]> => [{ ...params, page_token }, options],\n },\n queryProjects: {\n items: (page: Page<\"queryProjects\">) => page.projects,\n next: (page: Page<\"queryProjects\">) => page.next_page_token,\n withToken: ([queryProjectsBody, options]: Parameters<(typeof endpoints)[\"queryProjects\"]>, page_token: string): Parameters<(typeof endpoints)[\"queryProjects\"]> => [{ ...queryProjectsBody, page_token }, options],\n },\n listProjectAdmins: {\n items: (page: Page<\"listProjectAdmins\">) => page.admins,\n next: (page: Page<\"listProjectAdmins\">) => page.next_page_token,\n withToken: ([projectId, params, options]: Parameters<(typeof endpoints)[\"listProjectAdmins\"]>, page_token: string): Parameters<(typeof endpoints)[\"listProjectAdmins\"]> => [projectId, { ...params, page_token }, options],\n },\n listPreviews: {\n items: (page: Page<\"listPreviews\">) => page.previews,\n next: (page: Page<\"listPreviews\">) => page.next_page_token,\n withToken: ([projectId, params, options]: Parameters<(typeof endpoints)[\"listPreviews\"]>, page_token: string): Parameters<(typeof endpoints)[\"listPreviews\"]> => [projectId, { ...params, page_token }, options],\n },\n querySessions: {\n items: (page: Page<\"querySessions\">) => page.sessions,\n next: (page: Page<\"querySessions\">) => page.next_page_token,\n withToken: ([querySessionsBody, params, options]: Parameters<(typeof endpoints)[\"querySessions\"]>, page_token: string): Parameters<(typeof endpoints)[\"querySessions\"]> => [{ ...querySessionsBody, page_token }, params, options],\n },\n listSchemas: {\n items: (page: Page<\"listSchemas\">) => page.schemas,\n next: (page: Page<\"listSchemas\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listSchemas\"]>, page_token: string): Parameters<(typeof endpoints)[\"listSchemas\"]> => [{ ...params, page_token }, options],\n },\n listFlowDefinitions: {\n items: (page: Page<\"listFlowDefinitions\">) => page.flow_definitions,\n next: (page: Page<\"listFlowDefinitions\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listFlowDefinitions\"]>, page_token: string): Parameters<(typeof endpoints)[\"listFlowDefinitions\"]> => [{ ...params, page_token }, options],\n },\n queryTeams: {\n items: (page: Page<\"queryTeams\">) => page.teams,\n next: (page: Page<\"queryTeams\">) => page.next_page_token,\n withToken: ([queryTeamsBody, params, options]: Parameters<(typeof endpoints)[\"queryTeams\"]>, page_token: string): Parameters<(typeof endpoints)[\"queryTeams\"]> => [{ ...queryTeamsBody, page_token }, params, options],\n },\n queryIdps: {\n items: (page: Page<\"queryIdps\">) => page.idps,\n next: (page: Page<\"queryIdps\">) => page.next_page_token,\n withToken: ([queryIdpsBody, params, options]: Parameters<(typeof endpoints)[\"queryIdps\"]>, page_token: string): Parameters<(typeof endpoints)[\"queryIdps\"]> => [{ ...queryIdpsBody, page_token }, params, options],\n },\n listIdpRevisions: {\n items: (page: Page<\"listIdpRevisions\">) => page.revisions,\n next: (page: Page<\"listIdpRevisions\">) => page.next_page_token,\n withToken: ([id, params, options]: Parameters<(typeof endpoints)[\"listIdpRevisions\"]>, page_token: string): Parameters<(typeof endpoints)[\"listIdpRevisions\"]> => [id, { ...params, page_token }, options],\n },\n listPolicies: {\n items: (page: Page<\"listPolicies\">) => page.policies,\n next: (page: Page<\"listPolicies\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listPolicies\"]>, page_token: string): Parameters<(typeof endpoints)[\"listPolicies\"]> => [{ ...params, page_token }, options],\n },\n listPolicyRevisions: {\n items: (page: Page<\"listPolicyRevisions\">) => page.revisions,\n next: (page: Page<\"listPolicyRevisions\">) => page.next_page_token,\n withToken: ([policyId, params, options]: Parameters<(typeof endpoints)[\"listPolicyRevisions\"]>, page_token: string): Parameters<(typeof endpoints)[\"listPolicyRevisions\"]> => [policyId, { ...params, page_token }, options],\n },\n listReleases: {\n items: (page: Page<\"listReleases\">) => page.releases,\n next: (page: Page<\"listReleases\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listReleases\"]>, page_token: string): Parameters<(typeof endpoints)[\"listReleases\"]> => [{ ...params, page_token }, options],\n },\n queryGrants: {\n items: (page: Page<\"queryGrants\">) => page.grants,\n next: (page: Page<\"queryGrants\">) => page.next_page_token,\n withToken: ([queryGrantsBody, params, options]: Parameters<(typeof endpoints)[\"queryGrants\"]>, page_token: string): Parameters<(typeof endpoints)[\"queryGrants\"]> => [{ ...queryGrantsBody, page_token }, params, options],\n },\n listEvents: {\n items: (page: Page<\"listEvents\">) => page.data,\n next: (page: Page<\"listEvents\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listEvents\"]>, page_token: string): Parameters<(typeof endpoints)[\"listEvents\"]> => [{ ...params, page_token }, options],\n },\n listDeployments: {\n items: (page: Page<\"listDeployments\">) => page.deployments,\n next: (page: Page<\"listDeployments\">) => page.next_page_token,\n withToken: ([params, options]: Parameters<(typeof endpoints)[\"listDeployments\"]>, page_token: string): Parameters<(typeof endpoints)[\"listDeployments\"]> => [{ ...params, page_token }, options],\n },\n} as const;\n","/**\n * The client's own use of the cursor walk: `pages`, `items` and `all` on one\n * generated function. Internal to the package; `./paging` is what it exports.\n */\nimport { pages } from \"./paging\";\n\n/**\n * How a generated function pages: its page's items and cursor, read off a page\n * as the generated table types them, and the arguments that fetch the next one.\n * Method syntax, so a table entry typed by its page assigns here.\n */\ntype PagingShape = Readonly<{\n items(page: unknown): readonly unknown[];\n next(page: unknown): string | null | undefined;\n withToken(args: unknown[], token: string): readonly unknown[];\n}>;\n\n/** What the client does to every response and every failure. */\ntype Hooks = Readonly<{\n respond: (body: unknown) => unknown;\n fail: (error: unknown) => never;\n}>;\n\n/**\n * `pages`, `items` and `all` for one generated function. Each takes the\n * function's own arguments; the first page is fetched with them as given, so a\n * `page_token` among them is where it starts. `send` fetches a page as the\n * server answers it, so the cursor is read before `hooks.respond` sees the\n * page, and every failure of the walk reaches `hooks.fail` once.\n */\nexport function paged(send: (...args: unknown[]) => unknown, shape: PagingShape, hooks: Hooks) {\n async function* walk<T>(args: unknown[], take: (page: unknown) => readonly T[]) {\n const raw = pages(\n async (token) => {\n return token === undefined ? send(...args) : send(...shape.withToken(args, token));\n },\n { next: (page) => shape.next(page) ?? undefined },\n );\n try {\n for await (const page of raw) {\n for (const value of take(await hooks.respond(page))) {\n yield value;\n }\n }\n } catch (error) {\n hooks.fail(error);\n }\n }\n\n return {\n pages: (...args: unknown[]) => walk(args, (page) => [page]),\n items: (...args: unknown[]) => walk(args, (page) => shape.items(page)),\n all: async (...args: unknown[]) => {\n const collected: unknown[] = [];\n for await (const list of walk(args, (page) => [shape.items(page)])) {\n collected.push(...list);\n }\n return collected;\n },\n };\n}\n","/**\n * Factory for the typed Zitadel client every consumer reaches for.\n *\n * Wraps the orval-generated endpoints in a {@link Proxy} so each\n * generated function sees the right base URL and (optionally) the\n * right bearer token at call time — without the caller having to\n * thread either through every operation, and without exposing the\n * module-globals (`setProxyPath` / `setApiAuthToken`) as part of the\n * public API.\n *\n * Per-instance isolation: multiple clients can coexist in one process\n * (different servers, different tokens). Every call through a client,\n * each page of a paged one included, sets that client's globals\n * synchronously before invoking the underlying generated function,\n * which reads them at the top of `customFetch` before any `await`. So\n * clients can run in parallel across awaits without clobbering each\n * other.\n */\nimport * as endpoints from \"../generated/endpoints/zitadelNextGen\";\nimport { paging } from \"../generated/paging\";\n\nimport { setApiAuthToken } from \"./auth\";\nimport { setProxyPath } from \"./base-url\";\nimport { setRequestPolicy } from \"./fetch\";\nimport { paged } from \"./paged\";\n\n/**\n * How each paged function pages, by name: typed readers of a page's items and\n * of its cursor, and the arguments that fetch the page a cursor names. Named\n * apart from `@zitadel/api/runtime/paging`, the walk itself.\n */\nexport { paging as pagedFunctions };\n\ntype Endpoints = typeof endpoints;\ntype Paging = typeof paging;\n\n/** The name of a client function that pages. */\nexport type PagedOperation = keyof Paging;\n\n/** One page of a paged function's response. */\nexport type PageOf<K extends PagedOperation> = Awaited<ReturnType<Endpoints[K]>>;\n\n/** One item of a paged function's response. */\nexport type ItemOf<K extends PagedOperation> =\n ReturnType<Paging[K][\"items\"]> extends readonly (infer T)[] ? T : never;\n\n/**\n * What a paged function carries besides fetching one page. Each takes the\n * function's own arguments; a `page_token` among them is where it starts, and\n * `limit` is the page size.\n */\nexport type Paged<K extends PagedOperation> = {\n /** Every page, fetched as the loop reaches it. */\n pages(...args: Parameters<Endpoints[K]>): AsyncGenerator<PageOf<K>, void, undefined>;\n /** Every item of every page, fetched a page at a time as the loop reaches it. */\n items(...args: Parameters<Endpoints[K]>): AsyncGenerator<ItemOf<K>, void, undefined>;\n /** Every item of every page, in one array. */\n all(...args: Parameters<Endpoints[K]>): Promise<ItemOf<K>[]>;\n};\n\n/**\n * Typed Zitadel client returned by {@link createZitadelClient}: the\n * orval-generated endpoints, with {@link Paged} on every function that pages.\n */\nexport type ZitadelClient = {\n [K in keyof Endpoints]: K extends PagedOperation ? Endpoints[K] & Paged<K> : Endpoints[K];\n};\n\n/** Re-exported under the legacy name some consumers (`runtime/config.ts`) still import. */\nexport type ZitadelApi = ZitadelClient;\n\n/** Options for {@link createZitadelClient}. */\nexport type ZitadelClientOptions = {\n /** Base URL of the Zitadel server. Trailing slashes are stripped. */\n baseUrl: string;\n /**\n * Bearer token sent on every request. Optional — omit for the\n * unauthenticated `POST /projects` call; set it (typically to the\n * project secret returned by that call) before any subsequent\n * mutation.\n */\n token?: string;\n /**\n * Aborts every request this client makes. A request it cuts off rejects\n * with the signal's reason rather than a {@link NetworkError}.\n */\n signal?: AbortSignal;\n /**\n * Deadline for each request, response body included. A request that runs\n * past it rejects with a {@link NetworkError} whose reason is `timeout`.\n * Unset by default: no deadline beyond the runtime's own.\n */\n timeoutMs?: number;\n /**\n * Applied to every response this client resolves with, each page of a\n * paged function's included, before the caller sees it. A paged function\n * reads its cursor from the page as the server sent it, and its items from\n * what this returns under the same field.\n */\n onResponse?: (body: unknown) => unknown;\n /**\n * Applied to every failure of a call: the request's, `onResponse`'s, and a\n * paged function's own. It throws what the caller sees.\n */\n onError?: (error: unknown) => never;\n};\n\n/**\n * Build a typed Zitadel client pre-bound to a base URL and (optionally)\n * a bearer token. Every method on the returned object mirrors a\n * generated orval function, and one that pages also walks its pages:\n *\n * const client = createZitadelClient({ baseUrl, token });\n * await client.createProject({ origins: [] });\n * await client.createSchema(body, { project_id });\n * for await (const deployment of client.listDeployments.items({ project_id })) { … }\n */\nexport function createZitadelClient(opts: ZitadelClientOptions): ZitadelClient {\n let baseUrl = opts.baseUrl;\n while (baseUrl.endsWith(\"/\")) {\n baseUrl = baseUrl.slice(0, -1);\n }\n const hooks = {\n respond: (body: unknown) => (opts.onResponse ? opts.onResponse(body) : body),\n fail: (error: unknown): never => {\n opts.onError?.(error);\n throw error;\n },\n };\n const hooked = opts.onResponse !== undefined || opts.onError !== undefined;\n // Built once per function, not on every property read.\n const bound = new Map<PropertyKey, unknown>();\n return new Proxy(endpoints as unknown as ZitadelClient, {\n get(target, prop, receiver) {\n const known = bound.get(prop);\n if (known !== undefined) {\n return known;\n }\n const value = Reflect.get(target, prop, receiver);\n if (typeof value !== \"function\") {\n return value;\n }\n // Every request, each page included, sets this client's base URL and\n // token again: another client may have run in between.\n const send = (...args: unknown[]) => {\n setProxyPath(baseUrl);\n setApiAuthToken(opts.token);\n setRequestPolicy({ signal: opts.signal, timeoutMs: opts.timeoutMs });\n return (value as (...a: unknown[]) => unknown)(...args);\n };\n // The URL builders orval exports beside the requests return strings, so\n // only a pending result is hooked. A then-check rather than `instanceof`,\n // which a replaced global `Promise` (zone.js) would fail.\n const call = (...args: unknown[]) => {\n const result = send(...args);\n return hooked && typeof (result as { then?: unknown } | null)?.then === \"function\"\n ? Promise.resolve(result).then(hooks.respond).catch(hooks.fail)\n : result;\n };\n const fn = Object.hasOwn(paging, prop)\n ? Object.assign(call, paged(send, paging[prop as PagedOperation], hooks))\n : call;\n bound.set(prop, fn);\n return fn;\n },\n });\n}\n\n/**\n * Legacy entry point: builds a client with only the base URL set, no\n * token. Components and SDKs that don't carry an auth token (browser\n * flows authenticated by platform cookies) still consume this name.\n * Equivalent to `createZitadelClient({ baseUrl: apiBase })`.\n */\nexport function createApi(apiBase: string): ZitadelClient {\n return createZitadelClient({ baseUrl: apiBase });\n}\n"],"mappings":";;;;;;;;;;;AAWA,MAAa,SAAS;CACpB,YAAY;EACV,QAAQ,SAA6B,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