@htilabs/platform-common-models 0.23.0 → 0.25.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 (82) hide show
  1. package/README.md +104 -0
  2. package/dist/authz/index.cjs +143 -12
  3. package/dist/authz/index.cjs.map +1 -1
  4. package/dist/authz/index.d.cts +121 -12
  5. package/dist/authz/index.d.ts +121 -12
  6. package/dist/authz/index.js +136 -12
  7. package/dist/authz/index.js.map +1 -1
  8. package/dist/constants/index.cjs +30 -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 +26 -0
  13. package/dist/constants/index.js.map +1 -1
  14. package/dist/{cvcEntry-0BIB9sen.d.cts → cvcEntry-Asg7mxjB.d.cts} +12 -9
  15. package/dist/{cvcEntry-0BIB9sen.d.ts → cvcEntry-Asg7mxjB.d.ts} +12 -9
  16. package/dist/{index-CDoqrfc1.d.ts → index-ClTjjJ_S.d.ts} +1 -1
  17. package/dist/{index-Zu_mOJRn.d.cts → index-Pt82NxQg.d.cts} +1 -1
  18. package/dist/index.cjs +604 -15
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +7 -5
  21. package/dist/index.d.ts +7 -5
  22. package/dist/index.js +577 -15
  23. package/dist/index.js.map +1 -1
  24. package/dist/information-scope/index.d.cts +3 -350
  25. package/dist/information-scope/index.d.ts +3 -350
  26. package/dist/informationScopeResolver-BzYu97DE.d.cts +351 -0
  27. package/dist/informationScopeResolver-BzYu97DE.d.ts +351 -0
  28. package/dist/models/index.cjs +26 -1
  29. package/dist/models/index.cjs.map +1 -1
  30. package/dist/models/index.d.cts +2 -2
  31. package/dist/models/index.d.ts +2 -2
  32. package/dist/models/index.js +26 -1
  33. package/dist/models/index.js.map +1 -1
  34. package/dist/{platform-auth-B49Ly57B.d.cts → platform-auth-DJO-r9Pf.d.cts} +48 -1
  35. package/dist/{platform-auth-B49Ly57B.d.ts → platform-auth-DJO-r9Pf.d.ts} +48 -1
  36. package/dist/schemas/index.cjs +26 -1
  37. package/dist/schemas/index.cjs.map +1 -1
  38. package/dist/schemas/index.d.cts +25 -25
  39. package/dist/schemas/index.d.ts +25 -25
  40. package/dist/schemas/index.js +26 -1
  41. package/dist/schemas/index.js.map +1 -1
  42. package/dist/services/index.cjs +26 -1
  43. package/dist/services/index.cjs.map +1 -1
  44. package/dist/services/index.d.cts +2 -1
  45. package/dist/services/index.d.ts +2 -1
  46. package/dist/services/index.js +26 -1
  47. package/dist/services/index.js.map +1 -1
  48. package/dist/sharing-ceiling/index.cjs +497 -0
  49. package/dist/sharing-ceiling/index.cjs.map +1 -0
  50. package/dist/sharing-ceiling/index.d.cts +318 -0
  51. package/dist/sharing-ceiling/index.d.ts +318 -0
  52. package/dist/sharing-ceiling/index.js +451 -0
  53. package/dist/sharing-ceiling/index.js.map +1 -0
  54. package/dist/types/index.d.cts +11 -3
  55. package/dist/types/index.d.ts +11 -3
  56. package/dist/validation/index.cjs +22 -0
  57. package/dist/validation/index.cjs.map +1 -1
  58. package/dist/validation/index.js +22 -0
  59. package/dist/validation/index.js.map +1 -1
  60. package/package.json +7 -1
  61. package/src/__sot__/README.md +2 -1
  62. package/src/__sot__/coreFunctionFields.ts +88 -4
  63. package/src/__sot__/coreFunctions.pin.json +1040 -113
  64. package/src/__sot__/sharingStarter.pin.json +229 -0
  65. package/src/__tests__/authz-resolve.test.ts +115 -31
  66. package/src/__tests__/core-function-default-bounds.test.ts +374 -0
  67. package/src/__tests__/core-functions-case-close.test.ts +82 -0
  68. package/src/__tests__/sharing-starter-canon.test.ts +178 -0
  69. package/src/authz/defaultBounds.ts +69 -0
  70. package/src/authz/index.ts +12 -3
  71. package/src/authz/resolveEffectiveFunctions.ts +69 -29
  72. package/src/constants/platform-auth.ts +60 -0
  73. package/src/generated/coreFunctionDefaultBounds.ts +109 -0
  74. package/src/generated/sharingPlatformStarter.ts +165 -0
  75. package/src/index.ts +5 -0
  76. package/src/schemas/platform-role.ts +4 -1
  77. package/src/sharingCeiling/__tests__/sharingCeiling.test.ts +678 -0
  78. package/src/sharingCeiling/chain.ts +269 -0
  79. package/src/sharingCeiling/coverage.ts +346 -0
  80. package/src/sharingCeiling/index.ts +14 -0
  81. package/src/sharingCeiling/starter.ts +89 -0
  82. package/src/types/platform-auth.ts +9 -2
@@ -0,0 +1,165 @@
1
+ /**
2
+ * @htilabs/platform-common-models — the platform sharing starter (co-2sx)
3
+ *
4
+ * AUTO-GENERATED FILE — DO NOT EDIT BY HAND.
5
+ * Regenerate with:
6
+ * `python3 scripts/gen-sharing-starter.py <prototype root> <platform-prototype root>`.
7
+ *
8
+ * Canon (read from git objects at origin/main):
9
+ * - htilabstech/prototype HTI-LEADS-PAVE-Thread-prototype.html @ d85f05b7
10
+ * `HTI_SHARE_PLATFORM_STARTER` L326475-L326543
11
+ * (scopeVersion · scopeByPurpose · counterpartyOverrides);
12
+ * - htilabstech/platform-prototype src/data.js @ a6f1f3a5 (the contract of
13
+ * record, GDR § 5.79): `data.sharing.scopeByPurpose` /
14
+ * `counterpartyOverrides` L38170-L38190, and the
15
+ * platform purpose rows `sharing.purposes[].enabled`
16
+ * L32450-L32531;
17
+ * - htilabstech/prototype docs/share-roi/information_scope_v4.fields.csv @ d85f05b7: the distinct
18
+ * `row_v4` homes of its 517 fields (`fieldHomeRows`; the sentinel
19
+ * "rides with its record" is not a row and is left out).
20
+ * The two starter copies are equal (the generator refuses otherwise). GATE M
21
+ * (`src/__tests__/sharing-starter-canon.test.ts`) holds this module equal to
22
+ * `src/__sot__/sharingStarter.pin.json` and every code to a live, non-floor
23
+ * CVC-236 v4 row.
24
+ *
25
+ * CANON GAP: `counterpartyOverrides` is keyed by canon's DEMONSTRATION partner
26
+ * ids (palomar, okcpd, legal_aid_ok). No registry agency carries them, so the
27
+ * seeded-partner rung binds on no real data until the platform maps them.
28
+ */
29
+
30
+ /** Where this data was taken from (provenance, not compared by `--check`). */
31
+ export const SHARING_PLATFORM_STARTER_SOURCE = {
32
+ "monolith": {
33
+ "repo": "htilabstech/prototype",
34
+ "file": "HTI-LEADS-PAVE-Thread-prototype.html",
35
+ "sha": "d85f05b7",
36
+ "lines": [
37
+ 326475,
38
+ 326543
39
+ ]
40
+ },
41
+ "mirror": {
42
+ "repo": "htilabstech/platform-prototype",
43
+ "file": "src/data.js",
44
+ "sha": "a6f1f3a5",
45
+ "starterLines": [
46
+ 38170,
47
+ 38190
48
+ ],
49
+ "purposeLines": [
50
+ 32450,
51
+ 32531
52
+ ]
53
+ },
54
+ "fieldPlacements": {
55
+ "repo": "htilabstech/prototype",
56
+ "file": "docs/share-roi/information_scope_v4.fields.csv",
57
+ "sha": "d85f05b7"
58
+ }
59
+ } as const;
60
+
61
+ // <generated-data>
62
+ export const SHARING_PLATFORM_STARTER_DATA = {
63
+ scopeVersion: 4,
64
+ scopeByPurpose: {
65
+ "referral": ["identifying", "contact", "services", "system", "summary_needs_assessment"],
66
+ "case_collaboration": ["identifying", "risk", "contact", "services", "notes", "system", "summary_initial_screen", "summary_lap", "summary_danger_assessment", "summary_stalking_assessment", "summary_injury_and_strangulation", "summary_ae_intake", "summary_tra", "summary_needs_assessment"],
67
+ "deconfliction": ["identifying", "system"],
68
+ "mandatory_reporting": ["identifying", "risk", "contact", "services", "notes", "system", "summary_initial_screen", "summary_lap", "summary_danger_assessment", "summary_stalking_assessment", "summary_injury_and_strangulation", "summary_ae_intake", "summary_tra", "summary_needs_assessment", "offenders.identifying", "offenders.risk", "relationships_household", "family"],
69
+ "discretionary_share": ["identifying", "system"],
70
+ "authority_reporting": ["identifying", "risk", "system", "summary_initial_screen", "summary_lap", "summary_danger_assessment", "summary_stalking_assessment", "summary_injury_and_strangulation", "summary_ae_intake", "summary_tra", "offenders.identifying", "offenders.risk", "relationships_household", "family"],
71
+ "automatic_account_share": ["identifying", "system"],
72
+ "records_request": ["identifying", "system"],
73
+ },
74
+ counterpartyOverrides: {
75
+ "palomar": {
76
+ "case_collaboration": ["identifying", "risk", "contact", "services", "notes", "health_accommodation", "system", "summary_initial_screen", "summary_lap", "summary_danger_assessment", "summary_stalking_assessment", "summary_injury_and_strangulation", "summary_ae_intake", "summary_tra", "summary_mental_health_screen", "summary_behavioral_health_intake", "summary_trauma_and_coping_screen", "summary_needs_assessment"],
77
+ },
78
+ "okcpd": {
79
+ "mandatory_reporting": ["identifying", "risk", "contact", "services", "notes", "system", "summary_initial_screen", "summary_lap", "summary_danger_assessment", "summary_stalking_assessment", "summary_injury_and_strangulation", "summary_ae_intake", "summary_tra", "summary_needs_assessment", "offenders.identifying", "offenders.risk", "relationships_household", "family"],
80
+ "referral": ["identifying", "contact", "services", "system", "summary_needs_assessment"],
81
+ },
82
+ "legal_aid_ok": {
83
+ "referral": ["identifying", "contact", "services", "notes", "system", "summary_needs_assessment"],
84
+ },
85
+ },
86
+ purposeEnabled: {
87
+ "referral": true,
88
+ "case_collaboration": true,
89
+ "deconfliction": true,
90
+ "mandatory_reporting": true,
91
+ "discretionary_share": true,
92
+ "authority_reporting": true,
93
+ "automatic_account_share": true,
94
+ "records_request": false,
95
+ },
96
+ fieldHomeRows: [
97
+ "accommodation_needs",
98
+ "ad_content",
99
+ "additional_ids",
100
+ "addresses",
101
+ "case_attachments",
102
+ "case_determinations",
103
+ "case_lifecycle",
104
+ "case_notes",
105
+ "commercial_activity",
106
+ "contact_info",
107
+ "demographics",
108
+ "derived_risk_signals",
109
+ "dob",
110
+ "encounter_location",
111
+ "family.health_accommodation",
112
+ "family.identifying",
113
+ "family.risk",
114
+ "full_ae_intake",
115
+ "full_behavioral_health_intake",
116
+ "full_danger_assessment",
117
+ "full_findings",
118
+ "full_hope_scale",
119
+ "full_ida",
120
+ "full_initial_screen",
121
+ "full_injury_and_strangulation",
122
+ "full_lap",
123
+ "full_mental_health_screen",
124
+ "full_needs_assessment",
125
+ "full_stalking_assessment",
126
+ "full_tra",
127
+ "full_trauma_and_coping_screen",
128
+ "health_status",
129
+ "identifying",
130
+ "immigration_applications",
131
+ "immigration_status",
132
+ "instruments",
133
+ "names",
134
+ "network_membership",
135
+ "object_identity_attributes",
136
+ "offenders.risk",
137
+ "others.risk",
138
+ "persona_links",
139
+ "phone_identifiers",
140
+ "plans_goals",
141
+ "priorities_safety",
142
+ "relationships_household",
143
+ "screen_indicators",
144
+ "service_history",
145
+ "session_summary",
146
+ "summary_ae_intake",
147
+ "summary_behavioral_health_intake",
148
+ "summary_danger_assessment",
149
+ "summary_findings",
150
+ "summary_hope_scale",
151
+ "summary_ida",
152
+ "summary_initial_screen",
153
+ "summary_injury_and_strangulation",
154
+ "summary_lap",
155
+ "summary_mental_health_screen",
156
+ "summary_needs_assessment",
157
+ "summary_stalking_assessment",
158
+ "summary_tra",
159
+ "summary_trauma_and_coping_screen",
160
+ "system",
161
+ "system_involvement",
162
+ "victimization",
163
+ ],
164
+ } as const;
165
+ // </generated-data>
package/src/index.ts CHANGED
@@ -56,6 +56,11 @@ export * from "./services/index.js";
56
56
  // consumers import it from the `@htilabs/platform-common-models/authz` subpath.
57
57
  export * from "./authz/index.js";
58
58
 
59
+ // Inter-Agency Sharing ceiling on the CVC-236 v4 tree (pure; no mongoose, no
60
+ // I/O). Browser consumers import it from the
61
+ // `@htilabs/platform-common-models/sharing-ceiling` subpath.
62
+ export * from "./sharingCeiling/index.js";
63
+
59
64
  // ─── CVC validation surface (Zod schemas + inferred types) ──────────────────
60
65
  // Per co-am3.7 (Phase 1.7) bead: re-export the Zod schemas, plus the inferred
61
66
  // scalar types and `CvcDomain`. The Zod-inferred entry shape is exposed via
@@ -52,7 +52,10 @@ export const platformRoleSchemaDefinition = {
52
52
  type: Boolean,
53
53
  default: false,
54
54
  },
55
- /** Dynamic map of functionCode → PermissionStateValue. */
55
+ /**
56
+ * Dynamic map of functionCode → DefaultBoundStateValue (a PERMISSION_STATE
57
+ * value or the codebook's `NA`); an unlisted function is unbound.
58
+ */
56
59
  functions: {
57
60
  type: Schema.Types.Mixed,
58
61
  default: {},