@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
package/dist/models/index.d.cts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-
|
|
1
|
+
export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-DAuhe0cd.cjs';
|
|
2
2
|
import 'mongoose';
|
|
3
|
-
export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-
|
|
3
|
+
export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-1pWiqEBC.cjs';
|
package/dist/models/index.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-
|
|
1
|
+
export { a as CvcEntry, b as CvcRegistry, F as Form, P as PlatformFunction, d as PlatformRole, Q as Question, f as ScoringRule, h as Section } from '../cvcEntry-DAuhe0cd.js';
|
|
2
2
|
import 'mongoose';
|
|
3
|
-
export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-
|
|
3
|
+
export { C as CvcEntryDoc, a as CvcRegistryDoc, F as FormDoc, P as PlatformFunctionDoc, b as PlatformModels, c as PlatformRoleDoc, Q as QuestionDoc, S as ScoringRuleDoc, d as SectionDoc, g as createPlatformModels, h as cvcEntryModel, i as cvcRegistryModel, j as formModel, p as platformFunctionModel, k as platformRoleModel, q as questionModel, s as scoringRuleModel, l as sectionModel } from '../index-uz57Fic9.js';
|
package/dist/schemas/index.d.cts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as mongoose from 'mongoose';
|
|
2
2
|
import { InferRawDocType, Schema } from 'mongoose';
|
|
3
|
-
export { C as Choice, a as CvcEntry, b as CvcRegistry, F as Form, c as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, d as PlatformRole, Q as Question, S as ScoringCondition, e as ScoringRecommendation, f as ScoringRule, g as ScoringThreshold, h as Section, i as SectionQuestionRef, V as VisibilityRule, j as buildCvcEntrySchema, k as buildCvcRegistrySchema, l as buildFormSchema, m as buildPlatformFunctionSchema, n as buildPlatformRoleSchema, o as buildQuestionSchema, p as buildScoringRuleSchema, q as buildSectionSchema, r as choiceSchema, s as cvcEntrySchemaDefinition, t as cvcEntrySchemaOptions, u as cvcRegistrySchemaDefinition, v as cvcRegistrySchemaOptions, w as formSchemaDefinition, x as formSchemaOptions, y as formSectionRefSchema, z as guidanceSchema, A as layoutSchema, B as platformFunctionSchemaDefinition, D as platformFunctionSchemaOptions, E as platformRoleSchemaDefinition, H as platformRoleSchemaOptions, I as questionSchemaDefinition, J as questionSchemaOptions, K as scoringConditionSchema, M as scoringRecommendationSchema, N as scoringRuleSchemaDefinition, O as scoringRuleSchemaOptions, R as scoringThresholdSchema, T as sectionQuestionRefSchema, U as sectionSchemaDefinition, W as sectionSchemaOptions, X as visibilityRuleSchema } from '../cvcEntry-
|
|
3
|
+
export { C as Choice, a as CvcEntry, b as CvcRegistry, F as Form, c as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, d as PlatformRole, Q as Question, S as ScoringCondition, e as ScoringRecommendation, f as ScoringRule, g as ScoringThreshold, h as Section, i as SectionQuestionRef, V as VisibilityRule, j as buildCvcEntrySchema, k as buildCvcRegistrySchema, l as buildFormSchema, m as buildPlatformFunctionSchema, n as buildPlatformRoleSchema, o as buildQuestionSchema, p as buildScoringRuleSchema, q as buildSectionSchema, r as choiceSchema, s as cvcEntrySchemaDefinition, t as cvcEntrySchemaOptions, u as cvcRegistrySchemaDefinition, v as cvcRegistrySchemaOptions, w as formSchemaDefinition, x as formSchemaOptions, y as formSectionRefSchema, z as guidanceSchema, A as layoutSchema, B as platformFunctionSchemaDefinition, D as platformFunctionSchemaOptions, E as platformRoleSchemaDefinition, H as platformRoleSchemaOptions, I as questionSchemaDefinition, J as questionSchemaOptions, K as scoringConditionSchema, M as scoringRecommendationSchema, N as scoringRuleSchemaDefinition, O as scoringRuleSchemaOptions, R as scoringThresholdSchema, T as sectionQuestionRefSchema, U as sectionSchemaDefinition, W as sectionSchemaOptions, X as visibilityRuleSchema } from '../cvcEntry-DAuhe0cd.cjs';
|
|
4
4
|
import { a as AddAgencyOrgTypeFieldsOptions } from '../agency-BXvE4yWu.cjs';
|
|
5
5
|
export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, b as AgencyOrgTypeFields, O as ORG_TYPE_FIELD_NAMES, c as OrgTypeFieldName, d as OrgTypeFields, e as OrgTypeFieldsHolder, V as VSP_TWO_STEP_ISSUE, f as addAgencyOrgTypeFields, g as addOrgTypeFields, h as agencyOrgTypeSchemaDefinition, i as applyRunValidatorsIfUnset, j as installVspTwoStepHooks, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, k as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, l as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, n as vspTwoStepHoldsOnUpdate } from '../agency-BXvE4yWu.cjs';
|
|
6
6
|
export { P as PROGRAM_REVIEW_STATUS, a as PROGRAM_REVIEW_STATUS_VALUES, b as ProgramReviewStatus, i as isLiveOrganizationProgram, c as isProgramReviewStatus } from '../vocabulary-Cxhi9EGt.cjs';
|
package/dist/schemas/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as mongoose from 'mongoose';
|
|
2
2
|
import { InferRawDocType, Schema } from 'mongoose';
|
|
3
|
-
export { C as Choice, a as CvcEntry, b as CvcRegistry, F as Form, c as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, d as PlatformRole, Q as Question, S as ScoringCondition, e as ScoringRecommendation, f as ScoringRule, g as ScoringThreshold, h as Section, i as SectionQuestionRef, V as VisibilityRule, j as buildCvcEntrySchema, k as buildCvcRegistrySchema, l as buildFormSchema, m as buildPlatformFunctionSchema, n as buildPlatformRoleSchema, o as buildQuestionSchema, p as buildScoringRuleSchema, q as buildSectionSchema, r as choiceSchema, s as cvcEntrySchemaDefinition, t as cvcEntrySchemaOptions, u as cvcRegistrySchemaDefinition, v as cvcRegistrySchemaOptions, w as formSchemaDefinition, x as formSchemaOptions, y as formSectionRefSchema, z as guidanceSchema, A as layoutSchema, B as platformFunctionSchemaDefinition, D as platformFunctionSchemaOptions, E as platformRoleSchemaDefinition, H as platformRoleSchemaOptions, I as questionSchemaDefinition, J as questionSchemaOptions, K as scoringConditionSchema, M as scoringRecommendationSchema, N as scoringRuleSchemaDefinition, O as scoringRuleSchemaOptions, R as scoringThresholdSchema, T as sectionQuestionRefSchema, U as sectionSchemaDefinition, W as sectionSchemaOptions, X as visibilityRuleSchema } from '../cvcEntry-
|
|
3
|
+
export { C as Choice, a as CvcEntry, b as CvcRegistry, F as Form, c as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, d as PlatformRole, Q as Question, S as ScoringCondition, e as ScoringRecommendation, f as ScoringRule, g as ScoringThreshold, h as Section, i as SectionQuestionRef, V as VisibilityRule, j as buildCvcEntrySchema, k as buildCvcRegistrySchema, l as buildFormSchema, m as buildPlatformFunctionSchema, n as buildPlatformRoleSchema, o as buildQuestionSchema, p as buildScoringRuleSchema, q as buildSectionSchema, r as choiceSchema, s as cvcEntrySchemaDefinition, t as cvcEntrySchemaOptions, u as cvcRegistrySchemaDefinition, v as cvcRegistrySchemaOptions, w as formSchemaDefinition, x as formSchemaOptions, y as formSectionRefSchema, z as guidanceSchema, A as layoutSchema, B as platformFunctionSchemaDefinition, D as platformFunctionSchemaOptions, E as platformRoleSchemaDefinition, H as platformRoleSchemaOptions, I as questionSchemaDefinition, J as questionSchemaOptions, K as scoringConditionSchema, M as scoringRecommendationSchema, N as scoringRuleSchemaDefinition, O as scoringRuleSchemaOptions, R as scoringThresholdSchema, T as sectionQuestionRefSchema, U as sectionSchemaDefinition, W as sectionSchemaOptions, X as visibilityRuleSchema } from '../cvcEntry-DAuhe0cd.js';
|
|
4
4
|
import { a as AddAgencyOrgTypeFieldsOptions } from '../agency-NEW6NOGD.js';
|
|
5
5
|
export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, b as AgencyOrgTypeFields, O as ORG_TYPE_FIELD_NAMES, c as OrgTypeFieldName, d as OrgTypeFields, e as OrgTypeFieldsHolder, V as VSP_TWO_STEP_ISSUE, f as addAgencyOrgTypeFields, g as addOrgTypeFields, h as agencyOrgTypeSchemaDefinition, i as applyRunValidatorsIfUnset, j as installVspTwoStepHooks, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, k as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, l as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, n as vspTwoStepHoldsOnUpdate } from '../agency-NEW6NOGD.js';
|
|
6
6
|
export { P as PROGRAM_REVIEW_STATUS, a as PROGRAM_REVIEW_STATUS_VALUES, b as ProgramReviewStatus, i as isLiveOrganizationProgram, c as isProgramReviewStatus } from '../vocabulary-Cxhi9EGt.js';
|
|
@@ -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)
|