@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
|
@@ -361,10 +361,11 @@ function treeFacts(scope) {
|
|
|
361
361
|
const coverageChildren = memoize(
|
|
362
362
|
(code) => Object.freeze(scope.childrenOf(code).filter(isCoverageRow))
|
|
363
363
|
);
|
|
364
|
+
const kindHomed = kindHomedRows(scope);
|
|
364
365
|
const hasOwnContent = memoize((code) => {
|
|
365
366
|
const row = scope.row(code);
|
|
366
367
|
if (row === void 0) return false;
|
|
367
|
-
const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) ||
|
|
368
|
+
const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || kindHomed.has(code);
|
|
368
369
|
if (!homed) return false;
|
|
369
370
|
return !scope.childrenOf(code).some((c) => scope.row(c)?.rowType === "category_rest" && isLive(c));
|
|
370
371
|
});
|
|
@@ -379,6 +380,28 @@ function treeFacts(scope) {
|
|
|
379
380
|
factsCache.set(scope, facts);
|
|
380
381
|
return facts;
|
|
381
382
|
}
|
|
383
|
+
function kindHomedRows(scope) {
|
|
384
|
+
const perKind = /* @__PURE__ */ new Map();
|
|
385
|
+
const kinds = /* @__PURE__ */ new Map();
|
|
386
|
+
for (const r of scope.rows) {
|
|
387
|
+
if (r.status === "retired" || r.kindBranch === null) continue;
|
|
388
|
+
if (r.rowType === "person_type") kinds.set(r.kindBranch, r.scopeCode);
|
|
389
|
+
else if (r.kindRow !== void 0) perKind.set(`${r.kindBranch}\0${r.kindRow}`, r.scopeCode);
|
|
390
|
+
}
|
|
391
|
+
const out = /* @__PURE__ */ new Set();
|
|
392
|
+
for (const home of INFORMATION_SCOPE_FIELD_HOME_ROWS) {
|
|
393
|
+
const row = scope.row(home);
|
|
394
|
+
if (row === void 0 || row.specialDataType === "criminal_intelligence") continue;
|
|
395
|
+
const chain = scope.ancestorsOf(home);
|
|
396
|
+
if (scope.row(chain[chain.length - 1])?.rowType !== "branch") continue;
|
|
397
|
+
for (const [kind, root] of kinds) {
|
|
398
|
+
if (chain.includes(root)) continue;
|
|
399
|
+
const hit = chain.map((c) => perKind.get(`${kind}\0${c}`)).find((c) => c !== void 0);
|
|
400
|
+
if (hit !== void 0) out.add(hit);
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
return out;
|
|
404
|
+
}
|
|
382
405
|
function asCeilingSet(allowed) {
|
|
383
406
|
if (allowed === null) return null;
|
|
384
407
|
if (allowed instanceof Set) return allowed;
|
|
@@ -403,6 +426,7 @@ function ceilingCoverage(scope, allowed) {
|
|
|
403
426
|
let out;
|
|
404
427
|
if (!facts.isLive(code)) out = false;
|
|
405
428
|
else if (set === null) out = true;
|
|
429
|
+
else if (facts.underFloor(code)) out = set.has(code);
|
|
406
430
|
else if (scope.ancestorsOf(code).some((c) => set.has(c))) out = true;
|
|
407
431
|
else if (facts.hasOwnContent(code)) out = false;
|
|
408
432
|
else {
|
|
@@ -500,6 +524,10 @@ function maskSelectionToCeiling(scope, selection, allowed) {
|
|
|
500
524
|
for (const child of scope.childrenOf(code)) if (!sel.includes(child)) sel.push(child);
|
|
501
525
|
}
|
|
502
526
|
for (const code of outside) sel = subtractRow(scope, sel, code);
|
|
527
|
+
if (asCeilingSet(allowed) !== null) {
|
|
528
|
+
const within = ceilingCoverage(scope, allowed);
|
|
529
|
+
sel = sel.filter((c) => !facts.underFloor(c) || within(c));
|
|
530
|
+
}
|
|
503
531
|
return withSystemInfo(sel.filter((c) => facts.isLive(c)));
|
|
504
532
|
}
|
|
505
533
|
function isPermittedByCeiling(scope, ceiling, code) {
|
|
@@ -781,7 +809,8 @@ function shareRowCeiling(resolution, scope) {
|
|
|
781
809
|
...e.teamExcludedItems,
|
|
782
810
|
...e.floorItems
|
|
783
811
|
]);
|
|
784
|
-
|
|
812
|
+
const onlyFloorWithheld = [...withheld].every((r) => e.floorItems.includes(r));
|
|
813
|
+
if (withheld.size === 0 || onlyFloorWithheld && hasOwnScopeContent(scope, g)) {
|
|
785
814
|
out.push(g);
|
|
786
815
|
continue;
|
|
787
816
|
}
|
|
@@ -1173,7 +1202,8 @@ function resolveShare(input) {
|
|
|
1173
1202
|
teamExcludedItems.push(r);
|
|
1174
1203
|
if (teamExcludedItems.length > 0) teamExcludedReason = why;
|
|
1175
1204
|
}
|
|
1176
|
-
|
|
1205
|
+
const floorOnlyOwnContent = leaves.length > 0 && leaves.every((r) => floorItems.includes(r)) && hasOwnScopeContent(scope, g);
|
|
1206
|
+
if (allowed && (!req || platformRequired !== null) && leaves.length > 0 && !floorOnlyOwnContent) {
|
|
1177
1207
|
const gone = new Set(
|
|
1178
1208
|
[...floorItems, ...excludedItems, ...teamExcludedItems].filter(
|
|
1179
1209
|
(r) => leaves.includes(r)
|