policyengine-household-wizard 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.
Files changed (62) hide show
  1. package/README.md +14 -4
  2. package/dist/index-CIL8FXNR.cjs +1 -0
  3. package/dist/index-fgLnXugs.js +225 -0
  4. package/dist/index.d.ts +2 -2
  5. package/dist/primitives/index.d.ts +12 -12
  6. package/dist/primitives/useWizardSteps.d.ts +1 -1
  7. package/dist/primitives.d.ts +1 -1
  8. package/dist/uk-household/adapters/householdImpactRequest.d.ts +91 -0
  9. package/dist/uk-household/adapters/householdImpactRequest.d.ts.map +1 -0
  10. package/dist/uk-household/adapters/index.d.ts +2 -0
  11. package/dist/uk-household/adapters/index.d.ts.map +1 -0
  12. package/dist/uk-household/children.d.ts +18 -0
  13. package/dist/uk-household/children.d.ts.map +1 -0
  14. package/dist/uk-household/codes.d.ts +22 -0
  15. package/dist/uk-household/codes.d.ts.map +1 -0
  16. package/dist/uk-household/defaults.d.ts +56 -0
  17. package/dist/uk-household/defaults.d.ts.map +1 -0
  18. package/dist/uk-household/draft.d.ts +37 -0
  19. package/dist/uk-household/draft.d.ts.map +1 -0
  20. package/dist/uk-household/index.d.ts +10 -0
  21. package/dist/uk-household/index.d.ts.map +1 -0
  22. package/dist/uk-household/serialize.d.ts +4 -0
  23. package/dist/uk-household/serialize.d.ts.map +1 -0
  24. package/dist/uk-household/statePension.d.ts +42 -0
  25. package/dist/uk-household/statePension.d.ts.map +1 -0
  26. package/dist/uk-household/types.d.ts +134 -0
  27. package/dist/uk-household/types.d.ts.map +1 -0
  28. package/dist/uk-household/validate.d.ts +59 -0
  29. package/dist/uk-household/validate.d.ts.map +1 -0
  30. package/dist/uk-household-adapters.cjs +1 -0
  31. package/dist/uk-household-adapters.d.ts +1 -0
  32. package/dist/uk-household-adapters.js +5 -0
  33. package/dist/uk-household.cjs +1 -0
  34. package/dist/uk-household.d.ts +1 -0
  35. package/dist/uk-household.js +220 -0
  36. package/dist/us-household/adapters/index.d.ts +1 -1
  37. package/dist/us-household/adapters/v1Payload.d.ts +1 -1
  38. package/dist/us-household/draft.d.ts +1 -1
  39. package/dist/us-household/index.d.ts +9 -9
  40. package/dist/us-household/normalize.d.ts +1 -1
  41. package/dist/us-household/serialize.d.ts +1 -1
  42. package/dist/us-household/types.d.ts +1 -14
  43. package/dist/us-household/types.d.ts.map +1 -1
  44. package/dist/us-household/validate.d.ts +1 -1
  45. package/dist/us-household-adapters.d.ts +1 -1
  46. package/dist/us-household.d.ts +1 -1
  47. package/dist/validation.d.ts +16 -0
  48. package/dist/validation.d.ts.map +1 -0
  49. package/package.json +13 -2
  50. package/src/uk-household/adapters/householdImpactRequest.ts +164 -0
  51. package/src/uk-household/adapters/index.ts +9 -0
  52. package/src/uk-household/children.ts +23 -0
  53. package/src/uk-household/codes.ts +67 -0
  54. package/src/uk-household/defaults.ts +101 -0
  55. package/src/uk-household/draft.ts +138 -0
  56. package/src/uk-household/index.ts +75 -0
  57. package/src/uk-household/serialize.ts +189 -0
  58. package/src/uk-household/statePension.ts +69 -0
  59. package/src/uk-household/types.ts +159 -0
  60. package/src/uk-household/validate.ts +190 -0
  61. package/src/us-household/types.ts +1 -11
  62. package/src/validation.ts +12 -0
@@ -0,0 +1,42 @@
1
+ /**
2
+ * State Pension age and the full new State Pension by policy year, as a
3
+ * table of the same shape as the Autumn Budget 2026 dashboard's
4
+ * `src/uk_budget_data/state_pension.json`, so an app can pass its own copy.
5
+ */
6
+ export interface UKStatePensionYear {
7
+ /** The youngest whole age policyengine-uk places over State Pension age in the year. */
8
+ state_pension_age: number;
9
+ /** The full new State Pension, pounds a year. */
10
+ full_new_state_pension: number;
11
+ }
12
+ export interface UKStatePensionTable {
13
+ years: Readonly<Record<string, UKStatePensionYear>>;
14
+ }
15
+ /**
16
+ * The default table: the dashboard's state_pension.json at cc15d50e, which
17
+ * its tests/test_household_impact.py checks against policyengine-uk 2.132.6
18
+ * (the version its lockfile pins). The age is the youngest whole age the
19
+ * model's `is_SP_age` counts for a person entered by age alone; the amount is
20
+ * `gov.dwp.state_pension.new_state_pension.amount` times 52, to the penny.
21
+ * Both change with the model: an app that carries a copy checked against its
22
+ * own model should pass that copy instead.
23
+ */
24
+ export declare const UK_STATE_PENSION: UKStatePensionTable;
25
+ /**
26
+ * State Pension age and the full new State Pension in `year`: the table's
27
+ * row for that year, else for the first later year it has, else its last.
28
+ * So a year before the table (or 0, which apps use to compare answers without
29
+ * a year) takes its first row.
30
+ */
31
+ export declare function statePensionFor(year: number, table?: UKStatePensionTable): {
32
+ age: number;
33
+ full: number;
34
+ };
35
+ /**
36
+ * Whether someone of `age` in `year` is at State Pension age. An unanswered
37
+ * age (`null`) is not.
38
+ */
39
+ export declare function atStatePensionAge(age: number | null | undefined, year: number, table?: UKStatePensionTable): boolean;
40
+ /** Whether a State Pension amount was entered: a finite number; `null` is the full rate. */
41
+ export declare const statePensionEntered: (value: unknown) => value is number;
42
+ //# sourceMappingURL=statePension.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"statePension.d.ts","sourceRoot":"","sources":["../../src/uk-household/statePension.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,MAAM,WAAW,kBAAkB;IACjC,wFAAwF;IACxF,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iDAAiD;IACjD,sBAAsB,EAAE,MAAM,CAAC;CAChC;AAED,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAkB,CAAC,CAAC,CAAC;CACrD;AAED;;;;;;;;GAQG;AACH,eAAO,MAAM,gBAAgB,EAAE,mBAS9B,CAAC;AAEF;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,mBAAsC,GAC5C;IAAE,GAAG,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,CAO/B;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAC/B,GAAG,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,EAC9B,IAAI,EAAE,MAAM,EACZ,KAAK,GAAE,mBAAsC,GAC5C,OAAO,CAET;AAED,4FAA4F;AAC5F,eAAO,MAAM,mBAAmB,GAAI,OAAO,OAAO,KAAG,KAAK,IAAI,MACT,CAAC"}
@@ -0,0 +1,134 @@
1
+ export type { ValidationIssue, ValidationResult } from '../validation.js';
2
+ /**
3
+ * policyengine-uk's `Region` codes: the nine English regions, Wales, Scotland
4
+ * and Northern Ireland (its `UNKNOWN` is left out).
5
+ */
6
+ export type UKRegion = 'NORTH_EAST' | 'NORTH_WEST' | 'YORKSHIRE' | 'EAST_MIDLANDS' | 'WEST_MIDLANDS' | 'EAST_OF_ENGLAND' | 'LONDON' | 'SOUTH_EAST' | 'SOUTH_WEST' | 'WALES' | 'SCOTLAND' | 'NORTHERN_IRELAND';
7
+ /** policyengine-uk's `TenureType` codes. The first three are renting. */
8
+ export type UKTenure = 'RENT_PRIVATELY' | 'RENT_FROM_COUNCIL' | 'RENT_FROM_HA' | 'OWNED_WITH_MORTGAGE' | 'OWNED_OUTRIGHT';
9
+ /** policyengine-uk's `StudentLoanPlan` codes. */
10
+ export type UKStudentLoanPlan = 'NONE' | 'PLAN_1' | 'PLAN_2' | 'PLAN_4' | 'PLAN_5' | 'POSTGRADUATE';
11
+ /**
12
+ * policyengine-uk's `CouncilTaxBand` codes; band I is Wales's. Northern
13
+ * Ireland has domestic rates instead, and the household impact API estimates
14
+ * no Council Tax there.
15
+ */
16
+ export type UKCouncilTaxBand = 'A' | 'B' | 'C' | 'D' | 'E' | 'F' | 'G' | 'H' | 'I';
17
+ /**
18
+ * One adult's answers. Amounts are pounds a year.
19
+ *
20
+ * Ages are in the policy year being calculated: a calculation for 2028-29
21
+ * takes the age then, and does not age anyone from another year. Employment
22
+ * income is the other way round: it is entered for the draft's `salaryYear`
23
+ * and grown from there.
24
+ */
25
+ export interface UKAdultDraft {
26
+ /** Age in whole years in the policy year. `null` means not answered. */
27
+ age: number | null;
28
+ /** Gross earnings from employment in the draft's `salaryYear`. */
29
+ employmentIncome: number;
30
+ /**
31
+ * Private and workplace pensions in payment, before tax, not counting the
32
+ * State Pension. `null` or left out means none.
33
+ */
34
+ privatePensionIncome?: number | null;
35
+ /**
36
+ * The State Pension in the policy year (not grown like earnings). `null`
37
+ * means the full new State Pension for that year. Calculations read it only
38
+ * from State Pension age in the policy year (`atStatePensionAge`).
39
+ */
40
+ statePension: number | null;
41
+ /** App-controlled fields; the shared adapters ignore them. */
42
+ extras?: Record<string, unknown>;
43
+ }
44
+ /**
45
+ * The household's head: the person answering ("you"). The dashboard's form
46
+ * asks these for the head only, so they are not on the partner (the
47
+ * household impact API also takes a partner's student loan plan; the request
48
+ * leaves it out, so the API's default, `NONE`, applies).
49
+ */
50
+ export interface UKHeadDraft extends UKAdultDraft {
51
+ studentLoanPlan: UKStudentLoanPlan;
52
+ /** Pension contributions made by salary sacrifice. */
53
+ salarySacrificePensionContributions: number;
54
+ dividendIncome: number;
55
+ savingsInterestIncome: number;
56
+ /** Net income from property (rent received). */
57
+ propertyIncome: number;
58
+ }
59
+ export interface UKChildDraft {
60
+ /**
61
+ * Age in whole years in the policy year. policyengine-uk counts a child
62
+ * under 16 as a dependant, and a 16- to 19-year-old only in full-time
63
+ * non-advanced education (`inEducation`). Someone of 20 or over is not a
64
+ * child for Child Benefit or Universal Credit; `validate()` refuses them.
65
+ */
66
+ age: number | null;
67
+ /**
68
+ * From 16 to 19: whether they are in full-time non-advanced education
69
+ * (school or college, not university or an apprenticeship). Anything but
70
+ * `false`, including leaving it out, counts as yes. Not read under 16.
71
+ */
72
+ inEducation?: boolean;
73
+ extras?: Record<string, unknown>;
74
+ }
75
+ /** Household spending, pounds a year. */
76
+ export interface UKHouseholdSpending {
77
+ petrol: number;
78
+ diesel: number;
79
+ /**
80
+ * Domestic electricity, including VAT. `null` or left out means the
81
+ * calculation's own default, the average UK household's
82
+ * (`UK_DEFAULT_SPENDING.electricity`).
83
+ */
84
+ electricity?: number | null;
85
+ }
86
+ /**
87
+ * A UK household: a head, an optional partner and their children, as one
88
+ * benefit unit, plus where and how they live.
89
+ *
90
+ * The policy year is not part of the draft. Apps choose it apart from the
91
+ * answers (the Autumn Budget dashboard's year pill reruns the same answers),
92
+ * so `validate()` and the adapters take it as an option.
93
+ */
94
+ export interface UKHouseholdDraft {
95
+ /**
96
+ * The year `employmentIncome` amounts are entered for. The household
97
+ * impact API grows them to the policy year with the OBR average earnings
98
+ * index, so this year must not be after the policy year.
99
+ */
100
+ salaryYear: number;
101
+ /** `null` means not answered. */
102
+ region: UKRegion | null;
103
+ head: UKHeadDraft;
104
+ /** Whether the head lives with a partner. */
105
+ hasPartner: boolean;
106
+ /**
107
+ * The partner's answers. They are kept while `hasPartner` is false, so
108
+ * turning it back on restores them; calculations read them only with a
109
+ * partner.
110
+ */
111
+ partner: UKAdultDraft;
112
+ /** Dependent children, in the order apps show them ("Child 1", ...). */
113
+ children: UKChildDraft[];
114
+ /** `null` means not answered. */
115
+ tenure: UKTenure | null;
116
+ /**
117
+ * Rent a month, read only when renting. `null` means the region's average
118
+ * private rent (`regionalRent`).
119
+ */
120
+ monthlyRent: number | null;
121
+ /** `null` means not answered. */
122
+ councilTaxBand: UKCouncilTaxBand | null;
123
+ /**
124
+ * Whether the household would claim Universal Credit if entitled. `null`
125
+ * means not answered.
126
+ */
127
+ claimsUniversalCredit: boolean | null;
128
+ /** Paid childcare a month, for all children together; read only with children. */
129
+ monthlyChildcare: number;
130
+ spending: UKHouseholdSpending;
131
+ /** App-controlled household-level fields; the shared adapters ignore them. */
132
+ extras?: Record<string, unknown>;
133
+ }
134
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/uk-household/types.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,eAAe,C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KG;IACH,GAAG,EAAE,MAAM,GAAG,IAAI,CAAC;IACnB;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC;AAED,yCAAyC;AACzC,MAAM,WAAW,mBAAmB;IAClC,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED;;;;;;;GAOG;AACH,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,UAAU,EAAE,MAAM,CAAC;IACnB,iCAAiC;IACjC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,IAAI,EAAE,WAAW,CAAC;IAClB,6CAA6C;IAC7C,UAAU,EAAE,OAAO,CAAC;IACpB;;;;OAIG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB,wEAAwE;IACxE,QAAQ,EAAE,YAAY,EAAE,CAAC;IACzB,iCAAiC;IACjC,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB;;;OAGG;IACH,WAAW,EAAE,MAAM,GAAG,IAAI,CAAC;IAC3B,iCAAiC;IACjC,cAAc,EAAE,gBAAgB,GAAG,IAAI,CAAC;IACxC;;;OAGG;IACH,qBAAqB,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,kFAAkF;IAClF,gBAAgB,EAAE,MAAM,CAAC;IACzB,QAAQ,EAAE,mBAAmB,CAAC;IAC9B,8EAA8E;IAC9E,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAClC"}
@@ -0,0 +1,59 @@
1
+ import { type UKStatePensionTable } from './statePension.js';
2
+ import type { UKHouseholdDraft, ValidationResult } from './types.js';
3
+ /**
4
+ * The bounds the Autumn Budget 2026 dashboard's household impact API puts on
5
+ * each answer (`HouseholdAnswersRequest` in its src/uk_budget_data/api.py),
6
+ * which `validate()` applies. Amounts are pounds a year unless named monthly.
7
+ */
8
+ export declare const UK_HOUSEHOLD_LIMITS: {
9
+ readonly adultAge: {
10
+ readonly min: 16;
11
+ readonly max: 100;
12
+ };
13
+ readonly childAge: {
14
+ readonly min: 0;
15
+ readonly max: 19;
16
+ };
17
+ readonly maxChildren: 10;
18
+ /** Incomes and salary sacrifice. */
19
+ readonly maxAmount: 10000000;
20
+ readonly maxMonthlyRent: 100000;
21
+ readonly maxMonthlyChildcare: 10000;
22
+ /** Petrol, diesel and electricity. */
23
+ readonly maxSpending: 100000;
24
+ readonly maxStatePension: 100000;
25
+ };
26
+ /**
27
+ * The policy years the household impact API covers, 2026-27 to 2031-32
28
+ * (`POLICY_YEARS`, from the dashboard's src/uk_budget_data/budget_years.json).
29
+ * Salaries can be entered for these years too.
30
+ */
31
+ export declare const UK_POLICY_YEARS: readonly number[];
32
+ export interface UKValidateOptions {
33
+ /**
34
+ * The policy year (2027 is 2027-28). Ages are taken in this year, State
35
+ * Pension age is this year's, and salaries are grown to it.
36
+ */
37
+ year: number;
38
+ /**
39
+ * The policy years the calculation covers, for the year and the salary
40
+ * year; left out, the household impact API's (`UK_POLICY_YEARS`).
41
+ */
42
+ years?: readonly number[];
43
+ /** State Pension ages by year; left out, `UK_STATE_PENSION`. */
44
+ statePension?: UKStatePensionTable;
45
+ }
46
+ /**
47
+ * Check a draft for the calculation in `options.year`. Every issue is an
48
+ * answer the calculation needs and lacks, or one the household impact API
49
+ * would refuse, so a draft that passes builds a request within the API's
50
+ * bounds (`UK_HOUSEHOLD_LIMITS`) and years (`UK_POLICY_YEARS`), unless
51
+ * `options.years` names others. The request also needs at least one measure
52
+ * the API knows; the draft does not hold the measures, so that is the
53
+ * caller's to check. An answer the calculation does not read
54
+ * (rent when not renting, a partner's answers without a partner, a State
55
+ * Pension under State Pension age) is not checked.
56
+ */
57
+ export declare function validate(draft: UKHouseholdDraft, options: UKValidateOptions): ValidationResult;
58
+ export declare function isComplete(draft: UKHouseholdDraft, options: UKValidateOptions): boolean;
59
+ //# sourceMappingURL=validate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validate.d.ts","sourceRoot":"","sources":["../../src/uk-household/validate.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0C,KAAK,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAClG,OAAO,KAAK,EAAgB,gBAAgB,EAAmB,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEjG;;;;GAIG;AACH,eAAO,MAAM,mBAAmB;;;;;;;;;;IAI9B,oCAAoC;;;;IAIpC,sCAAsC;;;CAG9B,CAAC;AAEX;;;;GAIG;AACH,eAAO,MAAM,eAAe,EAAE,SAAS,MAAM,EAAyC,CAAC;AAEvF,MAAM,WAAW,iBAAiB;IAChC;;;OAGG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;;OAGG;IACH,KAAK,CAAC,EAAE,SAAS,MAAM,EAAE,CAAC;IAC1B,gEAAgE;IAChE,YAAY,CAAC,EAAE,mBAAmB,CAAC;CACpC;AAMD;;;;;;;;;;GAUG;AACH,wBAAgB,QAAQ,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,GAAG,gBAAgB,CA6H9F;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAEvF"}
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./index-CIL8FXNR.cjs");exports.monthlyRentFor=e.monthlyRentFor;exports.toHouseholdImpactRequest=e.toHouseholdImpactRequest;
@@ -0,0 +1 @@
1
+ export * from './uk-household/adapters/index.js';
@@ -0,0 +1,5 @@
1
+ import { B as e, G as s } from "./index-fgLnXugs.js";
2
+ export {
3
+ e as monthlyRentFor,
4
+ s as toHouseholdImpactRequest
5
+ };
@@ -0,0 +1 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("./index-CIL8FXNR.cjs");function S(e=t.UK_SALARY_YEAR){return{salaryYear:e,region:null,head:{age:null,employmentIncome:0,privatePensionIncome:0,statePension:null,studentLoanPlan:"NONE",salarySacrificePensionContributions:0,dividendIncome:0,savingsInterestIncome:0,propertyIncome:0},hasPartner:!1,partner:{age:null,employmentIncome:0,privatePensionIncome:0,statePension:null},children:[],tenure:null,monthlyRent:null,councilTaxBand:null,claimsUniversalCredit:null,monthlyChildcare:0,spending:{petrol:0,diesel:0,electricity:null}}}function R(e=t.UK_SALARY_YEAR){return{salaryYear:e,region:"NORTH_WEST",head:{age:30,employmentIncome:t.UK_DEFAULT_SALARY,privatePensionIncome:0,statePension:null,studentLoanPlan:"NONE",salarySacrificePensionContributions:0,dividendIncome:0,savingsInterestIncome:0,propertyIncome:0},hasPartner:!1,partner:{age:30,employmentIncome:t.UK_DEFAULT_SALARY,privatePensionIncome:0,statePension:null},children:[],tenure:"RENT_PRIVATELY",monthlyRent:null,councilTaxBand:"D",claimsUniversalCredit:!0,monthlyChildcare:0,spending:{petrol:t.UK_DEFAULT_SPENDING.petrol,diesel:t.UK_DEFAULT_SPENDING.diesel,electricity:t.UK_DEFAULT_SPENDING.electricity}}}const d=e=>e?{extras:structuredClone(e)}:{};function P(e){return{...e,head:{...e.head,...d(e.head.extras)},partner:{...e.partner,...d(e.partner.extras)},children:e.children.map(n=>({...n,...d(n.extras)})),spending:{...e.spending},...d(e.extras)}}function I(e,n){return{...e,head:{...e.head,...n}}}function y(e,n){return{...e,partner:{...e.partner,...n}}}function C(e,n={}){return{...e,children:[...e.children,{age:null,...n}]}}function D(e,n){return{...e,children:e.children.filter((i,o)=>o!==n)}}function O(e,n,i){return{...e,children:e.children.map((o,r)=>r===n?{...o,...i}:o)}}function f(e,n,i=t.UK_NEW_CHILD_AGE){const o=e.children.slice(0,Math.max(0,n));for(;o.length<n;)o.push({age:i});return{...e,children:o}}const m=[["employmentIncome","e"],["privatePensionIncome","p"],["statePension","s"]],T=[["salarySacrificePensionContributions","x"],["dividendIncome","d"],["savingsInterestIncome","i"],["propertyIncome","r"]],K="l",v=S(),l=e=>typeof e=="number"&&Number.isFinite(e),L=e=>l(e)?String(e):"";function g(e,n){const i=e,o=[L(e.age)];for(const[r,s]of n){const a=i[r];l(a)&&(a===0&&r!=="statePension"||o.push(`${s}${a}`))}return o.join(":")}function A(e){if(e.trim()==="")return;const n=Number(e);if(Number.isFinite(n))return n===0?0:n}function h(e,n,i){const[o="",...r]=e.split(":"),s={...n},a=s;s.age=A(o)??null;for(const u of r){const _=u[0],c=u.slice(1);if(_===K&&"studentLoanPlan"in n){s.studentLoanPlan=t.isUKStudentLoanPlan(c)?c:"NONE";continue}const E=i.find(([,p])=>p===_),U=A(c);E&&U!==void 0&&(a[E[0]]=U)}return s}function G(e){const n=L(e==null?void 0:e.age),i=(e==null?void 0:e.inEducation)===!0?"y":(e==null?void 0:e.inEducation)===!1?"n":"";return`${n}${i}`}function Y(e){const n=e.slice(-1),i=n==="y"||n==="n",o={age:A(i?e.slice(0,-1):e)??null};return i&&(o.inEducation=n==="y"),o}const F=(e,n)=>e.age===n.age&&e.employmentIncome===n.employmentIncome&&(e.privatePensionIncome??0)===(n.privatePensionIncome??0)&&e.statePension===n.statePension;function H(e){const n=new URLSearchParams;l(e.salaryYear)&&n.set("sy",String(e.salaryYear)),e.region&&n.set("region",e.region),e.tenure&&n.set("tenure",e.tenure),l(e.monthlyRent)&&n.set("rent",String(e.monthlyRent)),e.councilTaxBand&&n.set("band",e.councilTaxBand),typeof e.claimsUniversalCredit=="boolean"&&n.set("uc",e.claimsUniversalCredit?"1":"0");let i=g(e.head,[...m,...T]);e.head.studentLoanPlan&&e.head.studentLoanPlan!=="NONE"&&(i+=`:${K}${e.head.studentLoanPlan}`),n.set("you",i),e.hasPartner&&n.set("hp","1"),(e.hasPartner||!F(e.partner,v.partner))&&n.set("partner",g(e.partner,m)),e.children.length>0&&n.set("c",Array.from(e.children,G).join(","));const{petrol:o,diesel:r,electricity:s}=e.spending;return l(o)&&o!==0&&n.set("petrol",String(o)),l(r)&&r!==0&&n.set("diesel",String(r)),l(s)&&n.set("elec",String(s)),l(e.monthlyChildcare)&&e.monthlyChildcare!==0&&n.set("cc",String(e.monthlyChildcare)),n.toString()}function x(e){const n=typeof e=="string"?new URLSearchParams(e):e,i=S(),o=p=>{const N=n.get(p);return N===null?void 0:A(N)},r=o("sy");r!==void 0&&(i.salaryYear=r);const s=n.get("region");i.region=t.isUKRegion(s)?s:null;const a=n.get("tenure");i.tenure=t.isUKTenure(a)?a:null,i.monthlyRent=o("rent")??null;const u=n.get("band");i.councilTaxBand=t.isUKCouncilTaxBand(u)?u:null;const _=n.get("uc");i.claimsUniversalCredit=_==="1"?!0:_==="0"?!1:null;const c=n.get("you");c!==null&&(i.head=h(c,i.head,[...m,...T])),i.hasPartner=n.get("hp")==="1";const E=n.get("partner");E!==null&&(i.partner=h(E,i.partner,m));const U=n.get("c");return U!==null&&(i.children=U.split(",").map(Y)),i.spending={petrol:o("petrol")??0,diesel:o("diesel")??0,electricity:o("elec")??null},i.monthlyChildcare=o("cc")??0,i}exports.UK_AVERAGE_RENT=t.UK_AVERAGE_RENT;exports.UK_CHILD_AGE_MESSAGE=t.UK_CHILD_AGE_MESSAGE;exports.UK_COUNCIL_TAX_BANDS=t.UK_COUNCIL_TAX_BANDS;exports.UK_DEFAULT_SALARY=t.UK_DEFAULT_SALARY;exports.UK_DEFAULT_SALARY_NOTE=t.UK_DEFAULT_SALARY_NOTE;exports.UK_DEFAULT_SOURCES=t.UK_DEFAULT_SOURCES;exports.UK_DEFAULT_SPENDING=t.UK_DEFAULT_SPENDING;exports.UK_HOUSEHOLD_LIMITS=t.UK_HOUSEHOLD_LIMITS;exports.UK_NEW_CHILD_AGE=t.UK_NEW_CHILD_AGE;exports.UK_OLDEST_CHILD_AGE=t.UK_OLDEST_CHILD_AGE;exports.UK_POLICY_YEARS=t.UK_POLICY_YEARS;exports.UK_REGIONAL_RENT=t.UK_REGIONAL_RENT;exports.UK_REGIONS=t.UK_REGIONS;exports.UK_RENTING_TENURES=t.UK_RENTING_TENURES;exports.UK_SALARY_YEAR=t.UK_SALARY_YEAR;exports.UK_STATE_PENSION=t.UK_STATE_PENSION;exports.UK_STUDENT_LOAN_PLANS=t.UK_STUDENT_LOAN_PLANS;exports.UK_TENURES=t.UK_TENURES;exports.UK_YOUNG_PERSON_AGE=t.UK_YOUNG_PERSON_AGE;exports.asksEducation=t.asksEducation;exports.atStatePensionAge=t.atStatePensionAge;exports.getRegionName=t.getRegionName;exports.isComplete=t.isComplete;exports.isRenting=t.isRenting;exports.isUKCouncilTaxBand=t.isUKCouncilTaxBand;exports.isUKRegion=t.isUKRegion;exports.isUKStudentLoanPlan=t.isUKStudentLoanPlan;exports.isUKTenure=t.isUKTenure;exports.monthlyRentFor=t.monthlyRentFor;exports.regionalRent=t.regionalRent;exports.regionalRentMonth=t.regionalRentMonth;exports.statePensionEntered=t.statePensionEntered;exports.statePensionFor=t.statePensionFor;exports.toHouseholdImpactRequest=t.toHouseholdImpactRequest;exports.validate=t.validate;exports.addChild=C;exports.cloneDraft=P;exports.createBlankDraft=S;exports.createTypicalDraft=R;exports.deserializeDraft=x;exports.removeChild=D;exports.serializeDraft=H;exports.setChildCount=f;exports.updateChild=O;exports.updateHead=I;exports.updatePartner=y;
@@ -0,0 +1 @@
1
+ export * from './uk-household/index.js';
@@ -0,0 +1,220 @@
1
+ import { n as I, h as R, f as _, c as P, y as L, A as f, x as v, z as K } from "./index-fgLnXugs.js";
2
+ import { U as X, a as q, b as J, d as Q, e as Z, g as ee, i as ne, j as te, k as ie, l as se, m as oe, o as re, p as ae, q as le, r as ce, s as ue, t as me, u as pe, v as de, w as ge, B as he, C as Ee, D as _e, E as ye, F as Pe, G as Ue, H as Ne } from "./index-fgLnXugs.js";
3
+ function S(e = I) {
4
+ return {
5
+ salaryYear: e,
6
+ region: null,
7
+ head: {
8
+ age: null,
9
+ employmentIncome: 0,
10
+ privatePensionIncome: 0,
11
+ statePension: null,
12
+ studentLoanPlan: "NONE",
13
+ salarySacrificePensionContributions: 0,
14
+ dividendIncome: 0,
15
+ savingsInterestIncome: 0,
16
+ propertyIncome: 0
17
+ },
18
+ hasPartner: !1,
19
+ partner: { age: null, employmentIncome: 0, privatePensionIncome: 0, statePension: null },
20
+ children: [],
21
+ tenure: null,
22
+ monthlyRent: null,
23
+ councilTaxBand: null,
24
+ claimsUniversalCredit: null,
25
+ monthlyChildcare: 0,
26
+ spending: { petrol: 0, diesel: 0, electricity: null }
27
+ };
28
+ }
29
+ function Y(e = I) {
30
+ return {
31
+ salaryYear: e,
32
+ region: "NORTH_WEST",
33
+ head: {
34
+ age: 30,
35
+ employmentIncome: P,
36
+ privatePensionIncome: 0,
37
+ statePension: null,
38
+ studentLoanPlan: "NONE",
39
+ salarySacrificePensionContributions: 0,
40
+ dividendIncome: 0,
41
+ savingsInterestIncome: 0,
42
+ propertyIncome: 0
43
+ },
44
+ hasPartner: !1,
45
+ partner: { age: 30, employmentIncome: P, privatePensionIncome: 0, statePension: null },
46
+ children: [],
47
+ tenure: "RENT_PRIVATELY",
48
+ monthlyRent: null,
49
+ councilTaxBand: "D",
50
+ claimsUniversalCredit: !0,
51
+ monthlyChildcare: 0,
52
+ spending: {
53
+ petrol: _.petrol,
54
+ diesel: _.diesel,
55
+ electricity: _.electricity
56
+ }
57
+ };
58
+ }
59
+ const d = (e) => e ? { extras: structuredClone(e) } : {};
60
+ function F(e) {
61
+ return {
62
+ ...e,
63
+ head: { ...e.head, ...d(e.head.extras) },
64
+ partner: { ...e.partner, ...d(e.partner.extras) },
65
+ children: e.children.map((n) => ({ ...n, ...d(n.extras) })),
66
+ spending: { ...e.spending },
67
+ ...d(e.extras)
68
+ };
69
+ }
70
+ function H(e, n) {
71
+ return { ...e, head: { ...e.head, ...n } };
72
+ }
73
+ function B(e, n) {
74
+ return { ...e, partner: { ...e.partner, ...n } };
75
+ }
76
+ function w(e, n = {}) {
77
+ return { ...e, children: [...e.children, { age: null, ...n }] };
78
+ }
79
+ function k(e, n) {
80
+ return { ...e, children: e.children.filter((t, i) => i !== n) };
81
+ }
82
+ function $(e, n, t) {
83
+ return {
84
+ ...e,
85
+ children: e.children.map((i, s) => s === n ? { ...i, ...t } : i)
86
+ };
87
+ }
88
+ function M(e, n, t = R) {
89
+ const i = e.children.slice(0, Math.max(0, n));
90
+ for (; i.length < n; ) i.push({ age: t });
91
+ return { ...e, children: i };
92
+ }
93
+ const g = [
94
+ ["employmentIncome", "e"],
95
+ ["privatePensionIncome", "p"],
96
+ ["statePension", "s"]
97
+ ], A = [
98
+ ["salarySacrificePensionContributions", "x"],
99
+ ["dividendIncome", "d"],
100
+ ["savingsInterestIncome", "i"],
101
+ ["propertyIncome", "r"]
102
+ ], T = "l", D = S(), a = (e) => typeof e == "number" && Number.isFinite(e), C = (e) => a(e) ? String(e) : "";
103
+ function U(e, n) {
104
+ const t = e, i = [C(e.age)];
105
+ for (const [s, o] of n) {
106
+ const r = t[s];
107
+ a(r) && (r === 0 && s !== "statePension" || i.push(`${o}${r}`));
108
+ }
109
+ return i.join(":");
110
+ }
111
+ function h(e) {
112
+ if (e.trim() === "") return;
113
+ const n = Number(e);
114
+ if (Number.isFinite(n))
115
+ return n === 0 ? 0 : n;
116
+ }
117
+ function N(e, n, t) {
118
+ const [i = "", ...s] = e.split(":"), o = { ...n }, r = o;
119
+ o.age = h(i) ?? null;
120
+ for (const c of s) {
121
+ const u = c[0], l = c.slice(1);
122
+ if (u === T && "studentLoanPlan" in n) {
123
+ o.studentLoanPlan = K(l) ? l : "NONE";
124
+ continue;
125
+ }
126
+ const m = t.find(([, E]) => E === u), p = h(l);
127
+ m && p !== void 0 && (r[m[0]] = p);
128
+ }
129
+ return o;
130
+ }
131
+ function O(e) {
132
+ const n = C(e == null ? void 0 : e.age), t = (e == null ? void 0 : e.inEducation) === !0 ? "y" : (e == null ? void 0 : e.inEducation) === !1 ? "n" : "";
133
+ return `${n}${t}`;
134
+ }
135
+ function x(e) {
136
+ const n = e.slice(-1), t = n === "y" || n === "n", i = { age: h(t ? e.slice(0, -1) : e) ?? null };
137
+ return t && (i.inEducation = n === "y"), i;
138
+ }
139
+ const b = (e, n) => e.age === n.age && e.employmentIncome === n.employmentIncome && (e.privatePensionIncome ?? 0) === (n.privatePensionIncome ?? 0) && e.statePension === n.statePension;
140
+ function j(e) {
141
+ const n = new URLSearchParams();
142
+ a(e.salaryYear) && n.set("sy", String(e.salaryYear)), e.region && n.set("region", e.region), e.tenure && n.set("tenure", e.tenure), a(e.monthlyRent) && n.set("rent", String(e.monthlyRent)), e.councilTaxBand && n.set("band", e.councilTaxBand), typeof e.claimsUniversalCredit == "boolean" && n.set("uc", e.claimsUniversalCredit ? "1" : "0");
143
+ let t = U(e.head, [...g, ...A]);
144
+ e.head.studentLoanPlan && e.head.studentLoanPlan !== "NONE" && (t += `:${T}${e.head.studentLoanPlan}`), n.set("you", t), e.hasPartner && n.set("hp", "1"), (e.hasPartner || !b(e.partner, D.partner)) && n.set("partner", U(e.partner, g)), e.children.length > 0 && n.set("c", Array.from(e.children, O).join(","));
145
+ const { petrol: i, diesel: s, electricity: o } = e.spending;
146
+ return a(i) && i !== 0 && n.set("petrol", String(i)), a(s) && s !== 0 && n.set("diesel", String(s)), a(o) && n.set("elec", String(o)), a(e.monthlyChildcare) && e.monthlyChildcare !== 0 && n.set("cc", String(e.monthlyChildcare)), n.toString();
147
+ }
148
+ function z(e) {
149
+ const n = typeof e == "string" ? new URLSearchParams(e) : e, t = S(), i = (E) => {
150
+ const y = n.get(E);
151
+ return y === null ? void 0 : h(y);
152
+ }, s = i("sy");
153
+ s !== void 0 && (t.salaryYear = s);
154
+ const o = n.get("region");
155
+ t.region = L(o) ? o : null;
156
+ const r = n.get("tenure");
157
+ t.tenure = f(r) ? r : null, t.monthlyRent = i("rent") ?? null;
158
+ const c = n.get("band");
159
+ t.councilTaxBand = v(c) ? c : null;
160
+ const u = n.get("uc");
161
+ t.claimsUniversalCredit = u === "1" ? !0 : u === "0" ? !1 : null;
162
+ const l = n.get("you");
163
+ l !== null && (t.head = N(l, t.head, [...g, ...A])), t.hasPartner = n.get("hp") === "1";
164
+ const m = n.get("partner");
165
+ m !== null && (t.partner = N(m, t.partner, g));
166
+ const p = n.get("c");
167
+ return p !== null && (t.children = p.split(",").map(x)), t.spending = {
168
+ petrol: i("petrol") ?? 0,
169
+ diesel: i("diesel") ?? 0,
170
+ electricity: i("elec") ?? null
171
+ }, t.monthlyChildcare = i("cc") ?? 0, t;
172
+ }
173
+ export {
174
+ X as UK_AVERAGE_RENT,
175
+ q as UK_CHILD_AGE_MESSAGE,
176
+ J as UK_COUNCIL_TAX_BANDS,
177
+ P as UK_DEFAULT_SALARY,
178
+ Q as UK_DEFAULT_SALARY_NOTE,
179
+ Z as UK_DEFAULT_SOURCES,
180
+ _ as UK_DEFAULT_SPENDING,
181
+ ee as UK_HOUSEHOLD_LIMITS,
182
+ R as UK_NEW_CHILD_AGE,
183
+ ne as UK_OLDEST_CHILD_AGE,
184
+ te as UK_POLICY_YEARS,
185
+ ie as UK_REGIONAL_RENT,
186
+ se as UK_REGIONS,
187
+ oe as UK_RENTING_TENURES,
188
+ I as UK_SALARY_YEAR,
189
+ re as UK_STATE_PENSION,
190
+ ae as UK_STUDENT_LOAN_PLANS,
191
+ le as UK_TENURES,
192
+ ce as UK_YOUNG_PERSON_AGE,
193
+ w as addChild,
194
+ ue as asksEducation,
195
+ me as atStatePensionAge,
196
+ F as cloneDraft,
197
+ S as createBlankDraft,
198
+ Y as createTypicalDraft,
199
+ z as deserializeDraft,
200
+ pe as getRegionName,
201
+ de as isComplete,
202
+ ge as isRenting,
203
+ v as isUKCouncilTaxBand,
204
+ L as isUKRegion,
205
+ K as isUKStudentLoanPlan,
206
+ f as isUKTenure,
207
+ he as monthlyRentFor,
208
+ Ee as regionalRent,
209
+ _e as regionalRentMonth,
210
+ k as removeChild,
211
+ j as serializeDraft,
212
+ M as setChildCount,
213
+ ye as statePensionEntered,
214
+ Pe as statePensionFor,
215
+ Ue as toHouseholdImpactRequest,
216
+ $ as updateChild,
217
+ H as updateHead,
218
+ B as updatePartner,
219
+ Ne as validate
220
+ };
@@ -1,2 +1,2 @@
1
- export { toV1HouseholdPayload, toV1HouseholdSituation, type V1EntityCollection, type V1EntityRecord, type V1FieldValue, type V1GroupCollection, type V1GroupRecord, type V1HouseholdEnvelope, type V1HouseholdSituation, type V1PersonCollection, type V1PersonRecord, type V1ValueMap, type ToV1PayloadOptions, } from './v1Payload';
1
+ export { toV1HouseholdPayload, toV1HouseholdSituation, type V1EntityCollection, type V1EntityRecord, type V1FieldValue, type V1GroupCollection, type V1GroupRecord, type V1HouseholdEnvelope, type V1HouseholdSituation, type V1PersonCollection, type V1PersonRecord, type V1ValueMap, type ToV1PayloadOptions, } from './v1Payload.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { USHouseholdDraft, USPersonExpenses, USPersonFlags, USPersonIncomes } from '../types';
1
+ import type { USHouseholdDraft, USPersonExpenses, USPersonFlags, USPersonIncomes } from '../types.js';
2
2
  /**
3
3
  * The shape of a PolicyEngine US "situation" / household-creation payload at
4
4
  * the wire level. Variables are year-keyed; person/group keys are arbitrary
@@ -1,4 +1,4 @@
1
- import type { USHouseholdDraft, USPersonDraft, USPersonKind } from './types';
1
+ import type { USHouseholdDraft, USPersonDraft, USPersonKind } from './types.js';
2
2
  export declare const DEFAULT_HOUSEHOLD_YEAR: number;
3
3
  /**
4
4
  * Returns a draft with no defaults for state, ages, or marital status. The
@@ -1,10 +1,10 @@
1
- export type { USHouseholdDraft, USMaritalStatus, USPersonDraft, USPersonExpenses, USPersonFlags, USPersonIncomes, USPersonKind, USPersonOccupation, ValidationIssue, ValidationResult, } from './types';
2
- export { DEFAULT_HOUSEHOLD_YEAR, createBlankDraft, cloneDraft, createPerson, addPerson, removePerson, updatePerson, getAdults, getDependents, applyMaritalStatusChange, } from './draft';
3
- export { normalizeLegacyDraft } from './normalize';
4
- export { validate, isComplete, type ValidateOptions } from './validate';
5
- export { serializeDraft, deserializeDraft } from './serialize';
6
- export { US_STATES, isUSStateCode, getStateName, getStateFromZip, type USState, } from './states';
7
- export { NOT_A_TIPPED_OCCUPATION, TIPPED_OCCUPATIONS, getTippedOccupation, isTippedOccupationCode, toTippedOccupationCode, type TippedOccupation, } from './tippedOccupations';
8
- export { getCountiesByState, getCountyName, isCountyCode, resolveCountyCode, type County, } from './counties';
9
- export { toV1HouseholdPayload, toV1HouseholdSituation, type V1HouseholdEnvelope, type V1HouseholdSituation, type V1ValueMap, type V1FieldValue, type V1PersonRecord, type V1GroupRecord, type V1PersonCollection, type V1GroupCollection, type V1EntityRecord, type V1EntityCollection, type ToV1PayloadOptions, } from './adapters/v1Payload';
1
+ export type { USHouseholdDraft, USMaritalStatus, USPersonDraft, USPersonExpenses, USPersonFlags, USPersonIncomes, USPersonKind, USPersonOccupation, ValidationIssue, ValidationResult, } from './types.js';
2
+ export { DEFAULT_HOUSEHOLD_YEAR, createBlankDraft, cloneDraft, createPerson, addPerson, removePerson, updatePerson, getAdults, getDependents, applyMaritalStatusChange, } from './draft.js';
3
+ export { normalizeLegacyDraft } from './normalize.js';
4
+ export { validate, isComplete, type ValidateOptions } from './validate.js';
5
+ export { serializeDraft, deserializeDraft } from './serialize.js';
6
+ export { US_STATES, isUSStateCode, getStateName, getStateFromZip, type USState, } from './states.js';
7
+ export { NOT_A_TIPPED_OCCUPATION, TIPPED_OCCUPATIONS, getTippedOccupation, isTippedOccupationCode, toTippedOccupationCode, type TippedOccupation, } from './tippedOccupations.js';
8
+ export { getCountiesByState, getCountyName, isCountyCode, resolveCountyCode, type County, } from './counties.js';
9
+ export { toV1HouseholdPayload, toV1HouseholdSituation, type V1HouseholdEnvelope, type V1HouseholdSituation, type V1ValueMap, type V1FieldValue, type V1PersonRecord, type V1GroupRecord, type V1PersonCollection, type V1GroupCollection, type V1EntityRecord, type V1EntityCollection, type ToV1PayloadOptions, } from './adapters/v1Payload.js';
10
10
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import type { USHouseholdDraft } from './types';
1
+ import type { USHouseholdDraft } from './types.js';
2
2
  /**
3
3
  * Best-effort normalization from legacy household shapes (cliff-watch's people
4
4
  * array, Coverage Compass's flat fields, ad-hoc test fixtures) into the shared
@@ -1,4 +1,4 @@
1
- import type { USHouseholdDraft } from './types';
1
+ import type { USHouseholdDraft } from './types.js';
2
2
  export declare function serializeDraft(draft: USHouseholdDraft): string;
3
3
  export declare function deserializeDraft(query: string | URLSearchParams): USHouseholdDraft;
4
4
  //# sourceMappingURL=serialize.d.ts.map
@@ -196,18 +196,5 @@ export interface USHouseholdDraft {
196
196
  /** App-controlled household-level fields ignored by the shared adapters. */
197
197
  extras?: Record<string, unknown>;
198
198
  }
199
- export interface ValidationIssue {
200
- /** Stable identifier for the rule (e.g. "state.required"). */
201
- code: string;
202
- /** Path into the draft (dotted), e.g. "state" or "people[1].age". */
203
- path: string;
204
- message: string;
205
- }
206
- export type ValidationResult = {
207
- ok: true;
208
- issues: never[];
209
- } | {
210
- ok: false;
211
- issues: ValidationIssue[];
212
- };
199
+ export type { ValidationIssue, ValidationResult } from '../validation.js';
213
200
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/us-household/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,eAAe,GAAG,QAAQ,GAAG,SAAS,CAAC;AAEnD;;;;;;;GAOG;AACH,MAAM,MAAM,YAAY,GAAG,OAAO,GAAG,WAAW,CAAC;AAEjD;;;;;GAKG;AACH,MAAM,WAAW,aAAa;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC;I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EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC"}
@@ -1,4 +1,4 @@
1
- import type { USHouseholdDraft, ValidationResult } from './types';
1
+ import type { USHouseholdDraft, ValidationResult } from './types.js';
2
2
  export interface ValidateOptions {
3
3
  /**
4
4
  * If true, require a county selection in addition to state. Apps where the
@@ -1 +1 @@
1
- export * from './us-household/adapters/index';
1
+ export * from './us-household/adapters/index.js';
@@ -1 +1 @@
1
- export * from './us-household/index';
1
+ export * from './us-household/index.js';
@@ -0,0 +1,16 @@
1
+ /** One problem `validate()` found in a draft. Shared by the country models. */
2
+ export interface ValidationIssue {
3
+ /** Stable identifier for the rule (e.g. "state.required"). */
4
+ code: string;
5
+ /** Path into the draft (dotted), e.g. "state" or "people[1].age". */
6
+ path: string;
7
+ message: string;
8
+ }
9
+ export type ValidationResult = {
10
+ ok: true;
11
+ issues: never[];
12
+ } | {
13
+ ok: false;
14
+ issues: ValidationIssue[];
15
+ };
16
+ //# sourceMappingURL=validation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"validation.d.ts","sourceRoot":"","sources":["../src/validation.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,MAAM,WAAW,eAAe;IAC9B,8DAA8D;IAC9D,IAAI,EAAE,MAAM,CAAC;IACb,qEAAqE;IACrE,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,MAAM,gBAAgB,GACxB;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,MAAM,EAAE,KAAK,EAAE,CAAA;CAAE,GAC7B;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,MAAM,EAAE,eAAe,EAAE,CAAA;CAAE,CAAC"}