@htilabs/platform-common-models 0.22.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.
Files changed (61) hide show
  1. package/dist/authz/index.cjs +539 -0
  2. package/dist/authz/index.cjs.map +1 -0
  3. package/dist/authz/index.d.cts +210 -0
  4. package/dist/authz/index.d.ts +210 -0
  5. package/dist/authz/index.js +507 -0
  6. package/dist/authz/index.js.map +1 -0
  7. package/dist/constants/index.d.cts +2 -1
  8. package/dist/constants/index.d.ts +2 -1
  9. package/dist/cvcs/index.cjs +647 -353
  10. package/dist/cvcs/index.cjs.map +1 -1
  11. package/dist/cvcs/index.d.cts +658 -362
  12. package/dist/cvcs/index.d.ts +658 -362
  13. package/dist/cvcs/index.js +647 -353
  14. package/dist/cvcs/index.js.map +1 -1
  15. package/dist/enums/index.cjs +1 -9
  16. package/dist/enums/index.cjs.map +1 -1
  17. package/dist/enums/index.d.cts +7 -15
  18. package/dist/enums/index.d.ts +7 -15
  19. package/dist/enums/index.js +1 -9
  20. package/dist/enums/index.js.map +1 -1
  21. package/dist/{platform-auth-CvAYFVhK.d.cts → ic-DpKrdgQP.d.cts} +1 -78
  22. package/dist/{platform-auth-CvAYFVhK.d.ts → ic-DpKrdgQP.d.ts} +1 -78
  23. package/dist/index.cjs +899 -362
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +3 -1
  26. package/dist/index.d.ts +3 -1
  27. package/dist/index.js +893 -362
  28. package/dist/index.js.map +1 -1
  29. package/dist/platform-auth-B49Ly57B.d.cts +78 -0
  30. package/dist/platform-auth-B49Ly57B.d.ts +78 -0
  31. package/dist/types/index.d.cts +2 -2
  32. package/dist/types/index.d.ts +2 -2
  33. package/package.json +6 -1
  34. package/src/__sot__/README.md +3 -1
  35. package/src/__sot__/adminRoles.pin.json +122 -0
  36. package/src/__sot__/adminRoles.published.json +77 -0
  37. package/src/__sot__/coreFunctionFields.ts +16 -0
  38. package/src/__sot__/coreFunctions.pin.json +114 -1
  39. package/src/__sot__/roleFields.ts +137 -0
  40. package/src/__sot__/userRoles.pin.json +174 -0
  41. package/src/__sot__/userRoles.published.json +103 -0
  42. package/src/__tests__/__snapshots__/cvc-sot.snap +5 -5
  43. package/src/__tests__/admin-roles-canon.test.ts +80 -0
  44. package/src/__tests__/authz-resolve.test.ts +712 -0
  45. package/src/__tests__/core-functions-canon.test.ts +62 -12
  46. package/src/__tests__/cvc-sot-snapshot.test.ts +12 -4
  47. package/src/__tests__/cvc-status-parser.test.ts +1 -1
  48. package/src/__tests__/cvc-structural.test.ts +3 -3
  49. package/src/__tests__/role-vocab-gate.ts +279 -0
  50. package/src/__tests__/user-roles-canon.test.ts +104 -0
  51. package/src/authz/index.ts +9 -0
  52. package/src/authz/resolveEffectiveFunctions.ts +454 -0
  53. package/src/cvcs/adminRoles.v2.0.0.json +197 -0
  54. package/src/cvcs/{coreFunctions.v1.2.0.json → coreFunctions.v1.3.0.json} +357 -200
  55. package/src/cvcs/index.ts +3 -3
  56. package/src/cvcs/userRoles.v2.0.0.json +296 -0
  57. package/src/generated/coreFunctionsEvaluable.ts +101 -0
  58. package/src/generated/cvc-enums.ts +7 -15
  59. package/src/index.ts +4 -0
  60. package/src/cvcs/adminRoles.v1.0.0.json +0 -153
  61. package/src/cvcs/userRoles.v1.0.0.json +0 -203
@@ -3694,9 +3694,9 @@ declare const RiskCategoryKeys: {
3694
3694
  };
3695
3695
  type RiskCategoryKey = keyof typeof RiskCategoryKeys;
3696
3696
  /**
3697
- * Key → positional code map for the `core_functions` CVC domain (CANONICAL Notion CVC-133 `core - functions`, Active v2.0 — the Canonical Authorization Model function registry; SOT v1.2.0 is GENERATED from the prototype repo's data/cvcs/core_functions.yaml by scripts/gen-core-functions.py: 113 functions — the 78 published by 1.0.0/1.1.0 at their codes plus 35 appended at 133-079 … 133-113 — the roles → functions → gates/tiers graph is built over. NOT provisional numbering. Per-entry lifecycle Status (v1 / not v1), Platform Relevance, user/admin relevance and Category are carried in each entry's definition suffix, since the CVC entry schema has no fields for them; bounds are not carried).
3697
+ * Key → positional code map for the `core_functions` CVC domain (CANONICAL Notion CVC-133 `core - functions`, Active v2.0 — the Canonical Authorization Model function registry; SOT v1.3.0 is GENERATED from the prototype repo's data/cvcs/core_functions.yaml by scripts/gen-core-functions.py: 113 functions — the 78 published by 1.0.0/1.1.0 at their codes plus 35 appended at 133-079 … 133-113 — the roles → functions → gates/tiers graph is built over. NOT provisional numbering. Each entry carries canon's `v1` / `retired` flags as structured booleans (since 1.3.0, read by the shared authorization resolver); Platform Relevance, user/admin relevance and Category ride the definition suffix; bounds are not carried).
3698
3698
  *
3699
- * Domain: `core_functions` · Version: 1.2.0 · Entries: 117
3699
+ * Domain: `core_functions` · Version: 1.3.0 · Entries: 117
3700
3700
  */
3701
3701
  declare const CoreFunctionsKeys: {
3702
3702
  readonly missingness_root: "133-000-000-000-000-000-000";
@@ -4349,15 +4349,11 @@ declare const RiskSeverityBandKeys: {
4349
4349
  };
4350
4350
  type RiskSeverityBandKey = keyof typeof RiskSeverityBandKeys;
4351
4351
  /**
4352
- * Key → positional code map for the `admin_roles` CVC domain (CVC-134). Administrative role axis of the canonical authorization model (IC-66); distinct from CVC-135 `user_roles`.
4352
+ * Key → positional code map for the `admin_roles` CVC domain (CVC-134). Administrative / control-plane role axis of the canonical authorization model (IC-66; admin ≠ content visibility); distinct from CVC-135 `user_roles`. SOT v2.0.0 is GENERATED from the prototype repo's data/cvcs/core_admin_role.yaml by scripts/gen-admin-roles.py. Keys transliterate canon's hyphenated codes (`PLT-ADM` → `plt_adm`; canon spelling on `canonicalCode`). No missingness keys (the 1.0.0 quadruplet is withdrawn). Canon's legacy `ACCT-ADM` resolves to `mem_adm` through `adminRolesSot._supersedes.keyMap`, which is key-space (look up `acct_adm`: lowercase, `-` → `_`).
4353
4353
  *
4354
- * Domain: `admin_roles` · Version: 1.0.0 · Entries: 14
4354
+ * Domain: `admin_roles` · Version: 2.0.0 · Entries: 10
4355
4355
  */
4356
4356
  declare const AdminRoleKeys: {
4357
- readonly missingness_root: "134-000-000-000-000-000-000";
4358
- readonly unknown: "134-000-000-000-000-000-001";
4359
- readonly anonymous: "134-000-000-000-000-000-002";
4360
- readonly data_not_collected: "134-000-000-000-000-000-003";
4361
4357
  readonly plt_adm: "134-001-000-000-000-000-000";
4362
4358
  readonly plt_sup: "134-002-000-000-000-000-000";
4363
4359
  readonly mem_adm: "134-003-000-000-000-000-000";
@@ -4371,19 +4367,15 @@ declare const AdminRoleKeys: {
4371
4367
  };
4372
4368
  type AdminRoleKey = keyof typeof AdminRoleKeys;
4373
4369
  /**
4374
- * Key → positional code map for the `user_roles` CVC domain (CVC-135). Operational / practitioner role axis of the canonical authorization model (IC-66); distinct from CVC-134 `admin_roles`.
4370
+ * Key → positional code map for the `user_roles` CVC domain (CVC-135). Operational / practitioner role axis of the canonical authorization model (IC-66); distinct from CVC-134 `admin_roles`. SOT v2.0.0 is GENERATED from the prototype repo's data/cvcs/core_user_role.yaml by scripts/gen-user-roles.py; canon re-keyed `hotline_op` to `crisis_response` at the same code (135-004). No missingness keys (the 1.0.0 quadruplet is withdrawn; a role is assigned, never observed). A stored `hotline_op`, or canon's legacy `case_advocate` / `leads_investigator`, resolves through `userRolesSot._supersedes.keyMap`.
4375
4371
  *
4376
- * Domain: `user_roles` · Version: 1.0.0 · Entries: 19
4372
+ * Domain: `user_roles` · Version: 2.0.0 · Entries: 15
4377
4373
  */
4378
4374
  declare const UserRoleKeys: {
4379
- readonly missingness_root: "135-000-000-000-000-000-000";
4380
- readonly unknown: "135-000-000-000-000-000-001";
4381
- readonly anonymous: "135-000-000-000-000-000-002";
4382
- readonly data_not_collected: "135-000-000-000-000-000-003";
4383
4375
  readonly case_nav: "135-001-000-000-000-000-000";
4384
4376
  readonly healthcare_provider_medical: "135-002-000-000-000-000-000";
4385
4377
  readonly behavioral_health_provider: "135-003-000-000-000-000-000";
4386
- readonly hotline_op: "135-004-000-000-000-000-000";
4378
+ readonly crisis_response: "135-004-000-000-000-000-000";
4387
4379
  readonly intel_analyst: "135-005-000-000-000-000-000";
4388
4380
  readonly investigator: "135-006-000-000-000-000-000";
4389
4381
  readonly le_liaison_vsp: "135-007-000-000-000-000-000";
@@ -3694,9 +3694,9 @@ declare const RiskCategoryKeys: {
3694
3694
  };
3695
3695
  type RiskCategoryKey = keyof typeof RiskCategoryKeys;
3696
3696
  /**
3697
- * Key → positional code map for the `core_functions` CVC domain (CANONICAL Notion CVC-133 `core - functions`, Active v2.0 — the Canonical Authorization Model function registry; SOT v1.2.0 is GENERATED from the prototype repo's data/cvcs/core_functions.yaml by scripts/gen-core-functions.py: 113 functions — the 78 published by 1.0.0/1.1.0 at their codes plus 35 appended at 133-079 … 133-113 — the roles → functions → gates/tiers graph is built over. NOT provisional numbering. Per-entry lifecycle Status (v1 / not v1), Platform Relevance, user/admin relevance and Category are carried in each entry's definition suffix, since the CVC entry schema has no fields for them; bounds are not carried).
3697
+ * Key → positional code map for the `core_functions` CVC domain (CANONICAL Notion CVC-133 `core - functions`, Active v2.0 — the Canonical Authorization Model function registry; SOT v1.3.0 is GENERATED from the prototype repo's data/cvcs/core_functions.yaml by scripts/gen-core-functions.py: 113 functions — the 78 published by 1.0.0/1.1.0 at their codes plus 35 appended at 133-079 … 133-113 — the roles → functions → gates/tiers graph is built over. NOT provisional numbering. Each entry carries canon's `v1` / `retired` flags as structured booleans (since 1.3.0, read by the shared authorization resolver); Platform Relevance, user/admin relevance and Category ride the definition suffix; bounds are not carried).
3698
3698
  *
3699
- * Domain: `core_functions` · Version: 1.2.0 · Entries: 117
3699
+ * Domain: `core_functions` · Version: 1.3.0 · Entries: 117
3700
3700
  */
3701
3701
  declare const CoreFunctionsKeys: {
3702
3702
  readonly missingness_root: "133-000-000-000-000-000-000";
@@ -4349,15 +4349,11 @@ declare const RiskSeverityBandKeys: {
4349
4349
  };
4350
4350
  type RiskSeverityBandKey = keyof typeof RiskSeverityBandKeys;
4351
4351
  /**
4352
- * Key → positional code map for the `admin_roles` CVC domain (CVC-134). Administrative role axis of the canonical authorization model (IC-66); distinct from CVC-135 `user_roles`.
4352
+ * Key → positional code map for the `admin_roles` CVC domain (CVC-134). Administrative / control-plane role axis of the canonical authorization model (IC-66; admin ≠ content visibility); distinct from CVC-135 `user_roles`. SOT v2.0.0 is GENERATED from the prototype repo's data/cvcs/core_admin_role.yaml by scripts/gen-admin-roles.py. Keys transliterate canon's hyphenated codes (`PLT-ADM` → `plt_adm`; canon spelling on `canonicalCode`). No missingness keys (the 1.0.0 quadruplet is withdrawn). Canon's legacy `ACCT-ADM` resolves to `mem_adm` through `adminRolesSot._supersedes.keyMap`, which is key-space (look up `acct_adm`: lowercase, `-` → `_`).
4353
4353
  *
4354
- * Domain: `admin_roles` · Version: 1.0.0 · Entries: 14
4354
+ * Domain: `admin_roles` · Version: 2.0.0 · Entries: 10
4355
4355
  */
4356
4356
  declare const AdminRoleKeys: {
4357
- readonly missingness_root: "134-000-000-000-000-000-000";
4358
- readonly unknown: "134-000-000-000-000-000-001";
4359
- readonly anonymous: "134-000-000-000-000-000-002";
4360
- readonly data_not_collected: "134-000-000-000-000-000-003";
4361
4357
  readonly plt_adm: "134-001-000-000-000-000-000";
4362
4358
  readonly plt_sup: "134-002-000-000-000-000-000";
4363
4359
  readonly mem_adm: "134-003-000-000-000-000-000";
@@ -4371,19 +4367,15 @@ declare const AdminRoleKeys: {
4371
4367
  };
4372
4368
  type AdminRoleKey = keyof typeof AdminRoleKeys;
4373
4369
  /**
4374
- * Key → positional code map for the `user_roles` CVC domain (CVC-135). Operational / practitioner role axis of the canonical authorization model (IC-66); distinct from CVC-134 `admin_roles`.
4370
+ * Key → positional code map for the `user_roles` CVC domain (CVC-135). Operational / practitioner role axis of the canonical authorization model (IC-66); distinct from CVC-134 `admin_roles`. SOT v2.0.0 is GENERATED from the prototype repo's data/cvcs/core_user_role.yaml by scripts/gen-user-roles.py; canon re-keyed `hotline_op` to `crisis_response` at the same code (135-004). No missingness keys (the 1.0.0 quadruplet is withdrawn; a role is assigned, never observed). A stored `hotline_op`, or canon's legacy `case_advocate` / `leads_investigator`, resolves through `userRolesSot._supersedes.keyMap`.
4375
4371
  *
4376
- * Domain: `user_roles` · Version: 1.0.0 · Entries: 19
4372
+ * Domain: `user_roles` · Version: 2.0.0 · Entries: 15
4377
4373
  */
4378
4374
  declare const UserRoleKeys: {
4379
- readonly missingness_root: "135-000-000-000-000-000-000";
4380
- readonly unknown: "135-000-000-000-000-000-001";
4381
- readonly anonymous: "135-000-000-000-000-000-002";
4382
- readonly data_not_collected: "135-000-000-000-000-000-003";
4383
4375
  readonly case_nav: "135-001-000-000-000-000-000";
4384
4376
  readonly healthcare_provider_medical: "135-002-000-000-000-000-000";
4385
4377
  readonly behavioral_health_provider: "135-003-000-000-000-000-000";
4386
- readonly hotline_op: "135-004-000-000-000-000-000";
4378
+ readonly crisis_response: "135-004-000-000-000-000-000";
4387
4379
  readonly intel_analyst: "135-005-000-000-000-000-000";
4388
4380
  readonly investigator: "135-006-000-000-000-000-000";
4389
4381
  readonly le_liaison_vsp: "135-007-000-000-000-000-000";
@@ -3404,10 +3404,6 @@ var RiskSeverityBandKeys = {
3404
3404
  risk_5: "238-005-000-000-000-000-000"
3405
3405
  };
3406
3406
  var AdminRoleKeys = {
3407
- missingness_root: "134-000-000-000-000-000-000",
3408
- unknown: "134-000-000-000-000-000-001",
3409
- anonymous: "134-000-000-000-000-000-002",
3410
- data_not_collected: "134-000-000-000-000-000-003",
3411
3407
  plt_adm: "134-001-000-000-000-000-000",
3412
3408
  plt_sup: "134-002-000-000-000-000-000",
3413
3409
  mem_adm: "134-003-000-000-000-000-000",
@@ -3420,14 +3416,10 @@ var AdminRoleKeys = {
3420
3416
  train_adm: "134-010-000-000-000-000-000"
3421
3417
  };
3422
3418
  var UserRoleKeys = {
3423
- missingness_root: "135-000-000-000-000-000-000",
3424
- unknown: "135-000-000-000-000-000-001",
3425
- anonymous: "135-000-000-000-000-000-002",
3426
- data_not_collected: "135-000-000-000-000-000-003",
3427
3419
  case_nav: "135-001-000-000-000-000-000",
3428
3420
  healthcare_provider_medical: "135-002-000-000-000-000-000",
3429
3421
  behavioral_health_provider: "135-003-000-000-000-000-000",
3430
- hotline_op: "135-004-000-000-000-000-000",
3422
+ crisis_response: "135-004-000-000-000-000-000",
3431
3423
  intel_analyst: "135-005-000-000-000-000-000",
3432
3424
  investigator: "135-006-000-000-000-000-000",
3433
3425
  le_liaison_vsp: "135-007-000-000-000-000-000",