udp-schema 0.2.0 → 0.3.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/field-meta.d.ts.map +1 -1
- package/dist/field-meta.js +1151 -179
- package/dist/field-meta.js.map +1 -1
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/progress-fields.d.ts.map +1 -1
- package/dist/progress-fields.js +4 -14
- package/dist/progress-fields.js.map +1 -1
- package/dist/step-03.schema.d.ts +3 -3
- package/dist/step-03.schema.js +1 -1
- package/dist/step-03.schema.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -5,10 +5,9 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module udp-schema
|
|
7
7
|
*/
|
|
8
|
-
export { emptyStringToUndefined, optionalPhoneSchema, optionalTrimmedString, optionalYearSchema, } from './zod-helpers.js';
|
|
9
|
-
export { UDP_FIELD_META, type UdpFieldMeta, type UdpFieldOption, } from './field-meta.js';
|
|
10
8
|
export { getImmutableFields, getUdpFieldMeta, getUdpFieldOptions, getUdpStepFields, } from './field-helpers.js';
|
|
11
|
-
export {
|
|
9
|
+
export { UDP_FIELD_META, type UdpFieldMeta, type UdpFieldOption, } from './field-meta.js';
|
|
10
|
+
export { calculateStepProgress as calculateUdpStepProgress, getNestedValue, isFieldFilled, UDP_PROGRESS_FIELDS, UDP_TOTAL_STEPS, } from './progress-fields.js';
|
|
12
11
|
export { assistedByVolunteerSchema, languageValueSchema, profilePhotoSchema, type Step01OnboardingFormInput, type Step01OnboardingInput, secondaryLanguageItemSchema, step01OnboardingSchema, } from './step-01.schema.js';
|
|
13
12
|
export { optionalUrlSchema, type Step02ContactDetailsInput, step02ContactDetailsSchema, } from './step-02.schema.js';
|
|
14
13
|
export { type AddressInput, addressSchema, areaRefSchema, type Step03ResidenceInput, step03ResidenceSchema, } from './step-03.schema.js';
|
|
@@ -23,4 +22,5 @@ export { type Step11PoliticalInput, step11PoliticalSchema, } from './step-11.sch
|
|
|
23
22
|
export { type Step12ElectoralInput, step12ElectoralSchema, } from './step-12.schema.js';
|
|
24
23
|
export { type Step13HealthInput, step13HealthSchema, } from './step-13.schema.js';
|
|
25
24
|
export { type Step14PrioritiesInput, step14PrioritiesSchema, } from './step-14.schema.js';
|
|
25
|
+
export { emptyStringToUndefined, optionalPhoneSchema, optionalTrimmedString, optionalYearSchema, } from './zod-helpers.js';
|
|
26
26
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACL,cAAc,EACd,KAAK,YAAY,EACjB,KAAK,cAAc,GACpB,MAAM,iBAAiB,CAAC;AAEzB,OAAO,EACL,qBAAqB,IAAI,wBAAwB,EACjD,cAAc,EACd,aAAa,EACb,mBAAmB,EACnB,eAAe,GAChB,MAAM,sBAAsB,CAAC;AAE9B,OAAO,EACL,yBAAyB,EACzB,mBAAmB,EACnB,kBAAkB,EAClB,KAAK,yBAAyB,EAC9B,KAAK,qBAAqB,EAC1B,2BAA2B,EAC3B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,iBAAiB,EACjB,KAAK,yBAAyB,EAC9B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,YAAY,EACjB,aAAa,EACb,aAAa,EACb,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,mBAAmB,EACxB,oBAAoB,GACrB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,qBAAqB,EAC1B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,qBAAqB,EAC1B,sBAAsB,EACtB,KAAK,gBAAgB,EACrB,iBAAiB,EACjB,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,qBAAqB,EAC1B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,yBAAyB,EAC9B,0BAA0B,GAC3B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,wBAAwB,EAC7B,yBAAyB,GAC1B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,oBAAoB,EACzB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,iBAAiB,EACtB,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,KAAK,qBAAqB,EAC1B,sBAAsB,GACvB,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EACL,sBAAsB,EACtB,mBAAmB,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -5,13 +5,11 @@
|
|
|
5
5
|
*
|
|
6
6
|
* @module udp-schema
|
|
7
7
|
*/
|
|
8
|
-
|
|
9
|
-
export { emptyStringToUndefined, optionalPhoneSchema, optionalTrimmedString, optionalYearSchema, } from './zod-helpers.js';
|
|
8
|
+
export { getImmutableFields, getUdpFieldMeta, getUdpFieldOptions, getUdpStepFields, } from './field-helpers.js';
|
|
10
9
|
// Field Metadata & Helpers
|
|
11
10
|
export { UDP_FIELD_META, } from './field-meta.js';
|
|
12
|
-
export { getImmutableFields, getUdpFieldMeta, getUdpFieldOptions, getUdpStepFields, } from './field-helpers.js';
|
|
13
11
|
// Progress Fields — Single source of truth for step progress counting
|
|
14
|
-
export {
|
|
12
|
+
export { calculateStepProgress as calculateUdpStepProgress, getNestedValue, isFieldFilled, UDP_PROGRESS_FIELDS, UDP_TOTAL_STEPS, } from './progress-fields.js';
|
|
15
13
|
// Step 01 — Profile Onboarding
|
|
16
14
|
export { assistedByVolunteerSchema, languageValueSchema, profilePhotoSchema, secondaryLanguageItemSchema, step01OnboardingSchema, } from './step-01.schema.js';
|
|
17
15
|
// Step 02 — Contact Details
|
|
@@ -40,4 +38,6 @@ export { step12ElectoralSchema, } from './step-12.schema.js';
|
|
|
40
38
|
export { step13HealthSchema, } from './step-13.schema.js';
|
|
41
39
|
// Step 14 — Yearly Priorities & Life Goals
|
|
42
40
|
export { step14PrioritiesSchema, } from './step-14.schema.js';
|
|
41
|
+
// Zod Helpers
|
|
42
|
+
export { emptyStringToUndefined, optionalPhoneSchema, optionalTrimmedString, optionalYearSchema, } from './zod-helpers.js';
|
|
43
43
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACL,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EAClB,gBAAgB,GACjB,MAAM,oBAAoB,CAAC;AAE5B,2BAA2B;AAC3B,OAAO,EACL,cAAc,GAGf,MAAM,iBAAiB,CAAC;AACzB,sEAAsE;AACtE,OAAO,EACL,qBAAqB,IAAI,wBA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,EACnB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,kBAAkB,CAAC","sourcesContent":["/**\n * udp-schema — Shared Zod schemas for User Detailed Profile\n *\n * Single source of truth consumed by both reform frontends and reform-backend.\n *\n * @module udp-schema\n */\n\nexport {\n getImmutableFields,\n getUdpFieldMeta,\n getUdpFieldOptions,\n getUdpStepFields,\n} from './field-helpers.js';\n\n// Field Metadata & Helpers\nexport {\n UDP_FIELD_META,\n type UdpFieldMeta,\n type UdpFieldOption,\n} from './field-meta.js';\n// Progress Fields — Single source of truth for step progress counting\nexport {\n calculateStepProgress as calculateUdpStepProgress,\n getNestedValue,\n isFieldFilled,\n UDP_PROGRESS_FIELDS,\n UDP_TOTAL_STEPS,\n} from './progress-fields.js';\n// Step 01 — Profile Onboarding\nexport {\n assistedByVolunteerSchema,\n languageValueSchema,\n profilePhotoSchema,\n type Step01OnboardingFormInput,\n type Step01OnboardingInput,\n secondaryLanguageItemSchema,\n step01OnboardingSchema,\n} from './step-01.schema.js';\n// Step 02 — Contact Details\nexport {\n optionalUrlSchema,\n type Step02ContactDetailsInput,\n step02ContactDetailsSchema,\n} from './step-02.schema.js';\n// Step 03 — Residence / Address\nexport {\n type AddressInput,\n addressSchema,\n areaRefSchema,\n type Step03ResidenceInput,\n step03ResidenceSchema,\n} from './step-03.schema.js';\n// Step 04 — Identity & Social Profile\nexport {\n type Step04IdentityInput,\n step04IdentitySchema,\n} from './step-04.schema.js';\n// Step 05 — Leadership, Contribution & Political Ambition\nexport {\n type Step05LeadershipInput,\n step05LeadershipSchema,\n} from './step-05.schema.js';\n// Step 06 — Household, Economic & Digital Profile\nexport {\n type Step06HouseholdInput,\n step06HouseholdSchema,\n} from './step-06.schema.js';\n// Step 07 — Education History\nexport {\n type CertificateEntryInput,\n certificateEntrySchema,\n type DegreeEntryInput,\n degreeEntrySchema,\n type Step07EducationInput,\n step07EducationSchema,\n} from './step-07.schema.js';\n// Step 08 — Employment & Occupation\nexport {\n type Step08EmploymentInput,\n step08EmploymentSchema,\n} from './step-08.schema.js';\n// Step 09 — Neurodiversity & Learning Profile\nexport {\n type Step09NeurodiversityInput,\n step09NeurodiversitySchema,\n} from './step-09.schema.js';\n// Step 10 — Psychological Assessments\nexport {\n type Step10PsychologicalInput,\n step10PsychologicalSchema,\n} from './step-10.schema.js';\n// Step 11 — Political Association & History\nexport {\n type Step11PoliticalInput,\n step11PoliticalSchema,\n} from './step-11.schema.js';\n// Step 12 — Electoral Details\nexport {\n type Step12ElectoralInput,\n step12ElectoralSchema,\n} from './step-12.schema.js';\n// Step 13 — Health & Lifestyle\nexport {\n type Step13HealthInput,\n step13HealthSchema,\n} from './step-13.schema.js';\n// Step 14 — Yearly Priorities & Life Goals\nexport {\n type Step14PrioritiesInput,\n step14PrioritiesSchema,\n} from './step-14.schema.js';\n// Zod Helpers\nexport {\n emptyStringToUndefined,\n optionalPhoneSchema,\n optionalTrimmedString,\n optionalYearSchema,\n} from './zod-helpers.js';\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-fields.d.ts","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"progress-fields.d.ts","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,SAAS,MAAM,EAAE,CAiIxD,CAAC;AAEX,gCAAgC;AAChC,eAAO,MAAM,eAAe,KAAK,CAAC;AAElC;;;GAGG;AACH,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAYlF;AAED,iEAAiE;AACjE,wBAAgB,aAAa,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAcrD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,CACnC,UAAU,EAAE,MAAM,EAClB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAAG,IAAI,GACnD;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAenC"}
|
package/dist/progress-fields.js
CHANGED
|
@@ -42,14 +42,14 @@ export const UDP_PROGRESS_FIELDS = {
|
|
|
42
42
|
'currentAddress.state',
|
|
43
43
|
'currentAddress.division',
|
|
44
44
|
'currentAddress.district',
|
|
45
|
-
'currentAddress.
|
|
45
|
+
'currentAddress.subDistrict',
|
|
46
46
|
'currentAddress.areaType',
|
|
47
47
|
'currentAddress.housePlotDetails',
|
|
48
48
|
'currentAddress.pincode',
|
|
49
49
|
'permanentAddress.state',
|
|
50
50
|
'permanentAddress.division',
|
|
51
51
|
'permanentAddress.district',
|
|
52
|
-
'permanentAddress.
|
|
52
|
+
'permanentAddress.subDistrict',
|
|
53
53
|
'permanentAddress.areaType',
|
|
54
54
|
'permanentAddress.housePlotDetails',
|
|
55
55
|
'permanentAddress.pincode',
|
|
@@ -114,24 +114,14 @@ export const UDP_PROGRESS_FIELDS = {
|
|
|
114
114
|
'learningStylePreference',
|
|
115
115
|
'communicationPreferences',
|
|
116
116
|
],
|
|
117
|
-
10: [
|
|
118
|
-
'mbtiType',
|
|
119
|
-
'enneagramType',
|
|
120
|
-
'attachmentStyle',
|
|
121
|
-
'assessmentAccuracyRating',
|
|
122
|
-
],
|
|
117
|
+
10: ['mbtiType', 'enneagramType', 'attachmentStyle', 'assessmentAccuracyRating'],
|
|
123
118
|
11: [
|
|
124
119
|
'selfPartyAssociation',
|
|
125
120
|
'familyPartyAssociation',
|
|
126
121
|
'publicOfficeHistory',
|
|
127
122
|
'politicalNetworkLevel',
|
|
128
123
|
],
|
|
129
|
-
12: [
|
|
130
|
-
'willVoteThisTime',
|
|
131
|
-
'votedLastTime',
|
|
132
|
-
'politicalSpectrumSelf',
|
|
133
|
-
'votingFrequency',
|
|
134
|
-
],
|
|
124
|
+
12: ['willVoteThisTime', 'votedLastTime', 'politicalSpectrumSelf', 'votingFrequency'],
|
|
135
125
|
13: [
|
|
136
126
|
'overallHealthStatus',
|
|
137
127
|
'foodHabitType',
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"progress-fields.js","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAsC;IACpE,CAAC,EAAE;QACD,iBAAiB;QACjB,OAAO;QACP,WAAW;QACX,YAAY;QACZ,UAAU;QACV,QAAQ;QACR,aAAa;QACb,eAAe;QACf,qBAAqB;QACrB,iBAAiB;QACjB,oBAAoB;KACrB;IACD,CAAC,EAAE;QACD,cAAc;QACd,gBAAgB;QAChB,sBAAsB;QACtB,qBAAqB;QACrB,uBAAuB;QACvB,sBAAsB;QACtB,qBAAqB;QACrB,8BAA8B;QAC9B,kCAAkC;QAClC,+BAA+B;KAChC;IACD,CAAC,EAAE;QACD,gBAAgB;QAChB,YAAY;QACZ,iBAAiB;QACjB,sBAAsB;QACtB,uBAAuB;QACvB,sBAAsB;QACtB,yBAAyB;QACzB,yBAAyB;QACzB,
|
|
1
|
+
{"version":3,"file":"progress-fields.js","sourceRoot":"","sources":["../src/progress-fields.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,MAAM,CAAC,MAAM,mBAAmB,GAAsC;IACpE,CAAC,EAAE;QACD,iBAAiB;QACjB,OAAO;QACP,WAAW;QACX,YAAY;QACZ,UAAU;QACV,QAAQ;QACR,aAAa;QACb,eAAe;QACf,qBAAqB;QACrB,iBAAiB;QACjB,oBAAoB;KACrB;IACD,CAAC,EAAE;QACD,cAAc;QACd,gBAAgB;QAChB,sBAAsB;QACtB,qBAAqB;QACrB,uBAAuB;QACvB,sBAAsB;QACt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,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC;QAAE,OAAO,KAAK,CAAC,MAAM,GAAG,CAAC,CAAC;IAClD,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,mCAAmC;QACnC,IAAI,MAAM,IAAI,KAAK,IAAI,OAAQ,KAAiC,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACnF,OAAQ,KAAiC,CAAC,IAAI,KAAK,EAAE,CAAC;QACxD,CAAC;QACD,OAAO,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC;IACvC,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,qBAAqB,CACnC,UAAkB,EAClB,QAAoD;IAEpD,MAAM,MAAM,GAAG,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC/C,IAAI,CAAC,MAAM;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;IAE5C,MAAM,KAAK,GAAG,MAAM,CAAC,MAAM,CAAC;IAC5B,IAAI,CAAC,QAAQ,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC;IAE1D,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,MAAM,SAAS,IAAI,MAAM,EAAE,CAAC;QAC/B,IAAI,aAAa,CAAC,cAAc,CAAC,QAAQ,EAAE,SAAS,CAAC,CAAC,EAAE,CAAC;YACvD,MAAM,EAAE,CAAC;QACX,CAAC;IACH,CAAC;IAED,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,CAAC;AAC3B,CAAC","sourcesContent":["/**\n * UDP Progress Fields — Single source of truth for step progress counting.\n *\n * Used by both frontend (stepper UI) and backend (computeStepProgressCounts).\n * Each step lists the curated fields that determine filled/total progress.\n *\n * Dot-paths (e.g., \"socialMedia.facebook\") resolve nested subdocument fields.\n * Only these fields count toward progress — extra fields in the schema are ignored.\n */\n\nexport const UDP_PROGRESS_FIELDS: Record<number, readonly string[]> = {\n 1: [\n 'profilePhotoUrl',\n 'email',\n 'firstName',\n 'middleName',\n 'lastName',\n 'gender',\n 'dateOfBirth',\n 'aadhaarNumber',\n 'assistedByVolunteer',\n 'primaryLanguage',\n 'secondaryLanguages',\n ],\n 2: [\n 'phonePrimary',\n 'whatsappNumber',\n 'socialMedia.facebook',\n 'socialMedia.twitter',\n 'socialMedia.instagram',\n 'socialMedia.linkedin',\n 'socialMedia.youtube',\n 'emergencyContact.contactName',\n 'emergencyContact.contactRelation',\n 'emergencyContact.contactPhone',\n ],\n 3: [\n 'domicileSource',\n 'birthPlace',\n 'homeNativePlace',\n 'ancestralNativePlace',\n 'yearsAtCurrentAddress',\n 'currentAddress.state',\n 'currentAddress.division',\n 'currentAddress.district',\n 'currentAddress.subDistrict',\n 'currentAddress.areaType',\n 'currentAddress.housePlotDetails',\n 'currentAddress.pincode',\n 'permanentAddress.state',\n 'permanentAddress.division',\n 'permanentAddress.district',\n 'permanentAddress.subDistrict',\n 'permanentAddress.areaType',\n 'permanentAddress.housePlotDetails',\n 'permanentAddress.pincode',\n ],\n 4: [\n 'familyReligion',\n 'individualReligion',\n 'casteCategoryReservation',\n 'minorityStatus',\n 'viewOnLgbtqStatements',\n 'viewOnTransgenderInclusionStatements',\n ],\n 5: [\n 'desireToBeLeader',\n 'desiredPoliticalPosition',\n 'politicalPartyJoiningIntent',\n 'visionChangesYouWillBring',\n 'leadershipSkillset',\n 'politicalExposureLevel',\n 'publicVisibilityComfort',\n 'leadershipTrainingInterest',\n 'pastLeadershipRoles',\n 'socialInfluenceLevel',\n 'whyJoinMovement',\n ],\n 6: [\n 'areYouMigrant',\n 'maritalStatus',\n 'familyStructureType',\n 'householdSize',\n 'housingType',\n 'annualPersonalIncomeRange',\n 'annualHouseholdIncomeRange',\n 'digitalAccess',\n 'digitalSkillLevel',\n 'literacyLevel',\n ],\n 7: [\n 'highestQualification',\n 'education10th.board',\n 'education10th.schoolName',\n 'education10th.yearOfPassing',\n 'education12th.institutionName',\n 'education12th.yearOfPassing',\n 'diplomas',\n 'graduations',\n 'postGraduations',\n 'doctorates',\n 'postDoctorates',\n ],\n 8: [\n 'employmentStatus',\n 'employedSince',\n 'jobOccupationType',\n 'currentWorkShift',\n 'personalIncomeRange',\n 'workExperienceSummary',\n ],\n 9: [\n 'neurodivergentSelfIdentification',\n 'sensorySensitivities',\n 'learningStylePreference',\n 'communicationPreferences',\n ],\n 10: ['mbtiType', 'enneagramType', 'attachmentStyle', 'assessmentAccuracyRating'],\n 11: [\n 'selfPartyAssociation',\n 'familyPartyAssociation',\n 'publicOfficeHistory',\n 'politicalNetworkLevel',\n ],\n 12: ['willVoteThisTime', 'votedLastTime', 'politicalSpectrumSelf', 'votingFrequency'],\n 13: [\n 'overallHealthStatus',\n 'foodHabitType',\n 'physicalActivityLevel',\n 'sleepHoursPerDay',\n 'tobaccoUse',\n 'hasHealthInsurance',\n ],\n 14: [\n 'topPrioritiesThisYear',\n 'priorityCategoryTags',\n 'alignmentWithMovement',\n 'openToVolunteering',\n ],\n} as const;\n\n/** Total number of UDP steps */\nexport const UDP_TOTAL_STEPS = 14;\n\n/**\n * Resolve a dot-path (e.g., \"socialMedia.facebook\") against a data object.\n * Works with both plain objects and Mongoose subdocuments.\n */\nexport function getNestedValue(obj: Record<string, unknown>, path: string): unknown {\n const parts = path.split('.');\n let current: unknown = obj;\n\n for (const part of parts) {\n if (current === null || current === undefined || typeof current !== 'object') {\n return undefined;\n }\n current = (current as Record<string, unknown>)[part];\n }\n\n return current;\n}\n\n/** Determine if a field value counts as \"filled\" for progress */\nexport function isFieldFilled(value: unknown): boolean {\n if (value === null || value === undefined) return false;\n if (typeof value === 'string') return value.trim().length > 0;\n if (typeof value === 'number') return true;\n if (typeof value === 'boolean') return true;\n if (Array.isArray(value)) return value.length > 0;\n if (typeof value === 'object') {\n // Area entity ref - check for name\n if ('name' in value && typeof (value as Record<string, unknown>).name === 'string') {\n return (value as Record<string, unknown>).name !== '';\n }\n return Object.keys(value).length > 0;\n }\n return false;\n}\n\n/**\n * Calculate progress for a single step.\n * Shared between frontend (stepper UI) and backend (API response).\n */\nexport function calculateStepProgress(\n stepNumber: number,\n formData: Record<string, unknown> | undefined | null,\n): { filled: number; total: number } {\n const fields = UDP_PROGRESS_FIELDS[stepNumber];\n if (!fields) return { filled: 0, total: 0 };\n\n const total = fields.length;\n if (!formData || total === 0) return { filled: 0, total };\n\n let filled = 0;\n for (const fieldPath of fields) {\n if (isFieldFilled(getNestedValue(formData, fieldPath))) {\n filled++;\n }\n }\n\n return { filled, total };\n}\n"]}
|
package/dist/step-03.schema.d.ts
CHANGED
|
@@ -43,7 +43,7 @@ export declare const addressSchema: z.ZodObject<{
|
|
|
43
43
|
}, z.core.$loose>, z.ZodObject<{
|
|
44
44
|
name: z.ZodString;
|
|
45
45
|
}, z.core.$loose>, z.ZodString]>>;
|
|
46
|
-
|
|
46
|
+
subDistrict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
47
47
|
_id: z.ZodString;
|
|
48
48
|
name: z.ZodString;
|
|
49
49
|
}, z.core.$loose>, z.ZodObject<{
|
|
@@ -145,7 +145,7 @@ export declare const step03ResidenceSchema: z.ZodObject<{
|
|
|
145
145
|
}, z.core.$loose>, z.ZodObject<{
|
|
146
146
|
name: z.ZodString;
|
|
147
147
|
}, z.core.$loose>, z.ZodString]>>;
|
|
148
|
-
|
|
148
|
+
subDistrict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
149
149
|
_id: z.ZodString;
|
|
150
150
|
name: z.ZodString;
|
|
151
151
|
}, z.core.$loose>, z.ZodObject<{
|
|
@@ -236,7 +236,7 @@ export declare const step03ResidenceSchema: z.ZodObject<{
|
|
|
236
236
|
}, z.core.$loose>, z.ZodObject<{
|
|
237
237
|
name: z.ZodString;
|
|
238
238
|
}, z.core.$loose>, z.ZodString]>>;
|
|
239
|
-
|
|
239
|
+
subDistrict: z.ZodOptional<z.ZodUnion<readonly [z.ZodObject<{
|
|
240
240
|
_id: z.ZodString;
|
|
241
241
|
name: z.ZodString;
|
|
242
242
|
}, z.core.$loose>, z.ZodObject<{
|
package/dist/step-03.schema.js
CHANGED
|
@@ -27,7 +27,7 @@ export const addressSchema = z.object({
|
|
|
27
27
|
areaType: z.enum(['RURAL', 'URBAN']).optional(),
|
|
28
28
|
division: areaRefSchema,
|
|
29
29
|
district: areaRefSchema,
|
|
30
|
-
|
|
30
|
+
subDistrict: areaRefSchema,
|
|
31
31
|
// Rural
|
|
32
32
|
block: areaRefSchema,
|
|
33
33
|
gramPanchayat: areaRefSchema,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"step-03.schema.js","sourceRoot":"","sources":["../src/step-03.schema.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,2DAA2D;AAE3D;;;;;GAKG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC;KAC3B,KAAK,CAAC;IACL,CAAC,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;IAC3E,CAAC,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,WAAW,EAAE;IAC1D,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC;CACzB,CAAC;KACD,QAAQ,EAAE,CAAC;AAEd,iDAAiD;AACjD,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,CAAC,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AE,wBAAwB,CAAC,CAAC,CAAC,QAAQ,EAAE;IACjG,UAAU,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IACxC,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAC7C,oBAAoB,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;IAClD,qBAAqB,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE;IACnE,oBAAoB,EAAE,CAAC,CAAC,OAAO,EAAE,CAAC,QAAQ,EAAE;IAC5C,cAAc,EAAE,aAAa,CAAC,QAAQ,EAAE;IACxC,gBAAgB,EAAE,aAAa,CAAC,QAAQ,EAAE;IAC1C,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,EAAE,CAAC,QAAQ,EAAE;CAC3C,CAAC,CAAC","sourcesContent":["/**\n * Step 03 — Residence / Address Schema\n *\n * Single source of truth used by both frontend and backend.\n *\n * @module udp-schema/step-03\n */\n\nimport { z } from 'zod';\n\n// ─── Sub-schemas ────────────────────────────────────────\n\n/**\n * Area entity reference — accepts:\n * • `{ _id, name }` — existing area entity selected in frontend\n * • `{ name }` — custom / manually entered\n * • raw string — legacy ObjectId stored in DB\n */\nexport const areaRefSchema = z\n .union([\n z.object({ _id: z.string(), name: z.string().trim().min(1) }).passthrough(),\n z.object({ name: z.string().trim().min(1) }).passthrough(),\n z.string().trim().min(1),\n ])\n .optional();\n\n/** Full address block (current or permanent). */\nexport const addressSchema = z.object({\n country: z.string().trim().optional(),\n state: areaRefSchema,\n areaType: z.enum(['RURAL', 'URBAN']).optional(),\n division: areaRefSchema,\n district: areaRefSchema,\n subDistrict: areaRefSchema,\n // Rural\n block: areaRefSchema,\n gramPanchayat: areaRefSchema,\n village: areaRefSchema,\n hamlet: areaRefSchema,\n ruralWard: areaRefSchema,\n // Urban\n urbanBody: areaRefSchema,\n urbanWard: areaRefSchema,\n locality: areaRefSchema,\n // Common\n policeStation: areaRefSchema,\n // Details\n housePlotDetails: z.string().trim().optional(),\n pincode: z\n .string()\n .trim()\n .regex(/^\\d{6}$/, 'Pincode must be 6 digits')\n .optional()\n .or(z.literal('')),\n landmark: z.string().trim().optional(),\n directions: z.string().trim().optional(),\n latitude: z.coerce.number().min(-90).max(90).optional(),\n longitude: z.coerce.number().min(-180).max(180).optional(),\n});\n\n// ─── Main step-03 schema ────────────────────────────────\n\nexport const step03ResidenceSchema = z.object({\n domicileSource: z.enum(['BIRTH_PLACE', 'HOME_NATIVE_PLACE', 'ANCESTRAL_NATIVE_PLACE']).optional(),\n birthPlace: z.string().trim().optional(),\n homeNativePlace: z.string().trim().optional(),\n ancestralNativePlace: z.string().trim().optional(),\n yearsAtCurrentAddress: z.coerce.number().min(0).max(120).optional(),\n sameAsCurrentAddress: z.boolean().optional(),\n currentAddress: addressSchema.optional(),\n permanentAddress: addressSchema.optional(),\n addressNotes: z.string().trim().optional(),\n});\n\n// ─── Inferred types ─────────────────────────────────────\n\nexport type Step03ResidenceInput = z.infer<typeof step03ResidenceSchema>;\nexport type AddressInput = z.infer<typeof addressSchema>;\n"]}
|