@zitadel/testing 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +6 -7
- package/dist/index.cjs +1 -1
- package/dist/playwright.cjs +4 -4
- package/dist/playwright.cjs.map +1 -1
- package/dist/playwright.d.mts +4 -4
- package/dist/playwright.mjs +3 -3
- package/dist/playwright.mjs.map +1 -1
- package/dist/{src-CUvV1OWp.cjs → src-CaG3NNMx.cjs} +251 -48
- package/dist/src-CaG3NNMx.cjs.map +1 -0
- package/dist/src-DKJ1hMV8.mjs.map +1 -1
- package/dist/supervisor.cjs +1 -1
- package/package.json +6 -6
- package/dist/index.d.mts.map +0 -1
- package/dist/playwright.d.mts.map +0 -1
- package/dist/session-BrSkzPpy.d.mts.map +0 -1
- package/dist/src-CUvV1OWp.cjs.map +0 -1
|
@@ -99,12 +99,19 @@ var ApiError = class extends Error {
|
|
|
99
99
|
status;
|
|
100
100
|
url;
|
|
101
101
|
body;
|
|
102
|
-
|
|
102
|
+
/**
|
|
103
|
+
* The server's ID for the request, from its `X-Request-Id` header: the
|
|
104
|
+
* reference that finds the request in the server's logs, to show beside the
|
|
105
|
+
* error. `undefined` when the response carried none, as from a proxy.
|
|
106
|
+
*/
|
|
107
|
+
requestId;
|
|
108
|
+
constructor(status, url, body, message, requestId) {
|
|
103
109
|
super(message);
|
|
104
110
|
this.name = "ApiError";
|
|
105
111
|
this.status = status;
|
|
106
112
|
this.url = url;
|
|
107
113
|
this.body = body;
|
|
114
|
+
this.requestId = requestId;
|
|
108
115
|
}
|
|
109
116
|
};
|
|
110
117
|
/**
|
|
@@ -181,7 +188,7 @@ async function customFetch(url, options) {
|
|
|
181
188
|
}
|
|
182
189
|
if (!res.ok) {
|
|
183
190
|
const message = `${options.method ?? "GET"} ${url} returned ${res.status}`;
|
|
184
|
-
throw new ApiError(res.status, url, parsed, message);
|
|
191
|
+
throw new ApiError(res.status, url, parsed, message, res.headers.get("x-request-id") || void 0);
|
|
185
192
|
}
|
|
186
193
|
return parsed;
|
|
187
194
|
}
|
|
@@ -373,7 +380,6 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
373
380
|
getGetFlowDefinitionUrl: () => getGetFlowDefinitionUrl,
|
|
374
381
|
getGetFlowStepUrl: () => getGetFlowStepUrl,
|
|
375
382
|
getGetGrantUrl: () => getGetGrantUrl,
|
|
376
|
-
getGetHealthUrl: () => getGetHealthUrl,
|
|
377
383
|
getGetIdpByIdUrl: () => getGetIdpByIdUrl,
|
|
378
384
|
getGetIdpRevisionByIdUrl: () => getGetIdpRevisionByIdUrl,
|
|
379
385
|
getGetLiveUrl: () => getGetLiveUrl,
|
|
@@ -382,6 +388,8 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
382
388
|
getGetMySessionUrl: () => getGetMySessionUrl,
|
|
383
389
|
getGetMyUserSchemaUrl: () => getGetMyUserSchemaUrl,
|
|
384
390
|
getGetMyUserUrl: () => getGetMyUserUrl,
|
|
391
|
+
getGetPolicyRevisionUrl: () => getGetPolicyRevisionUrl,
|
|
392
|
+
getGetPolicyUrl: () => getGetPolicyUrl,
|
|
385
393
|
getGetProjectUrl: () => getGetProjectUrl,
|
|
386
394
|
getGetReadyUrl: () => getGetReadyUrl,
|
|
387
395
|
getGetReleaseByIdUrl: () => getGetReleaseByIdUrl,
|
|
@@ -393,7 +401,6 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
393
401
|
getGetVariableUrl: () => getGetVariableUrl,
|
|
394
402
|
getGetVariablesUrl: () => getGetVariablesUrl,
|
|
395
403
|
getGrant: () => getGrant,
|
|
396
|
-
getHealth: () => getHealth,
|
|
397
404
|
getIdpById: () => getIdpById,
|
|
398
405
|
getIdpRevisionById: () => getIdpRevisionById,
|
|
399
406
|
getInitClaimUrl: () => getInitClaimUrl,
|
|
@@ -407,7 +414,10 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
407
414
|
getListMyPasskeysUrl: () => getListMyPasskeysUrl,
|
|
408
415
|
getListMyProjectsUrl: () => getListMyProjectsUrl,
|
|
409
416
|
getListMyTeamsUrl: () => getListMyTeamsUrl,
|
|
417
|
+
getListPoliciesUrl: () => getListPoliciesUrl,
|
|
418
|
+
getListPolicyRevisionsUrl: () => getListPolicyRevisionsUrl,
|
|
410
419
|
getListPreviewsUrl: () => getListPreviewsUrl,
|
|
420
|
+
getListProjectAdminsUrl: () => getListProjectAdminsUrl,
|
|
411
421
|
getListReleasesUrl: () => getListReleasesUrl,
|
|
412
422
|
getListSchemasUrl: () => getListSchemasUrl,
|
|
413
423
|
getListUserIdentityLinksUrl: () => getListUserIdentityLinksUrl,
|
|
@@ -422,7 +432,10 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
422
432
|
getPatchMyUserUrl: () => getPatchMyUserUrl,
|
|
423
433
|
getPatchProjectUrl: () => getPatchProjectUrl,
|
|
424
434
|
getPatchUserByIDUrl: () => getPatchUserByIDUrl,
|
|
435
|
+
getPolicy: () => getPolicy,
|
|
436
|
+
getPolicyRevision: () => getPolicyRevision,
|
|
425
437
|
getProject: () => getProject,
|
|
438
|
+
getPublishPolicyUrl: () => getPublishPolicyUrl,
|
|
426
439
|
getQueryGrantsUrl: () => getQueryGrantsUrl,
|
|
427
440
|
getQueryIdpsUrl: () => getQueryIdpsUrl,
|
|
428
441
|
getQueryProjectsUrl: () => getQueryProjectsUrl,
|
|
@@ -460,7 +473,10 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
460
473
|
listMyPasskeys: () => listMyPasskeys,
|
|
461
474
|
listMyProjects: () => listMyProjects,
|
|
462
475
|
listMyTeams: () => listMyTeams,
|
|
476
|
+
listPolicies: () => listPolicies,
|
|
477
|
+
listPolicyRevisions: () => listPolicyRevisions,
|
|
463
478
|
listPreviews: () => listPreviews,
|
|
479
|
+
listProjectAdmins: () => listProjectAdmins,
|
|
464
480
|
listReleases: () => listReleases,
|
|
465
481
|
listSchemas: () => listSchemas,
|
|
466
482
|
listUserIdentityLinks: () => listUserIdentityLinks,
|
|
@@ -469,6 +485,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
469
485
|
patchMyUser: () => patchMyUser,
|
|
470
486
|
patchProject: () => patchProject,
|
|
471
487
|
patchUserByID: () => patchUserByID,
|
|
488
|
+
publishPolicy: () => publishPolicy,
|
|
472
489
|
queryGrants: () => queryGrants,
|
|
473
490
|
queryIdps: () => queryIdps,
|
|
474
491
|
queryProjects: () => queryProjects,
|
|
@@ -487,24 +504,15 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
487
504
|
updateVariables: () => updateVariables,
|
|
488
505
|
verifyChallengeProof: () => verifyChallengeProof
|
|
489
506
|
});
|
|
490
|
-
const getGetHealthUrl = () => {
|
|
491
|
-
return `${getProxyPath()}/healthz`;
|
|
492
|
-
};
|
|
493
|
-
/**
|
|
494
|
-
* Check whether the server is healthy
|
|
495
|
-
* @summary Check server health
|
|
496
|
-
*/
|
|
497
|
-
const getHealth = async (options) => {
|
|
498
|
-
return customFetch(getGetHealthUrl(), {
|
|
499
|
-
...options,
|
|
500
|
-
method: "GET"
|
|
501
|
-
});
|
|
502
|
-
};
|
|
503
507
|
const getGetLiveUrl = () => {
|
|
504
508
|
return `${getProxyPath()}/livez`;
|
|
505
509
|
};
|
|
506
510
|
/**
|
|
507
|
-
*
|
|
511
|
+
* Answers `ok` while the server process serves HTTP, and checks nothing behind it.
|
|
512
|
+
*
|
|
513
|
+
* Point a liveness probe here. It never checks the database, so an outage
|
|
514
|
+
* of the database does not restart every instance; `GET /readyz` takes an
|
|
515
|
+
* instance out of rotation instead.
|
|
508
516
|
* @summary Check server liveness
|
|
509
517
|
*/
|
|
510
518
|
const getLive = async (options) => {
|
|
@@ -517,7 +525,11 @@ const getGetReadyUrl = () => {
|
|
|
517
525
|
return `${getProxyPath()}/readyz`;
|
|
518
526
|
};
|
|
519
527
|
/**
|
|
520
|
-
*
|
|
528
|
+
* Answers whether the server can serve requests, which takes its database answering within a second.
|
|
529
|
+
*
|
|
530
|
+
* Point a readiness probe here, so that a server whose database does not
|
|
531
|
+
* answer gets no requests until it does. The check is one round trip to the
|
|
532
|
+
* database.
|
|
521
533
|
* @summary Check server readiness
|
|
522
534
|
*/
|
|
523
535
|
const getReady = async (options) => {
|
|
@@ -974,14 +986,20 @@ const getListMyProjectsUrl = (params) => {
|
|
|
974
986
|
return stringifiedParams.length > 0 ? `${getProxyPath()}/users/me/projects?${stringifiedParams}` : `${getProxyPath()}/users/me/projects`;
|
|
975
987
|
};
|
|
976
988
|
/**
|
|
977
|
-
* The projects the signed-in user
|
|
978
|
-
* through a team they are a member of.
|
|
979
|
-
*
|
|
989
|
+
* The projects the signed-in user can act on: those they hold an active grant
|
|
990
|
+
* on, either directly or through a team they are a member of. For a platform
|
|
991
|
+
* operator (ADR 075) that is every project of the deployment. Ordered by
|
|
992
|
+
* project id and paged with an opaque cursor.
|
|
980
993
|
*
|
|
981
994
|
* This is not the same question as `queryProjects`, which answers with the one
|
|
982
995
|
* project the calling credential is bound to. Here the session is the caller
|
|
983
996
|
* and the grants are the answer, so the list spans projects.
|
|
984
997
|
*
|
|
998
|
+
* With `name_contains`, only the projects whose name contains that text are
|
|
999
|
+
* listed. The search runs on the server together with the grants, so it
|
|
1000
|
+
* reaches every project the user can act on, however many there are, and
|
|
1001
|
+
* pages like the full list.
|
|
1002
|
+
*
|
|
985
1003
|
* With `project_id`, the projects are listed only when the session belongs to
|
|
986
1004
|
* that project. It names the project the session was signed in to, not one to
|
|
987
1005
|
* list.
|
|
@@ -1054,7 +1072,10 @@ const getCreateFlowUrl = () => {
|
|
|
1054
1072
|
* pattern with no live preview answers `403` with `proj.preview_not_live`;
|
|
1055
1073
|
* nothing deployed to the target answers `409` with `rel.not_deployed`; a
|
|
1056
1074
|
* revoked release answers `409` with `rel.revoked`. A request with no
|
|
1057
|
-
* `Origin` passes the gate and still needs a deployment target.
|
|
1075
|
+
* `Origin` passes the gate and still needs a deployment target. A loopback
|
|
1076
|
+
* origin passes it too, and so does the server's own origin, from which its
|
|
1077
|
+
* console previews a project's login; a step submitted from the server's
|
|
1078
|
+
* own origin is still refused unless the project lists it.
|
|
1058
1079
|
*
|
|
1059
1080
|
* The response contains an `id` field — the flow handle. Use it as the path
|
|
1060
1081
|
* parameter for all subsequent `/flow/{id}/submit` calls.
|
|
@@ -1192,10 +1213,10 @@ const getCreateAuthAttemptUrl = () => {
|
|
|
1192
1213
|
* also include session_id and that session's session_token to add factors to an existing session.
|
|
1193
1214
|
*
|
|
1194
1215
|
* The project comes from the project secret. A body `project_id` that disagrees
|
|
1195
|
-
* answers `403` with `proj.mismatch`.
|
|
1196
|
-
*
|
|
1197
|
-
*
|
|
1198
|
-
*
|
|
1216
|
+
* answers `403` with `proj.mismatch`. Sealed `deployment_id` / `release_id` are
|
|
1217
|
+
* filled only when create runs with a runtime resolution already on the
|
|
1218
|
+
* context (the flow create path); this HTTP entry point does not resolve
|
|
1219
|
+
* Origin or refuse a revoked release itself.
|
|
1199
1220
|
* @summary Create a new authentication attempt
|
|
1200
1221
|
*/
|
|
1201
1222
|
const createAuthAttempt = async (createAuthAttemptBody, options) => {
|
|
@@ -1228,9 +1249,6 @@ const getGetAuthAttemptUrl = (attemptId) => {
|
|
|
1228
1249
|
*
|
|
1229
1250
|
* Use this for polling during long-running factor verifications (e.g., waiting for
|
|
1230
1251
|
* a federated IdP callback or a device flow).
|
|
1231
|
-
*
|
|
1232
|
-
* Reuses the deployment sealed when the attempt was created. If that release
|
|
1233
|
-
* was revoked since, the response is `409` with `rel.revoked`.
|
|
1234
1252
|
* @summary Get authentication attempt state
|
|
1235
1253
|
*/
|
|
1236
1254
|
const getAuthAttempt = async (attemptId, options) => {
|
|
@@ -1249,9 +1267,6 @@ const getIssueChallengeUrl = (attemptId) => {
|
|
|
1249
1267
|
* (password, passkey, TOTP, OTP via SMS, etc.). The server responds with challenge details
|
|
1250
1268
|
* including method, metadata, and any UI hints. The client then verifies the proof
|
|
1251
1269
|
* by calling POST /auth_attempts/{attempt_id}/challenges/{challenge_id}/verify.
|
|
1252
|
-
*
|
|
1253
|
-
* Reuses the deployment sealed when the attempt was created. If that release
|
|
1254
|
-
* was revoked since, the response is `409` with `rel.revoked`.
|
|
1255
1270
|
* @summary Issue a factor challenge
|
|
1256
1271
|
*/
|
|
1257
1272
|
const issueChallenge = async (attemptId, issueChallengeBody, options) => {
|
|
@@ -1287,9 +1302,6 @@ const getVerifyChallengeProofUrl = (attemptId, challengeId) => {
|
|
|
1287
1302
|
*
|
|
1288
1303
|
* On successful verification, the factor is written to the auth attempt.
|
|
1289
1304
|
* The attempt moves to the next pending challenge or completes if all required factors are verified.
|
|
1290
|
-
*
|
|
1291
|
-
* Reuses the deployment sealed when the attempt was created. If that release
|
|
1292
|
-
* was revoked since, the response is `409` with `rel.revoked`.
|
|
1293
1305
|
* @summary Verify a factor proof
|
|
1294
1306
|
*/
|
|
1295
1307
|
const verifyChallengeProof = async (attemptId, challengeId, verifyChallengeProofBody, options) => {
|
|
@@ -1326,8 +1338,7 @@ const getCreateHandoffUrl = (attemptId) => {
|
|
|
1326
1338
|
* - Audience-bound (requires matching project key for exchange)
|
|
1327
1339
|
* - Idempotency-safe within a 5-minute window (see conventions)
|
|
1328
1340
|
*
|
|
1329
|
-
*
|
|
1330
|
-
* was revoked since, the response is `409` with `rel.revoked`.
|
|
1341
|
+
* Revoke refusal for a sealed release happens at handoff exchange, not here.
|
|
1331
1342
|
* @summary Complete authentication and create handoff token
|
|
1332
1343
|
*/
|
|
1333
1344
|
const createHandoff = async (attemptId, options) => {
|
|
@@ -1437,6 +1448,51 @@ const patchProject = async (projectId, patchProjectBody, options) => {
|
|
|
1437
1448
|
body: JSON.stringify(patchProjectBody)
|
|
1438
1449
|
});
|
|
1439
1450
|
};
|
|
1451
|
+
const getListProjectAdminsUrl = (projectId, params) => {
|
|
1452
|
+
const normalizedParams = new URLSearchParams();
|
|
1453
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1454
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1455
|
+
});
|
|
1456
|
+
const stringifiedParams = normalizedParams.toString();
|
|
1457
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/admins?${stringifiedParams}` : `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/admins`;
|
|
1458
|
+
};
|
|
1459
|
+
/**
|
|
1460
|
+
* Lists the people who can administer the project, and how each of them
|
|
1461
|
+
* gets that access. A person appears once, with one entry in `sources` per
|
|
1462
|
+
* way they hold it:
|
|
1463
|
+
*
|
|
1464
|
+
* - `owning_team`: an active member of the team that owns the project
|
|
1465
|
+
* (ADR 054 §2). Removing a grant does not remove this access; it ends
|
|
1466
|
+
* only when the person leaves the team or the project changes owner.
|
|
1467
|
+
* - `grant`: an unexpired `admin` grant on the project, either to the
|
|
1468
|
+
* person (`grant_id` only) or to a team they are an active member of
|
|
1469
|
+
* (`grant_id` and `team`). Revoking that grant removes this source.
|
|
1470
|
+
*
|
|
1471
|
+
* The list follows the authorization check: team membership is read from
|
|
1472
|
+
* the same membership projection the check expands, so a person who left a
|
|
1473
|
+
* team, or whose team or user was deactivated, is not listed through it.
|
|
1474
|
+
* Grants that expired or carry a lower role are left out. A person whose
|
|
1475
|
+
* only access is a `viewer` or `editor` grant is not an admin and is not
|
|
1476
|
+
* listed. Like the check, the list does not look at a person's user status
|
|
1477
|
+
* beyond that, so a direct grant to a suspended person is listed.
|
|
1478
|
+
*
|
|
1479
|
+
* A person whose access comes only through teams the caller is not a
|
|
1480
|
+
* member of is left out, and a team the caller is not in is named by
|
|
1481
|
+
* `team_id` only. The grant to such a team still shows in the project's
|
|
1482
|
+
* grants.
|
|
1483
|
+
*
|
|
1484
|
+
* Ordered by `user_id` and paginated with `page_token`.
|
|
1485
|
+
*
|
|
1486
|
+
* Accepts either a project secret (`oauth2`) or a user-bound Console
|
|
1487
|
+
* session cookie (`nextgenSession`) that can read the project.
|
|
1488
|
+
* @summary List project admins
|
|
1489
|
+
*/
|
|
1490
|
+
const listProjectAdmins = async (projectId, params, options) => {
|
|
1491
|
+
return customFetch(getListProjectAdminsUrl(projectId, params), {
|
|
1492
|
+
...options,
|
|
1493
|
+
method: "GET"
|
|
1494
|
+
});
|
|
1495
|
+
};
|
|
1440
1496
|
const getInitClaimUrl = (projectId) => {
|
|
1441
1497
|
return `${getProxyPath()}/projects/${encodeURIComponent(String(projectId))}/claim/init`;
|
|
1442
1498
|
};
|
|
@@ -2412,6 +2468,141 @@ const getIdpRevisionById = async (revisionId, params, options) => {
|
|
|
2412
2468
|
method: "GET"
|
|
2413
2469
|
});
|
|
2414
2470
|
};
|
|
2471
|
+
const getListPoliciesUrl = (params) => {
|
|
2472
|
+
const normalizedParams = new URLSearchParams();
|
|
2473
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2474
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2475
|
+
});
|
|
2476
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2477
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/policies?${stringifiedParams}` : `${getProxyPath()}/policies`;
|
|
2478
|
+
};
|
|
2479
|
+
/**
|
|
2480
|
+
* Lists the project's policies, one per operation, each as its newest
|
|
2481
|
+
* revision, ordered by `created_at` (first publish) and then `id`. Filter
|
|
2482
|
+
* by `operation` to read the policy of one operation; a project that never
|
|
2483
|
+
* published one gets an empty list.
|
|
2484
|
+
*
|
|
2485
|
+
* The lookup is scoped to the project in `project_id`.
|
|
2486
|
+
* @summary List policies
|
|
2487
|
+
*/
|
|
2488
|
+
const listPolicies = async (params, options) => {
|
|
2489
|
+
return customFetch(getListPoliciesUrl(params), {
|
|
2490
|
+
...options,
|
|
2491
|
+
method: "GET"
|
|
2492
|
+
});
|
|
2493
|
+
};
|
|
2494
|
+
const getPublishPolicyUrl = (params) => {
|
|
2495
|
+
const normalizedParams = new URLSearchParams();
|
|
2496
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2497
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2498
|
+
});
|
|
2499
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2500
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/policies?${stringifiedParams}` : `${getProxyPath()}/policies`;
|
|
2501
|
+
};
|
|
2502
|
+
/**
|
|
2503
|
+
* Publishes the project's policy for an operation as a new immutable
|
|
2504
|
+
* revision, creating the policy on its first publish. The newest revision
|
|
2505
|
+
* applies to the next time the operation runs; nothing already stored is
|
|
2506
|
+
* re-evaluated, so a stricter password policy applies the next time a
|
|
2507
|
+
* password is set.
|
|
2508
|
+
*
|
|
2509
|
+
* The request is typed by `operation`: an unknown operation or setting, or
|
|
2510
|
+
* a value of the wrong type or outside its bounds, answers `req.invalid`
|
|
2511
|
+
* like any malformed request. The operation's template then checks the
|
|
2512
|
+
* config again, together with the rules that relate settings to each other
|
|
2513
|
+
* (a `min_length` above `max_length`), and answers `pol.invalid`. Its
|
|
2514
|
+
* `details.details.violations` lists everything that failed, settings
|
|
2515
|
+
* first, then rules: `{"setting": "min_length"}` for one setting, or
|
|
2516
|
+
* `{"config_rule": "min_length_not_above_max_length", "settings":
|
|
2517
|
+
* ["min_length", "max_length"]}` for a rule across settings, with the
|
|
2518
|
+
* settings it reads. A setting left out is off, and `{}` switches every
|
|
2519
|
+
* rule off; there are no defaults.
|
|
2520
|
+
* @summary Publish a policy
|
|
2521
|
+
*/
|
|
2522
|
+
const publishPolicy = async (publishPolicyBody, params, options) => {
|
|
2523
|
+
const getHeaders = (h) => {
|
|
2524
|
+
if (!h) return {};
|
|
2525
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
2526
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2527
|
+
const headers = {};
|
|
2528
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
2529
|
+
return headers;
|
|
2530
|
+
};
|
|
2531
|
+
return customFetch(getPublishPolicyUrl(params), {
|
|
2532
|
+
...options,
|
|
2533
|
+
method: "POST",
|
|
2534
|
+
headers: {
|
|
2535
|
+
"Content-Type": "application/json",
|
|
2536
|
+
...getHeaders(options?.headers)
|
|
2537
|
+
},
|
|
2538
|
+
body: JSON.stringify(publishPolicyBody)
|
|
2539
|
+
});
|
|
2540
|
+
};
|
|
2541
|
+
const getGetPolicyUrl = (policyId, params) => {
|
|
2542
|
+
const normalizedParams = new URLSearchParams();
|
|
2543
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2544
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2545
|
+
});
|
|
2546
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2547
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/policies/${encodeURIComponent(String(policyId))}?${stringifiedParams}` : `${getProxyPath()}/policies/${encodeURIComponent(String(policyId))}`;
|
|
2548
|
+
};
|
|
2549
|
+
/**
|
|
2550
|
+
* Reads a policy as its newest revision, the one that applies the next time
|
|
2551
|
+
* its operation runs.
|
|
2552
|
+
*
|
|
2553
|
+
* The lookup is scoped to the project in `project_id`: a policy of another
|
|
2554
|
+
* project answers not found exactly as an unknown id does.
|
|
2555
|
+
* @summary Get a policy
|
|
2556
|
+
*/
|
|
2557
|
+
const getPolicy = async (policyId, params, options) => {
|
|
2558
|
+
return customFetch(getGetPolicyUrl(policyId, params), {
|
|
2559
|
+
...options,
|
|
2560
|
+
method: "GET"
|
|
2561
|
+
});
|
|
2562
|
+
};
|
|
2563
|
+
const getListPolicyRevisionsUrl = (policyId, params) => {
|
|
2564
|
+
const normalizedParams = new URLSearchParams();
|
|
2565
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2566
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2567
|
+
});
|
|
2568
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2569
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/policies/${encodeURIComponent(String(policyId))}/revisions?${stringifiedParams}` : `${getProxyPath()}/policies/${encodeURIComponent(String(policyId))}/revisions`;
|
|
2570
|
+
};
|
|
2571
|
+
/**
|
|
2572
|
+
* Returns every revision of one policy, newest first, paginated with a
|
|
2573
|
+
* cursor. The order is fixed, so there is no `sorting`.
|
|
2574
|
+
*
|
|
2575
|
+
* The lookup is scoped to the project in `project_id`: a policy of another
|
|
2576
|
+
* project answers not found exactly as an unknown id does.
|
|
2577
|
+
* @summary List the revisions of a policy
|
|
2578
|
+
*/
|
|
2579
|
+
const listPolicyRevisions = async (policyId, params, options) => {
|
|
2580
|
+
return customFetch(getListPolicyRevisionsUrl(policyId, params), {
|
|
2581
|
+
...options,
|
|
2582
|
+
method: "GET"
|
|
2583
|
+
});
|
|
2584
|
+
};
|
|
2585
|
+
const getGetPolicyRevisionUrl = (revisionId, params) => {
|
|
2586
|
+
const normalizedParams = new URLSearchParams();
|
|
2587
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2588
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2589
|
+
});
|
|
2590
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2591
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/policies/revisions/${encodeURIComponent(String(revisionId))}?${stringifiedParams}` : `${getProxyPath()}/policies/revisions/${encodeURIComponent(String(revisionId))}`;
|
|
2592
|
+
};
|
|
2593
|
+
/**
|
|
2594
|
+
* Reads one revision of a policy, newest or not.
|
|
2595
|
+
*
|
|
2596
|
+
* The lookup is scoped to the project in `project_id`: a revision of another
|
|
2597
|
+
* project answers not found exactly as an unknown id does.
|
|
2598
|
+
* @summary Get a policy revision
|
|
2599
|
+
*/
|
|
2600
|
+
const getPolicyRevision = async (revisionId, params, options) => {
|
|
2601
|
+
return customFetch(getGetPolicyRevisionUrl(revisionId, params), {
|
|
2602
|
+
...options,
|
|
2603
|
+
method: "GET"
|
|
2604
|
+
});
|
|
2605
|
+
};
|
|
2415
2606
|
const getCreateReleaseUrl = (params) => {
|
|
2416
2607
|
const normalizedParams = new URLSearchParams();
|
|
2417
2608
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -2507,7 +2698,9 @@ const getBuildReleaseUrl = (params) => {
|
|
|
2507
2698
|
* allocates nothing, however long ago it was built. Otherwise every resource is compared against the
|
|
2508
2699
|
* project's newest revision of the same handle: unchanged content reuses
|
|
2509
2700
|
* that revision, changed content allocates a new one, and the request
|
|
2510
|
-
* answers `201` with the new release.
|
|
2701
|
+
* answers `201` with the new release. A policy whose config matches only an
|
|
2702
|
+
* older revision allocates a new one too, so a request that resolves no
|
|
2703
|
+
* release, which reads the newest revision, applies it as well. Metadata is excluded from the
|
|
2511
2704
|
* comparison, so the same content under a different `message` is the same
|
|
2512
2705
|
* release.
|
|
2513
2706
|
*
|
|
@@ -2521,8 +2714,8 @@ const getBuildReleaseUrl = (params) => {
|
|
|
2521
2714
|
*
|
|
2522
2715
|
* Building writes revisions, so besides `release.write` it needs the write
|
|
2523
2716
|
* scope of every kind the bundle carries a resource of: `schema.write`,
|
|
2524
|
-
* `flow_definition.write`, `branding.write
|
|
2525
|
-
* per-kind create endpoints do. A missing scope answers `403` with `rel.permission_denied`,
|
|
2717
|
+
* `flow_definition.write`, `branding.write`, `idp.write` and
|
|
2718
|
+
* `policy.write`, as the per-kind create endpoints do. A missing scope answers `403` with `rel.permission_denied`,
|
|
2526
2719
|
* naming the kind. An empty kind needs no scope.
|
|
2527
2720
|
*
|
|
2528
2721
|
* Building a release does not deploy it. A release is not tied to an
|
|
@@ -2968,11 +3161,11 @@ const getCreateDeploymentUrl = (params) => {
|
|
|
2968
3161
|
* - `400 dep.invalid`: both or neither of `release_id` and `content_hash`;
|
|
2969
3162
|
* a primary origin named exactly; `primary` mixed with preview URLs;
|
|
2970
3163
|
* `primary` on a project with no primary origin; `ttl` with `primary`;
|
|
2971
|
-
* `ttl` above
|
|
3164
|
+
* `ttl` above 365 days (`P365D`).
|
|
2972
3165
|
* - `400 dep.variables_missing`: a referenced variable has no value for
|
|
2973
3166
|
* the kind; `details` names the kind and every missing variable.
|
|
2974
3167
|
* - `403 proj.origin_not_allowed`: a preview URL matches no preview
|
|
2975
|
-
* pattern.
|
|
3168
|
+
* pattern, or is a loopback URL.
|
|
2976
3169
|
* - `404 rel.not_found`: the release id or digest names no release here.
|
|
2977
3170
|
* - `409 dep.conflict`: `expected_deployment_id` is not the deployment
|
|
2978
3171
|
* this write replaces; `details.deployment` is that deployment.
|
|
@@ -3170,7 +3363,7 @@ function createZitadelClient(opts) {
|
|
|
3170
3363
|
} });
|
|
3171
3364
|
}
|
|
3172
3365
|
//#endregion
|
|
3173
|
-
//#region ../config/dist/defaults-
|
|
3366
|
+
//#region ../config/dist/defaults-Cuaveyma.mjs
|
|
3174
3367
|
var default_human_user_default = {
|
|
3175
3368
|
title: "DefaultHumanUserSchema",
|
|
3176
3369
|
$schema: "https://json-schema.org/draft/2020-12/schema",
|
|
@@ -3556,18 +3749,28 @@ function fieldBody(field, templateProps) {
|
|
|
3556
3749
|
};
|
|
3557
3750
|
}
|
|
3558
3751
|
/**
|
|
3752
|
+
* The fields a user's display name is made of, in order. A schema designates
|
|
3753
|
+
* those its use case collects as `x-display`, so a session names the user
|
|
3754
|
+
* ("Ada Lovelace") rather than leaving the app only their email.
|
|
3755
|
+
*/
|
|
3756
|
+
const DISPLAY_FIELDS = ["givenName", "familyName"];
|
|
3757
|
+
/**
|
|
3559
3758
|
* Narrow a rendered schema to the chosen use case: keep the preset-owned
|
|
3560
3759
|
* header and `x-auth-methods`, but replace `properties`/`required` with the
|
|
3561
|
-
* use case's field set
|
|
3760
|
+
* use case's field set, and designate its name fields as `x-display`. `email`
|
|
3761
|
+
* is the sole required property.
|
|
3562
3762
|
*/
|
|
3563
3763
|
function applyUseCaseToSchema(schema, useCase) {
|
|
3564
3764
|
const templateProps = schema.properties ?? {};
|
|
3765
|
+
const fields = useCaseFields(useCase);
|
|
3565
3766
|
const properties = {};
|
|
3566
|
-
for (const field of
|
|
3767
|
+
for (const field of fields) properties[field] = fieldBody(field, templateProps);
|
|
3768
|
+
const display = DISPLAY_FIELDS.filter((field) => fields.includes(field));
|
|
3567
3769
|
return {
|
|
3568
3770
|
...schema,
|
|
3569
3771
|
required: ["email"],
|
|
3570
|
-
properties
|
|
3772
|
+
properties,
|
|
3773
|
+
...display.length > 0 ? { "x-display": display } : {}
|
|
3571
3774
|
};
|
|
3572
3775
|
}
|
|
3573
3776
|
/**
|
|
@@ -4184,4 +4387,4 @@ Object.defineProperty(exports, "startLocalZitadel", {
|
|
|
4184
4387
|
}
|
|
4185
4388
|
});
|
|
4186
4389
|
|
|
4187
|
-
//# sourceMappingURL=src-
|
|
4390
|
+
//# sourceMappingURL=src-CaG3NNMx.cjs.map
|