@htilabs/platform-common-models 0.65.0 → 0.66.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.
- package/README.md +74 -0
- package/dist/index.cjs +13 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +10 -0
- package/dist/index.js.map +1 -1
- package/dist/org-directory/index.d.cts +4 -262
- package/dist/org-directory/index.d.ts +4 -262
- package/dist/orgRecord-B4-ELaZ_.d.cts +263 -0
- package/dist/orgRecord-h3Z-V23F.d.ts +263 -0
- package/package.json +1 -1
- package/src/__tests__/root-org-key-exports.test.ts +24 -0
- package/src/index.ts +7 -0
package/README.md
CHANGED
|
@@ -16,6 +16,80 @@ Package exports are organized into a public root API and a small number of
|
|
|
16
16
|
dedicated subpaths (`/validation`, `/cvcs`) — consult `package.json` for the
|
|
17
17
|
authoritative `exports` map.
|
|
18
18
|
|
|
19
|
+
## 0.66.0 — the agency link sheet: every Agency points at its Organization (additive)
|
|
20
|
+
|
|
21
|
+
The data dictionary says every Agency points at an Org (an Agency is an Org's
|
|
22
|
+
participation in an Account). In production 5 of 115 `agencies` rows carry
|
|
23
|
+
`organizationId`, and 53 of the rest hold a VSP answer that belongs on an
|
|
24
|
+
organization they do not have. This release adds the reviewed sheet that
|
|
25
|
+
links them. Nothing in the published package changes except the root exports
|
|
26
|
+
below; the rest is in `scripts/` (runbook:
|
|
27
|
+
`scripts/FILL_ORG_REGISTRY_RUNBOOK.md`, "The agency link sheet").
|
|
28
|
+
|
|
29
|
+
- `mintOrgKey`, `isOrgKey` and `ORG_KEY_PATTERN` are now exported from the
|
|
30
|
+
package root as well as from `/org-directory`, so an app can mint a key
|
|
31
|
+
where it creates an organization without a second import path.
|
|
32
|
+
- `fill-org-registry --propose-agency-orgs` (read-only) writes one CSV line
|
|
33
|
+
per agency with no `organizationId`: plain facts read from the agency row
|
|
34
|
+
(apps, account or not, deployed, off-PAVE, test account, retired, type,
|
|
35
|
+
VSP answer), a proposed organization, and the reason.
|
|
36
|
+
- An organization is proposed on two kinds of evidence only: an
|
|
37
|
+
organization that already names the agency as its own
|
|
38
|
+
(`organizations.agencyId`), or exactly one organization with the same
|
|
39
|
+
name that is not another agency's own and not in another agency's list.
|
|
40
|
+
Never on a loose name match.
|
|
41
|
+
- Nothing is proposed for an agency that holds no account (ruled
|
|
42
|
+
2026-10-15/17 to become an Org plus a referrals contact, which this tool
|
|
43
|
+
does not do), for a test or internal row, or where the evidence is not
|
|
44
|
+
clear-cut. The reason says which.
|
|
45
|
+
- The reviewer fills `approved` with an organization's database id,
|
|
46
|
+
`create`, or nothing.
|
|
47
|
+
- `--apply-agency-orgs <sheet> [--created-user <users._id>]` prints every
|
|
48
|
+
line with the agency's and the organization's stored names, refuses the
|
|
49
|
+
whole sheet if any line cannot be applied (another database's sheet, a
|
|
50
|
+
changed agency name, an agency that already has an `organizationId`, an
|
|
51
|
+
organization that is missing or another agency's own, two lines for one
|
|
52
|
+
organization), then asks for the database name, saves before-images and
|
|
53
|
+
writes line by line. A link a sign-in completed in between counts as done
|
|
54
|
+
and is not undone; an agency that got a different organization in between
|
|
55
|
+
is skipped and the line says what was taken back; a line the database
|
|
56
|
+
refuses fails alone; every line's result is printed and the command exits
|
|
57
|
+
non-zero if any was not linked. The plan marks a line whose organization's
|
|
58
|
+
type or VSP answer differs from the agency's.
|
|
59
|
+
- Both halves of the link are written: `agencies.organizationId` and
|
|
60
|
+
`organizations.agencyId` (`isAgencyOwnOrganization`).
|
|
61
|
+
- `create` adds the agency's own organization the way the auth service does
|
|
62
|
+
at a first sign-in: a new `_id`, the agency's name, `status` 1, `agencyId` and `agencyScope` the agency, `community` the
|
|
63
|
+
agency's state (else `UNKNOWN`), empty `phones` / `emails`, and
|
|
64
|
+
`createdUser` the operator's platform user. `type` (CVC-48
|
|
65
|
+
`core-referral_entity_category`) is the type the agency row already
|
|
66
|
+
carries, or `unknown`; nothing is worked out. `create` is refused while
|
|
67
|
+
any organization still stores a type number (`migrate:org-type-keys` goes
|
|
68
|
+
first). No VSP answer is written: the fill copies the agency's answer.
|
|
69
|
+
- An organization created by the link sheet deliberately gets **no `key`**
|
|
70
|
+
at creation: a stated exception to "every create stores `key`", because an
|
|
71
|
+
identifier never changes and the identifier sheet must be able to give the
|
|
72
|
+
agency's own organization its curated identifier. Creating an agency's own
|
|
73
|
+
organization where a same-named copy sits in another agency's list
|
|
74
|
+
knowingly leaves two rows until the copy is folded in (a merge: re-point
|
|
75
|
+
references, then delete the copy), which is not built in production yet.
|
|
76
|
+
- The identifier sheet (`--propose-keys`, run after the links) now reads
|
|
77
|
+
`agencies` too: when several rows could take one curated key and exactly
|
|
78
|
+
one is an agency's own organization, it proposes the key for that row and
|
|
79
|
+
marks the others as copies to leave blank. Otherwise the rows stay
|
|
80
|
+
contested. `proposeOrgKeys` takes the agencies as an optional fourth
|
|
81
|
+
argument.
|
|
82
|
+
- Undo is the existing `--rollback`. It removes an `organizationId` this
|
|
83
|
+
tool set (only while it still holds that value) and deletes an
|
|
84
|
+
organization it created only while that row is still exactly as created
|
|
85
|
+
and nothing in this database points at it (an agency, a unit, a personnel
|
|
86
|
+
record, a point of contact, a service listing); otherwise the organization
|
|
87
|
+
stays and the line says why. Linking to a stored organization sets only
|
|
88
|
+
its `agencyId`, so an undo of the fill still recognises the row.
|
|
89
|
+
Before-image files from 0.65.0 still read.
|
|
90
|
+
- Order of a run: type keys, agency link sheet, identifier sheet (proposed
|
|
91
|
+
after the links are applied), fill, report.
|
|
92
|
+
|
|
19
93
|
## 0.65.0 — the Org's identifier: `key` (additive)
|
|
20
94
|
|
|
21
95
|
An organization now carries its identifier, the one value that names the same
|
package/dist/index.cjs
CHANGED
|
@@ -392,6 +392,7 @@ __export(src_exports, {
|
|
|
392
392
|
ORG_KEY_INDEX_NAME: () => ORG_KEY_INDEX_NAME,
|
|
393
393
|
ORG_KEY_INDEX_OPTIONS: () => ORG_KEY_INDEX_OPTIONS,
|
|
394
394
|
ORG_KEY_INDEX_SPEC: () => ORG_KEY_INDEX_SPEC,
|
|
395
|
+
ORG_KEY_PATTERN: () => ORG_KEY_PATTERN,
|
|
395
396
|
ORG_TYPE_FIELD_NAMES: () => ORG_TYPE_FIELD_NAMES,
|
|
396
397
|
ORG_TYPE_HEADING_KEYS: () => ORG_TYPE_HEADING_KEYS,
|
|
397
398
|
ORG_TYPE_KEYS: () => ORG_TYPE_KEYS,
|
|
@@ -745,6 +746,7 @@ __export(src_exports, {
|
|
|
745
746
|
isLgbtqOrientation: () => isLgbtqOrientation,
|
|
746
747
|
isLiveOrganizationProgram: () => isLiveOrganizationProgram,
|
|
747
748
|
isNeverPickableServiceMechanism: () => isNeverPickableServiceMechanism,
|
|
749
|
+
isOrgKey: () => isOrgKey,
|
|
748
750
|
isOrgTypeKey: () => isOrgTypeKey,
|
|
749
751
|
isPermittedByCeiling: () => isPermittedByCeiling,
|
|
750
752
|
isProgramReviewStatus: () => isProgramReviewStatus,
|
|
@@ -778,6 +780,7 @@ __export(src_exports, {
|
|
|
778
780
|
militaryBranchSot: () => militaryBranch_v1_0_0_default,
|
|
779
781
|
militaryStatusSot: () => militaryStatus_v1_0_0_default,
|
|
780
782
|
minorAdultStatusSot: () => minorAdultStatus_v1_0_0_default,
|
|
783
|
+
mintOrgKey: () => mintOrgKey,
|
|
781
784
|
mirrorOrgTypeFields: () => mirrorOrgTypeFields,
|
|
782
785
|
nameTypeSot: () => nameType_v1_0_0_default,
|
|
783
786
|
needsAssessmentChangeTypeSot: () => needsAssessmentChangeType_v1_0_0_default,
|
|
@@ -18792,6 +18795,13 @@ var ORG_KEY_PATTERN = /^[a-z0-9][a-z0-9_-]{0,119}$/;
|
|
|
18792
18795
|
function isOrgKey(value) {
|
|
18793
18796
|
return typeof value === "string" && ORG_KEY_PATTERN.test(value);
|
|
18794
18797
|
}
|
|
18798
|
+
function mintOrgKey(id) {
|
|
18799
|
+
const hex = (typeof id === "string" ? id : id.toHexString()).trim().toLowerCase();
|
|
18800
|
+
if (!/^[0-9a-f]{24}$/.test(hex)) {
|
|
18801
|
+
throw new Error("mintOrgKey: needs the organization's 24-hex _id");
|
|
18802
|
+
}
|
|
18803
|
+
return `org-${hex}`;
|
|
18804
|
+
}
|
|
18795
18805
|
var line = (max) => import_zod.z.string().trim().min(1).max(max).nullable();
|
|
18796
18806
|
var ORG_VSP_TWO_STEP_MESSAGE = "vspPrivateNonprofit is step 2 of the HMIS VSP two-step and requires vsp: true";
|
|
18797
18807
|
var OrgIdentityWriteSchema = import_zod.z.object({
|
|
@@ -74825,6 +74835,7 @@ var CVC_197_VALUES = selectableCodes(
|
|
|
74825
74835
|
ORG_KEY_INDEX_NAME,
|
|
74826
74836
|
ORG_KEY_INDEX_OPTIONS,
|
|
74827
74837
|
ORG_KEY_INDEX_SPEC,
|
|
74838
|
+
ORG_KEY_PATTERN,
|
|
74828
74839
|
ORG_TYPE_FIELD_NAMES,
|
|
74829
74840
|
ORG_TYPE_HEADING_KEYS,
|
|
74830
74841
|
ORG_TYPE_KEYS,
|
|
@@ -75178,6 +75189,7 @@ var CVC_197_VALUES = selectableCodes(
|
|
|
75178
75189
|
isLgbtqOrientation,
|
|
75179
75190
|
isLiveOrganizationProgram,
|
|
75180
75191
|
isNeverPickableServiceMechanism,
|
|
75192
|
+
isOrgKey,
|
|
75181
75193
|
isOrgTypeKey,
|
|
75182
75194
|
isPermittedByCeiling,
|
|
75183
75195
|
isProgramReviewStatus,
|
|
@@ -75211,6 +75223,7 @@ var CVC_197_VALUES = selectableCodes(
|
|
|
75211
75223
|
militaryBranchSot,
|
|
75212
75224
|
militaryStatusSot,
|
|
75213
75225
|
minorAdultStatusSot,
|
|
75226
|
+
mintOrgKey,
|
|
75214
75227
|
mirrorOrgTypeFields,
|
|
75215
75228
|
nameTypeSot,
|
|
75216
75229
|
needsAssessmentChangeTypeSot,
|