@htilabs/platform-common-models 0.59.0 → 0.61.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 +90 -1
- package/dist/index.cjs +91 -13
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +91 -13
- package/dist/index.js.map +1 -1
- package/dist/org-directory/index.cjs +5 -4
- package/dist/org-directory/index.cjs.map +1 -1
- package/dist/org-directory/index.d.cts +15 -7
- package/dist/org-directory/index.d.ts +15 -7
- package/dist/org-directory/index.js +5 -4
- package/dist/org-directory/index.js.map +1 -1
- package/dist/points-of-contact/index.cjs +4 -3
- package/dist/points-of-contact/index.cjs.map +1 -1
- package/dist/points-of-contact/index.js +4 -3
- package/dist/points-of-contact/index.js.map +1 -1
- package/dist/schemas/index.cjs +10 -6
- package/dist/schemas/index.cjs.map +1 -1
- package/dist/schemas/index.d.cts +8 -4
- package/dist/schemas/index.d.ts +8 -4
- package/dist/schemas/index.js +10 -6
- package/dist/schemas/index.js.map +1 -1
- package/dist/sharing-ceiling/index.cjs +81 -7
- package/dist/sharing-ceiling/index.cjs.map +1 -1
- package/dist/sharing-ceiling/index.d.cts +64 -4
- package/dist/sharing-ceiling/index.d.ts +64 -4
- package/dist/sharing-ceiling/index.js +81 -7
- package/dist/sharing-ceiling/index.js.map +1 -1
- package/package.json +1 -1
- package/src/orgDirectory/__tests__/orgRecord.test.ts +6 -3
- package/src/orgDirectory/orgRecord.ts +14 -6
- package/src/orgDirectory/rules.ts +3 -2
- package/src/schemas/organization.ts +7 -4
- package/src/sharingCeiling/__tests__/resolveShare.purposeRule.test.ts +836 -0
- package/src/sharingCeiling/index.ts +4 -0
- package/src/sharingCeiling/resolve.ts +219 -15
package/dist/index.js
CHANGED
|
@@ -17779,12 +17779,13 @@ var ORG_RECORD_FIELD_NAMES = Object.freeze([
|
|
|
17779
17779
|
"vspPrivateNonprofit",
|
|
17780
17780
|
"reviewStatus",
|
|
17781
17781
|
"addedInApp",
|
|
17782
|
-
"
|
|
17783
|
-
"addedInSession"
|
|
17782
|
+
"addedBy"
|
|
17784
17783
|
]);
|
|
17785
17784
|
var ORG_AS_BUILT_FIELD_NAMES = Object.freeze([
|
|
17786
17785
|
"requiresROI",
|
|
17787
17786
|
"isCustom",
|
|
17787
|
+
"addedByUserId",
|
|
17788
|
+
"addedInSession",
|
|
17788
17789
|
"division",
|
|
17789
17790
|
"typeOverride",
|
|
17790
17791
|
"typeKey"
|
|
@@ -17876,13 +17877,15 @@ var orgRecordSchemaDefinition = {
|
|
|
17876
17877
|
/** The app it was added in (`thread`, `pave`, `leads`, `platform`). */
|
|
17877
17878
|
addedInApp: { type: String },
|
|
17878
17879
|
/** The adding user's platform `users._id`. */
|
|
17879
|
-
|
|
17880
|
-
addedInSession: { type: String }
|
|
17880
|
+
addedBy: { type: String }
|
|
17881
17881
|
};
|
|
17882
17882
|
var orgAsBuiltSchemaDefinition = {
|
|
17883
17883
|
/** Informational only: the release check reads the sender's `vsp` (GDR § 5.17 clause 2). */
|
|
17884
17884
|
requiresROI: { type: Boolean },
|
|
17885
17885
|
isCustom: { type: Boolean },
|
|
17886
|
+
/** The pre-0.60 spelling of `addedBy`; PAVE 2.0 rows carry it. */
|
|
17887
|
+
addedByUserId: { type: String },
|
|
17888
|
+
addedInSession: { type: String },
|
|
17886
17889
|
division: { type: String },
|
|
17887
17890
|
typeOverride: { type: String },
|
|
17888
17891
|
/** The CVC-48 key PAVE writes beside a numeric `type`; retires with the type migration. */
|
|
@@ -17907,10 +17910,11 @@ var EXPECTED_INSTANCE = {
|
|
|
17907
17910
|
vspPrivateNonprofit: "Boolean",
|
|
17908
17911
|
reviewStatus: "String",
|
|
17909
17912
|
addedInApp: "String",
|
|
17910
|
-
|
|
17911
|
-
addedInSession: "String",
|
|
17913
|
+
addedBy: "String",
|
|
17912
17914
|
requiresROI: "Boolean",
|
|
17913
17915
|
isCustom: "Boolean",
|
|
17916
|
+
addedByUserId: "String",
|
|
17917
|
+
addedInSession: "String",
|
|
17914
17918
|
division: "String",
|
|
17915
17919
|
typeOverride: "String",
|
|
17916
17920
|
typeKey: "String"
|
|
@@ -25415,8 +25419,31 @@ function resolveShare(input) {
|
|
|
25415
25419
|
};
|
|
25416
25420
|
}
|
|
25417
25421
|
}
|
|
25422
|
+
let fork = null;
|
|
25418
25423
|
if (gov === null && !inside && purposeKnown && recipientKey !== null) {
|
|
25419
25424
|
gov = hit(cell(att.relationships, recipientKey), "relationship");
|
|
25425
|
+
const rule = input.partnerPurposeRule;
|
|
25426
|
+
const rulePosture2 = rule?.posture;
|
|
25427
|
+
if (gov === null && recipient.kind === "partner" && // `__external__` stays scope-only (data.js L55333)
|
|
25428
|
+
(rulePosture2 === "open" || rulePosture2 === "approval" || rulePosture2 === "blocked")) {
|
|
25429
|
+
const partnerName = typeof rule?.partnerName === "string" && rule.partnerName !== "" ? rule.partnerName : recipientKey;
|
|
25430
|
+
fork = {
|
|
25431
|
+
policy: {
|
|
25432
|
+
id: `pol-bp-${recipientKey}-${purpose}`,
|
|
25433
|
+
name: `${purposeLabel} \u2014 ${partnerName} variant`,
|
|
25434
|
+
purpose,
|
|
25435
|
+
posture: rulePosture2,
|
|
25436
|
+
infoScope: null,
|
|
25437
|
+
cadences: null,
|
|
25438
|
+
version: 1,
|
|
25439
|
+
origin: { kind: "fork" },
|
|
25440
|
+
edited: true
|
|
25441
|
+
},
|
|
25442
|
+
level: "relationship",
|
|
25443
|
+
version: 1,
|
|
25444
|
+
rulePath: `policies.partnerOverrides[${recipientKey}].byPurpose[${purpose}] (purpose-specific rule, reported as its fork)`
|
|
25445
|
+
};
|
|
25446
|
+
}
|
|
25420
25447
|
if (gov === null)
|
|
25421
25448
|
gov = hit(own3(att.agencyDefaults, purpose), "agency_default");
|
|
25422
25449
|
if (gov === null && pd !== null) {
|
|
@@ -25438,18 +25465,36 @@ function resolveShare(input) {
|
|
|
25438
25465
|
};
|
|
25439
25466
|
}
|
|
25440
25467
|
}
|
|
25468
|
+
let defaultProjection = null;
|
|
25469
|
+
let defaultItems = null;
|
|
25470
|
+
if (fork !== null) {
|
|
25471
|
+
if (gov !== null && gov.level === "agency_default" && gov.policy.edited === true) {
|
|
25472
|
+
if (isStringList2(gov.policy.infoScope))
|
|
25473
|
+
defaultProjection = [...gov.policy.infoScope];
|
|
25474
|
+
const items = copyItems(gov.policy.infoScopeItems);
|
|
25475
|
+
if (items !== null)
|
|
25476
|
+
defaultItems = {
|
|
25477
|
+
rows: items,
|
|
25478
|
+
name: typeof gov.policy.name === "string" ? gov.policy.name : gov.policy.id
|
|
25479
|
+
};
|
|
25480
|
+
}
|
|
25481
|
+
gov = fork;
|
|
25482
|
+
}
|
|
25483
|
+
const rulePosture = input.partnerPurposeRule?.posture;
|
|
25484
|
+
const ruleAuthored = !inside && recipient.kind === "partner" && (rulePosture === "open" || rulePosture === "approval" || rulePosture === "blocked");
|
|
25441
25485
|
let tc = null;
|
|
25442
25486
|
if (teamId !== null && gov !== null) {
|
|
25443
25487
|
const t = hit(cell(att.teams, teamId), "team");
|
|
25444
25488
|
if (t !== null && t.policy.id !== gov.policy.id) tc = t;
|
|
25445
25489
|
}
|
|
25446
|
-
const govNamed = gov === null ? null : named(gov);
|
|
25490
|
+
const govNamed = gov === null ? null : fork !== null ? { ...named(gov), virtual: true } : named(gov);
|
|
25447
25491
|
const tcNamed = tc === null ? null : named(tc);
|
|
25448
25492
|
const rulePath = gov === null ? `no Platform default for purpose \u201C${purpose}\u201D \u2014 nothing governs (fails closed)` : tc === null ? gov.rulePath : `${gov.rulePath} \u2229 ${tc.rulePath} (the sending team's own policy is a ceiling \u2014 only what both allow)`;
|
|
25449
|
-
let posture = input.relationshipPosture === "approval" || input.relationshipPosture === "blocked" ? input.relationshipPosture : "open";
|
|
25493
|
+
let posture = ruleAuthored && rulePosture !== void 0 ? rulePosture : input.relationshipPosture === "approval" || input.relationshipPosture === "blocked" ? input.relationshipPosture : "open";
|
|
25450
25494
|
let postureSource = "relationship";
|
|
25451
25495
|
let posturePol = null;
|
|
25452
|
-
if (
|
|
25496
|
+
if (fork === null && // data.js L55391: a virtual policy's posture is never applied
|
|
25497
|
+
govNamed?.posture && SHARE_POSTURE_RANK[govNamed.posture] > SHARE_POSTURE_RANK[posture]) {
|
|
25453
25498
|
posture = govNamed.posture;
|
|
25454
25499
|
postureSource = "policy";
|
|
25455
25500
|
posturePol = govNamed;
|
|
@@ -25474,11 +25519,22 @@ function resolveShare(input) {
|
|
|
25474
25519
|
} else if (posture === "blocked") {
|
|
25475
25520
|
const pol = posturePol;
|
|
25476
25521
|
const path = pol === null ? "relationship posture = blocked" : `sharingPurposePolicies[${pol.id}].posture=blocked (policy \u201C${pol.name}\u201D \u2014 ${pol.levelLabel})`;
|
|
25477
|
-
|
|
25522
|
+
const byRule = ruleAuthored && postureSource === "relationship";
|
|
25523
|
+
if (report && byRule) {
|
|
25524
|
+
reportCarveOut = {
|
|
25525
|
+
note: "Partner is blocked for ordinary sharing \u2014 reachable for reports",
|
|
25526
|
+
rulePath: `reports-never-blocked-at-partner-layer (Crysta ruling 2026-08-23; policies.partnerOverrides[${recipientKey}].byPurpose[${purpose}].sharingPosture=blocked does not bind a legal duty \u2014 who may send is a role/function question)`
|
|
25527
|
+
};
|
|
25528
|
+
} else if (report) {
|
|
25478
25529
|
reportCarveOut = {
|
|
25479
25530
|
note: pol === null ? "Blocked for ordinary sharing \u2014 reachable for reports (nothing at the partner layer extinguishes the duty)" : `The \u201C${pol.name}\u201D policy blocks ordinary sharing \u2014 reachable for reports`,
|
|
25480
25531
|
rulePath: path
|
|
25481
25532
|
};
|
|
25533
|
+
} else if (byRule) {
|
|
25534
|
+
excluded = {
|
|
25535
|
+
reason: "Partner is blocked for this purpose by your account's sharing policy",
|
|
25536
|
+
rulePath: `policies.partnerOverrides[${recipientKey}].byPurpose[${purpose}].sharingPosture=blocked (Share Partners \u2014 purpose-specific rule)`
|
|
25537
|
+
};
|
|
25482
25538
|
} else {
|
|
25483
25539
|
excluded = {
|
|
25484
25540
|
reason: pol === null ? "Blocked for this purpose by the relationship" : `Blocked for this purpose by your account's \u201C${pol.name}\u201D policy`,
|
|
@@ -25491,9 +25547,11 @@ function resolveShare(input) {
|
|
|
25491
25547
|
const govList = govNamed?.infoScope ?? null;
|
|
25492
25548
|
const polScopeBinds = gov !== null && Array.isArray(govList) && (level === "team_row" || level === "relationship" || level === "account_internal" || level === "inside_starter" || level === "agency_default" && gov.policy.edited === true);
|
|
25493
25549
|
const legacy = legacyCeilingList(input.legacyCeiling);
|
|
25494
|
-
const
|
|
25495
|
-
|
|
25496
|
-
|
|
25550
|
+
const projectionPath = `policies.sharingScopeEdits[__default__][${purpose}] (projected from your account default policy)`;
|
|
25551
|
+
const projOverLegacy = legacy !== null ? defaultProjection : null;
|
|
25552
|
+
const ceilingIsStarter = legacy === null && defaultProjection === null;
|
|
25553
|
+
let groupCeiling = legacy ?? defaultProjection ?? pdRaw;
|
|
25554
|
+
let ceilingPath = legacy !== null ? "sharingScopeEdits (the account's partner / default rule \u2014 the legacy cell chain)" : defaultProjection !== null ? projectionPath : pd === null ? "no Platform default" : `pol-starter-${purpose} v${pd.version} (Platform default \u2014 the starting scope for this purpose)`;
|
|
25497
25555
|
if (ceilingIsStarter && polScopeBinds) {
|
|
25498
25556
|
groupCeiling = null;
|
|
25499
25557
|
ceilingPath = "";
|
|
@@ -25595,6 +25653,17 @@ function resolveShare(input) {
|
|
|
25595
25653
|
`Outside what the \u201C${govName}\u201D policy allows for this purpose`
|
|
25596
25654
|
);
|
|
25597
25655
|
}
|
|
25656
|
+
if (allowed && !req && projOverLegacy !== null && !scopeListCovers(scope, projOverLegacy, g)) {
|
|
25657
|
+
allowed = false;
|
|
25658
|
+
reason = "Outside the payload for this purpose";
|
|
25659
|
+
path = projectionPath;
|
|
25660
|
+
}
|
|
25661
|
+
if (allowed && !req && projOverLegacy !== null && !scopeListStrictlyCovers(scope, projOverLegacy, g)) {
|
|
25662
|
+
addExcluded(
|
|
25663
|
+
outside((r) => scopeListCovers(scope, projOverLegacy, g, r)),
|
|
25664
|
+
"Outside the payload for this purpose"
|
|
25665
|
+
);
|
|
25666
|
+
}
|
|
25598
25667
|
const govRows = polScopeBinds ? own3(govItems, g) : void 0;
|
|
25599
25668
|
if (allowed && !req && isStringList2(govRows)) {
|
|
25600
25669
|
const keep = new Set(govRows);
|
|
@@ -25604,6 +25673,15 @@ function resolveShare(input) {
|
|
|
25604
25673
|
`Outside what the \u201C${govName}\u201D policy allows for this purpose`
|
|
25605
25674
|
);
|
|
25606
25675
|
}
|
|
25676
|
+
const defRows = defaultItems === null ? void 0 : own3(defaultItems.rows, g);
|
|
25677
|
+
if (allowed && !req && isStringList2(defRows)) {
|
|
25678
|
+
const keep = new Set(defRows);
|
|
25679
|
+
const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
|
|
25680
|
+
addExcluded(
|
|
25681
|
+
outside(kept),
|
|
25682
|
+
`Outside what the \u201C${defaultItems?.name ?? ""}\u201D policy allows for this purpose`
|
|
25683
|
+
);
|
|
25684
|
+
}
|
|
25607
25685
|
if (allowed && !req && tcScope !== null && !scopeListCovers(scope, tcScope, g)) {
|
|
25608
25686
|
allowed = false;
|
|
25609
25687
|
reason = `Outside what your team's \u201C${tcNamed?.name}\u201D policy allows`;
|