@zitadel/testing 1.0.0-alpha.25 → 1.0.0-alpha.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -18
- package/dist/app-runner.cjs +1 -1
- package/dist/app-runner.mjs +1 -1
- package/dist/{handshake-BBrTG-5P.mjs → handshake-CwlxMjW0.mjs} +7 -4
- package/dist/handshake-CwlxMjW0.mjs.map +1 -0
- package/dist/{handshake-Cds_mGAO.cjs → handshake-D6MXSUcd.cjs} +7 -4
- package/dist/handshake-D6MXSUcd.cjs.map +1 -0
- package/dist/index.cjs +4 -2
- package/dist/index.d.mts +2 -7
- package/dist/index.d.mts.map +1 -1
- package/dist/index.mjs +3 -3
- package/dist/playwright.cjs +10 -3
- package/dist/playwright.cjs.map +1 -1
- package/dist/playwright.d.mts +7 -5
- package/dist/playwright.d.mts.map +1 -1
- package/dist/playwright.mjs +8 -4
- package/dist/playwright.mjs.map +1 -1
- package/dist/{app-env-CAfV3fk_.d.mts → session-BrSkzPpy.d.mts} +36 -5
- package/dist/session-BrSkzPpy.d.mts.map +1 -0
- package/dist/{src-CXX_iT7z.cjs → src-BbHs0YmP.cjs} +661 -164
- package/dist/src-BbHs0YmP.cjs.map +1 -0
- package/dist/{src-DhQK55R7.mjs → src-DKJ1hMV8.mjs} +33 -7
- package/dist/src-DKJ1hMV8.mjs.map +1 -0
- package/dist/supervisor.cjs +2 -2
- package/dist/supervisor.mjs +2 -2
- package/package.json +8 -6
- package/dist/app-env-CAfV3fk_.d.mts.map +0 -1
- package/dist/handshake-BBrTG-5P.mjs.map +0 -1
- package/dist/handshake-Cds_mGAO.cjs.map +0 -1
- package/dist/src-CXX_iT7z.cjs.map +0 -1
- package/dist/src-DhQK55R7.mjs.map +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
const require_handshake = require("./handshake-
|
|
1
|
+
const require_handshake = require("./handshake-D6MXSUcd.cjs");
|
|
2
2
|
require("node:fs");
|
|
3
3
|
require("node:url");
|
|
4
4
|
let node_fs_promises = require("node:fs/promises");
|
|
@@ -306,7 +306,9 @@ var __exportAll = (all, no_symbols) => {
|
|
|
306
306
|
* OpenAPI spec version: 0.0.1
|
|
307
307
|
*/
|
|
308
308
|
var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
309
|
+
addOrigin: () => addOrigin,
|
|
309
310
|
beginUserPasskeyRegistration: () => beginUserPasskeyRegistration,
|
|
311
|
+
buildRelease: () => buildRelease,
|
|
310
312
|
completeClaim: () => completeClaim,
|
|
311
313
|
createAuthAttempt: () => createAuthAttempt,
|
|
312
314
|
createBranding: () => createBranding,
|
|
@@ -328,9 +330,11 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
328
330
|
deleteVariable: () => deleteVariable,
|
|
329
331
|
exchangeHandoff: () => exchangeHandoff,
|
|
330
332
|
finishUserPasskeyRegistration: () => finishUserPasskeyRegistration,
|
|
333
|
+
getAddOriginUrl: () => getAddOriginUrl,
|
|
331
334
|
getAuthAttempt: () => getAuthAttempt,
|
|
332
335
|
getBeginUserPasskeyRegistrationUrl: () => getBeginUserPasskeyRegistrationUrl,
|
|
333
336
|
getBrandingById: () => getBrandingById,
|
|
337
|
+
getBuildReleaseUrl: () => getBuildReleaseUrl,
|
|
334
338
|
getClaimStatus: () => getClaimStatus,
|
|
335
339
|
getClaimWindow: () => getClaimWindow,
|
|
336
340
|
getCompleteClaimUrl: () => getCompleteClaimUrl,
|
|
@@ -353,7 +357,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
353
357
|
getDeleteUserByIDUrl: () => getDeleteUserByIDUrl,
|
|
354
358
|
getDeleteVariableUrl: () => getDeleteVariableUrl,
|
|
355
359
|
getDeploymentById: () => getDeploymentById,
|
|
356
|
-
|
|
360
|
+
getDeploymentVariables: () => getDeploymentVariables,
|
|
357
361
|
getEvent: () => getEvent,
|
|
358
362
|
getExchangeHandoffUrl: () => getExchangeHandoffUrl,
|
|
359
363
|
getFinishUserPasskeyRegistrationUrl: () => getFinishUserPasskeyRegistrationUrl,
|
|
@@ -364,7 +368,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
364
368
|
getGetClaimStatusUrl: () => getGetClaimStatusUrl,
|
|
365
369
|
getGetClaimWindowUrl: () => getGetClaimWindowUrl,
|
|
366
370
|
getGetDeploymentByIdUrl: () => getGetDeploymentByIdUrl,
|
|
367
|
-
|
|
371
|
+
getGetDeploymentVariablesUrl: () => getGetDeploymentVariablesUrl,
|
|
368
372
|
getGetEventUrl: () => getGetEventUrl,
|
|
369
373
|
getGetFlowDefinitionUrl: () => getGetFlowDefinitionUrl,
|
|
370
374
|
getGetFlowStepUrl: () => getGetFlowStepUrl,
|
|
@@ -375,6 +379,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
375
379
|
getGetLiveUrl: () => getGetLiveUrl,
|
|
376
380
|
getGetMySessionCsrfTokenUrl: () => getGetMySessionCsrfTokenUrl,
|
|
377
381
|
getGetMySessionUrl: () => getGetMySessionUrl,
|
|
382
|
+
getGetMyUserSchemaUrl: () => getGetMyUserSchemaUrl,
|
|
378
383
|
getGetMyUserUrl: () => getGetMyUserUrl,
|
|
379
384
|
getGetProjectUrl: () => getGetProjectUrl,
|
|
380
385
|
getGetReadyUrl: () => getGetReadyUrl,
|
|
@@ -393,19 +398,22 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
393
398
|
getIssueChallengeUrl: () => getIssueChallengeUrl,
|
|
394
399
|
getListBrandingUrl: () => getListBrandingUrl,
|
|
395
400
|
getListDeploymentsUrl: () => getListDeploymentsUrl,
|
|
396
|
-
getListEnvironmentsUrl: () => getListEnvironmentsUrl,
|
|
397
401
|
getListEventsUrl: () => getListEventsUrl,
|
|
398
402
|
getListFlowDefinitionsUrl: () => getListFlowDefinitionsUrl,
|
|
399
403
|
getListIdpRevisionsUrl: () => getListIdpRevisionsUrl,
|
|
400
404
|
getListMyProjectsUrl: () => getListMyProjectsUrl,
|
|
405
|
+
getListMyTeamsUrl: () => getListMyTeamsUrl,
|
|
406
|
+
getListPreviewsUrl: () => getListPreviewsUrl,
|
|
401
407
|
getListReleasesUrl: () => getListReleasesUrl,
|
|
402
408
|
getListSchemasUrl: () => getListSchemasUrl,
|
|
409
|
+
getListUserIdentityLinksUrl: () => getListUserIdentityLinksUrl,
|
|
403
410
|
getListUserPasskeysUrl: () => getListUserPasskeysUrl,
|
|
404
411
|
getListUserTeamsUrl: () => getListUserTeamsUrl,
|
|
405
412
|
getLive: () => getLive,
|
|
406
413
|
getMySession: () => getMySession,
|
|
407
414
|
getMySessionCsrfToken: () => getMySessionCsrfToken,
|
|
408
415
|
getMyUser: () => getMyUser,
|
|
416
|
+
getMyUserSchema: () => getMyUserSchema,
|
|
409
417
|
getPatchMyUserUrl: () => getPatchMyUserUrl,
|
|
410
418
|
getPatchProjectUrl: () => getPatchProjectUrl,
|
|
411
419
|
getPatchUserByIDUrl: () => getPatchUserByIDUrl,
|
|
@@ -418,8 +426,12 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
418
426
|
getQueryUsersUrl: () => getQueryUsersUrl,
|
|
419
427
|
getReady: () => getReady,
|
|
420
428
|
getReleaseById: () => getReleaseById,
|
|
429
|
+
getRemoveOriginUrl: () => getRemoveOriginUrl,
|
|
430
|
+
getRemovePreviewUrl: () => getRemovePreviewUrl,
|
|
421
431
|
getRevokeMySessionUrl: () => getRevokeMySessionUrl,
|
|
432
|
+
getRevokeReleaseUrl: () => getRevokeReleaseUrl,
|
|
422
433
|
getRevokeSessionUrl: () => getRevokeSessionUrl,
|
|
434
|
+
getRollbackDeploymentUrl: () => getRollbackDeploymentUrl,
|
|
423
435
|
getSchemaById: () => getSchemaById,
|
|
424
436
|
getSession: () => getSession,
|
|
425
437
|
getSetUserPasswordUrl: () => getSetUserPasswordUrl,
|
|
@@ -435,13 +447,15 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
435
447
|
issueChallenge: () => issueChallenge,
|
|
436
448
|
listBranding: () => listBranding,
|
|
437
449
|
listDeployments: () => listDeployments,
|
|
438
|
-
listEnvironments: () => listEnvironments,
|
|
439
450
|
listEvents: () => listEvents,
|
|
440
451
|
listFlowDefinitions: () => listFlowDefinitions,
|
|
441
452
|
listIdpRevisions: () => listIdpRevisions,
|
|
442
453
|
listMyProjects: () => listMyProjects,
|
|
454
|
+
listMyTeams: () => listMyTeams,
|
|
455
|
+
listPreviews: () => listPreviews,
|
|
443
456
|
listReleases: () => listReleases,
|
|
444
457
|
listSchemas: () => listSchemas,
|
|
458
|
+
listUserIdentityLinks: () => listUserIdentityLinks,
|
|
445
459
|
listUserPasskeys: () => listUserPasskeys,
|
|
446
460
|
listUserTeams: () => listUserTeams,
|
|
447
461
|
patchMyUser: () => patchMyUser,
|
|
@@ -453,8 +467,12 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
453
467
|
querySessions: () => querySessions,
|
|
454
468
|
queryTeams: () => queryTeams,
|
|
455
469
|
queryUsers: () => queryUsers,
|
|
470
|
+
removeOrigin: () => removeOrigin,
|
|
471
|
+
removePreview: () => removePreview,
|
|
456
472
|
revokeMySession: () => revokeMySession,
|
|
473
|
+
revokeRelease: () => revokeRelease,
|
|
457
474
|
revokeSession: () => revokeSession,
|
|
475
|
+
rollbackDeployment: () => rollbackDeployment,
|
|
458
476
|
setUserPassword: () => setUserPassword,
|
|
459
477
|
submitFlowStep: () => submitFlowStep,
|
|
460
478
|
updateTeam: () => updateTeam,
|
|
@@ -509,6 +527,11 @@ const getCreateUserUrl = (params) => {
|
|
|
509
527
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/users?${stringifiedParams}` : `${getProxyPath()}/users`;
|
|
510
528
|
};
|
|
511
529
|
/**
|
|
530
|
+
* Creates a user whose attributes satisfy the user schema the request names.
|
|
531
|
+
*
|
|
532
|
+
* The server assigns the user's id. With `team_id`, the user also becomes an
|
|
533
|
+
* active member of that team. A value the schema marks unique that another
|
|
534
|
+
* user already holds is refused with `409`.
|
|
512
535
|
* @summary Create user
|
|
513
536
|
*/
|
|
514
537
|
const createUser = async (createUserBody, params, options) => {
|
|
@@ -577,6 +600,10 @@ const getGetUserByIDUrl = (userId, params) => {
|
|
|
577
600
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/${encodeURIComponent(String(userId))}?${stringifiedParams}` : `${getProxyPath()}/users/${encodeURIComponent(String(userId))}`;
|
|
578
601
|
};
|
|
579
602
|
/**
|
|
603
|
+
* Returns a user by its id, with the attributes its schema defines.
|
|
604
|
+
*
|
|
605
|
+
* With `team_id`, the user is returned only while they are an active member of
|
|
606
|
+
* that team.
|
|
580
607
|
* @summary Get user by ID
|
|
581
608
|
*/
|
|
582
609
|
const getUserByID = async (userId, params, options) => {
|
|
@@ -618,6 +645,11 @@ const getDeleteUserByIDUrl = (userId) => {
|
|
|
618
645
|
return `${getProxyPath()}/users/${encodeURIComponent(String(userId))}`;
|
|
619
646
|
};
|
|
620
647
|
/**
|
|
648
|
+
* Deletes a user and removes them from every team they belong to.
|
|
649
|
+
*
|
|
650
|
+
* The user is removed, not deactivated, and the deletion emits `user.deleted`.
|
|
651
|
+
* With a project secret the request is idempotent: deleting a user that exists
|
|
652
|
+
* in no project succeeds without changing anything.
|
|
621
653
|
* @summary Delete user by ID
|
|
622
654
|
*/
|
|
623
655
|
const deleteUserByID = async (userId, options) => {
|
|
@@ -626,6 +658,25 @@ const deleteUserByID = async (userId, options) => {
|
|
|
626
658
|
method: "DELETE"
|
|
627
659
|
});
|
|
628
660
|
};
|
|
661
|
+
const getListUserIdentityLinksUrl = (userId, params) => {
|
|
662
|
+
const normalizedParams = new URLSearchParams();
|
|
663
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
664
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
665
|
+
});
|
|
666
|
+
const stringifiedParams = normalizedParams.toString();
|
|
667
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/${encodeURIComponent(String(userId))}/identity_links?${stringifiedParams}` : `${getProxyPath()}/users/${encodeURIComponent(String(userId))}/identity_links`;
|
|
668
|
+
};
|
|
669
|
+
/**
|
|
670
|
+
* The identity provider accounts a sign-in linked to the user, oldest first.
|
|
671
|
+
* The provider's subject and claims are never returned.
|
|
672
|
+
* @summary List the provider accounts linked to a user
|
|
673
|
+
*/
|
|
674
|
+
const listUserIdentityLinks = async (userId, params, options) => {
|
|
675
|
+
return customFetch(getListUserIdentityLinksUrl(userId, params), {
|
|
676
|
+
...options,
|
|
677
|
+
method: "GET"
|
|
678
|
+
});
|
|
679
|
+
};
|
|
629
680
|
const getListUserPasskeysUrl = (userId, params) => {
|
|
630
681
|
const normalizedParams = new URLSearchParams();
|
|
631
682
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -635,6 +686,11 @@ const getListUserPasskeysUrl = (userId, params) => {
|
|
|
635
686
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/${encodeURIComponent(String(userId))}/passkeys?${stringifiedParams}` : `${getProxyPath()}/users/${encodeURIComponent(String(userId))}/passkeys`;
|
|
636
687
|
};
|
|
637
688
|
/**
|
|
689
|
+
* Returns the passkeys registered for a user, newest first, paginated with a
|
|
690
|
+
* cursor.
|
|
691
|
+
*
|
|
692
|
+
* Each passkey carries its id, its name and when it was registered, never the
|
|
693
|
+
* credential itself.
|
|
638
694
|
* @summary List user passkeys
|
|
639
695
|
*/
|
|
640
696
|
const listUserPasskeys = async (userId, params, options) => {
|
|
@@ -708,6 +764,11 @@ const getSetUserPasswordUrl = (userId) => {
|
|
|
708
764
|
return `${getProxyPath()}/users/${encodeURIComponent(String(userId))}/password`;
|
|
709
765
|
};
|
|
710
766
|
/**
|
|
767
|
+
* Sets a user's password, hashed with the project's current password hashing
|
|
768
|
+
* policy.
|
|
769
|
+
*
|
|
770
|
+
* The new password replaces the current one, and setting it emits
|
|
771
|
+
* `auth.factor.password.set`.
|
|
711
772
|
* @summary Set user password
|
|
712
773
|
*/
|
|
713
774
|
const setUserPassword = async (userId, setUserPasswordBody, options) => {
|
|
@@ -753,28 +814,48 @@ const listUserTeams = async (userId, params, options) => {
|
|
|
753
814
|
method: "GET"
|
|
754
815
|
});
|
|
755
816
|
};
|
|
756
|
-
const getGetMyUserUrl = () => {
|
|
757
|
-
|
|
817
|
+
const getGetMyUserUrl = (params) => {
|
|
818
|
+
const normalizedParams = new URLSearchParams();
|
|
819
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
820
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
821
|
+
});
|
|
822
|
+
const stringifiedParams = normalizedParams.toString();
|
|
823
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/me?${stringifiedParams}` : `${getProxyPath()}/users/me`;
|
|
758
824
|
};
|
|
759
825
|
/**
|
|
826
|
+
* Returns the user signed in to the session that authenticates the request.
|
|
827
|
+
*
|
|
828
|
+
* The project and the user both come from the session cookie, so a caller only
|
|
829
|
+
* ever reads their own user.
|
|
830
|
+
*
|
|
831
|
+
* With `project_id`, the user is returned only when the session belongs to
|
|
832
|
+
* that project.
|
|
760
833
|
* @summary Get my user information
|
|
761
834
|
*/
|
|
762
|
-
const getMyUser = async (options) => {
|
|
763
|
-
return customFetch(getGetMyUserUrl(), {
|
|
835
|
+
const getMyUser = async (params, options) => {
|
|
836
|
+
return customFetch(getGetMyUserUrl(params), {
|
|
764
837
|
...options,
|
|
765
838
|
method: "GET"
|
|
766
839
|
});
|
|
767
840
|
};
|
|
768
|
-
const getPatchMyUserUrl = () => {
|
|
769
|
-
|
|
841
|
+
const getPatchMyUserUrl = (params) => {
|
|
842
|
+
const normalizedParams = new URLSearchParams();
|
|
843
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
844
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
845
|
+
});
|
|
846
|
+
const stringifiedParams = normalizedParams.toString();
|
|
847
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/me?${stringifiedParams}` : `${getProxyPath()}/users/me`;
|
|
770
848
|
};
|
|
771
849
|
/**
|
|
772
850
|
* Partially updates the caller's own schema-defined attributes. The merged
|
|
773
851
|
* result is validated against the user's schema before commit. Concurrent
|
|
774
852
|
* writes are last-write-wins.
|
|
853
|
+
*
|
|
854
|
+
* With `project_id`, the user is updated only when the session belongs to
|
|
855
|
+
* that project.
|
|
775
856
|
* @summary Update my user information
|
|
776
857
|
*/
|
|
777
|
-
const patchMyUser = async (patchMyUserBody, options) => {
|
|
858
|
+
const patchMyUser = async (patchMyUserBody, params, options) => {
|
|
778
859
|
const getHeaders = (h) => {
|
|
779
860
|
if (!h) return {};
|
|
780
861
|
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
@@ -783,7 +864,7 @@ const patchMyUser = async (patchMyUserBody, options) => {
|
|
|
783
864
|
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
784
865
|
return headers;
|
|
785
866
|
};
|
|
786
|
-
return customFetch(getPatchMyUserUrl(), {
|
|
867
|
+
return customFetch(getPatchMyUserUrl(params), {
|
|
787
868
|
...options,
|
|
788
869
|
method: "PATCH",
|
|
789
870
|
headers: {
|
|
@@ -809,6 +890,10 @@ const getListMyProjectsUrl = (params) => {
|
|
|
809
890
|
* This is not the same question as `queryProjects`, which answers with the one
|
|
810
891
|
* project the calling credential is bound to. Here the session is the caller
|
|
811
892
|
* and the grants are the answer, so the list spans projects.
|
|
893
|
+
*
|
|
894
|
+
* With `project_id`, the projects are listed only when the session belongs to
|
|
895
|
+
* that project. It names the project the session was signed in to, not one to
|
|
896
|
+
* list.
|
|
812
897
|
* @summary List the projects I can act on
|
|
813
898
|
*/
|
|
814
899
|
const listMyProjects = async (params, options) => {
|
|
@@ -817,6 +902,48 @@ const listMyProjects = async (params, options) => {
|
|
|
817
902
|
method: "GET"
|
|
818
903
|
});
|
|
819
904
|
};
|
|
905
|
+
const getGetMyUserSchemaUrl = (params) => {
|
|
906
|
+
const normalizedParams = new URLSearchParams();
|
|
907
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
908
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
909
|
+
});
|
|
910
|
+
const stringifiedParams = normalizedParams.toString();
|
|
911
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/me/schema?${stringifiedParams}` : `${getProxyPath()}/users/me/schema`;
|
|
912
|
+
};
|
|
913
|
+
/**
|
|
914
|
+
* The schema the signed-in user's own record is validated against.
|
|
915
|
+
*
|
|
916
|
+
* With `project_id`, the schema is returned only when the session belongs to
|
|
917
|
+
* that project.
|
|
918
|
+
* @summary Get my user schema
|
|
919
|
+
*/
|
|
920
|
+
const getMyUserSchema = async (params, options) => {
|
|
921
|
+
return customFetch(getGetMyUserSchemaUrl(params), {
|
|
922
|
+
...options,
|
|
923
|
+
method: "GET"
|
|
924
|
+
});
|
|
925
|
+
};
|
|
926
|
+
const getListMyTeamsUrl = (params) => {
|
|
927
|
+
const normalizedParams = new URLSearchParams();
|
|
928
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
929
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
930
|
+
});
|
|
931
|
+
const stringifiedParams = normalizedParams.toString();
|
|
932
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/me/teams?${stringifiedParams}` : `${getProxyPath()}/users/me/teams`;
|
|
933
|
+
};
|
|
934
|
+
/**
|
|
935
|
+
* The signed-in user's own team roster, ordered by team name.
|
|
936
|
+
*
|
|
937
|
+
* With `project_id`, the teams are listed only when the session belongs to
|
|
938
|
+
* that project.
|
|
939
|
+
* @summary List the teams I belong to
|
|
940
|
+
*/
|
|
941
|
+
const listMyTeams = async (params, options) => {
|
|
942
|
+
return customFetch(getListMyTeamsUrl(params), {
|
|
943
|
+
...options,
|
|
944
|
+
method: "GET"
|
|
945
|
+
});
|
|
946
|
+
};
|
|
820
947
|
const getCreateFlowUrl = () => {
|
|
821
948
|
return `${getProxyPath()}/flow`;
|
|
822
949
|
};
|
|
@@ -1083,6 +1210,12 @@ const getCreateProjectUrl = () => {
|
|
|
1083
1210
|
return `${getProxyPath()}/projects`;
|
|
1084
1211
|
};
|
|
1085
1212
|
/**
|
|
1213
|
+
* Creates a project and returns its project secret and preview secret, which no
|
|
1214
|
+
* other endpoint returns.
|
|
1215
|
+
*
|
|
1216
|
+
* The request needs no credential and is rate-limited. Unless `seed_defaults` is
|
|
1217
|
+
* `false`, the project starts with a default user schema and flow; the CLI turns
|
|
1218
|
+
* that off and uploads its own from `.zitadel/`.
|
|
1086
1219
|
* @summary Create project
|
|
1087
1220
|
*/
|
|
1088
1221
|
const createProject = async (createProjectBody, options) => {
|
|
@@ -1108,6 +1241,12 @@ const getQueryProjectsUrl = () => {
|
|
|
1108
1241
|
return `${getProxyPath()}/projects/query`;
|
|
1109
1242
|
};
|
|
1110
1243
|
/**
|
|
1244
|
+
* Returns the project the project secret belongs to, as a page of at most one
|
|
1245
|
+
* project.
|
|
1246
|
+
*
|
|
1247
|
+
* A credential is scoped to one project until ADR 036 widens it, so the filters
|
|
1248
|
+
* and sorting apply to that project alone. The projects a signed-in person can
|
|
1249
|
+
* act on are listed by `GET /users/me/projects`.
|
|
1111
1250
|
* @summary Query projects
|
|
1112
1251
|
*/
|
|
1113
1252
|
const queryProjects = async (queryProjectsBody, options) => {
|
|
@@ -1262,6 +1401,118 @@ const getClaimWindow = async (projectId, params, options) => {
|
|
|
1262
1401
|
method: "GET"
|
|
1263
1402
|
});
|
|
1264
1403
|
};
|
|
1404
|
+
const getAddOriginUrl = (projectId) => {
|
|
1405
|
+
return `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/origins`;
|
|
1406
|
+
};
|
|
1407
|
+
/**
|
|
1408
|
+
* Adds one `{pattern, kind}` to the project's origins. A primary pattern
|
|
1409
|
+
* must be an exact URL (no wildcard). Preview patterns may include a single
|
|
1410
|
+
* DNS-label wildcard. Adding a pattern that already exists with the same
|
|
1411
|
+
* kind is idempotent and answers 201 with the stored origin.
|
|
1412
|
+
* @summary Add an origin pattern
|
|
1413
|
+
*/
|
|
1414
|
+
const addOrigin = async (projectId, addOriginBody, options) => {
|
|
1415
|
+
const getHeaders = (h) => {
|
|
1416
|
+
if (!h) return {};
|
|
1417
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
1418
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1419
|
+
const headers = {};
|
|
1420
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
1421
|
+
return headers;
|
|
1422
|
+
};
|
|
1423
|
+
return customFetch(getAddOriginUrl(projectId), {
|
|
1424
|
+
...options,
|
|
1425
|
+
method: "POST",
|
|
1426
|
+
headers: {
|
|
1427
|
+
"Content-Type": "application/json",
|
|
1428
|
+
...getHeaders(options?.headers)
|
|
1429
|
+
},
|
|
1430
|
+
body: JSON.stringify(addOriginBody)
|
|
1431
|
+
});
|
|
1432
|
+
};
|
|
1433
|
+
const getRemoveOriginUrl = (projectId) => {
|
|
1434
|
+
return `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/origins/remove`;
|
|
1435
|
+
};
|
|
1436
|
+
/**
|
|
1437
|
+
* Removes one pattern from the project's origins. Requests from URLs only
|
|
1438
|
+
* that pattern admitted are refused from then on; live previews and
|
|
1439
|
+
* deployment history are untouched. Removing a pattern that is already
|
|
1440
|
+
* absent is idempotent and answers 204.
|
|
1441
|
+
* @summary Remove an origin pattern
|
|
1442
|
+
*/
|
|
1443
|
+
const removeOrigin = async (projectId, removeOriginBody, options) => {
|
|
1444
|
+
const getHeaders = (h) => {
|
|
1445
|
+
if (!h) return {};
|
|
1446
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
1447
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1448
|
+
const headers = {};
|
|
1449
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
1450
|
+
return headers;
|
|
1451
|
+
};
|
|
1452
|
+
return customFetch(getRemoveOriginUrl(projectId), {
|
|
1453
|
+
...options,
|
|
1454
|
+
method: "POST",
|
|
1455
|
+
headers: {
|
|
1456
|
+
"Content-Type": "application/json",
|
|
1457
|
+
...getHeaders(options?.headers)
|
|
1458
|
+
},
|
|
1459
|
+
body: JSON.stringify(removeOriginBody)
|
|
1460
|
+
});
|
|
1461
|
+
};
|
|
1462
|
+
const getListPreviewsUrl = (projectId, params) => {
|
|
1463
|
+
const normalizedParams = new URLSearchParams();
|
|
1464
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1465
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1466
|
+
});
|
|
1467
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1468
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/previews?${stringifiedParams}` : `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/previews`;
|
|
1469
|
+
};
|
|
1470
|
+
/**
|
|
1471
|
+
* Lists the project's live previews, newest first by `created_at`. An
|
|
1472
|
+
* expired or removed preview is not listed; what was deployed to it stays
|
|
1473
|
+
* in `GET /deployments`.
|
|
1474
|
+
* @summary List previews
|
|
1475
|
+
*/
|
|
1476
|
+
const listPreviews = async (projectId, params, options) => {
|
|
1477
|
+
return customFetch(getListPreviewsUrl(projectId, params), {
|
|
1478
|
+
...options,
|
|
1479
|
+
method: "GET"
|
|
1480
|
+
});
|
|
1481
|
+
};
|
|
1482
|
+
const getRemovePreviewUrl = (projectId) => {
|
|
1483
|
+
return `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/previews/remove`;
|
|
1484
|
+
};
|
|
1485
|
+
/**
|
|
1486
|
+
* Ends a preview before it expires: the URL stops being served at once.
|
|
1487
|
+
* The deployments to it stay in the history.
|
|
1488
|
+
*
|
|
1489
|
+
* Idempotent: a URL with no live preview, including one that has already
|
|
1490
|
+
* expired or was removed before, answers `204` too, so a cleanup that
|
|
1491
|
+
* races the expiry still succeeds.
|
|
1492
|
+
*
|
|
1493
|
+
* The URL travels in the body rather than the path because an origin
|
|
1494
|
+
* contains `/`.
|
|
1495
|
+
* @summary Remove a preview
|
|
1496
|
+
*/
|
|
1497
|
+
const removePreview = async (projectId, removePreviewBody, options) => {
|
|
1498
|
+
const getHeaders = (h) => {
|
|
1499
|
+
if (!h) return {};
|
|
1500
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
1501
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
1502
|
+
const headers = {};
|
|
1503
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
1504
|
+
return headers;
|
|
1505
|
+
};
|
|
1506
|
+
return customFetch(getRemovePreviewUrl(projectId), {
|
|
1507
|
+
...options,
|
|
1508
|
+
method: "POST",
|
|
1509
|
+
headers: {
|
|
1510
|
+
"Content-Type": "application/json",
|
|
1511
|
+
...getHeaders(options?.headers)
|
|
1512
|
+
},
|
|
1513
|
+
body: JSON.stringify(removePreviewBody)
|
|
1514
|
+
});
|
|
1515
|
+
};
|
|
1265
1516
|
const getCreateSessionUrl = () => {
|
|
1266
1517
|
return `${getProxyPath()}/sessions`;
|
|
1267
1518
|
};
|
|
@@ -1427,44 +1678,65 @@ const revokeSession = async (sessionId, options) => {
|
|
|
1427
1678
|
method: "DELETE"
|
|
1428
1679
|
});
|
|
1429
1680
|
};
|
|
1430
|
-
const getGetMySessionUrl = () => {
|
|
1431
|
-
|
|
1681
|
+
const getGetMySessionUrl = (params) => {
|
|
1682
|
+
const normalizedParams = new URLSearchParams();
|
|
1683
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1684
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1685
|
+
});
|
|
1686
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1687
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/sessions/me?${stringifiedParams}` : `${getProxyPath()}/sessions/me`;
|
|
1432
1688
|
};
|
|
1433
1689
|
/**
|
|
1434
1690
|
* Returns the current state of the current session including its factors and all currently
|
|
1435
1691
|
* satisfied assurance levels.
|
|
1436
1692
|
*
|
|
1693
|
+
* With `project_id`, the session is returned only when it belongs to that project.
|
|
1694
|
+
*
|
|
1437
1695
|
* `assurance_levels[]` may shrink over time as factor freshness windows expire,
|
|
1438
1696
|
* without the session itself expiring. Use step-up authentication (a new `auth_attempt`
|
|
1439
1697
|
* against the same `session_id`) to restore a dropped assurance level.
|
|
1440
1698
|
* @summary Get my session state
|
|
1441
1699
|
*/
|
|
1442
|
-
const getMySession = async (options) => {
|
|
1443
|
-
return customFetch(getGetMySessionUrl(), {
|
|
1700
|
+
const getMySession = async (params, options) => {
|
|
1701
|
+
return customFetch(getGetMySessionUrl(params), {
|
|
1444
1702
|
...options,
|
|
1445
1703
|
method: "GET"
|
|
1446
1704
|
});
|
|
1447
1705
|
};
|
|
1448
|
-
const getRevokeMySessionUrl = () => {
|
|
1449
|
-
|
|
1706
|
+
const getRevokeMySessionUrl = (params) => {
|
|
1707
|
+
const normalizedParams = new URLSearchParams();
|
|
1708
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1709
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1710
|
+
});
|
|
1711
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1712
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/sessions/me?${stringifiedParams}` : `${getProxyPath()}/sessions/me`;
|
|
1450
1713
|
};
|
|
1451
1714
|
/**
|
|
1452
1715
|
* Logs out by permanently deleting the session.
|
|
1453
1716
|
*
|
|
1454
1717
|
* The `__nextgen_session` cookie issued at creation (or superseded by a handoff
|
|
1455
|
-
* exchange) is required
|
|
1456
|
-
*
|
|
1457
|
-
*
|
|
1718
|
+
* exchange) is required, with the session's token from `GET /sessions/me/csrf`
|
|
1719
|
+
* in the `X-Zitadel-CSRF` header. Idempotent: if the session is already gone
|
|
1720
|
+
* this still returns 204. Any tokens derived from the session are invalidated,
|
|
1721
|
+
* and the cookie itself is cleared in the response.
|
|
1722
|
+
*
|
|
1723
|
+
* With `project_id`, only a session of that project is deleted. A session of
|
|
1724
|
+
* another project is left alone, and so is its cookie.
|
|
1458
1725
|
* @summary Revoke my session
|
|
1459
1726
|
*/
|
|
1460
|
-
const revokeMySession = async (options) => {
|
|
1461
|
-
return customFetch(getRevokeMySessionUrl(), {
|
|
1727
|
+
const revokeMySession = async (params, options) => {
|
|
1728
|
+
return customFetch(getRevokeMySessionUrl(params), {
|
|
1462
1729
|
...options,
|
|
1463
1730
|
method: "DELETE"
|
|
1464
1731
|
});
|
|
1465
1732
|
};
|
|
1466
|
-
const getGetMySessionCsrfTokenUrl = () => {
|
|
1467
|
-
|
|
1733
|
+
const getGetMySessionCsrfTokenUrl = (params) => {
|
|
1734
|
+
const normalizedParams = new URLSearchParams();
|
|
1735
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1736
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1737
|
+
});
|
|
1738
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1739
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/sessions/me/csrf?${stringifiedParams}` : `${getProxyPath()}/sessions/me/csrf`;
|
|
1468
1740
|
};
|
|
1469
1741
|
/**
|
|
1470
1742
|
* Returns the session-bound token for cross-site request forgery protection
|
|
@@ -1474,10 +1746,13 @@ const getGetMySessionCsrfTokenUrl = () => {
|
|
|
1474
1746
|
* HttpOnly cookie is still the credential, and a cross-site page cannot
|
|
1475
1747
|
* read this response. It stays the same for the life of the session, so a
|
|
1476
1748
|
* client fetches it once per session.
|
|
1749
|
+
*
|
|
1750
|
+
* With `project_id`, the token is returned only when the session belongs to
|
|
1751
|
+
* that project.
|
|
1477
1752
|
* @summary Get my session's CSRF token
|
|
1478
1753
|
*/
|
|
1479
|
-
const getMySessionCsrfToken = async (options) => {
|
|
1480
|
-
return customFetch(getGetMySessionCsrfTokenUrl(), {
|
|
1754
|
+
const getMySessionCsrfToken = async (params, options) => {
|
|
1755
|
+
return customFetch(getGetMySessionCsrfTokenUrl(params), {
|
|
1481
1756
|
...options,
|
|
1482
1757
|
method: "GET"
|
|
1483
1758
|
});
|
|
@@ -1650,6 +1925,10 @@ const getCreateTeamUrl = (params) => {
|
|
|
1650
1925
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/teams?${stringifiedParams}` : `${getProxyPath()}/teams`;
|
|
1651
1926
|
};
|
|
1652
1927
|
/**
|
|
1928
|
+
* Creates a team in the project, with a name no other team in the project has.
|
|
1929
|
+
*
|
|
1930
|
+
* A taken name is refused with `409 team.already_exists`. The new team has no
|
|
1931
|
+
* members yet.
|
|
1653
1932
|
* @summary Create team
|
|
1654
1933
|
*/
|
|
1655
1934
|
const createTeam = async (createTeamBody, params, options) => {
|
|
@@ -1766,45 +2045,6 @@ const updateTeam = async (teamId, updateTeamBody, options) => {
|
|
|
1766
2045
|
body: JSON.stringify(updateTeamBody)
|
|
1767
2046
|
});
|
|
1768
2047
|
};
|
|
1769
|
-
const getListEnvironmentsUrl = (params) => {
|
|
1770
|
-
const normalizedParams = new URLSearchParams();
|
|
1771
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1772
|
-
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1773
|
-
});
|
|
1774
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1775
|
-
return stringifiedParams.length > 0 ? `${getProxyPath()}/environments?${stringifiedParams}` : `${getProxyPath()}/environments`;
|
|
1776
|
-
};
|
|
1777
|
-
/**
|
|
1778
|
-
* Lists the project's environments ordered by name.
|
|
1779
|
-
* @summary List environments
|
|
1780
|
-
*/
|
|
1781
|
-
const listEnvironments = async (params, options) => {
|
|
1782
|
-
return customFetch(getListEnvironmentsUrl(params), {
|
|
1783
|
-
...options,
|
|
1784
|
-
method: "GET"
|
|
1785
|
-
});
|
|
1786
|
-
};
|
|
1787
|
-
const getGetEnvironmentByNameUrl = (name, params) => {
|
|
1788
|
-
const normalizedParams = new URLSearchParams();
|
|
1789
|
-
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1790
|
-
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1791
|
-
});
|
|
1792
|
-
const stringifiedParams = normalizedParams.toString();
|
|
1793
|
-
return stringifiedParams.length > 0 ? `${getProxyPath()}/environments/${encodeURIComponent(String(name))}?${stringifiedParams}` : `${getProxyPath()}/environments/${encodeURIComponent(String(name))}`;
|
|
1794
|
-
};
|
|
1795
|
-
/**
|
|
1796
|
-
* Reads one environment of the project by its name.
|
|
1797
|
-
*
|
|
1798
|
-
* The lookup is scoped to the project in `project_id`: a name that exists in
|
|
1799
|
-
* another project answers `env.not_found` exactly as an unused name does.
|
|
1800
|
-
* @summary Get an environment by name
|
|
1801
|
-
*/
|
|
1802
|
-
const getEnvironmentByName = async (name, params, options) => {
|
|
1803
|
-
return customFetch(getGetEnvironmentByNameUrl(name, params), {
|
|
1804
|
-
...options,
|
|
1805
|
-
method: "GET"
|
|
1806
|
-
});
|
|
1807
|
-
};
|
|
1808
2048
|
const getCreateBrandingUrl = (params) => {
|
|
1809
2049
|
const normalizedParams = new URLSearchParams();
|
|
1810
2050
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -1896,19 +2136,29 @@ const getCreateIdpUrl = (params) => {
|
|
|
1896
2136
|
* releases and auth attempts stay pinned to the revision they captured.
|
|
1897
2137
|
*
|
|
1898
2138
|
* Identity fields are fixed for the life of the connection and a revision
|
|
1899
|
-
* that changes one is rejected: `protocol`, `subject_claim`, and
|
|
1900
|
-
*
|
|
1901
|
-
* and `userinfo_endpoint` for OAuth 2.0). Their values decide which provider
|
|
2139
|
+
* that changes one is rejected: `protocol`, `subject_claim`, and `issuer`,
|
|
2140
|
+
* the field that names the authority. Their values decide which provider
|
|
1902
2141
|
* account a stored subject belongs to, so changing one would silently
|
|
1903
2142
|
* repoint existing identities at a different provider.
|
|
1904
2143
|
*
|
|
1905
|
-
* `subject_claim` is optional
|
|
1906
|
-
*
|
|
1907
|
-
*
|
|
1908
|
-
*
|
|
2144
|
+
* `subject_claim` is optional, and `sub` is used as the default value. If a
|
|
2145
|
+
* revision updates `subject_claim` to a different value than the one set
|
|
2146
|
+
* during creation, the request is rejected.
|
|
2147
|
+
*
|
|
2148
|
+
* OIDC is the only protocol.
|
|
1909
2149
|
*
|
|
1910
2150
|
* The document is validated against the `idp-connection.json` schema before
|
|
1911
|
-
* anything is stored.
|
|
2151
|
+
* anything is stored. The rules the engine applies when it starts a sign-in
|
|
2152
|
+
* then run on the document, so a connection that could never start one is
|
|
2153
|
+
* refused here instead with `idp.endpoints_partial`: the OIDC block sets an
|
|
2154
|
+
* endpoint without the others. It either sets no endpoint, and discovery
|
|
2155
|
+
* fills them, or sets `authorization_endpoint`, `token_endpoint`, `jwks_uri`,
|
|
2156
|
+
* and `userinfo_endpoint`. `userinfo_endpoint` may be left out when
|
|
2157
|
+
* `id_token_mapping` is on, but setting it alone still counts as setting an
|
|
2158
|
+
* endpoint. The details list the missing endpoints.
|
|
2159
|
+
*
|
|
2160
|
+
* A refused document stores nothing, and on a revise the current revision
|
|
2161
|
+
* stays unchanged.
|
|
1912
2162
|
* @summary Create or revise an identity provider connection
|
|
1913
2163
|
*/
|
|
1914
2164
|
const createIdp = async (createIdpBody, params, options) => {
|
|
@@ -2034,21 +2284,25 @@ const getCreateReleaseUrl = (params) => {
|
|
|
2034
2284
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/releases?${stringifiedParams}` : `${getProxyPath()}/releases`;
|
|
2035
2285
|
};
|
|
2036
2286
|
/**
|
|
2037
|
-
*
|
|
2038
|
-
* `(kind, revision_id)` pairs.
|
|
2039
|
-
*
|
|
2287
|
+
* Assembles a release from existing revisions, given as
|
|
2288
|
+
* `(kind, revision_id)` pairs. To build one from files on disk, use
|
|
2289
|
+
* `POST /releases/build`.
|
|
2040
2290
|
*
|
|
2041
|
-
*
|
|
2042
|
-
*
|
|
2043
|
-
* is always pinned under the identity it declares.
|
|
2291
|
+
* Each revision must exist in the project and is recorded under the handle
|
|
2292
|
+
* it declares. The release must be complete and consistent:
|
|
2044
2293
|
*
|
|
2045
|
-
*
|
|
2046
|
-
* and the
|
|
2047
|
-
*
|
|
2294
|
+
* - Every handle its revisions name must be in the release: a flow's
|
|
2295
|
+
* `user_schema`, and the IDP connections named by a flow step's
|
|
2296
|
+
* `sso_providers` or a schema's `x-auth-methods.sso.providers`. A missing
|
|
2297
|
+
* one answers `rel.unresolved_reference`, naming the resource and the
|
|
2298
|
+
* handle, e.g. `flow_definition default-login: user_schema human-user not found`.
|
|
2299
|
+
* - Every flow is validated as on save, against the user schema revision
|
|
2300
|
+
* in the release. A flow that fails answers `rel.invalid`, with the
|
|
2301
|
+
* reason in `details`.
|
|
2048
2302
|
*
|
|
2049
|
-
* Idempotent on the
|
|
2050
|
-
*
|
|
2051
|
-
*
|
|
2303
|
+
* Idempotent on the set of revisions: the same revisions with a different
|
|
2304
|
+
* `message` answer `200` with the existing release. A new release answers
|
|
2305
|
+
* `201`. Creating a release does not deploy it.
|
|
2052
2306
|
* @summary Create a release
|
|
2053
2307
|
*/
|
|
2054
2308
|
const createRelease = async (createReleaseBody, params, options) => {
|
|
@@ -2081,8 +2335,15 @@ const getListReleasesUrl = (params) => {
|
|
|
2081
2335
|
/**
|
|
2082
2336
|
* Lists the project's releases, newest first.
|
|
2083
2337
|
*
|
|
2084
|
-
* Entries carry metadata
|
|
2085
|
-
*
|
|
2338
|
+
* Entries carry the digest, the metadata and `revoked_at` — the pinned set
|
|
2339
|
+
* is omitted.
|
|
2340
|
+
* Read one release with `GET /releases/{release_id}` to get its pointers.
|
|
2341
|
+
*
|
|
2342
|
+
* `content_hash` looks a release up by its content, as the CLI does when a
|
|
2343
|
+
* person types the digest a transcript printed. The project holds at most
|
|
2344
|
+
* one release per digest, so the filtered list has one entry or none, and
|
|
2345
|
+
* an unknown digest is an empty list rather than an error. Paths take the
|
|
2346
|
+
* `rel_` id only; the matched entry's `id` is what to use there.
|
|
2086
2347
|
* @summary List releases
|
|
2087
2348
|
*/
|
|
2088
2349
|
const listReleases = async (params, options) => {
|
|
@@ -2091,6 +2352,66 @@ const listReleases = async (params, options) => {
|
|
|
2091
2352
|
method: "GET"
|
|
2092
2353
|
});
|
|
2093
2354
|
};
|
|
2355
|
+
const getBuildReleaseUrl = (params) => {
|
|
2356
|
+
const normalizedParams = new URLSearchParams();
|
|
2357
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2358
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2359
|
+
});
|
|
2360
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2361
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/releases/build?${stringifiedParams}` : `${getProxyPath()}/releases/build`;
|
|
2362
|
+
};
|
|
2363
|
+
/**
|
|
2364
|
+
* Builds a release from the resources of `.zitadel/` as authored on disk,
|
|
2365
|
+
* grouped by kind, in one transaction: a failure anywhere leaves no
|
|
2366
|
+
* revision and no release. The caller records nothing.
|
|
2367
|
+
*
|
|
2368
|
+
* If the project already holds a release with the same content, the same
|
|
2369
|
+
* `content_hash`, the request answers `200` with that release and
|
|
2370
|
+
* allocates nothing, however long ago it was built. Otherwise every resource is compared against the
|
|
2371
|
+
* project's newest revision of the same handle: unchanged content reuses
|
|
2372
|
+
* that revision, changed content allocates a new one, and the request
|
|
2373
|
+
* answers `201` with the new release. Metadata is excluded from the
|
|
2374
|
+
* comparison, so the same content under a different `message` is the same
|
|
2375
|
+
* release.
|
|
2376
|
+
*
|
|
2377
|
+
* A structurally malformed request is refused while decoding with
|
|
2378
|
+
* `req.invalid`, naming the offending fields. A well-formed bundle is then
|
|
2379
|
+
* checked resource by resource, as each kind's create endpoint checks it,
|
|
2380
|
+
* and every failure is reported at once: the request answers `400` with
|
|
2381
|
+
* `rel.invalid`, and `details.resources` lists each resource that failed.
|
|
2382
|
+
* A handle that resolves neither in the bundle nor in the project answers
|
|
2383
|
+
* `rel.unresolved_reference`, naming the pointer and the handle.
|
|
2384
|
+
*
|
|
2385
|
+
* Building writes revisions, so besides `release.write` it needs the write
|
|
2386
|
+
* scope of every kind the bundle carries a resource of: `schema.write`,
|
|
2387
|
+
* `flow_definition.write`, `branding.write` and `idp.write`, as the
|
|
2388
|
+
* per-kind create endpoints do. A missing scope answers `403` with `rel.permission_denied`,
|
|
2389
|
+
* naming the kind. An empty kind needs no scope.
|
|
2390
|
+
*
|
|
2391
|
+
* Building a release does not deploy it. A release is not tied to an
|
|
2392
|
+
* origin, and the same release can later be deployed to any number of
|
|
2393
|
+
* origins unchanged.
|
|
2394
|
+
* @summary Build a release from files
|
|
2395
|
+
*/
|
|
2396
|
+
const buildRelease = async (buildReleaseBody, params, options) => {
|
|
2397
|
+
const getHeaders = (h) => {
|
|
2398
|
+
if (!h) return {};
|
|
2399
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
2400
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2401
|
+
const headers = {};
|
|
2402
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
2403
|
+
return headers;
|
|
2404
|
+
};
|
|
2405
|
+
return customFetch(getBuildReleaseUrl(params), {
|
|
2406
|
+
...options,
|
|
2407
|
+
method: "POST",
|
|
2408
|
+
headers: {
|
|
2409
|
+
"Content-Type": "application/json",
|
|
2410
|
+
...getHeaders(options?.headers)
|
|
2411
|
+
},
|
|
2412
|
+
body: JSON.stringify(buildReleaseBody)
|
|
2413
|
+
});
|
|
2414
|
+
};
|
|
2094
2415
|
const getGetReleaseByIdUrl = (releaseId, params) => {
|
|
2095
2416
|
const normalizedParams = new URLSearchParams();
|
|
2096
2417
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -2100,8 +2421,11 @@ const getGetReleaseByIdUrl = (releaseId, params) => {
|
|
|
2100
2421
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/releases/${encodeURIComponent(String(releaseId))}?${stringifiedParams}` : `${getProxyPath()}/releases/${encodeURIComponent(String(releaseId))}`;
|
|
2101
2422
|
};
|
|
2102
2423
|
/**
|
|
2103
|
-
* Reads one release: its metadata
|
|
2104
|
-
* tuples it pins.
|
|
2424
|
+
* Reads one release: its digest, its metadata, whether it was revoked, and
|
|
2425
|
+
* the `(kind, handle, revision_id)` tuples it pins.
|
|
2426
|
+
*
|
|
2427
|
+
* The path takes the `rel_` id only. To find a release from its digest,
|
|
2428
|
+
* list with the `content_hash` filter and read the matched entry's `id`.
|
|
2105
2429
|
*
|
|
2106
2430
|
* Does not embed resource content. Resolve each `revision_id` through the
|
|
2107
2431
|
* per-kind read endpoints when the bytes are needed.
|
|
@@ -2118,6 +2442,42 @@ const getReleaseById = async (releaseId, params, options) => {
|
|
|
2118
2442
|
method: "GET"
|
|
2119
2443
|
});
|
|
2120
2444
|
};
|
|
2445
|
+
const getRevokeReleaseUrl = (releaseId, params) => {
|
|
2446
|
+
const normalizedParams = new URLSearchParams();
|
|
2447
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2448
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2449
|
+
});
|
|
2450
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2451
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/releases/${encodeURIComponent(String(releaseId))}/revoke?${stringifiedParams}` : `${getProxyPath()}/releases/${encodeURIComponent(String(releaseId))}/revoke`;
|
|
2452
|
+
};
|
|
2453
|
+
/**
|
|
2454
|
+
* Marks the release revoked, so that its content is never served again.
|
|
2455
|
+
* From then on the release cannot be deployed and is refused on every path
|
|
2456
|
+
* that would serve it, including to a build that pins its digest, with
|
|
2457
|
+
* `rel.revoked`.
|
|
2458
|
+
*
|
|
2459
|
+
* A release that any origin still serves cannot be revoked. An origin
|
|
2460
|
+
* serves the release of the newest deployment to it, so the call answers
|
|
2461
|
+
* `409` with `rel.in_use`, naming each such origin and that deployment.
|
|
2462
|
+
* Deploy another release there or roll back first, then revoke. Revoking
|
|
2463
|
+
* therefore never takes an origin down. Deployments that named the release
|
|
2464
|
+
* earlier stay in the history.
|
|
2465
|
+
*
|
|
2466
|
+
* Idempotent: revoking a release that is already revoked answers `200`
|
|
2467
|
+
* with the release unchanged, `revoked_at` still naming the first
|
|
2468
|
+
* revocation. There is no un-revoke; build a new release instead.
|
|
2469
|
+
*
|
|
2470
|
+
* Takes no body. The lookup is scoped to the project in `project_id`, so a
|
|
2471
|
+
* release id of another project answers not found exactly as an unknown id
|
|
2472
|
+
* does.
|
|
2473
|
+
* @summary Revoke a release
|
|
2474
|
+
*/
|
|
2475
|
+
const revokeRelease = async (releaseId, params, options) => {
|
|
2476
|
+
return customFetch(getRevokeReleaseUrl(releaseId, params), {
|
|
2477
|
+
...options,
|
|
2478
|
+
method: "POST"
|
|
2479
|
+
});
|
|
2480
|
+
};
|
|
2121
2481
|
const getCreateGrantUrl = (params) => {
|
|
2122
2482
|
const normalizedParams = new URLSearchParams();
|
|
2123
2483
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -2342,13 +2702,8 @@ const getGetVariablesUrl = (params) => {
|
|
|
2342
2702
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/variables?${stringifiedParams}` : `${getProxyPath()}/variables`;
|
|
2343
2703
|
};
|
|
2344
2704
|
/**
|
|
2345
|
-
* Returns the variables
|
|
2346
|
-
*
|
|
2347
|
-
* level itself without it.
|
|
2348
|
-
*
|
|
2349
|
-
* Owners are separate, not a ladder: an environment does not inherit the
|
|
2350
|
-
* project's variables and the project does not see its environments'. Reading
|
|
2351
|
-
* everything a project holds therefore means reading each owner in turn.
|
|
2705
|
+
* Returns the project's variables, keyed by name, each with its value per
|
|
2706
|
+
* kind. With `kind`, only that kind's values are returned.
|
|
2352
2707
|
*
|
|
2353
2708
|
* Secret values are not returned. A secret appears as `{"secret": true}`,
|
|
2354
2709
|
* which says a value is held without disclosing it.
|
|
@@ -2369,23 +2724,24 @@ const getUpdateVariablesUrl = (params) => {
|
|
|
2369
2724
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/variables?${stringifiedParams}` : `${getProxyPath()}/variables`;
|
|
2370
2725
|
};
|
|
2371
2726
|
/**
|
|
2372
|
-
* Enters, replaces and removes variables
|
|
2373
|
-
*
|
|
2727
|
+
* Enters, replaces and removes the project's variables for the requested
|
|
2728
|
+
* kind. Names not in the body are untouched. Existing deployments keep the
|
|
2729
|
+
* values they froze.
|
|
2374
2730
|
*
|
|
2375
|
-
*
|
|
2376
|
-
*
|
|
2377
|
-
*
|
|
2731
|
+
* Without `kind`, a plain value is written for both kinds. A secret is
|
|
2732
|
+
* written for `primary` only and removes the name's `preview` value, so a
|
|
2733
|
+
* preview never keeps a plaintext copy; set a preview secret with
|
|
2734
|
+
* `kind=preview`. `null` removes the name from both.
|
|
2378
2735
|
*
|
|
2379
2736
|
* A bare scalar enters a non-secret value. `{"value": …, "secret": true}`
|
|
2380
2737
|
* stores the value encrypted under the project's active `secret` key, after
|
|
2381
|
-
* which it can be referenced but not read back. `null` removes the name
|
|
2382
|
-
*
|
|
2383
|
-
*
|
|
2384
|
-
* error.
|
|
2738
|
+
* which it can be referenced but not read back. `null` removes the name
|
|
2739
|
+
* (RFC 7386), which is how several variables are removed in one request;
|
|
2740
|
+
* removing a name the project does not hold is a no-op rather than an error.
|
|
2385
2741
|
*
|
|
2386
2742
|
* The body is applied whole or not at all, so a rejected request leaves the
|
|
2387
|
-
*
|
|
2388
|
-
* value rather than duplicating it, which makes a retry safe.
|
|
2743
|
+
* project's variables exactly as they were. Writing the same name twice
|
|
2744
|
+
* replaces the value rather than duplicating it, which makes a retry safe.
|
|
2389
2745
|
* @summary Update variables
|
|
2390
2746
|
*/
|
|
2391
2747
|
const updateVariables = async (updateVariablesBody, params, options) => {
|
|
@@ -2416,13 +2772,9 @@ const getGetVariableUrl = (variableName, params) => {
|
|
|
2416
2772
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/variables/${encodeURIComponent(String(variableName))}?${stringifiedParams}` : `${getProxyPath()}/variables/${encodeURIComponent(String(variableName))}`;
|
|
2417
2773
|
};
|
|
2418
2774
|
/**
|
|
2419
|
-
* Reads one variable by name
|
|
2420
|
-
*
|
|
2421
|
-
*
|
|
2422
|
-
*
|
|
2423
|
-
* A name that owner has not entered answers `var.not_found`, even when
|
|
2424
|
-
* another owner of the same project holds it: nothing is inherited. A secret
|
|
2425
|
-
* is found but not disclosed: the response is `{"secret": true}`.
|
|
2775
|
+
* Reads one variable by name, with its value per kind. A name with no
|
|
2776
|
+
* value for the requested kind answers `var.not_found`. A secret reads
|
|
2777
|
+
* back as `{"secret": true}`.
|
|
2426
2778
|
* @summary Get a variable
|
|
2427
2779
|
*/
|
|
2428
2780
|
const getVariable = async (variableName, params, options) => {
|
|
@@ -2440,11 +2792,9 @@ const getDeleteVariableUrl = (variableName, params) => {
|
|
|
2440
2792
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/variables/${encodeURIComponent(String(variableName))}?${stringifiedParams}` : `${getProxyPath()}/variables/${encodeURIComponent(String(variableName))}`;
|
|
2441
2793
|
};
|
|
2442
2794
|
/**
|
|
2443
|
-
* Removes
|
|
2444
|
-
*
|
|
2445
|
-
*
|
|
2446
|
-
* another owner of the same project holds answers `var.not_found` and leaves
|
|
2447
|
-
* that owner's value standing.
|
|
2795
|
+
* Removes a variable for the requested kind, or for both kinds without
|
|
2796
|
+
* `kind`. A name with no value for that kind answers `var.not_found`.
|
|
2797
|
+
* Existing deployments keep the values they froze.
|
|
2448
2798
|
* @summary Delete a variable
|
|
2449
2799
|
*/
|
|
2450
2800
|
const deleteVariable = async (variableName, params, options) => {
|
|
@@ -2462,28 +2812,54 @@ const getCreateDeploymentUrl = (params) => {
|
|
|
2462
2812
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/deployments?${stringifiedParams}` : `${getProxyPath()}/deployments`;
|
|
2463
2813
|
};
|
|
2464
2814
|
/**
|
|
2465
|
-
* Makes a release live on
|
|
2466
|
-
* happen atomically: when the call returns,
|
|
2467
|
-
* release and the record exists; on any failure
|
|
2468
|
-
*
|
|
2469
|
-
*
|
|
2470
|
-
*
|
|
2471
|
-
*
|
|
2472
|
-
*
|
|
2473
|
-
*
|
|
2474
|
-
*
|
|
2475
|
-
*
|
|
2476
|
-
*
|
|
2477
|
-
*
|
|
2478
|
-
*
|
|
2479
|
-
*
|
|
2480
|
-
*
|
|
2481
|
-
* the
|
|
2482
|
-
*
|
|
2483
|
-
*
|
|
2484
|
-
* when
|
|
2485
|
-
*
|
|
2486
|
-
*
|
|
2815
|
+
* Makes a release live on a set of targets by recording a deployment. The
|
|
2816
|
+
* two happen atomically: when the call returns, every target serves the
|
|
2817
|
+
* named release and the record exists; on any failure every target keeps
|
|
2818
|
+
* serving what it served and no record is written.
|
|
2819
|
+
*
|
|
2820
|
+
* The release is named by exactly one of `release_id` or `content_hash`
|
|
2821
|
+
* (both or neither answers `400` with `dep.invalid`), and must already
|
|
2822
|
+
* exist in the project: deploying never assembles a release. An
|
|
2823
|
+
* unknown release id or digest answers `404` with `rel.not_found`, and a
|
|
2824
|
+
* revoked release answers `409` with `rel.revoked`.
|
|
2825
|
+
*
|
|
2826
|
+
* `targets` lists `primary`, which expands to every primary origin of the
|
|
2827
|
+
* project, and exact origins. An origin that is neither a primary origin
|
|
2828
|
+
* of the project nor matches one of its preview patterns answers `403`
|
|
2829
|
+
* with `proj.origin_not_allowed`, and `primary` on a project with no
|
|
2830
|
+
* primary origin answers `400` with `dep.invalid`. The deployment records
|
|
2831
|
+
* the resolved origins, sorted, never the keyword.
|
|
2832
|
+
*
|
|
2833
|
+
* A deployment to preview URLs creates the preview for each of them, or
|
|
2834
|
+
* renews it when it exists, in the same transaction, with the expiry set
|
|
2835
|
+
* from `ttl`; each target in the response carries that expiry. It always
|
|
2836
|
+
* writes a new deployment, answering `201`, even when the URLs already
|
|
2837
|
+
* serve the release: that record is the renewal. Primary origins and
|
|
2838
|
+
* preview URLs cannot be mixed in one deployment: that answers `400` with
|
|
2839
|
+
* `dep.invalid`.
|
|
2840
|
+
*
|
|
2841
|
+
* A deployment freezes the variable values the project stores for its
|
|
2842
|
+
* kind: primary origins use the primary values, preview URLs the preview
|
|
2843
|
+
* values, with no fallback from one to the other. A release that
|
|
2844
|
+
* references a variable with no value for that kind answers `400` with
|
|
2845
|
+
* `dep.variables_missing`, naming the kind and every missing variable, and
|
|
2846
|
+
* nothing is written.
|
|
2847
|
+
*
|
|
2848
|
+
* A deployment to primary origins is idempotent on what is served: when
|
|
2849
|
+
* every resolved target already serves the release with the same frozen
|
|
2850
|
+
* variable values, nothing changes and the call answers `200` with the
|
|
2851
|
+
* newest deployment to those targets, so a re-run of `zitadel deploy` on
|
|
2852
|
+
* unchanged content is a no-op end to end. The same release with a
|
|
2853
|
+
* changed variable value is a new deployment.
|
|
2854
|
+
* Anything else writes a new record covering all of the resolved targets,
|
|
2855
|
+
* including the same release returning after something else was served in
|
|
2856
|
+
* between: the log is append-only, and each record is one act of making a
|
|
2857
|
+
* release live.
|
|
2858
|
+
*
|
|
2859
|
+
* `expected_deployment_id` guards against racing another deploy: when
|
|
2860
|
+
* present, the write only happens if the newest deployment to any of the
|
|
2861
|
+
* resolved targets still is the one named, and a mismatch answers `409`
|
|
2862
|
+
* with `dep.conflict`, carrying the actual newest deployment.
|
|
2487
2863
|
* @summary Create a deployment
|
|
2488
2864
|
*/
|
|
2489
2865
|
const createDeployment = async (createDeploymentBody, params, options) => {
|
|
@@ -2522,10 +2898,19 @@ const getListDeploymentsUrl = (params) => {
|
|
|
2522
2898
|
/**
|
|
2523
2899
|
* Lists deployments newest first: what ran where, and when.
|
|
2524
2900
|
*
|
|
2525
|
-
*
|
|
2526
|
-
*
|
|
2527
|
-
*
|
|
2528
|
-
*
|
|
2901
|
+
* By default the list is the history: every deployment of the project, each
|
|
2902
|
+
* with every target it made the release live on. With `origin`, it is the
|
|
2903
|
+
* history of that origin alone, and its first row is the deployment the
|
|
2904
|
+
* origin serves.
|
|
2905
|
+
*
|
|
2906
|
+
* With `live=true`, the list is what is served now: the newest deployment
|
|
2907
|
+
* to each target, each carrying only the targets it still serves. A
|
|
2908
|
+
* preview URL is served only while its preview is live, and its
|
|
2909
|
+
* `expires_at` is the expiry its newest deployment set, which is the
|
|
2910
|
+
* preview's current one. A deployment every target of which has since
|
|
2911
|
+
* been replaced, or whose previews have all expired or been removed, does
|
|
2912
|
+
* not appear. Combined with `origin`, the live view is the one deployment
|
|
2913
|
+
* that origin serves, or empty.
|
|
2529
2914
|
*
|
|
2530
2915
|
* `expand: ["release"]` embeds the release each deployment made live, so a
|
|
2531
2916
|
* history renders with each entry's content without resolving `release_id`
|
|
@@ -2562,6 +2947,83 @@ const getDeploymentById = async (deploymentId, params, options) => {
|
|
|
2562
2947
|
method: "GET"
|
|
2563
2948
|
});
|
|
2564
2949
|
};
|
|
2950
|
+
const getRollbackDeploymentUrl = (deploymentId, params) => {
|
|
2951
|
+
const normalizedParams = new URLSearchParams();
|
|
2952
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2953
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2954
|
+
});
|
|
2955
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2956
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/deployments/${encodeURIComponent(String(deploymentId))}/rollback?${stringifiedParams}` : `${getProxyPath()}/deployments/${encodeURIComponent(String(deploymentId))}/rollback`;
|
|
2957
|
+
};
|
|
2958
|
+
/**
|
|
2959
|
+
* Re-deploys the deployment named in the path: a new deployment with the
|
|
2960
|
+
* same `release_id` and the same `targets`, `reason: rollback`, and
|
|
2961
|
+
* `rollback_to` in its metadata naming the deployment it re-applied. The
|
|
2962
|
+
* variable values that deployment resolved are re-applied with it, so the
|
|
2963
|
+
* targets serve exactly what they served then. The history is append-only,
|
|
2964
|
+
* so the deployments in between stay in it.
|
|
2965
|
+
*
|
|
2966
|
+
* Only a deployment to primary origins can be rolled back. One whose
|
|
2967
|
+
* targets were preview URLs answers `400` with `dep.invalid`; deploy to
|
|
2968
|
+
* the preview again instead. Every target must still be a primary origin
|
|
2969
|
+
* of the project, as `POST /deployments` requires of an exact origin:
|
|
2970
|
+
* when one is not, the request answers `403` with
|
|
2971
|
+
* `proj.origin_not_allowed` naming it, and nothing changes. There is no
|
|
2972
|
+
* narrowing to some of the targets: to roll back one origin, deploy the
|
|
2973
|
+
* earlier release to it with `POST /deployments`.
|
|
2974
|
+
*
|
|
2975
|
+
* When every target already serves the deployment's release, nothing
|
|
2976
|
+
* changes and the call answers `200` with the newest deployment to the
|
|
2977
|
+
* targets.
|
|
2978
|
+
*
|
|
2979
|
+
* The release must not be revoked: a revoked one answers `409` with
|
|
2980
|
+
* `rel.revoked`. An unknown deployment id, or one of another project,
|
|
2981
|
+
* answers `404` with `dep.not_found`.
|
|
2982
|
+
*
|
|
2983
|
+
* A rollback never answers `dep.variables_missing`: the release and the
|
|
2984
|
+
* frozen values it re-applies passed that check together when the named
|
|
2985
|
+
* deployment was made.
|
|
2986
|
+
* @summary Roll back to a deployment
|
|
2987
|
+
*/
|
|
2988
|
+
const rollbackDeployment = async (deploymentId, params, rollbackDeploymentBody, options) => {
|
|
2989
|
+
const getHeaders = (h) => {
|
|
2990
|
+
if (!h) return {};
|
|
2991
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
2992
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2993
|
+
const headers = {};
|
|
2994
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
2995
|
+
return headers;
|
|
2996
|
+
};
|
|
2997
|
+
return customFetch(getRollbackDeploymentUrl(deploymentId, params), {
|
|
2998
|
+
...options,
|
|
2999
|
+
method: "POST",
|
|
3000
|
+
headers: {
|
|
3001
|
+
"Content-Type": "application/json",
|
|
3002
|
+
...getHeaders(options?.headers)
|
|
3003
|
+
},
|
|
3004
|
+
body: JSON.stringify(rollbackDeploymentBody)
|
|
3005
|
+
});
|
|
3006
|
+
};
|
|
3007
|
+
const getGetDeploymentVariablesUrl = (deploymentId, params) => {
|
|
3008
|
+
const normalizedParams = new URLSearchParams();
|
|
3009
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
3010
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
3011
|
+
});
|
|
3012
|
+
const stringifiedParams = normalizedParams.toString();
|
|
3013
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/deployments/${encodeURIComponent(String(deploymentId))}/variables?${stringifiedParams}` : `${getProxyPath()}/deployments/${encodeURIComponent(String(deploymentId))}/variables`;
|
|
3014
|
+
};
|
|
3015
|
+
/**
|
|
3016
|
+
* Returns the variable values the deployment froze when it was made. Later
|
|
3017
|
+
* changes to the project's variables do not affect them. A secret reads
|
|
3018
|
+
* back as `{"secret": true}`.
|
|
3019
|
+
* @summary Get a deployment's variables
|
|
3020
|
+
*/
|
|
3021
|
+
const getDeploymentVariables = async (deploymentId, params, options) => {
|
|
3022
|
+
return customFetch(getGetDeploymentVariablesUrl(deploymentId, params), {
|
|
3023
|
+
...options,
|
|
3024
|
+
method: "GET"
|
|
3025
|
+
});
|
|
3026
|
+
};
|
|
2565
3027
|
//#endregion
|
|
2566
3028
|
//#region ../api/dist/runtime/api-factory.mjs
|
|
2567
3029
|
/**
|
|
@@ -2588,7 +3050,7 @@ const getDeploymentById = async (deploymentId, params, options) => {
|
|
|
2588
3050
|
* generated orval function:
|
|
2589
3051
|
*
|
|
2590
3052
|
* const client = createZitadelClient({ baseUrl, token });
|
|
2591
|
-
* await client.createProject({
|
|
3053
|
+
* await client.createProject({ origins: [] });
|
|
2592
3054
|
* await client.createSchema(body, { project_id });
|
|
2593
3055
|
*/
|
|
2594
3056
|
function createZitadelClient(opts) {
|
|
@@ -2609,7 +3071,7 @@ function createZitadelClient(opts) {
|
|
|
2609
3071
|
} });
|
|
2610
3072
|
}
|
|
2611
3073
|
//#endregion
|
|
2612
|
-
//#region ../config/dist/defaults-
|
|
3074
|
+
//#region ../config/dist/defaults-B3SfaQPb.mjs
|
|
2613
3075
|
var default_human_user_default = {
|
|
2614
3076
|
title: "DefaultHumanUserSchema",
|
|
2615
3077
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
@@ -2636,7 +3098,7 @@ var default_login_default = {
|
|
|
2636
3098
|
$schema: "../meta/flow-definition.json",
|
|
2637
3099
|
name: "default-login",
|
|
2638
3100
|
status: "active",
|
|
2639
|
-
user_schema: "
|
|
3101
|
+
user_schema: "human-user",
|
|
2640
3102
|
purposes: {
|
|
2641
3103
|
"login": "identifier",
|
|
2642
3104
|
"register": "register"
|
|
@@ -2746,7 +3208,7 @@ var login_default = {
|
|
|
2746
3208
|
$schema: "../meta/flow-definition.json",
|
|
2747
3209
|
name: "default-login",
|
|
2748
3210
|
status: "active",
|
|
2749
|
-
user_schema: "
|
|
3211
|
+
user_schema: "human-user",
|
|
2750
3212
|
purposes: {
|
|
2751
3213
|
"login": "passkey-first",
|
|
2752
3214
|
"register": "register"
|
|
@@ -2891,8 +3353,8 @@ var login_default = {
|
|
|
2891
3353
|
}
|
|
2892
3354
|
]
|
|
2893
3355
|
};
|
|
2894
|
-
const DEFAULT_BUILTIN_SCHEMA_BASE = "https://
|
|
2895
|
-
const DEFAULT_FLOW_SCHEMA_URI =
|
|
3356
|
+
const DEFAULT_BUILTIN_SCHEMA_BASE = "https://zitadel.com/schemas/v1";
|
|
3357
|
+
const DEFAULT_FLOW_SCHEMA_URI = `${DEFAULT_BUILTIN_SCHEMA_BASE}/flow-definition.json`;
|
|
2896
3358
|
/**
|
|
2897
3359
|
* Named schema+flow bundles `zitadel setup` can scaffold (#448: the prompt
|
|
2898
3360
|
* fires before any `.zitadel/` file is written; each preset maps to a
|
|
@@ -3029,18 +3491,15 @@ function defaultHumanUserSchemaUrl(builtinSchemaBase = DEFAULT_BUILTIN_SCHEMA_BA
|
|
|
3029
3491
|
return `${trimTrailingSlash(builtinSchemaBase)}/default-human-user.json`;
|
|
3030
3492
|
}
|
|
3031
3493
|
function getDefaultHumanUserSchema(options = {}) {
|
|
3032
|
-
const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://
|
|
3494
|
+
const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://zitadel.com/schemas/v1");
|
|
3033
3495
|
return applyUseCaseToSchema(renderTemplate(presetTemplates(options.preset ?? "password-first").schema, {
|
|
3034
3496
|
SERVER_URL: builtinSchemaBase,
|
|
3035
3497
|
USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase)
|
|
3036
3498
|
}), options.useCase ?? "minimal");
|
|
3037
3499
|
}
|
|
3038
3500
|
function getDefaultLoginFlow(options = {}) {
|
|
3039
|
-
const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://
|
|
3040
|
-
return applyUseCaseToFlow(renderTemplate(presetTemplates(options.preset ?? "password-first").flow, {
|
|
3041
|
-
SERVER_URL: builtinSchemaBase,
|
|
3042
|
-
USER_SCHEMA_URL: options.userSchemaUrl ?? defaultHumanUserSchemaUrl(builtinSchemaBase)
|
|
3043
|
-
}), options.useCase ?? "minimal");
|
|
3501
|
+
const builtinSchemaBase = trimTrailingSlash(options.builtinSchemaBase ?? "https://zitadel.com/schemas/v1");
|
|
3502
|
+
return applyUseCaseToFlow(renderTemplate(presetTemplates(options.preset ?? "password-first").flow, { SERVER_URL: builtinSchemaBase }), options.useCase ?? "minimal");
|
|
3044
3503
|
}
|
|
3045
3504
|
function renderTemplate(value, replacements) {
|
|
3046
3505
|
if (Array.isArray(value)) return value.map((item) => renderTemplate(item, replacements));
|
|
@@ -3068,7 +3527,10 @@ async function bootstrapProject(options) {
|
|
|
3068
3527
|
const { baseUrl } = options;
|
|
3069
3528
|
const project = await createZitadelClient({ baseUrl }).createProject({
|
|
3070
3529
|
name: options.projectName ?? DEFAULT_PROJECT_NAME,
|
|
3071
|
-
|
|
3530
|
+
origins: (options.appOrigins ?? []).map((pattern) => ({
|
|
3531
|
+
pattern,
|
|
3532
|
+
kind: "preview"
|
|
3533
|
+
})),
|
|
3072
3534
|
seed_defaults: false
|
|
3073
3535
|
});
|
|
3074
3536
|
const projectId = requireString(project.id, "project id");
|
|
@@ -3084,7 +3546,6 @@ async function bootstrapProject(options) {
|
|
|
3084
3546
|
});
|
|
3085
3547
|
const schemaId = requireString((await client.createSchema(schemaBody, { project_id: projectId })).id, "schema id");
|
|
3086
3548
|
const flowBody = getDefaultLoginFlow({
|
|
3087
|
-
userSchemaUrl: schemaId,
|
|
3088
3549
|
preset: options.preset,
|
|
3089
3550
|
useCase: options.useCase
|
|
3090
3551
|
});
|
|
@@ -3320,7 +3781,9 @@ function failureDetail(result) {
|
|
|
3320
3781
|
/**
|
|
3321
3782
|
* A unique unused email + password. Nothing is created on the instance —
|
|
3322
3783
|
* this is the input for registration-flow specs, which must prove the flow
|
|
3323
|
-
* creates the user.
|
|
3784
|
+
* creates the user. It needs no instance either, so both entry points export
|
|
3785
|
+
* it for specs that run without `withZitadel()`; `seed.identity()` and
|
|
3786
|
+
* `zitadel.identity()` call this function.
|
|
3324
3787
|
*/
|
|
3325
3788
|
function identity() {
|
|
3326
3789
|
return {
|
|
@@ -3372,8 +3835,30 @@ async function seedUsers(client, context, count, template = {}) {
|
|
|
3372
3835
|
}
|
|
3373
3836
|
//#endregion
|
|
3374
3837
|
//#region src/session.ts
|
|
3375
|
-
/**
|
|
3838
|
+
/**
|
|
3839
|
+
* Mirrors the server's session cookie (internal/api/session.go): the name a
|
|
3840
|
+
* direct call to the server sends, and the one an app keeps behind a proxy that
|
|
3841
|
+
* passes the server's cookie through, such as an SPA's in production.
|
|
3842
|
+
*/
|
|
3376
3843
|
const SESSION_COOKIE_NAME = "__nextgen_session";
|
|
3844
|
+
/**
|
|
3845
|
+
* The cookie an app keeps its session in on its own origin behind a server SDK
|
|
3846
|
+
* (Next.js, Nuxt, SvelteKit, SolidStart, TanStack Start, Qwik Router) or the dev
|
|
3847
|
+
* proxy `zitadel setup` writes for an SPA: `__nextgen_session_<projectId>`. The
|
|
3848
|
+
* proxy renames the server's cookie, so the apps and the Console on one host
|
|
3849
|
+
* keep a session each (ADR 073).
|
|
3850
|
+
*
|
|
3851
|
+
* Mirrors `sessionCookieName` in `@zitadel/sdk-core`, including the
|
|
3852
|
+
* percent-encoding of every byte outside `[A-Za-z0-9_-]`.
|
|
3853
|
+
*/
|
|
3854
|
+
function sessionCookieName(projectId) {
|
|
3855
|
+
let name = `${SESSION_COOKIE_NAME}_`;
|
|
3856
|
+
for (const byte of new TextEncoder().encode(projectId)) {
|
|
3857
|
+
const char = String.fromCharCode(byte);
|
|
3858
|
+
name += /[A-Za-z0-9_-]/.test(char) ? char : `%${byte.toString(16).toUpperCase().padStart(2, "0")}`;
|
|
3859
|
+
}
|
|
3860
|
+
return name;
|
|
3861
|
+
}
|
|
3377
3862
|
const MAX_FLOW_STEPS = 6;
|
|
3378
3863
|
/**
|
|
3379
3864
|
* Drive the real login flow headlessly for a seeded password user and
|
|
@@ -3581,6 +4066,18 @@ Object.defineProperty(exports, "connectZitadel", {
|
|
|
3581
4066
|
return connectZitadel;
|
|
3582
4067
|
}
|
|
3583
4068
|
});
|
|
4069
|
+
Object.defineProperty(exports, "identity", {
|
|
4070
|
+
enumerable: true,
|
|
4071
|
+
get: function() {
|
|
4072
|
+
return identity;
|
|
4073
|
+
}
|
|
4074
|
+
});
|
|
4075
|
+
Object.defineProperty(exports, "sessionCookieName", {
|
|
4076
|
+
enumerable: true,
|
|
4077
|
+
get: function() {
|
|
4078
|
+
return sessionCookieName;
|
|
4079
|
+
}
|
|
4080
|
+
});
|
|
3584
4081
|
Object.defineProperty(exports, "startLocalZitadel", {
|
|
3585
4082
|
enumerable: true,
|
|
3586
4083
|
get: function() {
|
|
@@ -3588,4 +4085,4 @@ Object.defineProperty(exports, "startLocalZitadel", {
|
|
|
3588
4085
|
}
|
|
3589
4086
|
});
|
|
3590
4087
|
|
|
3591
|
-
//# sourceMappingURL=src-
|
|
4088
|
+
//# sourceMappingURL=src-BbHs0YmP.cjs.map
|