@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
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
import { d as InformationScopeResolver } from '../informationScopeResolver-BzYu97DE.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* The platform sharing starter — what governs a share before an account has
|
|
5
|
+
* authored anything (co-2sx).
|
|
6
|
+
*
|
|
7
|
+
* The data is GENERATED from canon (`scripts/gen-sharing-starter.py` →
|
|
8
|
+
* `src/generated/sharingPlatformStarter.ts`) and held equal to canon by GATE M
|
|
9
|
+
* (`src/__tests__/sharing-starter-canon.test.ts`, against
|
|
10
|
+
* `src/__sot__/sharingStarter.pin.json`). This module types it and freezes it.
|
|
11
|
+
*
|
|
12
|
+
* Canon: prototype `HTI-LEADS-PAVE-Thread-prototype.html` @ d85f05b7
|
|
13
|
+
* `HTI_SHARE_PLATFORM_STARTER` L326475-L326543 (scopeVersion ·
|
|
14
|
+
* scopeByPurpose · counterpartyOverrides); platform-prototype `src/data.js`
|
|
15
|
+
* @ a6f1f3a `data.sharing.scopeByPurpose` / `counterpartyOverrides`
|
|
16
|
+
* L38170-L38190 (the contract of record, GDR § 5.79) and the platform
|
|
17
|
+
* purpose rows `sharing.purposes[].enabled` L32450-L32531 (`records_request`
|
|
18
|
+
* ships `enabled: false`, L32527); prototype
|
|
19
|
+
* `docs/share-roi/information_scope_v4.fields.csv` @ d85f05b7 (where each
|
|
20
|
+
* field is homed, `row_v4`).
|
|
21
|
+
*/
|
|
22
|
+
/** The tree version every starter list and every stored ceiling list is stamped with. */
|
|
23
|
+
declare const SHARING_CEILING_SCOPE_VERSION: 4;
|
|
24
|
+
/** purpose code (CVC-84 key) → v4 information-scope row codes. */
|
|
25
|
+
type SharingPurposeLists = Readonly<Record<string, readonly string[]>>;
|
|
26
|
+
interface SharingPlatformStarter {
|
|
27
|
+
readonly scopeVersion: typeof SHARING_CEILING_SCOPE_VERSION;
|
|
28
|
+
/** The platform per-purpose default — canon's last rung. A purpose with no row has no platform ceiling. */
|
|
29
|
+
readonly scopeByPurpose: SharingPurposeLists;
|
|
30
|
+
/** Platform-seeded partner rules: partner id → purpose → v4 row codes. */
|
|
31
|
+
readonly counterpartyOverrides: Readonly<Record<string, SharingPurposeLists>>;
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* The platform's own sharing rules (canon's `HTI_SHARE_PLATFORM_STARTER`,
|
|
35
|
+
* minus the demo-agency relationship / policy seeds). Deep-frozen.
|
|
36
|
+
*
|
|
37
|
+
* CANON GAP: `counterpartyOverrides` is keyed by canon's DEMONSTRATION partner
|
|
38
|
+
* ids (`palomar`, `okcpd`, `legal_aid_ok`). No registry agency carries them,
|
|
39
|
+
* so the seeded-partner rung binds on no real data until the platform maps
|
|
40
|
+
* them. They ship as canon has them.
|
|
41
|
+
*/
|
|
42
|
+
declare const HTI_SHARE_PLATFORM_STARTER: SharingPlatformStarter;
|
|
43
|
+
/**
|
|
44
|
+
* The platform purpose rows' `enabled` flag (data.js `sharing.purposes`). The
|
|
45
|
+
* contract of record disables a purpose whose platform row is `enabled:
|
|
46
|
+
* false` unless the account overrides it `true` (data.js clamp 1,
|
|
47
|
+
* L51352-L51354). `records_request` ships disabled.
|
|
48
|
+
*/
|
|
49
|
+
declare const HTI_SHARE_PLATFORM_PURPOSE_ENABLED: Readonly<Record<string, boolean>>;
|
|
50
|
+
/**
|
|
51
|
+
* The v4 rows at least one field is HOMED on (canon's field placements,
|
|
52
|
+
* `information_scope_v4.fields.csv` `row_v4`). The ceiling coverage rule
|
|
53
|
+
* reads it: a row with fields homed directly on it and no rest row is within
|
|
54
|
+
* a ceiling only when it or an ancestor is listed.
|
|
55
|
+
*/
|
|
56
|
+
declare const INFORMATION_SCOPE_FIELD_HOME_ROWS: ReadonlySet<string>;
|
|
57
|
+
/** Where the starter data was taken from (canon repo, file, SHA, line ranges). */
|
|
58
|
+
declare const HTI_SHARE_PLATFORM_STARTER_SOURCE: {
|
|
59
|
+
readonly monolith: {
|
|
60
|
+
readonly repo: "htilabstech/prototype";
|
|
61
|
+
readonly file: "HTI-LEADS-PAVE-Thread-prototype.html";
|
|
62
|
+
readonly sha: "d85f05b7";
|
|
63
|
+
readonly lines: readonly [326475, 326543];
|
|
64
|
+
};
|
|
65
|
+
readonly mirror: {
|
|
66
|
+
readonly repo: "htilabstech/platform-prototype";
|
|
67
|
+
readonly file: "src/data.js";
|
|
68
|
+
readonly sha: "a6f1f3a5";
|
|
69
|
+
readonly starterLines: readonly [38170, 38190];
|
|
70
|
+
readonly purposeLines: readonly [32450, 32531];
|
|
71
|
+
};
|
|
72
|
+
readonly fieldPlacements: {
|
|
73
|
+
readonly repo: "htilabstech/prototype";
|
|
74
|
+
readonly file: "docs/share-roi/information_scope_v4.fields.csv";
|
|
75
|
+
readonly sha: "d85f05b7";
|
|
76
|
+
};
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
/**
|
|
80
|
+
* The Inter-Agency Sharing ceiling read chain (co-2sx): the account's stored
|
|
81
|
+
* ceiling CELLS folded into canon's `sharingScopeEdits`, and the ONE chain
|
|
82
|
+
* that turns them, the platform starter and the purpose switches into the
|
|
83
|
+
* list a share for one recipient × purpose may carry.
|
|
84
|
+
*
|
|
85
|
+
* Pure, total on stored data, no I/O. Throws only on a caller's programming
|
|
86
|
+
* error (a missing / reserved row key, a missing purpose).
|
|
87
|
+
*
|
|
88
|
+
* Canon — prototype `HTI-LEADS-PAVE-Thread-prototype.html` @ d85f05b7:
|
|
89
|
+
* - `shareEffectiveCeiling` L327966-L328090; the per-purpose rung
|
|
90
|
+
* L328040-L328082, the chain itself L328053-L328058:
|
|
91
|
+
*
|
|
92
|
+
* const rowKey = r.__external ? "__external__" : r.id;
|
|
93
|
+
* const per = edits[rowKey] && edits[rowKey][opts.purposeCode];
|
|
94
|
+
* const seeded = (starter.counterpartyOverrides[rowKey] || {})[opts.purposeCode];
|
|
95
|
+
* const def = edits.__default__ && edits.__default__[opts.purposeCode];
|
|
96
|
+
* const platformDefault = starter.scopeByPurpose[opts.purposeCode];
|
|
97
|
+
* const allowed = per || seeded || def || platformDefault || null;
|
|
98
|
+
*
|
|
99
|
+
* - the purpose switch L327999-L328005 (an explicit `false` only).
|
|
100
|
+
* Platform prototype `src/data.js` @ a6f1f3a — the contract of record
|
|
101
|
+
* (GDR § 5.79), `HTI_SHARE_POLICY_API.effectiveCeiling` L51324ff:
|
|
102
|
+
* - clamp 1 L51352-L51354: a purpose is off when the account switched it
|
|
103
|
+
* off, OR when its platform row is `enabled: false` and the account has
|
|
104
|
+
* not switched it on (`records_request`, L32527). This module follows the
|
|
105
|
+
* contract of record; the monolith reads only the explicit `false`.
|
|
106
|
+
* - clamp 5 L51516-L51525: the same chain as the monolith.
|
|
107
|
+
* - `EXTERNAL_RECIPIENT_KEY = "__external__"` L50434: an off-platform
|
|
108
|
+
* recipient resolves through the same chain under that key, so an
|
|
109
|
+
* un-authored off-platform purpose follows the account default, then the
|
|
110
|
+
* platform default (L50427-L50430).
|
|
111
|
+
*
|
|
112
|
+
* One JavaScript detail of canon's `||` chain is kept: an EMPTY authored
|
|
113
|
+
* list is truthy, so it BINDS (it lets nothing but System metadata leave).
|
|
114
|
+
*
|
|
115
|
+
* STRICTER THAN CANON (ruling, co-2sx review): a purpose with no rung at all
|
|
116
|
+
* fails CLOSED — `allowed: []`, rung `none` — where canon's `|| null` reads
|
|
117
|
+
* no ceiling (`if (allowed && …)`, L328059). Every one of the eight core
|
|
118
|
+
* CVC-84 purposes has a platform row, so `none` can only come from a caller
|
|
119
|
+
* error (a misspelled purpose, a LEADS-wing purpose on a core share, a
|
|
120
|
+
* replaced starter missing a row); an unknown purpose must never mean
|
|
121
|
+
* "anything may leave".
|
|
122
|
+
*/
|
|
123
|
+
|
|
124
|
+
/** The account default row key — canon `sharingScopeEdits.__default__` (L328056; data.js L51519). */
|
|
125
|
+
declare const SHARING_CEILING_DEFAULT_ROW_KEY: "__default__";
|
|
126
|
+
/** The off-platform / unspecified recipients row key (canon L328053; data.js `EXTERNAL_RECIPIENT_KEY`, L50434). */
|
|
127
|
+
declare const SHARING_CEILING_EXTERNAL_ROW_KEY: "__external__";
|
|
128
|
+
/** rowKey (partner id · `__default__` · `__external__`) → purpose → v4 row codes. */
|
|
129
|
+
type SharingScopeEdits = Readonly<Record<string, Readonly<Record<string, readonly string[]>>>>;
|
|
130
|
+
/** The fields of one stored ceiling cell this read looks at (cells keyed agencyId × rowKey × purpose). */
|
|
131
|
+
interface SharingCeilingCellLike {
|
|
132
|
+
readonly rowKey?: unknown;
|
|
133
|
+
readonly purpose?: unknown;
|
|
134
|
+
readonly scopeVersion?: unknown;
|
|
135
|
+
readonly informationScope?: unknown;
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* The list one PRESENT cell carries. A cell is a rule by being there: stamped
|
|
139
|
+
* 4 with an array of strings → that list (a copy); anything else (unstamped,
|
|
140
|
+
* a v3 stamp, a missing list, a non-array, a non-string entry) → `[]`, which
|
|
141
|
+
* binds and covers nothing. A malformed rule never widens a share by falling
|
|
142
|
+
* through to a broader rung.
|
|
143
|
+
*/
|
|
144
|
+
declare function sharingCeilingCellList(cell: SharingCeilingCellLike): string[];
|
|
145
|
+
/**
|
|
146
|
+
* Fold ONE sending account's ceiling cells into canon's `sharingScopeEdits`.
|
|
147
|
+
*
|
|
148
|
+
* - A cell is present or absent; there is no status. An ABSENT cell is no
|
|
149
|
+
* rule, and the chain falls through.
|
|
150
|
+
* - A present cell binds with {@link sharingCeilingCellList}: `[]` binds; an
|
|
151
|
+
* unstamped, v3-stamped or malformed list reads as `[]`.
|
|
152
|
+
* - A cell without a string `rowKey` and `purpose` cannot be attributed to a
|
|
153
|
+
* cell and is skipped (it is not a rule for any cell).
|
|
154
|
+
* - Two cells for the same (rowKey, purpose) — the store's key forbids it —
|
|
155
|
+
* keep the list when they agree as sets, else read `[]` (fail closed).
|
|
156
|
+
*
|
|
157
|
+
* The caller passes one account's cells; the fold does not filter by agency.
|
|
158
|
+
*/
|
|
159
|
+
declare function sharingScopeEditsFromCells(cells: Iterable<SharingCeilingCellLike | null | undefined> | null | undefined): SharingScopeEdits;
|
|
160
|
+
/** Which rung of the chain answered. */
|
|
161
|
+
type SharingCeilingRung = "purpose_disabled" | "partner_rule" | "seeded_partner_rule" | "account_default" | "platform_default" | "none";
|
|
162
|
+
interface EffectiveSharingCeiling {
|
|
163
|
+
/**
|
|
164
|
+
* The v4 row codes a share may carry (read with `scopeRowWithinCeiling`).
|
|
165
|
+
* `[]` when the purpose is disabled, and when no rung exists for the
|
|
166
|
+
* purpose (rung `none` — fails closed; see the module header).
|
|
167
|
+
*/
|
|
168
|
+
readonly allowed: string[];
|
|
169
|
+
readonly rung: SharingCeilingRung;
|
|
170
|
+
/** The purpose is switched off for the account (`allowed` is then `[]`). */
|
|
171
|
+
readonly disabled: boolean;
|
|
172
|
+
}
|
|
173
|
+
interface EffectiveSharingCeilingInputs {
|
|
174
|
+
/** The sending account's authored lists ({@link sharingScopeEditsFromCells}). */
|
|
175
|
+
readonly edits: SharingScopeEdits | null | undefined;
|
|
176
|
+
/** Defaults to {@link HTI_SHARE_PLATFORM_STARTER}. */
|
|
177
|
+
readonly starter?: SharingPlatformStarter;
|
|
178
|
+
/** The account's Share Purposes switches: `false` disables, `true` re-enables a platform-disabled purpose. */
|
|
179
|
+
readonly purposeOverrides?: Readonly<Record<string, boolean | undefined>> | null;
|
|
180
|
+
/**
|
|
181
|
+
* Platform purpose `enabled` flags, merged OVER
|
|
182
|
+
* {@link HTI_SHARE_PLATFORM_PURPOSE_ENABLED} (a purpose the map does not
|
|
183
|
+
* name keeps the platform row). `null` / `undefined` = the platform rows.
|
|
184
|
+
*/
|
|
185
|
+
readonly purposeEnabled?: Readonly<Record<string, boolean | undefined>> | null;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Is `purpose` switched off? The contract of record (data.js clamp 1,
|
|
189
|
+
* L51352-L51354): the account's explicit `false`, or a platform row
|
|
190
|
+
* `enabled: false` the account has not overridden `true`. `purposeEnabled`
|
|
191
|
+
* is merged over the platform rows (a purpose it does not name, or names
|
|
192
|
+
* with a non-boolean, keeps the platform row); `null` = the platform rows.
|
|
193
|
+
*/
|
|
194
|
+
declare function isSharingPurposeDisabled(purpose: string, purposeOverrides?: Readonly<Record<string, boolean | undefined>> | null, purposeEnabled?: Readonly<Record<string, boolean | undefined>> | null): boolean;
|
|
195
|
+
/**
|
|
196
|
+
* The ceiling row key for one recipient: `__external__` for an off-platform
|
|
197
|
+
* recipient, else its partner id (canon L328053). Throws on a non-external
|
|
198
|
+
* recipient with no id, or whose id is a reserved row key.
|
|
199
|
+
*/
|
|
200
|
+
declare function sharingCeilingRowKey(recipient: {
|
|
201
|
+
readonly external?: boolean;
|
|
202
|
+
readonly id?: string | null;
|
|
203
|
+
}): string;
|
|
204
|
+
/**
|
|
205
|
+
* The ceiling for one recipient row and one purpose, by canon's chain:
|
|
206
|
+
*
|
|
207
|
+
* purpose disabled (clamp 1) → [] (purpose_disabled)
|
|
208
|
+
* edits[rowKey][purpose] (partner_rule)
|
|
209
|
+
* || starter.counterpartyOverrides[rowKey][purpose] (seeded_partner_rule)
|
|
210
|
+
* || edits.__default__[purpose] (account_default)
|
|
211
|
+
* || starter.scopeByPurpose[purpose] (platform_default)
|
|
212
|
+
* || [] (none — fails closed)
|
|
213
|
+
*
|
|
214
|
+
* `rowKey` is a partner id or `__external__` ({@link sharingCeilingRowKey});
|
|
215
|
+
* `__default__` is refused (it is the account default, not a recipient).
|
|
216
|
+
*/
|
|
217
|
+
declare function effectiveCeiling(rowKey: string, purpose: string, inputs: EffectiveSharingCeilingInputs): EffectiveSharingCeiling;
|
|
218
|
+
|
|
219
|
+
/**
|
|
220
|
+
* THE ceiling coverage rule (co-2sx): ONE answer to "does this ceiling list
|
|
221
|
+
* let this v4 row leave?", read the same way by the composer's mask
|
|
222
|
+
* ({@link rowsOutsideCeiling} / {@link rowsExpandedByCeiling} /
|
|
223
|
+
* {@link maskSelectionToCeiling}) and by the send door
|
|
224
|
+
* ({@link rowsOverCeiling}), so the list a composer masks to is the list a
|
|
225
|
+
* door accepts (pinned by a property test over every live row × generated
|
|
226
|
+
* ceilings).
|
|
227
|
+
*
|
|
228
|
+
* A row `code` is WITHIN a ceiling list when
|
|
229
|
+
* 1. it or an ANCESTOR is listed — canon's dumb read, `scopeListCovers`
|
|
230
|
+
* (prototype `HTI-LEADS-PAVE-Thread-prototype.html` @ d85f05b7
|
|
231
|
+
* L327953-L327964); or
|
|
232
|
+
* 2. it carries no content of its own (below), has at least one coverage
|
|
233
|
+
* child, and EVERY coverage child is within (recursively) — canon's door
|
|
234
|
+
* expands a branch / kind pick to the grain the ceiling is written at
|
|
235
|
+
* before clamping (`shareItemsWithinCeiling`, L328204-L328230), so a
|
|
236
|
+
* ceiling naming every child of `identifying` but not `identifying`
|
|
237
|
+
* permits the `identifying` pick.
|
|
238
|
+
*
|
|
239
|
+
* OWN CONTENT (ruling, strict rule 2): a row with fields HOMED directly on it
|
|
240
|
+
* (canon's field placements, {@link INFORMATION_SCOPE_FIELD_HOME_ROWS}; a
|
|
241
|
+
* per-kind row reads its `kindRow`, since rule 1 routes another person's
|
|
242
|
+
* record there) and NO rest row is within ONLY when it or an ancestor is
|
|
243
|
+
* listed — listing its children does not carry its own fields. Examples:
|
|
244
|
+
* `instruments` (`capture.assessment*`) and `commercial_activity`. A row with
|
|
245
|
+
* a rest row (`identifying` + `identifying.other`) keeps rule 2: its own
|
|
246
|
+
* fields are its rest row's.
|
|
247
|
+
*
|
|
248
|
+
* A COVERAGE child is live, not under the platform safety floor (never
|
|
249
|
+
* shared) and not System metadata (always rides). A row is LIVE when it and
|
|
250
|
+
* every row on its ancestor path are non-retired; a code outside the tree, or
|
|
251
|
+
* not live, is never within.
|
|
252
|
+
*
|
|
253
|
+
* Deliberately NOT the resolver's `isCovered`, under which a listed rest row
|
|
254
|
+
* (`identifying.other`) would cover its whole category.
|
|
255
|
+
*
|
|
256
|
+
* `allowed`: a list (or set) of v4 row codes; `null` is NO ceiling (canon
|
|
257
|
+
* `if (allowed && …)`), under which every live row is within. Any other value
|
|
258
|
+
* reads as `[]` (fail closed). `effectiveCeiling` never answers `null`.
|
|
259
|
+
*
|
|
260
|
+
* The tree arrives as an information-scope resolver (or anything with its
|
|
261
|
+
* four read methods), so this module carries no SOT and no I/O.
|
|
262
|
+
*/
|
|
263
|
+
|
|
264
|
+
/** What the coverage rule reads of a tree. */
|
|
265
|
+
type SharingCeilingScope = Pick<InformationScopeResolver, "rows" | "row" | "childrenOf" | "ancestorsOf">;
|
|
266
|
+
/** A ceiling list as callers hold it; `null` = no ceiling. */
|
|
267
|
+
type SharingCeilingAllowed = readonly string[] | ReadonlySet<string> | null;
|
|
268
|
+
/**
|
|
269
|
+
* Does the coverage rule require `code` for its parent to be covered? Live,
|
|
270
|
+
* not under the platform floor, not System metadata.
|
|
271
|
+
*/
|
|
272
|
+
declare function isCeilingCoverageRow(scope: SharingCeilingScope, code: string): boolean;
|
|
273
|
+
/**
|
|
274
|
+
* Does `code` carry content of its own that children-only coverage cannot
|
|
275
|
+
* carry (fields homed directly on it, no rest row)? See the module header.
|
|
276
|
+
*/
|
|
277
|
+
declare function hasOwnScopeContent(scope: SharingCeilingScope, code: string): boolean;
|
|
278
|
+
/**
|
|
279
|
+
* The coverage of ONE ceiling list, memoised per row — build it once and ask
|
|
280
|
+
* it about many rows. See the module header for the rule.
|
|
281
|
+
*/
|
|
282
|
+
declare function ceilingCoverage(scope: SharingCeilingScope, allowed: SharingCeilingAllowed): (code: string) => boolean;
|
|
283
|
+
/** THE coverage rule for one row (see the module header). */
|
|
284
|
+
declare function scopeRowWithinCeiling(scope: SharingCeilingScope, allowed: SharingCeilingAllowed, code: string): boolean;
|
|
285
|
+
/**
|
|
286
|
+
* The DOOR reader: the codes of a declared list the ceiling does not let
|
|
287
|
+
* leave, in list order, each once. `system_info` and every System-metadata
|
|
288
|
+
* row ride regardless (canon L327974), and rows under the platform floor are
|
|
289
|
+
* never included on any share, so neither is reported. A code outside the
|
|
290
|
+
* tree, or not live, is reported (fail closed).
|
|
291
|
+
*/
|
|
292
|
+
declare function rowsOverCeiling(scope: SharingCeilingScope, declared: readonly string[] | null | undefined, allowed: SharingCeilingAllowed): string[];
|
|
293
|
+
/**
|
|
294
|
+
* The COMPOSER-MASK reader: the rows a ceiling restricts, each at the
|
|
295
|
+
* highest grain that is wholly outside it — a row not within and holding no
|
|
296
|
+
* within coverage row beneath. A row that is not within but holds one that
|
|
297
|
+
* is, is not restricted itself; its children are walked. System metadata is
|
|
298
|
+
* never restricted. `null` (no ceiling) restricts nothing.
|
|
299
|
+
*/
|
|
300
|
+
declare function rowsOutsideCeiling(scope: SharingCeilingScope, allowed: SharingCeilingAllowed): string[];
|
|
301
|
+
/**
|
|
302
|
+
* The rows with content of their own (strict rule 2) that are not within the
|
|
303
|
+
* ceiling but hold rows that are: the row itself cannot be sent, so a pick of
|
|
304
|
+
* it reads as a pick of its children (then masked). Top-down order.
|
|
305
|
+
*/
|
|
306
|
+
declare function rowsExpandedByCeiling(scope: SharingCeilingScope, allowed: SharingCeilingAllowed): string[];
|
|
307
|
+
/**
|
|
308
|
+
* The COMPOSER MASK: a selection with every row the ceiling restricts taken
|
|
309
|
+
* out at its own grain. First each covered own-content row the ceiling does
|
|
310
|
+
* not permit ({@link rowsExpandedByCeiling}) is replaced by its children,
|
|
311
|
+
* then every row wholly outside ({@link rowsOutsideCeiling}) is subtracted.
|
|
312
|
+
* Only live rows survive (plus `system_info`, always first). A row within
|
|
313
|
+
* the ceiling is never removed, and {@link rowsOverCeiling} accepts every
|
|
314
|
+
* result.
|
|
315
|
+
*/
|
|
316
|
+
declare function maskSelectionToCeiling(scope: SharingCeilingScope, selection: readonly string[] | null | undefined, allowed: SharingCeilingAllowed): string[];
|
|
317
|
+
|
|
318
|
+
export { type EffectiveSharingCeiling, type EffectiveSharingCeilingInputs, HTI_SHARE_PLATFORM_PURPOSE_ENABLED, HTI_SHARE_PLATFORM_STARTER, HTI_SHARE_PLATFORM_STARTER_SOURCE, INFORMATION_SCOPE_FIELD_HOME_ROWS, SHARING_CEILING_DEFAULT_ROW_KEY, SHARING_CEILING_EXTERNAL_ROW_KEY, SHARING_CEILING_SCOPE_VERSION, type SharingCeilingAllowed, type SharingCeilingCellLike, type SharingCeilingRung, type SharingCeilingScope, type SharingPlatformStarter, type SharingPurposeLists, type SharingScopeEdits, ceilingCoverage, effectiveCeiling, hasOwnScopeContent, isCeilingCoverageRow, isSharingPurposeDisabled, maskSelectionToCeiling, rowsExpandedByCeiling, rowsOutsideCeiling, rowsOverCeiling, scopeRowWithinCeiling, sharingCeilingCellList, sharingCeilingRowKey, sharingScopeEditsFromCells };
|