@casomoltd/nhs-pay 0.29.0 → 0.31.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 (80) hide show
  1. package/README.md +78 -249
  2. package/dist/bands.d.ts +9 -1
  3. package/dist/bands.js +20 -0
  4. package/dist/bands.js.map +1 -1
  5. package/dist/dates.d.ts +3 -0
  6. package/dist/dates.js +7 -2
  7. package/dist/dates.js.map +1 -1
  8. package/dist/document-source.d.ts +16 -0
  9. package/dist/document-source.js +3 -1
  10. package/dist/document-source.js.map +1 -1
  11. package/dist/errors.d.ts +46 -11
  12. package/dist/errors.js +68 -28
  13. package/dist/errors.js.map +1 -1
  14. package/dist/factor-basis.d.ts +14 -0
  15. package/dist/factor-basis.js.map +1 -1
  16. package/dist/index.d.ts +13 -11
  17. package/dist/index.js +6 -5
  18. package/dist/index.js.map +1 -1
  19. package/dist/member/benefits.js +41 -39
  20. package/dist/member/benefits.js.map +1 -1
  21. package/dist/member/index.d.ts +1 -1
  22. package/dist/member/input-period.d.ts +41 -0
  23. package/dist/member/input-period.js +168 -0
  24. package/dist/member/input-period.js.map +1 -0
  25. package/dist/member/service.d.ts +8 -1
  26. package/dist/member/service.js +18 -1
  27. package/dist/member/service.js.map +1 -1
  28. package/dist/member/types.d.ts +101 -44
  29. package/dist/member/types.js.map +1 -1
  30. package/dist/member/valuation.d.ts +72 -14
  31. package/dist/member/valuation.js +115 -34
  32. package/dist/member/valuation.js.map +1 -1
  33. package/dist/pay-path.d.ts +21 -25
  34. package/dist/pay-path.js +85 -67
  35. package/dist/pay-path.js.map +1 -1
  36. package/dist/pension/ages.d.ts +6 -4
  37. package/dist/pension/ages.js +6 -4
  38. package/dist/pension/ages.js.map +1 -1
  39. package/dist/pension/curve.d.ts +2 -1
  40. package/dist/pension/curve.js +15 -7
  41. package/dist/pension/curve.js.map +1 -1
  42. package/dist/pension/history.d.ts +18 -3
  43. package/dist/pension/history.js +12 -5
  44. package/dist/pension/history.js.map +1 -1
  45. package/dist/pension/ledger.d.ts +15 -9
  46. package/dist/pension/ledger.js +91 -56
  47. package/dist/pension/ledger.js.map +1 -1
  48. package/dist/pension/prices.d.ts +11 -2
  49. package/dist/pension/prices.js +35 -14
  50. package/dist/pension/prices.js.map +1 -1
  51. package/dist/pension/scheme-year.d.ts +59 -0
  52. package/dist/pension/scheme-year.js +80 -0
  53. package/dist/pension/scheme-year.js.map +1 -0
  54. package/dist/pension/seed.d.ts +66 -50
  55. package/dist/pension/seed.js +111 -65
  56. package/dist/pension/seed.js.map +1 -1
  57. package/dist/pension/uplift.d.ts +13 -33
  58. package/dist/pension/uplift.js +11 -56
  59. package/dist/pension/uplift.js.map +1 -1
  60. package/dist/pension-projection.js +30 -22
  61. package/dist/pension-projection.js.map +1 -1
  62. package/dist/post.d.ts +1 -10
  63. package/dist/post.js +1 -12
  64. package/dist/post.js.map +1 -1
  65. package/dist/revaluation.d.ts +34 -35
  66. package/dist/revaluation.js +41 -41
  67. package/dist/revaluation.js.map +1 -1
  68. package/dist/scale-point.d.ts +6 -0
  69. package/dist/sections/final-salary.d.ts +64 -52
  70. package/dist/sections/final-salary.js +131 -69
  71. package/dist/sections/final-salary.js.map +1 -1
  72. package/dist/sections/section-2015.d.ts +2 -1
  73. package/dist/sections/section-2015.js.map +1 -1
  74. package/dist/sources.d.ts +10 -0
  75. package/dist/sources.js +20 -0
  76. package/dist/sources.js.map +1 -1
  77. package/dist/take-home.d.ts +4 -20
  78. package/dist/take-home.js +3 -23
  79. package/dist/take-home.js.map +1 -1
  80. package/package.json +3 -3
package/dist/pay-path.js CHANGED
@@ -29,35 +29,7 @@
29
29
  import { PROMOTIONAL_SCALE_2020 } from './gad/promotional-scale-2020.js';
30
30
  import { invariant, PayPathUnavailable } from './errors.js';
31
31
  import { isoToDate } from './iso-date.js';
32
- import { schemeYearEndFor } from './pension/seed.js';
33
- /**
34
- * GAD's promotional pay index at an age: growth from promotion and
35
- * progression over and above general pay awards, 100 at age 25,
36
- * linear between the published five-year rows and flat beyond their
37
- * ends.
38
- *
39
- * **The two non-manual columns, averaged.** GAD splits the index by
40
- * sex and we do not ask a member's sex, nor infer it: averaging is
41
- * the only version that encodes no guess about the member. It
42
- * overstates progression for women and understates it for men, which a
43
- * caller showing its figures should disclose. Non-manual is not a second
44
- * assumption — every Agenda for Change band is non-manual in GAD's
45
- * terms.
46
- */
47
- export function promotionalIndex(age) {
48
- invariant(Number.isFinite(age), `promotionalIndex: age ${age}`);
49
- const { ages, nonManual } = PROMOTIONAL_SCALE_2020;
50
- const blend = (i) => (nonManual.male[i] + nonManual.female[i]) / 2;
51
- const last = ages.length - 1;
52
- if (age <= ages[0])
53
- return blend(0);
54
- if (age >= ages[last])
55
- return blend(last);
56
- const hi = ages.findIndex((a) => a > age);
57
- const lo = hi - 1;
58
- const through = (age - ages[lo]) / (ages[hi] - ages[lo]);
59
- return blend(lo) + (blend(hi) - blend(lo)) * through;
60
- }
32
+ import { schemeYearEnd, schemeYearEndFor } from './pension/scheme-year.js';
61
33
  /** What a year's pay rests on: see the module header. */
62
34
  export const PAY_BASES = {
63
35
  declared: 'declared',
@@ -65,26 +37,8 @@ export const PAY_BASES = {
65
37
  projected: 'projected',
66
38
  reconstructed: 'reconstructed',
67
39
  };
68
- /**
69
- * The contractual steps still to come, as the scheme years each is
70
- * first paid in, scaled to the member's own pay so a part-time
71
- * member's steps stay in proportion to what they are actually paid.
72
- */
73
- function contractualSteps(ladder, current, currentYear) {
74
- const here = ladder.current;
75
- if (!ladder.points.includes(here)) {
76
- throw new RangeError(`pay ladder: current point "${here.label}" is not one of its points`);
77
- }
78
- const hereYears = here.yearsExperience;
79
- const scale = current.todaysMoney / here.salary;
80
- return ladder.points
81
- .filter((p) => p.yearsExperience > hereYears)
82
- .map((p) => ({
83
- from: currentYear + p.yearsExperience - hereYears,
84
- pay: p.salary * scale,
85
- }))
86
- .sort((a, b) => a.from - b.from);
87
- }
40
+ /** The columns the index averages: GAD's non-manual male and female. */
41
+ const NON_MANUAL_COLUMNS = 2;
88
42
  /**
89
43
  * Build a member's pay path. Refuses only where there is nothing to
90
44
  * build from: every other gap is filled, the same way for everybody,
@@ -92,11 +46,7 @@ function contractualSteps(ladder, current, currentYear) {
92
46
  */
93
47
  export function buildPayPath(dateOfBirth, pay) {
94
48
  const { current } = pay;
95
- // Nought is a figure: a member paid nothing accrues nothing, and a
96
- // stated balance still revalues. Only what is not a figure refuses.
97
- if (!Number.isFinite(current.todaysMoney) || current.todaysMoney < 0) {
98
- throw new PayPathUnavailable(`current pay ${current.todaysMoney} is not a pay figure`);
99
- }
49
+ refuseNoCurrentPay(current);
100
50
  const born = isoToDate(dateOfBirth);
101
51
  /** The age whose birthday falls in a scheme year: the years since
102
52
  * the scheme year the member was born in. */
@@ -104,26 +54,16 @@ export function buildPayPath(dateOfBirth, pay) {
104
54
  const ageIn = (schemeYearEnd) => schemeYearEnd - bornIn;
105
55
  const indexIn = (schemeYearEnd) => promotionalIndex(ageIn(schemeYearEnd));
106
56
  const currentYear = schemeYearEndFor(isoToDate(current.asAt));
107
- const declared = new Map();
108
- for (const { schemeYearEnd, todaysMoney: figure } of pay.declared) {
109
- if (declared.has(schemeYearEnd)) {
110
- throw new RangeError(`pay path: ${schemeYearEnd} declared twice`);
111
- }
112
- if (!Number.isFinite(figure) || figure <= 0) {
113
- throw new RangeError(`pay path: ${schemeYearEnd} declared as ${figure}`);
114
- }
115
- declared.set(schemeYearEnd, figure);
116
- }
57
+ const declared = declaredByYear(pay.declared);
117
58
  const steps = pay.ladder === null
118
59
  ? []
119
60
  : contractualSteps(pay.ladder, current, currentYear);
120
- const lastStep = steps.at(-1);
121
61
  /** Where the curve takes over going forwards: the top of the
122
62
  * ladder, or today where there is no ladder left to climb. */
123
- const curveFrom = lastStep ?? { from: currentYear, pay: current.todaysMoney };
63
+ const curveFrom = steps.at(-1)
64
+ ?? { from: currentYear, pay: current.todaysMoney };
124
65
  return {
125
66
  payFor(schemeYearEnd) {
126
- invariant(Number.isInteger(schemeYearEnd), `pay path: scheme year ${schemeYearEnd}`);
127
67
  const given = declared.get(schemeYearEnd);
128
68
  if (given !== undefined)
129
69
  return { pay: given, basis: PAY_BASES.declared };
@@ -152,4 +92,82 @@ export function buildPayPath(dateOfBirth, pay) {
152
92
  },
153
93
  };
154
94
  }
95
+ /**
96
+ * GAD's promotional pay index at an age: growth from promotion and
97
+ * progression over and above general pay awards, 100 at age 25,
98
+ * linear between the published five-year rows and flat beyond their
99
+ * ends.
100
+ *
101
+ * **The two non-manual columns, averaged.** GAD splits the index by
102
+ * sex and we do not ask a member's sex, nor infer it: averaging is
103
+ * the only version that encodes no guess about the member. It
104
+ * overstates progression for women and understates it for men, which a
105
+ * caller showing its figures should disclose. Non-manual is not a second
106
+ * assumption — every Agenda for Change band is non-manual in GAD's
107
+ * terms.
108
+ */
109
+ export function promotionalIndex(age) {
110
+ invariant(Number.isFinite(age), `promotionalIndex: age ${age}`);
111
+ const { ages, nonManual } = PROMOTIONAL_SCALE_2020;
112
+ const blend = (i) => (nonManual.male[i] + nonManual.female[i]) / NON_MANUAL_COLUMNS;
113
+ const last = ages.length - 1;
114
+ if (age <= ages[0])
115
+ return blend(0);
116
+ if (age >= ages[last])
117
+ return blend(last);
118
+ const hi = ages.findIndex((a) => a > age);
119
+ const lo = hi - 1;
120
+ const through = (age - ages[lo]) / (ages[hi] - ages[lo]);
121
+ return blend(lo) + (blend(hi) - blend(lo)) * through;
122
+ }
123
+ /**
124
+ * Whether `figure` is a pay figure: finite and not negative. Nought is one,
125
+ * now or in a past year: a member paid nothing, as on unpaid leave, accrues
126
+ * nothing for it, and a stated balance still revalues. A year of nought is
127
+ * not a break in service. The one test both refusals below apply.
128
+ */
129
+ function isPayFigure(figure) {
130
+ return Number.isFinite(figure) && figure >= 0;
131
+ }
132
+ /** Refuse a current pay that is not a pay figure. */
133
+ function refuseNoCurrentPay(current) {
134
+ if (!isPayFigure(current.todaysMoney)) {
135
+ throw new PayPathUnavailable(`current pay ${current.todaysMoney} is not a pay figure`);
136
+ }
137
+ }
138
+ /** The pay a member declared, by scheme year. Throws RangeError for a year
139
+ * declared twice or a figure that is not a pay figure. */
140
+ function declaredByYear(declared) {
141
+ const byYear = new Map();
142
+ for (const { schemeYearEnd, todaysMoney: figure } of declared) {
143
+ if (byYear.has(schemeYearEnd)) {
144
+ throw new RangeError(`pay path: ${schemeYearEnd} declared twice`);
145
+ }
146
+ if (!isPayFigure(figure)) {
147
+ throw new RangeError(`pay path: ${schemeYearEnd} declared as ${figure}`);
148
+ }
149
+ byYear.set(schemeYearEnd, figure);
150
+ }
151
+ return byYear;
152
+ }
153
+ /**
154
+ * The contractual steps still to come, as the scheme years each is
155
+ * first paid in, scaled to the member's own pay so a part-time
156
+ * member's steps stay in proportion to what they are actually paid.
157
+ */
158
+ function contractualSteps(ladder, current, currentYear) {
159
+ const here = ladder.current;
160
+ if (!ladder.points.includes(here)) {
161
+ throw new RangeError(`pay ladder: current point "${here.label}" is not one of its points`);
162
+ }
163
+ const hereYears = here.yearsExperience;
164
+ const scale = current.todaysMoney / here.salary;
165
+ return ladder.points
166
+ .filter((p) => p.yearsExperience > hereYears)
167
+ .map((p) => ({
168
+ from: schemeYearEnd(currentYear + p.yearsExperience - hereYears),
169
+ pay: p.salary * scale,
170
+ }))
171
+ .sort((a, b) => a.from - b.from);
172
+ }
155
173
  //# sourceMappingURL=pay-path.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pay-path.js","sourceRoot":"","sources":["../src/pay-path.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,OAAO,EAAC,sBAAsB,EAAC,MAAM,iCAAiC,CAAC;AACvE,OAAO,EAAC,SAAS,EAAE,kBAAkB,EAAC,MAAM,aAAa,CAAC;AAE1D,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AACxC,OAAO,EAAC,gBAAgB,EAAC,MAAM,mBAAmB,CAAC;AAGnD;;;;;;;;;;;;;G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4B,CACrE,CAAC;IACJ,CAAC;IACD,MAAM,SAAS,GAAG,IAAI,CAAC,eAAe,CAAC;IACvC,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,MAAM,CAAC;IAChD,OAAO,MAAM,CAAC,MAAM;SACjB,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC;SAC5C,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;QACX,IAAI,EAAE,aAAa,CAAC,WAAW,GAAG,CAAC,CAAC,eAAe,GAAG,SAAS,CAAC;QAChE,GAAG,EAAE,CAAC,CAAC,MAAM,GAAG,KAAK;KACtB,CAAC,CAAC;SACF,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,CAAC;AACrC,CAAC"}
@@ -6,10 +6,12 @@
6
6
  * NORMAL PENSION AGE in the 2015 Section = the member's State Pension age, with
7
7
  * a floor of 65 (NHSBSA 2015 Members' Guide V13, May 2024, archived as SA-38 in
8
8
  * docs/source-archive.md). The SPA timetable is legislated — Pensions Acts
9
- * 1995/2007/2011/2014 — and reproduced in DWP's "State Pension age timetables",
10
- * archived as SA-62 in docs/source-archive.md (last updated 15 May 2014; the
11
- * legislated dates have not changed since — the 2023 SPA review left them as
12
- * enacted).
9
+ * 1995/2007/2011/2014 — and reproduced in DWP's "State Pension age timetable",
10
+ * archived as SA-62 in docs/source-archive.md (last updated 15 May 2014, "following
11
+ * changes included in the Pensions Act 2014"). The legislated dates stand: the
12
+ * government's State Pension age Review 2023 (30 March 2023,
13
+ * https://www.gov.uk/government/publications/state-pension-age-review-2023-government-report)
14
+ * kept the rise to 67 for 2026-2028 and left the rise to 68 as legislated.
13
15
  *
14
16
  * Whole years only. The Acts phase each rise through narrow transitional birth
15
17
  * cohorts whose exact SPA is 65/66/67 plus some months; `normalPensionAge`
@@ -6,10 +6,12 @@
6
6
  * NORMAL PENSION AGE in the 2015 Section = the member's State Pension age, with
7
7
  * a floor of 65 (NHSBSA 2015 Members' Guide V13, May 2024, archived as SA-38 in
8
8
  * docs/source-archive.md). The SPA timetable is legislated — Pensions Acts
9
- * 1995/2007/2011/2014 — and reproduced in DWP's "State Pension age timetables",
10
- * archived as SA-62 in docs/source-archive.md (last updated 15 May 2014; the
11
- * legislated dates have not changed since — the 2023 SPA review left them as
12
- * enacted).
9
+ * 1995/2007/2011/2014 — and reproduced in DWP's "State Pension age timetable",
10
+ * archived as SA-62 in docs/source-archive.md (last updated 15 May 2014, "following
11
+ * changes included in the Pensions Act 2014"). The legislated dates stand: the
12
+ * government's State Pension age Review 2023 (30 March 2023,
13
+ * https://www.gov.uk/government/publications/state-pension-age-review-2023-government-report)
14
+ * kept the rise to 67 for 2026-2028 and left the rise to 68 as legislated.
13
15
  *
14
16
  * Whole years only. The Acts phase each rise through narrow transitional birth
15
17
  * cohorts whose exact SPA is 65/66/67 plus some months; `normalPensionAge`
@@ -1 +1 @@
1
- {"version":3,"file":"ages.js","sourceRoot":"","sources":["../../src/pension/ages.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,EACL,oBAAoB,EACpB,yBAAyB,GAC1B,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAC,SAAS,EAAE,QAAQ,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AACzD,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,OAAO,EAAE,SAAS,EAAE,SAAS,EAAC,MAAM,gBAAgB,CAAC;AAG7D;;;;;;;GAOG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG;IACjC,WAAW,EAAE,EAAE;IACf,WAAW,EAAE,EAAE;CACP,CAAC;AAEX;;;;;;;gDAOgD;AAChD,MAAM,CAAC,MAAM,YAAY,GAAG,EAAE,CAAC;AAE/B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,OAAO,CAAC;AAC/C,CAAC;AASD;8EAC8E;AAC9E,MAAM,UAAU,WAAW,CACzB,EAAC,IAAI,EAAE,WAAW,EAAiB,EACnC,OAAgB;IAEhB,MAAM,EAAE,GAAG,SAAS,CAAC,OAAO,CAAC,CAAC;IAC9B,MAAM,UAAU,GAAG,oBAAoB,CAAC;QACtC,YAAY,EAAE,YAAY;QAC1B,gBAAgB,EAAE,SAAS,CAAC,WAAW,CAAC,GAAG,yBAAyB,EAAE;KACvE,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,EAAC,UAAU,EAAE,OAAO,EAAE,EAAE,IAAI,OAAO,CAAC,SAAS,CAAC,IAAI,CAAC,EAAE,UAAU,CAAC,EAAC,CAAC;AAC3E,CAAC;AAED;yBACyB;AACzB,MAAM,UAAU,aAAa,CAC3B,MAAiE;IAEjE,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAChC,MAAM,IAAI,UAAU,CAAC,6BAA6B,CAAC,CAAC;IACtD,CAAC;IACD,OAAO,SAAS,CAAC,QAAQ,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC;AAChF,CAAC"}
@@ -1,5 +1,6 @@
1
1
  import type { EstimatedHistory } from './history.js';
2
2
  import type { MemberLedger } from './ledger.js';
3
+ import type { SchemeYearEnd } from './scheme-year.js';
3
4
  import type { MemberPhase } from './uplift.js';
4
5
  /** A point on the projection curve */
5
6
  export interface ProjectionPoint {
@@ -39,7 +40,7 @@ interface CurveRun {
39
40
  * the one the age is counted from, so five years of age can span six
40
41
  * scheme years.
41
42
  */
42
- export declare function walkThrough(drawing: Date, pensionAge: Date): number;
43
+ export declare function walkThrough(drawing: Date, pensionAge: Date): SchemeYearEnd;
43
44
  /**
44
45
  * The curve is the ledger's own steps, plotted ON THEM.
45
46
  *
@@ -7,8 +7,15 @@
7
7
  * the same ledger and plot it the same way, so it belongs to neither.
8
8
  */
9
9
  import { yearsBetween } from '../dates.js';
10
- import { schemeYearEndDate, schemeYearEndFor } from './seed.js';
10
+ import { schemeYearEnd, schemeYearEndDate, schemeYearEndFor } from './scheme-year.js';
11
11
  import { phaseAt } from './uplift.js';
12
+ /** The years of age the curve draws beyond the later of the drawing and
13
+ * the pension age. */
14
+ const CURVE_AGES_BEYOND = 5;
15
+ /** The scheme years a walk reaches beyond that point: one more than the
16
+ * ages, since a birthday can fall in the scheme year after the one the
17
+ * age is counted from. */
18
+ const WALK_YEARS_BEYOND = CURVE_AGES_BEYOND + 1;
12
19
  /**
13
20
  * The last scheme year a walk reaches: six past the later of the
14
21
  * drawing and the pension age. The curve draws five years of age
@@ -17,7 +24,7 @@ import { phaseAt } from './uplift.js';
17
24
  * scheme years.
18
25
  */
19
26
  export function walkThrough(drawing, pensionAge) {
20
- return Math.max(schemeYearEndFor(drawing), schemeYearEndFor(pensionAge)) + 6;
27
+ return schemeYearEnd(Math.max(schemeYearEndFor(drawing), schemeYearEndFor(pensionAge)) + WALK_YEARS_BEYOND);
21
28
  }
22
29
  /**
23
30
  * A member's age on a date, as WHOLE YEARS plus the fraction of
@@ -71,15 +78,16 @@ function ageAtYearEnd(dateOfBirth, on) {
71
78
  */
72
79
  export function buildCurve(cash, todays) {
73
80
  const { today, dateOfBirth, retirementDate, npa } = cash;
74
- const endAge = Math.max(npa + 5, yearsBetween(dateOfBirth, retirementDate) + 5);
81
+ const endAge = CURVE_AGES_BEYOND
82
+ + Math.max(npa, yearsBetween(dateOfBirth, retirementDate));
75
83
  /** The scheme year an age's birthday falls in. */
76
84
  const yearOfAge = (age) => schemeYearEndFor(new Date(dateOfBirth.getFullYear() + age, dateOfBirth.getMonth(), dateOfBirth.getDate()));
77
85
  /** The age whose birthday falls in a scheme year — the
78
86
  * inverse, used once to find where the axis starts. */
79
- const ageInYear = (schemeYearEnd) => {
80
- const end = schemeYearEndDate(schemeYearEnd);
81
- const birthday = new Date(schemeYearEnd, dateOfBirth.getMonth(), dateOfBirth.getDate());
82
- return schemeYearEnd - dateOfBirth.getFullYear()
87
+ const ageInYear = (year) => {
88
+ const end = schemeYearEndDate(year);
89
+ const birthday = new Date(year, dateOfBirth.getMonth(), dateOfBirth.getDate());
90
+ return year - dateOfBirth.getFullYear()
83
91
  - (birthday > end ? 1 : 0);
84
92
  };
85
93
  const startAge = ageInYear(schemeYearEndFor(cash.curveFrom));
@@ -1 +1 @@
1
- {"version":3,"file":"curve.js","sourceRoot":"","sources":["../../src/pension/curve.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,OAAO,EAAC,YAAY,EAAC,MAAM,aAAa,CAAC;AAGzC,OAAO,EAAC,iBAAiB,EAAE,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC9D,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AAoCpC;;;;;;GAMG;AACH,MAAM,UAAU,WAAW,CAAC,OAAa,EAAE,UAAgB;IACzD,OAAO,IAAI,CAAC,GAAG,CACb,gBAAgB,CAAC,OAAO,CAAC,EAAE,gBAAgB,CAAC,UAAU,CAAC,CACxD,GAAG,CAAC,CAAC;AACR,CAAC;AAED;;;;;;;GAOG;AACH,SAAS,YAAY,CAAC,WAAiB,EAAE,EAAQ;IAC/C,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,CAC3C,IAAI,EAAE,WAAW,CAAC,QAAQ,EAAE,EAAE,WAAW,CAAC,OAAO,EAAE,CACpD,CAAC;IACF,MAAM,QAAQ,GAAG,UAAU,CAAC,EAAE,CAAC,WAAW,EAAE,CAAC,CAAC;IAC9C,MAAM,OAAO,GAAG,QAAQ,IAAI,EAAE,CAAC;IAC/B,MAAM,KAAK,GAAG,EAAE,CAAC,WAAW,EAAE,GAAG,WAAW,CAAC,WAAW,EAAE;UACtD,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CA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E,CAAC;YAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,EAAE,IAAI,KAAK;YACpB;;;;;sDAK0C;YAC1C,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,OAAO,CAC1B,IAAI,EACJ,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CACtC;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -32,6 +32,12 @@
32
32
  * member actually gave. A pension projected from a pay derived
33
33
  * from that same pension would be arguing in a circle.
34
34
  *
35
+ * It is **the one estimate of the years before a statement**.
36
+ * The statement's own walk refuses every read before its 31 March
37
+ * (`BeforeStatement`); this walks a ledger of its own from the join
38
+ * date, so the chart's built-up arm is drawn from here and nowhere
39
+ * else.
40
+ *
35
41
  * ── Why it is calibrated by a walk, not a formula ───
36
42
  *
37
43
  * Closed form exists. With flat pay, a constant rate `r` and
@@ -71,6 +77,7 @@
71
77
  */
72
78
  import type { MemberLedger } from './ledger.js';
73
79
  import type { Prices } from './prices.js';
80
+ import type { SchemeYearEnd } from './scheme-year.js';
74
81
  /** An illustrative run-up to a stated balance. */
75
82
  export interface EstimatedHistory {
76
83
  /**
@@ -86,12 +93,20 @@ export interface EstimatedHistory {
86
93
  /** The walked years, ending exactly on the stated balance. */
87
94
  readonly ledger: MemberLedger;
88
95
  /** First and last scheme year covered, inclusive. */
89
- readonly from: number;
90
- readonly to: number;
96
+ readonly from: SchemeYearEnd;
97
+ readonly to: SchemeYearEnd;
91
98
  }
99
+ /**
100
+ * Estimate the years from `joinDate` up to a stated balance.
101
+ *
102
+ * Null when there is nothing to draw — a member who joined in
103
+ * or after the statement's own scheme year has no run-up, and
104
+ * inventing one would put pension on the chart before they had
105
+ * any.
106
+ */
92
107
  export declare function estimateHistory({ joinDate, statedBalance, statementSchemeYearEnd, prices, }: {
93
108
  joinDate: Date;
94
109
  statedBalance: number;
95
- statementSchemeYearEnd: number;
110
+ statementSchemeYearEnd: SchemeYearEnd;
96
111
  prices: Prices;
97
112
  }): EstimatedHistory | null;
@@ -32,6 +32,12 @@
32
32
  * member actually gave. A pension projected from a pay derived
33
33
  * from that same pension would be arguing in a circle.
34
34
  *
35
+ * It is **the one estimate of the years before a statement**.
36
+ * The statement's own walk refuses every read before its 31 March
37
+ * (`BeforeStatement`); this walks a ledger of its own from the join
38
+ * date, so the chart's built-up arm is drawn from here and nowhere
39
+ * else.
40
+ *
35
41
  * ── Why it is calibrated by a walk, not a formula ───
36
42
  *
37
43
  * Closed form exists. With flat pay, a constant rate `r` and
@@ -70,7 +76,11 @@
70
76
  * 2021 pounds with 2025 pounds and reads low by a tenth.
71
77
  */
72
78
  import { buildLedger, flatPay } from './ledger.js';
73
- import { firstWalkedYear, schemeYearEndDate, seedFromJoinDate, } from './seed.js';
79
+ import { schemeYearEnd, schemeYearEndDate } from './scheme-year.js';
80
+ import { firstWalkedYear, seedFromJoinDate } from './seed.js';
81
+ /** Far enough past the statement that no leaving or drawing date
82
+ * falls inside the estimated window. */
83
+ const YEARS_BEYOND_THE_WINDOW = 60;
74
84
  /**
75
85
  * Estimate the years from `joinDate` up to a stated balance.
76
86
  *
@@ -79,16 +89,13 @@ import { firstWalkedYear, schemeYearEndDate, seedFromJoinDate, } from './seed.js
79
89
  * inventing one would put pension on the chart before they had
80
90
  * any.
81
91
  */
82
- /** Far enough past the statement that no leaving or drawing date
83
- * falls inside the estimated window. */
84
- const YEARS_BEYOND_THE_WINDOW = 60;
85
92
  export function estimateHistory({ joinDate, statedBalance, statementSchemeYearEnd, prices, }) {
86
93
  const seed = seedFromJoinDate(joinDate);
87
94
  const first = firstWalkedYear(seed);
88
95
  if (first > statementSchemeYearEnd || statedBalance <= 0) {
89
96
  return null;
90
97
  }
91
- const beyondTheWindow = schemeYearEndDate(statementSchemeYearEnd + YEARS_BEYOND_THE_WINDOW);
98
+ const beyondTheWindow = schemeYearEndDate(schemeYearEnd(statementSchemeYearEnd + YEARS_BEYOND_THE_WINDOW));
92
99
  const walk = (pay) => buildLedger({
93
100
  seed,
94
101
  payIn: flatPay(pay),
@@ -1 +1 @@
1
- {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/pension/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAC,WAAW,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAGjD,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,WAAW,CAAC;AAqBnB;;;;;;;GAOG;AACH;yCACyC;AACzC,MAAM,uBAAuB,GAAG,EAAE,CAAC;AAEnC,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,MAAM,GAMP;IACC,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,eAAe,CAAC,IAAI,CAAC,CAAC;IACpC,IAAI,KAAK,GAAG,sBAAsB,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,eAAe,GAAG,iBAAiB,CACvC,sBAAsB,GAAG,uBAAuB,CACjD,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,WAAW,CAAC;QACxC,IAAI;QACJ,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;QACnB,4DAA4D;QAC5D,gEAAgE;QAChE,iEAAiE;QACjE,sCAAsC;QACtC,QAAQ,EAAE,eAAe;QACzB,cAAc,EAAE,eAAe;QAC/B,MAAM;QACN,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,OAAO,EAAE,sBAAsB;KAChC,CAAC,C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CACvC,aAAa,CAAC,sBAAsB,GAAG,uBAAuB,CAAC,CAChE,CAAC;IACF,MAAM,IAAI,GAAG,CAAC,GAAW,EAAE,EAAE,CAAC,WAAW,CAAC;QACxC,IAAI;QACJ,KAAK,EAAE,OAAO,CAAC,GAAG,CAAC;QACnB,4DAA4D;QAC5D,gEAAgE;QAChE,iEAAiE;QACjE,sCAAsC;QACtC,QAAQ,EAAE,eAAe;QACzB,cAAc,EAAE,eAAe;QAC/B,MAAM;QACN,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,OAAO,EAAE,sBAAsB;KAChC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,kDAAkD;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC3D,wDAAwD;IACxD,6DAA6D;IAC7D,2DAA2D;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAE7D,MAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC5C,OAAO;QACL,UAAU;QACV,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;QACxB,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,sBAAsB;KAC3B,CAAC;AACJ,CAAC"}
@@ -23,6 +23,7 @@ import type { FactorProvenance, FactorTableKind } from '../gad/factor-table.js';
23
23
  import type { PayBasis, YearPay } from '../pay-path.js';
24
24
  import type { CpiEntry, Prices } from './prices.js';
25
25
  import type { AppliedUplift, MemberPhase } from './uplift.js';
26
+ import type { SchemeYearEnd } from './scheme-year.js';
26
27
  import type { LedgerSeed } from './seed.js';
27
28
  /** The retirement event, recorded on the year it falls in. */
28
29
  export interface AppliedDrawing {
@@ -64,7 +65,7 @@ export interface AppliedLeaverAdjustment {
64
65
  export interface LedgerYear {
65
66
  /** Scheme year END — 2026 for 2025/26. The same key the
66
67
  * revaluation table uses, so a row joins by value. */
67
- readonly schemeYearEnd: number;
68
+ readonly schemeYearEnd: SchemeYearEnd;
68
69
  readonly phase: MemberPhase;
69
70
  /** Nominal pensionable pay for this year, or null when not
70
71
  * accruing. In a partial year this is the PAY scaled by months
@@ -122,13 +123,18 @@ export interface MemberLedger {
122
123
  * or the today's-money one, and it reports in the money it
123
124
  * was built in. Pairing the two is the orchestrator's job —
124
125
  * see `pension-projection.ts` — because neither walk can see
125
- * the other. */
126
+ * the other.
127
+ *
128
+ * Before a statement's 31 March this and `accruedAt` throw
129
+ * `BeforeStatement`: the statement gives no balance there. */
126
130
  atDate(date: Date): number;
127
- /** Closing balance at the end of a scheme year. Years at or
128
- * before the seed's own year return the seed balance: the
129
- * walk starts after it, so there is no row, but there is
130
- * still an answer. */
131
- closingAt(schemeYearEnd: number): number;
131
+ /** Closing balance at the end of a scheme year. The seed's own
132
+ * year returns the seed balance: the walk starts after it, so
133
+ * there is no row, but there is still an answer. A year before
134
+ * it does the same for a walk that opens the membership, and
135
+ * for a statement's walk throws `BeforeStatement`, as every
136
+ * read before a statement does. */
137
+ closingAt(schemeYearEnd: SchemeYearEnd): number;
132
138
  /** The ACCRUED entitlement at `date`, before any retirement
133
139
  * factor. Distinct from `atDate`, which reports the pension
134
140
  * actually in force: on the row carrying the drawing those
@@ -147,7 +153,7 @@ export interface MemberLedger {
147
153
  * revalued at the in-service rate, but their accrual belongs to
148
154
  * another ledger.
149
155
  */
150
- export type PayIn = (schemeYearEnd: number) => YearPay | {
156
+ export type PayIn = (schemeYearEnd: SchemeYearEnd) => YearPay | {
151
157
  readonly pay: number;
152
158
  readonly basis: typeof LEDGER_BASES.assumed;
153
159
  } | null;
@@ -187,7 +193,7 @@ export interface LedgerRequest {
187
193
  /** The retirement event, built once for the year it falls in. */
188
194
  readonly drawingFor: () => AppliedDrawing | null;
189
195
  /** Last scheme year to walk. */
190
- readonly through: number;
196
+ readonly through: SchemeYearEnd;
191
197
  }
192
198
  /**
193
199
  * 1/54 of pensionable pay, the 2015 CARE accrual rate — NHSBSA