@htilabs/platform-common-models 0.15.0 → 0.18.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 (76) hide show
  1. package/dist/agency-BHv54o79.d.ts +484 -0
  2. package/dist/agency-Ca4pCOOf.d.ts +342 -0
  3. package/dist/agency-DYCv839V.d.cts +342 -0
  4. package/dist/agency-Djp57S71.d.cts +484 -0
  5. package/dist/constants/index.cjs +952 -0
  6. package/dist/constants/index.cjs.map +1 -1
  7. package/dist/constants/index.d.cts +3 -1
  8. package/dist/constants/index.d.ts +3 -1
  9. package/dist/constants/index.js +920 -0
  10. package/dist/constants/index.js.map +1 -1
  11. package/dist/{cvcEntry-DaDrEuTa.d.cts → cvcEntry-0BIB9sen.d.cts} +44 -44
  12. package/dist/{cvcEntry-DaDrEuTa.d.ts → cvcEntry-0BIB9sen.d.ts} +44 -44
  13. package/dist/cvcs/index.cjs +182 -77
  14. package/dist/cvcs/index.cjs.map +1 -1
  15. package/dist/cvcs/index.d.cts +187 -78
  16. package/dist/cvcs/index.d.ts +187 -78
  17. package/dist/cvcs/index.js +182 -77
  18. package/dist/cvcs/index.js.map +1 -1
  19. package/dist/enums/index.cjs +3 -1
  20. package/dist/enums/index.cjs.map +1 -1
  21. package/dist/enums/index.d.cts +7 -5
  22. package/dist/enums/index.d.ts +7 -5
  23. package/dist/enums/index.js +3 -1
  24. package/dist/enums/index.js.map +1 -1
  25. package/dist/{index-C0J3f169.d.ts → index-CDoqrfc1.d.ts} +1 -1
  26. package/dist/{index-EPjPjR0z.d.cts → index-Zu_mOJRn.d.cts} +1 -1
  27. package/dist/index.cjs +1704 -1073
  28. package/dist/index.cjs.map +1 -1
  29. package/dist/index.d.cts +6 -4
  30. package/dist/index.d.ts +6 -4
  31. package/dist/index.js +1650 -1072
  32. package/dist/index.js.map +1 -1
  33. package/dist/models/index.d.cts +2 -2
  34. package/dist/models/index.d.ts +2 -2
  35. package/dist/org-type-BYQb9Qzq.d.ts +366 -0
  36. package/dist/org-type-D_FG4KdN.d.cts +366 -0
  37. package/dist/{platform-auth-CrF5U_JH.d.cts → platform-auth-CvAYFVhK.d.cts} +39 -0
  38. package/dist/{platform-auth-CrF5U_JH.d.ts → platform-auth-CvAYFVhK.d.ts} +39 -0
  39. package/dist/schemas/index.cjs +977 -2
  40. package/dist/schemas/index.cjs.map +1 -1
  41. package/dist/schemas/index.d.cts +38 -35
  42. package/dist/schemas/index.d.ts +38 -35
  43. package/dist/schemas/index.js +962 -1
  44. package/dist/schemas/index.js.map +1 -1
  45. package/dist/types/index.d.cts +2 -2
  46. package/dist/types/index.d.ts +2 -2
  47. package/dist/validation/index.cjs +894 -2
  48. package/dist/validation/index.cjs.map +1 -1
  49. package/dist/validation/index.d.cts +5 -1
  50. package/dist/validation/index.d.ts +5 -1
  51. package/dist/validation/index.js +884 -1
  52. package/dist/validation/index.js.map +1 -1
  53. package/package.json +26 -27
  54. package/src/__tests__/__snapshots__/cvc-sot.snap +5 -5
  55. package/src/__tests__/core-functions-canon.test.ts +53 -0
  56. package/src/__tests__/core-information-scope-invariant.test.ts +94 -4
  57. package/src/__tests__/cvc-sot-snapshot.test.ts +13 -10
  58. package/src/__tests__/cvc-status-parser.test.ts +1 -1
  59. package/src/__tests__/cvc-structural.test.ts +3 -3
  60. package/src/__tests__/org-type-contract.test.ts +1353 -0
  61. package/src/__tests__/referral-entity-category-canon.test.ts +255 -81
  62. package/src/constants/ic.ts +45 -0
  63. package/src/constants/index.ts +1 -0
  64. package/src/constants/org-type.ts +703 -0
  65. package/src/cvcs/{coreFunctions.v1.0.0.json → coreFunctions.v1.1.0.json} +11 -2
  66. package/src/cvcs/index.ts +3 -3
  67. package/src/cvcs/{referralEntityCategory.v1.1.0.json → referralEntityCategory.v1.2.0.json} +111 -59
  68. package/src/cvcs/{roiScope.v1.0.0.json → roiScope.v1.2.0.json} +51 -7
  69. package/src/generated/cvc-enums.ts +7 -5
  70. package/src/index.ts +23 -0
  71. package/src/schemas/agency.ts +481 -0
  72. package/src/schemas/index.ts +24 -0
  73. package/src/validation/agency.ts +119 -0
  74. package/src/validation/index.ts +1 -0
  75. package/dist/team-C4LJ5Tex.d.cts +0 -333
  76. package/dist/team-C4LJ5Tex.d.ts +0 -333
@@ -0,0 +1,53 @@
1
+ /**
2
+ * CORE FUNCTIONS (CVC-133) — v1.1.0 appends `note_open_departed_author`
3
+ *
4
+ * Canon added the Account Admin function on 2026-10-05 while building the
5
+ * Narrative notes Spec v2 (rule 10); its logic_notes mark the row as awaiting
6
+ * steward review (Crysta). `data/cvcs/core_functions.yaml` L68-93 @
7
+ * prototype 9ef79748 (unchanged at fed744f3). The SOT appends it at 133-078
8
+ * so every 1.0.0 code stays where it was; consumers gate on the key.
9
+ */
10
+
11
+ import { readFileSync } from "node:fs";
12
+ import path from "node:path";
13
+ import { fileURLToPath } from "node:url";
14
+
15
+ import { describe, it, expect } from "vitest";
16
+
17
+ import { CoreFunctionsKeys } from "../generated/cvc-enums.js";
18
+
19
+ const here = path.dirname(fileURLToPath(import.meta.url));
20
+ const cvcDir = path.join(here, "..", "cvcs");
21
+
22
+ interface Entry {
23
+ code: string;
24
+ key: string;
25
+ title: string;
26
+ selectable: boolean;
27
+ definition: string;
28
+ }
29
+
30
+ const sot = JSON.parse(
31
+ readFileSync(path.join(cvcDir, "coreFunctions.v1.1.0.json"), "utf8"),
32
+ ) as { version: string; entries: Entry[] };
33
+
34
+ describe("core_functions — note_open_departed_author (CVC-133 v1.1.0)", () => {
35
+ it("exports the key at its appended code", () => {
36
+ expect(CoreFunctionsKeys.note_open_departed_author).toBe("133-078-000-000-000-000-000");
37
+ });
38
+
39
+ it("carries canon's label and the PAVE + THREAD, admin-only posture", () => {
40
+ const row = sot.entries.find((e) => e.key === "note_open_departed_author");
41
+ expect(row?.title).toBe("Open a deactivated author's private notes");
42
+ expect(row?.selectable).toBe(true);
43
+ expect(row?.definition).toContain("Platform: PAVE, THREAD.");
44
+ expect(row?.definition).toContain("User-relevant: no. Admin-relevant: yes.");
45
+ });
46
+
47
+ it("is an append: it is the last entry and 1.0.0 is gone", () => {
48
+ expect(sot.version).toBe("1.1.0");
49
+ expect(sot.entries.at(-1)?.key).toBe("note_open_departed_author");
50
+ expect(sot.entries).toHaveLength(82);
51
+ expect(() => readFileSync(path.join(cvcDir, "coreFunctions.v1.0.0.json"))).toThrow();
52
+ });
53
+ });
@@ -4,12 +4,14 @@
4
4
  *
5
5
  * Two vocabularies describe the same thing at different grains:
6
6
  *
7
- * `roi_scope` flat item vocabulary, 27 substantive keys, no category axis
7
+ * `roi_scope` LEGACY flat item vocabulary, 27 substantive keys
8
+ * (25 live + 2 RETIRED tombstones), no category axis
8
9
  * `core_information_scope` 12 policy-grain CATEGORIES + 55 authorization-grain UNITS
9
10
  * (+ 2 RETIRED tombstones, 2026-10-05)
10
11
  *
11
- * PAVE and Thread are both pinned to `roi_scope` today, and both persist stored
12
- * ROIs against it. Migrating them to this domain is safe for exactly one reason:
12
+ * PAVE and Thread both hold stored ROIs written against `roi_scope` keys, and
13
+ * both now derive their live vocabulary from this domain, keeping `roi_scope`
14
+ * only as the stored-data provenance check. That move is safe for exactly one reason:
13
15
  * every substantive `roi_scope` key survives here, spelled identically, so a
14
16
  * stored ROI keeps its exact recorded meaning. That is not a nice-to-have — an
15
17
  * ROI whose meaning widens is a CONSENT change wearing a data change's clothes,
@@ -55,7 +57,7 @@ const read = (f: string): { entries: Entry[]; levels: Record<string, string> } =
55
57
  };
56
58
 
57
59
  const scope = read("coreInformationScope.v1.1.0.json");
58
- const roi = read("roiScope.v1.0.0.json");
60
+ const roi = read("roiScope.v1.2.0.json");
59
61
 
60
62
  const byCode = new Map(scope.entries.map((e) => [e.code, e]));
61
63
  const MISSINGNESS = new Set([
@@ -109,6 +111,45 @@ describe("core_information_scope — adoption invariants", () => {
109
111
  ]);
110
112
  });
111
113
 
114
+ it("gives ONE answer to 'is this offerable' across both vocabularies (co-bwc)", () => {
115
+ // Until roi_scope v1.2.0 the package answered twice: CVC-236 v1.1.0 had
116
+ // retired screen_notes / background while roi_scope still marked them
117
+ // selectable. Every shared key must now agree on selectable AND retired,
118
+ // so neither vocabulary can re-offer a retired unit as consent.
119
+ // Missingness keys included: the four shared sentinels must agree too.
120
+ const scopeByKey = new Map(scope.entries.map((u) => [u.key, u]));
121
+ const disagreements = roi.entries
122
+ .filter((e) => {
123
+ const twin = scopeByKey.get(e.key);
124
+ return (
125
+ twin === undefined ||
126
+ twin.selectable !== e.selectable ||
127
+ (twin.retired === true) !== (e.retired === true)
128
+ );
129
+ })
130
+ .map((e) => e.key);
131
+ expect(disagreements).toEqual([]);
132
+
133
+ // Scoped to CVC-236 tombstones whose key roi_scope carries: a future
134
+ // CVC-236-only retirement (a unit roi_scope never had) is not a
135
+ // divergence of the legacy vocabulary.
136
+ const roiKeys = new Set(roi.entries.map((e) => e.key));
137
+ const roiTombstones = roi.entries.filter((e) => e.retired === true);
138
+ expect(roiTombstones.map((e) => e.key).sort()).toEqual(
139
+ tombstones
140
+ .filter((t) => roiKeys.has(t.key))
141
+ .map((t) => t.key)
142
+ .sort(),
143
+ );
144
+ // A tombstone keeps its published roi_scope code (983-012 / 983-014) —
145
+ // codes are never withdrawn or reused.
146
+ expect(roiTombstones.map((e) => e.code).sort()).toEqual([
147
+ "983-012-000-000-000-000-000",
148
+ "983-014-000-000-000-000-000",
149
+ ]);
150
+ expect(roiTombstones.every((e) => e.selectable === false)).toBe(true);
151
+ });
152
+
112
153
  it("is a strict superset — the additions are additions, not renames", () => {
113
154
  expect(units.length).toBeGreaterThan(27);
114
155
  expect(units).toHaveLength(55);
@@ -526,3 +567,52 @@ describe("core_information_scope — v1.1.0 supersedes v1.0.0", () => {
526
567
  expect(() => readFileSync(path.join(cvcDir, "coreInformationScope.v1.0.0.json"))).toThrow();
527
568
  });
528
569
  });
570
+
571
+ /**
572
+ * roi_scope v1.2.0 supersedes v1.1.0 (co-bwc; ADR-CVC-0.8.13 Addendum
573
+ * 2026-10-05): tombstoning screen_notes / background to match CVC-236 v1.1.0
574
+ * takes `selectable` away from two published items, which is not additive.
575
+ * The superseded file was named `roiScope.v1.0.0.json` but declared 1.1.0;
576
+ * the declared version is the one superseded.
577
+ */
578
+ describe("roi_scope — v1.2.0 supersedes v1.1.0", () => {
579
+ const env = JSON.parse(
580
+ readFileSync(path.join(cvcDir, "roiScope.v1.2.0.json"), "utf8"),
581
+ ) as {
582
+ version: string;
583
+ _supersedes: {
584
+ version: string;
585
+ keyMap: Record<string, string>;
586
+ retiredCodes: unknown[];
587
+ notes: Record<string, string>;
588
+ };
589
+ entries: Entry[];
590
+ };
591
+ const sup = env._supersedes;
592
+
593
+ it("is version 1.2.0, superseding 1.1.0, with no code withdrawn", () => {
594
+ expect(env.version).toBe("1.2.0");
595
+ expect(sup.version).toBe("1.1.0");
596
+ expect(sup.retiredCodes).toEqual([]);
597
+ });
598
+
599
+ it("maps every v1.1.0 key to itself — nothing added, nothing renamed", () => {
600
+ expect(Object.keys(sup.keyMap)).toEqual(env.entries.map((e) => e.key));
601
+ expect(Object.keys(sup.keyMap)).toHaveLength(31);
602
+ for (const [from, to] of Object.entries(sup.keyMap)) expect(to, from).toBe(from);
603
+ });
604
+
605
+ it("notes each retirement, citing the CVC-236 twin", () => {
606
+ expect(Object.keys(sup.notes).sort()).toEqual(["background", "screen_notes", "summary"]);
607
+ for (const k of ["screen_notes", "background"]) {
608
+ expect(sup.notes[k], k).toContain("NO successor key");
609
+ expect(sup.notes[k], k).toContain("includes nothing");
610
+ expect(sup.notes[k], k).toContain("CVC-236 v1.1.0 retired the same key");
611
+ }
612
+ });
613
+
614
+ it("leaves no superseded file behind for the registry to resolve", () => {
615
+ expect(() => readFileSync(path.join(cvcDir, "roiScope.v1.0.0.json"))).toThrow();
616
+ expect(() => readFileSync(path.join(cvcDir, "roiScope.v1.1.0.json"))).toThrow();
617
+ });
618
+ });
@@ -375,15 +375,15 @@ const SOT_SPECS: readonly SotSpec[] = [
375
375
  domain: "location_type",
376
376
  expectedCount: 17,
377
377
  },
378
- // CVC-48 v1.1.0 (canon v1.3 re-mirror, ADDITIVE) — v1.0.0's 43 + 3 canon
378
+ // CVC-48 v1.1.0 (canon v1.3 re-mirror, ADDITIVE) — v1.0.0's 43 + 4 canon
379
379
  // leaves (Adult Protective Services, School / academic institution, Legal
380
- // services provider) = 46: 45 of canon's 46 rows + missingness_root. Canon's
381
- // `02-02-01-00` Hotline is deliberately not carried; see
380
+ // services provider, and since 0.18.0 Hotline at 048-006-003 with its two
381
+ // children re-parented) = 47: all 46 canon rows + missingness_root. See
382
382
  // referral-entity-category-canon.test.ts.
383
383
  {
384
- file: "referralEntityCategory.v1.1.0.json",
384
+ file: "referralEntityCategory.v1.2.0.json",
385
385
  domain: "referral_entity_category",
386
- expectedCount: 46,
386
+ expectedCount: 47,
387
387
  },
388
388
  // CVC-171 — 5 L1 type groups + 30 L2 source codes + 1 additive L1
389
389
  // `victim_compensation` group leaf (171-006) + 5 missingness = 41.
@@ -646,14 +646,17 @@ const SOT_SPECS: readonly SotSpec[] = [
646
646
  // fields) + 4 missingness = 9
647
647
  // ─── 0.8.12 vocabulary batch ───
648
648
  // CANONICAL Notion CVC-133 `core - functions` (verified v1.0): 77 functions
649
- // + 4 missingness = 81
650
- { file: "coreFunctions.v1.0.0.json", domain: "core_functions", expectedCount: 81 },
649
+ // + note_open_departed_author (133-078, appended 2026-10-05, Narrative notes
650
+ // Spec v2 rule 10; SOT v1.1.0, additive) + 4 missingness = 82
651
+ { file: "coreFunctions.v1.1.0.json", domain: "core_functions", expectedCount: 82 },
651
652
  // 9 fine-grained Needs-Assessment CAR change types (@pave/domain
652
653
  // NEEDS_ASSESSMENT_CHANGE_TYPES, casing normalized to lower_snake) + 4 = 13
653
654
  { file: "needsAssessmentChangeType.v1.0.0.json", domain: "needs_assessment_change_type", expectedCount: 13 },
654
- // 15 ROI scope items (@pave/domain ROI_SCOPE_KEYS — the PAVE-seed-attested
655
- // subset of the prototype's 27-item UI superset) + 4 = 19
656
- { file: "roiScope.v1.0.0.json", domain: "roi_scope", expectedCount: 31 },
655
+ // 27 ROI scope items (25 live + 2 RETIRED tombstones: screen_notes 983-012,
656
+ // background 983-014, retired 2026-10-05 to match CVC-236 v1.1.0 — codes
657
+ // kept, never reused) + 4 missingness = 31. SOT v1.2.0 (supersedes 1.1.0:
658
+ // the retirements are not additive; co-bwc).
659
+ { file: "roiScope.v1.2.0.json", domain: "roi_scope", expectedCount: 31 },
657
660
  // 5 stored-ROI lifecycle states (@pave/domain ROI_STATUSES) + 4 = 9
658
661
  { file: "roiStatus.v1.0.0.json", domain: "roi_status", expectedCount: 9 },
659
662
  // 2 HMIS FY2026 "P2 Referrals Provided" outcomes (attained / not_attained)
@@ -78,7 +78,7 @@ describe("parseCvcStatus", () => {
78
78
  expect(result.sourcePath).toBeNull();
79
79
  });
80
80
 
81
- it("flags the self-contradictory core_functions case as ambiguous, generically — not a special case for this one domain (src/cvcs/coreFunctions.v1.0.0.json)", () => {
81
+ it("flags the self-contradictory core_functions case as ambiguous, generically — not a special case for this one domain (src/cvcs/coreFunctions.v1.1.0.json)", () => {
82
82
  const result = parseCvcStatus({
83
83
  _status:
84
84
  "DRAFTED — NEEDS REVIEW: canonical Notion CVC-133 (core - functions), verified v1.0, " +
@@ -89,7 +89,7 @@ const SOT_FILES: readonly SotFile[] = [
89
89
  { file: "personRelationships.v1.0.0.json", expectedDomain: "person_relationships" },
90
90
  { file: "employmentStatus.v1.0.0.json", expectedDomain: "employment_status" },
91
91
  { file: "locationType.v1.0.0.json", expectedDomain: "location_type" },
92
- { file: "referralEntityCategory.v1.1.0.json", expectedDomain: "referral_entity_category" },
92
+ { file: "referralEntityCategory.v1.2.0.json", expectedDomain: "referral_entity_category" },
93
93
  { file: "incomeBenefitsSources.v1.1.0.json", expectedDomain: "income_benefits_sources" },
94
94
  { file: "enrollmentApplicationStatus.v1.0.0.json", expectedDomain: "enrollment_application_status" },
95
95
  { file: "administeringJurisdiction.v1.0.0.json", expectedDomain: "administering_jurisdiction" },
@@ -182,9 +182,9 @@ const SOT_FILES: readonly SotFile[] = [
182
182
  // ─── Risk taxonomy (names-only projection of the @hti/scoring SOT) ───
183
183
  { file: "riskCategory.v1.0.0.json", expectedDomain: "risk_category" },
184
184
  // ─── 0.8.12 vocabulary batch ───
185
- { file: "coreFunctions.v1.0.0.json", expectedDomain: "core_functions" },
185
+ { file: "coreFunctions.v1.1.0.json", expectedDomain: "core_functions" },
186
186
  { file: "needsAssessmentChangeType.v1.0.0.json", expectedDomain: "needs_assessment_change_type" },
187
- { file: "roiScope.v1.0.0.json", expectedDomain: "roi_scope" },
187
+ { file: "roiScope.v1.2.0.json", expectedDomain: "roi_scope" },
188
188
  { file: "roiStatus.v1.0.0.json", expectedDomain: "roi_status" },
189
189
  { file: "coreReferralOutcome.v1.0.0.json", expectedDomain: "core_referral_outcome" },
190
190
  { file: "assertionDomain.v1.1.0.json", expectedDomain: "assertion_domain" },