@htilabs/platform-common-models 0.80.0 → 0.82.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 +27 -0
- package/dist/{index-DvAypMJV.d.ts → index-Bh1zO_Vu.d.ts} +1 -1
- package/dist/{index-Bj-s0nZy.d.cts → index-XWSYon40.d.cts} +1 -1
- package/dist/index.cjs +365 -47
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +355 -47
- package/dist/index.js.map +1 -1
- package/dist/information-scope/index.cjs +290 -2
- package/dist/information-scope/index.cjs.map +1 -1
- package/dist/information-scope/index.d.cts +84 -1
- package/dist/information-scope/index.d.ts +84 -1
- package/dist/information-scope/index.js +279 -1
- package/dist/information-scope/index.js.map +1 -1
- package/dist/models/index.d.cts +2 -2
- package/dist/models/index.d.ts +2 -2
- package/dist/schemas/index.d.cts +25 -25
- package/dist/schemas/index.d.ts +25 -25
- package/dist/services/index.cjs +290 -2
- package/dist/services/index.cjs.map +1 -1
- package/dist/services/index.d.cts +1 -1
- package/dist/services/index.d.ts +1 -1
- package/dist/services/index.js +279 -1
- package/dist/services/index.js.map +1 -1
- package/dist/sharing-ceiling/index.cjs +33 -3
- package/dist/sharing-ceiling/index.cjs.map +1 -1
- package/dist/sharing-ceiling/index.d.cts +11 -7
- package/dist/sharing-ceiling/index.d.ts +11 -7
- package/dist/sharing-ceiling/index.js +33 -3
- package/dist/sharing-ceiling/index.js.map +1 -1
- package/package.json +1 -1
- package/src/generated/informationScopeUiCopy.ts +263 -0
- package/src/services/__tests__/informationScopeUiCopy.test.ts +128 -0
- package/src/services/informationScope.ts +1 -0
- package/src/services/informationScopeUiCopy.ts +98 -0
- package/src/sharingCeiling/__tests__/fixtures_starterVerdicts.json +1727 -0
- package/src/sharingCeiling/__tests__/personContactRows.test.ts +185 -0
- package/src/sharingCeiling/coverage.ts +55 -6
- package/src/sharingCeiling/resolve.ts +31 -8
- package/dist/{cvcEntry-BLeRivoF.d.cts → cvcEntry-D787utvP.d.cts} +8 -8
- package/dist/{cvcEntry-BLeRivoF.d.ts → cvcEntry-D787utvP.d.ts} +8 -8
|
@@ -238,8 +238,9 @@ declare function effectiveCeiling(rowKey: string, purpose: string, inputs: Effec
|
|
|
238
238
|
*
|
|
239
239
|
* OWN CONTENT (ruling, strict rule 2): a row with fields HOMED directly on it
|
|
240
240
|
* (canon's field placements, {@link INFORMATION_SCOPE_FIELD_HOME_ROWS}; a
|
|
241
|
-
* per-kind row
|
|
242
|
-
*
|
|
241
|
+
* per-kind row also holds every client home rule 1 routes to it — the deepest
|
|
242
|
+
* per-kind row whose `kindRow` is the home or an ancestor of it, so
|
|
243
|
+
* `contact_info` lands on `offenders.contact`) and NO rest row is within ONLY when it or an ancestor is
|
|
243
244
|
* listed — listing its children does not carry its own fields. Examples:
|
|
244
245
|
* `instruments` (`capture.assessment*`) and `commercial_activity`. A row with
|
|
245
246
|
* a rest row (`identifying` + `identifying.other`) keeps rule 2: its own
|
|
@@ -248,7 +249,9 @@ declare function effectiveCeiling(rowKey: string, purpose: string, inputs: Effec
|
|
|
248
249
|
* A COVERAGE child is live, not under the platform safety floor (never
|
|
249
250
|
* shared) and not System metadata (always rides). A row is LIVE when it and
|
|
250
251
|
* every row on its ancestor path are non-retired; a code outside the tree, or
|
|
251
|
-
* not live, is never within.
|
|
252
|
+
* not live, is never within. Under a bound ceiling a row under the platform
|
|
253
|
+
* floor is within only when the list names it itself, never through a listed
|
|
254
|
+
* ancestor.
|
|
252
255
|
*
|
|
253
256
|
* Deliberately NOT the resolver's `isCovered`, under which a listed rest row
|
|
254
257
|
* (`identifying.other`) would cover its whole category.
|
|
@@ -829,10 +832,11 @@ declare function platformDefaultFor(scope: SharingCeilingScope, purpose: string,
|
|
|
829
832
|
/**
|
|
830
833
|
* The ROW-grain ceiling one resolution amounts to — the list the item-grain readers take
|
|
831
834
|
* (`maskSelectionToCeiling` for the composer, `rowsOverCeiling` for the send door): each
|
|
832
|
-
* allowed category by its own code when no row of it is withheld,
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
835
|
+
* allowed category by its own code when no row of it is withheld (or, for a category with
|
|
836
|
+
* fields of its own, when only floor rows are), else its live rows minus the withheld ones
|
|
837
|
+
* (the governing list's, the account's heightened rows, the field-group limits, the team's).
|
|
838
|
+
* Rows under the platform floor are never listed, and never leave on a listed ancestor (the
|
|
839
|
+
* readers never let them through). `[]` for an excluded share — only System metadata rides.
|
|
836
840
|
*/
|
|
837
841
|
declare function shareRowCeiling(resolution: Pick<ShareResolution, "allowed" | "scope" | "allowedCategories">, scope: SharingCeilingScope): string[];
|
|
838
842
|
/**
|
|
@@ -238,8 +238,9 @@ declare function effectiveCeiling(rowKey: string, purpose: string, inputs: Effec
|
|
|
238
238
|
*
|
|
239
239
|
* OWN CONTENT (ruling, strict rule 2): a row with fields HOMED directly on it
|
|
240
240
|
* (canon's field placements, {@link INFORMATION_SCOPE_FIELD_HOME_ROWS}; a
|
|
241
|
-
* per-kind row
|
|
242
|
-
*
|
|
241
|
+
* per-kind row also holds every client home rule 1 routes to it — the deepest
|
|
242
|
+
* per-kind row whose `kindRow` is the home or an ancestor of it, so
|
|
243
|
+
* `contact_info` lands on `offenders.contact`) and NO rest row is within ONLY when it or an ancestor is
|
|
243
244
|
* listed — listing its children does not carry its own fields. Examples:
|
|
244
245
|
* `instruments` (`capture.assessment*`) and `commercial_activity`. A row with
|
|
245
246
|
* a rest row (`identifying` + `identifying.other`) keeps rule 2: its own
|
|
@@ -248,7 +249,9 @@ declare function effectiveCeiling(rowKey: string, purpose: string, inputs: Effec
|
|
|
248
249
|
* A COVERAGE child is live, not under the platform safety floor (never
|
|
249
250
|
* shared) and not System metadata (always rides). A row is LIVE when it and
|
|
250
251
|
* every row on its ancestor path are non-retired; a code outside the tree, or
|
|
251
|
-
* not live, is never within.
|
|
252
|
+
* not live, is never within. Under a bound ceiling a row under the platform
|
|
253
|
+
* floor is within only when the list names it itself, never through a listed
|
|
254
|
+
* ancestor.
|
|
252
255
|
*
|
|
253
256
|
* Deliberately NOT the resolver's `isCovered`, under which a listed rest row
|
|
254
257
|
* (`identifying.other`) would cover its whole category.
|
|
@@ -829,10 +832,11 @@ declare function platformDefaultFor(scope: SharingCeilingScope, purpose: string,
|
|
|
829
832
|
/**
|
|
830
833
|
* The ROW-grain ceiling one resolution amounts to — the list the item-grain readers take
|
|
831
834
|
* (`maskSelectionToCeiling` for the composer, `rowsOverCeiling` for the send door): each
|
|
832
|
-
* allowed category by its own code when no row of it is withheld,
|
|
833
|
-
*
|
|
834
|
-
*
|
|
835
|
-
*
|
|
835
|
+
* allowed category by its own code when no row of it is withheld (or, for a category with
|
|
836
|
+
* fields of its own, when only floor rows are), else its live rows minus the withheld ones
|
|
837
|
+
* (the governing list's, the account's heightened rows, the field-group limits, the team's).
|
|
838
|
+
* Rows under the platform floor are never listed, and never leave on a listed ancestor (the
|
|
839
|
+
* readers never let them through). `[]` for an excluded share — only System metadata rides.
|
|
836
840
|
*/
|
|
837
841
|
declare function shareRowCeiling(resolution: Pick<ShareResolution, "allowed" | "scope" | "allowedCategories">, scope: SharingCeilingScope): string[];
|
|
838
842
|
/**
|
|
@@ -285,10 +285,11 @@ function treeFacts(scope) {
|
|
|
285
285
|
const coverageChildren = memoize(
|
|
286
286
|
(code) => Object.freeze(scope.childrenOf(code).filter(isCoverageRow))
|
|
287
287
|
);
|
|
288
|
+
const kindHomed = kindHomedRows(scope);
|
|
288
289
|
const hasOwnContent = memoize((code) => {
|
|
289
290
|
const row = scope.row(code);
|
|
290
291
|
if (row === void 0) return false;
|
|
291
|
-
const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) ||
|
|
292
|
+
const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || kindHomed.has(code);
|
|
292
293
|
if (!homed) return false;
|
|
293
294
|
return !scope.childrenOf(code).some((c) => scope.row(c)?.rowType === "category_rest" && isLive(c));
|
|
294
295
|
});
|
|
@@ -303,6 +304,28 @@ function treeFacts(scope) {
|
|
|
303
304
|
factsCache.set(scope, facts);
|
|
304
305
|
return facts;
|
|
305
306
|
}
|
|
307
|
+
function kindHomedRows(scope) {
|
|
308
|
+
const perKind = /* @__PURE__ */ new Map();
|
|
309
|
+
const kinds = /* @__PURE__ */ new Map();
|
|
310
|
+
for (const r of scope.rows) {
|
|
311
|
+
if (r.status === "retired" || r.kindBranch === null) continue;
|
|
312
|
+
if (r.rowType === "person_type") kinds.set(r.kindBranch, r.scopeCode);
|
|
313
|
+
else if (r.kindRow !== void 0) perKind.set(`${r.kindBranch}\0${r.kindRow}`, r.scopeCode);
|
|
314
|
+
}
|
|
315
|
+
const out = /* @__PURE__ */ new Set();
|
|
316
|
+
for (const home of INFORMATION_SCOPE_FIELD_HOME_ROWS) {
|
|
317
|
+
const row = scope.row(home);
|
|
318
|
+
if (row === void 0 || row.specialDataType === "criminal_intelligence") continue;
|
|
319
|
+
const chain = scope.ancestorsOf(home);
|
|
320
|
+
if (scope.row(chain[chain.length - 1])?.rowType !== "branch") continue;
|
|
321
|
+
for (const [kind, root] of kinds) {
|
|
322
|
+
if (chain.includes(root)) continue;
|
|
323
|
+
const hit = chain.map((c) => perKind.get(`${kind}\0${c}`)).find((c) => c !== void 0);
|
|
324
|
+
if (hit !== void 0) out.add(hit);
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return out;
|
|
328
|
+
}
|
|
306
329
|
function asCeilingSet(allowed) {
|
|
307
330
|
if (allowed === null) return null;
|
|
308
331
|
if (allowed instanceof Set) return allowed;
|
|
@@ -327,6 +350,7 @@ function ceilingCoverage(scope, allowed) {
|
|
|
327
350
|
let out;
|
|
328
351
|
if (!facts.isLive(code)) out = false;
|
|
329
352
|
else if (set === null) out = true;
|
|
353
|
+
else if (facts.underFloor(code)) out = set.has(code);
|
|
330
354
|
else if (scope.ancestorsOf(code).some((c) => set.has(c))) out = true;
|
|
331
355
|
else if (facts.hasOwnContent(code)) out = false;
|
|
332
356
|
else {
|
|
@@ -424,6 +448,10 @@ function maskSelectionToCeiling(scope, selection, allowed) {
|
|
|
424
448
|
for (const child of scope.childrenOf(code)) if (!sel.includes(child)) sel.push(child);
|
|
425
449
|
}
|
|
426
450
|
for (const code of outside) sel = subtractRow(scope, sel, code);
|
|
451
|
+
if (asCeilingSet(allowed) !== null) {
|
|
452
|
+
const within = ceilingCoverage(scope, allowed);
|
|
453
|
+
sel = sel.filter((c) => !facts.underFloor(c) || within(c));
|
|
454
|
+
}
|
|
427
455
|
return withSystemInfo(sel.filter((c) => facts.isLive(c)));
|
|
428
456
|
}
|
|
429
457
|
function isPermittedByCeiling(scope, ceiling, code) {
|
|
@@ -705,7 +733,8 @@ function shareRowCeiling(resolution, scope) {
|
|
|
705
733
|
...e.teamExcludedItems,
|
|
706
734
|
...e.floorItems
|
|
707
735
|
]);
|
|
708
|
-
|
|
736
|
+
const onlyFloorWithheld = [...withheld].every((r) => e.floorItems.includes(r));
|
|
737
|
+
if (withheld.size === 0 || onlyFloorWithheld && hasOwnScopeContent(scope, g)) {
|
|
709
738
|
out.push(g);
|
|
710
739
|
continue;
|
|
711
740
|
}
|
|
@@ -1097,7 +1126,8 @@ function resolveShare(input) {
|
|
|
1097
1126
|
teamExcludedItems.push(r);
|
|
1098
1127
|
if (teamExcludedItems.length > 0) teamExcludedReason = why;
|
|
1099
1128
|
}
|
|
1100
|
-
|
|
1129
|
+
const floorOnlyOwnContent = leaves.length > 0 && leaves.every((r) => floorItems.includes(r)) && hasOwnScopeContent(scope, g);
|
|
1130
|
+
if (allowed && (!req || platformRequired !== null) && leaves.length > 0 && !floorOnlyOwnContent) {
|
|
1101
1131
|
const gone = new Set(
|
|
1102
1132
|
[...floorItems, ...excludedItems, ...teamExcludedItems].filter(
|
|
1103
1133
|
(r) => leaves.includes(r)
|