@htilabs/platform-common-models 0.67.0 → 0.69.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 CHANGED
@@ -16,6 +16,65 @@ 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.69.0 — the merge is in the package: `@htilabs/platform-common-models/org-merge`
20
+
21
+ The merge step of 0.68.0 lived in `scripts/` and so was not published. Its
22
+ plan, write and undo (`planMerges`, `executeMerges`, `rollbackMerges`,
23
+ `ORG_REFERENCES`, `appDatabaseProblem`) now ship as the server-only subpath
24
+ `/org-merge`, so the Platform's Admin Hub can fold a copy into the kept
25
+ organization by the same rules the developer-run tool uses. Nothing about a
26
+ merge changes: the code moved (`scripts/lib/orgMerge.ts` to
27
+ `src/orgMerge/orgMerge.ts`), the spreadsheet reader stayed in `scripts/`
28
+ (`scripts/lib/orgMergeSheet.ts`), and `rollbackMerges` takes the smaller
29
+ `MergeBeforeImages` (the fill's before-images file is one).
30
+
31
+ One change makes it usable outside this package: `/org-merge` imports neither
32
+ mongoose nor the MongoDB driver. Database handles are typed structurally, and
33
+ each call takes the caller's own ObjectId class and EJSON as its last argument
34
+ (`MergeDriver`: with `mongodb`, `{ ObjectId, EJSON: BSON.EJSON }`; with
35
+ mongoose, `mongoose.mongo.ObjectId` and `mongoose.mongo.BSON.EJSON`).
36
+ The tool binds mongoose's in `scripts/lib/orgMerge.ts`; its commands, sheet
37
+ and runbook are unchanged.
38
+
39
+ One refusal moved down a level with it: `planMerges` now refuses a line whose
40
+ copy and kept row are the same row. The sheet reader already did; a caller
41
+ that has no sheet (the Admin Hub) gets the same answer from the plan.
42
+
43
+ ## 0.68.0 — folding a copy into the real organization: the merge step (scripts only)
44
+
45
+ One record per real-world organization. Where the same organization was typed
46
+ in twice, a person names the copy and the row that is kept, and this step
47
+ folds the one into the other. Nothing in the published package changes; it is
48
+ all in `scripts/` (runbook: `scripts/FILL_ORG_REGISTRY_RUNBOOK.md`, "Folding
49
+ a copy into the real organization").
50
+
51
+ - `fill-org-registry --apply-merges <sheet.csv> [--thread-db <names>]
52
+ [--pave-db <names>]`. The sheet is written by a person (`source_db,
53
+ duplicate_id, duplicate_name, kept_id, kept_name, different_name_ok,
54
+ approved`); there is no propose step, and nothing works out which rows are
55
+ copies. Same standard as the other sheets: both names checked on every
56
+ line, another database's sheet refused, the whole plan printed before the
57
+ database name is asked for, before-images saved first, per-line results,
58
+ undo through `--rollback`.
59
+ - A merge is pure re-pointing (ruled 2026-10-20): every stored reference to
60
+ the copy's `_id` moves to the kept Org, in the stored form it had. The kept
61
+ row gains `legacy_ids.merged_from` (the copy's id) and nothing else. No
62
+ name, type, VSP answer or sharing rule is combined.
63
+ - The copy is deleted only when nothing in the platform database points at
64
+ it and every Thread and PAVE database was named and nothing there does
65
+ either. Otherwise it is kept, marked inactive (`status` 2), and the line
66
+ says which database could not be checked.
67
+ - Refused: a missing row; a name that is not the stored name; Thread's
68
+ development sample rows; a copy that is an Agency's own organization or has
69
+ programs; a kept row that is inactive or declined, or a unit of the copy; two
70
+ different names without `different_name_ok` = `yes` on the line; a kept row
71
+ the copy's users could not see (another Agency's list and no shared,
72
+ non-blank community); chains. A copy's identifier (`key`) and a sharing
73
+ grant naming it are never moved; either keeps the copy, inactive.
74
+ - A list that already names the kept Org loses the copy's id instead of naming
75
+ the kept Org twice; the undo puts the whole list back.
76
+ - Before-image files gain an optional `merges` list. Files from 0.65.0 to
77
+ 0.67.0 still read.
19
78
  ## 0.67.0 — coreFunctions 1.6.0: four permission descriptions reworded (additive; codes, keys, titles and bounds unchanged)
20
79
 
21
80
  **What changed.** Crysta approved new descriptions for four permissions on her