@htilabs/platform-common-models 0.2.0-beta.3 → 0.3.0-beta.5

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 (75) hide show
  1. package/README.md +38 -0
  2. package/dist/constants/index.cjs +0 -140
  3. package/dist/constants/index.cjs.map +1 -1
  4. package/dist/constants/index.d.cts +146 -5
  5. package/dist/constants/index.d.ts +146 -5
  6. package/dist/constants/index.js +0 -128
  7. package/dist/constants/index.js.map +1 -1
  8. package/dist/{platform-role-AHv1l5Og.d.cts → cvcEntry-wqktWfzE.d.cts} +231 -37
  9. package/dist/{platform-role-AHv1l5Og.d.ts → cvcEntry-wqktWfzE.d.ts} +231 -37
  10. package/dist/cvcs/index.cjs +2184 -0
  11. package/dist/cvcs/index.cjs.map +1 -0
  12. package/dist/cvcs/index.d.cts +2384 -0
  13. package/dist/cvcs/index.d.ts +2384 -0
  14. package/dist/cvcs/index.js +2154 -0
  15. package/dist/cvcs/index.js.map +1 -0
  16. package/dist/index--NCIPluF.d.cts +378 -0
  17. package/dist/index-CFOrHA8l.d.ts +378 -0
  18. package/dist/index.cjs +2962 -140
  19. package/dist/index.cjs.map +1 -1
  20. package/dist/index.d.cts +217 -3
  21. package/dist/index.d.ts +217 -3
  22. package/dist/index.js +2934 -128
  23. package/dist/index.js.map +1 -1
  24. package/dist/models/index.cjs +211 -0
  25. package/dist/models/index.cjs.map +1 -1
  26. package/dist/models/index.d.cts +3 -292
  27. package/dist/models/index.d.ts +3 -292
  28. package/dist/models/index.js +209 -0
  29. package/dist/models/index.js.map +1 -1
  30. package/dist/{platform-auth-DHSJP7XP.d.cts → platform-auth-C-G2qeGM.d.cts} +1 -36
  31. package/dist/{platform-auth-DHSJP7XP.d.ts → platform-auth-C-G2qeGM.d.ts} +1 -36
  32. package/dist/schemas/index.cjs +195 -116
  33. package/dist/schemas/index.cjs.map +1 -1
  34. package/dist/schemas/index.d.cts +11 -11
  35. package/dist/schemas/index.d.ts +11 -11
  36. package/dist/schemas/index.js +189 -116
  37. package/dist/schemas/index.js.map +1 -1
  38. package/dist/services/index.cjs +1442 -0
  39. package/dist/services/index.cjs.map +1 -0
  40. package/dist/services/index.d.cts +305 -0
  41. package/dist/services/index.d.ts +305 -0
  42. package/dist/services/index.js +1417 -0
  43. package/dist/services/index.js.map +1 -0
  44. package/dist/types/index.d.cts +2 -2
  45. package/dist/types/index.d.ts +2 -2
  46. package/dist/validation/index.cjs +261 -0
  47. package/dist/validation/index.cjs.map +1 -0
  48. package/dist/validation/index.d.cts +251 -0
  49. package/dist/validation/index.d.ts +251 -0
  50. package/dist/validation/index.js +228 -0
  51. package/dist/validation/index.js.map +1 -0
  52. package/package.json +36 -12
  53. package/src/__tests__/__snapshots__/cvc-sot.snap +22 -0
  54. package/src/__tests__/cvc-sot-snapshot.test.ts +184 -0
  55. package/src/__tests__/cvc-structural.test.ts +130 -0
  56. package/src/constants/ic.ts +0 -154
  57. package/src/constants/service-catalog.ts +146 -4
  58. package/src/cvcs/index.ts +31 -0
  59. package/src/cvcs/missingness.v1.0.0.json +50 -0
  60. package/src/cvcs/serviceCategories.v1.0.0.json +1947 -0
  61. package/src/cvcs/serviceMechanisms.v1.0.0.json +47 -0
  62. package/src/cvcs/serviceStates.v1.0.0.json +106 -0
  63. package/src/generated/cvc-enums.ts +215 -0
  64. package/src/index.ts +61 -1
  65. package/src/models/cvcEntryModel.ts +32 -0
  66. package/src/models/cvcRegistryModel.ts +35 -0
  67. package/src/models/index.ts +8 -0
  68. package/src/schemas/cvcEntry.ts +158 -0
  69. package/src/schemas/cvcRegistry.ts +149 -0
  70. package/src/schemas/index.ts +16 -0
  71. package/src/services/__tests__/cvcRegistryService.test.ts +614 -0
  72. package/src/services/cvcRegistryService.ts +729 -0
  73. package/src/services/index.ts +21 -0
  74. package/src/validation/cvc.ts +414 -0
  75. package/src/validation/index.ts +15 -0
@@ -1,6 +1,6 @@
1
1
  import * as mongoose from 'mongoose';
2
2
  import { InferRawDocType, Schema } from 'mongoose';
3
- export { C as Choice, F as Form, a as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, b as PlatformRole, Q as Question, S as ScoringCondition, c as ScoringRecommendation, d as ScoringRule, e as ScoringThreshold, f as Section, g as SectionQuestionRef, V as VisibilityRule, h as buildFormSchema, i as buildPlatformFunctionSchema, j as buildPlatformRoleSchema, k as buildQuestionSchema, l as buildScoringRuleSchema, m as buildSectionSchema, n as choiceSchema, o as formSchemaDefinition, p as formSchemaOptions, q as formSectionRefSchema, r as guidanceSchema, s as layoutSchema, t as platformFunctionSchemaDefinition, u as platformFunctionSchemaOptions, v as platformRoleSchemaDefinition, w as platformRoleSchemaOptions, x as questionSchemaDefinition, y as questionSchemaOptions, z as scoringConditionSchema, A as scoringRecommendationSchema, B as scoringRuleSchemaDefinition, D as scoringRuleSchemaOptions, E as scoringThresholdSchema, H as sectionQuestionRefSchema, I as sectionSchemaDefinition, J as sectionSchemaOptions, K as visibilityRuleSchema } from '../platform-role-AHv1l5Og.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-wqktWfzE.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
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
31
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
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;
@@ -88,9 +88,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
88
88
  isAnonymous?: boolean | null | undefined;
89
89
  }, {
90
90
  id: string;
91
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
91
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
92
92
  _id: false;
93
- }>> & Omit<{
93
+ }> & Omit<{
94
94
  alias?: boolean | null | undefined;
95
95
  firstName?: string | null | undefined;
96
96
  lastName?: string | null | undefined;
@@ -136,9 +136,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
136
136
  dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
137
137
  }, {
138
138
  id: string;
139
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
139
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
140
140
  _id: false;
141
- }>> & Omit<{
141
+ }> & Omit<{
142
142
  number?: string | null | undefined;
143
143
  type?: string | null | undefined;
144
144
  safeToContact?: boolean | null | undefined;
@@ -172,9 +172,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
172
172
  address?: string | null | undefined;
173
173
  }, {
174
174
  id: string;
175
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
175
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
176
176
  _id: false;
177
- }>> & Omit<{
177
+ }> & Omit<{
178
178
  type?: string | null | undefined;
179
179
  safeToContact?: boolean | null | undefined;
180
180
  address?: string | null | undefined;
@@ -246,9 +246,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
246
246
  ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
247
247
  }, {
248
248
  id: string;
249
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
249
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
250
250
  _id: false;
251
- }>> & Omit<{
251
+ }> & Omit<{
252
252
  race: number[];
253
253
  ethnicity: number[];
254
254
  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, F as Form, a as FormSectionRef, G as Guidance, L as Layout, P as PlatformFunction, b as PlatformRole, Q as Question, S as ScoringCondition, c as ScoringRecommendation, d as ScoringRule, e as ScoringThreshold, f as Section, g as SectionQuestionRef, V as VisibilityRule, h as buildFormSchema, i as buildPlatformFunctionSchema, j as buildPlatformRoleSchema, k as buildQuestionSchema, l as buildScoringRuleSchema, m as buildSectionSchema, n as choiceSchema, o as formSchemaDefinition, p as formSchemaOptions, q as formSectionRefSchema, r as guidanceSchema, s as layoutSchema, t as platformFunctionSchemaDefinition, u as platformFunctionSchemaOptions, v as platformRoleSchemaDefinition, w as platformRoleSchemaOptions, x as questionSchemaDefinition, y as questionSchemaOptions, z as scoringConditionSchema, A as scoringRecommendationSchema, B as scoringRuleSchemaDefinition, D as scoringRuleSchemaOptions, E as scoringThresholdSchema, H as sectionQuestionRefSchema, I as sectionSchemaDefinition, J as sectionSchemaOptions, K as visibilityRuleSchema } from '../platform-role-AHv1l5Og.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-wqktWfzE.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
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
31
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
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;
@@ -88,9 +88,9 @@ declare const personNameSchema: Schema<any, mongoose.Model<any, any, any, any, a
88
88
  isAnonymous?: boolean | null | undefined;
89
89
  }, {
90
90
  id: string;
91
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
91
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
92
92
  _id: false;
93
- }>> & Omit<{
93
+ }> & Omit<{
94
94
  alias?: boolean | null | undefined;
95
95
  firstName?: string | null | undefined;
96
96
  lastName?: string | null | undefined;
@@ -136,9 +136,9 @@ declare const phoneSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
136
136
  dataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
137
137
  }, {
138
138
  id: string;
139
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
139
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
140
140
  _id: false;
141
- }>> & Omit<{
141
+ }> & Omit<{
142
142
  number?: string | null | undefined;
143
143
  type?: string | null | undefined;
144
144
  safeToContact?: boolean | null | undefined;
@@ -172,9 +172,9 @@ declare const emailSchema: Schema<any, mongoose.Model<any, any, any, any, any, a
172
172
  address?: string | null | undefined;
173
173
  }, {
174
174
  id: string;
175
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
175
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
176
176
  _id: false;
177
- }>> & Omit<{
177
+ }> & Omit<{
178
178
  type?: string | null | undefined;
179
179
  safeToContact?: boolean | null | undefined;
180
180
  address?: string | null | undefined;
@@ -246,9 +246,9 @@ declare const demographicsSchema: Schema<any, mongoose.Model<any, any, any, any,
246
246
  ethnicityDataQuality?: "client_doesnt_know" | "client_prefers_not_to_answer" | "data_not_collected" | null | undefined;
247
247
  }, {
248
248
  id: string;
249
- }, mongoose.MergeType<mongoose.DefaultSchemaOptions, {
249
+ }, Omit<mongoose.DefaultSchemaOptions, "_id"> & {
250
250
  _id: false;
251
- }>> & Omit<{
251
+ }> & Omit<{
252
252
  race: number[];
253
253
  ethnicity: number[];
254
254
  accommodations: string[];
@@ -620,16 +620,6 @@ var CVC_17_TRANSGENDER_VALUES = [
620
620
  CVC_17_CORE_GENDER_IDENTITY.TRANSGENDER_FTM,
621
621
  CVC_17_CORE_GENDER_IDENTITY.TRANSGENDER_MTF
622
622
  ];
623
- var CVC_17_VALUES = [
624
- CVC_17_CORE_GENDER_IDENTITY.MALE,
625
- CVC_17_CORE_GENDER_IDENTITY.FEMALE,
626
- CVC_17_CORE_GENDER_IDENTITY.TRANSGENDER,
627
- CVC_17_CORE_GENDER_IDENTITY.NON_BINARY,
628
- CVC_17_CORE_GENDER_IDENTITY.OTHER,
629
- CVC_17_CORE_GENDER_IDENTITY.UNKNOWN,
630
- CVC_17_CORE_GENDER_IDENTITY.TRANSGENDER_FTM,
631
- CVC_17_CORE_GENDER_IDENTITY.TRANSGENDER_MTF
632
- ];
633
623
  var IC_24_RACE = {
634
624
  AMERICAN_INDIAN_ALASKA_NATIVE: 1,
635
625
  ASIAN: 2,
@@ -3474,112 +3464,6 @@ var CVC_67_SELECTABLE_VALUES = [
3474
3464
  var CVC_67_MISSINGNESS_VALUES = [
3475
3465
  CVC_67_HMIS_SEX.DATA_NOT_COLLECTED
3476
3466
  ];
3477
- var CVC_67_VALUES = [
3478
- CVC_67_HMIS_SEX.MALE,
3479
- CVC_67_HMIS_SEX.FEMALE,
3480
- CVC_67_HMIS_SEX.CLIENT_PREFERS_NOT_TO_ANSWER,
3481
- CVC_67_HMIS_SEX.CLIENT_DOESNT_KNOW,
3482
- CVC_67_HMIS_SEX.DATA_NOT_COLLECTED
3483
- ];
3484
- var CVC_137_RECENCY_BAND = {
3485
- // Primary recency values
3486
- WITHIN_3_MONTHS: "W3M",
3487
- MONTHS_3_TO_6: "M3_6",
3488
- MONTHS_6_TO_12: "M6_12",
3489
- ONE_YEAR_OR_MORE: "Y1P",
3490
- LESS_THAN_3_YEARS: "YLT3",
3491
- YEARS_3_TO_10: "Y3_10",
3492
- TEN_PLUS_YEARS: "Y10P",
3493
- // Missingness values
3494
- UNKNOWN: "UNK",
3495
- DATA_NOT_COLLECTED: "DNC",
3496
- ANONYMOUS: "ANON",
3497
- PREFERS_NOT_TO_ANSWER: "PNA"
3498
- };
3499
- var CVC_137_LABELS = {
3500
- [CVC_137_RECENCY_BAND.WITHIN_3_MONTHS]: "Within past 3 months",
3501
- [CVC_137_RECENCY_BAND.MONTHS_3_TO_6]: "3-6 months ago",
3502
- [CVC_137_RECENCY_BAND.MONTHS_6_TO_12]: "6-12 months ago",
3503
- [CVC_137_RECENCY_BAND.ONE_YEAR_OR_MORE]: "One year or more",
3504
- [CVC_137_RECENCY_BAND.LESS_THAN_3_YEARS]: "Less than 3 years ago",
3505
- [CVC_137_RECENCY_BAND.YEARS_3_TO_10]: "3-10 years ago",
3506
- [CVC_137_RECENCY_BAND.TEN_PLUS_YEARS]: "10+ years ago",
3507
- [CVC_137_RECENCY_BAND.UNKNOWN]: "Unknown",
3508
- [CVC_137_RECENCY_BAND.DATA_NOT_COLLECTED]: "Data not collected",
3509
- [CVC_137_RECENCY_BAND.ANONYMOUS]: "Anonymous",
3510
- [CVC_137_RECENCY_BAND.PREFERS_NOT_TO_ANSWER]: "Client prefers not to answer"
3511
- };
3512
- var CVC_137_VALUES = [
3513
- CVC_137_RECENCY_BAND.WITHIN_3_MONTHS,
3514
- CVC_137_RECENCY_BAND.MONTHS_3_TO_6,
3515
- CVC_137_RECENCY_BAND.MONTHS_6_TO_12,
3516
- CVC_137_RECENCY_BAND.ONE_YEAR_OR_MORE,
3517
- CVC_137_RECENCY_BAND.LESS_THAN_3_YEARS,
3518
- CVC_137_RECENCY_BAND.YEARS_3_TO_10,
3519
- CVC_137_RECENCY_BAND.TEN_PLUS_YEARS,
3520
- CVC_137_RECENCY_BAND.UNKNOWN,
3521
- CVC_137_RECENCY_BAND.DATA_NOT_COLLECTED,
3522
- CVC_137_RECENCY_BAND.ANONYMOUS,
3523
- CVC_137_RECENCY_BAND.PREFERS_NOT_TO_ANSWER
3524
- ];
3525
- var CVC_137_SELECTABLE_VALUES = [
3526
- CVC_137_RECENCY_BAND.WITHIN_3_MONTHS,
3527
- CVC_137_RECENCY_BAND.MONTHS_3_TO_6,
3528
- CVC_137_RECENCY_BAND.MONTHS_6_TO_12,
3529
- CVC_137_RECENCY_BAND.ONE_YEAR_OR_MORE,
3530
- CVC_137_RECENCY_BAND.LESS_THAN_3_YEARS,
3531
- CVC_137_RECENCY_BAND.YEARS_3_TO_10,
3532
- CVC_137_RECENCY_BAND.TEN_PLUS_YEARS
3533
- ];
3534
- var CVC_137_MISSINGNESS_VALUES = [
3535
- CVC_137_RECENCY_BAND.UNKNOWN,
3536
- CVC_137_RECENCY_BAND.DATA_NOT_COLLECTED,
3537
- CVC_137_RECENCY_BAND.ANONYMOUS,
3538
- CVC_137_RECENCY_BAND.PREFERS_NOT_TO_ANSWER
3539
- ];
3540
- var CVC_197_JUVENILE_JUSTICE_EPISODE = {
3541
- DIVERSION_PROGRAM: "diversion_program",
3542
- PROBATION_SUPERVISION: "probation_supervision",
3543
- PENDING_ADJUDICATION: "pending_adjudication",
3544
- DETENTION_STAY: "detention_stay",
3545
- RESIDENTIAL_JJ_PLACEMENT: "residential_jj_placement",
3546
- // Missingness values
3547
- DATA_NOT_COLLECTED: "DNC",
3548
- UNKNOWN: "UNK",
3549
- ANONYMOUS: "ANON"
3550
- };
3551
- var CVC_197_LABELS = {
3552
- [CVC_197_JUVENILE_JUSTICE_EPISODE.DIVERSION_PROGRAM]: "Diversion program",
3553
- [CVC_197_JUVENILE_JUSTICE_EPISODE.PROBATION_SUPERVISION]: "Probation supervision",
3554
- [CVC_197_JUVENILE_JUSTICE_EPISODE.PENDING_ADJUDICATION]: "Pending adjudication",
3555
- [CVC_197_JUVENILE_JUSTICE_EPISODE.DETENTION_STAY]: "Detention stay",
3556
- [CVC_197_JUVENILE_JUSTICE_EPISODE.RESIDENTIAL_JJ_PLACEMENT]: "Residential JJ placement",
3557
- [CVC_197_JUVENILE_JUSTICE_EPISODE.DATA_NOT_COLLECTED]: "Data not collected",
3558
- [CVC_197_JUVENILE_JUSTICE_EPISODE.UNKNOWN]: "Unknown",
3559
- [CVC_197_JUVENILE_JUSTICE_EPISODE.ANONYMOUS]: "Anonymous"
3560
- };
3561
- var CVC_197_VALUES = [
3562
- CVC_197_JUVENILE_JUSTICE_EPISODE.DIVERSION_PROGRAM,
3563
- CVC_197_JUVENILE_JUSTICE_EPISODE.PROBATION_SUPERVISION,
3564
- CVC_197_JUVENILE_JUSTICE_EPISODE.PENDING_ADJUDICATION,
3565
- CVC_197_JUVENILE_JUSTICE_EPISODE.DETENTION_STAY,
3566
- CVC_197_JUVENILE_JUSTICE_EPISODE.RESIDENTIAL_JJ_PLACEMENT,
3567
- CVC_197_JUVENILE_JUSTICE_EPISODE.DATA_NOT_COLLECTED,
3568
- CVC_197_JUVENILE_JUSTICE_EPISODE.UNKNOWN,
3569
- CVC_197_JUVENILE_JUSTICE_EPISODE.ANONYMOUS
3570
- ];
3571
- var CVC_197_SELECTABLE_VALUES = [
3572
- CVC_197_JUVENILE_JUSTICE_EPISODE.DIVERSION_PROGRAM,
3573
- CVC_197_JUVENILE_JUSTICE_EPISODE.PROBATION_SUPERVISION,
3574
- CVC_197_JUVENILE_JUSTICE_EPISODE.PENDING_ADJUDICATION,
3575
- CVC_197_JUVENILE_JUSTICE_EPISODE.DETENTION_STAY,
3576
- CVC_197_JUVENILE_JUSTICE_EPISODE.RESIDENTIAL_JJ_PLACEMENT
3577
- ];
3578
- var CVC_197_MISSINGNESS_VALUES = [
3579
- CVC_197_JUVENILE_JUSTICE_EPISODE.DATA_NOT_COLLECTED,
3580
- CVC_197_JUVENILE_JUSTICE_EPISODE.UNKNOWN,
3581
- CVC_197_JUVENILE_JUSTICE_EPISODE.ANONYMOUS
3582
- ];
3583
3467
 
3584
3468
  // src/schemas/common.ts
3585
3469
  var addressSchema = new Schema(
@@ -4501,8 +4385,193 @@ function buildPlatformRoleSchema() {
4501
4385
  return schema;
4502
4386
  }
4503
4387
  var _platformRoleSchema = buildPlatformRoleSchema();
4388
+
4389
+ // src/schemas/cvcRegistry.ts
4390
+ import { Schema as Schema8 } from "mongoose";
4391
+ var cvcRegistrySchemaDefinition = {
4392
+ // Versioning — semantic version of this registry bundle
4393
+ version: {
4394
+ type: String,
4395
+ required: true,
4396
+ match: /^\d+\.\d+\.\d+(?:[-+][0-9A-Za-z.-]+)?$/
4397
+ },
4398
+ // Human-readable name (e.g. "PAVE production registry")
4399
+ name: {
4400
+ type: String,
4401
+ required: true
4402
+ },
4403
+ // Scope keys. `null` widens scope: a null `application` means platform-wide;
4404
+ // a null `agencyId` means all agencies within `application`.
4405
+ application: {
4406
+ type: String,
4407
+ default: null
4408
+ },
4409
+ agencyId: {
4410
+ type: Schema8.Types.ObjectId,
4411
+ default: null
4412
+ },
4413
+ // Lifecycle
4414
+ status: {
4415
+ type: String,
4416
+ required: true,
4417
+ enum: ["draft", "active", "deprecated"],
4418
+ default: "draft",
4419
+ index: true
4420
+ },
4421
+ dateActivated: {
4422
+ type: Date
4423
+ },
4424
+ dateDeactivated: {
4425
+ type: Date
4426
+ },
4427
+ // Pinned domain versions: { service_categories: "1.0.0", ... }
4428
+ // Stored as a Map<string, string> so individual domains can be added or
4429
+ // bumped without re-validating the whole document shape.
4430
+ cvcVersions: {
4431
+ type: Map,
4432
+ of: String,
4433
+ required: true,
4434
+ default: () => /* @__PURE__ */ new Map()
4435
+ },
4436
+ // Selective inclusion/exclusion lists. Both contain CVC entry codes
4437
+ // (positional 7-segment, e.g. "01-02-00-00-00-00-00"). The runtime
4438
+ // applies excludes after includes when resolving the effective set.
4439
+ excludedEntries: {
4440
+ type: [String],
4441
+ default: []
4442
+ },
4443
+ includedEntries: {
4444
+ type: [String],
4445
+ default: []
4446
+ },
4447
+ // Inheritance pointer — when set, this registry inherits cvcVersions /
4448
+ // include / exclude lists from its base before applying its own overrides.
4449
+ // Indexed below so a base-version bump can find every dependent registry.
4450
+ basedOn: {
4451
+ type: Schema8.Types.ObjectId,
4452
+ default: null
4453
+ }
4454
+ };
4455
+ var cvcRegistrySchemaOptions = {
4456
+ timestamps: true,
4457
+ collection: "cvc_registries"
4458
+ };
4459
+ function buildCvcRegistrySchema() {
4460
+ const schema = new Schema8(
4461
+ cvcRegistrySchemaDefinition,
4462
+ cvcRegistrySchemaOptions
4463
+ );
4464
+ schema.index(
4465
+ { application: 1, agencyId: 1, version: 1 },
4466
+ { unique: true }
4467
+ );
4468
+ schema.index(
4469
+ { application: 1, agencyId: 1, status: 1 },
4470
+ {
4471
+ unique: true,
4472
+ partialFilterExpression: { status: "active" }
4473
+ }
4474
+ );
4475
+ schema.index({ basedOn: 1 });
4476
+ return schema;
4477
+ }
4478
+ var _cvcRegistrySchema = buildCvcRegistrySchema();
4479
+
4480
+ // src/schemas/cvcEntry.ts
4481
+ import { Schema as Schema9 } from "mongoose";
4482
+ var CVC_CODE_PATTERN = /^\d{2}(-\d{2}){6}$/;
4483
+ var CVC_KEY_PATTERN = /^[a-z][a-z0-9_]*$/;
4484
+ var cvcEntrySchemaDefinition = {
4485
+ // Compound identity: (domain, version, code) uniquely identifies an entry.
4486
+ // `domain` is the SOT family (e.g. "service_categories"); `version` is the
4487
+ // semantic version of the SOT JSON file the entry was loaded from.
4488
+ domain: {
4489
+ type: String,
4490
+ required: true
4491
+ },
4492
+ version: {
4493
+ type: String,
4494
+ required: true
4495
+ },
4496
+ code: {
4497
+ type: String,
4498
+ required: true,
4499
+ match: CVC_CODE_PATTERN
4500
+ },
4501
+ // Stable machine key for cross-CVC references (e.g. `relevantMechanisms`
4502
+ // in service_categories points at service_mechanisms entries by `key`).
4503
+ key: {
4504
+ type: String,
4505
+ required: true,
4506
+ match: CVC_KEY_PATTERN
4507
+ },
4508
+ // Display fields
4509
+ title: {
4510
+ type: String,
4511
+ required: true
4512
+ },
4513
+ // `selectable` distinguishes leaf entries (selectable) from structural
4514
+ // grouping rows (not selectable). Required because the seed CLI must
4515
+ // populate it explicitly — there is no sane default.
4516
+ selectable: {
4517
+ type: Boolean,
4518
+ required: true
4519
+ },
4520
+ // Tree structure. `parentCode` is `null` for root rows; `childCodes` is
4521
+ // empty for leaves. We give `parentCode` a `default: null` (rather than
4522
+ // marking it required) because Mongoose's `required` validator rejects
4523
+ // `null` outright — the default ensures the field is always present on
4524
+ // disk while still allowing the documented `string | null` shape. The
4525
+ // `match` validator is skipped by Mongoose when the value is null.
4526
+ parentCode: {
4527
+ type: String,
4528
+ default: null,
4529
+ match: CVC_CODE_PATTERN
4530
+ },
4531
+ childCodes: {
4532
+ type: [String],
4533
+ required: true,
4534
+ default: []
4535
+ },
4536
+ // Long-form definition. Same `default: null` treatment as `parentCode`
4537
+ // above — every row reaches disk with `definition` set to either a
4538
+ // string or an explicit null.
4539
+ definition: {
4540
+ type: String,
4541
+ default: null
4542
+ },
4543
+ // Domain-specific extension bag. Used for fields that only apply to a
4544
+ // particular CVC family — e.g. `relevantMechanisms` on service_categories
4545
+ // entries (a cross-CVC reference into service_mechanisms by key).
4546
+ meta: {
4547
+ type: Schema9.Types.Mixed
4548
+ }
4549
+ };
4550
+ var cvcEntrySchemaOptions = {
4551
+ timestamps: true,
4552
+ collection: "cvc_entities",
4553
+ // `parentCode` defaults to null but Mongoose strips required-with-default
4554
+ // null assignments unless we keep minimize off.
4555
+ minimize: false
4556
+ };
4557
+ function buildCvcEntrySchema() {
4558
+ const schema = new Schema9(cvcEntrySchemaDefinition, cvcEntrySchemaOptions);
4559
+ schema.index(
4560
+ { domain: 1, version: 1, code: 1 },
4561
+ { unique: true }
4562
+ );
4563
+ schema.index(
4564
+ { domain: 1, version: 1, key: 1 },
4565
+ { unique: true }
4566
+ );
4567
+ schema.index({ domain: 1, version: 1, parentCode: 1 });
4568
+ return schema;
4569
+ }
4570
+ var _cvcEntrySchema = buildCvcEntrySchema();
4504
4571
  export {
4505
4572
  addressSchema,
4573
+ buildCvcEntrySchema,
4574
+ buildCvcRegistrySchema,
4506
4575
  buildFormSchema,
4507
4576
  buildPlatformFunctionSchema,
4508
4577
  buildPlatformRoleSchema,
@@ -4510,6 +4579,10 @@ export {
4510
4579
  buildScoringRuleSchema,
4511
4580
  buildSectionSchema,
4512
4581
  choiceSchema,
4582
+ cvcEntrySchemaDefinition,
4583
+ cvcEntrySchemaOptions,
4584
+ cvcRegistrySchemaDefinition,
4585
+ cvcRegistrySchemaOptions,
4513
4586
  demographicsSchema,
4514
4587
  emailSchema,
4515
4588
  formSchemaDefinition,