@htilabs/platform-common-models 0.12.1 → 0.12.2

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.
Files changed (35) hide show
  1. package/dist/{cvcEntry-0BIB9sen.d.cts → cvcEntry-ctHTp2df.d.cts} +36 -36
  2. package/dist/{cvcEntry-0BIB9sen.d.ts → cvcEntry-ctHTp2df.d.ts} +36 -36
  3. package/dist/cvcs/index.cjs +224 -0
  4. package/dist/cvcs/index.cjs.map +1 -1
  5. package/dist/cvcs/index.d.cts +511 -270
  6. package/dist/cvcs/index.d.ts +511 -270
  7. package/dist/cvcs/index.js +223 -0
  8. package/dist/cvcs/index.js.map +1 -1
  9. package/dist/enums/index.cjs +16 -0
  10. package/dist/enums/index.cjs.map +1 -1
  11. package/dist/enums/index.d.cts +21 -1
  12. package/dist/enums/index.d.ts +21 -1
  13. package/dist/enums/index.js +15 -0
  14. package/dist/enums/index.js.map +1 -1
  15. package/dist/{index-CDoqrfc1.d.ts → index-4DiJrn7y.d.ts} +1 -1
  16. package/dist/{index-Zu_mOJRn.d.cts → index-qreOzXYS.d.cts} +1 -1
  17. package/dist/index.cjs +240 -0
  18. package/dist/index.cjs.map +1 -1
  19. package/dist/index.d.cts +4 -4
  20. package/dist/index.d.ts +4 -4
  21. package/dist/index.js +238 -0
  22. package/dist/index.js.map +1 -1
  23. package/dist/models/index.d.cts +2 -2
  24. package/dist/models/index.d.ts +2 -2
  25. package/dist/schemas/index.d.cts +11 -11
  26. package/dist/schemas/index.d.ts +11 -11
  27. package/package.json +27 -26
  28. package/src/__tests__/__snapshots__/cvc-sot.snap +4 -0
  29. package/src/__tests__/cvc-drift-gate.test.ts +18 -0
  30. package/src/__tests__/cvc-sot-snapshot.test.ts +8 -0
  31. package/src/__tests__/cvc-structural.test.ts +2 -0
  32. package/src/__tests__/share-response-reason-invariant.test.ts +167 -0
  33. package/src/cvcs/index.ts +4 -0
  34. package/src/cvcs/shareResponseReason.v1.0.0.json +220 -0
  35. package/src/generated/cvc-enums.ts +22 -0
@@ -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-0BIB9sen.cjs';
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-ctHTp2df.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-Zu_mOJRn.cjs';
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-qreOzXYS.cjs';
@@ -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-0BIB9sen.js';
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-ctHTp2df.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-CDoqrfc1.js';
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-4DiJrn7y.js';
@@ -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-0BIB9sen.cjs';
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-ctHTp2df.cjs';
4
4
 
5
5
  declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
6
6
  _id: false;
@@ -28,9 +28,9 @@ declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any,
28
28
  placeId?: string | null | undefined;
29
29
  }, {
30
30
  id: string;
31
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
31
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
32
32
  _id: false;
33
- }> & Omit<{
33
+ }>> & Omit<{
34
34
  formattedAddress?: string | null | undefined;
35
35
  street?: string | null | undefined;
36
36
  city?: string | null | undefined;
@@ -90,9 +90,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
90
90
  isMononym?: boolean | null | undefined;
91
91
  }, {
92
92
  id: string;
93
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
93
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
94
94
  _id: false;
95
- }> & Omit<{
95
+ }>> & Omit<{
96
96
  alias?: boolean | null | undefined;
97
97
  firstName?: string | null | undefined;
98
98
  lastName?: string | null | undefined;
@@ -140,9 +140,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
140
140
  dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
141
141
  }, {
142
142
  id: string;
143
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
143
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
144
144
  _id: false;
145
- }> & Omit<{
145
+ }>> & Omit<{
146
146
  number?: string | null | undefined;
147
147
  type?: string | null | undefined;
148
148
  safeToContact?: boolean | null | undefined;
@@ -176,9 +176,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
176
176
  address?: string | null | undefined;
177
177
  }, {
178
178
  id: string;
179
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
179
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
180
180
  _id: false;
181
- }> & Omit<{
181
+ }>> & Omit<{
182
182
  type?: string | null | undefined;
183
183
  safeToContact?: boolean | null | undefined;
184
184
  address?: string | null | undefined;
@@ -250,9 +250,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
250
250
  ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
251
251
  }, {
252
252
  id: string;
253
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
253
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
254
254
  _id: false;
255
- }> & Omit<{
255
+ }>> & Omit<{
256
256
  race: number[];
257
257
  ethnicity: number[];
258
258
  accommodations: string[];
@@ -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-0BIB9sen.js';
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-ctHTp2df.js';
4
4
 
5
5
  declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any, any, any>, {}, {}, {}, {}, {
6
6
  _id: false;
@@ -28,9 +28,9 @@ declare const addressSchema: Schema<any, mongoose.Model<any, any, any, any, any,
28
28
  placeId?: string | null | undefined;
29
29
  }, {
30
30
  id: string;
31
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
31
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
32
32
  _id: false;
33
- }> & Omit<{
33
+ }>> & Omit<{
34
34
  formattedAddress?: string | null | undefined;
35
35
  street?: string | null | undefined;
36
36
  city?: string | null | undefined;
@@ -90,9 +90,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
90
90
  isMononym?: boolean | null | undefined;
91
91
  }, {
92
92
  id: string;
93
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
93
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
94
94
  _id: false;
95
- }> & Omit<{
95
+ }>> & Omit<{
96
96
  alias?: boolean | null | undefined;
97
97
  firstName?: string | null | undefined;
98
98
  lastName?: string | null | undefined;
@@ -140,9 +140,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
140
140
  dataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
141
141
  }, {
142
142
  id: string;
143
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
143
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
144
144
  _id: false;
145
- }> & Omit<{
145
+ }>> & Omit<{
146
146
  number?: string | null | undefined;
147
147
  type?: string | null | undefined;
148
148
  safeToContact?: boolean | null | undefined;
@@ -176,9 +176,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
176
176
  address?: string | null | undefined;
177
177
  }, {
178
178
  id: string;
179
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
179
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
180
180
  _id: false;
181
- }> & Omit<{
181
+ }>> & Omit<{
182
182
  type?: string | null | undefined;
183
183
  safeToContact?: boolean | null | undefined;
184
184
  address?: string | null | undefined;
@@ -250,9 +250,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
250
250
  ethnicityDataQuality?: "data_not_collected" | "client_doesnt_know" | "client_prefers_not_to_answer" | null | undefined;
251
251
  }, {
252
252
  id: string;
253
- }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
253
+ }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
254
254
  _id: false;
255
- }> & Omit<{
255
+ }>> & Omit<{
256
256
  race: number[];
257
257
  ethnicity: number[];
258
258
  accommodations: string[];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@htilabs/platform-common-models",
3
- "version": "0.12.1",
3
+ "version": "0.12.2",
4
4
  "description": "Shared constants, types, and models for HTI Labs applications",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",
@@ -67,6 +67,31 @@
67
67
  "dist",
68
68
  "src"
69
69
  ],
70
+ "scripts": {
71
+ "build": "tsup",
72
+ "dev": "tsup --watch",
73
+ "typecheck": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
74
+ "lint": "eslint src --ext .ts",
75
+ "lint:fix": "eslint src --ext .ts --fix",
76
+ "test": "vitest run",
77
+ "test:watch": "vitest",
78
+ "test:snapshot": "UPDATE_SNAPSHOT=1 vitest run",
79
+ "clean": "rm -rf dist",
80
+ "codegen:cvc": "tsx scripts/codegen-cvc-enums.ts",
81
+ "codegen:cvc:check": "tsx scripts/codegen-cvc-enums.ts --check",
82
+ "import:cvcs": "node scripts/import-prototype-cvcs.mjs",
83
+ "sot:pins": "tsx scripts/sot-pins.ts",
84
+ "sot:pins:check": "tsx scripts/sot-pins.ts --check",
85
+ "gate:cvc": "vitest run src/__tests__/cvc-drift-gate.test.ts",
86
+ "bridge:codebook": "tsx scripts/codebook-bridge.ts",
87
+ "bridge:codebook:check": "tsx scripts/codebook-bridge.ts --check",
88
+ "test:bridge": "node --import tsx --test scripts/codebook-bridge.test.ts",
89
+ "seed:cvc": "tsx scripts/seed-cvc.ts",
90
+ "seed:cvc:all": "tsx scripts/seed-all-cvcs.ts",
91
+ "test:seed": "node --import tsx --test scripts/seed-cvc.test.ts",
92
+ "test:guard": "node --import tsx --test scripts/lib/confirmTargetDb.test.ts",
93
+ "prepublishOnly": "npm run build"
94
+ },
70
95
  "keywords": [
71
96
  "hti",
72
97
  "platform-common",
@@ -101,29 +126,5 @@
101
126
  },
102
127
  "engines": {
103
128
  "node": ">=18.0.0"
104
- },
105
- "scripts": {
106
- "build": "tsup",
107
- "dev": "tsup --watch",
108
- "typecheck": "tsc --noEmit && tsc --noEmit -p scripts/tsconfig.json",
109
- "lint": "eslint src --ext .ts",
110
- "lint:fix": "eslint src --ext .ts --fix",
111
- "test": "vitest run",
112
- "test:watch": "vitest",
113
- "test:snapshot": "UPDATE_SNAPSHOT=1 vitest run",
114
- "clean": "rm -rf dist",
115
- "codegen:cvc": "tsx scripts/codegen-cvc-enums.ts",
116
- "codegen:cvc:check": "tsx scripts/codegen-cvc-enums.ts --check",
117
- "import:cvcs": "node scripts/import-prototype-cvcs.mjs",
118
- "sot:pins": "tsx scripts/sot-pins.ts",
119
- "sot:pins:check": "tsx scripts/sot-pins.ts --check",
120
- "gate:cvc": "vitest run src/__tests__/cvc-drift-gate.test.ts",
121
- "bridge:codebook": "tsx scripts/codebook-bridge.ts",
122
- "bridge:codebook:check": "tsx scripts/codebook-bridge.ts --check",
123
- "test:bridge": "node --import tsx --test scripts/codebook-bridge.test.ts",
124
- "seed:cvc": "tsx scripts/seed-cvc.ts",
125
- "seed:cvc:all": "tsx scripts/seed-all-cvcs.ts",
126
- "test:seed": "node --import tsx --test scripts/seed-cvc.test.ts",
127
- "test:guard": "node --import tsx --test scripts/lib/confirmTargetDb.test.ts"
128
129
  }
129
- }
130
+ }
@@ -674,6 +674,10 @@
674
674
  "count": 57,
675
675
  "hash": "9e296ba8ae3a187171eb8facfd13a5e6824daa0ed7f963e41e31672104aa16c0"
676
676
  },
677
+ "share_response_reason": {
678
+ "count": 12,
679
+ "hash": "cf4fc986c61ecf896738374844dda337891fc5c6590cfb219d9472d6cc8cee73"
680
+ },
677
681
  "trafficking_relevant_role": {
678
682
  "count": 8,
679
683
  "hash": "1a4ea2992cc501179adafd192d7a2f1733ffe48c1ba26e1e61a3c757b2d62b32"
@@ -289,6 +289,24 @@ const INDEX_ABSENT: Record<string, { cvc: number; reason: string }> = {
289
289
  cvc: 236,
290
290
  reason: "authored in the live Notion inline DB; no Final CVCs/ export yet",
291
291
  },
292
+ // Index-absent HERE, not upstream. `data/cvcs/core_share_response_reason.yaml`
293
+ // self-declares `cvc_id: CVC-306`, and upstream CVC_INDEX.md DOES carry the
294
+ // row: first hand-added in prototype a4448b22 (2026-08-24) and renamed to the
295
+ // class-1 form `core-share_response_reason` by the 2026-09-14
296
+ // SHARING-FAMILY-AUDIT (6c2cfc0a). The pinned CVC_INDEX.md (622410b) predates
297
+ // that row, so there is nothing to bind against yet and nothing else claims
298
+ // 306. NO PIN EDIT: `cvcIndex.pin.json` is machine-derived
299
+ // (`src/__sot__/README.md`). When the next `npm run sot:pins` refresh brings
300
+ // the row in, GATE C will read this entry as a squat — move it to
301
+ // CANONICAL_BINDING as `{ cvc: 306, indexName: "core-share_response_reason" }`
302
+ // then (copy the name from the refreshed pin, which is what the binding test
303
+ // compares against). NOT parked at 900+: that block is for vocabularies with
304
+ // no canonical number, and parking a numbered domain there would leave 306
305
+ // looking free.
306
+ share_response_reason: {
307
+ cvc: 306,
308
+ reason: "CVC_INDEX row added upstream (a4448b22; renamed 6c2cfc0a) after the 622410b pin",
309
+ },
292
310
  // Trunk-only domain: authored on `kl-develop` (80341e0, "promote CVC-17 +
293
311
  // CVC-67 to SOT"), which the canonical 0.8.13 line never saw. Its sibling
294
312
  // CVC-17 (gender_identity) IS in CVC_INDEX.md and is bound above; 67 is not
@@ -693,6 +693,14 @@ const SOT_SPECS: readonly SotSpec[] = [
693
693
  domain: "determination_helper_categories",
694
694
  expectedCount: 57,
695
695
  },
696
+ // CVC-306 — 10 L1 share response reasons + 1 missingness root + canon v1.1's
697
+ // ONE sentinel (UNK; ANON absent by design, DNC [ARCHIVED] in the codebook
698
+ // and omitted) = 12. Generated by scripts/gen-share-response-reason.py.
699
+ {
700
+ file: "shareResponseReason.v1.0.0.json",
701
+ domain: "share_response_reason",
702
+ expectedCount: 12,
703
+ },
696
704
  // CVC-235 — 4 L1 trafficking-relevant roles + 1 missingness root + 3 canonical
697
705
  // missingness children = 8.
698
706
  {
@@ -73,6 +73,8 @@ const SOT_FILES: readonly SotFile[] = [
73
73
  { file: "highestEducationLevelCompleted.v1.0.0.json", expectedDomain: "highest_education_level_completed" },
74
74
  { file: "preferredContactMethod.v1.0.0.json", expectedDomain: "preferred_contact_method" },
75
75
  { file: "sharePurpose.v1.0.0.json", expectedDomain: "share_purpose" },
76
+ // CVC-306 — generated from prototype canon (scripts/gen-share-response-reason.py).
77
+ { file: "shareResponseReason.v1.0.0.json", expectedDomain: "share_response_reason" },
76
78
  { file: "facilitatorEntityType.v1.0.0.json", expectedDomain: "facilitator_entity_type" },
77
79
  { file: "facilitatorSubrole.v1.0.0.json", expectedDomain: "facilitator_subrole" },
78
80
  { file: "maritalStatusLegal.v1.0.0.json", expectedDomain: "marital_status_legal" },
@@ -0,0 +1,167 @@
1
+ /**
2
+ * SHARE RESPONSE REASON (CVC-306) — the per-context picker contract
3
+ * ==================================================================
4
+ *
5
+ * CVC-306 is ONE codebook whose rows are selectable per CONTEXT — `field_review`
6
+ * (a delivered field not brought in), `decline_share` (refusing a share before
7
+ * engaging it) and `reject_share` (refusing it after review). A consumer builds
8
+ * each context's picker by filtering on `entry.contexts`, so the context lists
9
+ * ARE the product contract: a reason that leaks into the wrong picker changes
10
+ * what a recipient can claim about a share.
11
+ *
12
+ * The canon rulings this pins (Crysta 2026-08-23, recorded in the prototype's
13
+ * `data/cvcs/core_share_response_reason.yaml` and the Notion codebook export):
14
+ *
15
+ * - The per-context columns, row for row, as canon publishes them.
16
+ * - Missingness is canon v1.1's shape (SHARING-FAMILY-AUDIT 2026-09-14): ONE
17
+ * ingestion-only sentinel, UNK, NEVER a picker chip (Selectable NO in every
18
+ * context), so it is `selectable: false` and belongs to no context. The
19
+ * codebook's DNC row is [ARCHIVED] ("Not a value; never emit") and must not
20
+ * be minted here — the first export did exactly that from stale canon.
21
+ * - The turned-away guard rail (R15): a person who was reached and chose no
22
+ * services is an ACCEPT + CVC-219 why-nots, never a decline — so
23
+ * `not_our_client` stays decline-only and no field-review or reject reason
24
+ * can stand in for it.
25
+ *
26
+ * The expected table below is transcribed from canon, NOT derived from the JSON,
27
+ * so a regenerated JSON that drifts from canon fails here rather than silently
28
+ * updating its own expectation.
29
+ */
30
+
31
+ import { readFileSync } from "node:fs";
32
+ import path from "node:path";
33
+ import { fileURLToPath } from "node:url";
34
+
35
+ import { describe, it, expect } from "vitest";
36
+
37
+ const here = path.dirname(fileURLToPath(import.meta.url));
38
+ const FILE = path.join(here, "..", "cvcs", "shareResponseReason.v1.0.0.json");
39
+
40
+ interface Entry {
41
+ code: string;
42
+ key: string;
43
+ selectable: boolean;
44
+ parentCode: string | null;
45
+ canonicalCode?: string;
46
+ contexts?: string[];
47
+ tobyRetention?: { class: string };
48
+ }
49
+ interface Envelope {
50
+ domain: string;
51
+ contexts: Record<string, string>;
52
+ entries: Entry[];
53
+ }
54
+
55
+ const env = JSON.parse(readFileSync(FILE, "utf8")) as Envelope;
56
+ const substantive = env.entries.filter((e) => e.code.split("-")[1] !== "000");
57
+ const missingness = env.entries.filter((e) => e.code.split("-")[1] === "000");
58
+
59
+ const CONTEXTS = ["field_review", "decline_share", "reject_share"] as const;
60
+
61
+ /** Canon's per-context selectability, in codebook row order. */
62
+ const CANON: Record<string, readonly string[]> = {
63
+ information_incorrect: ["field_review"],
64
+ not_relevant_for_client: ["field_review"],
65
+ duplicate_already_have: ["field_review", "decline_share"],
66
+ client_declined_recording: ["field_review"],
67
+ wrong_agency_service_area: ["decline_share"],
68
+ not_our_client: ["decline_share"],
69
+ sent_in_error: ["decline_share", "reject_share"],
70
+ no_capacity: ["decline_share"],
71
+ cannot_verify_conflicts: ["reject_share"],
72
+ wrong_person: ["reject_share"],
73
+ };
74
+
75
+ /** Canon's retention class vocabulary (yaml § TOBY RETENTION COLUMN). */
76
+ const RETENTION_CLASSES = new Set([
77
+ "supersede",
78
+ "tombstone_retain",
79
+ "purge_with_flags",
80
+ "inclusion_register",
81
+ "negative_constraint",
82
+ "retain_event",
83
+ ]);
84
+
85
+ describe("CVC-306 share_response_reason — per-context picker contract", () => {
86
+ it("declares exactly canon's three contexts", () => {
87
+ expect(env.domain).toBe("share_response_reason");
88
+ expect(Object.keys(env.contexts)).toEqual([...CONTEXTS]);
89
+ });
90
+
91
+ it("published codes are FROZEN: each key keeps its exact code (append-only)", () => {
92
+ // Enforced here independently of the generator's FROZEN list. Once published,
93
+ // a code's meaning is stored on live shares: a key may never move to another
94
+ // code, and a code may never be reused for another key. New reasons append at
95
+ // 306-011+, so this table only ever grows.
96
+ const FROZEN_CODES: Record<string, string> = {
97
+ information_incorrect: "306-001-000-000-000-000-000",
98
+ not_relevant_for_client: "306-002-000-000-000-000-000",
99
+ duplicate_already_have: "306-003-000-000-000-000-000",
100
+ client_declined_recording: "306-004-000-000-000-000-000",
101
+ wrong_agency_service_area: "306-005-000-000-000-000-000",
102
+ not_our_client: "306-006-000-000-000-000-000",
103
+ sent_in_error: "306-007-000-000-000-000-000",
104
+ no_capacity: "306-008-000-000-000-000-000",
105
+ cannot_verify_conflicts: "306-009-000-000-000-000-000",
106
+ wrong_person: "306-010-000-000-000-000-000",
107
+ };
108
+ const byKey = new Map(env.entries.map((e) => [e.key, e.code]));
109
+ for (const [key, code] of Object.entries(FROZEN_CODES)) {
110
+ expect(byKey.get(key), `${key} must keep ${code}`).toBe(code);
111
+ }
112
+ const frozen = new Set(Object.values(FROZEN_CODES));
113
+ for (const e of substantive) {
114
+ if (frozen.has(e.code)) expect(FROZEN_CODES[e.key], `${e.code} reused`).toBe(e.code);
115
+ else expect(Number(e.code.split("-")[1]), `${e.key} must append`).toBeGreaterThan(10);
116
+ }
117
+ });
118
+
119
+ it("carries exactly canon's 10 reasons, in codebook row order, all selectable", () => {
120
+ expect(substantive.map((e) => e.key)).toEqual(Object.keys(CANON));
121
+ for (const e of substantive) expect(e.selectable, e.key).toBe(true);
122
+ });
123
+
124
+ it("each reason is selectable in exactly the contexts canon gives it", () => {
125
+ for (const e of substantive) expect(e.contexts, e.key).toEqual(CANON[e.key]);
126
+ });
127
+
128
+ it("every context's picker is non-empty and matches canon", () => {
129
+ for (const ctx of CONTEXTS) {
130
+ const picker = substantive.filter((e) => e.contexts?.includes(ctx)).map((e) => e.key);
131
+ const want = Object.keys(CANON).filter((k) => CANON[k]!.includes(ctx));
132
+ expect(picker.length, ctx).toBeGreaterThan(0);
133
+ expect(picker, ctx).toEqual(want);
134
+ }
135
+ });
136
+
137
+ it("missingness is canon v1.1's single UNK sentinel, never a picker chip", () => {
138
+ expect(missingness.map((e) => e.key)).toEqual(["missingness_root", "unknown"]);
139
+ const unk = missingness.find((e) => e.key === "unknown")!;
140
+ expect(unk.code).toBe("306-000-000-000-000-000-001");
141
+ expect(unk.canonicalCode).toBe("UNK");
142
+ for (const e of missingness) {
143
+ expect(e.selectable, e.key).toBe(false);
144
+ expect(e.contexts ?? [], e.key).toEqual([]);
145
+ }
146
+ });
147
+
148
+ it("the archived DNC sentinel is not minted", () => {
149
+ const keys = env.entries.map((e) => e.key);
150
+ expect(keys).not.toContain("data_not_collected");
151
+ expect(env.entries.map((e) => e.canonicalCode)).not.toContain("DNC");
152
+ expect(env.entries.map((e) => e.code)).not.toContain("306-000-000-000-000-000-003");
153
+ });
154
+
155
+ it("R15 turned-away guard rail: not_our_client is decline-only", () => {
156
+ const e = substantive.find((x) => x.key === "not_our_client")!;
157
+ expect(e.contexts).toEqual(["decline_share"]);
158
+ });
159
+
160
+ it("every entry's tobyRetention class is in canon's class vocabulary", () => {
161
+ for (const e of env.entries) {
162
+ if (e.key === "missingness_root") continue;
163
+ expect(e.tobyRetention, e.key).toBeDefined();
164
+ expect(RETENTION_CLASSES.has(e.tobyRetention!.class), e.key).toBe(true);
165
+ }
166
+ });
167
+ });
package/src/cvcs/index.ts CHANGED
@@ -46,6 +46,9 @@ import preferredContactMethodSot from "./preferredContactMethod.v1.0.0.json" wit
46
46
  import sharePurposeSot from "./sharePurpose.v1.0.0.json" with { type: "json" };
47
47
  import referralOriginSot from "./referralOrigin.v1.0.0.json" with { type: "json" };
48
48
  import caseShareStateSot from "./caseShareState.v1.0.0.json" with { type: "json" };
49
+ // CVC-306 — structured reasons for responding to an inbound case share. Generated
50
+ // from prototype canon by scripts/gen-share-response-reason.py; re-run, don't hand-edit.
51
+ import shareResponseReasonSot from "./shareResponseReason.v1.0.0.json" with { type: "json" };
49
52
  import facilitatorEntityTypeSot from "./facilitatorEntityType.v1.0.0.json" with { type: "json" };
50
53
  import facilitatorSubroleSot from "./facilitatorSubrole.v1.0.0.json" with { type: "json" };
51
54
  import maritalStatusLegalSot from "./maritalStatusLegal.v1.0.0.json" with { type: "json" };
@@ -243,6 +246,7 @@ export {
243
246
  sharePurposeSot,
244
247
  referralOriginSot,
245
248
  caseShareStateSot,
249
+ shareResponseReasonSot,
246
250
  facilitatorEntityTypeSot,
247
251
  facilitatorSubroleSot,
248
252
  maritalStatusLegalSot,