@htilabs/platform-common-models 0.19.0 → 0.21.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 (59) hide show
  1. package/dist/cvcs/index.cjs +4867 -639
  2. package/dist/cvcs/index.cjs.map +1 -1
  3. package/dist/cvcs/index.d.cts +5145 -609
  4. package/dist/cvcs/index.d.ts +5145 -609
  5. package/dist/cvcs/index.js +4867 -639
  6. package/dist/cvcs/index.js.map +1 -1
  7. package/dist/enums/index.cjs +74 -1
  8. package/dist/enums/index.cjs.map +1 -1
  9. package/dist/enums/index.d.cts +77 -4
  10. package/dist/enums/index.d.ts +77 -4
  11. package/dist/enums/index.js +74 -1
  12. package/dist/enums/index.js.map +1 -1
  13. package/dist/{index-I-DiX9eQ.d.ts → index-CDoqrfc1.d.ts} +1 -1
  14. package/dist/{index-CoVr1jIV.d.cts → index-Zu_mOJRn.d.cts} +1 -1
  15. package/dist/index.cjs +5382 -588
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +3 -2
  18. package/dist/index.d.ts +3 -2
  19. package/dist/index.js +5371 -588
  20. package/dist/index.js.map +1 -1
  21. package/dist/information-scope/index.cjs +521 -0
  22. package/dist/information-scope/index.cjs.map +1 -0
  23. package/dist/information-scope/index.d.cts +442 -0
  24. package/dist/information-scope/index.d.ts +442 -0
  25. package/dist/information-scope/index.js +484 -0
  26. package/dist/information-scope/index.js.map +1 -0
  27. package/dist/models/index.d.cts +2 -2
  28. package/dist/models/index.d.ts +2 -2
  29. package/dist/schemas/index.d.cts +25 -25
  30. package/dist/schemas/index.d.ts +25 -25
  31. package/dist/services/index.cjs +495 -2
  32. package/dist/services/index.cjs.map +1 -1
  33. package/dist/services/index.d.cts +1 -0
  34. package/dist/services/index.d.ts +1 -0
  35. package/dist/services/index.js +483 -1
  36. package/dist/services/index.js.map +1 -1
  37. package/package.json +32 -26
  38. package/src/__tests__/__snapshots__/cvc-sot.snap +3 -3
  39. package/src/__tests__/core-information-scope-invariant.test.ts +835 -456
  40. package/src/__tests__/cvc-sot-snapshot.test.ts +17 -17
  41. package/src/__tests__/cvc-structural.test.ts +2 -2
  42. package/src/__tests__/location-type-routing-invariant.test.ts +25 -8
  43. package/src/cvcs/coreInformationScope.v2.1.0.json +5498 -0
  44. package/src/cvcs/index.ts +2 -2
  45. package/src/cvcs/roiScope.v1.4.0.json +360 -0
  46. package/src/generated/cvc-enums.ts +77 -4
  47. package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v3_placements.projection.csv +12 -0
  48. package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v4.migrations.csv +106 -0
  49. package/src/services/__tests__/fixtures/infoscope-v4/information_scope_v4.rows.csv +117 -0
  50. package/src/services/__tests__/fixtures/infoscope-v4/loadInfoscopeV4Fixtures.ts +187 -0
  51. package/src/services/__tests__/informationScopeResolver.test.ts +1278 -0
  52. package/src/services/index.ts +10 -3
  53. package/src/services/informationScope.ts +10 -0
  54. package/src/services/informationScopeResolver.ts +879 -0
  55. package/src/services/informationScopeSot.ts +203 -0
  56. package/src/cvcs/coreInformationScope.v1.1.0.json +0 -1290
  57. package/src/cvcs/roiScope.v1.2.0.json +0 -340
  58. package/dist/{cvcEntry-BCj1OWqL.d.cts → cvcEntry-0BIB9sen.d.cts} +8 -8
  59. package/dist/{cvcEntry-BCj1OWqL.d.ts → cvcEntry-0BIB9sen.d.ts} +8 -8
@@ -652,11 +652,12 @@ const SOT_SPECS: readonly SotSpec[] = [
652
652
  // 9 fine-grained Needs-Assessment CAR change types (@pave/domain
653
653
  // NEEDS_ASSESSMENT_CHANGE_TYPES, casing normalized to lower_snake) + 4 = 13
654
654
  { file: "needsAssessmentChangeType.v1.0.0.json", domain: "needs_assessment_change_type", expectedCount: 13 },
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 },
655
+ // 27 ROI scope items (14 live + 13 RETIRED tombstones: screen_notes 983-012
656
+ // and background 983-014 retired 2026-10-05 to match CVC-236 v1.1.0; 11 more
657
+ // retired to match CVC-236 v2.0.0, the v4 tree — codes kept, never reused)
658
+ // + 4 missingness = 31. SOT v1.3.0 (supersedes 1.2.0: the retirements are
659
+ // not additive; co-bwc "one answer to offerable").
660
+ { file: "roiScope.v1.4.0.json", domain: "roi_scope", expectedCount: 31 },
660
661
  // 5 stored-ROI lifecycle states (@pave/domain ROI_STATUSES) + 4 = 9
661
662
  { file: "roiStatus.v1.0.0.json", domain: "roi_status", expectedCount: 9 },
662
663
  // 2 HMIS FY2026 "P2 Referrals Provided" outcomes (attained / not_attained)
@@ -739,19 +740,18 @@ const SOT_SPECS: readonly SotSpec[] = [
739
740
  // 3 substantive age bands (@pave/domain AGE_BANDS_AT_EVENT minus `unknown`,
740
741
  // which maps to the missingness sentinel) + 4 missingness = 7
741
742
  { file: "minorAdultStatus.v1.0.0.json", domain: "minor_adult_status", expectedCount: 7 },
742
- // CVC-236 — 12 policy-grain categories + 55 live authorization-grain units
743
- // (priorities_safety, 236-003-003, added 2026-09-29; encounter_location,
744
- // 236-003-004, added 2026-10-01; session_summary, 236-005-004, added
745
- // 2026-10-05) + 2 RETIRED tombstones (screen_notes 236-005-001, background
746
- // 236-005-003, retired 2026-10-05 — codes kept, never reused) + 1
747
- // missingness root + 3 workspace-standard missingness children = 73.
748
- // SOT v1.1.0 (supersedes 1.0.0: the retirements + the case_notes narrowing
749
- // are not additive). Generated by scripts/gen-core-information-scope.py;
750
- // codes are FROZEN there.
751
- {
752
- file: "coreInformationScope.v1.1.0.json",
743
+ // CVC-236 — the v4 tree (INFOSCOPE v4, 2026-10-09): 115 live rows (2 top
744
+ // groups · 3 person types · 38 categories · 43 sub-categories (34
745
+ // `subcategory` + 9 LEADS `sub-category`) · 1 rest row · 28 instrument rows) + 27 RETIRED tombstones (every v1.1.0 code v4 no longer
746
+ // carries — codes kept, never reused) + 1 missingness root + 3
747
+ // workspace-standard missingness children = 146. SOT v2.1.0 (amends 2.0.0,
748
+ // additive release-grain fields; 2.0.0 superseded
749
+ // 1.1.0: 25 new retirements, categories selectable). Generated by
750
+ // scripts/gen-core-information-scope.py; codes are FROZEN there.
751
+ {
752
+ file: "coreInformationScope.v2.1.0.json",
753
753
  domain: "core_information_scope",
754
- expectedCount: 73,
754
+ expectedCount: 146,
755
755
  },
756
756
  ] as const;
757
757
 
@@ -184,7 +184,7 @@ const SOT_FILES: readonly SotFile[] = [
184
184
  // ─── 0.8.12 vocabulary batch ───
185
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.2.0.json", expectedDomain: "roi_scope" },
187
+ { file: "roiScope.v1.4.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" },
@@ -235,7 +235,7 @@ const SOT_FILES: readonly SotFile[] = [
235
235
  { file: "suggestionSource.v1.0.0.json", expectedDomain: "suggestion_source" },
236
236
  // CVC-236 — generated by scripts/gen-core-information-scope.py. Omitted from
237
237
  // this list since it was authored; added with the priorities_safety unit.
238
- { file: "coreInformationScope.v1.1.0.json", expectedDomain: "core_information_scope" },
238
+ { file: "coreInformationScope.v2.1.0.json", expectedDomain: "core_information_scope" },
239
239
  // ─── GDR §10.1 CAR-contract vocabularies (provisional 900-block; PAVE
240
240
  // @pave/domain verbatim; bead pv-pgdr-cvc-source-gdr-10-1-bulk-publish). ───
241
241
  { file: "assertionStatus.v1.0.0.json", expectedDomain: "assertion_status" },
@@ -40,6 +40,8 @@ interface Entry {
40
40
  anchorDefault?: string | null;
41
41
  shareUnit?: string | null;
42
42
  safetyDefault?: string | null;
43
+ rowType?: string;
44
+ retired?: boolean;
43
45
  }
44
46
 
45
47
  const read = (f: string): { entries: Entry[]; _source?: string } =>
@@ -49,7 +51,7 @@ const read = (f: string): { entries: Entry[]; _source?: string } =>
49
51
  };
50
52
 
51
53
  const lt = read("locationType.v1.0.0.json");
52
- const scope = read("coreInformationScope.v1.1.0.json");
54
+ const scope = read("coreInformationScope.v2.1.0.json");
53
55
  const byKey = new Map(lt.entries.map((e) => [e.key, e]));
54
56
  const scopeByKey = new Map(scope.entries.map((e) => [e.key, e]));
55
57
  const reasons = lt.entries.filter((e) => e.key !== "missingness_root");
@@ -168,13 +170,28 @@ describe("location_type — share routing at type grain (R1/R2)", () => {
168
170
  it("names an authorization-grain UNIT, except canon's two LEADS-only derived reasons", () => {
169
171
  // Canon's column names the category `commercial_activity` (not one of its
170
172
  // units) for the two machine-derived reasons. Carried verbatim; a consumer
171
- // authorizing at unit grain must resolve it as the category.
172
- const isCategory = (k: string): boolean => scopeByKey.get(k)?.selectable === false;
173
- const atCategory = reasons
174
- .filter((e) => e.shareUnit !== null && isCategory(e.shareUnit as string))
175
- .map((e) => e.key)
176
- .sort();
177
- expect(atCategory).toEqual(["ad_location_derived", "ip_derived_location"]);
173
+ // authorizing at unit grain must resolve it as the category. Every other
174
+ // shareUnit must be a LIVE sub-category row: never a tombstone, a category,
175
+ // a branch or a person type (CVC-236 v2.0.0 makes those selectable, so
176
+ // selectability no longer tells them apart).
177
+ const AT_CATEGORY = ["ad_location_derived", "ip_derived_location"];
178
+ for (const e of reasons) {
179
+ if (e.shareUnit === null) continue;
180
+ const u = scopeByKey.get(e.shareUnit as string);
181
+ if (AT_CATEGORY.includes(e.key)) {
182
+ expect(u?.rowType, e.key).toBe("category");
183
+ expect(u?.retired, e.key).toBeUndefined();
184
+ continue;
185
+ }
186
+ expect(u?.retired, `${e.key} -> ${e.shareUnit}`).not.toBe(true);
187
+ expect(["subcategory", "sub-category"], `${e.key} -> ${e.shareUnit}`).toContain(u?.rowType);
188
+ }
189
+ expect(
190
+ reasons
191
+ .filter((e) => e.shareUnit !== null && scopeByKey.get(e.shareUnit as string)?.rowType === "category")
192
+ .map((e) => e.key)
193
+ .sort(),
194
+ ).toEqual(AT_CATEGORY);
178
195
  });
179
196
 
180
197
  it("sends only the session/event encounter reasons under encounter_location", () => {