@htilabs/platform-common-models 0.34.0 → 0.36.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 +135 -0
- package/dist/constants/index.cjs +2 -0
- package/dist/constants/index.cjs.map +1 -1
- package/dist/constants/index.js +2 -0
- package/dist/constants/index.js.map +1 -1
- package/dist/{cvcEntry-DAuhe0cd.d.cts → cvcEntry-BqAGctqK.d.cts} +36 -36
- package/dist/{cvcEntry-DAuhe0cd.d.ts → cvcEntry-BqAGctqK.d.ts} +36 -36
- package/dist/{index-1pWiqEBC.d.cts → index-BTqHP4DM.d.cts} +1 -1
- package/dist/{index-uz57Fic9.d.ts → index-Dr6GBCoY.d.ts} +1 -1
- package/dist/index.cjs +2 -0
- 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 +2 -0
- 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/org-directory/index.cjs +4 -3
- package/dist/org-directory/index.cjs.map +1 -1
- package/dist/org-directory/index.d.cts +22 -6
- package/dist/org-directory/index.d.ts +22 -6
- package/dist/org-directory/index.js +4 -3
- package/dist/org-directory/index.js.map +1 -1
- package/dist/points-of-contact/index.cjs +6 -3
- package/dist/points-of-contact/index.cjs.map +1 -1
- package/dist/points-of-contact/index.js +6 -3
- package/dist/points-of-contact/index.js.map +1 -1
- package/dist/schemas/index.d.cts +11 -11
- package/dist/schemas/index.d.ts +11 -11
- package/dist/share-review/index.cjs +301 -0
- package/dist/share-review/index.cjs.map +1 -0
- package/dist/share-review/index.d.cts +431 -0
- package/dist/share-review/index.d.ts +431 -0
- package/dist/share-review/index.js +263 -0
- package/dist/share-review/index.js.map +1 -0
- package/package.json +11 -1
- package/src/__sot__/README.md +2 -0
- package/src/__sot__/captureConflictSemantics.pin.json +156 -0
- package/src/generated/captureConflictSemantics.ts +200 -0
- package/src/orgDirectory/__tests__/orgDirectory.test.ts +60 -0
- package/src/orgDirectory/rules.ts +26 -9
- package/src/pointsOfContact/__tests__/writer.test.ts +15 -0
- package/src/shareReview/__tests__/captureConflictSemantics.test.ts +148 -0
- package/src/shareReview/__tests__/captureConflictSemanticsPin.test.ts +78 -0
- package/src/shareReview/__tests__/recommendedDecision.test.ts +35 -0
- package/src/shareReview/__tests__/reviewDecision.test.ts +102 -0
- package/src/shareReview/__tests__/shareFieldReviewPlan.test.ts +523 -0
- package/src/shareReview/captureConflictSemantics.ts +170 -0
- package/src/shareReview/index.ts +23 -0
- package/src/shareReview/recommendedDecision.ts +21 -0
- package/src/shareReview/reviewDecision.ts +71 -0
- package/src/shareReview/shareFieldReviewPlan.ts +288 -0
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-BqAGctqK.cjs';
|
|
4
4
|
export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, a as AddAgencyOrgTypeFieldsOptions, 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, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, j as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, k as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, l as vspTwoStepHoldsOnUpdate } from '../agency-DYCv839V.cjs';
|
|
5
5
|
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';
|
|
6
6
|
import '../org-type-D_FG4KdN.cjs';
|
|
@@ -32,9 +32,9 @@ declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any,
|
|
|
32
32
|
placeId?: string | null | undefined;
|
|
33
33
|
}, {
|
|
34
34
|
id: string;
|
|
35
|
-
},
|
|
35
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
36
36
|
_id: false;
|
|
37
|
-
}
|
|
37
|
+
}> & Omit<{
|
|
38
38
|
formattedAddress?: string | null | undefined;
|
|
39
39
|
street?: string | null | undefined;
|
|
40
40
|
city?: string | null | undefined;
|
|
@@ -94,9 +94,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
|
|
|
94
94
|
isMononym?: boolean | null | undefined;
|
|
95
95
|
}, {
|
|
96
96
|
id: string;
|
|
97
|
-
},
|
|
97
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
98
98
|
_id: false;
|
|
99
|
-
}
|
|
99
|
+
}> & Omit<{
|
|
100
100
|
alias?: boolean | null | undefined;
|
|
101
101
|
firstName?: string | null | undefined;
|
|
102
102
|
lastName?: string | null | undefined;
|
|
@@ -144,9 +144,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
144
144
|
dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
145
145
|
}, {
|
|
146
146
|
id: string;
|
|
147
|
-
},
|
|
147
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
148
148
|
_id: false;
|
|
149
|
-
}
|
|
149
|
+
}> & Omit<{
|
|
150
150
|
number?: string | null | undefined;
|
|
151
151
|
type?: string | null | undefined;
|
|
152
152
|
safeToContact?: boolean | null | undefined;
|
|
@@ -180,9 +180,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
180
180
|
address?: string | null | undefined;
|
|
181
181
|
}, {
|
|
182
182
|
id: string;
|
|
183
|
-
},
|
|
183
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
184
184
|
_id: false;
|
|
185
|
-
}
|
|
185
|
+
}> & Omit<{
|
|
186
186
|
type?: string | null | undefined;
|
|
187
187
|
safeToContact?: boolean | null | undefined;
|
|
188
188
|
address?: string | null | undefined;
|
|
@@ -254,9 +254,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
254
254
|
ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
255
255
|
}, {
|
|
256
256
|
id: string;
|
|
257
|
-
},
|
|
257
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
258
258
|
_id: false;
|
|
259
|
-
}
|
|
259
|
+
}> & Omit<{
|
|
260
260
|
race: number[];
|
|
261
261
|
ethnicity: number[];
|
|
262
262
|
accommodations: string[];
|
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-BqAGctqK.js';
|
|
4
4
|
export { A as AGENCY_ORG_TYPE_VALIDATED_UPDATE_OPS, a as AddAgencyOrgTypeFieldsOptions, 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, m as mirrorOrgTypeFields, o as orgTypeFieldsDiffer, j as orgTypeSchemaDefinition, r as resolveEffectiveOrgType, k as resolveEffectiveOrgTypeFields, v as vspTwoStepHolds, l as vspTwoStepHoldsOnUpdate } from '../agency-Ca4pCOOf.js';
|
|
5
5
|
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';
|
|
6
6
|
import '../org-type-BYQb9Qzq.js';
|
|
@@ -32,9 +32,9 @@ declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any,
|
|
|
32
32
|
placeId?: string | null | undefined;
|
|
33
33
|
}, {
|
|
34
34
|
id: string;
|
|
35
|
-
},
|
|
35
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
36
36
|
_id: false;
|
|
37
|
-
}
|
|
37
|
+
}> & Omit<{
|
|
38
38
|
formattedAddress?: string | null | undefined;
|
|
39
39
|
street?: string | null | undefined;
|
|
40
40
|
city?: string | null | undefined;
|
|
@@ -94,9 +94,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
|
|
|
94
94
|
isMononym?: boolean | null | undefined;
|
|
95
95
|
}, {
|
|
96
96
|
id: string;
|
|
97
|
-
},
|
|
97
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
98
98
|
_id: false;
|
|
99
|
-
}
|
|
99
|
+
}> & Omit<{
|
|
100
100
|
alias?: boolean | null | undefined;
|
|
101
101
|
firstName?: string | null | undefined;
|
|
102
102
|
lastName?: string | null | undefined;
|
|
@@ -144,9 +144,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
144
144
|
dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
145
145
|
}, {
|
|
146
146
|
id: string;
|
|
147
|
-
},
|
|
147
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
148
148
|
_id: false;
|
|
149
|
-
}
|
|
149
|
+
}> & Omit<{
|
|
150
150
|
number?: string | null | undefined;
|
|
151
151
|
type?: string | null | undefined;
|
|
152
152
|
safeToContact?: boolean | null | undefined;
|
|
@@ -180,9 +180,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
|
|
|
180
180
|
address?: string | null | undefined;
|
|
181
181
|
}, {
|
|
182
182
|
id: string;
|
|
183
|
-
},
|
|
183
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
184
184
|
_id: false;
|
|
185
|
-
}
|
|
185
|
+
}> & Omit<{
|
|
186
186
|
type?: string | null | undefined;
|
|
187
187
|
safeToContact?: boolean | null | undefined;
|
|
188
188
|
address?: string | null | undefined;
|
|
@@ -254,9 +254,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
|
|
|
254
254
|
ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
|
|
255
255
|
}, {
|
|
256
256
|
id: string;
|
|
257
|
-
},
|
|
257
|
+
}, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
|
|
258
258
|
_id: false;
|
|
259
|
-
}
|
|
259
|
+
}> & Omit<{
|
|
260
260
|
race: number[];
|
|
261
261
|
ethnicity: number[];
|
|
262
262
|
accommodations: string[];
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/shareReview/index.ts
|
|
21
|
+
var shareReview_exports = {};
|
|
22
|
+
__export(shareReview_exports, {
|
|
23
|
+
CAPTURE_CONFLICT_SEMANTICS: () => CAPTURE_CONFLICT_SEMANTICS,
|
|
24
|
+
CAPTURE_CONFLICT_SEMANTICS_BY_FIELD: () => CAPTURE_CONFLICT_SEMANTICS_BY_FIELD,
|
|
25
|
+
CAPTURE_CONFLICT_SEMANTICS_SOURCE: () => CAPTURE_CONFLICT_SEMANTICS_SOURCE,
|
|
26
|
+
DISPLAY_CHOICES: () => DISPLAY_CHOICES,
|
|
27
|
+
DISPLAY_REPRESENTATIVE_FIELDS: () => DISPLAY_REPRESENTATIVE_FIELDS,
|
|
28
|
+
REVIEW_DECISIONS: () => REVIEW_DECISIONS,
|
|
29
|
+
canApproveReview: () => canApproveReview,
|
|
30
|
+
isOfferedForRow: () => isOfferedForRow,
|
|
31
|
+
isReviewDecision: () => isReviewDecision,
|
|
32
|
+
planFieldReview: () => planFieldReview,
|
|
33
|
+
recommendedDecision: () => recommendedDecision,
|
|
34
|
+
resolvedSemantics: () => resolvedSemantics
|
|
35
|
+
});
|
|
36
|
+
module.exports = __toCommonJS(shareReview_exports);
|
|
37
|
+
|
|
38
|
+
// src/shareReview/reviewDecision.ts
|
|
39
|
+
var REVIEW_DECISIONS = [
|
|
40
|
+
"add",
|
|
41
|
+
"theirs_current",
|
|
42
|
+
"mine_current",
|
|
43
|
+
"replace",
|
|
44
|
+
"keep_mine",
|
|
45
|
+
"keep_both_flagged",
|
|
46
|
+
"exclude"
|
|
47
|
+
];
|
|
48
|
+
var REVIEW_DECISION_SET = new Set(REVIEW_DECISIONS);
|
|
49
|
+
function isReviewDecision(value) {
|
|
50
|
+
return typeof value === "string" && REVIEW_DECISION_SET.has(value);
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// src/generated/captureConflictSemantics.ts
|
|
54
|
+
var CAPTURE_CONFLICT_SEMANTICS = [
|
|
55
|
+
"additive_log",
|
|
56
|
+
"log_end_date_current",
|
|
57
|
+
"single_value_keep_replace",
|
|
58
|
+
"no_conflict_derived"
|
|
59
|
+
];
|
|
60
|
+
var CAPTURE_CONFLICT_SEMANTICS_BY_FIELD = Object.freeze({
|
|
61
|
+
"capture.accommodation_type_set": "single_value_keep_replace",
|
|
62
|
+
"capture.account_link_role": "single_value_keep_replace",
|
|
63
|
+
"capture.address": "additive_log",
|
|
64
|
+
"capture.address_state": "single_value_keep_replace",
|
|
65
|
+
"capture.age_bin_reporting": "single_value_keep_replace",
|
|
66
|
+
"capture.assessment_capture_status": "single_value_keep_replace",
|
|
67
|
+
"capture.associate_subrole": "single_value_keep_replace",
|
|
68
|
+
"capture.birth_country": "single_value_keep_replace",
|
|
69
|
+
"capture.birth_state": "single_value_keep_replace",
|
|
70
|
+
"capture.case_account_id": "single_value_keep_replace",
|
|
71
|
+
"capture.case_team_id": "single_value_keep_replace",
|
|
72
|
+
"capture.child_custody": "single_value_keep_replace",
|
|
73
|
+
"capture.child_health": "single_value_keep_replace",
|
|
74
|
+
"capture.child_identity": "single_value_keep_replace",
|
|
75
|
+
"capture.child_legal": "single_value_keep_replace",
|
|
76
|
+
"capture.chronic_health_severity": "single_value_keep_replace",
|
|
77
|
+
"capture.citizenship": "additive_log",
|
|
78
|
+
"capture.collection_context": "additive_log",
|
|
79
|
+
"capture.contact_info": "additive_log",
|
|
80
|
+
"capture.contact_info_type": "additive_log",
|
|
81
|
+
"capture.contact_info_use_type": "additive_log",
|
|
82
|
+
"capture.contact_link_role": "single_value_keep_replace",
|
|
83
|
+
"capture.contact_safety_status": "single_value_keep_replace",
|
|
84
|
+
"capture.cooperativeness": "single_value_keep_replace",
|
|
85
|
+
"capture.destination_living_situation": "single_value_keep_replace",
|
|
86
|
+
"capture.education_level": "additive_log",
|
|
87
|
+
"capture.employment_status": "additive_log",
|
|
88
|
+
"capture.encounter_location": "additive_log",
|
|
89
|
+
"capture.english_proficiency": "single_value_keep_replace",
|
|
90
|
+
"capture.exit_reason": "single_value_keep_replace",
|
|
91
|
+
"capture.eye_color": "single_value_keep_replace",
|
|
92
|
+
"capture.facilitator_source_labels": "additive_log",
|
|
93
|
+
"capture.foreign_national": "single_value_keep_replace",
|
|
94
|
+
"capture.funder": "single_value_keep_replace",
|
|
95
|
+
"capture.hair_color": "single_value_keep_replace",
|
|
96
|
+
"capture.has_disability": "single_value_keep_replace",
|
|
97
|
+
"capture.has_tattoos": "single_value_keep_replace",
|
|
98
|
+
"capture.hiv_status": "single_value_keep_replace",
|
|
99
|
+
"capture.hmis_dv_currently_fleeing": "single_value_keep_replace",
|
|
100
|
+
"capture.hmis_dv_survivor": "single_value_keep_replace",
|
|
101
|
+
"capture.hmis_project_type": "single_value_keep_replace",
|
|
102
|
+
"capture.housing_subsidy_type": "log_end_date_current",
|
|
103
|
+
"capture.identification_rung_reached": "single_value_keep_replace",
|
|
104
|
+
"capture.immigration_status": "single_value_keep_replace",
|
|
105
|
+
"capture.income_cadence": "additive_log",
|
|
106
|
+
"capture.income_history": "additive_log",
|
|
107
|
+
"capture.industry_sector": "single_value_keep_replace",
|
|
108
|
+
"capture.involvement_role": "single_value_keep_replace",
|
|
109
|
+
"capture.kinship_basis": "additive_log",
|
|
110
|
+
"capture.lap_screen_result": "single_value_keep_replace",
|
|
111
|
+
"capture.le_report_status": "single_value_keep_replace",
|
|
112
|
+
"capture.legal_action_type": "additive_log",
|
|
113
|
+
"capture.lifecycle_engagement_state": "log_end_date_current",
|
|
114
|
+
"capture.link_end_reason": "additive_log",
|
|
115
|
+
"capture.living_situation": "log_end_date_current",
|
|
116
|
+
"capture.long_term_conditions": "single_value_keep_replace",
|
|
117
|
+
"capture.mental_health_status": "single_value_keep_replace",
|
|
118
|
+
"capture.mid_stay_event_type": "additive_log",
|
|
119
|
+
"capture.name": "additive_log",
|
|
120
|
+
"capture.needs_accommodations": "single_value_keep_replace",
|
|
121
|
+
"capture.non_residential_program_subtype": "single_value_keep_replace",
|
|
122
|
+
"capture.origin_interaction_type": "single_value_keep_replace",
|
|
123
|
+
"capture.participation_role": "additive_log",
|
|
124
|
+
"capture.pet_exit_reason": "single_value_keep_replace",
|
|
125
|
+
"capture.po_service_status": "single_value_keep_replace",
|
|
126
|
+
"capture.preferred_contact_method": "single_value_keep_replace",
|
|
127
|
+
"capture.priorities_safety": "single_value_keep_replace",
|
|
128
|
+
"capture.race_ethnicity": "log_end_date_current",
|
|
129
|
+
"capture.recipient_role": "single_value_keep_replace",
|
|
130
|
+
"capture.record_removal_reason": "additive_log",
|
|
131
|
+
"capture.referral_outcome": "single_value_keep_replace",
|
|
132
|
+
"capture.relationship": "single_value_keep_replace",
|
|
133
|
+
"capture.relationship_dynamics": "additive_log",
|
|
134
|
+
"capture.relationship_status_current": "single_value_keep_replace",
|
|
135
|
+
"capture.relationship_tie": "additive_log",
|
|
136
|
+
"capture.relationship_to_hoh": "single_value_keep_replace",
|
|
137
|
+
"capture.release_case_id": "single_value_keep_replace",
|
|
138
|
+
"capture.release_consent_type": "single_value_keep_replace",
|
|
139
|
+
"capture.release_scope_version": "single_value_keep_replace",
|
|
140
|
+
"capture.release_status": "single_value_keep_replace",
|
|
141
|
+
"capture.reporting_audience": "single_value_keep_replace",
|
|
142
|
+
"capture.residential_program_subtype": "single_value_keep_replace",
|
|
143
|
+
"capture.rural": "single_value_keep_replace",
|
|
144
|
+
"capture.service_delivery_channel": "single_value_keep_replace",
|
|
145
|
+
"capture.service_instance.linked_lifecycle_id": "no_conflict_derived",
|
|
146
|
+
"capture.service_instance.track_id": "no_conflict_derived",
|
|
147
|
+
"capture.service_plan_state": "single_value_keep_replace",
|
|
148
|
+
"capture.service_state": "log_end_date_current",
|
|
149
|
+
"capture.session_account_id": "single_value_keep_replace",
|
|
150
|
+
"capture.session_actor": "single_value_keep_replace",
|
|
151
|
+
"capture.session_ended_at": "single_value_keep_replace",
|
|
152
|
+
"capture.session_personnel": "no_conflict_derived",
|
|
153
|
+
"capture.session_route_state": "single_value_keep_replace",
|
|
154
|
+
"capture.session_signature": "single_value_keep_replace",
|
|
155
|
+
"capture.session_started_at": "single_value_keep_replace",
|
|
156
|
+
"capture.session_state": "single_value_keep_replace",
|
|
157
|
+
"capture.session_template": "single_value_keep_replace",
|
|
158
|
+
"capture.smt_type": "additive_log",
|
|
159
|
+
"capture.substance_use_status": "single_value_keep_replace",
|
|
160
|
+
"capture.survivor_achievement_item": "additive_log",
|
|
161
|
+
"capture.trafficking_relevant_role": "additive_log",
|
|
162
|
+
"capture.tribal_affiliation": "single_value_keep_replace",
|
|
163
|
+
"capture.us_veteran": "single_value_keep_replace",
|
|
164
|
+
"capture.us_veteran_branch": "additive_log",
|
|
165
|
+
"capture.us_veteran_status": "single_value_keep_replace",
|
|
166
|
+
"capture.vehicle_link_role": "single_value_keep_replace",
|
|
167
|
+
"capture.visa_type": "single_value_keep_replace",
|
|
168
|
+
"leads.assertion_car.assertion_domain": "single_value_keep_replace",
|
|
169
|
+
"leads.assertion_car.authored_app": "single_value_keep_replace",
|
|
170
|
+
"leads.assertion_car.handling_flags": "additive_log",
|
|
171
|
+
"leads.assertion_car.recency_band": "single_value_keep_replace",
|
|
172
|
+
"leads.case.closure_reason": "single_value_keep_replace",
|
|
173
|
+
"leads.charge.disposition": "additive_log",
|
|
174
|
+
"leads.criminal_org.category": "single_value_keep_replace",
|
|
175
|
+
"leads.criminal_org.ht_status": "additive_log",
|
|
176
|
+
"leads.deconfliction.ack_action": "single_value_keep_replace",
|
|
177
|
+
"leads.deconfliction.tier": "no_conflict_derived",
|
|
178
|
+
"leads.deconfliction.trigger": "no_conflict_derived",
|
|
179
|
+
"leads.disclosure_record.cui_marking": "no_conflict_derived",
|
|
180
|
+
"leads.lead.agency_record_snapshot": "no_conflict_derived",
|
|
181
|
+
"leads.lead.triage_outcome": "single_value_keep_replace",
|
|
182
|
+
"leads.milestone_snapshot.risk_band": "no_conflict_derived",
|
|
183
|
+
"leads.network.status": "additive_log",
|
|
184
|
+
"leads.person.identity_status": "single_value_keep_replace",
|
|
185
|
+
"leads.person_phase.trigger": "single_value_keep_replace",
|
|
186
|
+
"leads.roi.methods": "single_value_keep_replace",
|
|
187
|
+
"leads.roi.scope": "single_value_keep_replace",
|
|
188
|
+
"leads.share_edge.cadence": "no_conflict_derived",
|
|
189
|
+
"leads.share_edge.channel_state": "single_value_keep_replace",
|
|
190
|
+
"leads.share_edge.delivery_channel": "single_value_keep_replace",
|
|
191
|
+
"leads.share_edge.information_scope": "single_value_keep_replace",
|
|
192
|
+
"leads.share_edge.response_reason": "additive_log",
|
|
193
|
+
"leads.share_edge.review_state": "single_value_keep_replace",
|
|
194
|
+
"leads.sharing_grant.information_scope": "single_value_keep_replace",
|
|
195
|
+
"leads.tip.incident_source_type": "single_value_keep_replace",
|
|
196
|
+
"service_instance.non_client_audiences": "single_value_keep_replace",
|
|
197
|
+
"service_instance.why_not_code": "log_end_date_current",
|
|
198
|
+
"service_instance.why_not_secondary": "log_end_date_current",
|
|
199
|
+
"service_track.case_id": "no_conflict_derived",
|
|
200
|
+
"service_track.completed_confirmation": "single_value_keep_replace",
|
|
201
|
+
"service_track.state_override": "single_value_keep_replace"
|
|
202
|
+
});
|
|
203
|
+
var CAPTURE_CONFLICT_SEMANTICS_SOURCE = Object.freeze({
|
|
204
|
+
repo: "htilabstech/hti-features",
|
|
205
|
+
path: "src/hti_features/field_mapping/registry.json",
|
|
206
|
+
commit: "ed3a1f9",
|
|
207
|
+
registryVersion: 1,
|
|
208
|
+
/** Captured rows in the registry — the denominator for the sparse table. */
|
|
209
|
+
capturedRowCount: 533,
|
|
210
|
+
/** Rows that author a value — the size of the table above. */
|
|
211
|
+
authoredCount: 141
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
// src/shareReview/captureConflictSemantics.ts
|
|
215
|
+
var KEEP_REPLACE_CHOICES = Object.freeze(["replace", "keep_mine", "keep_both_flagged"]);
|
|
216
|
+
var END_DATE_CHOICES = Object.freeze([
|
|
217
|
+
"theirs_current",
|
|
218
|
+
"mine_current",
|
|
219
|
+
"keep_both_flagged"
|
|
220
|
+
]);
|
|
221
|
+
var NO_CHOICES = Object.freeze([]);
|
|
222
|
+
function resolvedSemantics(fieldId) {
|
|
223
|
+
const authoredValue = Object.prototype.hasOwnProperty.call(
|
|
224
|
+
CAPTURE_CONFLICT_SEMANTICS_BY_FIELD,
|
|
225
|
+
fieldId
|
|
226
|
+
) ? CAPTURE_CONFLICT_SEMANTICS_BY_FIELD[fieldId] : void 0;
|
|
227
|
+
const semantics = authoredValue ?? "single_value_keep_replace";
|
|
228
|
+
const producesConflict = semantics !== "additive_log" && semantics !== "no_conflict_derived";
|
|
229
|
+
return {
|
|
230
|
+
semantics,
|
|
231
|
+
authored: authoredValue !== void 0,
|
|
232
|
+
rulePath: authoredValue !== void 0 ? "registry_authored" : "unauthored_default_keep_replace",
|
|
233
|
+
producesConflict,
|
|
234
|
+
choices: !producesConflict ? NO_CHOICES : semantics === "log_end_date_current" ? END_DATE_CHOICES : KEEP_REPLACE_CHOICES
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// src/shareReview/shareFieldReviewPlan.ts
|
|
239
|
+
var DISPLAY_CHOICES = ["keep", "incoming"];
|
|
240
|
+
var DISPLAY_REPRESENTATIVE_FIELDS = /* @__PURE__ */ new Set(["capture.name"]);
|
|
241
|
+
function isOfferedForRow(row, decision) {
|
|
242
|
+
if (typeof decision !== "string") return false;
|
|
243
|
+
if (decision === "exclude") return row.canExclude;
|
|
244
|
+
if (row.bucket === "add") return decision === "add";
|
|
245
|
+
return row.choices.includes(decision);
|
|
246
|
+
}
|
|
247
|
+
function planFieldReview(offers) {
|
|
248
|
+
const adds = [];
|
|
249
|
+
const conflicts = [];
|
|
250
|
+
for (const offer of offers) {
|
|
251
|
+
const semantics = resolvedSemantics(offer.fieldId);
|
|
252
|
+
const competes = offer.targetPopulated === true;
|
|
253
|
+
const isConflict = competes && semantics.producesConflict;
|
|
254
|
+
const bucket = isConflict ? "conflict" : "add";
|
|
255
|
+
const choices = isConflict ? semantics.choices : [];
|
|
256
|
+
const displayQuestion = !isConflict && competes && DISPLAY_REPRESENTATIVE_FIELDS.has(offer.fieldId);
|
|
257
|
+
const rulePath = !competes ? "no_held_value" : isConflict ? "conflict_requires_decision" : semantics.semantics === "no_conflict_derived" ? "derived_never_conflicts" : "additive_never_conflicts";
|
|
258
|
+
const base = {
|
|
259
|
+
offerId: offer.offerId,
|
|
260
|
+
fieldId: offer.fieldId,
|
|
261
|
+
bucket,
|
|
262
|
+
blocking: isConflict && !isOfferedForRow({ bucket, choices, canExclude: true }, offer.decision),
|
|
263
|
+
semantics: semantics.semantics,
|
|
264
|
+
semanticsAuthored: semantics.authored,
|
|
265
|
+
choices,
|
|
266
|
+
rulePath
|
|
267
|
+
};
|
|
268
|
+
const planned = displayQuestion ? { ...base, displayQuestion: true, canExclude: false } : { ...base, displayQuestion: false, canExclude: true };
|
|
269
|
+
if (isConflict) conflicts.push(planned);
|
|
270
|
+
else adds.push(planned);
|
|
271
|
+
}
|
|
272
|
+
return {
|
|
273
|
+
adds,
|
|
274
|
+
conflicts,
|
|
275
|
+
blockingRemaining: conflicts.filter((c) => c.blocking).length
|
|
276
|
+
};
|
|
277
|
+
}
|
|
278
|
+
function canApproveReview(plan) {
|
|
279
|
+
return plan.blockingRemaining === 0;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// src/shareReview/recommendedDecision.ts
|
|
283
|
+
function recommendedDecision(semantics) {
|
|
284
|
+
return semantics === "log_end_date_current" ? "theirs_current" : "replace";
|
|
285
|
+
}
|
|
286
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
287
|
+
0 && (module.exports = {
|
|
288
|
+
CAPTURE_CONFLICT_SEMANTICS,
|
|
289
|
+
CAPTURE_CONFLICT_SEMANTICS_BY_FIELD,
|
|
290
|
+
CAPTURE_CONFLICT_SEMANTICS_SOURCE,
|
|
291
|
+
DISPLAY_CHOICES,
|
|
292
|
+
DISPLAY_REPRESENTATIVE_FIELDS,
|
|
293
|
+
REVIEW_DECISIONS,
|
|
294
|
+
canApproveReview,
|
|
295
|
+
isOfferedForRow,
|
|
296
|
+
isReviewDecision,
|
|
297
|
+
planFieldReview,
|
|
298
|
+
recommendedDecision,
|
|
299
|
+
resolvedSemantics
|
|
300
|
+
});
|
|
301
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/shareReview/index.ts","../../src/shareReview/reviewDecision.ts","../../src/generated/captureConflictSemantics.ts","../../src/shareReview/captureConflictSemantics.ts","../../src/shareReview/shareFieldReviewPlan.ts","../../src/shareReview/recommendedDecision.ts"],"sourcesContent":["/**\n * @htilabs/platform-common-models/share-review\n *\n * The pure inbound-CaseShare REVIEW KERNEL (th-hbo9t.2; Thread\n * ADR-THREAD-CASESHARE-INBOUND-REVIEW D-b / D-e), lifted from pave-2.0 and\n * re-keyed by hti-features registry field id (`capture.*`):\n *\n * - the seven review decisions (`REVIEW_DECISIONS`, `isReviewDecision`);\n * - the capture-conflict-semantics resolver (`resolvedSemantics`) over the\n * GENERATED registry table;\n * - the add / conflict planner and its blocking count (`planFieldReview`,\n * `canApproveReview`), and THE row gate (`isOfferedForRow`) the write side\n * calls and the planner resolves conflicts by;\n * - the semantics-routed recommendation (`recommendedDecision`).\n *\n * Pure TypeScript: no mongoose, no I/O, no React. Not re-exported from the\n * package root.\n */\n\nexport * from \"./reviewDecision.js\";\nexport * from \"./captureConflictSemantics.js\";\nexport * from \"./shareFieldReviewPlan.js\";\nexport * from \"./recommendedDecision.js\";\n","/**\n * The REVIEW DECISION vocabulary — what a reviewer may record against one\n * offered value in an inbound CaseShare review.\n *\n * Lifted from pave-2.0 packages/domain/src/reviewDecision.ts @ 312943078\n * (th-hbo9t.2); the code is unchanged, the prose is trimmed to this package.\n *\n * One vocabulary over one persisted decision column: {@link FieldOfferDecision}\n * in `shareFieldReviewPlan` is an alias of {@link ReviewDecision}. Which of\n * the seven a given ROW admits is `isOfferedForRow` (the write gate), not this\n * list.\n *\n * add — the offered value JOINS what is there. Recorded on an\n * add row (pre-accepted; also the display-choice and the\n * re-flag reset in the prototype). Never resolves a\n * conflict.\n * theirs_current — `log_end_date_current` only. Theirs becomes current and\n * mine end-dates today.\n * mine_current — `log_end_date_current` only. Mine stays current and\n * theirs joins history.\n * replace — take theirs. Mine stays in history by supersession,\n * never deletion.\n * keep_mine — keep mine; theirs is not adopted.\n * keep_both_flagged — \"I don't know yet.\" Keep BOTH and raise an open-conflict\n * marker on the record. Resolves a conflict without\n * deciding it, which is why an unauthored fallback can\n * never destroy information.\n * exclude — decline the offer outright, WITH a structured reason\n * code. Distinct from `keep_mine`: that one resolves a\n * conflict in favour of the held value, this one refuses\n * the offer and tells the sender why.\n */\nexport const REVIEW_DECISIONS = [\n \"add\",\n \"theirs_current\",\n \"mine_current\",\n \"replace\",\n \"keep_mine\",\n \"keep_both_flagged\",\n \"exclude\",\n] as const;\n\nexport type ReviewDecision = (typeof REVIEW_DECISIONS)[number];\n\n/**\n * The runtime set, built once.\n *\n * `ReadonlySet<string>` and not `Set<ReviewDecision>`: the caller's input is an\n * arbitrary string off the wire or out of a bare-String column, and typing the\n * set to the union would force every caller to cast the very value it is asking\n * about.\n */\nconst REVIEW_DECISION_SET: ReadonlySet<string> = new Set(REVIEW_DECISIONS);\n\n/**\n * Whether an arbitrary value is a review decision.\n *\n * An ALLOWLIST, deliberately — never `v != null && v !== \"add\"` or any other\n * negation. A persisted decision column typically carries no enum, so the\n * values that actually reach this are unconstrained: `\"\"`, `\" \"`, `0`,\n * `false`, `{}` and any arbitrary string all arrive. Every one of those passes\n * a negation and fails this.\n *\n * That asymmetry is the whole point. A wrong answer here in the permissive\n * direction admits a decision nobody offered onto a survivor record; a wrong\n * answer in the strict direction refuses a legitimate one loudly. Only the\n * second is recoverable.\n */\nexport function isReviewDecision(value: unknown): value is ReviewDecision {\n return typeof value === \"string\" && REVIEW_DECISION_SET.has(value);\n}\n","// ⚠️ GENERATED FILE — DO NOT EDIT BY HAND. ⚠️\n//\n// Emitted by scripts/gen-capture-conflict-semantics.ts from ONE input:\n// src/__sot__/captureConflictSemantics.pin.json, which `npm run sot:pins` derives\n// from the SSOT, the hti-features field-mapping registry (htilabstech/hti-features,\n// src/hti_features/field_mapping/registry.json), key `capture_conflict_semantics` on captured rows.\n// The prototype's generated `window.HTI_CAPTURE_CONFLICT_SEMANTICS` block is a\n// sibling projection of the same key.\n//\n// To change a value: author it in the registry, then\n// `npm run sot:pins -- --only=captureConflictSemantics` against an hti-features\n// checkout, then `npm run gen:capture-conflict-semantics`.\n// Drift-gated by `npm run gen:capture-conflict-semantics:check` (hermetic, CI).\n//\n// The table is SPARSE on purpose: 141 of 533 captured registry rows\n// author a value. An absent field means NOBODY HAS RULED, which the resolver in\n// src/shareReview/captureConflictSemantics.ts keeps distinct from every value.\n// Do not add entries here to fill the gap.\n//\n// Registry version 1 @ ed3a1f9\n\n/**\n * How a CONFLICT between two values of the same captured field resolves at\n * review time. Vocabulary fixed by the registry validator.\n *\n * - `additive_log` — entries add; never a conflict (a NAME is never a conflict,\n * at most a display question).\n * - `log_end_date_current` — one current entry + dated history; a conflict\n * resolves by END-DATING one entry, BOTH kept.\n * - `single_value_keep_replace` — true one-value facts; keep/replace by\n * supersession, never deletion.\n * - `no_conflict_derived` — the value never conflicts because it is derived.\n */\nexport const CAPTURE_CONFLICT_SEMANTICS = [\n \"additive_log\",\n \"log_end_date_current\",\n \"single_value_keep_replace\",\n \"no_conflict_derived\",\n] as const;\n\nexport type CaptureConflictSemantics = (typeof CAPTURE_CONFLICT_SEMANTICS)[number];\n\n/** Authored semantics keyed by registry field id (`capture.*` and kin). */\nexport const CAPTURE_CONFLICT_SEMANTICS_BY_FIELD: Readonly<\n Record<string, CaptureConflictSemantics>\n> = Object.freeze({\n \"capture.accommodation_type_set\": \"single_value_keep_replace\",\n \"capture.account_link_role\": \"single_value_keep_replace\",\n \"capture.address\": \"additive_log\",\n \"capture.address_state\": \"single_value_keep_replace\",\n \"capture.age_bin_reporting\": \"single_value_keep_replace\",\n \"capture.assessment_capture_status\": \"single_value_keep_replace\",\n \"capture.associate_subrole\": \"single_value_keep_replace\",\n \"capture.birth_country\": \"single_value_keep_replace\",\n \"capture.birth_state\": \"single_value_keep_replace\",\n \"capture.case_account_id\": \"single_value_keep_replace\",\n \"capture.case_team_id\": \"single_value_keep_replace\",\n \"capture.child_custody\": \"single_value_keep_replace\",\n \"capture.child_health\": \"single_value_keep_replace\",\n \"capture.child_identity\": \"single_value_keep_replace\",\n \"capture.child_legal\": \"single_value_keep_replace\",\n \"capture.chronic_health_severity\": \"single_value_keep_replace\",\n \"capture.citizenship\": \"additive_log\",\n \"capture.collection_context\": \"additive_log\",\n \"capture.contact_info\": \"additive_log\",\n \"capture.contact_info_type\": \"additive_log\",\n \"capture.contact_info_use_type\": \"additive_log\",\n \"capture.contact_link_role\": \"single_value_keep_replace\",\n \"capture.contact_safety_status\": \"single_value_keep_replace\",\n \"capture.cooperativeness\": \"single_value_keep_replace\",\n \"capture.destination_living_situation\": \"single_value_keep_replace\",\n \"capture.education_level\": \"additive_log\",\n \"capture.employment_status\": \"additive_log\",\n \"capture.encounter_location\": \"additive_log\",\n \"capture.english_proficiency\": \"single_value_keep_replace\",\n \"capture.exit_reason\": \"single_value_keep_replace\",\n \"capture.eye_color\": \"single_value_keep_replace\",\n \"capture.facilitator_source_labels\": \"additive_log\",\n \"capture.foreign_national\": \"single_value_keep_replace\",\n \"capture.funder\": \"single_value_keep_replace\",\n \"capture.hair_color\": \"single_value_keep_replace\",\n \"capture.has_disability\": \"single_value_keep_replace\",\n \"capture.has_tattoos\": \"single_value_keep_replace\",\n \"capture.hiv_status\": \"single_value_keep_replace\",\n \"capture.hmis_dv_currently_fleeing\": \"single_value_keep_replace\",\n \"capture.hmis_dv_survivor\": \"single_value_keep_replace\",\n \"capture.hmis_project_type\": \"single_value_keep_replace\",\n \"capture.housing_subsidy_type\": \"log_end_date_current\",\n \"capture.identification_rung_reached\": \"single_value_keep_replace\",\n \"capture.immigration_status\": \"single_value_keep_replace\",\n \"capture.income_cadence\": \"additive_log\",\n \"capture.income_history\": \"additive_log\",\n \"capture.industry_sector\": \"single_value_keep_replace\",\n \"capture.involvement_role\": \"single_value_keep_replace\",\n \"capture.kinship_basis\": \"additive_log\",\n \"capture.lap_screen_result\": \"single_value_keep_replace\",\n \"capture.le_report_status\": \"single_value_keep_replace\",\n \"capture.legal_action_type\": \"additive_log\",\n \"capture.lifecycle_engagement_state\": \"log_end_date_current\",\n \"capture.link_end_reason\": \"additive_log\",\n \"capture.living_situation\": \"log_end_date_current\",\n \"capture.long_term_conditions\": \"single_value_keep_replace\",\n \"capture.mental_health_status\": \"single_value_keep_replace\",\n \"capture.mid_stay_event_type\": \"additive_log\",\n \"capture.name\": \"additive_log\",\n \"capture.needs_accommodations\": \"single_value_keep_replace\",\n \"capture.non_residential_program_subtype\": \"single_value_keep_replace\",\n \"capture.origin_interaction_type\": \"single_value_keep_replace\",\n \"capture.participation_role\": \"additive_log\",\n \"capture.pet_exit_reason\": \"single_value_keep_replace\",\n \"capture.po_service_status\": \"single_value_keep_replace\",\n \"capture.preferred_contact_method\": \"single_value_keep_replace\",\n \"capture.priorities_safety\": \"single_value_keep_replace\",\n \"capture.race_ethnicity\": \"log_end_date_current\",\n \"capture.recipient_role\": \"single_value_keep_replace\",\n \"capture.record_removal_reason\": \"additive_log\",\n \"capture.referral_outcome\": \"single_value_keep_replace\",\n \"capture.relationship\": \"single_value_keep_replace\",\n \"capture.relationship_dynamics\": \"additive_log\",\n \"capture.relationship_status_current\": \"single_value_keep_replace\",\n \"capture.relationship_tie\": \"additive_log\",\n \"capture.relationship_to_hoh\": \"single_value_keep_replace\",\n \"capture.release_case_id\": \"single_value_keep_replace\",\n \"capture.release_consent_type\": \"single_value_keep_replace\",\n \"capture.release_scope_version\": \"single_value_keep_replace\",\n \"capture.release_status\": \"single_value_keep_replace\",\n \"capture.reporting_audience\": \"single_value_keep_replace\",\n \"capture.residential_program_subtype\": \"single_value_keep_replace\",\n \"capture.rural\": \"single_value_keep_replace\",\n \"capture.service_delivery_channel\": \"single_value_keep_replace\",\n \"capture.service_instance.linked_lifecycle_id\": \"no_conflict_derived\",\n \"capture.service_instance.track_id\": \"no_conflict_derived\",\n \"capture.service_plan_state\": \"single_value_keep_replace\",\n \"capture.service_state\": \"log_end_date_current\",\n \"capture.session_account_id\": \"single_value_keep_replace\",\n \"capture.session_actor\": \"single_value_keep_replace\",\n \"capture.session_ended_at\": \"single_value_keep_replace\",\n \"capture.session_personnel\": \"no_conflict_derived\",\n \"capture.session_route_state\": \"single_value_keep_replace\",\n \"capture.session_signature\": \"single_value_keep_replace\",\n \"capture.session_started_at\": \"single_value_keep_replace\",\n \"capture.session_state\": \"single_value_keep_replace\",\n \"capture.session_template\": \"single_value_keep_replace\",\n \"capture.smt_type\": \"additive_log\",\n \"capture.substance_use_status\": \"single_value_keep_replace\",\n \"capture.survivor_achievement_item\": \"additive_log\",\n \"capture.trafficking_relevant_role\": \"additive_log\",\n \"capture.tribal_affiliation\": \"single_value_keep_replace\",\n \"capture.us_veteran\": \"single_value_keep_replace\",\n \"capture.us_veteran_branch\": \"additive_log\",\n \"capture.us_veteran_status\": \"single_value_keep_replace\",\n \"capture.vehicle_link_role\": \"single_value_keep_replace\",\n \"capture.visa_type\": \"single_value_keep_replace\",\n \"leads.assertion_car.assertion_domain\": \"single_value_keep_replace\",\n \"leads.assertion_car.authored_app\": \"single_value_keep_replace\",\n \"leads.assertion_car.handling_flags\": \"additive_log\",\n \"leads.assertion_car.recency_band\": \"single_value_keep_replace\",\n \"leads.case.closure_reason\": \"single_value_keep_replace\",\n \"leads.charge.disposition\": \"additive_log\",\n \"leads.criminal_org.category\": \"single_value_keep_replace\",\n \"leads.criminal_org.ht_status\": \"additive_log\",\n \"leads.deconfliction.ack_action\": \"single_value_keep_replace\",\n \"leads.deconfliction.tier\": \"no_conflict_derived\",\n \"leads.deconfliction.trigger\": \"no_conflict_derived\",\n \"leads.disclosure_record.cui_marking\": \"no_conflict_derived\",\n \"leads.lead.agency_record_snapshot\": \"no_conflict_derived\",\n \"leads.lead.triage_outcome\": \"single_value_keep_replace\",\n \"leads.milestone_snapshot.risk_band\": \"no_conflict_derived\",\n \"leads.network.status\": \"additive_log\",\n \"leads.person.identity_status\": \"single_value_keep_replace\",\n \"leads.person_phase.trigger\": \"single_value_keep_replace\",\n \"leads.roi.methods\": \"single_value_keep_replace\",\n \"leads.roi.scope\": \"single_value_keep_replace\",\n \"leads.share_edge.cadence\": \"no_conflict_derived\",\n \"leads.share_edge.channel_state\": \"single_value_keep_replace\",\n \"leads.share_edge.delivery_channel\": \"single_value_keep_replace\",\n \"leads.share_edge.information_scope\": \"single_value_keep_replace\",\n \"leads.share_edge.response_reason\": \"additive_log\",\n \"leads.share_edge.review_state\": \"single_value_keep_replace\",\n \"leads.sharing_grant.information_scope\": \"single_value_keep_replace\",\n \"leads.tip.incident_source_type\": \"single_value_keep_replace\",\n \"service_instance.non_client_audiences\": \"single_value_keep_replace\",\n \"service_instance.why_not_code\": \"log_end_date_current\",\n \"service_instance.why_not_secondary\": \"log_end_date_current\",\n \"service_track.case_id\": \"no_conflict_derived\",\n \"service_track.completed_confirmation\": \"single_value_keep_replace\",\n \"service_track.state_override\": \"single_value_keep_replace\",\n});\n\n/** Provenance of the pin this module was emitted from. */\nexport const CAPTURE_CONFLICT_SEMANTICS_SOURCE = Object.freeze({\n repo: \"htilabstech/hti-features\",\n path: \"src/hti_features/field_mapping/registry.json\",\n commit: \"ed3a1f9\",\n registryVersion: 1,\n /** Captured rows in the registry — the denominator for the sparse table. */\n capturedRowCount: 533,\n /** Rows that author a value — the size of the table above. */\n authoredCount: 141,\n});\n","import {\n CAPTURE_CONFLICT_SEMANTICS_BY_FIELD,\n type CaptureConflictSemantics,\n} from \"../generated/captureConflictSemantics.js\";\n\n/**\n * The CAPTURE CONFLICT SEMANTICS axis of an inbound CaseShare review.\n *\n * Lifted from pave-2.0 packages/domain/src/captureConflictSemantics.ts @ 312943078\n * (th-hbo9t.2, Thread ADR-THREAD-CASESHARE-INBOUND-REVIEW D-b / D-e) and RE-KEYED:\n * PAVE looked semantics up by its `assertion_domain`; this kernel looks them up by\n * the hti-features registry FIELD id (`capture.living_situation`, …), the key the\n * registry authors at and the prototype's `window.HTI_CAPTURE_CONFLICT_SEMANTICS`\n * block carries. A consumer maps its own carried fields to registry ids (Thread:\n * the D-e differ table); the kernel never sees an app's field names.\n *\n * Answers ONE question, for one captured field: when the sender's value and the\n * recipient's value disagree, what is the reviewer allowed to choose?\n *\n * ## UNAUTHORED IS NOT A VALUE\n *\n * The registry key is OPTIONAL and captured-rows-only, so for most captured\n * fields NOBODY HAS RULED (the counts are in `CAPTURE_CONFLICT_SEMANTICS_SOURCE`).\n * That is a distinct fact from every member of the vocabulary.\n * {@link resolvedSemantics} therefore always reports `authored` alongside the\n * value, and labels the fallback by `rulePath` rather than presenting it as a\n * ruling.\n *\n * The fallback is `single_value_keep_replace`, which is not a guess: it is the\n * prototype's own observed fallback. Its conflict-row render branches on\n * `semantics === \"log_end_date_current\"` and gives EVERY other value the\n * keep/replace pair (canon c2b0b8b0 `conflictRowHtml`, L351609-L351615).\n *\n * It is also the safe direction. `additive_log` resolves a disagreement by\n * keeping both values silently; applying that to a true one-value fact (a vital\n * status, a date of birth) would leave two contradictory \"current\" values with\n * no conflict ever surfaced. `single_value_keep_replace` forces the reviewer to\n * look — and because `keep_both_flagged` and `exclude` are offered on EVERY\n * conflict regardless of semantics (L351616-L351617), the fallback never forces\n * a value away.\n *\n * This module answers a FIELD question. Which decision a given review ROW\n * admits (the write gate) also depends on the row's bucket, and is answered by\n * `isOfferedForRow` in `shareFieldReviewPlan.ts`.\n *\n * ## Where the four values come from\n *\n * Not from here. `src/generated/captureConflictSemantics.ts` is generated from\n * the hti-features field_mapping registry by\n * `scripts/gen-capture-conflict-semantics.ts`; never hand-edit it.\n */\n\n/** A decision a reviewer can record against one conflict. */\nexport type CaptureConflictDecision =\n /** `log_end_date_current` only — theirs becomes current, mine end-dates today. */\n | \"theirs_current\"\n /** `log_end_date_current` only — mine stays current, theirs joins history. */\n | \"mine_current\"\n /** Take theirs; mine stays in history by supersession, never deletion. */\n | \"replace\"\n /** Keep mine; theirs is not adopted. */\n | \"keep_mine\"\n /**\n * \"I don't know yet\" — keep BOTH and flag the open conflict on the record.\n *\n * First-class and NON-BLOCKING: the registry doc states it \"UNBLOCKS\n * approval\", and the prototype offers it on every conflict irrespective of\n * semantics. It is the reason the unauthored fallback cannot destroy\n * information — there is always an escape that decides nothing.\n */\n | \"keep_both_flagged\"\n /**\n * Decline the offer outright, with a structured reason code.\n *\n * Offered on every conflict row, like `keep_both_flagged` — the prototype\n * renders \"Don't bring theirs in…\" outside the semantics branch (L351617).\n * NOT in {@link ResolvedCaptureConflictSemantics.choices}: that list is the\n * semantics-driven resolution set, and declining is a different act on a\n * different control carrying a reason code. The row gate `isOfferedForRow`\n * (shareFieldReviewPlan.ts) accounts for it separately.\n */\n | \"exclude\";\n\n/** Why {@link resolvedSemantics} returned the value it did. */\nexport type CaptureConflictRulePath =\n /** The registry authors this field explicitly. */\n | \"registry_authored\"\n /** No upstream ruling; fell back to the prototype's own default branch. */\n | \"unauthored_default_keep_replace\";\n\nexport interface ResolvedCaptureConflictSemantics {\n /** The semantics in force — authored or fallen back to. */\n semantics: CaptureConflictSemantics;\n /**\n * Whether the registry actually authored this field.\n *\n * `false` does NOT mean \"no conflict semantics apply\" — `semantics` still\n * carries the operative value. It means no human upstream has ruled, so a\n * caller that wants to report coverage, or to prompt for authoring, can tell\n * the difference.\n */\n authored: boolean;\n /** Which fact decided. Never omitted, so any resolution can be explained. */\n rulePath: CaptureConflictRulePath;\n /**\n * Whether a disagreement on this field is a CONFLICT a reviewer must resolve.\n *\n * False for `additive_log` (\"entries add — never a conflict\") and for\n * `no_conflict_derived` (\"the value never conflicts because it is derived\").\n * Those offers are adopted without blocking the review.\n */\n producesConflict: boolean;\n /**\n * The resolution decisions offered, in the prototype's render order.\n *\n * `keep_both_flagged` is ALWAYS last and ALWAYS present when there is a\n * conflict. Empty when `producesConflict` is false — nothing to decide.\n */\n choices: readonly CaptureConflictDecision[];\n}\n\nconst KEEP_REPLACE_CHOICES = Object.freeze([\"replace\", \"keep_mine\", \"keep_both_flagged\"] as const);\n\nconst END_DATE_CHOICES = Object.freeze([\n \"theirs_current\",\n \"mine_current\",\n \"keep_both_flagged\",\n] as const);\n\nconst NO_CHOICES = Object.freeze([] as const);\n\n/**\n * Resolve the review semantics for one registry field id.\n *\n * Total: every field resolves, because an unauthored one falls back rather\n * than returning nothing. A resolver that could return \"unknown\" would put the\n * branch in every caller, and the callers would not agree on it.\n */\nexport function resolvedSemantics(fieldId: string): ResolvedCaptureConflictSemantics {\n // Own-property check: `BY_FIELD[\"constructor\"]` is truthy on a plain object.\n const authoredValue = Object.prototype.hasOwnProperty.call(\n CAPTURE_CONFLICT_SEMANTICS_BY_FIELD,\n fieldId,\n )\n ? CAPTURE_CONFLICT_SEMANTICS_BY_FIELD[fieldId]\n : undefined;\n\n const semantics: CaptureConflictSemantics = authoredValue ?? \"single_value_keep_replace\";\n\n const producesConflict = semantics !== \"additive_log\" && semantics !== \"no_conflict_derived\";\n\n return {\n semantics,\n authored: authoredValue !== undefined,\n rulePath: authoredValue !== undefined ? \"registry_authored\" : \"unauthored_default_keep_replace\",\n producesConflict,\n choices: !producesConflict\n ? NO_CHOICES\n : semantics === \"log_end_date_current\"\n ? END_DATE_CHOICES\n : KEEP_REPLACE_CHOICES,\n };\n}\n\nexport {\n CAPTURE_CONFLICT_SEMANTICS,\n CAPTURE_CONFLICT_SEMANTICS_BY_FIELD,\n CAPTURE_CONFLICT_SEMANTICS_SOURCE,\n type CaptureConflictSemantics,\n} from \"../generated/captureConflictSemantics.js\";\n","import {\n type CaptureConflictDecision,\n type CaptureConflictSemantics,\n resolvedSemantics,\n} from \"./captureConflictSemantics.js\";\nimport type { ReviewDecision } from \"./reviewDecision.js\";\n\n/**\n * The FIELD-GRAIN REVIEW PLAN of an inbound CaseShare.\n *\n * Lifted from pave-2.0 packages/domain/src/shareFieldReviewPlan.ts @ 312943078\n * (th-hbo9t.2, Thread ADR-THREAD-CASESHARE-INBOUND-REVIEW D-b), with these changes:\n *\n * - RE-KEYED by registry field id (`fieldId`, e.g. `capture.living_situation`)\n * instead of PAVE's `assertionDomain`.\n * - PAVE's `unverified` bucket (and its tri-state `targetHeld: \"unknown\"` input)\n * is DROPPED. It is a PAVE-only extra with no canon counterpart: canon has\n * exactly two row kinds, adds and conflicts (`addsOf` / `conflictsOf`, canon\n * c2b0b8b0 L351462-L351463). A caller that cannot establish the held side must\n * not call the planner for that row as if it had.\n * - PAVE's `survivorDeclined` input (its demographics decline lane) is DROPPED.\n * It is a PAVE survivor-record rule, not part of the share-review kernel; a\n * consumer with such a rule applies it before planning.\n * - Decisions are judged PER ROW by one rule, {@link isOfferedForRow}: it is\n * both the write gate and what decides whether a conflict is resolved.\n * - The name display-question row cannot be excluded (canon renders only the\n * two display buttons there), and derived fields get their own rule path.\n *\n * ## Two kinds, and only one of them blocks\n *\n * - An **add** is pre-accepted. The recipient holds nothing that competes, or\n * the field's semantics say entries accumulate or are derived. It does NOT\n * hold up approval.\n * - A **conflict** is blocking until decided. Two values compete and the\n * field's semantics say only one can be current, so a human has to choose.\n *\n * `blockingRemaining` counts undecided conflicts and nothing else — canon's\n * `undecidedCount` is `conflictsOf(s).filter(c => !c.decision).length` (L351464).\n *\n * ## Input contracts\n *\n * - **Only offered fields are planned.** A field the sender did not send (no\n * incoming value) is never an input: there is nothing to add or to decide.\n * Canon builds rows only from the delivered payload (`payload.forEach`,\n * L348703). The planner never synthesizes a row.\n * - **An identical held value is not competing.** When the recipient already\n * holds the same value the sender offers, the caller passes\n * `targetPopulated: false`; the row is a no-op add, never a conflict. (Canon's\n * re-review skips an unchanged value the same way, L348712.)\n *\n * ## NO VALUES CROSS THIS BOUNDARY\n *\n * The planner takes `targetPopulated: boolean`, never the held value and never\n * the incoming one. Bucketing needs to know THAT a value competes, never WHAT\n * it is, so the plan can be computed without a plaintext survivor value in scope.\n */\n\n/** One incoming field offer, reduced to what bucketing actually needs. */\nexport interface FieldOfferInput {\n /** Stable id of this offer within the share — the handle a decision pulls by. */\n offerId: string;\n /**\n * The hti-features registry field id (`capture.*` and kin). Drives the\n * semantics lookup. Only fields the sender actually offered are planned.\n */\n fieldId: string;\n /**\n * Whether the RECIPIENT already holds a DIFFERENT value for this field.\n *\n * Strictly boolean, and the caller must mean it:\n * - `false` when the recipient looked and holds nothing, or holds exactly the\n * offered value (an identical value does not compete);\n * - `true` only when a different held value competes.\n *\n * It must not be used for \"we did not check\": that reads as \"nothing\n * competes\" and pre-accepts an offer that should have been a conflict.\n */\n targetPopulated: boolean;\n /** The recorded decision, when the reviewer has made one. */\n decision?: FieldOfferDecision | null;\n}\n\n/**\n * A decision recorded against an offer — an alias of {@link ReviewDecision}, so\n * there is one vocabulary underneath. Which members a ROW admits is\n * {@link isOfferedForRow}.\n */\nexport type FieldOfferDecision = ReviewDecision;\n\n/**\n * The name display-question's two answers: keep the current display name, or\n * display the incoming one. Canon's `data-rvw-display` buttons (c2b0b8b0\n * L351554-L351555); the click records `display_choice` AND `decision = \"add\"`\n * (L351893) — both names join the name log either way.\n */\nexport const DISPLAY_CHOICES = [\"keep\", \"incoming\"] as const;\nexport type DisplayChoice = (typeof DISPLAY_CHOICES)[number];\n\n/** Why an offer landed in the bucket it did. */\nexport type FieldOfferRulePath =\n /** Nothing (different) competes on the recipient side — no question to ask. */\n | \"no_held_value\"\n /** A value competes, but the field's semantics say entries accumulate. */\n | \"additive_never_conflicts\"\n /**\n * A value competes, but the field is `no_conflict_derived`. Bucketed as an\n * add (non-blocking, no choices). The prototype is SILENT on whether a\n * derived value offered in a share is adopted as sent or recomputed by the\n * recipient; this kernel decides only that it never blocks review.\n */\n | \"derived_never_conflicts\"\n /** A value competes and only one can be current. A human must choose. */\n | \"conflict_requires_decision\";\n\ninterface PlannedFieldOfferBase {\n offerId: string;\n fieldId: string;\n bucket: \"add\" | \"conflict\";\n /**\n * Whether this row is holding up approval RIGHT NOW.\n *\n * Only a conflict without an OFFERED decision ({@link isOfferedForRow}) blocks.\n * An add never does — including one the reviewer has not touched.\n */\n blocking: boolean;\n /** The semantics in force, authored or fallen back to. */\n semantics: CaptureConflictSemantics;\n /** Whether the registry actually authored those semantics. */\n semanticsAuthored: boolean;\n /**\n * The conflict-resolution choices offered (`keep_both_flagged` always last).\n * Empty for an add — there is nothing to resolve. `exclude` is separate; see\n * `canExclude`.\n */\n choices: readonly CaptureConflictDecision[];\n rulePath: FieldOfferRulePath;\n}\n\n/**\n * One planned row. `displayQuestion` and `canExclude` are typed together:\n *\n * - A **display-question** row (`capture.name` over a held name) asks only\n * which name displays; it CANNOT be excluded. Canon's add row renders the two\n * display buttons in the `display_question` branch and \"Don't add this…\" only\n * in the `else if` branch (c2b0b8b0 L351542-L351569); \"Two names never\n * conflict; the only question is which one displays\" (L346745).\n * - Every other row can be declined with a reason (`exclude`).\n */\nexport type PlannedFieldOffer = PlannedFieldOfferBase &\n (\n | {\n /** The record shows ONE name; the reviewer chooses which ({@link DisplayChoice}). */\n displayQuestion: true;\n canExclude: false;\n }\n | {\n displayQuestion: false;\n /** Declining the offer, with a structured reason code, is available. */\n canExclude: true;\n }\n );\n\nexport interface FieldReviewPlan {\n /** Pre-accepted offers, in input order. */\n adds: PlannedFieldOffer[];\n /** Competing offers, in input order. */\n conflicts: PlannedFieldOffer[];\n /**\n * Undecided conflicts. The number the surface shows and approval gates on.\n *\n * Zero does NOT mean the review is empty — a share of nothing but adds\n * reports zero here and still has rows to render.\n */\n blockingRemaining: number;\n}\n\n/**\n * Fields where the record displays ONE representative value while the log\n * holds many, so a second value raises a display question instead of a\n * conflict. Deliberately narrow: the prototype sets `display_question: true` on\n * the name add and on no other row (L346745). A record shows every phone it\n * holds, but ONE name.\n */\nexport const DISPLAY_REPRESENTATIVE_FIELDS: ReadonlySet<string> = new Set([\"capture.name\"]);\n\n/**\n * THE row gate: whether `decision` is one this review row admits.\n *\n * The write side MUST call this before persisting a decision, and the planner\n * uses the same rule to decide whether a conflict is resolved — one rule, so a\n * decision the surface would refuse can never clear a blocking row.\n *\n * - **Add row** → `add` (canon writes it on add rows: the seed, the display\n * choice L351893, the re-flag reset L348744), plus `exclude` when the row\n * `canExclude` (not on the name display question).\n * - **Conflict row** → the field's semantics `choices` (the end-date pair OR\n * keep/replace, canon L351609-L351615, plus `keep_both_flagged` L351616) and\n * `exclude` (L351617). Never `add`, and never the OTHER semantics' pair:\n * `replace` does not resolve an end-date conflict, `mine_current` does not\n * resolve a keep/replace one.\n *\n * An allowlist over `unknown`: `\"\"`, `null`, `0`, `{}` and arbitrary strings\n * are refused.\n */\nexport function isOfferedForRow(\n row: Pick<PlannedFieldOfferBase, \"bucket\" | \"choices\"> & { canExclude: boolean },\n decision: unknown,\n): decision is FieldOfferDecision {\n if (typeof decision !== \"string\") return false;\n if (decision === \"exclude\") return row.canExclude;\n if (row.bucket === \"add\") return decision === \"add\";\n return (row.choices as readonly string[]).includes(decision);\n}\n\n/**\n * Plan one share's field review.\n *\n * Pure and total: every offer lands in exactly one bucket, so the two arrays\n * always partition the input and no offer can be dropped by falling through.\n */\nexport function planFieldReview(offers: readonly FieldOfferInput[]): FieldReviewPlan {\n const adds: PlannedFieldOffer[] = [];\n const conflicts: PlannedFieldOffer[] = [];\n\n for (const offer of offers) {\n const semantics = resolvedSemantics(offer.fieldId);\n // Nothing (different) competes ⇒ nothing to decide, whatever the semantics say.\n const competes = offer.targetPopulated === true;\n const isConflict = competes && semantics.producesConflict;\n const bucket = isConflict ? \"conflict\" : \"add\";\n const choices = isConflict ? semantics.choices : [];\n const displayQuestion =\n !isConflict && competes && DISPLAY_REPRESENTATIVE_FIELDS.has(offer.fieldId);\n\n const rulePath: FieldOfferRulePath = !competes\n ? \"no_held_value\"\n : isConflict\n ? \"conflict_requires_decision\"\n : semantics.semantics === \"no_conflict_derived\"\n ? \"derived_never_conflicts\"\n : \"additive_never_conflicts\";\n\n const base: PlannedFieldOfferBase = {\n offerId: offer.offerId,\n fieldId: offer.fieldId,\n bucket,\n blocking:\n isConflict && !isOfferedForRow({ bucket, choices, canExclude: true }, offer.decision),\n semantics: semantics.semantics,\n semanticsAuthored: semantics.authored,\n choices,\n rulePath,\n };\n const planned: PlannedFieldOffer = displayQuestion\n ? { ...base, displayQuestion: true, canExclude: false }\n : { ...base, displayQuestion: false, canExclude: true };\n\n if (isConflict) conflicts.push(planned);\n else adds.push(planned);\n }\n\n return {\n adds,\n conflicts,\n blockingRemaining: conflicts.filter((c) => c.blocking).length,\n };\n}\n\n/**\n * Whether the FIELD REVIEW is settled — no conflict is still undecided.\n *\n * ## NOT the whole approve gate\n *\n * This answers ONE condition. Canon's approve path also requires the share to\n * be linked to a case before it looks at any decision (`case_not_linked`, canon\n * c2b0b8b0 L348504); a caller treating this function as THE gate would approve\n * an unlinked share. Named for what it measures so the caller still has to ask\n * the other question.\n *\n * ## Recompute; never trust a stored counter\n *\n * Derive this from the conflicts at the moment of approving; do not read a\n * denormalized per-share counter. An unclaimed share can carry a zero counter\n * while holding undecided conflicts, because its review has not started.\n */\nexport function canApproveReview(plan: FieldReviewPlan): boolean {\n return plan.blockingRemaining === 0;\n}\n","import type { ReviewDecision } from \"./reviewDecision.js\";\n\n/**\n * Which decision a conflict-row recommendation (or \"Accept all\") resolves to.\n *\n * Lifted from pave-2.0 packages/composites/src/CaseShareReviewTakeover/\n * RecommendationAssist.tsx @ 312943078 (th-hbo9t.2), where it sat in a React\n * module; it is pure, so it lives in the kernel.\n *\n * Branches on SEMANTICS, exactly as the prototype's handlers do — per-row Apply\n * (canon c2b0b8b0 L351836) and bulk \"Accept all\" over undecided conflicts\n * (L351827): `log_end_date_current` → `theirs_current`, every other value →\n * `replace`. Not on a stored `recommend.value`: the prototype's seed rows carry\n * that field and its handlers never read it.\n *\n * Either way nothing is destroyed — the held value joins the history (end-dated\n * or superseded).\n */\nexport function recommendedDecision(semantics: string): ReviewDecision {\n return semantics === \"log_end_date_current\" ? \"theirs_current\" : \"replace\";\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACgCO,IAAM,mBAAmB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAYA,IAAM,sBAA2C,IAAI,IAAI,gBAAgB;AAgBlE,SAAS,iBAAiB,OAAyC;AACxE,SAAO,OAAO,UAAU,YAAY,oBAAoB,IAAI,KAAK;AACnE;;;ACrCO,IAAM,6BAA6B;AAAA,EACxC;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAKO,IAAM,sCAET,OAAO,OAAO;AAAA,EAChB,kCAAkC;AAAA,EAClC,6BAA6B;AAAA,EAC7B,mBAAmB;AAAA,EACnB,yBAAyB;AAAA,EACzB,6BA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