@htilabs/platform-common-models 0.8.24 → 0.12.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 (91) hide show
  1. package/dist/config/index.cjs +81 -0
  2. package/dist/config/index.cjs.map +1 -1
  3. package/dist/config/index.d.cts +79 -4
  4. package/dist/config/index.d.ts +79 -4
  5. package/dist/config/index.js +79 -1
  6. package/dist/config/index.js.map +1 -1
  7. package/dist/constants/index.cjs +2 -18
  8. package/dist/constants/index.cjs.map +1 -1
  9. package/dist/constants/index.d.cts +1 -1
  10. package/dist/constants/index.d.ts +1 -1
  11. package/dist/constants/index.js +2 -18
  12. package/dist/constants/index.js.map +1 -1
  13. package/dist/{cvcEntry-ctHTp2df.d.cts → cvcEntry-BCj1OWqL.d.cts} +44 -44
  14. package/dist/{cvcEntry-ctHTp2df.d.ts → cvcEntry-BCj1OWqL.d.ts} +44 -44
  15. package/dist/cvcs/index.cjs +217 -6674
  16. package/dist/cvcs/index.cjs.map +1 -1
  17. package/dist/cvcs/index.d.cts +8057 -15024
  18. package/dist/cvcs/index.d.ts +8057 -15024
  19. package/dist/cvcs/index.js +217 -6662
  20. package/dist/cvcs/index.js.map +1 -1
  21. package/dist/{index-qreOzXYS.d.cts → index-CoVr1jIV.d.cts} +1 -1
  22. package/dist/{index-4DiJrn7y.d.ts → index-I-DiX9eQ.d.ts} +1 -1
  23. package/dist/index.cjs +230 -7217
  24. package/dist/index.cjs.map +1 -1
  25. package/dist/index.d.cts +26 -588
  26. package/dist/index.d.ts +26 -588
  27. package/dist/index.js +230 -7193
  28. package/dist/index.js.map +1 -1
  29. package/dist/models/index.d.cts +2 -2
  30. package/dist/models/index.d.ts +2 -2
  31. package/dist/mongo/index.cjs +1 -0
  32. package/dist/mongo/index.cjs.map +1 -1
  33. package/dist/mongo/index.js +2 -1
  34. package/dist/mongo/index.js.map +1 -1
  35. package/dist/{platform-auth-91Hcl8F8.d.cts → platform-auth-v53r3BhN.d.cts} +3 -4
  36. package/dist/{platform-auth-91Hcl8F8.d.ts → platform-auth-v53r3BhN.d.ts} +3 -4
  37. package/dist/schemas/index.cjs +1 -5
  38. package/dist/schemas/index.cjs.map +1 -1
  39. package/dist/schemas/index.d.cts +35 -35
  40. package/dist/schemas/index.d.ts +35 -35
  41. package/dist/schemas/index.js +1 -5
  42. package/dist/schemas/index.js.map +1 -1
  43. package/dist/types/index.d.cts +2 -2
  44. package/dist/types/index.d.ts +2 -2
  45. package/dist/validation/index.cjs +0 -58
  46. package/dist/validation/index.cjs.map +1 -1
  47. package/dist/validation/index.d.cts +283 -82
  48. package/dist/validation/index.d.ts +283 -82
  49. package/dist/validation/index.js +0 -57
  50. package/dist/validation/index.js.map +1 -1
  51. package/package.json +22 -26
  52. package/src/__sot__/README.md +1 -36
  53. package/src/__sot__/coreIndicators.pin.json +2 -1936
  54. package/src/__sot__/cvcIndex.pin.json +4 -8
  55. package/src/__tests__/__snapshots__/cvc-sot.snap +13 -41
  56. package/src/__tests__/cvc-136-scoring-invariant.test.ts +3 -8
  57. package/src/__tests__/cvc-drift-gate.test.ts +12 -445
  58. package/src/__tests__/cvc-sot-snapshot.test.ts +11 -73
  59. package/src/__tests__/cvc-structural.test.ts +0 -14
  60. package/src/__tests__/runtime-contract-validator.test.ts +325 -1
  61. package/src/config/index.ts +189 -4
  62. package/src/constants/ic.ts +3 -120
  63. package/src/cvcs/assertionDomain.v1.1.0.json +1 -19
  64. package/src/cvcs/coreIndicators.v1.0.0.json +5 -83
  65. package/src/cvcs/incidentParticipationRoles.v1.0.0.json +1 -11
  66. package/src/cvcs/index.ts +0 -32
  67. package/src/cvcs/personRelationships.v1.0.0.json +2 -67
  68. package/src/cvcs/relationshipConcern.v1.0.0.json +19 -28
  69. package/src/cvcs/sessionTemplate.v1.0.0.json +0 -22
  70. package/src/cvcs/sharePurpose.v1.0.0.json +12 -80
  71. package/src/generated/cvc-enums.ts +20 -606
  72. package/src/validation/index.ts +0 -1
  73. package/dist/cvc-C7qdsXYK.d.cts +0 -298
  74. package/dist/cvc-C7qdsXYK.d.ts +0 -298
  75. package/src/__sot__/coreIndicatorFields.ts +0 -331
  76. package/src/__tests__/core-information-scope-invariant.test.ts +0 -134
  77. package/src/__tests__/cvc-181-182-country-parity.test.ts +0 -163
  78. package/src/__tests__/cvc-status-parser.test.ts +0 -150
  79. package/src/cvcs/assertionStatus.v1.0.0.json +0 -80
  80. package/src/cvcs/carCorrectionReason.v1.0.0.json +0 -89
  81. package/src/cvcs/caseShareState.v1.0.0.json +0 -62
  82. package/src/cvcs/coreInformationScope.v1.0.0.json +0 -1165
  83. package/src/cvcs/countries.v1.0.0.json +0 -3077
  84. package/src/cvcs/createdBySystem.v1.0.0.json +0 -89
  85. package/src/cvcs/criminalOrgCategory.v1.0.0.json +0 -116
  86. package/src/cvcs/determinationHelperCategories.v1.0.0.json +0 -1166
  87. package/src/cvcs/minorAdultStatus.v1.0.0.json +0 -80
  88. package/src/cvcs/referralOrigin.v1.0.0.json +0 -26
  89. package/src/cvcs/riskIdentificationMilestone.v1.0.0.json +0 -109
  90. package/src/cvcs/subjectType.v1.0.0.json +0 -80
  91. package/src/validation/cvcStatus.ts +0 -209
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htilabs/platform-common-models",
3
- "version": "0.8.24",
3
+ "version": "0.12.0",
4
4
  "description": "Shared constants, types, and models for HTI Labs applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -62,30 +62,6 @@
62
62
  "dist",
63
63
  "src"
64
64
  ],
65
- "scripts": {
66
- "build": "tsup",
67
- "dev": "tsup --watch",
68
- "typecheck": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
69
- "lint": "eslint src --ext .ts",
70
- "lint:fix": "eslint src --ext .ts --fix",
71
- "test": "vitest run",
72
- "test:watch": "vitest",
73
- "test:snapshot": "UPDATE_SNAPSHOT=1 vitest run",
74
- "clean": "rm -rf dist",
75
- "codegen:cvc": "tsx scripts/codegen-cvc-enums.ts",
76
- "codegen:cvc:check": "tsx scripts/codegen-cvc-enums.ts --check",
77
- "sot:pins": "tsx scripts/sot-pins.ts",
78
- "sot:pins:check": "tsx scripts/sot-pins.ts --check",
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",
83
- "seed:cvc": "tsx scripts/seed-cvc.ts",
84
- "seed:cvc:all": "tsx scripts/seed-all-cvcs.ts",
85
- "test:seed": "node --import tsx --test scripts/seed-cvc.test.ts",
86
- "test:guard": "node --import tsx --test scripts/lib/confirmTargetDb.test.ts",
87
- "prepublishOnly": "npm run build"
88
- },
89
65
  "keywords": [
90
66
  "hti",
91
67
  "platform-common",
@@ -120,5 +96,25 @@
120
96
  },
121
97
  "engines": {
122
98
  "node": ">=18.0.0"
99
+ },
100
+ "scripts": {
101
+ "build": "tsup",
102
+ "dev": "tsup --watch",
103
+ "typecheck": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
104
+ "lint": "eslint src --ext .ts",
105
+ "lint:fix": "eslint src --ext .ts --fix",
106
+ "test": "vitest run",
107
+ "test:watch": "vitest",
108
+ "test:snapshot": "UPDATE_SNAPSHOT=1 vitest run",
109
+ "clean": "rm -rf dist",
110
+ "codegen:cvc": "tsx scripts/codegen-cvc-enums.ts",
111
+ "codegen:cvc:check": "tsx scripts/codegen-cvc-enums.ts --check",
112
+ "sot:pins": "tsx scripts/sot-pins.ts",
113
+ "sot:pins:check": "tsx scripts/sot-pins.ts --check",
114
+ "gate:cvc": "vitest run src/__tests__/cvc-drift-gate.test.ts",
115
+ "seed:cvc": "tsx scripts/seed-cvc.ts",
116
+ "seed:cvc:all": "tsx scripts/seed-all-cvcs.ts",
117
+ "test:seed": "node --import tsx --test scripts/seed-cvc.test.ts",
118
+ "test:guard": "node --import tsx --test scripts/lib/confirmTargetDb.test.ts"
123
119
  }
124
- }
120
+ }
@@ -10,7 +10,7 @@ live in other repos:
10
10
  | Pin | Upstream | What it is |
11
11
  |---|---|---|
12
12
  | `cvcIndex.pin.json` | `htilabstech/prototype` · `Final CVCs/CVC_INDEX.md` | The CVC **number space** — which number belongs to which vocabulary. **Authoritative.** A yaml's self-declared number is not. |
13
- | `coreIndicators.pin.json` | `htilabstech/prototype` · `data/core_indicators.yaml` | The indicator **catalog** — which indicator codes legitimately exist, **and what the catalog says about each one** (label · definition · family · polarity · severity · is_alert · alert_when, verbatim). |
13
+ | `coreIndicators.pin.json` | `htilabstech/prototype` · `data/core_indicators.yaml` | The indicator **catalog** — which indicator codes legitimately exist. |
14
14
  | `scoringEmits.pin.json` | `htilabstech/hti-scoring` · `weights/risk.weights.json` → `emits_by_code` | What the risk pipeline actually **consumes** — what CVC-136 must be able to express. |
15
15
 
16
16
  (Notion is the fourth SOT: **ratification**. It has no pin because it is a human
@@ -18,41 +18,6 @@ process. Items awaiting it carry `_status.vocabStatus:
18
18
  "provisional-pending-notion-ratification"` in their CVC JSON, and are listed in
19
19
  `docs/adrs/ADR-CVC-0.8.13-canonical-alignment.md`.)
20
20
 
21
- ### The field half of `coreIndicators.pin.json`
22
-
23
- That pin originally carried only `codes: string[]` — the sorted **set of code
24
- names**. So both halves of the contract were blind to everything else the catalog
25
- says: a code could keep its name while its label, definition, family, polarity,
26
- severity or alert routing was rewritten, and nothing failed. That shipped twice
27
- in consecutive refreshes — 0.8.14 dropped a definition revision, and the 0.8.17
28
- branch initially dropped a label rename plus a load-bearing deprecation
29
- qualifier, caught in human review rather than by CI.
30
-
31
- The pin now also carries `fields` — the seven projected values per code,
32
- **verbatim**. `GATE H` in the drift gate asserts CVC-136 restates every one of
33
- them. The projection and the (enumerated, individually self-tested) YAML
34
- round-trip normalizations live in `coreIndicatorFields.ts` **next to this file**,
35
- because both halves must share one definition of them.
36
-
37
- > `coreIndicatorFields.ts` is hand-maintained source, not a pin. The
38
- > "do not hand-edit" rule above is about the `*.pin.json` snapshots.
39
-
40
- ### Regenerating one pin without bumping another
41
-
42
- The pins are deliberately allowed to sit at **different** upstream SHAs. For a
43
- release `cvcIndex` was held at `a596eb9` while the prototype moved on, because
44
- absorbing the newer `CVC_INDEX.md` meant reconciling `INDEX_ABSENT` first —
45
- `juvenile_justice_involvement_status` (CVC-95) gained an index row and had to be
46
- promoted out of `INDEX_ABSENT` into `CANONICAL_BINDING`, and CVC-177's binding
47
- had to be re-pointed at the surviving spelling after the stale duplicate row was
48
- removed. That reconcile has landed and `cvcIndex` is now at `622410b`;
49
- `scoringEmits` still sits at its own SHA. Use `--only` so refreshing one pin from
50
- a checkout does not drag the others along:
51
-
52
- ```bash
53
- npm run sot:pins -- --only=coreIndicators
54
- ```
55
-
56
21
  Before these pins existed, platform-common validated itself **against itself**.
57
22
  So it drifted, silently, in every direction at once — 66 canonical indicator
58
23
  codes missing (including the whole perpetrator lane, which made facilitator