@htilabs/platform-common-models 0.8.13 → 0.8.14

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 (72) hide show
  1. package/README.md +44 -0
  2. package/dist/config/index.cjs +4 -0
  3. package/dist/config/index.cjs.map +1 -1
  4. package/dist/config/index.d.cts +16 -1
  5. package/dist/config/index.d.ts +16 -1
  6. package/dist/config/index.js +2 -0
  7. package/dist/config/index.js.map +1 -1
  8. package/dist/constants/index.cjs +10 -0
  9. package/dist/constants/index.cjs.map +1 -1
  10. package/dist/constants/index.d.cts +1 -1
  11. package/dist/constants/index.d.ts +1 -1
  12. package/dist/constants/index.js +10 -0
  13. package/dist/constants/index.js.map +1 -1
  14. package/dist/cvcs/index.cjs +505 -2
  15. package/dist/cvcs/index.cjs.map +1 -1
  16. package/dist/cvcs/index.d.cts +2642 -2084
  17. package/dist/cvcs/index.d.ts +2642 -2084
  18. package/dist/cvcs/index.js +500 -2
  19. package/dist/cvcs/index.js.map +1 -1
  20. package/dist/{index-I-DiX9eQ.d.ts → index-CDoqrfc1.d.ts} +1 -1
  21. package/dist/{index-CoVr1jIV.d.cts → index-Zu_mOJRn.d.cts} +1 -1
  22. package/dist/index.cjs +582 -4
  23. package/dist/index.cjs.map +1 -1
  24. package/dist/index.d.cts +111 -7
  25. package/dist/index.d.ts +111 -7
  26. package/dist/index.js +571 -4
  27. package/dist/index.js.map +1 -1
  28. package/dist/models/index.d.cts +2 -2
  29. package/dist/models/index.d.ts +2 -2
  30. package/dist/mongo/index.cjs +383 -0
  31. package/dist/mongo/index.cjs.map +1 -0
  32. package/dist/mongo/index.d.cts +221 -0
  33. package/dist/mongo/index.d.ts +221 -0
  34. package/dist/mongo/index.js +351 -0
  35. package/dist/mongo/index.js.map +1 -0
  36. package/dist/{platform-auth-BfCMuAlC.d.cts → platform-auth-AsfnIXfK.d.cts} +2 -2
  37. package/dist/{platform-auth-BfCMuAlC.d.ts → platform-auth-AsfnIXfK.d.ts} +2 -2
  38. package/dist/schemas/index.cjs +5 -1
  39. package/dist/schemas/index.cjs.map +1 -1
  40. package/dist/schemas/index.d.cts +29 -25
  41. package/dist/schemas/index.d.ts +29 -25
  42. package/dist/schemas/index.js +5 -1
  43. package/dist/schemas/index.js.map +1 -1
  44. package/dist/types/index.d.cts +2 -2
  45. package/dist/types/index.d.ts +2 -2
  46. package/package.json +10 -1
  47. package/src/__sot__/coreIndicators.pin.json +6 -1
  48. package/src/__tests__/__snapshots__/cvc-sot.snap +18 -2
  49. package/src/__tests__/cvc-136-scoring-invariant.test.ts +6 -3
  50. package/src/__tests__/cvc-drift-gate.test.ts +14 -3
  51. package/src/__tests__/cvc-sot-snapshot.test.ts +13 -1
  52. package/src/__tests__/cvc-structural.test.ts +6 -0
  53. package/src/__tests__/mongo-verifier.test.ts +502 -0
  54. package/src/config/index.ts +8 -2
  55. package/src/constants/ic.ts +31 -2
  56. package/src/cvcs/assertionStatus.v1.0.0.json +80 -0
  57. package/src/cvcs/coreIndicators.v1.0.0.json +67 -2
  58. package/src/cvcs/createdBySystem.v1.0.0.json +89 -0
  59. package/src/cvcs/hmisSex.v1.0.0.json +89 -0
  60. package/src/cvcs/index.ts +18 -0
  61. package/src/cvcs/minorAdultStatus.v1.0.0.json +80 -0
  62. package/src/cvcs/subjectType.v1.0.0.json +80 -0
  63. package/src/generated/cvc-enums.ts +76 -2
  64. package/src/index.ts +20 -0
  65. package/src/mongo/catalog.ts +65 -0
  66. package/src/mongo/contract.ts +157 -0
  67. package/src/mongo/index.ts +343 -0
  68. package/src/mongo/similarity.ts +133 -0
  69. package/src/mongo/uri.ts +53 -0
  70. package/src/schemas/common.ts +4 -0
  71. package/dist/{cvcEntry-BCj1OWqL.d.cts → cvcEntry-0BIB9sen.d.cts} +8 -8
  72. package/dist/{cvcEntry-BCj1OWqL.d.ts → cvcEntry-0BIB9sen.d.ts} +8 -8
@@ -1,5 +1,5 @@
1
- import { e4 as PlatformToolValue, cB as FunctionStatusValue, er as RoleLevelValue, eC as ShareViewValue, e0 as PermissionStateValue } from '../platform-auth-BfCMuAlC.cjs';
2
- export { h as AccommodationValue, i as AgeBinReportingValue, j as AppScopeValue, k as ApparentAgeValue, cr as DataQualityValue, cz as FormStatusValue, cA as FormTypeValue, cC as IC13Category, cE as IC13Value, cF as IC22Value, cG as IC23Value, cH as IC24Value, cI as IC25Value, cJ as IC49ReferralOutcomeValue, cK as IC49ReferralVerificationValue, cL as IC49Value, cM as IC4Value, cO as IC56Value, cP as IC57Value, cR as IC58Value, cS as IC59Value, cT as IC5Value, dI as IncidentInvolvementRoleValue, dJ as IncidentParticipationRoleValue, dK as InteractionTypeValue, dN as MinorAdultStatusValue, e1 as PersonDisplayCategoryValue, e2 as PersonRoleValue, e3 as PersonTypeValue, ea as QuestionFormatValue, eb as QuickStartTemplateId, en as RecordStateValue, ep as RelationshipConcernValue, eq as RelationshipDynamicValue, eB as SessionStateValue, eD as SubmissionStateValue, eH as UserStatusValue } from '../platform-auth-BfCMuAlC.cjs';
1
+ import { P as PlatformToolValue, F as FunctionStatusValue, R as RoleLevelValue, S as ShareViewValue, a as PermissionStateValue } from '../platform-auth-AsfnIXfK.cjs';
2
+ export { A as AccommodationValue, b as AgeBinReportingValue, c as AppScopeValue, d as ApparentAgeValue, D as DataQualityValue, e as FormStatusValue, f as FormTypeValue, I as IC13Category, g as IC13Value, h as IC22Value, i as IC23Value, j as IC24Value, k as IC25Value, l as IC49ReferralOutcomeValue, m as IC49ReferralVerificationValue, n as IC49Value, o as IC4Value, p as IC56Value, q as IC57Value, r as IC58Value, s as IC59Value, t as IC5Value, u as IncidentInvolvementRoleValue, v as IncidentParticipationRoleValue, w as InteractionTypeValue, M as MinorAdultStatusValue, x as PersonDisplayCategoryValue, y as PersonRoleValue, z as PersonTypeValue, Q as QuestionFormatValue, B as QuickStartTemplateId, C as RecordStateValue, E as RelationshipConcernValue, G as RelationshipDynamicValue, H as SessionStateValue, J as SubmissionStateValue, U as UserStatusValue } from '../platform-auth-AsfnIXfK.cjs';
3
3
 
4
4
  /**
5
5
  * @htilabs/platform-common-models — Platform Authorization Types
@@ -1,5 +1,5 @@
1
- import { e4 as PlatformToolValue, cB as FunctionStatusValue, er as RoleLevelValue, eC as ShareViewValue, e0 as PermissionStateValue } from '../platform-auth-BfCMuAlC.js';
2
- export { h as AccommodationValue, i as AgeBinReportingValue, j as AppScopeValue, k as ApparentAgeValue, cr as DataQualityValue, cz as FormStatusValue, cA as FormTypeValue, cC as IC13Category, cE as IC13Value, cF as IC22Value, cG as IC23Value, cH as IC24Value, cI as IC25Value, cJ as IC49ReferralOutcomeValue, cK as IC49ReferralVerificationValue, cL as IC49Value, cM as IC4Value, cO as IC56Value, cP as IC57Value, cR as IC58Value, cS as IC59Value, cT as IC5Value, dI as IncidentInvolvementRoleValue, dJ as IncidentParticipationRoleValue, dK as InteractionTypeValue, dN as MinorAdultStatusValue, e1 as PersonDisplayCategoryValue, e2 as PersonRoleValue, e3 as PersonTypeValue, ea as QuestionFormatValue, eb as QuickStartTemplateId, en as RecordStateValue, ep as RelationshipConcernValue, eq as RelationshipDynamicValue, eB as SessionStateValue, eD as SubmissionStateValue, eH as UserStatusValue } from '../platform-auth-BfCMuAlC.js';
1
+ import { P as PlatformToolValue, F as FunctionStatusValue, R as RoleLevelValue, S as ShareViewValue, a as PermissionStateValue } from '../platform-auth-AsfnIXfK.js';
2
+ export { A as AccommodationValue, b as AgeBinReportingValue, c as AppScopeValue, d as ApparentAgeValue, D as DataQualityValue, e as FormStatusValue, f as FormTypeValue, I as IC13Category, g as IC13Value, h as IC22Value, i as IC23Value, j as IC24Value, k as IC25Value, l as IC49ReferralOutcomeValue, m as IC49ReferralVerificationValue, n as IC49Value, o as IC4Value, p as IC56Value, q as IC57Value, r as IC58Value, s as IC59Value, t as IC5Value, u as IncidentInvolvementRoleValue, v as IncidentParticipationRoleValue, w as InteractionTypeValue, M as MinorAdultStatusValue, x as PersonDisplayCategoryValue, y as PersonRoleValue, z as PersonTypeValue, Q as QuestionFormatValue, B as QuickStartTemplateId, C as RecordStateValue, E as RelationshipConcernValue, G as RelationshipDynamicValue, H as SessionStateValue, J as SubmissionStateValue, U as UserStatusValue } from '../platform-auth-AsfnIXfK.js';
3
3
 
4
4
  /**
5
5
  * @htilabs/platform-common-models — Platform Authorization Types
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htilabs/platform-common-models",
3
- "version": "0.8.13",
3
+ "version": "0.8.14",
4
4
  "description": "Shared constants, types, and models for HTI Labs applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -51,6 +51,11 @@
51
51
  "types": "./dist/config/index.d.ts",
52
52
  "import": "./dist/config/index.js",
53
53
  "require": "./dist/config/index.cjs"
54
+ },
55
+ "./mongo": {
56
+ "types": "./dist/mongo/index.d.ts",
57
+ "import": "./dist/mongo/index.js",
58
+ "require": "./dist/mongo/index.cjs"
54
59
  }
55
60
  },
56
61
  "files": [
@@ -72,9 +77,13 @@
72
77
  "sot:pins": "tsx scripts/sot-pins.ts",
73
78
  "sot:pins:check": "tsx scripts/sot-pins.ts --check",
74
79
  "gate:cvc": "vitest run src/__tests__/cvc-drift-gate.test.ts",
80
+ "bridge:codebook": "tsx scripts/codebook-bridge.ts",
81
+ "bridge:codebook:check": "tsx scripts/codebook-bridge.ts --check",
82
+ "test:bridge": "node --import tsx --test scripts/codebook-bridge.test.ts",
75
83
  "seed:cvc": "tsx scripts/seed-cvc.ts",
76
84
  "seed:cvc:all": "tsx scripts/seed-all-cvcs.ts",
77
85
  "test:seed": "node --import tsx --test scripts/seed-cvc.test.ts",
86
+ "test:guard": "node --import tsx --test scripts/lib/confirmTargetDb.test.ts",
78
87
  "prepublishOnly": "npm run build"
79
88
  },
80
89
  "keywords": [
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "sourceRepo": "htilabstech/prototype",
3
3
  "sourceFile": "data/core_indicators.yaml",
4
- "sourceSha": "a596eb9",
4
+ "sourceSha": "84a1b67",
5
5
  "codes": [
6
6
  "abuser_evading_legal_consequences",
7
7
  "abuser_has_weapon",
@@ -33,6 +33,7 @@
33
33
  "cannot_stop_working_or_freely_leave",
34
34
  "child_not_abusers_in_household",
35
35
  "child_welfare_system_involvement",
36
+ "clients_unaware_of_third_party_coordination",
36
37
  "coerced_to_misrepresent_identity_or_activity",
37
38
  "coercive_debt_pressure",
38
39
  "coercive_migration_or_forced_travel",
@@ -53,6 +54,7 @@
53
54
  "debt_terms_deceptive",
54
55
  "denied_basic_needs",
55
56
  "depends_on_employer_for_immigration_status",
57
+ "depends_on_spouse_or_family_for_immigration_status",
56
58
  "does_not_control_finances_or_earnings",
57
59
  "does_not_control_identity_documents",
58
60
  "elevated_lethality_risk_signal",
@@ -146,6 +148,8 @@
146
148
  "several_cell_phones_or_frequent_number_changes",
147
149
  "sex_acts_in_own_residence",
148
150
  "sexual_exploitation",
151
+ "sexualized_content_in_person_performance_activity",
152
+ "sexualized_content_online_performance_activity",
149
153
  "sexualized_content_performance_activity",
150
154
  "shared_contact_network",
151
155
  "signs_of_physical_abuse_confinement_or_neglect",
@@ -191,6 +195,7 @@
191
195
  "trafficking_experience_past_10plusy",
192
196
  "trafficking_experience_past_3to10y",
193
197
  "trafficking_experience_past_lt3y",
198
+ "trauma_perpetrator_is_current_manager",
194
199
  "travel_organized_by_third_party",
195
200
  "tricked_or_pressured_into_unwanted_acts",
196
201
  "under_18_advertised_age",
@@ -599,8 +599,8 @@
599
599
  "hash": "90aec290aa586a9bbc098c0c8a19536e06b705b054e4444ff6461a9913340a5c"
600
600
  },
601
601
  "core_indicators": {
602
- "count": 214,
603
- "hash": "401f8c604a63a94e63569cbed9e1ae2e80bedb5e29ffcff4b40af3ce9f75b7b9"
602
+ "count": 219,
603
+ "hash": "b389bf68c84985e66445ac9a42b5c98ca36f10592dc820f909fc4e71c7f421bc"
604
604
  },
605
605
  "risk_severity_band": {
606
606
  "count": 9,
@@ -669,6 +669,22 @@
669
669
  "trafficking_relevant_role": {
670
670
  "count": 8,
671
671
  "hash": "1a4ea2992cc501179adafd192d7a2f1733ffe48c1ba26e1e61a3c757b2d62b32"
672
+ },
673
+ "assertion_status": {
674
+ "count": 7,
675
+ "hash": "a1914348815dabc7171ed4ea632383d39f31764d390c43d6b1d359eae465807f"
676
+ },
677
+ "created_by_system": {
678
+ "count": 8,
679
+ "hash": "35ea022a704b4eee7b493ea3c9a8a5d2ffa41c4cacbe9f899cc1336e73808fc2"
680
+ },
681
+ "subject_type": {
682
+ "count": 7,
683
+ "hash": "81ad6c7fbb74bbb6d9c6f316df3275fd57a1646dedb4fb47472ee77fb2482f99"
684
+ },
685
+ "minor_adult_status": {
686
+ "count": 7,
687
+ "hash": "9d8972c65373a9981aab6b8749661659ecc632004e67bc9c2b3c88aa76f30977"
672
688
  }
673
689
  }
674
690
  }
@@ -261,9 +261,12 @@ describe("CVC-136 core_indicators", () => {
261
261
  ]);
262
262
  });
263
263
 
264
- it("has exactly 210 substantive codes (208 canonical + 2 scoring-ahead)", () => {
265
- expect(substantive.length).toBe(210);
266
- expect(envelope.entries.length).toBe(214);
264
+ it("has exactly 215 substantive codes (213 canonical + 2 scoring-ahead)", () => {
265
+ // 0.8.14 refreshed the catalog pin a596eb9 (208) -> 84a1b67 (213):
266
+ // +5 upstream mints, 0 withdrawn. The 2 scoring-ahead codes are unchanged
267
+ // and still absent upstream.
268
+ expect(substantive.length).toBe(215);
269
+ expect(envelope.entries.length).toBe(219);
267
270
  });
268
271
 
269
272
  it("has no duplicate keys", () => {
@@ -218,6 +218,13 @@ const INDEX_ABSENT: Record<string, { cvc: number; reason: string }> = {
218
218
  // but CVC_INDEX.md carries no row. Not a squat (nothing else claims these
219
219
  // numbers) — but each needs a Notion index row to become verifiable.
220
220
  service_categories: { cvc: 22, reason: "no CVC_INDEX row" },
221
+ // Trunk-only domain: authored on `kl-develop` (80341e0, "promote CVC-17 +
222
+ // CVC-67 to SOT"), which the canonical 0.8.13 line never saw. Its sibling
223
+ // CVC-17 (gender_identity) IS in CVC_INDEX.md and is bound above; 67 is not
224
+ // — CVC_INDEX.md carries no row, Final CVCs/ carries no codebook, and no
225
+ // other domain claims 67, so it is index-absent rather than a squat. Sourced
226
+ // from the HMIS data standard via `CVC_67_HMIS_SEX` in `../constants/ic.ts`.
227
+ hmis_sex: { cvc: 67, reason: "no CVC_INDEX row" },
221
228
  juvenile_justice_involvement_status: { cvc: 95, reason: "no CVC_INDEX row" },
222
229
  primary_language: { cvc: 122, reason: "no CVC_INDEX row" },
223
230
  hmis_relationship_to_hoh: { cvc: 129, reason: "no CVC_INDEX row" },
@@ -586,11 +593,15 @@ describe("SOT pins carry their provenance", () => {
586
593
  }
587
594
  });
588
595
 
589
- it("the pinned SOT is the one 0.8.13 was authored against", () => {
596
+ it("the pinned SOT is the one this release was authored against", () => {
597
+ // cvcIndex stays at a596eb9 — the CVC NUMBER<->NAME registry did not move.
598
+ // coreIndicators advanced to 84a1b67 in 0.8.14 (+5 upstream mints, 0
599
+ // withdrawn); scoringEmits is unchanged, so the 2 SCORING_AHEAD_OF_CATALOG
600
+ // codes remain ahead of the catalog exactly as before.
590
601
  expect(cvcIndexPin.sourceSha).toBe("a596eb9");
591
- expect(coreIndicatorsPin.sourceSha).toBe("a596eb9");
602
+ expect(coreIndicatorsPin.sourceSha).toBe("84a1b67");
592
603
  expect(scoringEmitsPin.sourceSha).toBe("9b5d654");
593
- expect(coreIndicatorsPin.codes.length).toBe(208);
604
+ expect(coreIndicatorsPin.codes.length).toBe(213);
594
605
  expect(scoringEmitsPin.codes.length).toBe(169);
595
606
  });
596
607
  });
@@ -627,7 +627,8 @@ const SOT_SPECS: readonly SotSpec[] = [
627
627
  { file: "coreReferralOutcome.v1.0.0.json", domain: "core_referral_outcome", expectedCount: 6 },
628
628
  // ─── 0.8.13 canonical CVC batch ───
629
629
  { file: "coreDhState.v1.0.0.json", domain: "dh_state", expectedCount: 9 },
630
- { file: "coreIndicators.v1.0.0.json", domain: "core_indicators", expectedCount: 214 },
630
+ // 0.8.14: 214 -> 219 (catalog refresh a596eb9 -> 84a1b67; +5 mints, 0 withdrawn).
631
+ { file: "coreIndicators.v1.0.0.json", domain: "core_indicators", expectedCount: 219 },
631
632
  { file: "riskSeverityBand.v1.0.0.json", domain: "risk_severity_band", expectedCount: 9 },
632
633
  { file: "adminRoles.v1.0.0.json", domain: "admin_roles", expectedCount: 14 },
633
634
  { file: "userRoles.v1.0.0.json", domain: "user_roles", expectedCount: 19 },
@@ -654,6 +655,17 @@ const SOT_SPECS: readonly SotSpec[] = [
654
655
  domain: "trafficking_relevant_role",
655
656
  expectedCount: 8,
656
657
  },
658
+ // ─── GDR §10.1 CAR-contract vocabularies (provisional 900-block; PAVE
659
+ // @pave/domain verbatim; bead pv-pgdr-cvc-source-gdr-10-1-bulk-publish). ───
660
+ // 3 lifecycle states (@pave/domain ASSERTION_STATUSES) + 4 missingness = 7
661
+ { file: "assertionStatus.v1.0.0.json", domain: "assertion_status", expectedCount: 7 },
662
+ // 4 actor classes (@pave/domain CREATED_BY_SYSTEMS) + 4 missingness = 8
663
+ { file: "createdBySystem.v1.0.0.json", domain: "created_by_system", expectedCount: 8 },
664
+ // 3 entity kinds (@pave/domain SUBJECT_TYPES) + 4 missingness = 7
665
+ { file: "subjectType.v1.0.0.json", domain: "subject_type", expectedCount: 7 },
666
+ // 3 substantive age bands (@pave/domain AGE_BANDS_AT_EVENT minus `unknown`,
667
+ // which maps to the missingness sentinel) + 4 missingness = 7
668
+ { file: "minorAdultStatus.v1.0.0.json", domain: "minor_adult_status", expectedCount: 7 },
657
669
  ] as const;
658
670
 
659
671
  // ─── Helpers ────────────────────────────────────────────────────────────────
@@ -223,6 +223,12 @@ const SOT_FILES: readonly SotFile[] = [
223
223
  { file: "sessionNoteVisibility.v1.0.0.json", expectedDomain: "session_note_visibility" },
224
224
  { file: "specialNeedsDisabilities.v1.0.0.json", expectedDomain: "special_needs_disabilities" },
225
225
  { file: "suggestionSource.v1.0.0.json", expectedDomain: "suggestion_source" },
226
+ // ─── GDR §10.1 CAR-contract vocabularies (provisional 900-block; PAVE
227
+ // @pave/domain verbatim; bead pv-pgdr-cvc-source-gdr-10-1-bulk-publish). ───
228
+ { file: "assertionStatus.v1.0.0.json", expectedDomain: "assertion_status" },
229
+ { file: "createdBySystem.v1.0.0.json", expectedDomain: "created_by_system" },
230
+ { file: "subjectType.v1.0.0.json", expectedDomain: "subject_type" },
231
+ { file: "minorAdultStatus.v1.0.0.json", expectedDomain: "minor_adult_status" },
226
232
  ] as const;
227
233
 
228
234
  function loadSot(file: string): unknown {