@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.
- package/README.md +104 -0
- package/dist/authz/index.cjs +143 -12
- package/dist/authz/index.cjs.map +1 -1
- package/dist/authz/index.d.cts +121 -12
- package/dist/authz/index.d.ts +121 -12
- package/dist/authz/index.js +136 -12
- package/dist/authz/index.js.map +1 -1
- package/dist/constants/index.cjs +30 -0
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.d.cts +1 -1
- package/dist/constants/index.d.ts +1 -1
- package/dist/constants/index.js +26 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/{cvcEntry-0BIB9sen.d.cts → cvcEntry-Asg7mxjB.d.cts} +12 -9
- package/dist/{cvcEntry-0BIB9sen.d.ts → cvcEntry-Asg7mxjB.d.ts} +12 -9
- package/dist/{index-CDoqrfc1.d.ts → index-ClTjjJ_S.d.ts} +1 -1
- package/dist/{index-Zu_mOJRn.d.cts → index-Pt82NxQg.d.cts} +1 -1
- package/dist/index.cjs +604 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +7 -5
- package/dist/index.d.ts +7 -5
- package/dist/index.js +577 -15
- package/dist/index.js.map +1 -1
- package/dist/information-scope/index.d.cts +3 -350
- package/dist/information-scope/index.d.ts +3 -350
- package/dist/informationScopeResolver-BzYu97DE.d.cts +351 -0
- package/dist/informationScopeResolver-BzYu97DE.d.ts +351 -0
- package/dist/models/index.cjs +26 -1
- package/dist/models/index.cjs.map +1 -1
- package/dist/models/index.d.cts +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/models/index.js +26 -1
- package/dist/models/index.js.map +1 -1
- package/dist/{platform-auth-B49Ly57B.d.cts → platform-auth-DJO-r9Pf.d.cts} +48 -1
- package/dist/{platform-auth-B49Ly57B.d.ts → platform-auth-DJO-r9Pf.d.ts} +48 -1
- package/dist/schemas/index.cjs +26 -1
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +25 -25
- package/dist/schemas/index.d.ts +25 -25
- package/dist/schemas/index.js +26 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/services/index.cjs +26 -1
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +2 -1
- package/dist/services/index.d.ts +2 -1
- package/dist/services/index.js +26 -1
- package/dist/services/index.js.map +1 -1
- package/dist/sharing-ceiling/index.cjs +497 -0
- package/dist/sharing-ceiling/index.cjs.map +1 -0
- package/dist/sharing-ceiling/index.d.cts +318 -0
- package/dist/sharing-ceiling/index.d.ts +318 -0
- package/dist/sharing-ceiling/index.js +451 -0
- package/dist/sharing-ceiling/index.js.map +1 -0
- package/dist/types/index.d.cts +11 -3
- package/dist/types/index.d.ts +11 -3
- package/dist/validation/index.cjs +22 -0
- package/dist/validation/index.cjs.map +1 -1
- package/dist/validation/index.js +22 -0
- package/dist/validation/index.js.map +1 -1
- package/package.json +7 -1
- package/src/__sot__/README.md +2 -1
- package/src/__sot__/coreFunctionFields.ts +88 -4
- package/src/__sot__/coreFunctions.pin.json +1040 -113
- package/src/__sot__/sharingStarter.pin.json +229 -0
- package/src/__tests__/authz-resolve.test.ts +115 -31
- package/src/__tests__/core-function-default-bounds.test.ts +374 -0
- package/src/__tests__/core-functions-case-close.test.ts +82 -0
- package/src/__tests__/sharing-starter-canon.test.ts +178 -0
- package/src/authz/defaultBounds.ts +69 -0
- package/src/authz/index.ts +12 -3
- package/src/authz/resolveEffectiveFunctions.ts +69 -29
- package/src/constants/platform-auth.ts +60 -0
- package/src/generated/coreFunctionDefaultBounds.ts +109 -0
- package/src/generated/sharingPlatformStarter.ts +165 -0
- package/src/index.ts +5 -0
- package/src/schemas/platform-role.ts +4 -1
- package/src/sharingCeiling/__tests__/sharingCeiling.test.ts +678 -0
- package/src/sharingCeiling/chain.ts +269 -0
- package/src/sharingCeiling/coverage.ts +346 -0
- package/src/sharingCeiling/index.ts +14 -0
- package/src/sharingCeiling/starter.ts +89 -0
- package/src/types/platform-auth.ts +9 -2
|
@@ -1,352 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* The ONE implementation of how a stored information-scope selection reads
|
|
5
|
-
* against the v4 tree, so Thread and PAVE (preview and send, picker and door)
|
|
6
|
-
* cannot disagree. Pure and dependency-free: no imports, no I/O, never
|
|
7
|
-
* mutates its inputs. Browser-safe entry: `@htilabs/platform-common-models/information-scope`.
|
|
8
|
-
*
|
|
9
|
-
* Spec (canon, read-only): htilabstech/prototype
|
|
10
|
-
* docs/share-roi/INFOSCOPE_V4_DEV_HANDOFF_2026-10-09.md
|
|
11
|
-
* @ 7ca7e586ae487c608da657d426598a65d5b06111 (merge of the SIGNED-GRAIN
|
|
12
|
-
* content commit e86dd89cdba5cbb39ccfc7fb35aff8cbf0774790, which amends
|
|
13
|
-
* § 3 only and re-labels the migrations CSV; § 2, § 7, § 8 and the rows CSV
|
|
14
|
-
* are unchanged from 6dab8a95 / 00179edc)
|
|
15
|
-
* - § 2 rules 1–7 ("the resolver contract — build exactly this, nothing
|
|
16
|
-
* cleverer") — every behaviour below cites its rule;
|
|
17
|
-
* - § 3 the migration rules (identity · row · category · subtract ·
|
|
18
|
-
* retired before v4) and `scopeVersion`; a signed release keeps its list
|
|
19
|
-
* as signed and its current reading is DERIVED at read time; a retired
|
|
20
|
-
* code "stays recognisable in stored data forever";
|
|
21
|
-
* - § 7 row 6 a branch-grain pick is expanded to the ceiling's grain
|
|
22
|
-
* before clamping; a sender can never widen;
|
|
23
|
-
* - § 8 the enums.
|
|
24
|
-
* Release grain (Crysta, 2026-10-09; SOT v2.1.0 `migrations.ruling`, quoted
|
|
25
|
-
* verbatim there): "a SIGNED RELEASE keeps the grain it was signed at ...
|
|
26
|
-
* Policies and presets (agency-authored, not consent) take the merged
|
|
27
|
-
* successor with a dated version row." Canon carries it since SIGNED-GRAIN
|
|
28
|
-
* (prototype e86dd89c: `signed_release_grain: keep` on the nine `rows` merge
|
|
29
|
-
* folds; handoff § 3 amended). So `readSelection` takes WHOSE list it is
|
|
30
|
-
* (`subject`): a release or a share (frozen at send, § 3) naming a code on a
|
|
31
|
-
* `releaseReading: "retain"` line at scopeVersion 3 is NOT mapped — the code
|
|
32
|
-
* comes back under `retained` with its v3 field membership, for the builder
|
|
33
|
-
* to deliver read-only; a policy takes the successor (`widened`) and the
|
|
34
|
-
* reading says a dated version row is due. The widening identity line canon
|
|
35
|
-
* leaves unmarked (`immigration_status`, `releaseReading: "successor"`) reads
|
|
36
|
-
* as itself for every subject.
|
|
37
|
-
* Reference implementation of rule-1 kind-row resolution:
|
|
38
|
-
* tools/infoscope/phase4_stress_test.py `resolve_home` (same SHA).
|
|
39
|
-
*
|
|
40
|
-
* WHAT A SELECTION STORES. `information_scope: string[]` holds canon's scope
|
|
41
|
-
* codes as canon spells them — `names`, `identifying.other`,
|
|
42
|
-
* `offenders.risk` (handoff § 8: "lowercase snake, or `<kind>.<row>`") —
|
|
43
|
-
* NOT the package's SOT keys (`offenders__risk`) and NOT seven-segment wire
|
|
44
|
-
* codes (`236-016-001-002-…`). `ScopeRow.scopeCode` / `parentScopeCode` are
|
|
45
|
-
* in that space; `scopeRowsFromSot` maps the SOT into it.
|
|
46
|
-
*
|
|
47
|
-
* ALWAYS COVERED. `system_info` and its ancestor `system` ("System metadata —
|
|
48
|
-
* always included, never a choice", handoff § 1; the field placements home
|
|
49
|
-
* the system fields on `system`) are covered by every selection.
|
|
50
|
-
*
|
|
51
|
-
* Two kinds of call:
|
|
52
|
-
* - READS (`isCovered`, `isIncludedOnShare`, `shareVerdict`,
|
|
53
|
-
* `isVisibleAtLevel`, `readSelection`, `readRestriction`,
|
|
54
|
-
* `expandBranchPickToGrain`, `clampToCeiling`) are total: they never
|
|
55
|
-
* throw on stored data. An unknown code, a null list or an unsupported
|
|
56
|
-
* `scopeVersion` (absent, 2, or anything but 3 / 4) includes nothing
|
|
57
|
-
* (fail closed). `readSelection`'s `subject` is the caller's, not stored
|
|
58
|
-
* data: a missing or unknown one throws (no silent default).
|
|
59
|
-
* - PICKER WRITES (`selectAll`, `deselectChild`, `expandSelectAll`), the
|
|
60
|
-
* build-time `rowForSubject`, and the constructor throw on programming
|
|
61
|
-
* errors (an unknown or non-selectable code, a malformed tree).
|
|
62
|
-
*/
|
|
63
|
-
/** The tree version this resolver reads to (handoff § 3: "today 3, after this round 4"). */
|
|
64
|
-
declare const INFORMATION_SCOPE_VERSION: 4;
|
|
65
|
-
/**
|
|
66
|
-
* The `scopeVersion` stamps a stored list may carry and still be read: 3
|
|
67
|
-
* (through the v3 → v4 table) and 4. A 2 list, and an UNSTAMPED list (which
|
|
68
|
-
* is v2-era), must go through canon's conjunctive v2 → v3 table first (SOT
|
|
69
|
-
* v2.1.0 `migrations.readAt` / `migrations.unstamped`: the `retired before
|
|
70
|
-
* v4` lines name "the flattened v3 reading, not an unconditional one"); this
|
|
71
|
-
* package ships no v2 → v3 table, so those lists are unsupported and include
|
|
72
|
-
* nothing (fail closed). None was ever persisted (`migrations.unstamped`).
|
|
73
|
-
*/
|
|
74
|
-
declare const INFORMATION_SCOPE_READABLE_VERSIONS: readonly number[];
|
|
75
|
-
/** Required on every stored selection and always included (handoff § 2 rule 1; § 6). */
|
|
76
|
-
declare const INFORMATION_SCOPE_SYSTEM_INFO: "system_info";
|
|
77
|
-
/** A kind of other named person (handoff § 1; § 8 `kind_branch`). */
|
|
78
|
-
type ScopePersonKind = "offenders" | "family" | "others";
|
|
79
|
-
/** Whose record a record is: the client, or another named person's kind (rule 1). */
|
|
80
|
-
type ScopeSubjectKind = "client" | ScopePersonKind;
|
|
81
|
-
/** `kind_branch` (§ 8); `null` on System and Notes rows (blank in the CSV). */
|
|
82
|
-
type ScopeKindBranch = ScopeSubjectKind | "leads" | null;
|
|
83
|
-
/**
|
|
84
|
-
* `row_type` (§ 8). The tree also carries `branch` (`primary_client`,
|
|
85
|
-
* `other_named_persons`) and the LEADS spelling `sub-category`, which § 8's
|
|
86
|
-
* list omits; both are accepted as written.
|
|
87
|
-
*/
|
|
88
|
-
type ScopeRowType = "branch" | "category" | "subcategory" | "sub-category" | "person_type" | "category_rest" | "instrument row";
|
|
89
|
-
/** `status` (§ 8). */
|
|
90
|
-
type ScopeRowStatus = "as_today" | "new" | "retired";
|
|
91
|
-
/** `special_data_type` (§ 8, plus `evidence`, which the tree carries on `case_attachments`). */
|
|
92
|
-
type ScopeSpecialDataType = "none" | "survivor_confidential" | "criminal_intelligence" | "evidence";
|
|
93
|
-
/** The three app-relevance columns (§ 4). */
|
|
94
|
-
type ScopeApp = "pave" | "thread" | "leads";
|
|
95
|
-
type ScopeApps = Readonly<Record<ScopeApp, boolean>>;
|
|
96
|
-
/**
|
|
97
|
-
* One tree row, in the selection-code space (see header). Bind the SOT with
|
|
98
|
-
* `scopeRowsFromSot`. Extra fields on a caller's row type are carried through
|
|
99
|
-
* (`row(code)` returns the caller's row).
|
|
100
|
-
*/
|
|
101
|
-
interface ScopeRow {
|
|
102
|
-
/** The code a selection stores (canon's spelling: `offenders.risk`). */
|
|
103
|
-
scopeCode: string;
|
|
104
|
-
parentScopeCode: string | null;
|
|
105
|
-
rowType: ScopeRowType;
|
|
106
|
-
kindBranch: ScopeKindBranch;
|
|
107
|
-
/** On a per-kind row (`offenders.risk`): the client row it copies (`risk`). Required there. */
|
|
108
|
-
kindRow?: string;
|
|
109
|
-
/** App relevance (§ 4). Informational: no resolver decision reads it. */
|
|
110
|
-
apps: ScopeApps;
|
|
111
|
-
selectable: boolean;
|
|
112
|
-
/** `shareable_default = on` (rule 4: `false` = off by default). */
|
|
113
|
-
shareableDefault: boolean;
|
|
114
|
-
platformFloor: boolean;
|
|
115
|
-
levelFloor: 1 | 3;
|
|
116
|
-
specialDataType: ScopeSpecialDataType;
|
|
117
|
-
/** A `retired` row is never covered, offered or written. */
|
|
118
|
-
status: ScopeRowStatus;
|
|
119
|
-
replacesV3?: readonly string[];
|
|
120
|
-
}
|
|
121
|
-
/** The four migration rules of handoff § 3, plus the pre-v4 retirement reading. */
|
|
122
|
-
type ScopeMigrationRule = "identity" | "row" | "category" | "subtract" | "retired before v4";
|
|
123
|
-
/** One from-to line (selection-code space); `to` is empty for "(nothing)". */
|
|
124
|
-
interface ScopeMigration {
|
|
125
|
-
from: string;
|
|
126
|
-
to: readonly string[];
|
|
127
|
-
rule: ScopeMigrationRule;
|
|
128
|
-
note?: string;
|
|
129
|
-
/** The line reads WIDER than v3 did (SOT `widens: true`). A policy takes it; see `releaseReading`. */
|
|
130
|
-
widens?: boolean;
|
|
131
|
-
/**
|
|
132
|
-
* On every `widens` line (SOT; ruling 2026-10-09, canon SIGNED-GRAIN).
|
|
133
|
-
* `retain` — canon's nine merge folds (`signed_release_grain: keep`): a
|
|
134
|
-
* release or share at scopeVersion 3 keeps the code at its v3 grain instead
|
|
135
|
-
* of reading `to`; requires exactly one `to` and `v3Fields` / `v3Domains`.
|
|
136
|
-
* `successor` — a widening identity line canon leaves unmarked
|
|
137
|
-
* (`immigration_status`): every subject reads `to` (`releaseReadingNote`).
|
|
138
|
-
* Absent: `to` is every subject's reading.
|
|
139
|
-
*/
|
|
140
|
-
releaseReading?: "retain" | "successor";
|
|
141
|
-
/** Why a widening line is read as its successor by a release too. */
|
|
142
|
-
releaseReadingNote?: string;
|
|
143
|
-
/** `successor` (SOT, on every `widens` line): a policy or preset reads `to`. */
|
|
144
|
-
policyReading?: "successor";
|
|
145
|
-
/** A `retired before v4` line (ruling 2): a stated reading only a v2-era list can need. */
|
|
146
|
-
informational?: boolean;
|
|
147
|
-
/**
|
|
148
|
-
* On a `retain` line: the fields whose v3 home was the `from` unit (canon
|
|
149
|
-
* field placements `home_unit_today`) — what a retained release delivers,
|
|
150
|
-
* read-only. Field ids (`capture.hiv_status`), not scope codes. Empty = the
|
|
151
|
-
* unit homed no field, so a release retaining it delivers nothing.
|
|
152
|
-
*/
|
|
153
|
-
v3Fields?: readonly string[];
|
|
154
|
-
/**
|
|
155
|
-
* On a `retain` line: the distinct `assertion_domain` of `v3Fields`. CATEGORY
|
|
156
|
-
* grain in v3 (`access_accommodations`, `immigration_legal_status` each span
|
|
157
|
-
* every unit of their category): the field family, NOT the unit's membership.
|
|
158
|
-
* Deliver by `v3Fields`.
|
|
159
|
-
*/
|
|
160
|
-
v3Domains?: readonly string[];
|
|
161
|
-
/** On a `retain` line: why the membership is what it is (an empty unit; a derivation under veto). */
|
|
162
|
-
v3FieldsNote?: string;
|
|
163
|
-
}
|
|
164
|
-
/** How one stored code was read. `unknown` = no row, no table line: it includes nothing. */
|
|
165
|
-
type ScopeReadingRule = ScopeMigrationRule | "unknown";
|
|
166
|
-
interface ScopeCodeReading {
|
|
167
|
-
readonly from: string;
|
|
168
|
-
readonly rule: ScopeReadingRule;
|
|
169
|
-
/** The v4 codes it reads as; empty for a retained code (see `ScopeReading.retained`). */
|
|
170
|
-
readonly reads: readonly string[];
|
|
171
|
-
/** It read through a line flagged as wider than v3 (never true for a retained code). */
|
|
172
|
-
readonly widens: boolean;
|
|
173
|
-
/** A release or share kept it at its v3 grain (`releaseReading: "retain"`). */
|
|
174
|
-
readonly retained: boolean;
|
|
175
|
-
}
|
|
176
|
-
/**
|
|
177
|
-
* Whose stored list is being read (handoff § 3; ruling 2026-10-09):
|
|
178
|
-
* - `release` — a signed ROI / release;
|
|
179
|
-
* - `share` — a share, which freezes the list it was sent with AND the
|
|
180
|
-
* `scopeVersion` of the release it was composed under (handoff § 3: "A
|
|
181
|
-
* share freezes the list it was sent with ... and its version"), so it
|
|
182
|
-
* reads like a release: a share frozen under a v3 release is a stamp-3
|
|
183
|
-
* list and retains;
|
|
184
|
-
* - `policy` — everything agency-authored: a policy, a PRESET or a PARTNER
|
|
185
|
-
* RULE (canon SIGNED-GRAIN: "policies / presets / partner rules take the
|
|
186
|
-
* successor whole"), migrated with a dated version row.
|
|
187
|
-
*/
|
|
188
|
-
type ScopeReadingSubject = "release" | "share" | "policy";
|
|
189
|
-
interface ScopeReadOptions {
|
|
190
|
-
subject: ScopeReadingSubject;
|
|
191
|
-
}
|
|
192
|
-
/**
|
|
193
|
-
* A stored code a release or share keeps at the grain it was signed at
|
|
194
|
-
* (ruling 2026-10-09): not mapped to `successor`, not in `informationScope`.
|
|
195
|
-
* The builder delivers exactly `v3Fields`, read-only — never offered, never
|
|
196
|
-
* widened, never narrowed — until the survivor re-signs on v4.
|
|
197
|
-
*
|
|
198
|
-
* Only a STAMP-3 list retains. A v4-stamped release or share can only hold
|
|
199
|
-
* live v4 codes (the picker never offers a tombstone); if one nonetheless
|
|
200
|
-
* names a code on a `retain` line, that code is recognised as retired and
|
|
201
|
-
* includes NOTHING (fail closed) — never its successor, and not retained.
|
|
202
|
-
*/
|
|
203
|
-
interface ScopeRetainedReading {
|
|
204
|
-
readonly code: string;
|
|
205
|
-
/** The fields the code delivered in v3 (field ids). Empty: it delivers nothing (`note`). */
|
|
206
|
-
readonly v3Fields: readonly string[];
|
|
207
|
-
/** Their assertion domains — CATEGORY grain in v3, the field family; deliver by `v3Fields`. */
|
|
208
|
-
readonly v3Domains: readonly string[];
|
|
209
|
-
/** What a policy reads it as, and what a v4 re-signature would name. */
|
|
210
|
-
readonly successor: string;
|
|
211
|
-
/** Present when the membership needs explaining (an empty unit; a derivation under veto). */
|
|
212
|
-
readonly note?: string;
|
|
213
|
-
}
|
|
214
|
-
/**
|
|
215
|
-
* The current (v4) reading of a stored list. `stored` and `storedVersion` are
|
|
216
|
-
* the list as signed, copied, never rewritten (§ 3: "a signed release keeps
|
|
217
|
-
* its list as signed, at the version signed; its current reading is derived
|
|
218
|
-
* through the table at read time").
|
|
219
|
-
*/
|
|
220
|
-
interface ScopeReading {
|
|
221
|
-
/** The stamp as stored; `null` when it was absent or not a number. */
|
|
222
|
-
readonly storedVersion: number | null;
|
|
223
|
-
readonly stored: readonly string[];
|
|
224
|
-
readonly version: typeof INFORMATION_SCOPE_VERSION;
|
|
225
|
-
/** The stamp is not in `INFORMATION_SCOPE_READABLE_VERSIONS`: every code reads `unknown`. */
|
|
226
|
-
readonly unsupportedVersion: boolean;
|
|
227
|
-
/**
|
|
228
|
-
* The derived v4 list: unique, in tree order. A selection reading always
|
|
229
|
-
* contains `system_info`; a restriction reading contains only what it restricts.
|
|
230
|
-
*/
|
|
231
|
-
readonly informationScope: readonly string[];
|
|
232
|
-
/** One entry per distinct stored code, in stored order. */
|
|
233
|
-
readonly codes: readonly ScopeCodeReading[];
|
|
234
|
-
/** Stored codes that are retired (read by `row`, `subtract` or `retired before v4`). */
|
|
235
|
-
readonly retired: readonly string[];
|
|
236
|
-
/** Stored codes with no live row and no table line; they include nothing. */
|
|
237
|
-
readonly unknown: readonly string[];
|
|
238
|
-
/** Stored codes whose reading is wider than v3's (`widens`): surface, never hide. */
|
|
239
|
-
readonly widened: readonly string[];
|
|
240
|
-
/** `readSelection`'s subject; `null` on a restriction reading. */
|
|
241
|
-
readonly subject: ScopeReadingSubject | null;
|
|
242
|
-
/** Release / share codes kept at v3 grain, in stored order (always empty for a policy). */
|
|
243
|
-
readonly retained: readonly ScopeRetainedReading[];
|
|
244
|
-
/**
|
|
245
|
-
* A policy read across versions (stamp 3) — `readSelection` with subject
|
|
246
|
-
* `policy`, and every `readRestriction` (a restriction is a policy's):
|
|
247
|
-
* handoff § 3 — "a policy is migrated with a new version row on the record,
|
|
248
|
-
* dated" — so the app writes that dated row before acting on
|
|
249
|
-
* `informationScope`. `false` otherwise.
|
|
250
|
-
*/
|
|
251
|
-
readonly versionRowRequired: boolean;
|
|
252
|
-
/** Says why, when `versionRowRequired`; otherwise `null`. */
|
|
253
|
-
readonly note: string | null;
|
|
254
|
-
}
|
|
255
|
-
type ScopeShareVerdict = {
|
|
256
|
-
readonly included: true;
|
|
257
|
-
readonly reason: "included";
|
|
258
|
-
} | {
|
|
259
|
-
readonly included: false;
|
|
260
|
-
readonly reason: "not_covered" | "platform_floor" | "unknown_code";
|
|
261
|
-
} | {
|
|
262
|
-
readonly included: false;
|
|
263
|
-
readonly reason: "off_by_default";
|
|
264
|
-
/** The off-by-default rows in the chain the account has not enabled. */
|
|
265
|
-
readonly notEnabled: readonly string[];
|
|
266
|
-
};
|
|
267
|
-
type ScopeShareReason = ScopeShareVerdict["reason"];
|
|
268
|
-
interface ScopeShareOptions {
|
|
269
|
-
/** The off-by-default rows the account's policy has enabled for sharing (rule 4). */
|
|
270
|
-
enabledOffByDefault?: ReadonlySet<string> | readonly string[];
|
|
271
|
-
}
|
|
272
|
-
interface CreateInformationScopeResolverInput<R extends ScopeRow> {
|
|
273
|
-
rows: readonly R[];
|
|
274
|
-
migrations?: readonly ScopeMigration[];
|
|
275
|
-
}
|
|
276
|
-
/** A stored list as it may arrive from storage (reads are total). */
|
|
277
|
-
type StoredScopeList = readonly string[] | null | undefined;
|
|
278
|
-
interface InformationScopeResolver<R extends ScopeRow = ScopeRow> {
|
|
279
|
-
readonly version: typeof INFORMATION_SCOPE_VERSION;
|
|
280
|
-
/** Every row in input order. */
|
|
281
|
-
readonly rows: readonly R[];
|
|
282
|
-
row(code: string): R | undefined;
|
|
283
|
-
/** The live (non-retired) children of `code`, in input order (a copy). */
|
|
284
|
-
childrenOf(code: string): string[];
|
|
285
|
-
/** `code` first, then its parent, up to the root (a copy). Empty for an unknown code. */
|
|
286
|
-
ancestorsOf(code: string): string[];
|
|
287
|
-
/** Rules 2 + 3. */
|
|
288
|
-
isCovered(selection: StoredScopeList, code: string): boolean;
|
|
289
|
-
/** Rules 2–5. */
|
|
290
|
-
isIncludedOnShare(selection: StoredScopeList, code: string, options?: ScopeShareOptions): boolean;
|
|
291
|
-
/** `isIncludedOnShare` with the reason, for "held back and counted". */
|
|
292
|
-
shareVerdict(selection: StoredScopeList, code: string, options?: ScopeShareOptions): ScopeShareVerdict;
|
|
293
|
-
/** Rule 7 (the viewing side). */
|
|
294
|
-
isVisibleAtLevel(level: number, code: string): boolean;
|
|
295
|
-
/** Rules 3 + 6: the codes a picker writes when it expands `code` (its live children, rest row included). */
|
|
296
|
-
expandSelectAll(code: string): string[];
|
|
297
|
-
/** Rule 6: select-all at `code` (the code itself is stored; its now-redundant descendants drop). */
|
|
298
|
-
selectAll(selection: readonly string[], code: string): string[];
|
|
299
|
-
/** Rules 3 + 6: de-select one child; every selected ancestor is replaced by its other children. */
|
|
300
|
-
deselectChild(selection: readonly string[], childCode: string): string[];
|
|
301
|
-
/**
|
|
302
|
-
* § 3: the current v4 reading of a stored selection, for its `subject`
|
|
303
|
-
* (required; throws when missing or unknown). A release or share keeps a
|
|
304
|
-
* `retain` code at its v3 grain (`retained`); a policy reads the successor.
|
|
305
|
-
*/
|
|
306
|
-
readSelection(list: StoredScopeList, scopeVersion: number | null | undefined, options: ScopeReadOptions): ScopeReading;
|
|
307
|
-
/**
|
|
308
|
-
* § 3 `subtract`: the current v4 reading of a stored RESTRICTION. A
|
|
309
|
-
* restriction is a policy's, so a stamp-3 one sets `versionRowRequired`.
|
|
310
|
-
*/
|
|
311
|
-
readRestriction(list: StoredScopeList, scopeVersion: number | null | undefined): ScopeReading;
|
|
312
|
-
/** Rule 1: the row a record is included under, given its field's home row and its subject. */
|
|
313
|
-
rowForSubject(homeRow: string, kind: ScopeSubjectKind): string;
|
|
314
|
-
/** § 7 row 6: expand every pick that sits above the ceiling's grain into its children. */
|
|
315
|
-
expandBranchPickToGrain(selection: StoredScopeList, ceiling: StoredScopeList): string[];
|
|
316
|
-
/** § 7 row 6: expand, then keep only what the ceiling covers. A sender can never widen. */
|
|
317
|
-
clampToCeiling(selection: StoredScopeList, ceiling: StoredScopeList): string[];
|
|
318
|
-
}
|
|
319
|
-
/** A row a picker offers as a choice (§ 8 `selectable`; never a retired row). */
|
|
320
|
-
declare const isSelectableScopeRow: (row: ScopeRow | undefined) => boolean;
|
|
321
|
-
/** The `category_rest` row (rule 3): never offered, covered with its category. */
|
|
322
|
-
declare const isScopeRestRow: (row: ScopeRow | undefined) => boolean;
|
|
323
|
-
/** One of the 28 `summary_<x>` / `full_<x>` rows (§ 8 `instrument row`). */
|
|
324
|
-
declare const isScopeInstrumentRow: (row: ScopeRow | undefined) => boolean;
|
|
325
|
-
/**
|
|
326
|
-
* Which kind of other named person someone is (handoff § 2 rule 1; § 8; Phase
|
|
327
|
-
* 3 D5): "This person caused harm" wins; "Eligible family member" (asserted
|
|
328
|
-
* by the advocate, never derived from the relationship) otherwise; neither →
|
|
329
|
-
* `others`. A person with both switches is listed under `offenders`; the
|
|
330
|
-
* caller keeps the family-member VAWA handling, which rides `efmAsserted` on
|
|
331
|
-
* the person, not the kind.
|
|
332
|
-
*/
|
|
333
|
-
declare function kindForPerson(person: {
|
|
334
|
-
causedHarm: boolean;
|
|
335
|
-
efmAsserted: boolean;
|
|
336
|
-
}): ScopePersonKind;
|
|
337
|
-
/** The `note` on a policy reading across versions (handoff § 3). */
|
|
338
|
-
declare const INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE: string;
|
|
339
|
-
/**
|
|
340
|
-
* Bind the resolver to one tree (and its migration table). Throws on a
|
|
341
|
-
* malformed tree: a duplicate code, a parent that is not a row, a cycle, no
|
|
342
|
-
* `system_info` row, a live row whose `specialDataType` is missing or not in
|
|
343
|
-
* § 8 (rule 1 routes on it — absence fails closed by refusing to bind), a
|
|
344
|
-
* per-kind row without a `kindRow` that names a row, an unknown migration
|
|
345
|
-
* rule, a migration successor that is not a live row, two different
|
|
346
|
-
* readings for the same code and rule, or a `releaseReading: "retain"` line
|
|
347
|
-
* without exactly one successor and its `v3Fields` / `v3Domains`.
|
|
348
|
-
*/
|
|
349
|
-
declare function createInformationScopeResolver<R extends ScopeRow>(input: CreateInformationScopeResolverInput<R>): InformationScopeResolver<R>;
|
|
1
|
+
import { h as ScopeMigration, p as ScopeRow } from '../informationScopeResolver-BzYu97DE.cjs';
|
|
2
|
+
export { C as CreateInformationScopeResolverInput, I as INFORMATION_SCOPE_POLICY_VERSION_ROW_NOTE, a as INFORMATION_SCOPE_READABLE_VERSIONS, b as INFORMATION_SCOPE_SYSTEM_INFO, c as INFORMATION_SCOPE_VERSION, d as InformationScopeResolver, S as ScopeApp, e as ScopeApps, f as ScopeCodeReading, g as ScopeKindBranch, i as ScopeMigrationRule, j as ScopePersonKind, k as ScopeReadOptions, l as ScopeReading, m as ScopeReadingRule, n as ScopeReadingSubject, o as ScopeRetainedReading, q as ScopeRowStatus, r as ScopeRowType, s as ScopeShareOptions, t as ScopeShareReason, u as ScopeShareVerdict, v as ScopeSpecialDataType, w as ScopeSubjectKind, x as StoredScopeList, y as createInformationScopeResolver, z as isScopeInstrumentRow, A as isScopeRestRow, B as isSelectableScopeRow, D as kindForPerson } from '../informationScopeResolver-BzYu97DE.cjs';
|
|
350
3
|
|
|
351
4
|
/**
|
|
352
5
|
* @htilabs/platform-common-models — CVC-236 SOT → information-scope resolver binding
|
|
@@ -439,4 +92,4 @@ declare function scopeRowsFromSot(sot: CoreInformationScopeSot): ScopeRow[];
|
|
|
439
92
|
/** The v3 → v4 from-to table of a CVC-236 SOT (`migrations.table`), in selection codes. */
|
|
440
93
|
declare function scopeMigrationsFromSot(sot: CoreInformationScopeSot): ScopeMigration[];
|
|
441
94
|
|
|
442
|
-
export { type CoreInformationScopeSot, type CoreInformationScopeSotEntry, type CoreInformationScopeSotMigrationLine,
|
|
95
|
+
export { type CoreInformationScopeSot, type CoreInformationScopeSotEntry, type CoreInformationScopeSotMigrationLine, ScopeMigration, ScopeRow, scopeMigrationsFromSot, scopeRowsFromSot };
|