@casomoltd/nhs-pay 0.19.3 → 0.20.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 (93) hide show
  1. package/README.md +69 -5
  2. package/dist/afc-scales.d.ts +14 -7
  3. package/dist/afc-scales.js +28 -23
  4. package/dist/afc-scales.js.map +1 -1
  5. package/dist/bands.d.ts +2 -2
  6. package/dist/commutation.d.ts +49 -5
  7. package/dist/commutation.js +124 -43
  8. package/dist/commutation.js.map +1 -1
  9. package/dist/dates.d.ts +2 -0
  10. package/dist/dates.js +4 -0
  11. package/dist/dates.js.map +1 -1
  12. package/dist/errors.d.ts +70 -12
  13. package/dist/errors.js +85 -19
  14. package/dist/errors.js.map +1 -1
  15. package/dist/factor-basis.d.ts +87 -0
  16. package/dist/factor-basis.js +99 -0
  17. package/dist/factor-basis.js.map +1 -0
  18. package/dist/gad/erf-1-401-2023-06-30.d.ts +47 -0
  19. package/dist/gad/erf-1-401-2023-06-30.js +73 -0
  20. package/dist/gad/erf-1-401-2023-06-30.js.map +1 -0
  21. package/dist/gad/erf-1-402-2023-06-30.d.ts +48 -0
  22. package/dist/gad/erf-1-402-2023-06-30.js +84 -0
  23. package/dist/gad/erf-1-402-2023-06-30.js.map +1 -0
  24. package/dist/gad/erf-1-407-2023-06-30.d.ts +47 -0
  25. package/dist/gad/erf-1-407-2023-06-30.js +73 -0
  26. package/dist/gad/erf-1-407-2023-06-30.js.map +1 -0
  27. package/dist/gad/erf-2023-06-30.d.ts +3 -0
  28. package/dist/gad/erf-2023-06-30.js +1 -0
  29. package/dist/gad/erf-2023-06-30.js.map +1 -1
  30. package/dist/gad/factor-table.d.ts +62 -31
  31. package/dist/gad/factor-table.js +67 -34
  32. package/dist/gad/factor-table.js.map +1 -1
  33. package/dist/gad/lrf-2-416-2023-06-30.d.ts +46 -0
  34. package/dist/gad/lrf-2-416-2023-06-30.js +72 -0
  35. package/dist/gad/lrf-2-416-2023-06-30.js.map +1 -0
  36. package/dist/gad/lrf-2023-06-30.d.ts +3 -0
  37. package/dist/gad/lrf-2023-06-30.js +1 -0
  38. package/dist/gad/lrf-2023-06-30.js.map +1 -1
  39. package/dist/gad/promotional-scale-2020.d.ts +37 -0
  40. package/dist/gad/promotional-scale-2020.js +38 -0
  41. package/dist/gad/promotional-scale-2020.js.map +1 -0
  42. package/dist/index.d.ts +17 -4
  43. package/dist/index.js +22 -13
  44. package/dist/index.js.map +1 -1
  45. package/dist/iso-date.d.ts +7 -0
  46. package/dist/iso-date.js +11 -0
  47. package/dist/iso-date.js.map +1 -1
  48. package/dist/member-benefits.d.ts +237 -0
  49. package/dist/member-benefits.js +440 -0
  50. package/dist/member-benefits.js.map +1 -0
  51. package/dist/pay-path.d.ts +70 -0
  52. package/dist/pay-path.js +155 -0
  53. package/dist/pay-path.js.map +1 -0
  54. package/dist/pension/curve.d.ts +74 -0
  55. package/dist/pension/curve.js +134 -0
  56. package/dist/pension/curve.js.map +1 -0
  57. package/dist/pension/history.js +3 -3
  58. package/dist/pension/history.js.map +1 -1
  59. package/dist/pension/ledger.d.ts +71 -31
  60. package/dist/pension/ledger.js +41 -6
  61. package/dist/pension/ledger.js.map +1 -1
  62. package/dist/pension/money.d.ts +23 -6
  63. package/dist/pension/money.js +23 -1
  64. package/dist/pension/money.js.map +1 -1
  65. package/dist/pension/uplift.d.ts +23 -0
  66. package/dist/pension/uplift.js +34 -1
  67. package/dist/pension/uplift.js.map +1 -1
  68. package/dist/pension-projection.d.ts +25 -31
  69. package/dist/pension-projection.js +40 -197
  70. package/dist/pension-projection.js.map +1 -1
  71. package/dist/scale-point.d.ts +11 -1
  72. package/dist/scales.d.ts +9 -9
  73. package/dist/scales.js +68 -67
  74. package/dist/scales.js.map +1 -1
  75. package/dist/sections/final-salary.d.ts +97 -0
  76. package/dist/sections/final-salary.js +99 -0
  77. package/dist/sections/final-salary.js.map +1 -0
  78. package/dist/sections/section-1995.d.ts +20 -0
  79. package/dist/sections/section-1995.js +52 -0
  80. package/dist/sections/section-1995.js.map +1 -0
  81. package/dist/sections/section-2008.d.ts +16 -0
  82. package/dist/sections/section-2008.js +44 -0
  83. package/dist/sections/section-2008.js.map +1 -0
  84. package/dist/sections/section-2015.d.ts +43 -0
  85. package/dist/sections/section-2015.js +57 -0
  86. package/dist/sections/section-2015.js.map +1 -0
  87. package/dist/sources.d.ts +14 -0
  88. package/dist/sources.js +21 -0
  89. package/dist/sources.js.map +1 -1
  90. package/dist/values.d.ts +4 -5
  91. package/dist/values.js +4 -5
  92. package/dist/values.js.map +1 -1
  93. package/package.json +8 -5
package/README.md CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  NHS pay scales — Agenda for Change plus medical & dental —
4
4
  with pension tiers, regions, HCAS supplements, and a take-home
5
- calculator. Built on top of `@casomoltd/paye-calc`.
5
+ calculator built on top of `@casomoltd/paye-calc`. And a member's
6
+ NHS pension across the 1995, 2008 and 2015 Sections: final salary
7
+ and career average, the McCloud remedy window valued on either
8
+ basis, early and late retirement factors, and tax-free cash across
9
+ the whole drawing.
6
10
 
7
11
  See [`docs/pay-frameworks.md`](docs/pay-frameworks.md) for the domain
8
12
  model — the pay frameworks (AfC, medical, dental, VSM), the shared
@@ -129,7 +133,64 @@ consultant scale is 20 payroll steps over 5 threshold labels, so
129
133
  dental grades. Both fail loud (`ScaleUnavailable`) for an
130
134
  unpublished nation/year or grade rather than defaulting.
131
135
 
132
- ### Project a 2015-scheme pension
136
+ ### Value a member's pension across sections
137
+
138
+ ```ts
139
+ import {SECTIONS, isoDate, memberBenefits} from '@casomoltd/nhs-pay';
140
+
141
+ // Built once from the member; `today` pins the date the figures
142
+ // are as at, so they reproduce.
143
+ const benefits = memberBenefits(
144
+ {
145
+ dateOfBirth: isoDate('1979-01-01'),
146
+ service: [
147
+ {section: SECTIONS.s1995, joined: isoDate('2004-04-01'),
148
+ left: isoDate('2022-03-31')},
149
+ {section: SECTIONS.s2015, joined: isoDate('2022-04-01'),
150
+ left: null},
151
+ ],
152
+ pay: {
153
+ declared: [],
154
+ current: {todaysMoney: 51932, asAt: isoDate('2026-09-01')},
155
+ ladder: null, // or the member's AfC band points and current point
156
+ },
157
+ statement: null, // or a 2015 Section balance off a statement
158
+ },
159
+ {assumedCpi: 0.02},
160
+ new Date(2026, 8, 23),
161
+ );
162
+
163
+ benefits.remedy; // true: in service by 31 March 2012 and after 2015
164
+ benefits.now(); // held today, the remedy window on the legacy basis
165
+
166
+ // Asked once per option. Every section is drawn on one date.
167
+ for (const kind of ['legacy-basis', 'section-2015-basis'] as const) {
168
+ const position = benefits.at({
169
+ leaving: isoDate('2039-09-30'),
170
+ drawing: isoDate('2039-09-30'),
171
+ remedy: {kind},
172
+ cash: {kind: 'maximum'},
173
+ });
174
+ position.awards; // one per section and basis, each factored
175
+ position.crystallised; // the pension and automatic lump sum, summed
176
+ position.cash; // the cash taken across the whole
177
+ }
178
+ ```
179
+
180
+ Each section keeps its own rules — denominator, pay measure,
181
+ pension age, lump sum, factors — so no caller can combine them
182
+ into one the scheme lacks. Pay comes from the member's pay path
183
+ (`promotionalIndex` is GAD's curve behind it). Service the library
184
+ does not model, such as a break, is refused with
185
+ `BenefitNotModelled` and a `code` to branch on; `NOT_MODELLED`
186
+ links each code to the issue tracking it. See
187
+ [*A member's benefits across sections*](docs/how-it-works.md#a-members-benefits-across-sections).
188
+
189
+ ### Project a 2015 Section pension on flat pay
190
+
191
+ **Deprecated.** `projectPension` is kept for this flat-pay question
192
+ until [#21](https://github.com/casomoltd/nhs-pay/issues/21); for a
193
+ member across sections, use `memberBenefits` above.
133
194
 
134
195
  ```ts
135
196
  import {
@@ -237,13 +298,16 @@ Table A25 (AfC 2025/26 data for England, NI, Wales).
237
298
  [scales-2627]: https://www.nhsemployers.org/articles/pay-scales-202627
238
299
  [nhsprb-39]: https://assets.publishing.service.gov.uk/media/698df41175466636847f6a93/NHSPRB_39th_Report_2026.pdf
239
300
 
240
- ### 2015 CARE pension projection
301
+ ### NHS pension
241
302
 
242
303
  | Data | Source |
243
304
  | ---- | ------ |
244
305
  | September CPI + in-service rate | [HM Treasury Revaluation Orders][sis], one SI per year |
245
- | Accrual rate, NPA | NHSBSA 2015 Members' Guide (V13) |
246
- | ERF / LRF factors | GAD NHS EW consolidated factor workbook |
306
+ | 2015 Section accrual rate, NPA | NHSBSA 2015 Members' Guide (V13) |
307
+ | 1995 and 2008 Sections' denominators, pay measures, lump sum | SI 1995/300 and SI 2008/653, as [`how-it-works.md`](docs/how-it-works.md) cites them |
308
+ | McCloud remedy eligibility and window | Public Service Pensions and Judicial Offices Act 2022 ss.1–2; rollback by SI 2023/985 |
309
+ | ERF / LRF factors: 0-420, 0-421, 1-401, 1-402, 1-407, 2-416 | GAD NHS EW consolidated factor workbook |
310
+ | Promotional pay index | GAD, summary of the 2020 valuation assumptions, page 3 |
247
311
  | Commutation rate (£12 : £1) | NHSBSA Key Notes — 2015 Scheme Estimates (V2) |
248
312
  | Permitted maximum (lowest of three limbs) | [Sch 29 Finance Act 2004 para 2][sch29] |
249
313
  | Applicable amount, defined benefits, `(A + (B × C)) / 4` | [Sch 29 Finance Act 2004 para 2C][sch29p2c] |
@@ -4,7 +4,7 @@
4
4
  * The counterpart to `medical-scales.ts` for Agenda for Change. The
5
5
  * verbatim transcriptions in `src/circulars/*` hold each publisher's
6
6
  * own table shape; this module maps them to the uniform
7
- * `Record<AfcBandId, ScalePoint[]>` the rest of the library speaks.
7
+ * `Record<AfcBandId, SteppedPoint[]>` the rest of the library speaks.
8
8
  *
9
9
  * **England is a deliberate exception and stays in `scales.ts`.** It
10
10
  * publishes no AfC circular — its scales are an NHS Employers web page
@@ -33,7 +33,7 @@
33
33
  import type { Nation, PayYear } from '@casomoltd/paye-calc';
34
34
  import type { DocumentSource } from './document-source.js';
35
35
  import type { AfcBandId } from './afc-band.js';
36
- import type { ScalePoint } from './scale-point.js';
36
+ import type { SteppedPoint } from './scale-point.js';
37
37
  /** Band 1 as a nation publishes it, for the one nation still paying it
38
38
  * to new entrants. */
39
39
  export interface AfcBand1 {
@@ -63,9 +63,16 @@ export interface AfcBand1Published extends AfcBand1 {
63
63
  * added to it.
64
64
  */
65
65
  export declare function afcBand1(year: PayYear, nation: Nation): AfcBand1Published | undefined;
66
- export declare const WALES_SCALES_2025_26: Record<AfcBandId, ScalePoint[]>;
67
- export declare const WALES_SCALES_2026_27: Record<AfcBandId, ScalePoint[]>;
68
- export declare const NI_SCALES_2025_26: Record<AfcBandId, ScalePoint[]>;
66
+ /**
67
+ * An Agenda for Change point from the year of service it is first
68
+ * reached in: the label every nation's scale prints, and the same year
69
+ * as a number, so a reader that needs the timing never has to parse it
70
+ * back out of the label. The one producer of both, for all four nations.
71
+ */
72
+ export declare function afcPoint(year: number, isTop: boolean, salary: number): SteppedPoint;
73
+ export declare const WALES_SCALES_2025_26: Record<AfcBandId, SteppedPoint[]>;
74
+ export declare const WALES_SCALES_2026_27: Record<AfcBandId, SteppedPoint[]>;
75
+ export declare const NI_SCALES_2025_26: Record<AfcBandId, SteppedPoint[]>;
69
76
  /**
70
77
  * Scotland 2026-27, from Annex C.
71
78
  *
@@ -74,7 +81,7 @@ export declare const NI_SCALES_2025_26: Record<AfcBandId, ScalePoint[]>;
74
81
  * number, which cannot produce a label — `scotlandAnnexB` below exists
75
82
  * so a fixture can check the two annexes agree.
76
83
  */
77
- export declare const SCOTLAND_SCALES_2026_27: Record<AfcBandId, ScalePoint[]>;
84
+ export declare const SCOTLAND_SCALES_2026_27: Record<AfcBandId, SteppedPoint[]>;
78
85
  /**
79
86
  * Annex B's salaries for a year, keyed by band, in printed order.
80
87
  *
@@ -95,4 +102,4 @@ export declare function scotlandAnnexB(year: '2025-26' | '2026-27'): Map<AfcBand
95
102
  * publishes twice is faithful; re-typing the same increments would
96
103
  * only add a second place to mistype them.
97
104
  */
98
- export declare const SCOTLAND_SCALES_2025_26: Record<AfcBandId, ScalePoint[]>;
105
+ export declare const SCOTLAND_SCALES_2025_26: Record<AfcBandId, SteppedPoint[]>;
@@ -4,7 +4,7 @@
4
4
  * The counterpart to `medical-scales.ts` for Agenda for Change. The
5
5
  * verbatim transcriptions in `src/circulars/*` hold each publisher's
6
6
  * own table shape; this module maps them to the uniform
7
- * `Record<AfcBandId, ScalePoint[]>` the rest of the library speaks.
7
+ * `Record<AfcBandId, SteppedPoint[]>` the rest of the library speaks.
8
8
  *
9
9
  * **England is a deliberate exception and stays in `scales.ts`.** It
10
10
  * publishes no AfC circular — its scales are an NHS Employers web page
@@ -71,10 +71,15 @@ const UNMODELLED_BANDS = ['band 1'];
71
71
  * document it claims to quote.
72
72
  */
73
73
  const BAND_1 = {
74
- // England's AfC circulars are not transcribed here — its scales come
75
- // from the NHS Employers tables, which print bands 2 upward. So this
76
- // is the one genuine empty: nothing to reach, rather than a band that
77
- // does not exist.
74
+ // Empty because there is no transcription to read it OFF, not because
75
+ // the publisher withholds it. NHS Employers prints Band 1 like every
76
+ // other nation — £25,272 for 2026/27, footnoted "Band 1 closed to new
77
+ // entrants", on both the pay-scales poster and the web table. But
78
+ // England issues no AfC circular, so it has no file under
79
+ // `circulars/` and `band1Of` has nothing to read; authoring the
80
+ // figure here instead would be the first hand-typed scale value in
81
+ // this record, against the rule stated above it. Reaching England's
82
+ // Band 1 means deciding that separately.
78
83
  [NATION_KEYS.england]: [],
79
84
  [NATION_KEYS.wales]: [
80
85
  band1Of(WALES_AFC_W_02_2025.flatBands, payYear(TAX_YEARS.Y2025_26), AFC_W_02_2025, 'AfC(W) 02/2025'),
@@ -147,9 +152,18 @@ function bandIdOf(printed) {
147
152
  invariant(id !== undefined, `afc-scales: no band id for the printed band "${printed}"`);
148
153
  return id;
149
154
  }
150
- /** A point's label from the year of service it is first reached in. */
151
- function yearLabelAt(year, isTop) {
152
- return isTop ? `Year ${year}+` : `Year ${year}`;
155
+ /**
156
+ * An Agenda for Change point from the year of service it is first
157
+ * reached in: the label every nation's scale prints, and the same year
158
+ * as a number, so a reader that needs the timing never has to parse it
159
+ * back out of the label. The one producer of both, for all four nations.
160
+ */
161
+ export function afcPoint(year, isTop, salary) {
162
+ return {
163
+ label: isTop ? `Year ${year}+` : `Year ${year}`,
164
+ salary,
165
+ yearsExperience: year - 1,
166
+ };
153
167
  }
154
168
  /**
155
169
  * A stepped row → its points.
@@ -160,16 +174,10 @@ function yearLabelAt(year, isTop) {
160
174
  function pointsFromStepped(row) {
161
175
  const points = [];
162
176
  let year = 1;
163
- points.push({
164
- label: yearLabelAt(year, false),
165
- salary: row.entry,
166
- });
177
+ points.push(afcPoint(year, false, row.entry));
167
178
  if (row.intermediate !== undefined) {
168
179
  year += row.yearsToNext;
169
- points.push({
170
- label: yearLabelAt(year, false),
171
- salary: row.intermediate,
172
- });
180
+ points.push(afcPoint(year, false, row.intermediate));
173
181
  invariant(row.yearsToTop !== undefined, `afc-scales: ${row.band} prints an intermediate step with no `
174
182
  + 'interval to the top');
175
183
  year += row.yearsToTop;
@@ -177,14 +185,14 @@ function pointsFromStepped(row) {
177
185
  else {
178
186
  year += row.yearsToNext;
179
187
  }
180
- points.push({ label: yearLabelAt(year, true), salary: row.top });
188
+ points.push(afcPoint(year, true, row.top));
181
189
  return points;
182
190
  }
183
191
  /** A flat row → its single point. */
184
192
  function pointsFromFlat(row) {
185
193
  // Year 1 without a `+`: the circular prints one figure and no
186
194
  // progression, so there is no service beyond the point to signal.
187
- return [{ label: 'Year 1', salary: row.salary }];
195
+ return [afcPoint(1, false, row.salary)];
188
196
  }
189
197
  /**
190
198
  * Scotland's Annex C → points.
@@ -202,10 +210,7 @@ function pointsFromJourney(rows) {
202
210
  }
203
211
  }
204
212
  invariant(runs.length > 0, 'afc-scales: a pay journey with no increments');
205
- return runs.map((run, i) => ({
206
- label: yearLabelAt(run.year, i === runs.length - 1),
207
- salary: run.salary,
208
- }));
213
+ return runs.map((run, i) => afcPoint(run.year, i === runs.length - 1, run.salary));
209
214
  }
210
215
  /** Every band a circular prints, keyed by id. */
211
216
  function scalesFrom(flat, stepped) {
@@ -310,7 +315,7 @@ export const SCOTLAND_SCALES_2025_26 = (() => {
310
315
  && yearSalaries.length === points.length, `afc-scales: Scotland ${band} has ${points.length} points in `
311
316
  + `Annex C but ${yearSalaries?.length ?? 0} in Annex B 2025-26`);
312
317
  out[band] = points.map((point, i) => ({
313
- label: point.label,
318
+ ...point,
314
319
  salary: yearSalaries[i],
315
320
  }));
316
321
  }
@@ -1 +1 @@
1
- {"version":3,"file":"afc-scales.js","sourceRoot":"","sources":["../src/afc-scales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+BG;AAGH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAE,OAAO,EAAC,MAAM,sBAAsB,CAAC;AAErE,OAAO,EACL,WAAW,EACX,YAAY,EACZ,aAAa,EACb,aAAa,GACd,MAAM,cAAc,CAAC;AAEtB,OAAO,EAAC,SAAS,EAAC,MAAM,eAAe,CAAC;AAExC,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAMtC,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAC,mBAAmB,EAAC,MAAM,oCAAoC,CAAC;AACvE,OAAO,EAAC,kBAAkB,EAAC,MAAM,mCAAmC,CAAC;AACrE,OAAO,EACL,wBAAwB,GACzB,MAAM,yCAAyC,CAAC;AAEjD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,gBAAgB,GAAsB,CAAC,QAAQ,CAAC,CAAC;AAuBvD;;;;;;;;;;;GAWG;AACH,MAAM,MAAM,GAAwC;IAClD,qEAAqE;IACrE,qEAAqE;IACrE,sEAAsE;IACtE,kBAAkB;IAClB,CAAC,WAAW,CAAC,OAAO,CAAC,EAAE,EAAE;IACzB,CAAC,WAAW,CAAC,KAAK,CAAC,EAAE;QACnB,OAAO,CAAC,mBAAmB,CAAC,SAAS,EAAE,OAAO,CAAC,SAAS,CAAC,QAAQ,CAAC,EAChE,aAAa,EAAE,gBAAgB,CAAC;QAClC,OAAO,CAAC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;GAUG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,GAEtC,EAAE;IACF,MAAM,QAAQ,GAAG,cAAc,CAAC,SAAS,CAAC,CAAC;IAC3C,MAAM,GAAG,GAA+C,EAAE,CAAC;IAC3D,KAAK,MAAM,CAAC,IAAI,EAAE,MAAM,CAAC,IAAI,MAAM,CAAC,OAAO,CACzC,uBAAuB,CACS,EAAE,CAAC;QACnC,MAAM,YAAY,GAAG,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;QACxC,SAAS,CACP,YAAY,KAAK,SAAS;eACvB,YAAY,CAAC,MAAM,KAAK,MAAM,CAAC,MAAM,EACxC,wBAAwB,IAAI,QAAQ,MAAM,CAAC,MAAM,aAAa;cAC5D,eAAe,YAAY,EAAE,MAAM,IAAI,CAAC,qBAAqB,CAChE,CAAC;QACF,GAAG,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;YACpC,GAAG,KAAK;YACR,MAAM,EAAE,YAAY,CAAC,CAAC,CAAE;SACzB,CAAC,CAAC,CAAC;IACN,CAAC;IACD,OAAO,eAAe,CAAC,GAAG,CAAC,CAAC;AAC9B,CAAC,CAAC,EAAE,CAAC"}
package/dist/bands.d.ts CHANGED
@@ -9,12 +9,12 @@
9
9
  */
10
10
  import type { PayYear, Nation } from '@casomoltd/paye-calc';
11
11
  import type { AfcBandId, HcasZones } from './scales.js';
12
- import type { ScalePoint } from './scale-point.js';
12
+ import type { SteppedPoint } from './scale-point.js';
13
13
  import type { DocumentSource } from './document-source.js';
14
14
  import type { SalaryRange } from './values.js';
15
15
  export interface AfcBandMeta {
16
16
  band: AfcBandId;
17
- points: ScalePoint[];
17
+ points: SteppedPoint[];
18
18
  salary: SalaryRange;
19
19
  /** The document that publishes these figures for this nation and
20
20
  * year — the same value across a nation's bands, because one
@@ -5,11 +5,12 @@
5
5
  * Separate from the projection because it IS separate: nothing
6
6
  * in `pension-projection.ts` calls into here and the ledger
7
7
  * applies no commutation. It is a choice taken AT retirement, on
8
- * a pension the projection has already finished producing. It
9
- * borrows one thing, by type only: the `Prices` the projection
10
- * ran with, so the allowance is carried forward at the SAME
11
- * assumption the pension was projected at and cannot silently
12
- * use another.
8
+ * a pension already produced. It borrows two types from the
9
+ * pension layer: `ProjectionMoney`, the pair every figure travels
10
+ * as, and the `Prices` the projection ran with, so the allowance
11
+ * is carried forward at the SAME assumption the pension was
12
+ * projected at and cannot silently use another. `memberBenefits`
13
+ * calls {@link cashAt} across every section's crystallised total.
13
14
  *
14
15
  * ── Only one figure here is an NHS rule ─────────────
15
16
  *
@@ -329,3 +330,46 @@ export interface CommutationResult {
329
330
  * the pension at retirement after any factor.
330
331
  */
331
332
  export declare function commute(pension: ProjectionMoney, fraction: number, limits: CommutationLimits): CommutationResult;
333
+ /**
334
+ * What a member takes as cash when every section is drawn together:
335
+ * one total, because the scheme's rate is £12 for each £1 of pension
336
+ * in every section and the limit is a quarter of the capital value of
337
+ * everything crystallised. So nothing about the answer depends on
338
+ * which section the cash comes from, and no source is modelled.
339
+ *
340
+ * - `automatic-only`: the 1995 Section's automatic lump sum and
341
+ * nothing more — nil where the member holds none.
342
+ * - `maximum`: up to the permitted maximum, which counts the
343
+ * automatic lump sum, and never less than it.
344
+ * - `amount`: a stated total, the automatic lump sum included, in
345
+ * today's money — the field says which ruler, because a bare amount
346
+ * could be either.
347
+ */
348
+ export declare const CASH_CHOICES: {
349
+ readonly automaticOnly: "automatic-only";
350
+ readonly maximum: "maximum";
351
+ readonly amount: "amount";
352
+ };
353
+ export type CashChoice = {
354
+ readonly kind: typeof CASH_CHOICES.automaticOnly;
355
+ } | {
356
+ readonly kind: typeof CASH_CHOICES.maximum;
357
+ } | {
358
+ readonly kind: typeof CASH_CHOICES.amount;
359
+ readonly todaysMoney: number;
360
+ };
361
+ /**
362
+ * The cash at a drawing over the crystallised total. `lumpSum` in the
363
+ * result is ALL the cash, the automatic lump sum included, and
364
+ * `pensionGivenUp` is only what the cash above it cost.
365
+ *
366
+ * On `maximum` the automatic lump sum is paid even where the Lump Sum
367
+ * Allowance is below it, so `lumpSum` can exceed `limit.amount` there:
368
+ * the excess is taxed rather than refused, and `limit` still says what
369
+ * was tax-free.
370
+ *
371
+ * Throws RangeError for a stated amount below the automatic lump sum,
372
+ * which is paid whether or not it is asked for, or above the permitted
373
+ * maximum, which the scheme does not pay.
374
+ */
375
+ export declare function cashAt(pension: ProjectionMoney, automatic: ProjectionMoney, choice: CashChoice, limits: CommutationLimits): CommutationResult;
@@ -5,11 +5,12 @@
5
5
  * Separate from the projection because it IS separate: nothing
6
6
  * in `pension-projection.ts` calls into here and the ledger
7
7
  * applies no commutation. It is a choice taken AT retirement, on
8
- * a pension the projection has already finished producing. It
9
- * borrows one thing, by type only: the `Prices` the projection
10
- * ran with, so the allowance is carried forward at the SAME
11
- * assumption the pension was projected at and cannot silently
12
- * use another.
8
+ * a pension already produced. It borrows two types from the
9
+ * pension layer: `ProjectionMoney`, the pair every figure travels
10
+ * as, and the `Prices` the projection ran with, so the allowance
11
+ * is carried forward at the SAME assumption the pension was
12
+ * projected at and cannot silently use another. `memberBenefits`
13
+ * calls {@link cashAt} across every section's crystallised total.
13
14
  *
14
15
  * ── Only one figure here is an NHS rule ─────────────
15
16
  *
@@ -23,6 +24,7 @@
23
24
  * scheme-neutral home without a redesign.
24
25
  */
25
26
  import { invariant } from './errors.js';
27
+ import { divideMoney, minusMoney, moneyAt } from './pension/money.js';
26
28
  // ── The scheme's own rule ───────────────────────────
27
29
  /**
28
30
  * Commutation: £12 lump sum per £1 of annual pension given up.
@@ -207,8 +209,15 @@ export function nhsCommutationLimits(prices) {
207
209
  *
208
210
  * L = c × (v × (P − L/f) + L)
209
211
  *
210
- * for L gives the expression below. Written from the named
211
- * constants rather than from its rearrangement — the familiar
212
+ * for L gives the expression below. With an automatic lump sum A
213
+ * already paid, only the cash above it gives up pension:
214
+ *
215
+ * L = c × (v × (P − (L − A)/f) + L)
216
+ *
217
+ * which is the same solution with `P + A/f` in place of `P` — on
218
+ * today's constants `(60P + 5A)/14`, and `30P/7` where A is nothing.
219
+ *
220
+ * Written from the named constants rather than from its rearrangement — the familiar
212
221
  * `(20P) / (3 + 20/f)` is this same solution with `c = 0.25`
213
222
  * already substituted in, which hides the one number a reader
214
223
  * would want to check.
@@ -217,19 +226,20 @@ export function nhsCommutationLimits(prices) {
217
226
  * both money arguments must already be in that ruler. Exporting
218
227
  * it would put a pair of bare, ruler-less numbers on the public
219
228
  * API — the very thing {@link DatedAmount} exists to prevent.
220
- * Consumers get both rulers' limits from {@link commute}.
229
+ * Callers get both rulers' limits from {@link commute}, and from
230
+ * {@link cashAt} through a `Position`, via {@link limitsIn}.
221
231
  */
222
- function lumpSumLimit({ pension, allowance, commutationFactor }) {
232
+ function lumpSumLimit({ pension, automatic, allowance, commutationFactor }) {
223
233
  if (commutationFactor <= 0) {
224
234
  throw new RangeError(`Commutation factor must be positive, got `
225
235
  + `${commutationFactor}`);
226
236
  }
227
- if (pension < 0 || allowance < 0) {
228
- throw new RangeError(`Pension and allowance must be non-negative, got `
229
- + `${pension} and ${allowance}`);
237
+ if (pension < 0 || allowance < 0 || automatic < 0) {
238
+ throw new RangeError(`Pension, automatic lump sum and allowance must be `
239
+ + `non-negative, got ${pension}, ${automatic} and ${allowance}`);
230
240
  }
231
241
  const cap = HMRC_LUMP_SUM_CAP_PCT / 100;
232
- const schemeMax = (VALUATION_FACTOR * cap * pension)
242
+ const schemeMax = (VALUATION_FACTOR * cap * (pension + automatic / commutationFactor))
233
243
  / (1 - cap + (VALUATION_FACTOR * cap) / commutationFactor);
234
244
  // One comparison decides both the figure and the reason, so
235
245
  // the two cannot drift into disagreeing.
@@ -246,7 +256,8 @@ function lumpSumLimit({ pension, allowance, commutationFactor }) {
246
256
  The tolerance is not slack: at the scheme limb the two sides
247
257
  are EQUAL, and float leaves them differing by up to ~6e-11
248
258
  in either direction across the realistic range. */
249
- const capitalValue = VALUATION_FACTOR * (pension - amount / commutationFactor)
259
+ const capitalValue = VALUATION_FACTOR
260
+ * (pension - (amount - automatic) / commutationFactor)
250
261
  + amount;
251
262
  invariant(amount - cap * capitalValue <= Math.abs(capitalValue) * 1e-9, `Lump sum ${amount} exceeds ${HMRC_LUMP_SUM_CAP_PCT}% of `
252
263
  + `capital value ${capitalValue} — the fixed point is wrong`);
@@ -283,42 +294,112 @@ export function commute(pension, fraction, limits) {
283
294
  // see the note at the top of errors.ts.
284
295
  throw new RangeError(`Commutation fraction must be 0–1, got ${fraction}`);
285
296
  }
286
- const { allowance, prices, commutationFactor } = limits;
287
- // The allowance is a real-terms constant: the today's-money
288
- // run tests its stated value, the cash run tests the same cap
289
- // carried to the pension's own date.
290
- const today = lumpSumLimit({
291
- pension: pension.real,
292
- // Into the ruler the today's-money reading is anchored in —
293
- // the run date. Usually the identity, because that is where
294
- // a caller states the allowance; not assumed to be.
295
- allowance: prices.valueAt(allowance.amount, allowance.asAt, prices.asOf),
296
- commutationFactor,
297
- });
298
- const cash = lumpSumLimit({
299
- pension: pension.nominal,
300
- allowance: prices.valueAt(allowance.amount, allowance.asAt, pension.asAt),
301
- commutationFactor,
302
- });
303
- /* Takes the object, not two same-typed positional numbers: a
304
- transposition would swap the rulers silently. */
305
- const pair = (m) => ({ ...m, asAt: pension.asAt });
306
- const lumpSum = pair({
297
+ const { commutationFactor } = limits;
298
+ const nothing = moneyAt({ nominal: 0, real: 0 }, pension.asAt);
299
+ const { today, cash } = limitsIn(pension, nothing, limits);
300
+ const lumpSum = moneyAt({
307
301
  real: today.amount * fraction,
308
302
  nominal: cash.amount * fraction,
309
- });
310
- const pensionGivenUp = pair({
311
- real: lumpSum.real / commutationFactor,
312
- nominal: lumpSum.nominal / commutationFactor,
313
- });
303
+ }, pension.asAt);
304
+ const pensionGivenUp = divideMoney(lumpSum, commutationFactor);
314
305
  return {
315
306
  lumpSum,
316
307
  pensionGivenUp,
317
- residualPension: pair({
318
- real: pension.real - pensionGivenUp.real,
319
- nominal: pension.nominal - pensionGivenUp.nominal,
308
+ residualPension: minusMoney(pension, pensionGivenUp),
309
+ limit: { real: today, nominal: cash },
310
+ };
311
+ }
312
+ // ── Cash across a whole drawing ────────────────────────
313
+ /**
314
+ * What a member takes as cash when every section is drawn together:
315
+ * one total, because the scheme's rate is £12 for each £1 of pension
316
+ * in every section and the limit is a quarter of the capital value of
317
+ * everything crystallised. So nothing about the answer depends on
318
+ * which section the cash comes from, and no source is modelled.
319
+ *
320
+ * - `automatic-only`: the 1995 Section's automatic lump sum and
321
+ * nothing more — nil where the member holds none.
322
+ * - `maximum`: up to the permitted maximum, which counts the
323
+ * automatic lump sum, and never less than it.
324
+ * - `amount`: a stated total, the automatic lump sum included, in
325
+ * today's money — the field says which ruler, because a bare amount
326
+ * could be either.
327
+ */
328
+ export const CASH_CHOICES = {
329
+ automaticOnly: 'automatic-only',
330
+ maximum: 'maximum',
331
+ amount: 'amount',
332
+ };
333
+ /**
334
+ * The permitted maximum in both rulers, with an automatic lump sum
335
+ * counted in. The allowance is a real-terms constant: the today's-money
336
+ * reading tests it at the run date, where a caller usually states it,
337
+ * and the cash reading tests the same cap carried to the pension's own
338
+ * date.
339
+ */
340
+ function limitsIn(pension, automatic, { allowance, prices, commutationFactor }) {
341
+ return {
342
+ today: lumpSumLimit({
343
+ pension: pension.real,
344
+ automatic: automatic.real,
345
+ allowance: prices.valueAt(allowance.amount, allowance.asAt, prices.asOf),
346
+ commutationFactor,
347
+ }),
348
+ cash: lumpSumLimit({
349
+ pension: pension.nominal,
350
+ automatic: automatic.nominal,
351
+ allowance: prices.valueAt(allowance.amount, allowance.asAt, pension.asAt),
352
+ commutationFactor,
320
353
  }),
354
+ };
355
+ }
356
+ /**
357
+ * The cash at a drawing over the crystallised total. `lumpSum` in the
358
+ * result is ALL the cash, the automatic lump sum included, and
359
+ * `pensionGivenUp` is only what the cash above it cost.
360
+ *
361
+ * On `maximum` the automatic lump sum is paid even where the Lump Sum
362
+ * Allowance is below it, so `lumpSum` can exceed `limit.amount` there:
363
+ * the excess is taxed rather than refused, and `limit` still says what
364
+ * was tax-free.
365
+ *
366
+ * Throws RangeError for a stated amount below the automatic lump sum,
367
+ * which is paid whether or not it is asked for, or above the permitted
368
+ * maximum, which the scheme does not pay.
369
+ */
370
+ export function cashAt(pension, automatic, choice, limits) {
371
+ const { commutationFactor } = limits;
372
+ const { today, cash } = limitsIn(pension, automatic, limits);
373
+ const taken = cashTaken(choice, automatic, { today, cash }, limits);
374
+ const lumpSum = moneyAt(taken, pension.asAt);
375
+ const pensionGivenUp = divideMoney(minusMoney(lumpSum, automatic), commutationFactor);
376
+ return {
377
+ lumpSum,
378
+ pensionGivenUp,
379
+ residualPension: minusMoney(pension, pensionGivenUp),
321
380
  limit: { real: today, nominal: cash },
322
381
  };
323
382
  }
383
+ /** The total cash a choice takes, in both rulers. */
384
+ function cashTaken(choice, automatic, limit, { prices }) {
385
+ if (choice.kind === CASH_CHOICES.automaticOnly) {
386
+ return { nominal: automatic.nominal, real: automatic.real };
387
+ }
388
+ if (choice.kind === CASH_CHOICES.maximum) {
389
+ return {
390
+ nominal: Math.max(automatic.nominal, limit.cash.amount),
391
+ real: Math.max(automatic.real, limit.today.amount),
392
+ };
393
+ }
394
+ const value = choice.todaysMoney;
395
+ if (value < automatic.real || value > limit.today.amount) {
396
+ throw new RangeError(`Cash of ${value} is outside what can be taken: from the `
397
+ + `automatic ${automatic.real} to the maximum `
398
+ + `${limit.today.amount}`);
399
+ }
400
+ return {
401
+ nominal: prices.valueAt(value, prices.asOf, automatic.asAt),
402
+ real: value,
403
+ };
404
+ }
324
405
  //# sourceMappingURL=commutation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"commutation.js","sourceRoot":"","sources":["../src/commutation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAItC,uDAAuD;AAE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AAK,CAAC,KAAK,CAAC,MAAM,EAAE,CAC1B,CAAC;IACJ,CAAC;IACD,OAAO;QACL,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,SAAS,CAAC,IAAI,CAAC;QAC3D,IAAI,EAAE,KAAK;KACZ,CAAC;AACJ,CAAC"}
package/dist/dates.d.ts CHANGED
@@ -47,3 +47,5 @@ export declare function yearsBetween(from: Date, to: Date): number;
47
47
  * would move NPA a day earlier to 28 Feb.
48
48
  */
49
49
  export declare function npaDate(dateOfBirth: Date, npa: number): Date;
50
+ /** The earliest of some dates. */
51
+ export declare function earliest(...dates: readonly Date[]): Date;
package/dist/dates.js CHANGED
@@ -83,4 +83,8 @@ export function yearsBetween(from, to) {
83
83
  export function npaDate(dateOfBirth, npa) {
84
84
  return new Date(dateOfBirth.getFullYear() + npa, dateOfBirth.getMonth(), dateOfBirth.getDate());
85
85
  }
86
+ /** The earliest of some dates. */
87
+ export function earliest(...dates) {
88
+ return new Date(Math.min(...dates.map((d) => d.getTime())));
89
+ }
86
90
  //# sourceMappingURL=dates.js.map