udp-schema 2.23.0 → 2.28.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.d.ts.map +1 -1
- package/dist/helpers.js +11 -1
- package/dist/helpers.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/onboarding-config.d.ts.map +1 -1
- package/dist/onboarding-config.js +110 -21
- package/dist/onboarding-config.js.map +1 -1
- package/dist/onboarding-form.d.ts +522 -17
- package/dist/onboarding-form.d.ts.map +1 -1
- package/dist/profile-fields/06-education.d.ts.map +1 -1
- package/dist/profile-fields/06-education.js +0 -9
- package/dist/profile-fields/06-education.js.map +1 -1
- package/dist/profile-fields/07-employment.d.ts +168 -0
- package/dist/profile-fields/07-employment.d.ts.map +1 -1
- package/dist/profile-fields/07-employment.js +212 -3
- package/dist/profile-fields/07-employment.js.map +1 -1
- package/dist/profile-fields/10-worldview.d.ts.map +1 -1
- package/dist/profile-fields/10-worldview.js +3 -23
- package/dist/profile-fields/10-worldview.js.map +1 -1
- package/dist/profile-fields/12-household.d.ts +15 -2
- package/dist/profile-fields/12-household.d.ts.map +1 -1
- package/dist/profile-fields/12-household.js +166 -17
- package/dist/profile-fields/12-household.js.map +1 -1
- package/dist/profile-fields/index.d.ts +1 -1
- package/dist/profile-fields/index.d.ts.map +1 -1
- package/dist/profile-fields/index.js +1 -1
- package/dist/profile-fields/index.js.map +1 -1
- package/dist/profile-fields/types.d.ts +12 -3
- package/dist/profile-fields/types.d.ts.map +1 -1
- package/dist/profile-fields/types.js.map +1 -1
- package/dist/progress-fields.d.ts.map +1 -1
- package/dist/progress-fields.js +17 -3
- package/dist/progress-fields.js.map +1 -1
- package/dist/step-06.schema.d.ts +0 -1
- package/dist/step-06.schema.d.ts.map +1 -1
- package/dist/step-06.schema.js +0 -2
- package/dist/step-06.schema.js.map +1 -1
- package/dist/step-07.schema.d.ts +84 -2
- package/dist/step-07.schema.d.ts.map +1 -1
- package/dist/step-07.schema.js +114 -4
- package/dist/step-07.schema.js.map +1 -1
- package/dist/step-10.schema.d.ts +3 -5
- package/dist/step-10.schema.d.ts.map +1 -1
- package/dist/step-10.schema.js +3 -7
- package/dist/step-10.schema.js.map +1 -1
- package/dist/step-11.schema.d.ts +75 -15
- package/dist/step-11.schema.d.ts.map +1 -1
- package/dist/step-11.schema.js +30 -2
- package/dist/step-11.schema.js.map +1 -1
- package/dist/step-12.schema.d.ts +434 -3
- package/dist/step-12.schema.d.ts.map +1 -1
- package/dist/step-12.schema.js +72 -3
- package/dist/step-12.schema.js.map +1 -1
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-11.schema.js","sourceRoot":"","sources":["../src/step-11.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAEhF
|
|
1
|
+
{"version":3,"file":"step-11.schema.js","sourceRoot":"","sources":["../src/step-11.schema.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,gFAAgF;AAEhF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,aAAa,GAAG,CAAC;KACpB,KAAK,CAAC;IACL,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE;IACjB,CAAC,CAAC,MAAM,CAAC;QACP,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;QAC1B,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;KAC5B,CAAC;CACH,CAAC;KACD,QAAQ,EAAE;KACV,QAAQ,EAAE,CAAC;AAEd,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC9C,qBAAqB;IACrB,KAAK,EAAE,aAAa;IACpB,wBAAwB;IACxB,QAAQ,EAAE,aAAa;IACvB,uDAAuD;IACvD,OAAO,EAAE,aAAa;CACvB,CAAC,CAAC;AAEH,+EAA+E;AAE/E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,CAAC,MAAM,CAAC;IAC5C,6BAA6B;IAC7B,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAElD,0DAA0D;IAC1D,gBAAgB,EAAE,uBAAuB;SACtC,MAAM,CAAC;QACN,aAAa,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;KACtC,CAAC;SACD,QAAQ,EAAE;IAEb,wBAAwB;IACxB,eAAe,EAAE,uBAAuB,CAAC,QAAQ,EAAE;IAEnD,sBAAsB;IACtB,cAAc,EAAE,uBAAuB,CAAC,QAAQ,EAAE;CACnD,CAAC,CAAC","sourcesContent":["/**\n * Step 11 — Residence & Address\n *\n * Simplified: 3 fields per address (state, district, village/colony).\n * Fields: currentAddress, permanentAddress, homeNativePlace, ancestralPlace\n *\n * @module udp-schema/step-11\n */\n\nimport { z } from 'zod';\n\n// ─── Address sub-schema (simplified) ─────────────────────────────────────────\n\n/**\n * Area reference — saves BOTH the ObjectId and the display name (per the\n * \"save both id + name\" architectural decision). Three accepted shapes:\n *\n * 1. `{ _id, name, type? }` — selected from the location-db search API\n * via `AreaCombobox`. The canonical case: we have a real Area entity\n * reference (`_id`) AND its display name without an extra lookup.\n * 2. `{ name }` — free-text fallback for hyper-local names not seeded\n * in the location DB (e.g. a specific colony / mohalla typed via\n * the AreaCombobox `allowCreate` path). No `_id` exists to save.\n * 3. `string` — bare ObjectId, kept for backward compatibility with any\n * legacy records that stored a flat _id reference. New saves will\n * always use shape #1 or #2.\n *\n * `null` / `undefined` mean \"not set\" (e.g. cascade reset when parent\n * changes). Zod's default object behavior strips unknown keys, so any\n * extra metadata the API returned (e.g. `location`, `urbanBodyType`) is\n * dropped at save time — keeps stored documents clean and small.\n */\nconst areaRefSchema = z\n .union([\n z.string().trim(),\n z.object({\n _id: z.string().optional(),\n name: z.string(),\n type: z.string().optional(),\n }),\n ])\n .nullable()\n .optional();\n\nexport const simplifiedAddressSchema = z.object({\n /** State area ref */\n state: areaRefSchema,\n /** District area ref */\n district: areaRefSchema,\n /** Smallest area unit — village, colony, ward, etc. */\n village: areaRefSchema,\n});\n\n// ─── Main Step 11 Schema ────────────────────────────────────────────────────\n\nexport const step11ResidenceSchema = z.object({\n /** Current living address */\n currentAddress: simplifiedAddressSchema.optional(),\n\n /** Permanent address — may have \"same as current\" flag */\n permanentAddress: simplifiedAddressSchema\n .extend({\n sameAsCurrent: z.boolean().optional(),\n })\n .optional(),\n\n /** Home native place */\n homeNativePlace: simplifiedAddressSchema.optional(),\n\n /** Ancestral place */\n ancestralPlace: simplifiedAddressSchema.optional(),\n});\n\n// ─── Inferred types ─────────────────────────────────────────────────────────\n\nexport type SimplifiedAddressInput = z.infer<typeof simplifiedAddressSchema>;\nexport type Step11ResidenceInput = z.infer<typeof step11ResidenceSchema>;\n"]}
|
package/dist/step-12.schema.d.ts
CHANGED
|
@@ -1,13 +1,64 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Step 12 — Household & Economic Profile
|
|
3
3
|
*
|
|
4
|
-
* Fields: maritalStatus, familyMembers,
|
|
5
|
-
*
|
|
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
|
|
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"}
|
package/dist/step-12.schema.js
CHANGED
|
@@ -1,13 +1,65 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Step 12 — Household & Economic Profile
|
|
3
3
|
*
|
|
4
|
-
* Fields: maritalStatus, familyMembers,
|
|
5
|
-
*
|
|
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
90
|
/** Housing type */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-12.schema.js","sourceRoot":"","sources":["../src/step-12.schema.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"step-12.schema.js","sourceRoot":"","sources":["../src/step-12.schema.ts"],"names":[],"mappings":"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","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"]}
|