@htilabs/platform-common-models 0.42.0 → 0.42.1
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 +18 -0
- package/dist/{index-uz57Fic9.d.ts → index-BHSRMJvd.d.ts} +1 -1
- package/dist/{index-1pWiqEBC.d.cts → index-DF469Qgd.d.cts} +1 -1
- package/dist/index.cjs +10 -10
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +10 -10
- 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 +10 -10
- package/dist/sharing-ceiling/index.cjs.map +1 -1
- package/dist/sharing-ceiling/index.d.cts +9 -2
- package/dist/sharing-ceiling/index.d.ts +9 -2
- package/dist/sharing-ceiling/index.js +10 -10
- package/dist/sharing-ceiling/index.js.map +1 -1
- package/package.json +1 -1
- package/src/sharingCeiling/__tests__/resolveShare.test.ts +114 -0
- package/src/sharingCeiling/resolve.ts +32 -17
- package/dist/{cvcEntry-DAuhe0cd.d.cts → cvcEntry-DQEoFVL2.d.cts} +8 -8
- package/dist/{cvcEntry-DAuhe0cd.d.ts → cvcEntry-DQEoFVL2.d.ts} +8 -8
|
@@ -624,10 +624,17 @@ interface ShareCategoryEntry {
|
|
|
624
624
|
} | null;
|
|
625
625
|
/** Rows under the platform safety floor — never leave. */
|
|
626
626
|
readonly floorItems: string[];
|
|
627
|
-
/**
|
|
627
|
+
/**
|
|
628
|
+
* Rows the governing list / the account's heightened toggles / the ceiling leave out. A code is
|
|
629
|
+
* withheld when it OR AN ANCESTOR is listed here. Since 0.42.1 a grouping is listed only when
|
|
630
|
+
* nothing beneath it is covered — when a list names some of its rows, the grouping is NOT listed
|
|
631
|
+
* and its uncovered rows are listed one by one instead. So a grouping code's absence here does
|
|
632
|
+
* not mean the whole grouping may leave: for a send decision read `shareRowCeiling` +
|
|
633
|
+
* `rowsOverCeiling`, never a grouping-code check against `excludedItems` alone.
|
|
634
|
+
*/
|
|
628
635
|
readonly excludedItems: string[];
|
|
629
636
|
readonly excludedReason: string | null;
|
|
630
|
-
/** Rows the sending team's own policy leaves out (5d). */
|
|
637
|
+
/** Rows the sending team's own policy leaves out (5d). Same shape and same caveat as `excludedItems`. */
|
|
631
638
|
readonly teamExcludedItems: string[];
|
|
632
639
|
readonly teamExcludedReason: string | null;
|
|
633
640
|
}
|
|
@@ -624,10 +624,17 @@ interface ShareCategoryEntry {
|
|
|
624
624
|
} | null;
|
|
625
625
|
/** Rows under the platform safety floor — never leave. */
|
|
626
626
|
readonly floorItems: string[];
|
|
627
|
-
/**
|
|
627
|
+
/**
|
|
628
|
+
* Rows the governing list / the account's heightened toggles / the ceiling leave out. A code is
|
|
629
|
+
* withheld when it OR AN ANCESTOR is listed here. Since 0.42.1 a grouping is listed only when
|
|
630
|
+
* nothing beneath it is covered — when a list names some of its rows, the grouping is NOT listed
|
|
631
|
+
* and its uncovered rows are listed one by one instead. So a grouping code's absence here does
|
|
632
|
+
* not mean the whole grouping may leave: for a send decision read `shareRowCeiling` +
|
|
633
|
+
* `rowsOverCeiling`, never a grouping-code check against `excludedItems` alone.
|
|
634
|
+
*/
|
|
628
635
|
readonly excludedItems: string[];
|
|
629
636
|
readonly excludedReason: string | null;
|
|
630
|
-
/** Rows the sending team's own policy leaves out (5d). */
|
|
637
|
+
/** Rows the sending team's own policy leaves out (5d). Same shape and same caveat as `excludedItems`. */
|
|
631
638
|
readonly teamExcludedItems: string[];
|
|
632
639
|
readonly teamExcludedReason: string | null;
|
|
633
640
|
}
|
|
@@ -936,6 +936,9 @@ function resolveShare(input) {
|
|
|
936
936
|
let excludedReason = null;
|
|
937
937
|
const teamExcludedItems = [];
|
|
938
938
|
let teamExcludedReason = null;
|
|
939
|
+
const outside = (covered) => items.filter(
|
|
940
|
+
(r) => !covered(r) && !items.some((d) => d !== r && covered(d) && scope.ancestorsOf(d).includes(r))
|
|
941
|
+
);
|
|
939
942
|
const addExcluded = (rows, why) => {
|
|
940
943
|
for (const r of rows)
|
|
941
944
|
if (!floorItems.includes(r) && !excludedItems.includes(r))
|
|
@@ -971,7 +974,7 @@ function resolveShare(input) {
|
|
|
971
974
|
}
|
|
972
975
|
if (allowed && !req && groupCeiling !== null && !scopeListStrictlyCovers(scope, groupCeiling, g)) {
|
|
973
976
|
addExcluded(
|
|
974
|
-
|
|
977
|
+
outside((r) => scopeListCovers(scope, groupCeiling, g, r)),
|
|
975
978
|
"Outside the payload for this purpose"
|
|
976
979
|
);
|
|
977
980
|
}
|
|
@@ -982,17 +985,16 @@ function resolveShare(input) {
|
|
|
982
985
|
}
|
|
983
986
|
if (allowed && !req && polScopeBinds && !scopeListStrictlyCovers(scope, govList, g)) {
|
|
984
987
|
addExcluded(
|
|
985
|
-
|
|
988
|
+
outside((r) => scopeListCovers(scope, govList, g, r)),
|
|
986
989
|
`Outside what the \u201C${govName}\u201D policy allows for this purpose`
|
|
987
990
|
);
|
|
988
991
|
}
|
|
989
992
|
const govRows = polScopeBinds ? own2(govItems, g) : void 0;
|
|
990
993
|
if (allowed && !req && isStringList2(govRows)) {
|
|
991
994
|
const keep = new Set(govRows);
|
|
995
|
+
const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
|
|
992
996
|
addExcluded(
|
|
993
|
-
|
|
994
|
-
(r) => !keep.has(r) && !scope.ancestorsOf(r).some((a) => a !== g && keep.has(a))
|
|
995
|
-
),
|
|
997
|
+
outside(kept),
|
|
996
998
|
`Outside what the \u201C${govName}\u201D policy allows for this purpose`
|
|
997
999
|
);
|
|
998
1000
|
}
|
|
@@ -1005,15 +1007,13 @@ function resolveShare(input) {
|
|
|
1005
1007
|
const why = `Outside what your team's \u201C${tcNamed?.name}\u201D policy allows`;
|
|
1006
1008
|
const outRows = /* @__PURE__ */ new Set();
|
|
1007
1009
|
if (tcScope !== null && !scopeListStrictlyCovers(scope, tcScope, g)) {
|
|
1008
|
-
for (const r of
|
|
1009
|
-
if (!scopeListCovers(scope, tcScope, g, r)) outRows.add(r);
|
|
1010
|
+
for (const r of outside((x) => scopeListCovers(scope, tcScope, g, x))) outRows.add(r);
|
|
1010
1011
|
}
|
|
1011
1012
|
const tcRows = own2(tcItems, g);
|
|
1012
1013
|
if (isStringList2(tcRows)) {
|
|
1013
1014
|
const keep = new Set(tcRows);
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
outRows.add(r);
|
|
1015
|
+
const kept = (r) => keep.has(r) || scope.ancestorsOf(r).some((a) => a !== g && keep.has(a));
|
|
1016
|
+
for (const r of outside(kept)) outRows.add(r);
|
|
1017
1017
|
}
|
|
1018
1018
|
for (const r of outRows)
|
|
1019
1019
|
if (!floorItems.includes(r) && !excludedItems.includes(r))
|