policyengine-household-wizard 0.3.0 → 0.5.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/README.md +45 -0
- package/dist/draft-BI_Gnew1.cjs +1 -0
- package/dist/draft-DF6lMn4k.js +88 -0
- package/dist/{index-B_OXaS4a.cjs → index-BfoPBFne.cjs} +1 -1
- package/dist/{index-DWM0giHt.js → index-DoD0AXHz.js} +72 -70
- package/dist/index.cjs +1 -1
- package/dist/index.js +34 -33
- package/dist/us-household/adapters/v1Payload.d.ts.map +1 -1
- package/dist/us-household/draft.d.ts.map +1 -1
- package/dist/us-household/normalize.d.ts.map +1 -1
- package/dist/us-household/samples/index.d.ts +38 -0
- package/dist/us-household/samples/index.d.ts.map +1 -0
- package/dist/us-household/serialize.d.ts.map +1 -1
- package/dist/us-household/types.d.ts +8 -0
- package/dist/us-household/types.d.ts.map +1 -1
- package/dist/us-household/validate.d.ts.map +1 -1
- package/dist/us-household-adapters.cjs +1 -1
- package/dist/us-household-adapters.js +1 -1
- package/dist/us-household-samples.cjs +1 -0
- package/dist/us-household-samples.d.ts +1 -0
- package/dist/us-household-samples.js +61 -0
- package/dist/us-household.cjs +1 -1
- package/dist/us-household.js +236 -297
- package/package.json +6 -1
- package/src/us-household/adapters/v1Payload.ts +4 -0
- package/src/us-household/draft.ts +1 -0
- package/src/us-household/normalize.ts +3 -0
- package/src/us-household/samples/catalog.json +1 -0
- package/src/us-household/samples/index.ts +124 -0
- package/src/us-household/serialize.ts +6 -0
- package/src/us-household/types.ts +8 -0
- package/src/us-household/validate.ts +15 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "policyengine-household-wizard",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "Shared wizard primitives and US and UK household draft contracts for PolicyEngine apps.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.cjs",
|
|
@@ -27,6 +27,11 @@
|
|
|
27
27
|
"import": "./dist/us-household-adapters.js",
|
|
28
28
|
"require": "./dist/us-household-adapters.cjs"
|
|
29
29
|
},
|
|
30
|
+
"./us-household/samples": {
|
|
31
|
+
"types": "./dist/us-household/samples/index.d.ts",
|
|
32
|
+
"import": "./dist/us-household-samples.js",
|
|
33
|
+
"require": "./dist/us-household-samples.cjs"
|
|
34
|
+
},
|
|
30
35
|
"./uk-household": {
|
|
31
36
|
"types": "./dist/uk-household/index.d.ts",
|
|
32
37
|
"import": "./dist/uk-household.js",
|
|
@@ -367,6 +367,10 @@ export function toV1HouseholdPayload(
|
|
|
367
367
|
const spmUnits: V1GroupCollection = {
|
|
368
368
|
[keys.spmUnit]: { members: [...memberIds] },
|
|
369
369
|
};
|
|
370
|
+
const childcare = toAmount(draft.childcareExpenses);
|
|
371
|
+
if (childcare !== undefined) {
|
|
372
|
+
spmUnits[keys.spmUnit].spm_unit_pre_subsidy_childcare_expenses = yearMap(year, childcare);
|
|
373
|
+
}
|
|
370
374
|
const households: V1GroupCollection = {
|
|
371
375
|
[keys.household]: householdRecord,
|
|
372
376
|
};
|
|
@@ -46,6 +46,7 @@ export function cloneDraft(draft: USHouseholdDraft): USHouseholdDraft {
|
|
|
46
46
|
zip: draft.zip,
|
|
47
47
|
maritalStatus: draft.maritalStatus,
|
|
48
48
|
year: draft.year,
|
|
49
|
+
childcareExpenses: draft.childcareExpenses,
|
|
49
50
|
extras: draft.extras ? structuredClone(draft.extras) : undefined,
|
|
50
51
|
people: draft.people.map((person) => ({
|
|
51
52
|
...person,
|
|
@@ -110,6 +110,7 @@ interface LegacyDraftShape {
|
|
|
110
110
|
partnerAge?: number | string | null;
|
|
111
111
|
spouseAge?: number | string | null;
|
|
112
112
|
year?: number;
|
|
113
|
+
childcareExpenses?: number | string | null;
|
|
113
114
|
}
|
|
114
115
|
|
|
115
116
|
function coerceAge(value: unknown): number | null {
|
|
@@ -233,6 +234,8 @@ export function normalizeLegacyDraft(
|
|
|
233
234
|
}
|
|
234
235
|
const legacy = raw as LegacyDraftShape;
|
|
235
236
|
const draft = createBlankDraft(options.year ?? legacy.year ?? DEFAULT_HOUSEHOLD_YEAR);
|
|
237
|
+
const childcare = coerceNumber(legacy.childcareExpenses);
|
|
238
|
+
if (childcare !== undefined) draft.childcareExpenses = childcare;
|
|
236
239
|
|
|
237
240
|
// Location.
|
|
238
241
|
if (typeof legacy.state === 'string' && isUSStateCode(legacy.state)) {
|