udp-schema 2.26.0 → 2.30.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.
Files changed (55) hide show
  1. package/dist/helpers.d.ts.map +1 -1
  2. package/dist/helpers.js +11 -1
  3. package/dist/helpers.js.map +1 -1
  4. package/dist/index.d.ts +2 -1
  5. package/dist/index.d.ts.map +1 -1
  6. package/dist/index.js +9 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/onboarding-config.d.ts.map +1 -1
  9. package/dist/onboarding-config.js +106 -0
  10. package/dist/onboarding-config.js.map +1 -1
  11. package/dist/onboarding-form.d.ts +378 -0
  12. package/dist/onboarding-form.d.ts.map +1 -1
  13. package/dist/profile-fields/07-employment.d.ts.map +1 -1
  14. package/dist/profile-fields/07-employment.js +175 -35
  15. package/dist/profile-fields/07-employment.js.map +1 -1
  16. package/dist/profile-fields/12-household.d.ts +15 -2
  17. package/dist/profile-fields/12-household.d.ts.map +1 -1
  18. package/dist/profile-fields/12-household.js +166 -17
  19. package/dist/profile-fields/12-household.js.map +1 -1
  20. package/dist/profile-fields/types.d.ts +12 -3
  21. package/dist/profile-fields/types.d.ts.map +1 -1
  22. package/dist/profile-fields/types.js.map +1 -1
  23. package/dist/progress-fields.d.ts.map +1 -1
  24. package/dist/progress-fields.js +17 -0
  25. package/dist/progress-fields.js.map +1 -1
  26. package/dist/shared-enums.d.ts +78 -0
  27. package/dist/shared-enums.d.ts.map +1 -0
  28. package/dist/shared-enums.js +184 -0
  29. package/dist/shared-enums.js.map +1 -0
  30. package/dist/step-01.schema.d.ts.map +1 -1
  31. package/dist/step-01.schema.js +8 -79
  32. package/dist/step-01.schema.js.map +1 -1
  33. package/dist/step-06.schema.d.ts.map +1 -1
  34. package/dist/step-06.schema.js +4 -13
  35. package/dist/step-06.schema.js.map +1 -1
  36. package/dist/step-07.schema.d.ts.map +1 -1
  37. package/dist/step-07.schema.js +8 -114
  38. package/dist/step-07.schema.js.map +1 -1
  39. package/dist/step-12.schema.d.ts +434 -3
  40. package/dist/step-12.schema.d.ts.map +1 -1
  41. package/dist/step-12.schema.js +72 -3
  42. package/dist/step-12.schema.js.map +1 -1
  43. package/package.json +1 -1
  44. package/dist/field-meta.d.ts +0 -20
  45. package/dist/field-meta.d.ts.map +0 -1
  46. package/dist/field-meta.js +0 -19
  47. package/dist/field-meta.js.map +0 -1
  48. package/dist/step-13.schema.d.ts +0 -186
  49. package/dist/step-13.schema.d.ts.map +0 -1
  50. package/dist/step-13.schema.js +0 -215
  51. package/dist/step-13.schema.js.map +0 -1
  52. package/dist/step-14.schema.d.ts +0 -88
  53. package/dist/step-14.schema.d.ts.map +0 -1
  54. package/dist/step-14.schema.js +0 -135
  55. package/dist/step-14.schema.js.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"step-07.schema.js","sourceRoot":"","sources":["../src/step-07.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,wBAAwB;IACxB,gBAAgB,EAAE,CAAC;SAChB,IAAI,CAAC;QACJ,UAAU;QACV,eAAe;QACf,YAAY;QACZ,SAAS;QACT,WAAW;QACX,SAAS;QACT,YAAY;QACZ,OAAO;KACR,CAAC;SACD,QAAQ,EAAE;IAEb;;;;;OAKG;IACH,UAAU,EAAE,CAAC;SACV,IAAI,CAAC;QACJ,aAAa;QACb,aAAa;QACb,aAAa;QACb,wBAAwB;QACxB,mBAAmB;QACnB,oBAAoB;QACpB,mBAAmB;QACnB,oBAAoB;QACpB,uBAAuB;QACvB,oBAAoB;QACpB,kBAAkB;QAClB,qBAAqB;QACrB,iBAAiB;QACjB,sBAAsB;QACtB,qBAAqB;QACrB,mBAAmB;QACnB,oBAAoB;QACpB,qBAAqB;QACrB,iBAAiB;QACjB,8BAA8B;QAC9B,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AAqB;QACrB,oBAAoB;QACpB,qBAAqB;QACrB,iBAAiB;QACjB,gBAAgB;QAChB,mBAAmB;QACnB,kBAAkB;QAClB,wBAAwB;QACxB,OAAO;QACP,gBAAgB;QAChB,qBAAqB;QACrB,oBAAoB;QACpB,iBAAiB;QACjB,qBAAqB;QACrB,aAAa;QACb,kBAAkB;QAClB,eAAe;QACf,eAAe;QACf,iBAAiB;QACjB,qBAAqB;QACrB,gBAAgB;QAChB,iBAAiB;QACjB,eAAe;QACf,SAAS;QACT,WAAW;QACX,SAAS;QACT,aAAa;QACb,2BAA2B;QAC3B,OAAO;QACP,mBAAmB;KACpB,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * Step 07 — Employment & Occupation\n *\n * Fields: employmentStatus, occupation, workShift, comfortableWithShift,\n * desiredShift, incomeRange, dreamOccupation\n *\n * @module udp-schema/step-07\n */\n\nimport { z } from 'zod';\n\n// ─── Main Step 07 Schema ────────────────────────────────────────────────────\n\nexport const step07EmploymentSchema = z.object({\n /** Employment status */\n employmentStatus: z\n .enum([\n 'employed',\n 'self_employed',\n 'unemployed',\n 'student',\n 'homemaker',\n 'retired',\n 'daily_wage',\n 'other',\n ])\n .optional(),\n\n /**\n * Occupation — exhaustive Indian profession enum, mirrored from\n * dating-schema's `profession` field. Keep these values in sync with\n * `occupationOptions` in profile-fields/07-employment.ts and with\n * dating-schema's profession options.\n */\n occupation: z\n .enum([\n // Technology\n 'it_software',\n 'engineering',\n // Healthcare & Medicine\n 'healthcare_doctor',\n 'healthcare_nursing',\n 'healthcare_pharma',\n 'psychology_therapy',\n // Education & Research\n 'education_teaching',\n 'science_research',\n // Finance & Business\n 'finance_banking',\n 'chartered_accountant',\n 'business_management',\n // Creative & Media\n 'arts_entertainment',\n 'media_communication',\n 'design_creative',\n // Government & Public Service\n 'civil_services',\n 'government_public',\n 'defence_military',\n 'police_law_enforcement',\n // Legal\n 'legal',\n // Trades & Services\n 'skilled_trades',\n 'transport_logistics',\n 'hospitality_travel',\n 'beauty_wellness',\n // Agriculture & Rural\n 'agriculture_farming',\n // Real Estate & Construction\n 'real_estate',\n // Retail & Commerce\n 'retail_ecommerce',\n 'manufacturing',\n // Maritime\n 'merchant_navy',\n // Social & NGO\n 'ngo_social_work',\n 'religious_spiritual',\n // Independent\n 'freelancer_gig',\n 'content_creator',\n 'self_employed',\n // Non-working\n 'student',\n 'homemaker',\n 'retired',\n 'not_working',\n 'differently_abled_pension',\n 'other',\n 'prefer_not_to_say',\n ])\n .optional(),\n\n /** Current work shift */\n workShift: z\n .enum(['day_shift', 'night_shift', 'rotating', 'flexible', 'work_from_home', 'not_applicable'])\n .optional(),\n\n /** Comfortable with current shift? */\n comfortableWithShift: z.enum(['yes', 'no', 'somewhat']).optional(),\n\n /** Desired shift */\n desiredShift: z\n .enum(['day_shift', 'night_shift', 'rotating', 'flexible', 'work_from_home', 'not_applicable'])\n .optional(),\n\n /** Income range */\n incomeRange: z.string().trim().optional(),\n\n /**\n * Dream occupation — same enum as `occupation` above. Answers\n * \"If you could start over, what would you do?\" using the canonical\n * profession enum so the two fields are directly comparable.\n */\n dreamOccupation: z\n .enum([\n 'it_software',\n 'engineering',\n 'healthcare_doctor',\n 'healthcare_nursing',\n 'healthcare_pharma',\n 'psychology_therapy',\n 'education_teaching',\n 'science_research',\n 'finance_banking',\n 'chartered_accountant',\n 'business_management',\n 'arts_entertainment',\n 'media_communication',\n 'design_creative',\n 'civil_services',\n 'government_public',\n 'defence_military',\n 'police_law_enforcement',\n 'legal',\n 'skilled_trades',\n 'transport_logistics',\n 'hospitality_travel',\n 'beauty_wellness',\n 'agriculture_farming',\n 'real_estate',\n 'retail_ecommerce',\n 'manufacturing',\n 'merchant_navy',\n 'ngo_social_work',\n 'religious_spiritual',\n 'freelancer_gig',\n 'content_creator',\n 'self_employed',\n 'student',\n 'homemaker',\n 'retired',\n 'not_working',\n 'differently_abled_pension',\n 'other',\n 'prefer_not_to_say',\n ])\n .optional(),\n});\n\n// ─── Inferred types ─────────────────────────────────────────────────────────\n\nexport type Step07EmploymentInput = z.infer<typeof step07EmploymentSchema>;\n"]}
1
+ {"version":3,"file":"step-07.schema.js","sourceRoot":"","sources":["../src/step-07.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAEtD,+EAA+E;AAE/E,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7C,wBAAwB;IACxB,gBAAgB,EAAE,CAAC;SAChB,IAAI,CAAC;QACJ,UAAU;QACV,eAAe;QACf,YAAY;QACZ,SAAS;QACT,WAAW;QACX,SAAS;QACT,YAAY;QACZ,OAAO;KACR,CAAC;SACD,QAAQ,EAAE;IAEb;;sCAEkC;IAClC,UAAU,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;IAEhD,yBAAyB;IACzB,SAAS,EAAE,CAAC;SACT,IAAI,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;SAC9F,QAAQ,EAAE;IAEb,sCAAsC;IACtC,oBAAoB,EAAE,CAAC,CAAC,IAAI,CAAC,CAAC,KAAK,EAAE,IAAI,EAAE,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE;IAElE,oBAAoB;IACpB,YAAY,EAAE,CAAC;SACZ,IAAI,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,UAAU,EAAE,UAAU,EAAE,gBAAgB,EAAE,gBAAgB,CAAC,CAAC;SAC9F,QAAQ,EAAE;IAEb,mBAAmB;IACnB,WAAW,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAEzC;qDACiD;IACjD,eAAe,EAAE,CAAC,CAAC,IAAI,CAAC,iBAAiB,CAAC,CAAC,QAAQ,EAAE;CACtD,CAAC,CAAC","sourcesContent":["/**\n * Step 07 — Employment & Occupation\n *\n * Fields: employmentStatus, occupation, workShift, comfortableWithShift,\n * desiredShift, incomeRange, dreamOccupation\n *\n * @module udp-schema/step-07\n */\n\nimport { z } from 'zod';\nimport { OCCUPATION_VALUES } from './shared-enums.js';\n\n// ─── Main Step 07 Schema ────────────────────────────────────────────────────\n\nexport const step07EmploymentSchema = z.object({\n /** Employment status */\n employmentStatus: z\n .enum([\n 'employed',\n 'self_employed',\n 'unemployed',\n 'student',\n 'homemaker',\n 'retired',\n 'daily_wage',\n 'other',\n ])\n .optional(),\n\n /** Occupation — canonical 39-value taxonomy from `shared-enums`.\n * Shared with dating-schema's `profession` and any future service\n * profile's occupation field. */\n occupation: z.enum(OCCUPATION_VALUES).optional(),\n\n /** Current work shift */\n workShift: z\n .enum(['day_shift', 'night_shift', 'rotating', 'flexible', 'work_from_home', 'not_applicable'])\n .optional(),\n\n /** Comfortable with current shift? */\n comfortableWithShift: z.enum(['yes', 'no', 'somewhat']).optional(),\n\n /** Desired shift */\n desiredShift: z\n .enum(['day_shift', 'night_shift', 'rotating', 'flexible', 'work_from_home', 'not_applicable'])\n .optional(),\n\n /** Income range */\n incomeRange: z.string().trim().optional(),\n\n /** Dream occupation — same canonical 39-value enum as `occupation`,\n * so the two fields are directly comparable. */\n dreamOccupation: z.enum(OCCUPATION_VALUES).optional(),\n});\n\n// ─── Inferred types ─────────────────────────────────────────────────────────\n\nexport type Step07EmploymentInput = z.infer<typeof step07EmploymentSchema>;\n"]}
@@ -1,13 +1,64 @@
1
1
  /**
2
2
  * Step 12 — Household & Economic Profile
3
3
  *
4
- * Fields: maritalStatus, familyMembers, numberOfDependents, housingType,
5
- * householdIncome, bplCard, digitalAccess, migrationStatus,
6
- * landOwnership, primaryIncomeSource
4
+ * Fields: maritalStatus, familyMembers, [14 link sub-step fields gated on
5
+ * familyMembers], numberOfDependents, housingType, householdIncome,
6
+ * bplCard, digitalAccess, migrationStatus, landOwnership, primaryIncomeSource
7
+ *
8
+ * Family member linking:
9
+ * After picking familyMembers (sub-step 2), up to 14 conditional sub-steps
10
+ * appear — one per family-member type the user selected. Each sub-step
11
+ * shows a search UI (by name / email / phone) and lets the user link an
12
+ * existing platform account. Single-instance relations (mother / father
13
+ * / step_*) save as a single link object; multi-instance relations
14
+ * (siblings / children / spouse / other) save as an array.
15
+ *
16
+ * The schema accepts these fields here so they can be validated at save
17
+ * time. The same data is also written to the User collection's
18
+ * `relations` sub-doc on save (indexed for graph traversal).
7
19
  *
8
20
  * @module udp-schema/step-12
9
21
  */
10
22
  import { z } from 'zod';
23
+ /**
24
+ * One family-link entry. `_id` is server-assigned on insert. Both `linkedUserId`
25
+ * and `cachedName` are written together (per the "save id + name" decision —
26
+ * id for joins / graph traversal, name for display without an extra lookup).
27
+ *
28
+ * `mutuallyConfirmed` flips to true when the *other* user adds a reciprocal
29
+ * relation pointing back at this user (computed server-side on save).
30
+ *
31
+ * `verified` / `verifiedAt` / `verifiedBy` are populated when the initiating
32
+ * volunteer marks the family-relations field group as verified per the
33
+ * member's official ID (Phase 4 of the rollout).
34
+ */
35
+ declare const familyLinkSchema: z.ZodObject<{
36
+ _id: z.ZodOptional<z.ZodString>;
37
+ relation: z.ZodEnum<{
38
+ other: "other";
39
+ father: "father";
40
+ mother: "mother";
41
+ step_father: "step_father";
42
+ step_mother: "step_mother";
43
+ wife_husband: "wife_husband";
44
+ blood_brother: "blood_brother";
45
+ blood_sister: "blood_sister";
46
+ half_brother: "half_brother";
47
+ half_sister: "half_sister";
48
+ step_brother: "step_brother";
49
+ step_sister: "step_sister";
50
+ son: "son";
51
+ daughter: "daughter";
52
+ }>;
53
+ linkedUserId: z.ZodString;
54
+ cachedName: z.ZodString;
55
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
56
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
57
+ verified: z.ZodDefault<z.ZodBoolean>;
58
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
59
+ verifiedBy: z.ZodOptional<z.ZodString>;
60
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
61
+ }, z.core.$strip>;
11
62
  export declare const step12HouseholdSchema: z.ZodObject<{
12
63
  maritalStatus: z.ZodOptional<z.ZodEnum<{
13
64
  prefer_not_to_say: "prefer_not_to_say";
@@ -18,6 +69,384 @@ export declare const step12HouseholdSchema: z.ZodObject<{
18
69
  separated: "separated";
19
70
  }>>;
20
71
  familyMembers: z.ZodOptional<z.ZodArray<z.ZodString>>;
72
+ linkedMother: z.ZodOptional<z.ZodObject<{
73
+ _id: z.ZodOptional<z.ZodString>;
74
+ relation: z.ZodEnum<{
75
+ other: "other";
76
+ father: "father";
77
+ mother: "mother";
78
+ step_father: "step_father";
79
+ step_mother: "step_mother";
80
+ wife_husband: "wife_husband";
81
+ blood_brother: "blood_brother";
82
+ blood_sister: "blood_sister";
83
+ half_brother: "half_brother";
84
+ half_sister: "half_sister";
85
+ step_brother: "step_brother";
86
+ step_sister: "step_sister";
87
+ son: "son";
88
+ daughter: "daughter";
89
+ }>;
90
+ linkedUserId: z.ZodString;
91
+ cachedName: z.ZodString;
92
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
93
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
94
+ verified: z.ZodDefault<z.ZodBoolean>;
95
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
96
+ verifiedBy: z.ZodOptional<z.ZodString>;
97
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
98
+ }, z.core.$strip>>;
99
+ linkedStepMother: z.ZodOptional<z.ZodObject<{
100
+ _id: z.ZodOptional<z.ZodString>;
101
+ relation: z.ZodEnum<{
102
+ other: "other";
103
+ father: "father";
104
+ mother: "mother";
105
+ step_father: "step_father";
106
+ step_mother: "step_mother";
107
+ wife_husband: "wife_husband";
108
+ blood_brother: "blood_brother";
109
+ blood_sister: "blood_sister";
110
+ half_brother: "half_brother";
111
+ half_sister: "half_sister";
112
+ step_brother: "step_brother";
113
+ step_sister: "step_sister";
114
+ son: "son";
115
+ daughter: "daughter";
116
+ }>;
117
+ linkedUserId: z.ZodString;
118
+ cachedName: z.ZodString;
119
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
120
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
121
+ verified: z.ZodDefault<z.ZodBoolean>;
122
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
123
+ verifiedBy: z.ZodOptional<z.ZodString>;
124
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
125
+ }, z.core.$strip>>;
126
+ linkedFather: z.ZodOptional<z.ZodObject<{
127
+ _id: z.ZodOptional<z.ZodString>;
128
+ relation: z.ZodEnum<{
129
+ other: "other";
130
+ father: "father";
131
+ mother: "mother";
132
+ step_father: "step_father";
133
+ step_mother: "step_mother";
134
+ wife_husband: "wife_husband";
135
+ blood_brother: "blood_brother";
136
+ blood_sister: "blood_sister";
137
+ half_brother: "half_brother";
138
+ half_sister: "half_sister";
139
+ step_brother: "step_brother";
140
+ step_sister: "step_sister";
141
+ son: "son";
142
+ daughter: "daughter";
143
+ }>;
144
+ linkedUserId: z.ZodString;
145
+ cachedName: z.ZodString;
146
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
147
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
148
+ verified: z.ZodDefault<z.ZodBoolean>;
149
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
150
+ verifiedBy: z.ZodOptional<z.ZodString>;
151
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
152
+ }, z.core.$strip>>;
153
+ linkedStepFather: z.ZodOptional<z.ZodObject<{
154
+ _id: z.ZodOptional<z.ZodString>;
155
+ relation: z.ZodEnum<{
156
+ other: "other";
157
+ father: "father";
158
+ mother: "mother";
159
+ step_father: "step_father";
160
+ step_mother: "step_mother";
161
+ wife_husband: "wife_husband";
162
+ blood_brother: "blood_brother";
163
+ blood_sister: "blood_sister";
164
+ half_brother: "half_brother";
165
+ half_sister: "half_sister";
166
+ step_brother: "step_brother";
167
+ step_sister: "step_sister";
168
+ son: "son";
169
+ daughter: "daughter";
170
+ }>;
171
+ linkedUserId: z.ZodString;
172
+ cachedName: z.ZodString;
173
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
174
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
175
+ verified: z.ZodDefault<z.ZodBoolean>;
176
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
177
+ verifiedBy: z.ZodOptional<z.ZodString>;
178
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
179
+ }, z.core.$strip>>;
180
+ linkedSpouses: z.ZodOptional<z.ZodArray<z.ZodObject<{
181
+ _id: z.ZodOptional<z.ZodString>;
182
+ relation: z.ZodEnum<{
183
+ other: "other";
184
+ father: "father";
185
+ mother: "mother";
186
+ step_father: "step_father";
187
+ step_mother: "step_mother";
188
+ wife_husband: "wife_husband";
189
+ blood_brother: "blood_brother";
190
+ blood_sister: "blood_sister";
191
+ half_brother: "half_brother";
192
+ half_sister: "half_sister";
193
+ step_brother: "step_brother";
194
+ step_sister: "step_sister";
195
+ son: "son";
196
+ daughter: "daughter";
197
+ }>;
198
+ linkedUserId: z.ZodString;
199
+ cachedName: z.ZodString;
200
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
201
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
202
+ verified: z.ZodDefault<z.ZodBoolean>;
203
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
204
+ verifiedBy: z.ZodOptional<z.ZodString>;
205
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
206
+ }, z.core.$strip>>>;
207
+ linkedBloodSisters: z.ZodOptional<z.ZodArray<z.ZodObject<{
208
+ _id: z.ZodOptional<z.ZodString>;
209
+ relation: z.ZodEnum<{
210
+ other: "other";
211
+ father: "father";
212
+ mother: "mother";
213
+ step_father: "step_father";
214
+ step_mother: "step_mother";
215
+ wife_husband: "wife_husband";
216
+ blood_brother: "blood_brother";
217
+ blood_sister: "blood_sister";
218
+ half_brother: "half_brother";
219
+ half_sister: "half_sister";
220
+ step_brother: "step_brother";
221
+ step_sister: "step_sister";
222
+ son: "son";
223
+ daughter: "daughter";
224
+ }>;
225
+ linkedUserId: z.ZodString;
226
+ cachedName: z.ZodString;
227
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
228
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
229
+ verified: z.ZodDefault<z.ZodBoolean>;
230
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
231
+ verifiedBy: z.ZodOptional<z.ZodString>;
232
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
233
+ }, z.core.$strip>>>;
234
+ linkedHalfSisters: z.ZodOptional<z.ZodArray<z.ZodObject<{
235
+ _id: z.ZodOptional<z.ZodString>;
236
+ relation: z.ZodEnum<{
237
+ other: "other";
238
+ father: "father";
239
+ mother: "mother";
240
+ step_father: "step_father";
241
+ step_mother: "step_mother";
242
+ wife_husband: "wife_husband";
243
+ blood_brother: "blood_brother";
244
+ blood_sister: "blood_sister";
245
+ half_brother: "half_brother";
246
+ half_sister: "half_sister";
247
+ step_brother: "step_brother";
248
+ step_sister: "step_sister";
249
+ son: "son";
250
+ daughter: "daughter";
251
+ }>;
252
+ linkedUserId: z.ZodString;
253
+ cachedName: z.ZodString;
254
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
255
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
256
+ verified: z.ZodDefault<z.ZodBoolean>;
257
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
258
+ verifiedBy: z.ZodOptional<z.ZodString>;
259
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
260
+ }, z.core.$strip>>>;
261
+ linkedStepSisters: z.ZodOptional<z.ZodArray<z.ZodObject<{
262
+ _id: z.ZodOptional<z.ZodString>;
263
+ relation: z.ZodEnum<{
264
+ other: "other";
265
+ father: "father";
266
+ mother: "mother";
267
+ step_father: "step_father";
268
+ step_mother: "step_mother";
269
+ wife_husband: "wife_husband";
270
+ blood_brother: "blood_brother";
271
+ blood_sister: "blood_sister";
272
+ half_brother: "half_brother";
273
+ half_sister: "half_sister";
274
+ step_brother: "step_brother";
275
+ step_sister: "step_sister";
276
+ son: "son";
277
+ daughter: "daughter";
278
+ }>;
279
+ linkedUserId: z.ZodString;
280
+ cachedName: z.ZodString;
281
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
282
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
283
+ verified: z.ZodDefault<z.ZodBoolean>;
284
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
285
+ verifiedBy: z.ZodOptional<z.ZodString>;
286
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
287
+ }, z.core.$strip>>>;
288
+ linkedBloodBrothers: z.ZodOptional<z.ZodArray<z.ZodObject<{
289
+ _id: z.ZodOptional<z.ZodString>;
290
+ relation: z.ZodEnum<{
291
+ other: "other";
292
+ father: "father";
293
+ mother: "mother";
294
+ step_father: "step_father";
295
+ step_mother: "step_mother";
296
+ wife_husband: "wife_husband";
297
+ blood_brother: "blood_brother";
298
+ blood_sister: "blood_sister";
299
+ half_brother: "half_brother";
300
+ half_sister: "half_sister";
301
+ step_brother: "step_brother";
302
+ step_sister: "step_sister";
303
+ son: "son";
304
+ daughter: "daughter";
305
+ }>;
306
+ linkedUserId: z.ZodString;
307
+ cachedName: z.ZodString;
308
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
309
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
310
+ verified: z.ZodDefault<z.ZodBoolean>;
311
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
312
+ verifiedBy: z.ZodOptional<z.ZodString>;
313
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
314
+ }, z.core.$strip>>>;
315
+ linkedHalfBrothers: z.ZodOptional<z.ZodArray<z.ZodObject<{
316
+ _id: z.ZodOptional<z.ZodString>;
317
+ relation: z.ZodEnum<{
318
+ other: "other";
319
+ father: "father";
320
+ mother: "mother";
321
+ step_father: "step_father";
322
+ step_mother: "step_mother";
323
+ wife_husband: "wife_husband";
324
+ blood_brother: "blood_brother";
325
+ blood_sister: "blood_sister";
326
+ half_brother: "half_brother";
327
+ half_sister: "half_sister";
328
+ step_brother: "step_brother";
329
+ step_sister: "step_sister";
330
+ son: "son";
331
+ daughter: "daughter";
332
+ }>;
333
+ linkedUserId: z.ZodString;
334
+ cachedName: z.ZodString;
335
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
336
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
337
+ verified: z.ZodDefault<z.ZodBoolean>;
338
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
339
+ verifiedBy: z.ZodOptional<z.ZodString>;
340
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
341
+ }, z.core.$strip>>>;
342
+ linkedStepBrothers: z.ZodOptional<z.ZodArray<z.ZodObject<{
343
+ _id: z.ZodOptional<z.ZodString>;
344
+ relation: z.ZodEnum<{
345
+ other: "other";
346
+ father: "father";
347
+ mother: "mother";
348
+ step_father: "step_father";
349
+ step_mother: "step_mother";
350
+ wife_husband: "wife_husband";
351
+ blood_brother: "blood_brother";
352
+ blood_sister: "blood_sister";
353
+ half_brother: "half_brother";
354
+ half_sister: "half_sister";
355
+ step_brother: "step_brother";
356
+ step_sister: "step_sister";
357
+ son: "son";
358
+ daughter: "daughter";
359
+ }>;
360
+ linkedUserId: z.ZodString;
361
+ cachedName: z.ZodString;
362
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
363
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
364
+ verified: z.ZodDefault<z.ZodBoolean>;
365
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
366
+ verifiedBy: z.ZodOptional<z.ZodString>;
367
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
368
+ }, z.core.$strip>>>;
369
+ linkedDaughters: z.ZodOptional<z.ZodArray<z.ZodObject<{
370
+ _id: z.ZodOptional<z.ZodString>;
371
+ relation: z.ZodEnum<{
372
+ other: "other";
373
+ father: "father";
374
+ mother: "mother";
375
+ step_father: "step_father";
376
+ step_mother: "step_mother";
377
+ wife_husband: "wife_husband";
378
+ blood_brother: "blood_brother";
379
+ blood_sister: "blood_sister";
380
+ half_brother: "half_brother";
381
+ half_sister: "half_sister";
382
+ step_brother: "step_brother";
383
+ step_sister: "step_sister";
384
+ son: "son";
385
+ daughter: "daughter";
386
+ }>;
387
+ linkedUserId: z.ZodString;
388
+ cachedName: z.ZodString;
389
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
390
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
391
+ verified: z.ZodDefault<z.ZodBoolean>;
392
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
393
+ verifiedBy: z.ZodOptional<z.ZodString>;
394
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
395
+ }, z.core.$strip>>>;
396
+ linkedSons: z.ZodOptional<z.ZodArray<z.ZodObject<{
397
+ _id: z.ZodOptional<z.ZodString>;
398
+ relation: z.ZodEnum<{
399
+ other: "other";
400
+ father: "father";
401
+ mother: "mother";
402
+ step_father: "step_father";
403
+ step_mother: "step_mother";
404
+ wife_husband: "wife_husband";
405
+ blood_brother: "blood_brother";
406
+ blood_sister: "blood_sister";
407
+ half_brother: "half_brother";
408
+ half_sister: "half_sister";
409
+ step_brother: "step_brother";
410
+ step_sister: "step_sister";
411
+ son: "son";
412
+ daughter: "daughter";
413
+ }>;
414
+ linkedUserId: z.ZodString;
415
+ cachedName: z.ZodString;
416
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
417
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
418
+ verified: z.ZodDefault<z.ZodBoolean>;
419
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
420
+ verifiedBy: z.ZodOptional<z.ZodString>;
421
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
422
+ }, z.core.$strip>>>;
423
+ linkedOthers: z.ZodOptional<z.ZodArray<z.ZodObject<{
424
+ _id: z.ZodOptional<z.ZodString>;
425
+ relation: z.ZodEnum<{
426
+ other: "other";
427
+ father: "father";
428
+ mother: "mother";
429
+ step_father: "step_father";
430
+ step_mother: "step_mother";
431
+ wife_husband: "wife_husband";
432
+ blood_brother: "blood_brother";
433
+ blood_sister: "blood_sister";
434
+ half_brother: "half_brother";
435
+ half_sister: "half_sister";
436
+ step_brother: "step_brother";
437
+ step_sister: "step_sister";
438
+ son: "son";
439
+ daughter: "daughter";
440
+ }>;
441
+ linkedUserId: z.ZodString;
442
+ cachedName: z.ZodString;
443
+ cachedAvatarUrl: z.ZodOptional<z.ZodString>;
444
+ mutuallyConfirmed: z.ZodDefault<z.ZodBoolean>;
445
+ verified: z.ZodDefault<z.ZodBoolean>;
446
+ verifiedAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
447
+ verifiedBy: z.ZodOptional<z.ZodString>;
448
+ createdAt: z.ZodOptional<z.ZodCoercedDate<unknown>>;
449
+ }, z.core.$strip>>>;
21
450
  numberOfDependents: z.ZodOptional<z.ZodNumber>;
22
451
  housingType: z.ZodOptional<z.ZodEnum<{
23
452
  other: "other";
@@ -63,4 +492,6 @@ export declare const step12HouseholdSchema: z.ZodObject<{
63
492
  }>>;
64
493
  }, z.core.$strip>;
65
494
  export type Step12HouseholdInput = z.infer<typeof step12HouseholdSchema>;
495
+ export type FamilyLink = z.infer<typeof familyLinkSchema>;
496
+ export {};
66
497
  //# sourceMappingURL=step-12.schema.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"step-12.schema.d.ts","sourceRoot":"","sources":["../src/step-12.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBAyDhC,CAAC;AAIH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC"}
1
+ {"version":3,"file":"step-12.schema.d.ts","sourceRoot":"","sources":["../src/step-12.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAIxB;;;;;;;;;;;GAWG;AACH,QAAA,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;iBA0BpB,CAAC;AAIH,eAAO,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;iBA4EhC,CAAC;AAIH,MAAM,MAAM,oBAAoB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AACzE,MAAM,MAAM,UAAU,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
@@ -1,13 +1,65 @@
1
1
  /**
2
2
  * Step 12 — Household & Economic Profile
3
3
  *
4
- * Fields: maritalStatus, familyMembers, numberOfDependents, housingType,
5
- * householdIncome, bplCard, digitalAccess, migrationStatus,
6
- * landOwnership, primaryIncomeSource
4
+ * Fields: maritalStatus, familyMembers, [14 link sub-step fields gated on
5
+ * familyMembers], numberOfDependents, housingType, householdIncome,
6
+ * bplCard, digitalAccess, migrationStatus, landOwnership, primaryIncomeSource
7
+ *
8
+ * Family member linking:
9
+ * After picking familyMembers (sub-step 2), up to 14 conditional sub-steps
10
+ * appear — one per family-member type the user selected. Each sub-step
11
+ * shows a search UI (by name / email / phone) and lets the user link an
12
+ * existing platform account. Single-instance relations (mother / father
13
+ * / step_*) save as a single link object; multi-instance relations
14
+ * (siblings / children / spouse / other) save as an array.
15
+ *
16
+ * The schema accepts these fields here so they can be validated at save
17
+ * time. The same data is also written to the User collection's
18
+ * `relations` sub-doc on save (indexed for graph traversal).
7
19
  *
8
20
  * @module udp-schema/step-12
9
21
  */
10
22
  import { z } from 'zod';
23
+ // ─── Family-link sub-schema ─────────────────────────────────────────────────
24
+ /**
25
+ * One family-link entry. `_id` is server-assigned on insert. Both `linkedUserId`
26
+ * and `cachedName` are written together (per the "save id + name" decision —
27
+ * id for joins / graph traversal, name for display without an extra lookup).
28
+ *
29
+ * `mutuallyConfirmed` flips to true when the *other* user adds a reciprocal
30
+ * relation pointing back at this user (computed server-side on save).
31
+ *
32
+ * `verified` / `verifiedAt` / `verifiedBy` are populated when the initiating
33
+ * volunteer marks the family-relations field group as verified per the
34
+ * member's official ID (Phase 4 of the rollout).
35
+ */
36
+ const familyLinkSchema = z.object({
37
+ _id: z.string().optional(),
38
+ relation: z.enum([
39
+ 'mother',
40
+ 'step_mother',
41
+ 'father',
42
+ 'step_father',
43
+ 'wife_husband',
44
+ 'blood_sister',
45
+ 'half_sister',
46
+ 'step_sister',
47
+ 'blood_brother',
48
+ 'half_brother',
49
+ 'step_brother',
50
+ 'daughter',
51
+ 'son',
52
+ 'other',
53
+ ]),
54
+ linkedUserId: z.string(),
55
+ cachedName: z.string(),
56
+ cachedAvatarUrl: z.string().optional(),
57
+ mutuallyConfirmed: z.boolean().default(false),
58
+ verified: z.boolean().default(false),
59
+ verifiedAt: z.coerce.date().optional(),
60
+ verifiedBy: z.string().optional(),
61
+ createdAt: z.coerce.date().optional(),
62
+ });
11
63
  // ─── Main Step 12 Schema ────────────────────────────────────────────────────
12
64
  export const step12HouseholdSchema = z.object({
13
65
  /** Marital status */
@@ -16,6 +68,23 @@ export const step12HouseholdSchema = z.object({
16
68
  .optional(),
17
69
  /** Family members present (multi-select string array) */
18
70
  familyMembers: z.array(z.string().trim()).optional(),
71
+ // ── Family-link fields (gated on familyMembers via includesAny) ──
72
+ // Single-instance relations: at most one link
73
+ linkedMother: familyLinkSchema.optional(),
74
+ linkedStepMother: familyLinkSchema.optional(),
75
+ linkedFather: familyLinkSchema.optional(),
76
+ linkedStepFather: familyLinkSchema.optional(),
77
+ // Multi-instance relations: arrays
78
+ linkedSpouses: z.array(familyLinkSchema).optional(),
79
+ linkedBloodSisters: z.array(familyLinkSchema).optional(),
80
+ linkedHalfSisters: z.array(familyLinkSchema).optional(),
81
+ linkedStepSisters: z.array(familyLinkSchema).optional(),
82
+ linkedBloodBrothers: z.array(familyLinkSchema).optional(),
83
+ linkedHalfBrothers: z.array(familyLinkSchema).optional(),
84
+ linkedStepBrothers: z.array(familyLinkSchema).optional(),
85
+ linkedDaughters: z.array(familyLinkSchema).optional(),
86
+ linkedSons: z.array(familyLinkSchema).optional(),
87
+ linkedOthers: z.array(familyLinkSchema).optional(),
19
88
  /** Number of financial dependents */
20
89
  numberOfDependents: z.number().int().min(0).max(50).optional(),
21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ACvB,eAAe,EAAE,CAAC;SACf,IAAI,CAAC,CAAC,QAAQ,EAAE,iBAAiB,EAAE,cAAc,EAAE,aAAa,EAAE,eAAe,CAAC,CAAC;SACnF,QAAQ,EAAE;IAEb,qBAAqB;IACrB,aAAa,EAAE,CAAC;SACb,IAAI,CAAC;QACJ,kBAAkB;QAClB,iBAAiB;QACjB,qBAAqB;QACrB,SAAS;QACT,QAAQ;QACR,OAAO;KACR,CAAC;SACD,QAAQ,EAAE;IAEb,4BAA4B;IAC5B,mBAAmB,EAAE,CAAC;SACnB,IAAI,CAAC;QACJ,aAAa;QACb,gBAAgB;QAChB,aAAa;QACb,UAAU;QACV,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,iBAAiB;QACjB,OAAO;KACR,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * Step 12 — Household & Economic Profile\n *\n * Fields: maritalStatus, familyMembers, numberOfDependents, housingType,\n * householdIncome, bplCard, digitalAccess, migrationStatus,\n * landOwnership, primaryIncomeSource\n *\n * @module udp-schema/step-12\n */\n\nimport { z } from 'zod';\n\n// ─── Main Step 12 Schema ────────────────────────────────────────────────────\n\nexport const step12HouseholdSchema = z.object({\n /** Marital status */\n maritalStatus: z\n .enum(['single', 'married', 'divorced', 'widowed', 'separated', 'prefer_not_to_say'])\n .optional(),\n\n /** Family members present (multi-select string array) */\n familyMembers: z.array(z.string().trim()).optional(),\n\n /** Number of financial dependents */\n numberOfDependents: z.number().int().min(0).max(50).optional(),\n\n /** Housing type */\n housingType: z\n .enum(['own_house', 'rented', 'government_quarters', 'shared', 'homeless', 'other'])\n .optional(),\n\n /** Household income range (monthly) */\n householdIncome: z.string().trim().optional(),\n\n /** Below Poverty Line card */\n bplCard: z.enum(['yes', 'no', 'applied', 'dont_know']).optional(),\n\n /** Digital access (multi-select string array) */\n digitalAccess: z.array(z.string().trim()).optional(),\n\n /** Migration status */\n migrationStatus: z\n .enum(['native', 'within_district', 'within_state', 'inter_state', 'international'])\n .optional(),\n\n /** Land ownership */\n landOwnership: z\n .enum([\n 'own_agricultural',\n 'own_residential',\n 'government_allotted',\n 'no_land',\n 'leased',\n 'other',\n ])\n .optional(),\n\n /** Primary income source */\n primaryIncomeSource: z\n .enum([\n 'agriculture',\n 'government_job',\n 'private_job',\n 'business',\n 'daily_wage',\n 'pension',\n 'remittance',\n 'no_fixed_income',\n 'other',\n ])\n .optional(),\n});\n\n// ─── Inferred types ─────────────────────────────────────────────────────────\n\nexport type Step12HouseholdInput = z.infer<typeof step12HouseholdSchema>;\n"]}
1
+ {"version":3,"file":"step-12.schema.js","sourceRoot":"","sources":["../src/step-12.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,+EAA+E;AAE/E;;;;;;;;;;;GAWG;AACH,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC;IAChC,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC1B,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC;QACf,QAAQ;QACR,aAAa;QACb,QAAQ;QACR,aAAa;QACb,cAAc;QACd,cAAc;QACd,aAAa;QACb,aAAa;QACb,eAAe;QACf,cAAc;QACd,cAAc;QACd,UAAU;QACV,KAAK;QACL,OAAO;KACR,CAAC;IACF,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;IACxB,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE;IACtB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IACtC,iBAAiB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IAC7C,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC;IACpC,UAAU,EAAE,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,QAAQ,E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B,SAAS;QACT,QAAQ;QACR,OAAO;KACR,CAAC;SACD,QAAQ,EAAE;IAEb,4BAA4B;IAC5B,mBAAmB,EAAE,CAAC;SACnB,IAAI,CAAC;QACJ,aAAa;QACb,gBAAgB;QAChB,aAAa;QACb,UAAU;QACV,YAAY;QACZ,SAAS;QACT,YAAY;QACZ,iBAAiB;QACjB,OAAO;KACR,CAAC;SACD,QAAQ,EAAE;CACd,CAAC,CAAC","sourcesContent":["/**\n * Step 12 — Household & Economic Profile\n *\n * Fields: maritalStatus, familyMembers, [14 link sub-step fields gated on\n * familyMembers], numberOfDependents, housingType, householdIncome,\n * bplCard, digitalAccess, migrationStatus, landOwnership, primaryIncomeSource\n *\n * Family member linking:\n * After picking familyMembers (sub-step 2), up to 14 conditional sub-steps\n * appear — one per family-member type the user selected. Each sub-step\n * shows a search UI (by name / email / phone) and lets the user link an\n * existing platform account. Single-instance relations (mother / father\n * / step_*) save as a single link object; multi-instance relations\n * (siblings / children / spouse / other) save as an array.\n *\n * The schema accepts these fields here so they can be validated at save\n * time. The same data is also written to the User collection's\n * `relations` sub-doc on save (indexed for graph traversal).\n *\n * @module udp-schema/step-12\n */\n\nimport { z } from 'zod';\n\n// ─── Family-link sub-schema ─────────────────────────────────────────────────\n\n/**\n * One family-link entry. `_id` is server-assigned on insert. Both `linkedUserId`\n * and `cachedName` are written together (per the \"save id + name\" decision —\n * id for joins / graph traversal, name for display without an extra lookup).\n *\n * `mutuallyConfirmed` flips to true when the *other* user adds a reciprocal\n * relation pointing back at this user (computed server-side on save).\n *\n * `verified` / `verifiedAt` / `verifiedBy` are populated when the initiating\n * volunteer marks the family-relations field group as verified per the\n * member's official ID (Phase 4 of the rollout).\n */\nconst familyLinkSchema = z.object({\n _id: z.string().optional(),\n relation: z.enum([\n 'mother',\n 'step_mother',\n 'father',\n 'step_father',\n 'wife_husband',\n 'blood_sister',\n 'half_sister',\n 'step_sister',\n 'blood_brother',\n 'half_brother',\n 'step_brother',\n 'daughter',\n 'son',\n 'other',\n ]),\n linkedUserId: z.string(),\n cachedName: z.string(),\n cachedAvatarUrl: z.string().optional(),\n mutuallyConfirmed: z.boolean().default(false),\n verified: z.boolean().default(false),\n verifiedAt: z.coerce.date().optional(),\n verifiedBy: z.string().optional(),\n createdAt: z.coerce.date().optional(),\n});\n\n// ─── Main Step 12 Schema ────────────────────────────────────────────────────\n\nexport const step12HouseholdSchema = z.object({\n /** Marital status */\n maritalStatus: z\n .enum(['single', 'married', 'divorced', 'widowed', 'separated', 'prefer_not_to_say'])\n .optional(),\n\n /** Family members present (multi-select string array) */\n familyMembers: z.array(z.string().trim()).optional(),\n\n // ── Family-link fields (gated on familyMembers via includesAny) ──\n // Single-instance relations: at most one link\n linkedMother: familyLinkSchema.optional(),\n linkedStepMother: familyLinkSchema.optional(),\n linkedFather: familyLinkSchema.optional(),\n linkedStepFather: familyLinkSchema.optional(),\n\n // Multi-instance relations: arrays\n linkedSpouses: z.array(familyLinkSchema).optional(),\n linkedBloodSisters: z.array(familyLinkSchema).optional(),\n linkedHalfSisters: z.array(familyLinkSchema).optional(),\n linkedStepSisters: z.array(familyLinkSchema).optional(),\n linkedBloodBrothers: z.array(familyLinkSchema).optional(),\n linkedHalfBrothers: z.array(familyLinkSchema).optional(),\n linkedStepBrothers: z.array(familyLinkSchema).optional(),\n linkedDaughters: z.array(familyLinkSchema).optional(),\n linkedSons: z.array(familyLinkSchema).optional(),\n linkedOthers: z.array(familyLinkSchema).optional(),\n\n /** Number of financial dependents */\n numberOfDependents: z.number().int().min(0).max(50).optional(),\n\n /** Housing type */\n housingType: z\n .enum(['own_house', 'rented', 'government_quarters', 'shared', 'homeless', 'other'])\n .optional(),\n\n /** Household income range (monthly) */\n householdIncome: z.string().trim().optional(),\n\n /** Below Poverty Line card */\n bplCard: z.enum(['yes', 'no', 'applied', 'dont_know']).optional(),\n\n /** Digital access (multi-select string array) */\n digitalAccess: z.array(z.string().trim()).optional(),\n\n /** Migration status */\n migrationStatus: z\n .enum(['native', 'within_district', 'within_state', 'inter_state', 'international'])\n .optional(),\n\n /** Land ownership */\n landOwnership: z\n .enum([\n 'own_agricultural',\n 'own_residential',\n 'government_allotted',\n 'no_land',\n 'leased',\n 'other',\n ])\n .optional(),\n\n /** Primary income source */\n primaryIncomeSource: z\n .enum([\n 'agriculture',\n 'government_job',\n 'private_job',\n 'business',\n 'daily_wage',\n 'pension',\n 'remittance',\n 'no_fixed_income',\n 'other',\n ])\n .optional(),\n});\n\n// ─── Inferred types ─────────────────────────────────────────────────────────\n\nexport type Step12HouseholdInput = z.infer<typeof step12HouseholdSchema>;\nexport type FamilyLink = z.infer<typeof familyLinkSchema>;\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "udp-schema",
3
- "version": "2.26.0",
3
+ "version": "2.30.0",
4
4
  "description": "Shared Zod schemas for User Detailed Profile (frontend + backend).",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -1,20 +0,0 @@
1
- /**
2
- * UDP Field Metadata — backward-compatible re-exports from profile-fields.
3
- *
4
- * This file re-exports option arrays under SCREAMING_CASE names for
5
- * backward compatibility with existing frontend imports.
6
- * New code should import directly from profile-fields.
7
- *
8
- * @module udp-schema/field-meta
9
- */
10
- export type { FieldOption as UdpFieldOption } from './profile-fields/types.js';
11
- export { genderOptions as GENDER_OPTIONS, religionOptions as RELIGION_OPTIONS, languageOptions as LANGUAGE_OPTIONS, reservationOptions as RESERVATION_STATUS_OPTIONS, minorityOptions as MINORITY_STATUS_OPTIONS, } from './profile-fields/01-profile.js';
12
- export { politicalSpectrumOptions as POLITICAL_SPECTRUM_OPTIONS, partyOptions as PARTY_OPTIONS, civicEngagementOptions as CIVIC_ENGAGEMENT_OPTIONS, } from './profile-fields/02-political.js';
13
- export { votingIssueOptions as VOTING_ISSUES_OPTIONS } from './profile-fields/03-electoral.js';
14
- export { leadershipSkillsetOptions as LEADERSHIP_SKILLSET_OPTIONS } from './profile-fields/04-leadership.js';
15
- export { qualificationOptions as QUALIFICATION_OPTIONS } from './profile-fields/06-education.js';
16
- export { neurodiversityConditionOptions as NEURODIVERSITY_CONDITIONS_OPTIONS, sensoryPreferenceOptions as SENSORY_PREFERENCES_OPTIONS, supportNeedOptions as SUPPORT_NEEDS_OPTIONS, } from './profile-fields/08-neurodiversity.js';
17
- export { disabilityOptions as DISABILITY_STATUS_OPTIONS, substanceUseOptions as SUBSTANCE_USE_OPTIONS, } from './profile-fields/09-health.js';
18
- export { lgbtqStatementOptions as LGBTQ_STATEMENTS_OPTIONS, transgenderStatementOptions as TRANSGENDER_STATEMENTS_OPTIONS, casteDiscriminationPlaceOptions as CASTE_DISCRIMINATION_PLACES_OPTIONS, } from './profile-fields/10-worldview.js';
19
- export { familyMemberOptions as FAMILY_MEMBERS_OPTIONS, digitalAccessOptions as DIGITAL_ACCESS_OPTIONS, } from './profile-fields/12-household.js';
20
- //# sourceMappingURL=field-meta.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"field-meta.d.ts","sourceRoot":"","sources":["../src/field-meta.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,YAAY,EAAE,WAAW,IAAI,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE/E,OAAO,EACL,aAAa,IAAI,cAAc,EAC/B,eAAe,IAAI,gBAAgB,EACnC,eAAe,IAAI,gBAAgB,EACnC,kBAAkB,IAAI,0BAA0B,EAChD,eAAe,IAAI,uBAAuB,GAC3C,MAAM,gCAAgC,CAAC;AAExC,OAAO,EACL,wBAAwB,IAAI,0BAA0B,EACtD,YAAY,IAAI,aAAa,EAC7B,sBAAsB,IAAI,wBAAwB,GACnD,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EAAE,kBAAkB,IAAI,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAE/F,OAAO,EAAE,yBAAyB,IAAI,2BAA2B,EAAE,MAAM,mCAAmC,CAAC;AAE7G,OAAO,EAAE,oBAAoB,IAAI,qBAAqB,EAAE,MAAM,kCAAkC,CAAC;AAEjG,OAAO,EACL,8BAA8B,IAAI,iCAAiC,EACnE,wBAAwB,IAAI,2BAA2B,EACvD,kBAAkB,IAAI,qBAAqB,GAC5C,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,iBAAiB,IAAI,yBAAyB,EAC9C,mBAAmB,IAAI,qBAAqB,GAC7C,MAAM,+BAA+B,CAAC;AAEvC,OAAO,EACL,qBAAqB,IAAI,wBAAwB,EACjD,2BAA2B,IAAI,8BAA8B,EAC7D,+BAA+B,IAAI,mCAAmC,GACvE,MAAM,kCAAkC,CAAC;AAE1C,OAAO,EACL,mBAAmB,IAAI,sBAAsB,EAC7C,oBAAoB,IAAI,sBAAsB,GAC/C,MAAM,kCAAkC,CAAC"}