@htilabs/platform-common-models 0.40.0 → 0.42.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 +149 -0
- package/dist/index.cjs +677 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +658 -0
- package/dist/index.js.map +1 -1
- package/dist/share-rules/index.cjs +822 -0
- package/dist/share-rules/index.cjs.map +1 -0
- package/dist/share-rules/index.d.cts +804 -0
- package/dist/share-rules/index.d.ts +804 -0
- package/dist/share-rules/index.js +736 -0
- package/dist/share-rules/index.js.map +1 -0
- package/dist/sharing-ceiling/index.cjs +679 -2
- package/dist/sharing-ceiling/index.cjs.map +1 -1
- package/dist/sharing-ceiling/index.d.cts +461 -1
- package/dist/sharing-ceiling/index.d.ts +461 -1
- package/dist/sharing-ceiling/index.js +659 -1
- package/dist/sharing-ceiling/index.js.map +1 -1
- package/package.json +6 -1
- package/src/shareRules/__tests__/caseShareLane.test.ts +259 -0
- package/src/shareRules/__tests__/magicLinkAddresses.test.ts +107 -0
- package/src/shareRules/__tests__/platformApps.test.ts +133 -0
- package/src/shareRules/__tests__/releaseTerms.test.ts +358 -0
- package/src/shareRules/__tests__/senderRoiPosture.test.ts +284 -0
- package/src/shareRules/__tests__/sharingMethods.test.ts +105 -0
- package/src/shareRules/caseShareLane.ts +289 -0
- package/src/shareRules/index.ts +31 -0
- package/src/shareRules/magicLinkAddresses.ts +185 -0
- package/src/shareRules/platformApps.ts +168 -0
- package/src/shareRules/releaseTerms.ts +359 -0
- package/src/shareRules/reportPurposes.ts +50 -0
- package/src/shareRules/senderRoiPosture.ts +296 -0
- package/src/shareRules/sharingMethods.ts +204 -0
- package/src/sharingCeiling/__tests__/resolveShare.test.ts +1305 -0
- package/src/sharingCeiling/__tests__/threadLift.test.ts +353 -0
- package/src/sharingCeiling/coverage.ts +63 -0
- package/src/sharingCeiling/defaults.ts +106 -0
- package/src/sharingCeiling/index.ts +13 -1
- package/src/sharingCeiling/resolve.ts +1278 -0
package/README.md
CHANGED
|
@@ -16,6 +16,155 @@ 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
|
+
## share-resolver / 0.42.0 (additive)
|
|
20
|
+
|
|
21
|
+
0.42.0 (Kickoff 13, GDR § 5.79 "ONE resolver per runtime") ships THE share
|
|
22
|
+
resolver beside the ceiling at `@htilabs/platform-common-models/sharing-ceiling`
|
|
23
|
+
(also from the root): `resolveShare(input)` — the one pure read Thread and
|
|
24
|
+
PAVE call to learn, for one sender (account + team) × one recipient × one
|
|
25
|
+
purpose, which **policy** governs and at which **level**, the **posture**,
|
|
26
|
+
whether the share is excluded as a whole, and which information-scope
|
|
27
|
+
**categories** may leave. Every answer names policy · version · level. The
|
|
28
|
+
contract of record is platform-prototype `src/data.js` @ becfab4
|
|
29
|
+
(`governingPolicyFor`, `effectiveCeiling`, `platformStarterScope`,
|
|
30
|
+
`scopeListCovers`); the vectors of its two behavioural smoke flows
|
|
31
|
+
(`one-resolver-k13`, `sharing-four-state-k13`) are the test suite.
|
|
32
|
+
|
|
33
|
+
What it reads, in order:
|
|
34
|
+
|
|
35
|
+
- **The ladder** (`governingPolicyFor`): the team-to-team row → [inside the
|
|
36
|
+
account: the account's inside default → the platform's inside starter (the
|
|
37
|
+
full record, open, v1) — stop] → the relationship (the partner id, or
|
|
38
|
+
`__external__`) → the account default → the Platform default (a versioned
|
|
39
|
+
document, `pol-starter-<purpose>`). One policy = one purpose; a policy that
|
|
40
|
+
ANSWERS shares received (`trigger.answers === "received"`) never governs a
|
|
41
|
+
send; a retired document governs nowhere. The index is built from each
|
|
42
|
+
document's `assignments` (`attachmentIndexFromPolicies`); `matchTeamRow`
|
|
43
|
+
finds the row the first rung reads, exactly as the prototype does.
|
|
44
|
+
- **The team ceiling**: the sending team's own policy for the purpose rides
|
|
45
|
+
as a ceiling on every rung's answer (inside the account too) when it is not
|
|
46
|
+
itself the governing one — only what both allow, the stricter posture,
|
|
47
|
+
never a widening.
|
|
48
|
+
- **Posture**: the relationship's, raised (never lowered) by the governing
|
|
49
|
+
policy, then by the ceiling. A `blocked` posture excludes a discretionary
|
|
50
|
+
share and CARVES OUT a report (`mandatory_reporting`, `authority_reporting`
|
|
51
|
+
— `SHARE_REPORTING_PURPOSES`, derived from the purpose, never a caller
|
|
52
|
+
flag): the posture still reads `blocked`, `reportCarveOut` names what
|
|
53
|
+
blocks ordinary sharing, and the share is not excluded. The account's
|
|
54
|
+
purpose switch (`purposeOff`) excludes the whole share, reports included —
|
|
55
|
+
the carve-out is a policy / partner-layer rule, the switch sits above it.
|
|
56
|
+
- **The Platform default as the four states** (`derivePlatformDefault`;
|
|
57
|
+
CVC-133 keys `always · default_on · default_off · never`, the words
|
|
58
|
+
Required · Default On · Default Off · Blocked): System metadata and a
|
|
59
|
+
category the platform requires for the purpose are Required and bypass
|
|
60
|
+
every account-grain clamp; an off-by-default (heightened) category is
|
|
61
|
+
Blocked for every account; the seed list covers a category by itself, by
|
|
62
|
+
an ancestor (a kind) or by any row of it; a Platform Admin's bound
|
|
63
|
+
overrides. Neither Required nor Blocked is read inside the account.
|
|
64
|
+
- **Which list binds** (K13-12): a synced account default or the raw
|
|
65
|
+
Platform default → the default's starting scope is the ceiling; an
|
|
66
|
+
authored policy (an edited account default, a relationship, a team row, an
|
|
67
|
+
inside default) → its own list, within the default's cap. A legacy cell
|
|
68
|
+
chain's list (`effectiveCeiling(...).allowed` from this same module) arrives
|
|
69
|
+
as `legacyCeiling` and stays a ceiling even over an authored policy.
|
|
70
|
+
- **Per category**: the account's Information Scope, the default's Blocked,
|
|
71
|
+
the binding list, the governing policy's list, the team ceiling's list —
|
|
72
|
+
then rows: the platform floor, heightened rows off in the account,
|
|
73
|
+
field-group limits (`infoScopeItems`), and a
|
|
74
|
+
category every row of which is withheld is withheld. `scopeListCovers`
|
|
75
|
+
reads a stored list the way the prototype does — a category, a kind above
|
|
76
|
+
it, or a row of it; never a flat `indexOf` (HANDOFF K13-14).
|
|
77
|
+
|
|
78
|
+
Helpers the apps adopt with: `platformDefaultFor(scope, purpose)` — the
|
|
79
|
+
Platform default from the PUBLISHED starter (day-one, version 1) with the
|
|
80
|
+
platform's Required list (`HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE`: Identifying
|
|
81
|
+
information on every report), until the platform stores `pol-starter-<purpose>`
|
|
82
|
+
as a versioned document; `shareRowCeiling(resolution, scope)` — the ROW-grain
|
|
83
|
+
ceiling one answer amounts to (an allowed category by its code, or its rows minus
|
|
84
|
+
the withheld ones), which `maskSelectionToCeiling` (the composer) and
|
|
85
|
+
`rowsOverCeiling` (the send door) take as their ceiling; `legacyCeiling` takes
|
|
86
|
+
`effectiveCeiling`'s ANSWER and binds it only when an account rule answered — its
|
|
87
|
+
`platform_default` rung is the document the resolver already reads (passing that
|
|
88
|
+
as a list would clamp every authored policy to the starter and undo K13-12).
|
|
89
|
+
|
|
90
|
+
**The account's Information Scope starts from the codebook** (`accountScope`;
|
|
91
|
+
the prototype's clamps 4 / 4b). A CVC-236 heightened category or row
|
|
92
|
+
(`shareableDefault: false` — immigration & legal status, the full instrument
|
|
93
|
+
narratives) stays OFF until the account turns it on. `accountScope` carries
|
|
94
|
+
only the account's explicit choices: `categoriesOff` / `rowsOff` (switched
|
|
95
|
+
off) and `categoriesOn` / `rowsOn` (a heightened code turned on; turning a
|
|
96
|
+
grouping on does not turn on an off-by-default row beneath it). A caller that
|
|
97
|
+
omits `accountScope` gets the codebook's defaults — heightened information
|
|
98
|
+
held back, inside the account too — never everything. A code in both lists
|
|
99
|
+
is off.
|
|
100
|
+
|
|
101
|
+
Fail closed: an unknown purpose (no `platformDefault`) governs nothing —
|
|
102
|
+
`governing: null`, every category withheld. A document's `infoScope: null`
|
|
103
|
+
**or an absent `infoScope`** is "no category list" (the prototype reads every
|
|
104
|
+
non-array that way; the inside starter, a field-limits-only team ceiling and
|
|
105
|
+
a posture-only policy are written that way); an explicit `[]` binds an empty
|
|
106
|
+
list; a present value that is not a list of strings reads as `[]` (stricter
|
|
107
|
+
than the prototype). An assignment with an unknown `scope` is skipped.
|
|
108
|
+
`matchTeamRow` matches a sibling team's pair row on `their.id` alone, as the
|
|
109
|
+
prototype's `internalPairRow` does.
|
|
110
|
+
|
|
111
|
+
Left to the caller, deliberately: the partner row's direction / team-scoped
|
|
112
|
+
gates and item `restrictions`, the legacy `sharingPolicies` narrowing rows
|
|
113
|
+
(#451 moved them onto cards), the `byPurpose` virtual fork, and the
|
|
114
|
+
item-grain door (`rowsOverCeiling` / `maskSelectionToCeiling`, which take
|
|
115
|
+
`allowedCategories` as their ceiling).
|
|
116
|
+
|
|
117
|
+
## share-rules + sharing-ceiling defaults / 0.41.0 (additive)
|
|
118
|
+
|
|
119
|
+
PAVE is adopting the shared Next Steps share window Thread already uses. The
|
|
120
|
+
app-independent share rules it needs lived in Thread's `@thread/shared`; this
|
|
121
|
+
release LIFTS them here so both apps and both servers run one copy.
|
|
122
|
+
**Behaviour and copy are Thread's, unchanged** (thread develop `f021be2`); the
|
|
123
|
+
Thread unit tests for each function are ported beside it.
|
|
124
|
+
|
|
125
|
+
`@htilabs/platform-common-models/sharing-ceiling` (and the root) gains:
|
|
126
|
+
|
|
127
|
+
- `shareDefaultScopeFor(edits, purpose, { starter?, purposeOverrides? })` →
|
|
128
|
+
`{ off, accountDefault }` — the account's per-purpose default (the
|
|
129
|
+
prototype's name): the account's `__default__` cell for the purpose, else
|
|
130
|
+
the platform starter's `scopeByPurpose[purpose]`; `[]` when the purpose is
|
|
131
|
+
off or the store could not be read (`edits === null`). Thread's
|
|
132
|
+
`accountSharePurposePolicy` is the same function (an alias, not a wrapper).
|
|
133
|
+
- `isPermittedByCeiling(scope, ceiling, code)` and
|
|
134
|
+
`intersectSharingCeilingLists(scope, a, b)` — Thread's two coverage
|
|
135
|
+
readers, with the tree passed as `scope` like every other reader here
|
|
136
|
+
(Thread bound its own resolver; its re-point keeps the two-argument forms).
|
|
137
|
+
|
|
138
|
+
New subpath `@htilabs/platform-common-models/share-rules` (not on the root;
|
|
139
|
+
pure — no mongoose, no I/O, no React, no SOT import):
|
|
140
|
+
|
|
141
|
+
- magic link: `derivesOffPlatformRecipient`, `magicLinkAddresses`,
|
|
142
|
+
`magicLinkAddressOverflow`, `magicLinkToText`,
|
|
143
|
+
`magicLinkConfidentialOverflow`, `magicLinkPocHasVisibleAddress`,
|
|
144
|
+
`magicLinkConfidentialOnly`, `MAGIC_LINK_MAX_ADDRESSES` (25);
|
|
145
|
+
- release terms (R19 method / R21 end date): `operativeReleaseOf`,
|
|
146
|
+
`releaseListedMethods`, `releaseMethodRefusal`, `shareExpiryUnderRelease`,
|
|
147
|
+
`releaseEndOfDay` / `releaseEndDay`, `shareMethodOf`,
|
|
148
|
+
`isBrokeredSharingMethod`, the exemptions;
|
|
149
|
+
- the CaseShare lane: `caseShareLandingLane`, `pickDefaultShareTeam`,
|
|
150
|
+
`caseShareLaneMismatch`, the refusal codes and sentences (Thread's, which
|
|
151
|
+
name Thread, and Thread's recorded LEADS deviation — unchanged);
|
|
152
|
+
- the sender's release posture: `readAuthoredRoiPosture`,
|
|
153
|
+
`resolveAgencyRoiPosture`, `senderRoiPostureForTeam`,
|
|
154
|
+
`resolveSenderRoiPosture`, `vspReleasePosture`;
|
|
155
|
+
- what they stand on, moved with them: `recipientPlatformFromApps`,
|
|
156
|
+
`recipientUsesApp`, `agencyIdKey`, `teamLandingApp` / `teamLandsIn*`;
|
|
157
|
+
the share-method vocabulary `SHARING_METHOD` / `SHARING_METHOD_LABELS` and
|
|
158
|
+
the CVC-332 release-method reading (`RELEASE_METHOD*`,
|
|
159
|
+
`normalizeReleaseMethod`, `readReleaseMethods`,
|
|
160
|
+
`sharingMethodOfReleaseMethod`, …; Thread's zod write schema stays in
|
|
161
|
+
Thread); the report purposes `ROI_WAIVER_EXEMPT_PURPOSES` /
|
|
162
|
+
`isRoiWaiverExemptPurpose`.
|
|
163
|
+
|
|
164
|
+
Release-basis codes are NOT converged here: the one basis reason these rules
|
|
165
|
+
read, `roi_on_file` (Thread's `on_file`; CVC-331 `signed_release`), is kept
|
|
166
|
+
and marked `CVC-331 convergence owed (Kickoff 12)`.
|
|
167
|
+
|
|
19
168
|
## age / 0.40.0 (additive)
|
|
20
169
|
|
|
21
170
|
New subpath `@htilabs/platform-common-models/age` (also on the package root):
|