@htilabs/platform-common-models 0.80.0 → 0.81.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 +17 -0
- package/dist/{index-Bj-s0nZy.d.cts → index-1pWiqEBC.d.cts} +1 -1
- package/dist/{index-DvAypMJV.d.ts → index-uz57Fic9.d.ts} +1 -1
- package/dist/index.cjs +33 -3
- 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 +33 -3
- package/dist/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 +1 -1
- package/dist/schemas/index.d.ts +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/dist/validation/index.d.cts +1 -1
- package/dist/validation/index.d.ts +1 -1
- package/package.json +1 -1
- 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/{agency-CnVTwLeV.d.ts → agency-BHv54o79.d.ts} +4 -4
- package/dist/{agency-8ufZJJDH.d.cts → agency-Djp57S71.d.cts} +4 -4
- package/dist/{cvcEntry-BLeRivoF.d.cts → cvcEntry-DAuhe0cd.d.cts} +16 -16
- package/dist/{cvcEntry-BLeRivoF.d.ts → cvcEntry-DAuhe0cd.d.ts} +16 -16
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Another person's phones, emails and contact log (0.81.0).
|
|
3
|
+
*
|
|
4
|
+
* Canon homes them on `contact_info` (fields.csv `capture.contact_link_role`,
|
|
5
|
+
* rule 1) and the share builder routes them, for another person, to the
|
|
6
|
+
* deepest per-kind row whose `kindRow` is the home or an ancestor —
|
|
7
|
+
* `<kind>.contact` (prototype `resolveHome` @ 72d045ab; the scope tree
|
|
8
|
+
* `INFOSCOPE_TREE_V4_PROPOSAL_2026-10-08.md` L140: "offenders.contact —
|
|
9
|
+
* their phones / emails — shareable yes"; L141 `offenders.safe_locations` —
|
|
10
|
+
* floor, locked off). The prototype's composer catalog lists no floor row, so
|
|
11
|
+
* its full record (`shareFullRecordIds`) carries all three per-kind Contact &
|
|
12
|
+
* safety rows. Before 0.81.0 the resolver withheld each one as "under the
|
|
13
|
+
* platform safety floor" because its only child is the floor row.
|
|
14
|
+
*/
|
|
15
|
+
import { describe, expect, it } from "vitest";
|
|
16
|
+
|
|
17
|
+
import { coreInformationScopeSot } from "../../cvcs/index.js";
|
|
18
|
+
import {
|
|
19
|
+
createInformationScopeResolver,
|
|
20
|
+
scopeMigrationsFromSot,
|
|
21
|
+
scopeRowsFromSot,
|
|
22
|
+
type CoreInformationScopeSot,
|
|
23
|
+
} from "../../services/informationScope.js";
|
|
24
|
+
import {
|
|
25
|
+
HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE,
|
|
26
|
+
ceilingCoverage,
|
|
27
|
+
HTI_SHARE_PLATFORM_STARTER,
|
|
28
|
+
derivePlatformDefault,
|
|
29
|
+
hasOwnScopeContent,
|
|
30
|
+
liveCategories,
|
|
31
|
+
maskSelectionToCeiling,
|
|
32
|
+
resolveShare,
|
|
33
|
+
rowsOverCeiling,
|
|
34
|
+
scopeRowWithinCeiling,
|
|
35
|
+
shareRowCeiling,
|
|
36
|
+
type ShareResolveInput,
|
|
37
|
+
} from "../index.js";
|
|
38
|
+
import pinned from "./fixtures_starterVerdicts.json" with { type: "json" };
|
|
39
|
+
|
|
40
|
+
const sot = coreInformationScopeSot as CoreInformationScopeSot;
|
|
41
|
+
const scope = createInformationScopeResolver({
|
|
42
|
+
rows: scopeRowsFromSot(sot),
|
|
43
|
+
migrations: scopeMigrationsFromSot(sot),
|
|
44
|
+
});
|
|
45
|
+
|
|
46
|
+
const KINDS = ["offenders", "family", "others"] as const;
|
|
47
|
+
const CONTACT = KINDS.map((k) => `${k}.contact`);
|
|
48
|
+
const SAFE = KINDS.map((k) => `${k}.safe_locations`);
|
|
49
|
+
|
|
50
|
+
const RECIPIENTS: Record<string, ShareResolveInput["recipient"]> = {
|
|
51
|
+
inside: { kind: "sibling_team", teamId: "T" },
|
|
52
|
+
partner_okcpd: { kind: "partner", id: "okcpd" },
|
|
53
|
+
partner_unseeded: { kind: "partner", id: "org-x" },
|
|
54
|
+
external: { kind: "external" },
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
const resolve = (
|
|
58
|
+
purpose: string,
|
|
59
|
+
recipient: ShareResolveInput["recipient"],
|
|
60
|
+
extra: Partial<ShareResolveInput> = {},
|
|
61
|
+
) =>
|
|
62
|
+
resolveShare({
|
|
63
|
+
scope,
|
|
64
|
+
policies: [],
|
|
65
|
+
platformDefault: derivePlatformDefault(
|
|
66
|
+
scope,
|
|
67
|
+
purpose,
|
|
68
|
+
HTI_SHARE_PLATFORM_STARTER.scopeByPurpose[purpose] ?? null,
|
|
69
|
+
{
|
|
70
|
+
required:
|
|
71
|
+
(
|
|
72
|
+
HTI_SHARE_PLATFORM_REQUIRED_BY_PURPOSE as Record<string, readonly string[]>
|
|
73
|
+
)[purpose]?.slice() ?? [],
|
|
74
|
+
},
|
|
75
|
+
),
|
|
76
|
+
sender: { accountId: "A", teamId: "T2" },
|
|
77
|
+
recipient,
|
|
78
|
+
purpose,
|
|
79
|
+
...extra,
|
|
80
|
+
});
|
|
81
|
+
|
|
82
|
+
describe("another person's Contact & safety row", () => {
|
|
83
|
+
it("carries fields of its own: contact_info routes to it for every kind", () => {
|
|
84
|
+
for (const c of CONTACT) expect(hasOwnScopeContent(scope, c)).toBe(true);
|
|
85
|
+
for (const c of SAFE) expect(hasOwnScopeContent(scope, c)).toBe(false);
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
it("an internal referral under the inside starter, no account rule, carries all three and counts them", () => {
|
|
89
|
+
const r = resolve("referral", RECIPIENTS.inside);
|
|
90
|
+
expect(r.inside).toBe(true);
|
|
91
|
+
const ceiling = shareRowCeiling(r, scope);
|
|
92
|
+
for (const c of CONTACT) {
|
|
93
|
+
expect(r.scope[c]?.allowed).toBe(true);
|
|
94
|
+
expect(r.allowedCategories).toContain(c);
|
|
95
|
+
expect(ceiling).toContain(c);
|
|
96
|
+
expect(scopeRowWithinCeiling(scope, ceiling, c)).toBe(true);
|
|
97
|
+
}
|
|
98
|
+
// a whole-branch pick of the other people keeps each Contact & safety row
|
|
99
|
+
const masked = maskSelectionToCeiling(
|
|
100
|
+
scope,
|
|
101
|
+
["system_info", "offenders", "family", "others"],
|
|
102
|
+
ceiling,
|
|
103
|
+
);
|
|
104
|
+
const reaches = (c: string) =>
|
|
105
|
+
masked.some((m) => scope.ancestorsOf(c).includes(m));
|
|
106
|
+
for (const c of CONTACT) expect(reaches(c)).toBe(true);
|
|
107
|
+
expect(rowsOverCeiling(scope, CONTACT, ceiling)).toEqual([]);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
it("the safe-locations floor beneath it never leaves", () => {
|
|
111
|
+
for (const purpose of Object.keys(HTI_SHARE_PLATFORM_STARTER.scopeByPurpose)) {
|
|
112
|
+
for (const rec of Object.values(RECIPIENTS)) {
|
|
113
|
+
const r = resolve(purpose, rec);
|
|
114
|
+
const ceiling = shareRowCeiling(r, scope);
|
|
115
|
+
for (const s of SAFE) {
|
|
116
|
+
expect(ceiling).not.toContain(s);
|
|
117
|
+
expect(scopeRowWithinCeiling(scope, ceiling, s)).toBe(false);
|
|
118
|
+
}
|
|
119
|
+
for (const c of CONTACT) {
|
|
120
|
+
if (r.scope[c] !== undefined) {
|
|
121
|
+
expect(r.scope[c]?.floorItems).toEqual([`${c.split(".")[0]}.safe_locations`]);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
// a selection that names the floor row is masked away
|
|
127
|
+
const ceiling = shareRowCeiling(resolve("referral", RECIPIENTS.inside), scope);
|
|
128
|
+
expect(maskSelectionToCeiling(scope, ["system_info", ...SAFE], ceiling)).toEqual([
|
|
129
|
+
"system_info",
|
|
130
|
+
]);
|
|
131
|
+
});
|
|
132
|
+
|
|
133
|
+
it("an account rule that holds the category out still holds it out", () => {
|
|
134
|
+
const r = resolve("referral", RECIPIENTS.inside, {
|
|
135
|
+
accountScope: { categoriesOff: CONTACT },
|
|
136
|
+
});
|
|
137
|
+
const ceiling = shareRowCeiling(r, scope);
|
|
138
|
+
for (const c of CONTACT) {
|
|
139
|
+
expect(r.scope[c]?.allowed).toBe(false);
|
|
140
|
+
expect(r.scope[c]?.reason).toMatch(/Information Scope/);
|
|
141
|
+
expect(scopeRowWithinCeiling(scope, ceiling, c)).toBe(false);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
it("a partner ceiling that does not name the branch still withholds it", () => {
|
|
146
|
+
const r = resolve("referral", RECIPIENTS.partner_okcpd);
|
|
147
|
+
for (const c of CONTACT) expect(r.scope[c]?.allowed).toBe(false);
|
|
148
|
+
});
|
|
149
|
+
|
|
150
|
+
it("every other verdict under the platform starter is unchanged (pinned table)", () => {
|
|
151
|
+
for (const purpose of Object.keys(HTI_SHARE_PLATFORM_STARTER.scopeByPurpose)) {
|
|
152
|
+
for (const [rk, rec] of Object.entries(RECIPIENTS)) {
|
|
153
|
+
const r = resolve(purpose, rec);
|
|
154
|
+
const ceiling = shareRowCeiling(r, scope);
|
|
155
|
+
const got = {
|
|
156
|
+
allowed: liveCategories(scope).filter((g) => r.scope[g]?.allowed),
|
|
157
|
+
withinRows: scope.rows
|
|
158
|
+
.map((x) => x.scopeCode)
|
|
159
|
+
.filter((c) => scopeRowWithinCeiling(scope, ceiling, c)),
|
|
160
|
+
};
|
|
161
|
+
expect(got, `${purpose} / ${rk}`).toEqual(
|
|
162
|
+
(pinned as unknown as Record<string, unknown>)[`${purpose} / ${rk}`],
|
|
163
|
+
);
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
});
|
|
167
|
+
|
|
168
|
+
it.each(["offenders.contact", "offenders", "other_named_persons", "contact", "primary_client"])(
|
|
169
|
+
"a ceiling listing %s (an ancestor of a floor row) lets no safe-locations row leave",
|
|
170
|
+
(ancestor) => {
|
|
171
|
+
const floorRows = scope.rows
|
|
172
|
+
.map((r) => r.scopeCode)
|
|
173
|
+
.filter((c) => c === "safe_locations" || c.endsWith(".safe_locations"));
|
|
174
|
+
expect(floorRows).toEqual(expect.arrayContaining(["safe_locations", ...SAFE]));
|
|
175
|
+
const allowed = [ancestor];
|
|
176
|
+
const within = ceilingCoverage(scope, allowed);
|
|
177
|
+
for (const f of floorRows) expect(within(f), f).toBe(false);
|
|
178
|
+
const fullTree = scope.rows
|
|
179
|
+
.filter((r) => r.status !== "retired")
|
|
180
|
+
.map((r) => r.scopeCode);
|
|
181
|
+
const masked = maskSelectionToCeiling(scope, fullTree, allowed);
|
|
182
|
+
for (const f of floorRows) expect(masked, f).not.toContain(f);
|
|
183
|
+
},
|
|
184
|
+
);
|
|
185
|
+
});
|
|
@@ -20,8 +20,9 @@
|
|
|
20
20
|
*
|
|
21
21
|
* OWN CONTENT (ruling, strict rule 2): a row with fields HOMED directly on it
|
|
22
22
|
* (canon's field placements, {@link INFORMATION_SCOPE_FIELD_HOME_ROWS}; a
|
|
23
|
-
* per-kind row
|
|
24
|
-
*
|
|
23
|
+
* per-kind row also holds every client home rule 1 routes to it — the deepest
|
|
24
|
+
* per-kind row whose `kindRow` is the home or an ancestor of it, so
|
|
25
|
+
* `contact_info` lands on `offenders.contact`) and NO rest row is within ONLY when it or an ancestor is
|
|
25
26
|
* listed — listing its children does not carry its own fields. Examples:
|
|
26
27
|
* `instruments` (`capture.assessment*`) and `commercial_activity`. A row with
|
|
27
28
|
* a rest row (`identifying` + `identifying.other`) keeps rule 2: its own
|
|
@@ -30,7 +31,9 @@
|
|
|
30
31
|
* A COVERAGE child is live, not under the platform safety floor (never
|
|
31
32
|
* shared) and not System metadata (always rides). A row is LIVE when it and
|
|
32
33
|
* every row on its ancestor path are non-retired; a code outside the tree, or
|
|
33
|
-
* not live, is never within.
|
|
34
|
+
* not live, is never within. Under a bound ceiling a row under the platform
|
|
35
|
+
* floor is within only when the list names it itself, never through a listed
|
|
36
|
+
* ancestor.
|
|
34
37
|
*
|
|
35
38
|
* Deliberately NOT the resolver's `isCovered`, under which a listed rest row
|
|
36
39
|
* (`identifying.other`) would cover its whole category.
|
|
@@ -99,12 +102,18 @@ function treeFacts(scope: SharingCeilingScope): TreeFacts {
|
|
|
99
102
|
const coverageChildren = memoize((code) =>
|
|
100
103
|
Object.freeze(scope.childrenOf(code).filter(isCoverageRow)),
|
|
101
104
|
);
|
|
105
|
+
// Rule 1, read the way canon's share builder reads it (prototype
|
|
106
|
+
// `HTI-LEADS-PAVE-Thread-prototype.html` @ 72d045ab `resolveHome`; the
|
|
107
|
+
// resolver's `rowForSubject`): a field homed on a client row rides, for
|
|
108
|
+
// another person, the DEEPEST per-kind row whose `kindRow` is that home or
|
|
109
|
+
// one of its ancestors. So `contact_info` (another person's phones, emails,
|
|
110
|
+
// contact log — fields.csv `capture.contact_link_role`, rule 1) rides
|
|
111
|
+
// `offenders.contact`, whose `kindRow` is `contact`, not `contact_info`.
|
|
112
|
+
const kindHomed = kindHomedRows(scope);
|
|
102
113
|
const hasOwnContent = memoize((code) => {
|
|
103
114
|
const row = scope.row(code);
|
|
104
115
|
if (row === undefined) return false;
|
|
105
|
-
const homed =
|
|
106
|
-
INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) ||
|
|
107
|
-
(row.kindRow !== undefined && INFORMATION_SCOPE_FIELD_HOME_ROWS.has(row.kindRow));
|
|
116
|
+
const homed = INFORMATION_SCOPE_FIELD_HOME_ROWS.has(code) || kindHomed.has(code);
|
|
108
117
|
if (!homed) return false;
|
|
109
118
|
// A rest row stands for the row's own fields; then rule 2 still applies.
|
|
110
119
|
return !scope
|
|
@@ -123,6 +132,36 @@ function treeFacts(scope: SharingCeilingScope): TreeFacts {
|
|
|
123
132
|
return facts;
|
|
124
133
|
}
|
|
125
134
|
|
|
135
|
+
/**
|
|
136
|
+
* The per-kind rows a client-row field home resolves to (rule 1). Mirrors the
|
|
137
|
+
* resolver's `rowForSubject`: a home outside the client branch, under a kind
|
|
138
|
+
* already, or holding criminal intelligence stays home; otherwise each kind
|
|
139
|
+
* takes the deepest per-kind row whose `kindRow` is the home or an ancestor
|
|
140
|
+
* of it. Retired rows are skipped.
|
|
141
|
+
*/
|
|
142
|
+
function kindHomedRows(scope: SharingCeilingScope): ReadonlySet<string> {
|
|
143
|
+
const perKind = new Map<string, string>(); // `${kind}\u0000${kindRow}` → code
|
|
144
|
+
const kinds = new Map<string, string>(); // kind → person_type root
|
|
145
|
+
for (const r of scope.rows) {
|
|
146
|
+
if (r.status === "retired" || r.kindBranch === null) continue;
|
|
147
|
+
if (r.rowType === "person_type") kinds.set(r.kindBranch, r.scopeCode);
|
|
148
|
+
else if (r.kindRow !== undefined) perKind.set(`${r.kindBranch}\u0000${r.kindRow}`, r.scopeCode);
|
|
149
|
+
}
|
|
150
|
+
const out = new Set<string>();
|
|
151
|
+
for (const home of INFORMATION_SCOPE_FIELD_HOME_ROWS) {
|
|
152
|
+
const row = scope.row(home);
|
|
153
|
+
if (row === undefined || row.specialDataType === "criminal_intelligence") continue;
|
|
154
|
+
const chain = scope.ancestorsOf(home);
|
|
155
|
+
if (scope.row(chain[chain.length - 1] as string)?.rowType !== "branch") continue;
|
|
156
|
+
for (const [kind, root] of kinds) {
|
|
157
|
+
if (chain.includes(root)) continue;
|
|
158
|
+
const hit = chain.map((c) => perKind.get(`${kind}\u0000${c}`)).find((c) => c !== undefined);
|
|
159
|
+
if (hit !== undefined) out.add(hit);
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
return out;
|
|
163
|
+
}
|
|
164
|
+
|
|
126
165
|
function asCeilingSet(allowed: unknown): ReadonlySet<string> | null {
|
|
127
166
|
if (allowed === null) return null;
|
|
128
167
|
if (allowed instanceof Set) return allowed as ReadonlySet<string>;
|
|
@@ -165,6 +204,10 @@ export function ceilingCoverage(
|
|
|
165
204
|
let out: boolean;
|
|
166
205
|
if (!facts.isLive(code)) out = false;
|
|
167
206
|
else if (set === null) out = true;
|
|
207
|
+
// A row under the platform safety floor never leaves on a bound ceiling,
|
|
208
|
+
// even when an ancestor is listed (a per-kind Contact & safety row is
|
|
209
|
+
// listed whole for its own fields; its safe locations stay home).
|
|
210
|
+
else if (facts.underFloor(code)) out = set.has(code);
|
|
168
211
|
else if (scope.ancestorsOf(code).some((c) => set.has(c))) out = true;
|
|
169
212
|
else if (facts.hasOwnContent(code)) out = false;
|
|
170
213
|
else {
|
|
@@ -340,6 +383,12 @@ export function maskSelectionToCeiling(
|
|
|
340
383
|
for (const child of scope.childrenOf(code)) if (!sel.includes(child)) sel.push(child);
|
|
341
384
|
}
|
|
342
385
|
for (const code of outside) sel = subtractRow(scope, sel, code);
|
|
386
|
+
// A floor row named in the selection never stays, even beneath a listed
|
|
387
|
+
// ancestor (`offenders.safe_locations` under a listed `offenders.contact`).
|
|
388
|
+
if (asCeilingSet(allowed) !== null) {
|
|
389
|
+
const within = ceilingCoverage(scope, allowed);
|
|
390
|
+
sel = sel.filter((c) => !facts.underFloor(c) || within(c));
|
|
391
|
+
}
|
|
343
392
|
// Siblings put back by subtractRow / the expansion come from childrenOf,
|
|
344
393
|
// which a caller's tree may populate with retired rows: keep live ones only.
|
|
345
394
|
return withSystemInfo(sel.filter((c) => facts.isLive(c)));
|
|
@@ -86,7 +86,7 @@
|
|
|
86
86
|
*/
|
|
87
87
|
|
|
88
88
|
import type { EffectiveSharingCeiling } from "./chain.js";
|
|
89
|
-
import type
|
|
89
|
+
import { hasOwnScopeContent, type SharingCeilingScope } from "./coverage.js";
|
|
90
90
|
import {
|
|
91
91
|
HTI_SHARE_PLATFORM_STARTER,
|
|
92
92
|
type SharingPlatformStarter,
|
|
@@ -806,10 +806,11 @@ export function platformDefaultFor(
|
|
|
806
806
|
/**
|
|
807
807
|
* The ROW-grain ceiling one resolution amounts to — the list the item-grain readers take
|
|
808
808
|
* (`maskSelectionToCeiling` for the composer, `rowsOverCeiling` for the send door): each
|
|
809
|
-
* allowed category by its own code when no row of it is withheld,
|
|
810
|
-
*
|
|
811
|
-
*
|
|
812
|
-
*
|
|
809
|
+
* allowed category by its own code when no row of it is withheld (or, for a category with
|
|
810
|
+
* fields of its own, when only floor rows are), else its live rows minus the withheld ones
|
|
811
|
+
* (the governing list's, the account's heightened rows, the field-group limits, the team's).
|
|
812
|
+
* Rows under the platform floor are never listed, and never leave on a listed ancestor (the
|
|
813
|
+
* readers never let them through). `[]` for an excluded share — only System metadata rides.
|
|
813
814
|
*/
|
|
814
815
|
export function shareRowCeiling(
|
|
815
816
|
resolution: Pick<ShareResolution, "allowed" | "scope" | "allowedCategories">,
|
|
@@ -825,7 +826,12 @@ export function shareRowCeiling(
|
|
|
825
826
|
...e.teamExcludedItems,
|
|
826
827
|
...e.floorItems,
|
|
827
828
|
]);
|
|
828
|
-
|
|
829
|
+
// A category with fields of its own that has nothing withheld but floor rows is listed
|
|
830
|
+
// itself: listing only its children would drop its own fields (coverage rule 2), and a
|
|
831
|
+
// floor row never leaves on a listed ancestor (`ceilingCoverage`). The per-kind
|
|
832
|
+
// "Contact & safety" rows (another person's phones, emails, contact log) are this shape.
|
|
833
|
+
const onlyFloorWithheld = [...withheld].every((r) => e.floorItems.includes(r));
|
|
834
|
+
if (withheld.size === 0 || (onlyFloorWithheld && hasOwnScopeContent(scope, g))) {
|
|
829
835
|
out.push(g);
|
|
830
836
|
continue;
|
|
831
837
|
}
|
|
@@ -1474,8 +1480,25 @@ export function resolveShare(input: ShareResolveInput): ShareResolution {
|
|
|
1474
1480
|
teamExcludedItems.push(r);
|
|
1475
1481
|
if (teamExcludedItems.length > 0) teamExcludedReason = why;
|
|
1476
1482
|
}
|
|
1477
|
-
// the group flip: every leaf row withheld → the category is withheld
|
|
1478
|
-
|
|
1483
|
+
// the group flip: every leaf row withheld → the category is withheld. A category that
|
|
1484
|
+
// carries fields of its own (`hasOwnScopeContent`) and whose every leaf is under the
|
|
1485
|
+
// platform floor is not flipped: the floor withholds those rows only, and the category's
|
|
1486
|
+
// own fields still go. The three per-kind "Contact & safety" rows have that shape — their
|
|
1487
|
+
// one child is the safe-locations floor, while another person's phones, emails and contact
|
|
1488
|
+
// log ride the category itself (rule 1: `contact_info` → `<kind>.contact`; the prototype's
|
|
1489
|
+
// share builder `resolveHome`, and its composer catalog, which lists no floor row, so the
|
|
1490
|
+
// prototype never withholds the category for it — prototype @ 72d045ab
|
|
1491
|
+
// `HTI_SHARE_SCOPE_GROUPS` `offenders.contact` items: []).
|
|
1492
|
+
const floorOnlyOwnContent =
|
|
1493
|
+
leaves.length > 0 &&
|
|
1494
|
+
leaves.every((r) => floorItems.includes(r)) &&
|
|
1495
|
+
hasOwnScopeContent(scope, g);
|
|
1496
|
+
if (
|
|
1497
|
+
allowed &&
|
|
1498
|
+
(!req || platformRequired !== null) &&
|
|
1499
|
+
leaves.length > 0 &&
|
|
1500
|
+
!floorOnlyOwnContent
|
|
1501
|
+
) {
|
|
1479
1502
|
const gone = new Set(
|
|
1480
1503
|
[...floorItems, ...excludedItems, ...teamExcludedItems].filter((r) =>
|
|
1481
1504
|
leaves.includes(r),
|
|
@@ -199,6 +199,8 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
|
|
|
199
199
|
definition: z.ZodNullable<z.ZodString>;
|
|
200
200
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
201
201
|
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
name: string;
|
|
203
|
+
version: string;
|
|
202
204
|
entries: z.objectOutputType<{
|
|
203
205
|
code: z.ZodString;
|
|
204
206
|
key: z.ZodString;
|
|
@@ -208,11 +210,11 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
|
|
|
208
210
|
childCodes: z.ZodArray<z.ZodString, "many">;
|
|
209
211
|
definition: z.ZodNullable<z.ZodString>;
|
|
210
212
|
}, z.ZodTypeAny, "passthrough">[];
|
|
211
|
-
name: string;
|
|
212
|
-
version: string;
|
|
213
213
|
domain: string;
|
|
214
214
|
levels: Record<string, string>;
|
|
215
215
|
}, {
|
|
216
|
+
name: string;
|
|
217
|
+
version: string;
|
|
216
218
|
entries: z.objectInputType<{
|
|
217
219
|
code: z.ZodString;
|
|
218
220
|
key: z.ZodString;
|
|
@@ -222,8 +224,6 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
|
|
|
222
224
|
childCodes: z.ZodArray<z.ZodString, "many">;
|
|
223
225
|
definition: z.ZodNullable<z.ZodString>;
|
|
224
226
|
}, z.ZodTypeAny, "passthrough">[];
|
|
225
|
-
name: string;
|
|
226
|
-
version: string;
|
|
227
227
|
domain: string;
|
|
228
228
|
levels: Record<string, string>;
|
|
229
229
|
}>;
|
|
@@ -199,6 +199,8 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
|
|
|
199
199
|
definition: z.ZodNullable<z.ZodString>;
|
|
200
200
|
}, z.ZodTypeAny, "passthrough">>, "many">;
|
|
201
201
|
}, "strip", z.ZodTypeAny, {
|
|
202
|
+
name: string;
|
|
203
|
+
version: string;
|
|
202
204
|
entries: z.objectOutputType<{
|
|
203
205
|
code: z.ZodString;
|
|
204
206
|
key: z.ZodString;
|
|
@@ -208,11 +210,11 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
|
|
|
208
210
|
childCodes: z.ZodArray<z.ZodString, "many">;
|
|
209
211
|
definition: z.ZodNullable<z.ZodString>;
|
|
210
212
|
}, z.ZodTypeAny, "passthrough">[];
|
|
211
|
-
name: string;
|
|
212
|
-
version: string;
|
|
213
213
|
domain: string;
|
|
214
214
|
levels: Record<string, string>;
|
|
215
215
|
}, {
|
|
216
|
+
name: string;
|
|
217
|
+
version: string;
|
|
216
218
|
entries: z.objectInputType<{
|
|
217
219
|
code: z.ZodString;
|
|
218
220
|
key: z.ZodString;
|
|
@@ -222,8 +224,6 @@ declare const CvcEnvelopeSchema: z.ZodObject<{
|
|
|
222
224
|
childCodes: z.ZodArray<z.ZodString, "many">;
|
|
223
225
|
definition: z.ZodNullable<z.ZodString>;
|
|
224
226
|
}, z.ZodTypeAny, "passthrough">[];
|
|
225
|
-
name: string;
|
|
226
|
-
version: string;
|
|
227
227
|
domain: string;
|
|
228
228
|
levels: Record<string, string>;
|
|
229
229
|
}>;
|
|
@@ -199,20 +199,20 @@ type Form = InferRawDocType<typeof _formSchema>;
|
|
|
199
199
|
declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
200
200
|
_id: false;
|
|
201
201
|
}, {
|
|
202
|
-
questionId: string;
|
|
203
202
|
index: number;
|
|
203
|
+
questionId: string;
|
|
204
204
|
questionVersion: string;
|
|
205
205
|
}, mongoose.Document<unknown, {}, {
|
|
206
|
-
questionId: string;
|
|
207
206
|
index: number;
|
|
207
|
+
questionId: string;
|
|
208
208
|
questionVersion: string;
|
|
209
209
|
}, {
|
|
210
210
|
id: string;
|
|
211
211
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
212
212
|
_id: false;
|
|
213
213
|
}>> & Omit<{
|
|
214
|
-
questionId: string;
|
|
215
214
|
index: number;
|
|
215
|
+
questionId: string;
|
|
216
216
|
questionVersion: string;
|
|
217
217
|
} & {
|
|
218
218
|
_id: mongoose.Types.ObjectId;
|
|
@@ -221,8 +221,8 @@ declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any
|
|
|
221
221
|
}, "id"> & {
|
|
222
222
|
id: string;
|
|
223
223
|
}, unknown, {
|
|
224
|
-
questionId: string;
|
|
225
224
|
index: number;
|
|
225
|
+
questionId: string;
|
|
226
226
|
questionVersion: string;
|
|
227
227
|
} & {
|
|
228
228
|
_id: mongoose.Types.ObjectId;
|
|
@@ -233,18 +233,18 @@ type SectionQuestionRef = InferRawDocType<typeof sectionQuestionRefSchema>;
|
|
|
233
233
|
declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
234
234
|
_id: false;
|
|
235
235
|
}, {
|
|
236
|
-
text: string;
|
|
237
236
|
type: "tip" | "warning" | "prompt";
|
|
238
|
-
}, mongoose.Document<unknown, {}, {
|
|
239
237
|
text: string;
|
|
238
|
+
}, mongoose.Document<unknown, {}, {
|
|
240
239
|
type: "tip" | "warning" | "prompt";
|
|
240
|
+
text: string;
|
|
241
241
|
}, {
|
|
242
242
|
id: string;
|
|
243
243
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
244
244
|
_id: false;
|
|
245
245
|
}>> & Omit<{
|
|
246
|
-
text: string;
|
|
247
246
|
type: "tip" | "warning" | "prompt";
|
|
247
|
+
text: string;
|
|
248
248
|
} & {
|
|
249
249
|
_id: mongoose.Types.ObjectId;
|
|
250
250
|
} & {
|
|
@@ -252,8 +252,8 @@ declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any
|
|
|
252
252
|
}, "id"> & {
|
|
253
253
|
id: string;
|
|
254
254
|
}, unknown, {
|
|
255
|
-
text: string;
|
|
256
255
|
type: "tip" | "warning" | "prompt";
|
|
256
|
+
text: string;
|
|
257
257
|
} & {
|
|
258
258
|
_id: mongoose.Types.ObjectId;
|
|
259
259
|
} & {
|
|
@@ -294,18 +294,18 @@ declare const sectionSchemaDefinition: {
|
|
|
294
294
|
type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
295
295
|
_id: false;
|
|
296
296
|
}, {
|
|
297
|
-
text: string;
|
|
298
297
|
type: "tip" | "warning" | "prompt";
|
|
299
|
-
}, mongoose.Document<unknown, {}, {
|
|
300
298
|
text: string;
|
|
299
|
+
}, mongoose.Document<unknown, {}, {
|
|
301
300
|
type: "tip" | "warning" | "prompt";
|
|
301
|
+
text: string;
|
|
302
302
|
}, {
|
|
303
303
|
id: string;
|
|
304
304
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
305
305
|
_id: false;
|
|
306
306
|
}>> & Omit<{
|
|
307
|
-
text: string;
|
|
308
307
|
type: "tip" | "warning" | "prompt";
|
|
308
|
+
text: string;
|
|
309
309
|
} & {
|
|
310
310
|
_id: mongoose.Types.ObjectId;
|
|
311
311
|
} & {
|
|
@@ -313,8 +313,8 @@ declare const sectionSchemaDefinition: {
|
|
|
313
313
|
}, "id"> & {
|
|
314
314
|
id: string;
|
|
315
315
|
}, unknown, {
|
|
316
|
-
text: string;
|
|
317
316
|
type: "tip" | "warning" | "prompt";
|
|
317
|
+
text: string;
|
|
318
318
|
} & {
|
|
319
319
|
_id: mongoose.Types.ObjectId;
|
|
320
320
|
} & {
|
|
@@ -326,20 +326,20 @@ declare const sectionSchemaDefinition: {
|
|
|
326
326
|
type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
327
327
|
_id: false;
|
|
328
328
|
}, {
|
|
329
|
-
questionId: string;
|
|
330
329
|
index: number;
|
|
330
|
+
questionId: string;
|
|
331
331
|
questionVersion: string;
|
|
332
332
|
}, mongoose.Document<unknown, {}, {
|
|
333
|
-
questionId: string;
|
|
334
333
|
index: number;
|
|
334
|
+
questionId: string;
|
|
335
335
|
questionVersion: string;
|
|
336
336
|
}, {
|
|
337
337
|
id: string;
|
|
338
338
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
339
339
|
_id: false;
|
|
340
340
|
}>> & Omit<{
|
|
341
|
-
questionId: string;
|
|
342
341
|
index: number;
|
|
342
|
+
questionId: string;
|
|
343
343
|
questionVersion: string;
|
|
344
344
|
} & {
|
|
345
345
|
_id: mongoose.Types.ObjectId;
|
|
@@ -348,8 +348,8 @@ declare const sectionSchemaDefinition: {
|
|
|
348
348
|
}, "id"> & {
|
|
349
349
|
id: string;
|
|
350
350
|
}, unknown, {
|
|
351
|
-
questionId: string;
|
|
352
351
|
index: number;
|
|
352
|
+
questionId: string;
|
|
353
353
|
questionVersion: string;
|
|
354
354
|
} & {
|
|
355
355
|
_id: mongoose.Types.ObjectId;
|
|
@@ -199,20 +199,20 @@ type Form = InferRawDocType<typeof _formSchema>;
|
|
|
199
199
|
declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
200
200
|
_id: false;
|
|
201
201
|
}, {
|
|
202
|
-
questionId: string;
|
|
203
202
|
index: number;
|
|
203
|
+
questionId: string;
|
|
204
204
|
questionVersion: string;
|
|
205
205
|
}, mongoose.Document<unknown, {}, {
|
|
206
|
-
questionId: string;
|
|
207
206
|
index: number;
|
|
207
|
+
questionId: string;
|
|
208
208
|
questionVersion: string;
|
|
209
209
|
}, {
|
|
210
210
|
id: string;
|
|
211
211
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
212
212
|
_id: false;
|
|
213
213
|
}>> & Omit<{
|
|
214
|
-
questionId: string;
|
|
215
214
|
index: number;
|
|
215
|
+
questionId: string;
|
|
216
216
|
questionVersion: string;
|
|
217
217
|
} & {
|
|
218
218
|
_id: mongoose.Types.ObjectId;
|
|
@@ -221,8 +221,8 @@ declare const sectionQuestionRefSchema: Schema<any, mongoose.Model<any, any, any
|
|
|
221
221
|
}, "id"> & {
|
|
222
222
|
id: string;
|
|
223
223
|
}, unknown, {
|
|
224
|
-
questionId: string;
|
|
225
224
|
index: number;
|
|
225
|
+
questionId: string;
|
|
226
226
|
questionVersion: string;
|
|
227
227
|
} & {
|
|
228
228
|
_id: mongoose.Types.ObjectId;
|
|
@@ -233,18 +233,18 @@ type SectionQuestionRef = InferRawDocType<typeof sectionQuestionRefSchema>;
|
|
|
233
233
|
declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
234
234
|
_id: false;
|
|
235
235
|
}, {
|
|
236
|
-
text: string;
|
|
237
236
|
type: "tip" | "warning" | "prompt";
|
|
238
|
-
}, mongoose.Document<unknown, {}, {
|
|
239
237
|
text: string;
|
|
238
|
+
}, mongoose.Document<unknown, {}, {
|
|
240
239
|
type: "tip" | "warning" | "prompt";
|
|
240
|
+
text: string;
|
|
241
241
|
}, {
|
|
242
242
|
id: string;
|
|
243
243
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
244
244
|
_id: false;
|
|
245
245
|
}>> & Omit<{
|
|
246
|
-
text: string;
|
|
247
246
|
type: "tip" | "warning" | "prompt";
|
|
247
|
+
text: string;
|
|
248
248
|
} & {
|
|
249
249
|
_id: mongoose.Types.ObjectId;
|
|
250
250
|
} & {
|
|
@@ -252,8 +252,8 @@ declare const guidanceSchema: Schema<any, mongoose.Model<any, any, any, any, any
|
|
|
252
252
|
}, "id"> & {
|
|
253
253
|
id: string;
|
|
254
254
|
}, unknown, {
|
|
255
|
-
text: string;
|
|
256
255
|
type: "tip" | "warning" | "prompt";
|
|
256
|
+
text: string;
|
|
257
257
|
} & {
|
|
258
258
|
_id: mongoose.Types.ObjectId;
|
|
259
259
|
} & {
|
|
@@ -294,18 +294,18 @@ declare const sectionSchemaDefinition: {
|
|
|
294
294
|
type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
295
295
|
_id: false;
|
|
296
296
|
}, {
|
|
297
|
-
text: string;
|
|
298
297
|
type: "tip" | "warning" | "prompt";
|
|
299
|
-
}, mongoose.Document<unknown, {}, {
|
|
300
298
|
text: string;
|
|
299
|
+
}, mongoose.Document<unknown, {}, {
|
|
301
300
|
type: "tip" | "warning" | "prompt";
|
|
301
|
+
text: string;
|
|
302
302
|
}, {
|
|
303
303
|
id: string;
|
|
304
304
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
305
305
|
_id: false;
|
|
306
306
|
}>> & Omit<{
|
|
307
|
-
text: string;
|
|
308
307
|
type: "tip" | "warning" | "prompt";
|
|
308
|
+
text: string;
|
|
309
309
|
} & {
|
|
310
310
|
_id: mongoose.Types.ObjectId;
|
|
311
311
|
} & {
|
|
@@ -313,8 +313,8 @@ declare const sectionSchemaDefinition: {
|
|
|
313
313
|
}, "id"> & {
|
|
314
314
|
id: string;
|
|
315
315
|
}, unknown, {
|
|
316
|
-
text: string;
|
|
317
316
|
type: "tip" | "warning" | "prompt";
|
|
317
|
+
text: string;
|
|
318
318
|
} & {
|
|
319
319
|
_id: mongoose.Types.ObjectId;
|
|
320
320
|
} & {
|
|
@@ -326,20 +326,20 @@ declare const sectionSchemaDefinition: {
|
|
|
326
326
|
type: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
|
|
327
327
|
_id: false;
|
|
328
328
|
}, {
|
|
329
|
-
questionId: string;
|
|
330
329
|
index: number;
|
|
330
|
+
questionId: string;
|
|
331
331
|
questionVersion: string;
|
|
332
332
|
}, mongoose.Document<unknown, {}, {
|
|
333
|
-
questionId: string;
|
|
334
333
|
index: number;
|
|
334
|
+
questionId: string;
|
|
335
335
|
questionVersion: string;
|
|
336
336
|
}, {
|
|
337
337
|
id: string;
|
|
338
338
|
}, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
|
|
339
339
|
_id: false;
|
|
340
340
|
}>> & Omit<{
|
|
341
|
-
questionId: string;
|
|
342
341
|
index: number;
|
|
342
|
+
questionId: string;
|
|
343
343
|
questionVersion: string;
|
|
344
344
|
} & {
|
|
345
345
|
_id: mongoose.Types.ObjectId;
|
|
@@ -348,8 +348,8 @@ declare const sectionSchemaDefinition: {
|
|
|
348
348
|
}, "id"> & {
|
|
349
349
|
id: string;
|
|
350
350
|
}, unknown, {
|
|
351
|
-
questionId: string;
|
|
352
351
|
index: number;
|
|
352
|
+
questionId: string;
|
|
353
353
|
questionVersion: string;
|
|
354
354
|
} & {
|
|
355
355
|
_id: mongoose.Types.ObjectId;
|