@htilabs/platform-common-models 0.21.0 → 0.23.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/authz/index.cjs +539 -0
- package/dist/authz/index.cjs.map +1 -0
- package/dist/authz/index.d.cts +210 -0
- package/dist/authz/index.d.ts +210 -0
- package/dist/authz/index.js +507 -0
- package/dist/authz/index.js.map +1 -0
- package/dist/constants/index.d.cts +2 -1
- package/dist/constants/index.d.ts +2 -1
- package/dist/cvcs/index.cjs +936 -243
- package/dist/cvcs/index.cjs.map +1 -1
- package/dist/cvcs/index.d.cts +986 -254
- package/dist/cvcs/index.d.ts +986 -254
- package/dist/cvcs/index.js +936 -243
- package/dist/cvcs/index.js.map +1 -1
- package/dist/enums/index.cjs +37 -10
- package/dist/enums/index.cjs.map +1 -1
- package/dist/enums/index.d.cts +42 -15
- package/dist/enums/index.d.ts +42 -15
- package/dist/enums/index.js +37 -10
- package/dist/enums/index.js.map +1 -1
- package/dist/{platform-auth-CvAYFVhK.d.cts → ic-DpKrdgQP.d.cts} +1 -78
- package/dist/{platform-auth-CvAYFVhK.d.ts → ic-DpKrdgQP.d.ts} +1 -78
- package/dist/index.cjs +1328 -253
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -2
- package/dist/index.d.ts +4 -2
- package/dist/index.js +1313 -253
- package/dist/index.js.map +1 -1
- package/dist/platform-auth-B49Ly57B.d.cts +78 -0
- package/dist/platform-auth-B49Ly57B.d.ts +78 -0
- package/dist/schemas/index.cjs +104 -0
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +240 -1
- package/dist/schemas/index.d.ts +240 -1
- package/dist/schemas/index.js +95 -0
- package/dist/schemas/index.js.map +1 -1
- package/dist/types/index.d.cts +2 -2
- package/dist/types/index.d.ts +2 -2
- package/package.json +6 -1
- package/src/__sot__/README.md +3 -0
- package/src/__sot__/adminRoles.pin.json +122 -0
- package/src/__sot__/adminRoles.published.json +77 -0
- package/src/__sot__/coreFunctionFields.ts +137 -0
- package/src/__sot__/coreFunctions.pin.json +1659 -0
- package/src/__sot__/coreFunctions.published.json +233 -0
- package/src/__sot__/roleFields.ts +137 -0
- package/src/__sot__/userRoles.pin.json +174 -0
- package/src/__sot__/userRoles.published.json +103 -0
- package/src/__tests__/__snapshots__/cvc-sot.snap +6 -6
- package/src/__tests__/admin-roles-canon.test.ts +80 -0
- package/src/__tests__/authz-resolve.test.ts +712 -0
- package/src/__tests__/core-functions-canon.test.ts +358 -24
- package/src/__tests__/cvc-sot-snapshot.test.ts +17 -6
- package/src/__tests__/cvc-status-parser.test.ts +2 -2
- package/src/__tests__/cvc-structural.test.ts +3 -3
- package/src/__tests__/organization-program.test.ts +254 -0
- package/src/__tests__/role-vocab-gate.ts +279 -0
- package/src/__tests__/user-roles-canon.test.ts +104 -0
- package/src/authz/index.ts +9 -0
- package/src/authz/resolveEffectiveFunctions.ts +454 -0
- package/src/cvcs/adminRoles.v2.0.0.json +197 -0
- package/src/cvcs/{coreFunctions.v1.1.0.json → coreFunctions.v1.3.0.json} +646 -90
- package/src/cvcs/index.ts +3 -3
- package/src/cvcs/userRoles.v2.0.0.json +296 -0
- package/src/generated/coreFunctionsEvaluable.ts +101 -0
- package/src/generated/cvc-enums.ts +42 -15
- package/src/index.ts +4 -0
- package/src/schemas/index.ts +18 -0
- package/src/schemas/organization-program.ts +297 -0
- package/src/cvcs/adminRoles.v1.0.0.json +0 -153
- package/src/cvcs/userRoles.v1.0.0.json +0 -203
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ADMIN ROLES (CVC-134) — GATE K: the SOT restates canon, whole
|
|
3
|
+
* ==============================================================
|
|
4
|
+
*
|
|
5
|
+
* `src/cvcs/adminRoles.v2.0.0.json` is GENERATED from the canonical CVC-134
|
|
6
|
+
* codeset (`htilabstech/prototype` `data/cvcs/core_admin_role.yaml`) by
|
|
7
|
+
* `scripts/gen-admin-roles.py`. Hermetic enforcer against
|
|
8
|
+
* `src/__sot__/adminRoles.pin.json`; `npm run sot:pins:check` detects when
|
|
9
|
+
* canon moves. The shared contract lives in `role-vocab-gate.ts` (GATE J,
|
|
10
|
+
* CVC-135, asserts the same one); this file adds the CVC-134 specifics.
|
|
11
|
+
*
|
|
12
|
+
* History it closes: the 1.0.0 file was hand-imported in 0.8.13 from the June
|
|
13
|
+
* Notion export and validated against itself. Against canon it carried a stale
|
|
14
|
+
* PLT-ADM title, a stale definition on all 10 roles, a null TRAIN-ADM
|
|
15
|
+
* definition, none of canon's per-role fields (`reach`, `display_label`, …) and
|
|
16
|
+
* no reading for canon's legacy code ACCT-ADM.
|
|
17
|
+
*/
|
|
18
|
+
import { describe, it, expect } from "vitest";
|
|
19
|
+
|
|
20
|
+
import { AdminRoleKeys } from "../generated/cvc-enums.js";
|
|
21
|
+
import { adminRolesSot } from "../cvcs/index.js";
|
|
22
|
+
import { describeRoleVocabGate, loadRoleVocab, resolveStoredKey, type RoleGateConfig } from "./role-vocab-gate.js";
|
|
23
|
+
|
|
24
|
+
const cfg: RoleGateConfig = {
|
|
25
|
+
gate: "GATE K",
|
|
26
|
+
domain: "admin_roles",
|
|
27
|
+
prefix: "134",
|
|
28
|
+
stem: "adminRoles",
|
|
29
|
+
version: "2.0.0",
|
|
30
|
+
supersededVersion: "1.0.0",
|
|
31
|
+
canonFile: "data/cvcs/core_admin_role.yaml",
|
|
32
|
+
roleCount: 10,
|
|
33
|
+
keyOf: (code) => code.toLowerCase().replace(/-/g, "_"),
|
|
34
|
+
keys: AdminRoleKeys,
|
|
35
|
+
barrel: adminRolesSot,
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
describeRoleVocabGate(cfg);
|
|
39
|
+
|
|
40
|
+
describe("admin_roles — GATE K: CVC-134 specifics", () => {
|
|
41
|
+
const { sot, ledger } = loadRoleVocab(cfg);
|
|
42
|
+
const byKey = new Map(sot.entries.map((e) => [e.key, e] as const));
|
|
43
|
+
|
|
44
|
+
it("every 1.0.0 role key and code is unchanged (no re-key)", () => {
|
|
45
|
+
expect(ledger.renamed).toEqual({});
|
|
46
|
+
expect(Object.entries(AdminRoleKeys)).toEqual(
|
|
47
|
+
["plt_adm", "plt_sup", "mem_adm", "team_adm", "aud", "data_adm", "gov_aud", "ciro", "sup", "train_adm"].map(
|
|
48
|
+
(k, i) => [k, `134-${String(i + 1).padStart(3, "0")}-000-000-000-000-000`],
|
|
49
|
+
),
|
|
50
|
+
);
|
|
51
|
+
});
|
|
52
|
+
|
|
53
|
+
it("aliases canon's legacy ACCT-ADM to mem_adm (never a CVC-134 code nor a key of this package)", () => {
|
|
54
|
+
expect(ledger.aliases).toEqual({ acct_adm: { to: "mem_adm", canonical: "ACCT-ADM", version: "2.0.0" } });
|
|
55
|
+
// keyMap is key-space (the package convention); canon's spelling resolves after the key rule.
|
|
56
|
+
expect(sot._supersedes.keyMap["acct_adm"]).toBe("mem_adm");
|
|
57
|
+
expect(resolveStoredKey(cfg, "acct_adm")).toBe(AdminRoleKeys.mem_adm);
|
|
58
|
+
expect(resolveStoredKey(cfg, "ACCT-ADM")).toBe(AdminRoleKeys.mem_adm);
|
|
59
|
+
expect(resolveStoredKey(cfg, "MEM-ADM")).toBe(AdminRoleKeys.mem_adm);
|
|
60
|
+
});
|
|
61
|
+
|
|
62
|
+
it("ships TRAIN-ADM's drafted definition verbatim and keeps canon's ⚑ marker in definitionNote", () => {
|
|
63
|
+
const train = byKey.get("train_adm")!;
|
|
64
|
+
expect(train.definition).toMatch(/^Agency-set role that configures training\/certification requirements/);
|
|
65
|
+
expect(train.definition).not.toContain("⚑");
|
|
66
|
+
expect(train.definitionNote).toMatch(/⚑ Crysta to confirm\.$/);
|
|
67
|
+
expect(sot.entries.filter((e) => e.definitionNote !== undefined).map((e) => e.key)).toEqual(["train_adm"]);
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
it("carries canon's reach on every admin role, from canon's own value set", () => {
|
|
71
|
+
const reachValues = ["platform", "account", "team", "supervised_people"];
|
|
72
|
+
for (const e of sot.entries) expect(reachValues, e.key).toContain(e["reach"]);
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
it("retitles PLT-ADM to canon's live label and refreshes every role", () => {
|
|
76
|
+
expect(byKey.get("plt_adm")?.title).toBe("Platform Owner & Admin");
|
|
77
|
+
if (sot._supersedes.version !== "1.0.0") return; // `refreshed` is a per-bump record
|
|
78
|
+
expect(sot._supersedes.refreshed).toEqual(Object.keys(AdminRoleKeys));
|
|
79
|
+
});
|
|
80
|
+
});
|