@zitadel/testing 0.0.0 → 0.1.0-alpha.18

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.
@@ -1,4 +1,4 @@
1
- const require_handshake = require("./handshake-CggSIoxF.cjs");
1
+ const require_handshake = require("./handshake-CRKcgkfN.cjs");
2
2
  require("node:fs");
3
3
  require("node:url");
4
4
  let node_fs_promises = require("node:fs/promises");
@@ -129,9 +129,7 @@ function safeJsonParse(text) {
129
129
  * OpenAPI spec version: 0.0.1
130
130
  */
131
131
  var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
132
- activateFlowDefinition: () => activateFlowDefinition,
133
- authorizeDevice: () => authorizeDevice,
134
- authorizeGet: () => authorizeGet,
132
+ completeClaim: () => completeClaim,
135
133
  createAuthAttempt: () => createAuthAttempt,
136
134
  createBranding: () => createBranding,
137
135
  createFlow: () => createFlow,
@@ -142,16 +140,14 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
142
140
  createSession: () => createSession,
143
141
  createTeam: () => createTeam,
144
142
  createUser: () => createUser,
145
- deactivateFlowDefinition: () => deactivateFlowDefinition,
146
143
  deleteFlowDefinition: () => deleteFlowDefinition,
144
+ deleteTeam: () => deleteTeam,
147
145
  deleteUserByID: () => deleteUserByID,
148
- endSession: () => endSession,
149
146
  exchangeHandoff: () => exchangeHandoff,
150
- getActivateFlowDefinitionUrl: () => getActivateFlowDefinitionUrl,
151
147
  getAuthAttempt: () => getAuthAttempt,
152
- getAuthorizeDeviceUrl: () => getAuthorizeDeviceUrl,
153
- getAuthorizeGetUrl: () => getAuthorizeGetUrl,
154
148
  getBrandingById: () => getBrandingById,
149
+ getClaimStatus: () => getClaimStatus,
150
+ getCompleteClaimUrl: () => getCompleteClaimUrl,
155
151
  getCreateAuthAttemptUrl: () => getCreateAuthAttemptUrl,
156
152
  getCreateBrandingUrl: () => getCreateBrandingUrl,
157
153
  getCreateFlowDefinitionUrl: () => getCreateFlowDefinitionUrl,
@@ -162,236 +158,76 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
162
158
  getCreateSessionUrl: () => getCreateSessionUrl,
163
159
  getCreateTeamUrl: () => getCreateTeamUrl,
164
160
  getCreateUserUrl: () => getCreateUserUrl,
165
- getDeactivateFlowDefinitionUrl: () => getDeactivateFlowDefinitionUrl,
166
161
  getDeleteFlowDefinitionUrl: () => getDeleteFlowDefinitionUrl,
162
+ getDeleteTeamUrl: () => getDeleteTeamUrl,
167
163
  getDeleteUserByIDUrl: () => getDeleteUserByIDUrl,
168
- getEndSessionUrl: () => getEndSessionUrl,
169
164
  getExchangeHandoffUrl: () => getExchangeHandoffUrl,
170
165
  getFlowDefinition: () => getFlowDefinition,
171
166
  getFlowStep: () => getFlowStep,
172
167
  getGetAuthAttemptUrl: () => getGetAuthAttemptUrl,
173
168
  getGetBrandingByIdUrl: () => getGetBrandingByIdUrl,
169
+ getGetClaimStatusUrl: () => getGetClaimStatusUrl,
174
170
  getGetFlowDefinitionUrl: () => getGetFlowDefinitionUrl,
175
171
  getGetFlowStepUrl: () => getGetFlowStepUrl,
176
172
  getGetHealthUrl: () => getGetHealthUrl,
177
- getGetKeysUrl: () => getGetKeysUrl,
178
173
  getGetLiveUrl: () => getGetLiveUrl,
179
174
  getGetMySessionUrl: () => getGetMySessionUrl,
180
175
  getGetMyUserUrl: () => getGetMyUserUrl,
181
- getGetOpenIDConfigurationUrl: () => getGetOpenIDConfigurationUrl,
182
176
  getGetProjectUrl: () => getGetProjectUrl,
183
177
  getGetReadyUrl: () => getGetReadyUrl,
184
178
  getGetSchemaByIdUrl: () => getGetSchemaByIdUrl,
185
179
  getGetSessionUrl: () => getGetSessionUrl,
186
180
  getGetTeamUrl: () => getGetTeamUrl,
187
- getGetTokenUrl: () => getGetTokenUrl,
188
181
  getGetUserByIDUrl: () => getGetUserByIDUrl,
189
- getGetUserInfoUrl: () => getGetUserInfoUrl,
190
182
  getHealth: () => getHealth,
191
- getIntrospectUrl: () => getIntrospectUrl,
183
+ getInitClaimUrl: () => getInitClaimUrl,
192
184
  getIssueChallengeUrl: () => getIssueChallengeUrl,
193
- getKeys: () => getKeys,
194
185
  getListBrandingUrl: () => getListBrandingUrl,
195
186
  getListFlowDefinitionsUrl: () => getListFlowDefinitionsUrl,
196
187
  getListSchemasUrl: () => getListSchemasUrl,
197
- getListSessionsUrl: () => getListSessionsUrl,
198
188
  getListUserPasskeysUrl: () => getListUserPasskeysUrl,
189
+ getListUserTeamsUrl: () => getListUserTeamsUrl,
199
190
  getListUsersUrl: () => getListUsersUrl,
200
191
  getLive: () => getLive,
201
192
  getMySession: () => getMySession,
202
193
  getMyUser: () => getMyUser,
203
- getOpenIDConfiguration: () => getOpenIDConfiguration,
204
194
  getPatchProjectUrl: () => getPatchProjectUrl,
205
195
  getProject: () => getProject,
206
196
  getQueryProjectsUrl: () => getQueryProjectsUrl,
197
+ getQuerySessionsUrl: () => getQuerySessionsUrl,
198
+ getQueryTeamsUrl: () => getQueryTeamsUrl,
207
199
  getReady: () => getReady,
208
200
  getRevokeMySessionUrl: () => getRevokeMySessionUrl,
209
201
  getRevokeSessionUrl: () => getRevokeSessionUrl,
210
- getRevokeTokenUrl: () => getRevokeTokenUrl,
211
202
  getSchemaById: () => getSchemaById,
212
203
  getSession: () => getSession,
213
204
  getSetUserPasswordUrl: () => getSetUserPasswordUrl,
214
- getSubmitFlowEventUrl: () => getSubmitFlowEventUrl,
215
205
  getSubmitFlowStepUrl: () => getSubmitFlowStepUrl,
216
206
  getTeam: () => getTeam,
217
- getToken: () => getToken,
218
207
  getUpdateFlowDefinitionUrl: () => getUpdateFlowDefinitionUrl,
208
+ getUpdateTeamUrl: () => getUpdateTeamUrl,
219
209
  getUserByID: () => getUserByID,
220
- getUserInfo: () => getUserInfo,
221
210
  getVerifyChallengeProofUrl: () => getVerifyChallengeProofUrl,
222
- introspect: () => introspect,
211
+ initClaim: () => initClaim,
223
212
  issueChallenge: () => issueChallenge,
224
213
  listBranding: () => listBranding,
225
214
  listFlowDefinitions: () => listFlowDefinitions,
226
215
  listSchemas: () => listSchemas,
227
- listSessions: () => listSessions,
228
216
  listUserPasskeys: () => listUserPasskeys,
217
+ listUserTeams: () => listUserTeams,
229
218
  listUsers: () => listUsers,
230
219
  patchProject: () => patchProject,
231
220
  queryProjects: () => queryProjects,
221
+ querySessions: () => querySessions,
222
+ queryTeams: () => queryTeams,
232
223
  revokeMySession: () => revokeMySession,
233
224
  revokeSession: () => revokeSession,
234
- revokeToken: () => revokeToken,
235
225
  setUserPassword: () => setUserPassword,
236
- submitFlowEvent: () => submitFlowEvent,
237
226
  submitFlowStep: () => submitFlowStep,
238
227
  updateFlowDefinition: () => updateFlowDefinition,
228
+ updateTeam: () => updateTeam,
239
229
  verifyChallengeProof: () => verifyChallengeProof
240
230
  });
241
- const getGetOpenIDConfigurationUrl = () => {
242
- return `${getProxyPath()}/.well-known/openid-configuration`;
243
- };
244
- /**
245
- * Retrieve the OpenID Connect configuration
246
- * @summary Get OpenID Connect configuration
247
- */
248
- const getOpenIDConfiguration = async (options) => {
249
- return customFetch(getGetOpenIDConfigurationUrl(), {
250
- ...options,
251
- method: "GET"
252
- });
253
- };
254
- const getAuthorizeGetUrl = (params) => {
255
- const normalizedParams = new URLSearchParams();
256
- Object.entries(params || {}).forEach(([key, value]) => {
257
- if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
258
- });
259
- const stringifiedParams = normalizedParams.toString();
260
- return stringifiedParams.length > 0 ? `${getProxyPath()}/auth/authorize?${stringifiedParams}` : `${getProxyPath()}/auth/authorize`;
261
- };
262
- /**
263
- * @summary Authorize a user
264
- */
265
- const authorizeGet = async (params, options) => {
266
- return customFetch(getAuthorizeGetUrl(params), {
267
- ...options,
268
- method: "GET"
269
- });
270
- };
271
- const getAuthorizeDeviceUrl = (params) => {
272
- const normalizedParams = new URLSearchParams();
273
- Object.entries(params || {}).forEach(([key, value]) => {
274
- if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
275
- });
276
- const stringifiedParams = normalizedParams.toString();
277
- return stringifiedParams.length > 0 ? `${getProxyPath()}/auth/device-authorization?${stringifiedParams}` : `${getProxyPath()}/auth/device-authorization`;
278
- };
279
- /**
280
- * @summary Authorize a device
281
- */
282
- const authorizeDevice = async (params, options) => {
283
- return customFetch(getAuthorizeDeviceUrl(params), {
284
- ...options,
285
- method: "GET"
286
- });
287
- };
288
- const getEndSessionUrl = (params) => {
289
- const normalizedParams = new URLSearchParams();
290
- Object.entries(params || {}).forEach(([key, value]) => {
291
- if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
292
- });
293
- const stringifiedParams = normalizedParams.toString();
294
- return stringifiedParams.length > 0 ? `${getProxyPath()}/auth/end-session?${stringifiedParams}` : `${getProxyPath()}/auth/end-session`;
295
- };
296
- /**
297
- * @summary End a session
298
- */
299
- const endSession = async (params, options) => {
300
- return customFetch(getEndSessionUrl(params), {
301
- ...options,
302
- method: "GET"
303
- });
304
- };
305
- const getIntrospectUrl = () => {
306
- return `${getProxyPath()}/auth/introspect`;
307
- };
308
- /**
309
- * @summary Introspect a token
310
- */
311
- const introspect = async (introspectBody, options) => {
312
- const formUrlEncoded = new URLSearchParams();
313
- formUrlEncoded.append(`token`, introspectBody.token);
314
- if (introspectBody.token_type_hint !== void 0) formUrlEncoded.append(`token_type_hint`, introspectBody.token_type_hint);
315
- return customFetch(getIntrospectUrl(), {
316
- ...options,
317
- method: "POST",
318
- headers: {
319
- "Content-Type": "application/x-www-form-urlencoded",
320
- ...options?.headers
321
- },
322
- body: formUrlEncoded
323
- });
324
- };
325
- const getGetKeysUrl = () => {
326
- return `${getProxyPath()}/auth/keys`;
327
- };
328
- /**
329
- * @summary Get public keys
330
- */
331
- const getKeys = async (options) => {
332
- return customFetch(getGetKeysUrl(), {
333
- ...options,
334
- method: "GET"
335
- });
336
- };
337
- const getRevokeTokenUrl = () => {
338
- return `${getProxyPath()}/auth/revoke`;
339
- };
340
- /**
341
- * @summary Revoke an access token or refresh token
342
- */
343
- const revokeToken = async (revokeTokenBody, options) => {
344
- const formUrlEncoded = new URLSearchParams();
345
- if (revokeTokenBody.token !== void 0) formUrlEncoded.append(`token`, revokeTokenBody.token);
346
- if (revokeTokenBody.token_type_hint !== void 0) formUrlEncoded.append(`token_type_hint`, revokeTokenBody.token_type_hint);
347
- return customFetch(getRevokeTokenUrl(), {
348
- ...options,
349
- method: "POST",
350
- headers: {
351
- "Content-Type": "application/x-www-form-urlencoded",
352
- ...options?.headers
353
- },
354
- body: formUrlEncoded
355
- });
356
- };
357
- const getGetTokenUrl = () => {
358
- return `${getProxyPath()}/auth/token`;
359
- };
360
- /**
361
- * @summary Get access token
362
- */
363
- const getToken = async (getTokenBody, options) => {
364
- const formUrlEncoded = new URLSearchParams();
365
- if (getTokenBody.code !== void 0) formUrlEncoded.append(`code`, getTokenBody.code);
366
- if (getTokenBody.client_assertion !== void 0) formUrlEncoded.append(`client_assertion`, getTokenBody.client_assertion);
367
- if (getTokenBody.client_assertion_type !== void 0) formUrlEncoded.append(`client_assertion_type`, getTokenBody.client_assertion_type);
368
- if (getTokenBody.client_id !== void 0) formUrlEncoded.append(`client_id`, getTokenBody.client_id);
369
- if (getTokenBody.client_secret !== void 0) formUrlEncoded.append(`client_secret`, getTokenBody.client_secret);
370
- if (getTokenBody.code_verifier !== void 0) formUrlEncoded.append(`code_verifier`, getTokenBody.code_verifier);
371
- if (getTokenBody.grant_type !== void 0) formUrlEncoded.append(`grant_type`, getTokenBody.grant_type);
372
- if (getTokenBody.redirect_uri !== void 0) formUrlEncoded.append(`redirect_uri`, getTokenBody.redirect_uri);
373
- return customFetch(getGetTokenUrl(), {
374
- ...options,
375
- method: "POST",
376
- headers: {
377
- "Content-Type": "application/x-www-form-urlencoded",
378
- ...options?.headers
379
- },
380
- body: formUrlEncoded
381
- });
382
- };
383
- const getGetUserInfoUrl = () => {
384
- return `${getProxyPath()}/auth/userinfo`;
385
- };
386
- /**
387
- * @summary Get user info
388
- */
389
- const getUserInfo = async (options) => {
390
- return customFetch(getGetUserInfoUrl(), {
391
- ...options,
392
- method: "GET"
393
- });
394
- };
395
231
  const getGetHealthUrl = () => {
396
232
  return `${getProxyPath()}/healthz`;
397
233
  };
@@ -543,6 +379,31 @@ const setUserPassword = async (userId, setUserPasswordBody, params, options) =>
543
379
  body: JSON.stringify(setUserPasswordBody)
544
380
  });
545
381
  };
382
+ const getListUserTeamsUrl = (userId, params) => {
383
+ const normalizedParams = new URLSearchParams();
384
+ Object.entries(params || {}).forEach(([key, value]) => {
385
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
386
+ });
387
+ const stringifiedParams = normalizedParams.toString();
388
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/users/${userId}/teams?${stringifiedParams}` : `${getProxyPath()}/users/${userId}/teams`;
389
+ };
390
+ /**
391
+ * The user's team roster, ordered by team name. Each entry carries the
392
+ team's name, so a client renders a page without resolving ids one by one.
393
+
394
+ This is the N:N roster and it is not lifecycle ownership: the single team
395
+ that owns the user's lifecycle is reported as `metadata.lifecycle_owner_team_id`
396
+ on the user read endpoints. Memberships the user was removed from are not
397
+ returned.
398
+
399
+ * @summary List the teams a user belongs to
400
+ */
401
+ const listUserTeams = async (userId, params, options) => {
402
+ return customFetch(getListUserTeamsUrl(userId, params), {
403
+ ...options,
404
+ method: "GET"
405
+ });
406
+ };
546
407
  const getGetMyUserUrl = () => {
547
408
  return `${getProxyPath()}/users/me`;
548
409
  };
@@ -564,7 +425,7 @@ the first capability step. Creates a new session implicitly unless
564
425
  `session_id` is provided (for step-up / reauth on an existing session).
565
426
 
566
427
  The response contains an `id` field — the flow handle. Use it as the path
567
- parameter for all subsequent `/flow/{id}/submit` and `/flow/{id}/event` calls.
428
+ parameter for all subsequent `/flow/{id}/submit` calls.
568
429
 
569
430
  The response also sets an encrypted `HttpOnly` cookie (`_zflow`) containing
570
431
  the flow's orchestration state (current step, collected data, history).
@@ -644,26 +505,6 @@ const submitFlowStep = async (id, submitFlowStepBody, options) => {
644
505
  body: JSON.stringify(submitFlowStepBody)
645
506
  });
646
507
  };
647
- const getSubmitFlowEventUrl = (id) => {
648
- return `${getProxyPath()}/flow/${id}/event`;
649
- };
650
- /**
651
- * Submits telemetry or fingerprint data from the frontend.
652
- Does not advance the state machine. Used for risk evaluation.
653
-
654
- * @summary Submit client-side event
655
- */
656
- const submitFlowEvent = async (id, submitFlowEventBody, options) => {
657
- return customFetch(getSubmitFlowEventUrl(id), {
658
- ...options,
659
- method: "POST",
660
- headers: {
661
- "Content-Type": "application/json",
662
- ...options?.headers
663
- },
664
- body: JSON.stringify(submitFlowEventBody)
665
- });
666
- };
667
508
  const getCreateAuthAttemptUrl = () => {
668
509
  return `${getProxyPath()}/auth_attempts`;
669
510
  };
@@ -851,6 +692,68 @@ const patchProject = async (projectId, patchProjectBody, options) => {
851
692
  body: JSON.stringify(patchProjectBody)
852
693
  });
853
694
  };
695
+ const getInitClaimUrl = (projectId) => {
696
+ return `${getProxyPath()}/projects/${projectId}/claim/init`;
697
+ };
698
+ /**
699
+ * Starts a claim challenge for an unclaimed project. Authenticated by the
700
+ project secret, this mints a single-use, short-lived challenge and returns
701
+ the `claim_url` the developer opens in a browser to complete the claim,
702
+ together with the `challenge_id` the CLI polls with. The exact expiry is
703
+ carried by `expires_at` on the response.
704
+
705
+ * @summary Initialize a project claim
706
+ */
707
+ const initClaim = async (projectId, options) => {
708
+ return customFetch(getInitClaimUrl(projectId), {
709
+ ...options,
710
+ method: "POST"
711
+ });
712
+ };
713
+ const getGetClaimStatusUrl = (projectId, params) => {
714
+ const normalizedParams = new URLSearchParams();
715
+ Object.entries(params || {}).forEach(([key, value]) => {
716
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
717
+ });
718
+ const stringifiedParams = normalizedParams.toString();
719
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/projects/${projectId}/claim/status?${stringifiedParams}` : `${getProxyPath()}/projects/${projectId}/claim/status`;
720
+ };
721
+ /**
722
+ * Polled by the CLI while a browser completes the claim. Authorized by the
723
+ project secret that initiated the challenge. Returns `pending`, or
724
+ `completed` with the owning team, the claim timestamp, and the dashboard
725
+ URL once the browser leg has finished.
726
+
727
+ * @summary Get claim status
728
+ */
729
+ const getClaimStatus = async (projectId, params, options) => {
730
+ return customFetch(getGetClaimStatusUrl(projectId, params), {
731
+ ...options,
732
+ method: "GET"
733
+ });
734
+ };
735
+ const getCompleteClaimUrl = (projectId) => {
736
+ return `${getProxyPath()}/projects/${projectId}/claim/complete`;
737
+ };
738
+ /**
739
+ * Called by the browser after the developer authenticates on the claim page.
740
+ Authenticated by the `__nextgen_session` cookie, it attaches the project to
741
+ the developer's personal team using the `challenge_id` from the claim URL as
742
+ its single-use, browser-safe authorization.
743
+
744
+ * @summary Complete a project claim
745
+ */
746
+ const completeClaim = async (projectId, completeClaimBody, options) => {
747
+ return customFetch(getCompleteClaimUrl(projectId), {
748
+ ...options,
749
+ method: "POST",
750
+ headers: {
751
+ "Content-Type": "application/json",
752
+ ...options?.headers
753
+ },
754
+ body: JSON.stringify(completeClaimBody)
755
+ });
756
+ };
854
757
  const getCreateSessionUrl = () => {
855
758
  return `${getProxyPath()}/sessions`;
856
759
  };
@@ -863,8 +766,16 @@ Use this explicitly when you want to:
863
766
  can be correlated with the eventual authenticated session from the start.
864
767
  - Track anonymous state (bot detection, device fingerprint) that survives until authentication.
865
768
 
866
- The returned `session_token` authorises GET and DELETE on this session.
867
- It is superseded when a handoff exchange completes — clients must replace it at that point.
769
+ Creating a session is an app-plane operation on the project credential
770
+ (`session.write`). The returned `session_token` is a session credential for the
771
+ end-user client, not a management scope: it is delivered as the
772
+ `__nextgen_session` cookie and authorises the self-service operations
773
+ `GET /sessions/me` and `DELETE /sessions/me` (`nextgenSession` scheme). The
774
+ by-id operations `GET /sessions/{session_id}` and `DELETE /sessions/{session_id}`
775
+ are operator endpoints and require `session.read` / `session.delete` instead.
776
+
777
+ The `session_token` is superseded when a handoff exchange completes — clients must
778
+ replace it at that point.
868
779
 
869
780
  Anonymous sessions expire aggressively (10-minute TTL). The TTL resets to the configured
870
781
  full session TTL when the first authentication factor is written via a completing `auth_attempt`.
@@ -882,24 +793,30 @@ const createSession = async (createSessionBody, options) => {
882
793
  body: JSON.stringify(createSessionBody)
883
794
  });
884
795
  };
885
- const getListSessionsUrl = (params) => {
796
+ const getQuerySessionsUrl = (params) => {
886
797
  const normalizedParams = new URLSearchParams();
887
798
  Object.entries(params || {}).forEach(([key, value]) => {
888
799
  if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
889
800
  });
890
801
  const stringifiedParams = normalizedParams.toString();
891
- return stringifiedParams.length > 0 ? `${getProxyPath()}/sessions?${stringifiedParams}` : `${getProxyPath()}/sessions`;
802
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/sessions/query?${stringifiedParams}` : `${getProxyPath()}/sessions/query`;
892
803
  };
893
804
  /**
894
- * Returns a paginated list of sessions for a project.
895
- Requires a project service key (OAuth2 client credentials).
805
+ * Returns the sessions of a project, paginated with a cursor.
806
+ Sessions of every lifecycle state are returned; each carries its `state`.
807
+ Requires `session.read` permission.
896
808
 
897
- * @summary List sessions
809
+ * @summary Query sessions
898
810
  */
899
- const listSessions = async (params, options) => {
900
- return customFetch(getListSessionsUrl(params), {
811
+ const querySessions = async (querySessionsBody, params, options) => {
812
+ return customFetch(getQuerySessionsUrl(params), {
901
813
  ...options,
902
- method: "GET"
814
+ method: "POST",
815
+ headers: {
816
+ "Content-Type": "application/json",
817
+ ...options?.headers
818
+ },
819
+ body: JSON.stringify(querySessionsBody)
903
820
  });
904
821
  };
905
822
  const getExchangeHandoffUrl = (params) => {
@@ -975,13 +892,15 @@ const getRevokeSessionUrl = (sessionId, params) => {
975
892
  return stringifiedParams.length > 0 ? `${getProxyPath()}/sessions/${sessionId}?${stringifiedParams}` : `${getProxyPath()}/sessions/${sessionId}`;
976
893
  };
977
894
  /**
978
- * Revokes the session immediately (`state: revoked`).
895
+ * Permanently deletes the session, terminating it immediately.
979
896
 
980
897
  This is the operator revoke path and requires the `session.delete` scope on a
981
898
  project-bound credential. End-user logout with the `__nextgen_session` cookie is
982
899
  `DELETE /sessions/me` (`nextgenSession` scheme).
983
900
 
984
- After revocation, any tokens derived from this session are invalidated.
901
+ Idempotent: deleting a session that does not exist (or was already deleted)
902
+ still returns 204. After deletion, any tokens derived from the session are
903
+ invalidated.
985
904
 
986
905
  * @summary Revoke session
987
906
  */
@@ -1014,10 +933,12 @@ const getRevokeMySessionUrl = () => {
1014
933
  return `${getProxyPath()}/sessions/me`;
1015
934
  };
1016
935
  /**
1017
- * Revokes the session immediately (`state: revoked`). This is the logout operation.
936
+ * Logs out by permanently deleting the session.
1018
937
 
1019
- The __nextgen_session cookie issued at creation (or superseded by a handoff exchange) is required.
1020
- After revocation, any tokens derived from this session are invalidated including the cookie itself, which is cleared in the response.
938
+ The `__nextgen_session` cookie issued at creation (or superseded by a handoff
939
+ exchange) is required. Idempotent: if the session is already gone this still
940
+ returns 204. Any tokens derived from the session are invalidated, and the
941
+ cookie itself is cleared in the response.
1021
942
 
1022
943
  * @summary Revoke my session
1023
944
  */
@@ -1036,10 +957,12 @@ const getCreateSchemaUrl = (params) => {
1036
957
  return stringifiedParams.length > 0 ? `${getProxyPath()}/schemas?${stringifiedParams}` : `${getProxyPath()}/schemas`;
1037
958
  };
1038
959
  /**
1039
- * Create a new schema. The schema definition must include a unique $id field,
1040
- which will be used to identify the schema in future requests. The $id must
1041
- be a valid URI and should ideally point to the location where the schema
1042
- can be accessed.
960
+ * Create a new schema. The optional `$id` field is the JSON Schema document
961
+ URI used to identify the schema in future requests (GitOps-stable identity,
962
+ not a free-form resource primary key). When `$id` is omitted, the server
963
+ generates a `sch_*` URL. When provided, `$id` must be unique within the
964
+ project and should ideally be a valid URI pointing at where the schema can
965
+ be accessed.
1043
966
 
1044
967
  The schema can either be a concrete schema, e.g. a user schema, or a
1045
968
  schema-url which will be resolved by the server.
@@ -1202,70 +1125,99 @@ const deleteFlowDefinition = async (id, params, options) => {
1202
1125
  method: "DELETE"
1203
1126
  });
1204
1127
  };
1205
- const getActivateFlowDefinitionUrl = (id, params) => {
1128
+ const getCreateTeamUrl = (params) => {
1206
1129
  const normalizedParams = new URLSearchParams();
1207
1130
  Object.entries(params || {}).forEach(([key, value]) => {
1208
1131
  if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
1209
1132
  });
1210
1133
  const stringifiedParams = normalizedParams.toString();
1211
- return stringifiedParams.length > 0 ? `${getProxyPath()}/flow_definitions/${id}/activate?${stringifiedParams}` : `${getProxyPath()}/flow_definitions/${id}/activate`;
1134
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/teams?${stringifiedParams}` : `${getProxyPath()}/teams`;
1212
1135
  };
1213
1136
  /**
1214
- * Activate a flow definition by transitioning it from a `draft` state to an `active` state.
1215
- Alternatively, the status of a flow definition can also be set via the `POST /flow_definitions` and `PUT /flow_definitions/{id}` endpoints by setting the `status` attribute in the flow definition payload.
1137
+ * @summary Create team
1138
+ */
1139
+ const createTeam = async (createTeamBody, params, options) => {
1140
+ return customFetch(getCreateTeamUrl(params), {
1141
+ ...options,
1142
+ method: "POST",
1143
+ headers: {
1144
+ "Content-Type": "application/json",
1145
+ ...options?.headers
1146
+ },
1147
+ body: JSON.stringify(createTeamBody)
1148
+ });
1149
+ };
1150
+ const getQueryTeamsUrl = (params) => {
1151
+ const normalizedParams = new URLSearchParams();
1152
+ Object.entries(params || {}).forEach(([key, value]) => {
1153
+ if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
1154
+ });
1155
+ const stringifiedParams = normalizedParams.toString();
1156
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/teams/query?${stringifiedParams}` : `${getProxyPath()}/teams/query`;
1157
+ };
1158
+ /**
1159
+ * Returns the teams of a project, paginated with a cursor.
1160
+ Teams of every lifecycle status are returned; each carries its `status`.
1216
1161
 
1217
- * @summary Activate a flow definition by ID.
1162
+ * @summary Query teams
1218
1163
  */
1219
- const activateFlowDefinition = async (id, params, options) => {
1220
- return customFetch(getActivateFlowDefinitionUrl(id, params), {
1164
+ const queryTeams = async (queryTeamsBody, params, options) => {
1165
+ return customFetch(getQueryTeamsUrl(params), {
1221
1166
  ...options,
1222
- method: "POST"
1167
+ method: "POST",
1168
+ headers: {
1169
+ "Content-Type": "application/json",
1170
+ ...options?.headers
1171
+ },
1172
+ body: JSON.stringify(queryTeamsBody)
1223
1173
  });
1224
1174
  };
1225
- const getDeactivateFlowDefinitionUrl = (id, params) => {
1175
+ const getGetTeamUrl = (teamId, params) => {
1226
1176
  const normalizedParams = new URLSearchParams();
1227
1177
  Object.entries(params || {}).forEach(([key, value]) => {
1228
1178
  if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
1229
1179
  });
1230
1180
  const stringifiedParams = normalizedParams.toString();
1231
- return stringifiedParams.length > 0 ? `${getProxyPath()}/flow_definitions/${id}/deactivate?${stringifiedParams}` : `${getProxyPath()}/flow_definitions/${id}/deactivate`;
1181
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/teams/${teamId}?${stringifiedParams}` : `${getProxyPath()}/teams/${teamId}`;
1232
1182
  };
1233
1183
  /**
1234
- * Deactivates a flow definition in the `active` state by transitioning it to the `draft` state.
1235
- Flow definitions in `draft` state cannot be used to start new flows. Existing flows that use the deactivated flow definition must gracefully handle this.
1236
- Alternatively, the status of a flow definition can also be set via the `POST /flow_definitions` and `PUT /flow_definitions/{id}` endpoints by setting the `status` attribute in the flow definition payload.
1184
+ * Returns a Team by its id.
1237
1185
 
1238
- * @summary Deactivate a flow definition by ID.
1186
+ * @summary Get team
1239
1187
  */
1240
- const deactivateFlowDefinition = async (id, params, options) => {
1241
- return customFetch(getDeactivateFlowDefinitionUrl(id, params), {
1188
+ const getTeam = async (teamId, params, options) => {
1189
+ return customFetch(getGetTeamUrl(teamId, params), {
1242
1190
  ...options,
1243
- method: "POST"
1191
+ method: "GET"
1244
1192
  });
1245
1193
  };
1246
- const getCreateTeamUrl = (params) => {
1194
+ const getDeleteTeamUrl = (teamId, params) => {
1247
1195
  const normalizedParams = new URLSearchParams();
1248
1196
  Object.entries(params || {}).forEach(([key, value]) => {
1249
1197
  if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
1250
1198
  });
1251
1199
  const stringifiedParams = normalizedParams.toString();
1252
- return stringifiedParams.length > 0 ? `${getProxyPath()}/teams?${stringifiedParams}` : `${getProxyPath()}/teams`;
1200
+ return stringifiedParams.length > 0 ? `${getProxyPath()}/teams/${teamId}?${stringifiedParams}` : `${getProxyPath()}/teams/${teamId}`;
1253
1201
  };
1254
1202
  /**
1255
- * @summary Create team
1203
+ * Deactivates the team.
1204
+
1205
+ The team is tombstoned rather than erased: it stays readable through
1206
+ getTeam with status `deactivated`. Its memberships are removed and the
1207
+ users whose lifecycle it owns are deactivated with it.
1208
+
1209
+ The request is idempotent. Deleting a team that is already deactivated
1210
+ or doesn't exist succeeds without changing anything.
1211
+
1212
+ * @summary Delete team
1256
1213
  */
1257
- const createTeam = async (createTeamBody, params, options) => {
1258
- return customFetch(getCreateTeamUrl(params), {
1214
+ const deleteTeam = async (teamId, params, options) => {
1215
+ return customFetch(getDeleteTeamUrl(teamId, params), {
1259
1216
  ...options,
1260
- method: "POST",
1261
- headers: {
1262
- "Content-Type": "application/json",
1263
- ...options?.headers
1264
- },
1265
- body: JSON.stringify(createTeamBody)
1217
+ method: "DELETE"
1266
1218
  });
1267
1219
  };
1268
- const getGetTeamUrl = (teamId, params) => {
1220
+ const getUpdateTeamUrl = (teamId, params) => {
1269
1221
  const normalizedParams = new URLSearchParams();
1270
1222
  Object.entries(params || {}).forEach(([key, value]) => {
1271
1223
  if (value !== void 0) normalizedParams.append(key, value === null ? "null" : value.toString());
@@ -1274,14 +1226,19 @@ const getGetTeamUrl = (teamId, params) => {
1274
1226
  return stringifiedParams.length > 0 ? `${getProxyPath()}/teams/${teamId}?${stringifiedParams}` : `${getProxyPath()}/teams/${teamId}`;
1275
1227
  };
1276
1228
  /**
1277
- * Returns the current state of a team.
1229
+ * Update team. Only active teams can be updated.
1278
1230
 
1279
- * @summary Get team
1231
+ * @summary Update team
1280
1232
  */
1281
- const getTeam = async (teamId, params, options) => {
1282
- return customFetch(getGetTeamUrl(teamId, params), {
1233
+ const updateTeam = async (teamId, updateTeamBody, params, options) => {
1234
+ return customFetch(getUpdateTeamUrl(teamId, params), {
1283
1235
  ...options,
1284
- method: "GET"
1236
+ method: "PATCH",
1237
+ headers: {
1238
+ "Content-Type": "application/json",
1239
+ ...options?.headers
1240
+ },
1241
+ body: JSON.stringify(updateTeamBody)
1285
1242
  });
1286
1243
  };
1287
1244
  const getCreateBrandingUrl = (params) => {
@@ -1383,7 +1340,7 @@ const getBrandingById = async (id, params, options) => {
1383
1340
  * generated orval function:
1384
1341
  *
1385
1342
  * const client = createZitadelClient({ baseUrl, token });
1386
- * await client.createProject({ previewOrigins: [] });
1343
+ * await client.createProject({ preview_origins: [] });
1387
1344
  * await client.createSchema(body, { project_id });
1388
1345
  */
1389
1346
  function createZitadelClient(opts) {
@@ -1832,12 +1789,12 @@ async function bootstrapProject(options) {
1832
1789
  const { baseUrl } = options;
1833
1790
  const project = await createZitadelClient({ baseUrl }).createProject({
1834
1791
  name: options.projectName ?? DEFAULT_PROJECT_NAME,
1835
- previewOrigins: options.appOrigins ?? [],
1836
- seedDefaults: false
1792
+ preview_origins: options.appOrigins ?? [],
1793
+ seed_defaults: false
1837
1794
  });
1838
1795
  const projectId = requireString(project.id, "project id");
1839
- const projectSecret = requireString(project.projectSecret, "project secret");
1840
- const previewSecret = typeof project.previewSecret === "string" ? project.previewSecret : void 0;
1796
+ const projectSecret = requireString(project.project_secret, "project secret");
1797
+ const previewSecret = typeof project.preview_secret === "string" ? project.preview_secret : void 0;
1841
1798
  const client = createZitadelClient({
1842
1799
  baseUrl,
1843
1800
  token: projectSecret
@@ -1988,9 +1945,8 @@ function getFreePort() {
1988
1945
  /**
1989
1946
  * Boot an ephemeral local server by shelling out to `zitadel start` and parse
1990
1947
  * its JSON envelope. The CLI owns the subtle parts (port preflight, health
1991
- * wait, process-group stop, embedded-Postgres reaping), so this module stays a
1992
- * thin adapter; swapping it for direct library calls later must not change the
1993
- * shape returned here.
1948
+ * wait, process-group stop), so this module stays a thin adapter; swapping it
1949
+ * for direct library calls later must not change the shape returned here.
1994
1950
  */
1995
1951
  async function bootLocalServer(options = {}) {
1996
1952
  const ownsDir = options.dir === void 0;
@@ -2096,7 +2052,7 @@ function identity() {
2096
2052
  /**
2097
2053
  * Create a user that can immediately complete the password login flow:
2098
2054
  * `POST /users` (the body must carry `$schema: <schema id>`) followed by
2099
- * `PUT /users/{id}/password` with `isChangeRequired: false`.
2055
+ * `PUT /users/{id}/password` with `is_change_required: false`.
2100
2056
  *
2101
2057
  * Defaults mint a unique email per call (email is x-unique per project), which
2102
2058
  * is what makes per-test seeding parallel-safe on a shared instance.
@@ -2112,7 +2068,7 @@ async function seedUser(client, context, input = {}) {
2112
2068
  }, { project_id: context.projectId })).id, "user id");
2113
2069
  await client.setUserPassword(id, {
2114
2070
  password,
2115
- isChangeRequired: false
2071
+ is_change_required: false
2116
2072
  }, { project_id: context.projectId });
2117
2073
  return {
2118
2074
  id,
@@ -2284,7 +2240,7 @@ function connectZitadel(handle) {
2284
2240
  };
2285
2241
  }
2286
2242
  /**
2287
- * Boot an ephemeral local instance (binary runtime + embedded Postgres, no
2243
+ * Boot an ephemeral local instance (binary runtime + SQLite by default, no
2288
2244
  * Docker) and bootstrap a project + default schema + login flow on it. The
2289
2245
  * result can seed loginable password users immediately.
2290
2246
  */
@@ -2353,4 +2309,4 @@ Object.defineProperty(exports, "startLocalZitadel", {
2353
2309
  }
2354
2310
  });
2355
2311
 
2356
- //# sourceMappingURL=src-BIL0PdSd.cjs.map
2312
+ //# sourceMappingURL=src-DirKLqi4.cjs.map