@zitadel/testing 0.2.0 → 0.3.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/dist/index.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("./src-
|
|
2
|
+
const require_src = require("./src-BxDa7FSy.cjs");
|
|
3
3
|
const require_handshake = require("./handshake-D6MXSUcd.cjs");
|
|
4
4
|
exports.SESSION_COOKIE_NAME = require_src.SESSION_COOKIE_NAME;
|
|
5
5
|
exports.applyAppEnvTemplate = require_handshake.applyAppEnvTemplate;
|
package/dist/playwright.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_src = require("./src-
|
|
2
|
+
const require_src = require("./src-BxDa7FSy.cjs");
|
|
3
3
|
const require_handshake = require("./handshake-D6MXSUcd.cjs");
|
|
4
4
|
const require_orchestration = require("./orchestration-gIDANMcF.cjs");
|
|
5
5
|
let node_fs = require("node:fs");
|
|
@@ -335,6 +335,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
335
335
|
deleteTeam: () => deleteTeam,
|
|
336
336
|
deleteUserByID: () => deleteUserByID,
|
|
337
337
|
deleteVariable: () => deleteVariable,
|
|
338
|
+
evaluatePolicy: () => evaluatePolicy,
|
|
338
339
|
exchangeHandoff: () => exchangeHandoff,
|
|
339
340
|
finishUserPasskeyRegistration: () => finishUserPasskeyRegistration,
|
|
340
341
|
getAddOriginUrl: () => getAddOriginUrl,
|
|
@@ -365,6 +366,7 @@ var zitadelNextGen_exports = /* @__PURE__ */ __exportAll({
|
|
|
365
366
|
getDeleteVariableUrl: () => getDeleteVariableUrl,
|
|
366
367
|
getDeploymentById: () => getDeploymentById,
|
|
367
368
|
getDeploymentVariables: () => getDeploymentVariables,
|
|
369
|
+
getEvaluatePolicyUrl: () => getEvaluatePolicyUrl,
|
|
368
370
|
getEvent: () => getEvent,
|
|
369
371
|
getExchangeHandoffUrl: () => getExchangeHandoffUrl,
|
|
370
372
|
getFinishUserPasskeyRegistrationUrl: () => getFinishUserPasskeyRegistrationUrl,
|
|
@@ -665,9 +667,11 @@ const getDeleteUserByIDUrl = (userId) => {
|
|
|
665
667
|
return `${getProxyPath()}/users/${encodeURIComponent(String(userId))}`;
|
|
666
668
|
};
|
|
667
669
|
/**
|
|
668
|
-
* Deletes a user
|
|
670
|
+
* Deletes a user, removes them from every team they belong to, and revokes
|
|
671
|
+
* every grant they hold, on any project.
|
|
669
672
|
*
|
|
670
|
-
* The user is removed, not deactivated, and the deletion emits `user.deleted
|
|
673
|
+
* The user is removed, not deactivated, and the deletion emits `user.deleted`,
|
|
674
|
+
* plus `authz.revoked` for each grant on that grant's project.
|
|
671
675
|
* With a project secret the request is idempotent: deleting a user that exists
|
|
672
676
|
* in no project succeeds without changing anything.
|
|
673
677
|
* @summary Delete user by ID
|
|
@@ -1992,6 +1996,12 @@ const createSchema = async (createSchemaBody, params, options) => {
|
|
|
1992
1996
|
const getListSchemasUrl = (params) => {
|
|
1993
1997
|
const normalizedParams = new URLSearchParams();
|
|
1994
1998
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
1999
|
+
if (Array.isArray(value) && ["expand"].includes(key)) {
|
|
2000
|
+
value.forEach((v) => {
|
|
2001
|
+
normalizedParams.append(key, v === null ? "null" : String(v));
|
|
2002
|
+
});
|
|
2003
|
+
return;
|
|
2004
|
+
}
|
|
1995
2005
|
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
1996
2006
|
});
|
|
1997
2007
|
const stringifiedParams = normalizedParams.toString();
|
|
@@ -2538,6 +2548,57 @@ const publishPolicy = async (publishPolicyBody, params, options) => {
|
|
|
2538
2548
|
body: JSON.stringify(publishPolicyBody)
|
|
2539
2549
|
});
|
|
2540
2550
|
};
|
|
2551
|
+
const getEvaluatePolicyUrl = (params) => {
|
|
2552
|
+
const normalizedParams = new URLSearchParams();
|
|
2553
|
+
Object.entries(params || {}).forEach(([key, value]) => {
|
|
2554
|
+
if (value !== void 0) normalizedParams.append(key, value === null ? "null" : String(value));
|
|
2555
|
+
});
|
|
2556
|
+
const stringifiedParams = normalizedParams.toString();
|
|
2557
|
+
return stringifiedParams.length > 0 ? `${getProxyPath()}/policies/evaluate?${stringifiedParams}` : `${getProxyPath()}/policies/evaluate`;
|
|
2558
|
+
};
|
|
2559
|
+
/**
|
|
2560
|
+
* Evaluates a policy config against one request, without side effects, and
|
|
2561
|
+
* answers the decision the operation would reach. Nothing is read from or
|
|
2562
|
+
* written to the project: the config is the one in the body, checked
|
|
2563
|
+
* exactly as a publish checks it, so an invalid config answers `pol.invalid`
|
|
2564
|
+
* with the same violations.
|
|
2565
|
+
*
|
|
2566
|
+
* `input` is what the operation's request carries, in the operation's own
|
|
2567
|
+
* terms (a password, not its length): the server derives what the policy
|
|
2568
|
+
* checks with the code the live operation runs, guards included. `facts`
|
|
2569
|
+
* states what the operation would look up at runtime, such as whether the
|
|
2570
|
+
* candidate matches one of the user's kept passwords.
|
|
2571
|
+
*
|
|
2572
|
+
* The decision and the names of the failed rules hold wherever the
|
|
2573
|
+
* operation runs. `code` and `violations` are what an API call answers; a
|
|
2574
|
+
* login flow shows the same rules as field errors on the password field
|
|
2575
|
+
* (`error.x-auth-methods#password_<rule>` in `step.error`).
|
|
2576
|
+
*
|
|
2577
|
+
* Which policy a project or release applies is not decided here: read it
|
|
2578
|
+
* and pass its config.
|
|
2579
|
+
*
|
|
2580
|
+
* The caller needs read access to the project in `project_id`.
|
|
2581
|
+
* @summary Evaluate a policy
|
|
2582
|
+
*/
|
|
2583
|
+
const evaluatePolicy = async (evaluatePolicyBody, params, options) => {
|
|
2584
|
+
const getHeaders = (h) => {
|
|
2585
|
+
if (!h) return {};
|
|
2586
|
+
if (h instanceof Headers) return Object.fromEntries(h.entries());
|
|
2587
|
+
if (Symbol.iterator in h) return Object.fromEntries(Array.from(h, (entry) => Array.from(entry)));
|
|
2588
|
+
const headers = {};
|
|
2589
|
+
for (const [name, value] of Object.entries(h)) if (value !== void 0) headers[name] = value;
|
|
2590
|
+
return headers;
|
|
2591
|
+
};
|
|
2592
|
+
return customFetch(getEvaluatePolicyUrl(params), {
|
|
2593
|
+
...options,
|
|
2594
|
+
method: "POST",
|
|
2595
|
+
headers: {
|
|
2596
|
+
"Content-Type": "application/json",
|
|
2597
|
+
...getHeaders(options?.headers)
|
|
2598
|
+
},
|
|
2599
|
+
body: JSON.stringify(evaluatePolicyBody)
|
|
2600
|
+
});
|
|
2601
|
+
};
|
|
2541
2602
|
const getGetPolicyUrl = (policyId, params) => {
|
|
2542
2603
|
const normalizedParams = new URLSearchParams();
|
|
2543
2604
|
Object.entries(params || {}).forEach(([key, value]) => {
|
|
@@ -4387,4 +4448,4 @@ Object.defineProperty(exports, "startLocalZitadel", {
|
|
|
4387
4448
|
}
|
|
4388
4449
|
});
|
|
4389
4450
|
|
|
4390
|
-
//# sourceMappingURL=src-
|
|
4451
|
+
//# sourceMappingURL=src-BxDa7FSy.cjs.map
|