@htilabs/platform-common-models 0.79.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 +55 -0
- package/dist/authz/index.cjs +154 -2
- package/dist/authz/index.cjs.map +1 -1
- package/dist/authz/index.d.cts +174 -2
- package/dist/authz/index.d.ts +174 -2
- package/dist/authz/index.js +151 -2
- package/dist/authz/index.js.map +1 -1
- package/dist/{index-XWSYon40.d.cts → index-1pWiqEBC.d.cts} +1 -1
- package/dist/{index-Bh1zO_Vu.d.ts → index-uz57Fic9.d.ts} +1 -1
- package/dist/index.cjs +126 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +123 -5
- 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 +25 -25
- package/dist/schemas/index.d.ts +25 -25
- 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 +2 -1
- package/src/__tests__/authz-resolve.test.ts +3 -0
- package/src/__tests__/authz-seat-app-access.test.ts +304 -0
- package/src/authz/index.ts +1 -0
- package/src/authz/seatAppAccess.ts +304 -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/{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-D787utvP.d.cts → cvcEntry-DAuhe0cd.d.cts} +8 -8
- package/dist/{cvcEntry-D787utvP.d.ts → cvcEntry-DAuhe0cd.d.ts} +8 -8
package/README.md
CHANGED
|
@@ -16,6 +16,46 @@ Package exports are organized into a public root API and a small number of
|
|
|
16
16
|
dedicated subpaths (`/validation`, `/cvcs`) — consult `package.json` for the
|
|
17
17
|
authoritative `exports` map.
|
|
18
18
|
|
|
19
|
+
## 0.81.0 — an internal referral carries other people's phones and emails again: the per-kind "Contact & safety" rows are no longer withheld as "under the platform safety floor" (sharing ceiling; CVC-236 `core-information_scope` unchanged)
|
|
20
|
+
|
|
21
|
+
**What changed.** Another person's phones, emails and contact log (the person who caused harm, an eligible family member, another person on the case) ride that person's **Contact & safety** row (`offenders.contact` · `family.contact` · `others.contact`): canon homes them on `contact_info` and rule 1 routes them to the deepest per-kind row whose `kindRow` is that home or an ancestor (prototype `resolveHome`; the scope tree, `INFOSCOPE_TREE_V4_PROPOSAL_2026-10-08.md`: "offenders.contact — their phones / emails — shareable yes"). Each of those rows has one child, `<kind>.safe_locations`, the platform floor. `resolveShare` counted that one floor child as "every leaf withheld" and withheld the whole row ("Never shared — under the platform safety floor"), so `shareRowCeiling` never listed it and Thread's and PAVE's composers masked it away: an internal share under the inside starter offered 3 fewer categories than the prototype's full record (`shareFullRecordIds`, whose catalog lists no floor row) and carried no other person's phone or email.
|
|
22
|
+
|
|
23
|
+
- `hasOwnScopeContent` reads rule 1 as canon does: a per-kind row holds every client field home that routes to it (`contact_info` → `<kind>.contact`). Rows with no children gain the flag too (`<kind>.services`, `<kind>.instrument_summary`, …); no verdict reads it there.
|
|
24
|
+
- `resolveShare`'s group flip skips a category that has fields of its own and whose every leaf is under the floor.
|
|
25
|
+
- `shareRowCeiling` lists such a category itself (only floor rows withheld beneath it).
|
|
26
|
+
- The floor still never leaves: under a bound ceiling a row under the floor is within only when the list names it itself, never through a listed ancestor, and `maskSelectionToCeiling` drops a floor row the ceiling does not name.
|
|
27
|
+
|
|
28
|
+
**Verdicts that move (platform starter, no account rule; every other verdict pinned unchanged in `src/sharingCeiling/__tests__/fixtures_starterVerdicts.json`):**
|
|
29
|
+
|
|
30
|
+
| Purpose × recipient | Now allowed |
|
|
31
|
+
|---|---|
|
|
32
|
+
| every purpose, inside the account (`sibling_team`) | `offenders.contact` · `family.contact` · `others.contact` |
|
|
33
|
+
| `mandatory_reporting`, `authority_reporting` to a partner or off-platform | `family.contact` (the starter lists the whole Eligible family members branch, `family`) |
|
|
34
|
+
|
|
35
|
+
Note: the Platform prototype's `HTI_SHARE_POLICY_API.effectiveCeiling` (`src/data.js`) counts the floor item in its group flip and would still withhold these rows; the monolith, which builds and sends the share, never does. This release follows the monolith and the scope-tree ruling.
|
|
36
|
+
## 0.80.0 — seatAppAccess: a seat's app access from its teams, inside the account's grant (additive, `./authz` and the root)
|
|
37
|
+
|
|
38
|
+
**What changed.** One shared answer to "may this person open this app?" for Thread's and PAVE's sign-in doors and the platform's app tiles (Kickoff 08c), so the three stop deciding from the Auth0 role alone.
|
|
39
|
+
|
|
40
|
+
```ts
|
|
41
|
+
import { seatAppAccess, seatTeamApps, accountAppGrant } from "@htilabs/platform-common-models/authz";
|
|
42
|
+
|
|
43
|
+
const r = seatAppAccess({
|
|
44
|
+
app: "THREAD", // any case
|
|
45
|
+
auth0Allows, // the app's own Auth0 decision for this tier
|
|
46
|
+
teams: seat.teams.map((t) => ({ apps: t.apps, active: t.status !== RETIRED })),
|
|
47
|
+
accountGrant: accountAppGrant(account), // the account's apps_subscribed; null = not known
|
|
48
|
+
accountPreLaunch, // member_status prospective / onboarding
|
|
49
|
+
});
|
|
50
|
+
// r.allowed, r.via ("auth0" | "teams" | "both" | "none"), r.teamApps, r.teamUnion, r.accountGrant, r.unrecognized
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
**The rule.** Platform side: Echo and Trail for every seat (Crysta 2026-08-20 Ruling 2, "everyone with an account"); Thread, PAVE and LEADS when an active team of the seat carries the app and the account's grant includes it (grant unknown: no ceiling); Trail only while the account is not launched (2026-08-31). `allowed` = the app's Auth0 decision OR the platform side: the transition, so nobody loses access on day one; `via` lets the apps report where the two disagree. Canon: 2026-10-02 ("Contract grants apps to the Account, users gain access via teams"), 2026-08-20 Rulings 1 and 2, 2026-10-18, 2026-11-12; prototype `HTI_appsForUser`. Differences from the prototype's user grain, declared in the module comment: the Auth0 OR, inactive teams never grant (2026-11-12; the prototype is being updated), and the account ceiling (2026-11-12).
|
|
54
|
+
|
|
55
|
+
**The grant** is the account's `apps_subscribed`, "Apps the contract grants" (UDD Account Data Object; hti-features Account.v1; records `HTI_ACCOUNT_DIRECTORY.csv`), the list HTI sets; `accountAppGrant` reads it and nothing else. Never `apps_declared` (a retired 2026-10-18 generator artifact) and never the legacy PAVE-synced `accounts.apps`.
|
|
56
|
+
|
|
57
|
+
**Mechanics.** `src/authz/seatAppAccess.ts`, pure (imports only `constants/platform-apps.ts` and a type); tests `src/__tests__/authz-seat-app-access.test.ts`; the `./authz` import allowlist in `authz-resolve.test.ts` gains it and `../constants/platform-apps.js`.
|
|
58
|
+
|
|
19
59
|
## 0.79.0 — the Grant, the Award and the Award–Program link, shared: `@htilabs/platform-common-models/grant-registry` (additive; a new subpath, nothing existing changes)
|
|
20
60
|
|
|
21
61
|
The shape Crysta confirmed on 2026-11-10 (hti-features
|
|
@@ -2764,6 +2804,21 @@ The connection URI comes from `MONGO_URI` (or `--mongo-uri`); the target databas
|
|
|
2764
2804
|
is whatever the URI's path says. Pass `--dry-run` to validate and report counts
|
|
2765
2805
|
without writing anything.
|
|
2766
2806
|
|
|
2807
|
+
`seed:cvc:all` checks every `DOMAINS` entry in `scripts/lib/seedAllCvcs.ts` before
|
|
2808
|
+
it writes anything (before the guard prompt and the connection): the SOT file
|
|
2809
|
+
`resolveSotPath(domain, version)` must exist, declare that domain and a version,
|
|
2810
|
+
carry entries, and pass the same envelope and structural checks `seed:cvc` runs.
|
|
2811
|
+
If any entry fails, it lists every failure and exits 1 with nothing written.
|
|
2812
|
+
`npm run test:seed-all` (a CI step) runs the same check over the table, so a SOT
|
|
2813
|
+
version bump that misses `DOMAINS` fails in CI rather than on a real seed.
|
|
2814
|
+
|
|
2815
|
+
The default registry's pins are **merged**, not replaced: `DOMAINS` sets the pins
|
|
2816
|
+
for the domains it lists, and every other pin already in the registry (a domain
|
|
2817
|
+
seeded with `seed:cvc`, say) is kept. The preview, in a dry run and a real run
|
|
2818
|
+
alike, prints each changed pin as `<domain>: <from> → <to>` and each kept one as
|
|
2819
|
+
`<domain>: <version> (kept, not in DOMAINS)`. The seeder never unpins a domain;
|
|
2820
|
+
removing one from the default registry is a deliberate edit of its `cvcVersions`.
|
|
2821
|
+
|
|
2767
2822
|
### service_categories 2.1.0 — LAP · INS · TRA as their own rows (0.43.0)
|
|
2768
2823
|
|
|
2769
2824
|
Additive minor over 2.0.0 (Kickoff 04c; Crysta ruling 11 of 2026-10-18 — every
|
package/dist/authz/index.cjs
CHANGED
|
@@ -31,6 +31,7 @@ __export(authz_exports, {
|
|
|
31
31
|
VIEWING_LEVEL_FUNCTIONS: () => VIEWING_LEVEL_FUNCTIONS,
|
|
32
32
|
VIEWING_POLICY_SPECIES: () => VIEWING_POLICY_SPECIES,
|
|
33
33
|
VIEWING_POLICY_VOCABULARIES: () => VIEWING_POLICY_VOCABULARIES,
|
|
34
|
+
accountAppGrant: () => accountAppGrant,
|
|
34
35
|
canonicalRoleCode: () => canonicalRoleCode,
|
|
35
36
|
caseSurfacesAsStub: () => caseSurfacesAsStub,
|
|
36
37
|
caseSurfacesOn: () => caseSurfacesOn,
|
|
@@ -44,6 +45,8 @@ __export(authz_exports, {
|
|
|
44
45
|
resolveEffectiveFunctions: () => resolveEffectiveFunctions,
|
|
45
46
|
resolveEffectiveViewingLevel: () => resolveEffectiveViewingLevel,
|
|
46
47
|
resolveViewingPolicy: () => resolveViewingPolicy,
|
|
48
|
+
seatAppAccess: () => seatAppAccess,
|
|
49
|
+
seatTeamApps: () => seatTeamApps,
|
|
47
50
|
selectActingTeamId: () => selectActingTeamId,
|
|
48
51
|
teamViewingLevelFromPolicy: () => teamViewingLevelFromPolicy,
|
|
49
52
|
unavailableViewingPolicy: () => unavailableViewingPolicy,
|
|
@@ -1203,8 +1206,8 @@ function governingRowOf(rows) {
|
|
|
1203
1206
|
if (rows.length === 1 && only !== void 0) return { row: only };
|
|
1204
1207
|
const family = idText(rows[0]?.familyId);
|
|
1205
1208
|
const versions = rows.map((r) => positiveIntOrNull(r.version));
|
|
1206
|
-
const
|
|
1207
|
-
if (!
|
|
1209
|
+
const ordered2 = family !== null && rows.every((r) => idText(r.familyId) === family) && versions.every((v) => typeof v === "number") && new Set(versions).size === versions.length;
|
|
1210
|
+
if (!ordered2) {
|
|
1208
1211
|
return unavailableViewingPolicy("ambiguous_rows", policyIdOf(rows[0] ?? {}));
|
|
1209
1212
|
}
|
|
1210
1213
|
let best = rows[0];
|
|
@@ -1461,6 +1464,152 @@ function viewingComponentOpen(access, homeRow, scope) {
|
|
|
1461
1464
|
if (row.status === "retired") return false;
|
|
1462
1465
|
return scope.isCovered(access.visibleScope, homeRow);
|
|
1463
1466
|
}
|
|
1467
|
+
|
|
1468
|
+
// src/generated/platformApps.ts
|
|
1469
|
+
var PLATFORM_APP_CATALOG = [
|
|
1470
|
+
{
|
|
1471
|
+
"id": "trail",
|
|
1472
|
+
"name": "Trail",
|
|
1473
|
+
"tag": "Certified Access & Training",
|
|
1474
|
+
"universal": true
|
|
1475
|
+
},
|
|
1476
|
+
{
|
|
1477
|
+
"id": "thread",
|
|
1478
|
+
"name": "Thread",
|
|
1479
|
+
"tag": "First Contact Routing",
|
|
1480
|
+
"universal": false
|
|
1481
|
+
},
|
|
1482
|
+
{
|
|
1483
|
+
"id": "pave",
|
|
1484
|
+
"name": "PAVE",
|
|
1485
|
+
"tag": "Survivor-Centered Navigation",
|
|
1486
|
+
"universal": false
|
|
1487
|
+
},
|
|
1488
|
+
{
|
|
1489
|
+
"id": "leads",
|
|
1490
|
+
"name": "LEADS",
|
|
1491
|
+
"tag": "Intelligence-Driven Investigation",
|
|
1492
|
+
"universal": false
|
|
1493
|
+
},
|
|
1494
|
+
{
|
|
1495
|
+
"id": "echo",
|
|
1496
|
+
"name": "Echo",
|
|
1497
|
+
"tag": "Outcomes, Learning, & Impact",
|
|
1498
|
+
"universal": true
|
|
1499
|
+
}
|
|
1500
|
+
];
|
|
1501
|
+
|
|
1502
|
+
// src/constants/platform-apps.ts
|
|
1503
|
+
var PLATFORM_APP_IDS = ["trail", "thread", "pave", "leads", "echo"];
|
|
1504
|
+
if (PLATFORM_APP_CATALOG.length !== PLATFORM_APP_IDS.length || PLATFORM_APP_CATALOG.some((a, i) => a.id !== PLATFORM_APP_IDS[i])) {
|
|
1505
|
+
throw new Error(
|
|
1506
|
+
`platformApps.ts: canon lists [${PLATFORM_APP_CATALOG.map((a) => a.id).join(", ")}], PLATFORM_APP_IDS [${PLATFORM_APP_IDS.join(", ")}]`
|
|
1507
|
+
);
|
|
1508
|
+
}
|
|
1509
|
+
var PLATFORM_APPS = PLATFORM_APP_CATALOG.map((a) => ({
|
|
1510
|
+
id: a.id,
|
|
1511
|
+
name: a.name,
|
|
1512
|
+
tagline: a.tag,
|
|
1513
|
+
universal: a.universal
|
|
1514
|
+
}));
|
|
1515
|
+
var PLATFORM_APP_NAMES = Object.fromEntries(
|
|
1516
|
+
PLATFORM_APPS.map((a) => [a.id, a.name])
|
|
1517
|
+
);
|
|
1518
|
+
var CASEWORK_APP_IDS = PLATFORM_APPS.filter(
|
|
1519
|
+
(a) => !a.universal
|
|
1520
|
+
).map((a) => a.id);
|
|
1521
|
+
var UNIVERSAL_APP_IDS = PLATFORM_APPS.filter(
|
|
1522
|
+
(a) => a.universal
|
|
1523
|
+
).map((a) => a.id);
|
|
1524
|
+
var BY_ID = new Map(PLATFORM_APPS.map((a) => [a.id, a]));
|
|
1525
|
+
function platformAppById(id) {
|
|
1526
|
+
return typeof id === "string" ? BY_ID.get(id.trim().toLowerCase()) ?? null : null;
|
|
1527
|
+
}
|
|
1528
|
+
|
|
1529
|
+
// src/authz/seatAppAccess.ts
|
|
1530
|
+
var UNIVERSAL = new Set(UNIVERSAL_APP_IDS);
|
|
1531
|
+
var TRAIL = "trail";
|
|
1532
|
+
function toolCode(id) {
|
|
1533
|
+
return id.toUpperCase();
|
|
1534
|
+
}
|
|
1535
|
+
function asWritten(v) {
|
|
1536
|
+
if (typeof v === "string") return v;
|
|
1537
|
+
try {
|
|
1538
|
+
const json = JSON.stringify(v);
|
|
1539
|
+
return json === void 0 ? String(v) : json;
|
|
1540
|
+
} catch {
|
|
1541
|
+
return String(v);
|
|
1542
|
+
}
|
|
1543
|
+
}
|
|
1544
|
+
function listOf(value, unrecognized) {
|
|
1545
|
+
if (value === null || value === void 0) return [];
|
|
1546
|
+
if (typeof value === "string") return [value];
|
|
1547
|
+
if (Array.isArray(value)) return value;
|
|
1548
|
+
unrecognized.push(asWritten(value));
|
|
1549
|
+
return [];
|
|
1550
|
+
}
|
|
1551
|
+
function readApps(value, unrecognized) {
|
|
1552
|
+
const out = /* @__PURE__ */ new Set();
|
|
1553
|
+
for (const v of listOf(value, unrecognized)) {
|
|
1554
|
+
const app = platformAppById(v);
|
|
1555
|
+
if (app) out.add(app.id);
|
|
1556
|
+
else unrecognized.push(asWritten(v));
|
|
1557
|
+
}
|
|
1558
|
+
return out;
|
|
1559
|
+
}
|
|
1560
|
+
function ordered(ids) {
|
|
1561
|
+
return PLATFORM_APP_IDS.filter((id) => ids.has(id)).map(toolCode);
|
|
1562
|
+
}
|
|
1563
|
+
function readGrant(value, unrecognized) {
|
|
1564
|
+
if (value === null || value === void 0) return null;
|
|
1565
|
+
return readApps(value, unrecognized);
|
|
1566
|
+
}
|
|
1567
|
+
function accountAppGrant(account) {
|
|
1568
|
+
if (!account || typeof account !== "object") return null;
|
|
1569
|
+
const grant = account.apps_subscribed;
|
|
1570
|
+
return grant === null || grant === void 0 ? null : grant;
|
|
1571
|
+
}
|
|
1572
|
+
function teamSide(teams, accountGrant, accountPreLaunch) {
|
|
1573
|
+
const unrecognized = [];
|
|
1574
|
+
const grant = readGrant(accountGrant, unrecognized);
|
|
1575
|
+
const union = /* @__PURE__ */ new Set();
|
|
1576
|
+
for (const team of Array.isArray(teams) ? teams : []) {
|
|
1577
|
+
if (!team || typeof team !== "object") continue;
|
|
1578
|
+
const t = team;
|
|
1579
|
+
if (t.active === false) continue;
|
|
1580
|
+
for (const id of readApps(t.apps, unrecognized)) union.add(id);
|
|
1581
|
+
}
|
|
1582
|
+
const granted = /* @__PURE__ */ new Set();
|
|
1583
|
+
if (accountPreLaunch === true) {
|
|
1584
|
+
granted.add(TRAIL);
|
|
1585
|
+
return { granted, union, grant, unrecognized };
|
|
1586
|
+
}
|
|
1587
|
+
for (const id of UNIVERSAL) granted.add(id);
|
|
1588
|
+
for (const id of CASEWORK_APP_IDS) {
|
|
1589
|
+
if (union.has(id) && (grant === null || grant.has(id))) granted.add(id);
|
|
1590
|
+
}
|
|
1591
|
+
return { granted, union, grant, unrecognized };
|
|
1592
|
+
}
|
|
1593
|
+
function seatTeamApps(input) {
|
|
1594
|
+
return ordered(teamSide(input.teams, input.accountGrant, input.accountPreLaunch).granted);
|
|
1595
|
+
}
|
|
1596
|
+
function seatAppAccess(input) {
|
|
1597
|
+
const side = teamSide(input.teams, input.accountGrant, input.accountPreLaunch);
|
|
1598
|
+
const app = platformAppById(input.app);
|
|
1599
|
+
const teamAllows = app !== null && side.granted.has(app.id);
|
|
1600
|
+
const auth0Allows = input.auth0Allows === true;
|
|
1601
|
+
const via = auth0Allows && teamAllows ? "both" : auth0Allows ? "auth0" : teamAllows ? "teams" : "none";
|
|
1602
|
+
return {
|
|
1603
|
+
allowed: auth0Allows || teamAllows,
|
|
1604
|
+
via,
|
|
1605
|
+
app: app ? toolCode(app.id) : null,
|
|
1606
|
+
teamAllows,
|
|
1607
|
+
teamApps: ordered(side.granted),
|
|
1608
|
+
teamUnion: ordered(side.union),
|
|
1609
|
+
accountGrant: side.grant ? ordered(side.grant) : null,
|
|
1610
|
+
unrecognized: side.unrecognized
|
|
1611
|
+
};
|
|
1612
|
+
}
|
|
1464
1613
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1465
1614
|
0 && (module.exports = {
|
|
1466
1615
|
CORE_FUNCTION_DEFAULT_BOUNDS,
|
|
@@ -1474,6 +1623,7 @@ function viewingComponentOpen(access, homeRow, scope) {
|
|
|
1474
1623
|
VIEWING_LEVEL_FUNCTIONS,
|
|
1475
1624
|
VIEWING_POLICY_SPECIES,
|
|
1476
1625
|
VIEWING_POLICY_VOCABULARIES,
|
|
1626
|
+
accountAppGrant,
|
|
1477
1627
|
canonicalRoleCode,
|
|
1478
1628
|
caseSurfacesAsStub,
|
|
1479
1629
|
caseSurfacesOn,
|
|
@@ -1487,6 +1637,8 @@ function viewingComponentOpen(access, homeRow, scope) {
|
|
|
1487
1637
|
resolveEffectiveFunctions,
|
|
1488
1638
|
resolveEffectiveViewingLevel,
|
|
1489
1639
|
resolveViewingPolicy,
|
|
1640
|
+
seatAppAccess,
|
|
1641
|
+
seatTeamApps,
|
|
1490
1642
|
selectActingTeamId,
|
|
1491
1643
|
teamViewingLevelFromPolicy,
|
|
1492
1644
|
unavailableViewingPolicy,
|