@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,366 @@
1
+ import { ReferralEntityCategoryKey, IncidentParticipationRoleKey } from './enums/index.cjs';
2
+
3
+ /**
4
+ * @htilabs/platform-common-models — Organization type (CVC-48, organization half)
5
+ *
6
+ * THE ONE PLACE an agency's / organization's type is defined and read.
7
+ *
8
+ * ## Ruling of record (Crysta, 2026-10-05 — platform-common #187)
9
+ *
10
+ * Agency type = `core-referral_entity_category` (CVC-48). It is set ONCE on
11
+ * the Org in the Admin Hub ("Organization Type", `direct`); the Agency (an
12
+ * Org's participation on an Account) carries it from the Org; every reader
13
+ * in every app joins on the KEY. No reader guesses the type from free text.
14
+ *
15
+ * Before this module, "agency type" existed four ways across the platform —
16
+ * free text on Thread's `Agency.type`, a positional number on
17
+ * `Organization.type`, the correct CVC-48 key that nothing read, and a
18
+ * free-text recogniser (Thread's `FREE_TEXT_TYPE_MATCHERS`) that the ROI gate,
19
+ * the mandatory-report authority set and the default session role all sat on
20
+ * top of. PAVE kept its own `VSP_TYPE_IDS` in a third spelling. This module
21
+ * replaces all of those with ONE vocabulary (the SOT keys) and ONE set of
22
+ * ruling-backed classifiers over it, so Thread and PAVE answer the same
23
+ * question the same way.
24
+ *
25
+ * ## IC-58 is the concept; CVC-48 is its only codeset
26
+ *
27
+ * IC-58 (Information Concept "Referral Entity Category") says WHAT the thing
28
+ * is; CVC-48 says WHICH VALUES are allowed. The `IC_58_*` constants in
29
+ * `./ic.ts` (`IC_58_REFERRAL_ENTITY`, `IC_58_LABELS`, `IC_58_ORG_TYPE_GROUPS`,
30
+ * `IC_58_EXTERNAL_TIERED`) are NOT a vocabulary of their own: they are CVC-48's
31
+ * own hierarchy written as positional numbers (0–31) for Thread's
32
+ * `Organization.type` and `CaseRecord.referralEntity`. They are deprecated for
33
+ * org-type use in favour of this module and stay exported only so the
34
+ * numbers already stored can be read. {@link LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY}
35
+ * is the one-way bridge (number → CVC-48 key), row for row by label;
36
+ * {@link resolveOrgTypeKeyFromLegacyNumeric} applies it. (Canon's 2025 PAVE
37
+ * pick-list, CVC-86, is a different legacy list — deprecated 2026-09-28 and
38
+ * kept in the records repo as its own crosswalk; it is not in this package.)
39
+ *
40
+ * ## What is and is not derived from the type
41
+ *
42
+ * - DERIVED (this module): sector membership (victim-serving / law
43
+ * enforcement / legal / healthcare / mandated-report authority), the
44
+ * default CVC-69 session role of a person acting FROM an agency of this
45
+ * type, labels, and spelling resolution (key ↔ Sean-spec enum constant ↔
46
+ * canon dotted code ↔ positional code ↔ legacy number).
47
+ * - NOT derived — captured on the org record, never inferred: `vsp` (the
48
+ * "is a DV/SA victim service provider" fact HMIS 2.01 needs — captured in
49
+ * the Admin Hub, UDD Org Data Object ruling 2026-10-05; CVC-48 ruling
50
+ * 2026-08-20 on 02-06-02-00), `vsp_private_nonprofit`, `apps_used`, and
51
+ * the as-built `requires_roi` (informational, GDR § 5.17 clause 2 — not
52
+ * one of the shared organization-type fields). The type only PROPOSES
53
+ * `vsp` ({@link orgTypeDefaultVsp} — the Admin Hub's pre-fill; set when
54
+ * HTI Labs affirms or changes it there, Crysta 2026-10-08); a stored
55
+ * boolean always wins. See `schemas/agency.ts`. (ORG-TYPE-REVIEW-ROUND-2026-10-08)
56
+ *
57
+ * ## Vocabulary
58
+ *
59
+ * CVC-48 is a referral-entity vocabulary whose organization half (canon codes
60
+ * `02-XX-YY-ZZ`) doubles as the org-type typology. {@link ORG_TYPE_KEYS} is
61
+ * that half: Level 1B sector headings (not selectable — a child is required
62
+ * everywhere, including agency onboarding; ruled 2026-08-20) plus Level 2 /
63
+ * Level 3 leaves. The Individual branch (Level 1A) and the missingness leaves
64
+ * are NOT org types; {@link AGENCY_TYPE_KEYS} additionally admits `unknown`
65
+ * as the ONE pre-backfill placeholder a stored agency may carry — the Admin
66
+ * Hub never offers it.
67
+ *
68
+ * The SOT JSON (~28 KB) is imported here so `./constants` stays
69
+ * mongoose-free for edge consumers; the cost is that JSON in the constants
70
+ * bundle. `enumConstant` is a generator column for spelling resolution only —
71
+ * it is not in the seeder's hashable fields and is never written to
72
+ * `cvc_entities`.
73
+ */
74
+
75
+ /** The Level 1B sector headings (never stored as a type; aggregation only). */
76
+ declare const ORG_TYPE_HEADING_KEYS: readonly ["housing_shelter_continuum", "hotlines", "justice_protective_systems", "health_behavioral_health", "education", "victim_community_service_providers", "coordination_governance", "internal", "other_entity"];
77
+ type OrgTypeHeadingKey = (typeof ORG_TYPE_HEADING_KEYS)[number];
78
+ /**
79
+ * The org-type keys an Admin Hub picker offers: every CVC-48 organization-half
80
+ * leaf the codebook marks `Selectable` (Level 2 Required + Optional, Level 3
81
+ * Optional), minus the one leaf no admin may pick
82
+ * ({@link ORG_TYPE_NONPICKABLE_LEAF_KEYS}). `school_academic_institution` IS
83
+ * a kind of organization (Level 2 Required under Education) and is offered.
84
+ * `hotline` (02-02-01-00, canon's Level-2 parent of the two hotline children)
85
+ * is carried since 0.18.0 at 048-006-003 — an organization that is a hotline
86
+ * without being national / local has its key.
87
+ */
88
+ declare const ORG_TYPE_SELECTABLE_KEYS: readonly ["outreach_project", "temporary_shelter", "residential_project", "national_hotline", "local_other_hotline", "hotline", "child_welfare_cps", "juvenile_justice", "law_enforcement", "local_law_enforcement", "state_law_enforcement", "federal_law_enforcement", "tribal_law_enforcement", "other_law_enforcement", "courts_prosecution", "correction_probation", "adult_protective_services", "inpatient_psychiatric_facility", "healthcare_provider", "school_academic_institution", "child_advocacy_center", "victim_service_provider", "community_based_service_provider", "legal_services_provider", "mdt", "coalition", "employer", "benefits_public_assistance_office", "other_organization"];
89
+ type OrgTypeSelectableKey = (typeof ORG_TYPE_SELECTABLE_KEYS)[number];
90
+ /**
91
+ * Organization-half leaves the codebook marks Selectable that an Admin Hub
92
+ * picker must NOT offer, yet a stored row may carry: `own_agency_internal`
93
+ * ("Own agency / internal referral", 02-08-01-00). As a REFERRAL value the
94
+ * codebook resolves its meaning THROUGH the receiving agency's type ("HMIS
95
+ * rollup derived from the receiving agency's Agency Type field — IC-58 § III
96
+ * Edge-Case Handling"), so no admin picks it as a kind of organization — the
97
+ * prototype's canonical CVC-48 picker keeps it in its non-pickable annex.
98
+ * But the platform's OWN organization carries it as built (registry row
99
+ * `internal_hti` / HTI Labs, `type: ORGANIZATION_INTERNAL_OWNAGENCY`), and
100
+ * the CVC-69 ruling table's "the platform's own agency → VSP staff" row keys
101
+ * on exactly that stored value. So: storable ({@link AGENCY_TYPE_KEYS}),
102
+ * resolvable, never offered ({@link ORG_TYPE_SELECTABLE_KEYS}).
103
+ */
104
+ declare const ORG_TYPE_NONPICKABLE_LEAF_KEYS: readonly ["own_agency_internal"];
105
+ /** Every CVC-48 key, organization half only (headings + leaves). */
106
+ declare const ORG_TYPE_KEYS: readonly ["housing_shelter_continuum", "hotlines", "justice_protective_systems", "health_behavioral_health", "education", "victim_community_service_providers", "coordination_governance", "internal", "other_entity", "outreach_project", "temporary_shelter", "residential_project", "national_hotline", "local_other_hotline", "hotline", "child_welfare_cps", "juvenile_justice", "law_enforcement", "local_law_enforcement", "state_law_enforcement", "federal_law_enforcement", "tribal_law_enforcement", "other_law_enforcement", "courts_prosecution", "correction_probation", "adult_protective_services", "inpatient_psychiatric_facility", "healthcare_provider", "school_academic_institution", "child_advocacy_center", "victim_service_provider", "community_based_service_provider", "legal_services_provider", "mdt", "coalition", "employer", "benefits_public_assistance_office", "other_organization", "own_agency_internal"];
107
+ /** A heading OR a leaf. For "what may be stored" see {@link AgencyTypeKey}. */
108
+ type OrgTypeKey = (typeof ORG_TYPE_KEYS)[number];
109
+ /**
110
+ * Valid stored values for `Organization.type` (home) / `Agency.type`
111
+ * (mirror): every selectable org-type leaf, the non-pickable leaf the
112
+ * platform's own organization carries ({@link ORG_TYPE_NONPICKABLE_LEAF_KEYS}),
113
+ * plus `unknown` — the pre-backfill placeholder an un-typed row carries until
114
+ * HTI Labs confirms its type (never offered by the Admin Hub; readers treat
115
+ * it as "no sector"). A heading is NOT a valid stored value.
116
+ */
117
+ declare const AGENCY_TYPE_KEYS: readonly ["outreach_project", "temporary_shelter", "residential_project", "national_hotline", "local_other_hotline", "hotline", "child_welfare_cps", "juvenile_justice", "law_enforcement", "local_law_enforcement", "state_law_enforcement", "federal_law_enforcement", "tribal_law_enforcement", "other_law_enforcement", "courts_prosecution", "correction_probation", "adult_protective_services", "inpatient_psychiatric_facility", "healthcare_provider", "school_academic_institution", "child_advocacy_center", "victim_service_provider", "community_based_service_provider", "legal_services_provider", "mdt", "coalition", "employer", "benefits_public_assistance_office", "other_organization", "own_agency_internal", "unknown"];
118
+ type AgencyTypeKey = (typeof AGENCY_TYPE_KEYS)[number];
119
+ declare function isOrgTypeKey(value: unknown): value is OrgTypeKey;
120
+ declare function isAgencyTypeKey(value: unknown): value is AgencyTypeKey;
121
+ /**
122
+ * Resolve any of the platform's STRING spellings of an org type to the ONE
123
+ * key. Accepts the SOT key (`child_welfare_cps`), the Sean-spec enum constant
124
+ * the org registry / `agencies.typeId` carry (`ORGANIZATION_JUSTICE_CHILDWELFARE`),
125
+ * the canon dotted code (`02-03-01-00`) or the positional code
126
+ * (`048-007-001-000-000-000-000`). Anything else — including every free-text
127
+ * value the retired recognisers used to guess at, and a legacy NUMBER in any
128
+ * form (`18`, `"18"`) — is `null`. The number has its own, explicit bridge:
129
+ * {@link resolveOrgTypeKeyFromLegacyNumeric}. Case- and whitespace-insensitive;
130
+ * never a substring match.
131
+ */
132
+ declare function resolveOrgTypeKey(value: unknown): OrgTypeKey | null;
133
+ /**
134
+ * Resolve any spelling of a STORABLE agency type: a selectable org-type leaf,
135
+ * or `unknown` (any spelling the missingness leaf has). This is the resolver
136
+ * for reading or backfilling `Agency.type` — a heading
137
+ * (`justice_protective_systems`, `ORGANIZATION_JUSTICE`), a v1.0.0 leaf that
138
+ * became a heading (`education`), an individual referrer or any other
139
+ * missingness row resolves to `null`, exactly as the Mongoose enum and the
140
+ * Zod schemas would refuse it (pre-review finding D1: the previous version
141
+ * returned headings typed as `AgencyTypeKey`). Use {@link resolveOrgTypeKey}
142
+ * when a heading is an acceptable answer (aggregation, labels).
143
+ */
144
+ declare function resolveAgencyTypeKey(value: unknown): AgencyTypeKey | null;
145
+ /**
146
+ * The positional numbers `./ic.ts` `IC_58_REFERRAL_ENTITY` assigned to CVC-48's
147
+ * rows, → the CVC-48 key, row for row by label (`IC_58_LABELS`). One-way:
148
+ * nothing new is ever written as a number. Three numbers name a sector HEADING
149
+ * (17 Education, 19 "Other External", 26 Victim + Community) and
150
+ * therefore resolve to an org type but NOT to a storable agency type — a row
151
+ * Thread defaulted to 19 is an un-typed organization and reads as such
152
+ * until the backfill gives it a leaf. Numbers 2–5 are the Individual branch:
153
+ * referral sources, never org types.
154
+ *
155
+ * **Backfill-only. Not a runtime reader, and never an ROI input.** The ruled
156
+ * shape (Org Data Object, 2026-10-02 / 2026-10-05; platform-common #187) is
157
+ * that the type is set ONCE, as a key, in the Admin Hub, and every reader
158
+ * joins on the key — "no reader guesses from words", and no reader translates
159
+ * numbers either. This table exists so the backfill review can PROPOSE a key
160
+ * for a numeric `Organization.type`; a consumer that still translates numbers
161
+ * at read time (pave's `IC58_TO_REFERRAL_ENTITY_CATEGORY_KEY`, Thread's
162
+ * `Organization.type` itself) retires that path when its rows are backfilled
163
+ * (#187 follow-ups). Whether a share needs a release is decided by the org's
164
+ * attested `vsp` flag, captured in the Admin Hub and never derived from the
165
+ * type (ruling 2026-10-05) — so which key `19` proposes cannot change an ROI
166
+ * answer anywhere. `19` → the `other_entity` HEADING is deliberate: in Thread
167
+ * `19` was the write for "referring organization Unknown / Anonymous"
168
+ * (`UNIDENTIFIED_EXTERNAL_ORG_TYPE`) and the default for every organization
169
+ * created before leaf-only pickers, so it proposes nothing and the review
170
+ * picks the leaf — `other_organization` only when a human says so.
171
+ */
172
+ declare const LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY: Readonly<{
173
+ readonly 0: "unknown";
174
+ readonly 1: "own_agency_internal";
175
+ readonly 2: "self_referred";
176
+ readonly 3: "family_guardian_friend";
177
+ readonly 4: "peer";
178
+ readonly 5: "other_individual";
179
+ readonly 10: "housing_shelter_continuum";
180
+ readonly 11: "hotline";
181
+ readonly 12: "justice_protective_systems";
182
+ readonly 13: "outreach_project";
183
+ readonly 14: "temporary_shelter";
184
+ readonly 15: "residential_project";
185
+ readonly 16: "health_behavioral_health";
186
+ readonly 17: "education";
187
+ readonly 18: "law_enforcement";
188
+ readonly 19: "other_entity";
189
+ readonly 20: "child_welfare_cps";
190
+ readonly 21: "juvenile_justice";
191
+ readonly 22: "courts_prosecution";
192
+ readonly 23: "correction_probation";
193
+ readonly 24: "inpatient_psychiatric_facility";
194
+ readonly 25: "healthcare_provider";
195
+ readonly 26: "victim_community_service_providers";
196
+ readonly 27: "child_advocacy_center";
197
+ readonly 28: "victim_service_provider";
198
+ readonly 29: "community_based_service_provider";
199
+ readonly 30: "employer";
200
+ readonly 31: "benefits_public_assistance_office";
201
+ }>;
202
+ type LegacyNumericReferralEntity = keyof typeof LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY;
203
+ /**
204
+ * The CVC-48 key a legacy number stands for (any row — individuals included),
205
+ * or `null` for a number the list never had. Accepts a number or its decimal
206
+ * string (`18` / `"18"`), the two forms Thread has stored it in.
207
+ */
208
+ declare function resolveReferralEntityKeyFromLegacyNumeric(value: unknown): ReferralEntityCategoryKey | null;
209
+ /**
210
+ * The ORG TYPE a legacy number stands for — a heading or a leaf — or `null`
211
+ * for the Individual branch, `0` (unknown) and anything unlisted. For "may it
212
+ * be stored as an agency type" pass the result through
213
+ * {@link resolveAgencyTypeKey} (headings → `null`).
214
+ */
215
+ declare function resolveOrgTypeKeyFromLegacyNumeric(value: unknown): OrgTypeKey | null;
216
+ /** The Sean-spec enum constant for a key (the org registry's spelling). */
217
+ declare function orgTypeEnumConstant(key: string): string | null;
218
+ /** The canon dotted code for a key (`02-03-01-00`). */
219
+ declare function orgTypeCanonicalCode(key: string): string | null;
220
+ /** Canon's picker label for a key (`title`); `null` for a key the SOT lacks. */
221
+ declare function orgTypeLabel(key: string): string | null;
222
+ /**
223
+ * The key and every ancestor, leaf first (`local_law_enforcement` →
224
+ * `law_enforcement` → `justice_protective_systems`). Empty for an unknown key.
225
+ * Guarded against a cyclic or self-referencing `parentCode` in the SOT: the
226
+ * walk stops at the first repeat instead of hanging.
227
+ */
228
+ declare function orgTypeAncestry(key: string): ReferralEntityCategoryKey[];
229
+ /**
230
+ * Key → parent key, organization half, from the SOT's `parentCode` field —
231
+ * the companion map a consumer uses instead of code-prefix arithmetic
232
+ * (review nit on `fce762f`). The hierarchy is the `parentCode` FIELD, never
233
+ * the positional code's prefix: `national_hotline` / `local_other_hotline`
234
+ * keep their v1.0.0 codes while their parent is now the `hotline` LEAF
235
+ * (048-006-003, carried since 0.18.0), so a child code does not lexically
236
+ * extend its parent's. Headings map to `null`. (`hotline` is the storable
237
+ * leaf — an organization that is a hotline; `hotlines` is the
238
+ * non-storable heading above it. Mind the plural.)
239
+ */
240
+ declare const ORG_TYPE_PARENT_KEY: Readonly<Record<OrgTypeKey, ReferralEntityCategoryKey | null>>;
241
+ /**
242
+ * The Level 1B sector heading a key sits under (itself if it is one); `null`
243
+ * for a key whose chain does not end in a heading — `unknown`, the
244
+ * individual referrers, the missingness root (pre-review finding D6: an
245
+ * aggregator keyed on this must skip un-typed agencies, not bucket them under
246
+ * `missingness_root`).
247
+ */
248
+ declare function orgTypeSector(key: string): OrgTypeHeadingKey | null;
249
+ /**
250
+ * Victim-serving organization types: the two Victim + Community leaves whose
251
+ * staff act as victim advocates — `victim_service_provider` and
252
+ * `child_advocacy_center` (CAC ruled under Victim + Community service
253
+ * providers 2026-08-20). `community_based_service_provider` and
254
+ * `legal_services_provider` sit under the same heading but are NOT
255
+ * victim-serving for this question (canon: the residual non-VSP provider; a
256
+ * lawyer's help). `coalition` is a system-level membership body, not a
257
+ * service provider (ruled 2026-08-20). NOTE: this is the TYPE-level default;
258
+ * the org record's own `vsp` attestation decides the HMIS 2.01 / ROI question.
259
+ */
260
+ declare const VICTIM_SERVING_ORG_TYPE_KEYS: readonly ["victim_service_provider", "child_advocacy_center"];
261
+ /** Law enforcement: the `law_enforcement` leaf and its Level 3 refinements. */
262
+ declare const LAW_ENFORCEMENT_ORG_TYPE_KEYS: readonly ["law_enforcement", "local_law_enforcement", "state_law_enforcement", "federal_law_enforcement", "tribal_law_enforcement", "other_law_enforcement"];
263
+ /** Legal: courts / prosecution, and legal services providers (a lawyer's help). */
264
+ declare const LEGAL_ORG_TYPE_KEYS: readonly ["courts_prosecution", "legal_services_provider"];
265
+ /**
266
+ * Healthcare incl. behavioral health: the `health_behavioral_health` subtree
267
+ * (the heading is listed so a consumer aggregating by sector can use it; it
268
+ * is never a stored type).
269
+ */
270
+ declare const HEALTHCARE_ORG_TYPE_KEYS: readonly ["health_behavioral_health", "inpatient_psychiatric_facility", "healthcare_provider"];
271
+ /**
272
+ * Designated authorities for mandatory / authority reporting: the whole
273
+ * Justice & Protective Systems subtree — child welfare, juvenile justice,
274
+ * every law-enforcement leaf, courts / prosecution, corrections / probation,
275
+ * adult protective services. This is canon's `/^ORGANIZATION_JUSTICE/`
276
+ * predicate over the enum constants, expressed over keys.
277
+ */
278
+ declare const REPORT_AUTHORITY_ORG_TYPE_KEYS: readonly ["justice_protective_systems", "child_welfare_cps", "juvenile_justice", "law_enforcement", "local_law_enforcement", "state_law_enforcement", "federal_law_enforcement", "tribal_law_enforcement", "other_law_enforcement", "courts_prosecution", "correction_probation", "adult_protective_services"];
279
+ /**
280
+ * Types that say nothing about a sector: the platform's own organization
281
+ * (`own_agency_internal` as stored on the HTI Labs row; `internal`, its
282
+ * heading) and the pre-backfill `unknown`. This set is the ruling table's
283
+ * "no type / unknown / the platform's own agency → VSP staff" row.
284
+ */
285
+ declare const NO_SECTOR_ORG_TYPE_KEYS: readonly ["internal", "own_agency_internal", "unknown"];
286
+ /**
287
+ * Each predicate accepts ANY spelling {@link resolveAgencyTypeKey} accepts and
288
+ * answers `false` for everything it does not recognise — a free-text type is
289
+ * never guessed at.
290
+ */
291
+ declare function isVictimServingOrgType(type: string | null | undefined): boolean;
292
+ declare function isLawEnforcementOrgType(type: string | null | undefined): boolean;
293
+ declare function isLegalOrgType(type: string | null | undefined): boolean;
294
+ declare function isHealthcareOrgType(type: string | null | undefined): boolean;
295
+ /** Is this type a designated mandatory / authority-report recipient? */
296
+ declare function isReportAuthorityOrgType(type: string | null | undefined): boolean;
297
+ /**
298
+ * The type-level DEFAULT for the org record's `vsp` attestation: `true` for
299
+ * `victim_service_provider`, `false` for every other recognised org type,
300
+ * `null` when the type cannot answer — the type is unknown / own-agency
301
+ * (nothing to default from), or it is a `child_advocacy_center` (ruled
302
+ * 2026-10-05: a CAC is victim-serving for the session role and OCAT, but its
303
+ * HMIS VSP standing is whatever the org attests — the registry attests FALSE
304
+ * for the one on file — so a bare CAC type is NOT a default either way; a
305
+ * reader on `null` takes the ROI gate's conservative branch, release
306
+ * required). A stored `vsp` boolean on the org ALWAYS wins; this is only what
307
+ * the Admin Hub pre-fills and what a reader falls back to when the org has
308
+ * not attested.
309
+ */
310
+ declare function orgTypeDefaultVsp(type: string | null | undefined): boolean | null;
311
+ /**
312
+ * The CVC-69 `incident_participation_roles` key a person acting FROM an
313
+ * agency of this type defaults to — the ruling table on the CVC-69 page
314
+ * (OWNER-ROLE-FROM-AGENCY, prototype #703, 2026-10-05):
315
+ *
316
+ * org attests `vsp: true` → Victim Service provider staff (checked FIRST)
317
+ * victim-serving → Victim Service provider staff
318
+ * law enforcement → Law enforcement personnel
319
+ * courts / prosecution / legal → Legal professional
320
+ * healthcare incl. behavioral health → Healthcare provider staff
321
+ * any other recognised org type → Other Response Personnel
322
+ * no type / unknown / own agency → Victim Service provider staff
323
+ *
324
+ * **This is a non-authoritative UI PRE-FILL, never an authorization input.**
325
+ * It cannot say "no" — the last row is a ruled catch-all, and it also absorbs
326
+ * a value that is PRESENT but unresolvable (legacy free text such as
327
+ * `"Law Enforcement"`). That is the ruling, not an accident: the Personnel
328
+ * roles card records (2026-10-05) "unrecognized or empty types fall back to
329
+ * Victim Service provider staff", the conservative direction for an advocate
330
+ * surface (Swap corrects it by hand). A consumer that needs to KNOW it is
331
+ * looking at the guess calls {@link orgTypeDefaultSessionRoleOrNull} instead.
332
+ * Any VAWA / ROI / VSP gate reads the org's stored `vsp` boolean, never this
333
+ * role (a CAC defaults to `vsp_staff` while its attested `vsp` may be false).
334
+ *
335
+ * Keys are the canonical CVC-69 v1.1.0 spellings (platform-common #186):
336
+ * `vsp_staff`, `law_enforcement_personnel`, `legal_professional`,
337
+ * `healthcare_provider_staff`, `other_response_personnel`. A consumer still
338
+ * on the 0.13.0 spellings (`service_provider_staff`, `responding_officer`,
339
+ * `medical_provider_staff`, `other_incident_responder`) maps through its own
340
+ * successor table until it repins; the test pins this table to
341
+ * `IncidentParticipationRoleKeys` so a future rename lands here too.
342
+ */
343
+ declare function orgTypeDefaultSessionRole(type: string | null | undefined,
344
+ /**
345
+ * The org's attested HMIS VSP flag (`agencies.vsp`, {@link addAgencyOrgTypeFields}).
346
+ * Canon checks it BEFORE the type (`HTI_SESSION_ROLE_FOR_ORG`, prototype
347
+ * ~L217866; the CVC-69 ruling table's first row): a strict `true` answers
348
+ * `vsp_staff` whatever the type says, because the flag is captured and the
349
+ * type's sector is only a default. `false`, `null`, `undefined` and any
350
+ * non-boolean fall through to the type. Thread's `resolveAgencySessionRole`
351
+ * carries the same precedence (#670) and collapses onto this at the repin.
352
+ */
353
+ vsp?: unknown): IncidentParticipationRoleKey;
354
+ /**
355
+ * The same table, but `null` instead of the catch-all whenever the type does
356
+ * not RESOLVE — absent, empty, free text, a legacy number, a heading. A
357
+ * resolved `unknown` / own-agency type still answers `vsp_staff` (that row is
358
+ * ruled, and the type was read, not guessed), and so does an attested
359
+ * `vsp: true` with any type at all (the flag was read). Use this when the caller must
360
+ * tell "the ruling said VSP staff" from "we had nothing to go on".
361
+ */
362
+ declare function orgTypeDefaultSessionRoleOrNull(type: string | null | undefined,
363
+ /** See {@link orgTypeDefaultSessionRole}: a strict `true` is a READ answer, never a guess. */
364
+ vsp?: unknown): IncidentParticipationRoleKey | null;
365
+
366
+ export { AGENCY_TYPE_KEYS as A, resolveAgencyTypeKey as B, resolveOrgTypeKey as C, resolveOrgTypeKeyFromLegacyNumeric as D, resolveReferralEntityKeyFromLegacyNumeric as E, HEALTHCARE_ORG_TYPE_KEYS as H, LAW_ENFORCEMENT_ORG_TYPE_KEYS as L, NO_SECTOR_ORG_TYPE_KEYS as N, ORG_TYPE_HEADING_KEYS as O, REPORT_AUTHORITY_ORG_TYPE_KEYS as R, VICTIM_SERVING_ORG_TYPE_KEYS as V, type AgencyTypeKey as a, LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY as b, LEGAL_ORG_TYPE_KEYS as c, type LegacyNumericReferralEntity as d, ORG_TYPE_KEYS as e, ORG_TYPE_NONPICKABLE_LEAF_KEYS as f, ORG_TYPE_PARENT_KEY as g, ORG_TYPE_SELECTABLE_KEYS as h, type OrgTypeHeadingKey as i, type OrgTypeKey as j, type OrgTypeSelectableKey as k, isAgencyTypeKey as l, isHealthcareOrgType as m, isLawEnforcementOrgType as n, isLegalOrgType as o, isOrgTypeKey as p, isReportAuthorityOrgType as q, isVictimServingOrgType as r, orgTypeAncestry as s, orgTypeCanonicalCode as t, orgTypeDefaultSessionRole as u, orgTypeDefaultSessionRoleOrNull as v, orgTypeDefaultVsp as w, orgTypeEnumConstant as x, orgTypeLabel as y, orgTypeSector as z };
@@ -284,6 +284,16 @@ declare const IC_57_SERVICE_AUDIENCE: {
284
284
  };
285
285
  type IC57Value = (typeof IC_57_SERVICE_AUDIENCE)[keyof typeof IC_57_SERVICE_AUDIENCE];
286
286
  declare const IC_57_LABELS: Record<IC57Value, string>;
287
+ /**
288
+ * @deprecated for ORGANIZATION TYPE — the positional numbers Thread stores. IC-58 is the Information
289
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
290
+ * and the one vocabulary for an agency's / organization's type is
291
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
292
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
293
+ * they stay exported only so values already stored can be read. Bridge a
294
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
295
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
296
+ */
287
297
  declare const IC_58_REFERRAL_ENTITY: {
288
298
  readonly UNKNOWN: 0;
289
299
  readonly INTERNAL: 1;
@@ -315,6 +325,16 @@ declare const IC_58_REFERRAL_ENTITY: {
315
325
  readonly EXTERNAL_BENEFITS: 31;
316
326
  };
317
327
  type IC58Value = (typeof IC_58_REFERRAL_ENTITY)[keyof typeof IC_58_REFERRAL_ENTITY];
328
+ /**
329
+ * @deprecated for ORGANIZATION TYPE — labels for the positional numbers; CVC-48 titles are `orgTypeLabel(key)`. IC-58 is the Information
330
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
331
+ * and the one vocabulary for an agency's / organization's type is
332
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
333
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
334
+ * they stay exported only so values already stored can be read. Bridge a
335
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
336
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
337
+ */
318
338
  declare const IC_58_LABELS: Record<IC58Value, string>;
319
339
  interface ReferralBranch {
320
340
  value?: number;
@@ -335,6 +355,16 @@ interface OrgTypeGroup {
335
355
  label: string;
336
356
  }[];
337
357
  }
358
+ /**
359
+ * @deprecated for ORGANIZATION TYPE — a picker tree over the positional numbers; pickers offer `ORG_TYPE_SELECTABLE_KEYS` grouped by `orgTypeSector`. IC-58 is the Information
360
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
361
+ * and the one vocabulary for an agency's / organization's type is
362
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
363
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
364
+ * they stay exported only so values already stored can be read. Bridge a
365
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
366
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
367
+ */
338
368
  declare const IC_58_ORG_TYPE_GROUPS: OrgTypeGroup[];
339
369
  interface IC58ExternalCategory {
340
370
  id: number;
@@ -349,6 +379,15 @@ interface IC58ExternalCategory {
349
379
  * Tiered organization type structure for External referral sources.
350
380
  * Parent categories are collapsible; leaf children are selectable.
351
381
  * Based on core_referral_entity_category codebook from Notion.
382
+ *
383
+ * @deprecated for ORGANIZATION TYPE — a tiered picker over the positional numbers; see `IC_58_ORG_TYPE_GROUPS`. IC-58 is the Information
384
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
385
+ * and the one vocabulary for an agency's / organization's type is
386
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
387
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
388
+ * they stay exported only so values already stored can be read. Bridge a
389
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
390
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
352
391
  */
353
392
  declare const IC_58_EXTERNAL_TIERED: IC58ExternalCategory[];
354
393
  declare const IC_59_SERVICE_STATE: {
@@ -284,6 +284,16 @@ declare const IC_57_SERVICE_AUDIENCE: {
284
284
  };
285
285
  type IC57Value = (typeof IC_57_SERVICE_AUDIENCE)[keyof typeof IC_57_SERVICE_AUDIENCE];
286
286
  declare const IC_57_LABELS: Record<IC57Value, string>;
287
+ /**
288
+ * @deprecated for ORGANIZATION TYPE — the positional numbers Thread stores. IC-58 is the Information
289
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
290
+ * and the one vocabulary for an agency's / organization's type is
291
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
292
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
293
+ * they stay exported only so values already stored can be read. Bridge a
294
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
295
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
296
+ */
287
297
  declare const IC_58_REFERRAL_ENTITY: {
288
298
  readonly UNKNOWN: 0;
289
299
  readonly INTERNAL: 1;
@@ -315,6 +325,16 @@ declare const IC_58_REFERRAL_ENTITY: {
315
325
  readonly EXTERNAL_BENEFITS: 31;
316
326
  };
317
327
  type IC58Value = (typeof IC_58_REFERRAL_ENTITY)[keyof typeof IC_58_REFERRAL_ENTITY];
328
+ /**
329
+ * @deprecated for ORGANIZATION TYPE — labels for the positional numbers; CVC-48 titles are `orgTypeLabel(key)`. IC-58 is the Information
330
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
331
+ * and the one vocabulary for an agency's / organization's type is
332
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
333
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
334
+ * they stay exported only so values already stored can be read. Bridge a
335
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
336
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
337
+ */
318
338
  declare const IC_58_LABELS: Record<IC58Value, string>;
319
339
  interface ReferralBranch {
320
340
  value?: number;
@@ -335,6 +355,16 @@ interface OrgTypeGroup {
335
355
  label: string;
336
356
  }[];
337
357
  }
358
+ /**
359
+ * @deprecated for ORGANIZATION TYPE — a picker tree over the positional numbers; pickers offer `ORG_TYPE_SELECTABLE_KEYS` grouped by `orgTypeSector`. IC-58 is the Information
360
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
361
+ * and the one vocabulary for an agency's / organization's type is
362
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
363
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
364
+ * they stay exported only so values already stored can be read. Bridge a
365
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
366
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
367
+ */
338
368
  declare const IC_58_ORG_TYPE_GROUPS: OrgTypeGroup[];
339
369
  interface IC58ExternalCategory {
340
370
  id: number;
@@ -349,6 +379,15 @@ interface IC58ExternalCategory {
349
379
  * Tiered organization type structure for External referral sources.
350
380
  * Parent categories are collapsible; leaf children are selectable.
351
381
  * Based on core_referral_entity_category codebook from Notion.
382
+ *
383
+ * @deprecated for ORGANIZATION TYPE — a tiered picker over the positional numbers; see `IC_58_ORG_TYPE_GROUPS`. IC-58 is the Information
384
+ * Concept; its only live codeset is CVC-48 `core-referral_entity_category`,
385
+ * and the one vocabulary for an agency's / organization's type is
386
+ * `constants/org-type.ts` (`ORG_TYPE_KEYS`, `resolveOrgTypeKey`, the ruling-
387
+ * table classifiers). These numbers are CVC-48's hierarchy in positional form;
388
+ * they stay exported only so values already stored can be read. Bridge a
389
+ * stored number with `resolveOrgTypeKeyFromLegacyNumeric` /
390
+ * `LEGACY_NUMERIC_TO_REFERRAL_ENTITY_KEY`; never write a new one.
352
391
  */
353
392
  declare const IC_58_EXTERNAL_TIERED: IC58ExternalCategory[];
354
393
  declare const IC_59_SERVICE_STATE: {