@casomoltd/nhs-pay 0.19.4 → 0.21.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 (90) hide show
  1. package/README.md +95 -18
  2. package/dist/afc-scales.d.ts +14 -7
  3. package/dist/afc-scales.js +19 -19
  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 +54 -52
  69. package/dist/pension-projection.js +65 -219
  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/values.d.ts +4 -5
  88. package/dist/values.js +4 -5
  89. package/dist/values.js.map +1 -1
  90. package/package.json +9 -5
@@ -7,10 +7,10 @@
7
7
  *
8
8
  * Sources:
9
9
  *
10
- * GAD Consolidated Factor Spreadsheet (NHS EW Consolidated
11
- * Factors 2023-03), issued 30 June 2023
12
- * → ERF1/LRF1 values (see src/gad/ issue files for the
13
- * verbatim transcriptions + per-table provenance)
10
+ * GAD consolidated factor workbook
11
+ * → ERF1/LRF1 values: src/gad/ holds the verbatim
12
+ * transcriptions, and each carries its own issue, version
13
+ * and provenance
14
14
  *
15
15
  * GAD "NHSPS 2015 E&W — Early and late retirement in normal
16
16
  * health — Factors and guidance", 7 August 2019 — methodology
@@ -83,10 +83,6 @@
83
83
  * that uplift produced. `pension/ledger.ts` holds one row per
84
84
  * scheme year; this module is the orchestrator over it.
85
85
  *
86
- * NHSBSA Key Notes — 2015 Scheme Estimates (V2), March 2025
87
- * → Commutation rate: £12 lump sum per £1 pension
88
- * → HMRC 25% cap on lump sum
89
- *
90
86
  * ── One rate after the seed ─────────────────────────
91
87
  *
92
88
  * A projection reads no published Revaluation Order. Every
@@ -151,33 +147,32 @@
151
147
  * back-computing CPI as rate − 1.5 would make the test of the
152
148
  * +1.5 rule agree with itself.
153
149
  *
154
- * This module used to compound instead, at a flat real 1.5%:
155
- * the multiplicative reading of the same rule, running about
156
- * 0.6% high over a full career at 2% CPI. That is now fixed,
157
- * at the cost described above.
150
+ * Compounding at a flat real 1.5% instead is the multiplicative
151
+ * reading of the same rule, and runs about 0.6% high over a full
152
+ * career at 2% CPI.
158
153
  */
159
- import { npaDate, periodInYearsMonths, yearsBetween, } from './dates.js';
154
+ import { earliest, npaDate, periodInYearsMonths, } from './dates.js';
160
155
  import { createPrices } from './pension/prices.js';
161
- import { ACCRUAL_RATE, buildLedger } from './pension/ledger.js';
156
+ import { ACCRUAL_RATE, atDrawing, buildLedger, flatPay, } from './pension/ledger.js';
162
157
  import { estimateHistory } from './pension/history.js';
163
- import { openingUpliftFor, phaseAt } from './pension/uplift.js';
164
- import { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
165
- import { FactorTable } from './gad/factor-table.js';
166
- import { ERF_0_420 } from './gad/erf-2023-06-30.js';
167
- import { LRF_0_421 } from './gad/lrf-2023-06-30.js';
158
+ import { seedFromBalanceAt } from './pension/uplift.js';
159
+ import { buildCurve, walkThrough } from './pension/curve.js';
160
+ import { schemeYearEndDate, schemeYearEndFor, seedFromJoinDate, } from './pension/seed.js';
161
+ import { factorTable } from './factor-basis.js';
168
162
  // ── Constants ───────────────────────────────────────
169
163
  /* The accrual rate is owned by the ledger that applies it and
170
164
  re-exported here, so the record and every figure read off it
171
165
  cannot hold two different 1/54s. */
172
166
  export { ACCRUAL_RATE };
173
167
  // ── Factor Tables ───────────────────────────────────
174
- // Which issue is in force is exactly these two constructions —
175
- // swap the import when GAD supersedes a table (the two tables
176
- // change on different dates, hence one issue file per table).
177
- const ERF1 = new FactorTable(ERF_0_420);
178
- const LRF1 = new FactorTable(LRF_0_421);
168
+ // The 2015 Section's two tables, read through the one set every
169
+ // factor in the library comes from, so this and `memberBenefits`
170
+ // cannot round the same drawing two ways.
171
+ const ERF1 = factorTable('0-420');
172
+ const LRF1 = factorTable('0-421');
179
173
  /**
180
- * Provenance of the in-force table behind a factor kind — the
174
+ * Provenance of the 2015 Section's in-force table behind a factor
175
+ * kind — the
181
176
  * citation facts (table ref, guidance name, issue date, source
182
177
  * PDF) consumers render instead of hand-typing them, so a page
183
178
  * showing "GAD factors issued 30 June 2023" updates itself when
@@ -198,6 +193,13 @@ export function factorProvenance(kind) {
198
193
  * at NPA is not an early retirement with a factor of 1: naming
199
194
  * a table there hands a consumer an ERF citation to render at a
200
195
  * member who took no reduction.
196
+ *
197
+ * A second route to the factor `factor2015` reads through
198
+ * `factor-basis.ts`, kept because this public signature takes the
199
+ * pension-age date where that door takes a date of birth. It
200
+ * retires with `projectPension`
201
+ * (https://github.com/casomoltd/nhs-pay/issues/21), and until then
202
+ * `tests/section-factors.test.ts` holds the two routes equal.
201
203
  */
202
204
  export function retirementFactor(retirementDate, npDate) {
203
205
  if (retirementDate >= npDate) {
@@ -213,6 +215,21 @@ export function retirementFactor(retirementDate, npDate) {
213
215
  const period = periodInYearsMonths(retirementDate, npDate);
214
216
  return { factor: ERF1.factorFor(period), type: 'erf' };
215
217
  }
218
+ /**
219
+ * The **2015 Section's** early retirement factor for drawing a
220
+ * whole period before its pension age: {@link retirementFactor} for
221
+ * a caller that holds the period rather than the two dates it
222
+ * spans. The 1995 and 2008 Sections are keyed by age and are not
223
+ * read here. A whole period has no part-month to round, so the
224
+ * table is read at exactly that row. Months are 0 to 11; a period
225
+ * past the last printed row raises
226
+ * {@link RetirementFactorOutOfRange}. It stays when
227
+ * `projectPension` retires: a caller holding a period is not a
228
+ * projection.
229
+ */
230
+ export function erf2015For(period) {
231
+ return ERF1.factorFor({ ...period, days: 0 });
232
+ }
216
233
  // ── Core Calculations ───────────────────────────────
217
234
  /** Annual pension accrual for one year of service */
218
235
  export function yearlyAccrual(pensionablePay) {
@@ -221,7 +238,14 @@ export function yearlyAccrual(pensionablePay) {
221
238
  // ── Projection Orchestrator ─────────────────────────
222
239
  /**
223
240
  * Generate a full pension projection including curve
224
- * data for both nominal and real (CPI-deflated) views.
241
+ * data for both nominal and real views, the real one a second run
242
+ * at zero CPI rather than the nominal one deflated.
243
+ *
244
+ * @deprecated For the 2015 Section alone, on pay held flat.
245
+ * `memberBenefits` values a member across every section they
246
+ * hold; this stays for the flat-salary question until that can
247
+ * be asked of `memberBenefits` too:
248
+ * https://github.com/casomoltd/nhs-pay/issues/21
225
249
  *
226
250
  * `today` is the evaluation date — the anchor for the
227
251
  * accrued/projected split and the real-terms deflator.
@@ -238,11 +262,8 @@ export function projectPension(input, today = new Date()) {
238
262
 
239
263
  Cheap, deterministic and pure, so running the model twice
240
264
  costs a few microseconds and buys a definition a reader can
241
- check by hand. The deflated alternative cost an anchor
242
- date, a face-value window, a rule against restating a
243
- stated balance, and three failed attempts at placing the
244
- anchor — all to arrive at 1.47% where the member's own
245
- arithmetic says 1.5%. */
265
+ check by hand, where deflating arrives at 1.47% against the
266
+ member's own 1.5%. */
246
267
  const cash = resolveProjection(input, today);
247
268
  const todays = input.assumedCpi === 0
248
269
  ? cash
@@ -270,43 +291,6 @@ export function projectPension(input, today = new Date()) {
270
291
  todaysMoneyLedger: todays.ledger,
271
292
  };
272
293
  }
273
- /**
274
- * A member's stated balance, on whatever date it is stated —
275
- * the day they read it, or the day their statement prints. That
276
- * is a position mid-scheme-year, and a seed is a year-end
277
- * closing balance, so it has to be carried back to one.
278
- *
279
- * In November the April uplift has already been applied to the
280
- * figure being read, so dividing it out lands on the last
281
- * year-end closing balance and the walk re-applies it — no
282
- * double count, and no year of accrual thrown away. On a date
283
- * before that April the figure already IS the year-end balance
284
- * and nothing is divided, which is why a statement printed on
285
- * 31 March passes through untouched.
286
- *
287
- * ONE route for both the dated and the undated case, because
288
- * there is only one question: what was the closing balance at
289
- * the year end before this date? `seedFromStatement` stays
290
- * strict about wanting a year end; this is what finds it.
291
- * Statements print on arbitrary days — 7 November is a real
292
- * one — so the strict form alone could not serve them.
293
- */
294
- function seedFromBalanceAt(balance, asOf, exitDate, retirementDate, prices) {
295
- const lastYearEnd = schemeYearClosedBy(asOf);
296
- /* The uplift undone here is the one OPENING year
297
- `lastYearEnd + 1`, and it is the very object `buildLedger`
298
- re-applies to that year: inverting the walk exactly is this
299
- function's only job, so both sides ask `openingUpliftFor`
300
- rather than each naming the phase, the year and the CPI
301
- series for themselves. */
302
- const applied = openingUpliftFor(lastYearEnd, exitDate, retirementDate, prices);
303
- const already = applied.appliedOn <= asOf;
304
- return seedFromStatement(already ? balance / (1 + applied.percent / 100) : balance, schemeYearEndDate(lastYearEnd));
305
- }
306
- /** The earliest of some dates. */
307
- function earliest(...dates) {
308
- return new Date(Math.min(...dates.map((d) => d.getTime())));
309
- }
310
294
  function resolveProjection(input, today) {
311
295
  const { currentSalary, dateOfBirth, exitDate, retirementDate, npa, assumedCpi, } = input;
312
296
  /* The drawing date is used EXACTLY AS GIVEN, to the day.
@@ -317,16 +301,12 @@ function resolveProjection(input, today) {
317
301
  down §3.4) exist precisely for the part-months a date-exact
318
302
  answer produces.
319
303
 
320
- A CONSUMER may want less than that. The NHS pension
321
- calculator prices retirement in whole years from NPA,
322
- because it draws a chart whose every point is a 31 March
323
- and a factor that moved when you retired "on time" would
324
- be harder to follow than one that is a little rough. It
325
- gets that by handing this function two birthdays, which are
326
- a whole number of years apart. That is its simplification
327
- to declare, in its own methods, and it did not belong in
328
- here: a library that has already thrown the precision away
329
- cannot offer it back to the next caller. */
304
+ A consumer may want less than that, such as retirement
305
+ priced in whole years from NPA. It gets that by handing
306
+ this function two dates a whole number of years apart, and
307
+ declares the simplification in its own methods: a library
308
+ that has already thrown the precision away cannot offer it
309
+ back to the next caller. */
330
310
  const isEstimation = input.kind === 'estimation';
331
311
  const prices = createPrices(assumedCpi, today);
332
312
  // The ONLY place the input variant is read.
@@ -334,13 +314,10 @@ function resolveProjection(input, today) {
334
314
  ? seedFromJoinDate(input.joinDate)
335
315
  : seedFromBalanceAt(input.accruedPension, input.statementDate, exitDate, retirementDate, prices);
336
316
  const { factor, type: factorType } = retirementFactor(retirementDate, npaDate(dateOfBirth, npa));
337
- const retireYear = schemeYearEndFor(retirementDate);
338
- // Walk five years past the later of NPA and retirement, which
339
- // is as far as the curve is ever asked to reach.
340
- const through = Math.max(retireYear, schemeYearEndFor(npaDate(dateOfBirth, npa))) + 6;
317
+ const through = walkThrough(retirementDate, npaDate(dateOfBirth, npa));
341
318
  const ledger = buildLedger({
342
319
  seed,
343
- pensionableEarnings: currentSalary,
320
+ payIn: flatPay(currentSalary),
344
321
  exitDate,
345
322
  retirementDate,
346
323
  prices,
@@ -348,23 +325,12 @@ function resolveProjection(input, today) {
348
325
  drawingFor: () => ({
349
326
  on: retirementDate,
350
327
  factor,
351
- kind: factorType,
352
- provenance: factorType === null
328
+ table: factorType === null
353
329
  ? null
354
- : factorProvenance(factorType),
330
+ : { kind: factorType, provenance: factorProvenance(factorType) },
355
331
  }),
356
332
  });
357
- // Absent when retirement falls at or before the seed's own
358
- // year end — a member handing over a balance and drawing it
359
- // the same day. There is no row then, but there is still an
360
- // answer: the balance they handed over.
361
- const retireRow = ledger.years.find((r) => r.schemeYearEnd === retireYear);
362
- const revalued = retireRow === undefined
363
- ? ledger.accruedAt(retirementDate)
364
- : retireRow.revalued + retireRow.earned;
365
- const drawn = retireRow === undefined
366
- ? revalued * factor
367
- : retireRow.closing;
333
+ const { revalued, drawn } = atDrawing(ledger, retirementDate, factor);
368
334
  /* Illustration only, and only where a statement leaves a gap:
369
335
  an estimation path already walks from the join date, so
370
336
  there is nothing to fill in. Calibrated to land exactly on
@@ -387,9 +353,8 @@ function resolveProjection(input, today) {
387
353
  The seed IS a balance at a scheme year end, so the months
388
354
  between it and today are rows of this walk like any
389
355
  other; starting the curve at today withholds them.
390
- Starting at today also puts a past leaving date OUTSIDE
391
- the plotted range, leaving the "stops paying in" marker
392
- floating in space beside a chart that begins after it. */
356
+ Starting at today would also put a past leaving date
357
+ outside the curve's range. */
393
358
  curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null ? seed.atSchemeYearEnd : history.from - 1)),
394
359
  /* The close of that year, not the exit date — see
395
360
  docs/how-it-works.md, "An exit date names a SCHEME
@@ -401,123 +366,4 @@ function resolveProjection(input, today) {
401
366
  annualPension: drawn,
402
367
  };
403
368
  }
404
- /**
405
- * A member's age on a date, as WHOLE YEARS plus the fraction of
406
- * the year since their birthday.
407
- *
408
- * The whole part is calendar arithmetic, so it is the age they
409
- * would give if asked. The fraction only orders points within a
410
- * year, which is all the chart needs it for.
411
- */
412
- function ageAtYearEnd(dateOfBirth, on) {
413
- const birthdayIn = (year) => new Date(year, dateOfBirth.getMonth(), dateOfBirth.getDate());
414
- const thisYear = birthdayIn(on.getFullYear());
415
- const reached = thisYear <= on;
416
- const whole = on.getFullYear() - dateOfBirth.getFullYear()
417
- - (reached ? 0 : 1);
418
- const last = reached ? thisYear : birthdayIn(on.getFullYear() - 1);
419
- const next = reached ? birthdayIn(on.getFullYear() + 1) : thisYear;
420
- return whole
421
- + (on.getTime() - last.getTime())
422
- / (next.getTime() - last.getTime());
423
- }
424
- /**
425
- * The curve is the ledger's own steps, plotted ON THEM.
426
- *
427
- * **One point per scheme year, at its 31 March close** — the
428
- * date an Annual Benefit Statement is drawn to, so every
429
- * plotted value is a figure a member can lay beside paper.
430
- *
431
- * **Never at BIRTHDAYS**, which is the plotting the age axis
432
- * invites. A birthday falls somewhere inside a scheme year:
433
- * after the April uplift but before the year's slice lands, or
434
- * the other way about. So a member born in January reads their
435
- * 43rd-birthday point as "the 2026 figure" and gets a balance
436
- * with neither the year's accrual in it nor any relation to a
437
- * year end — values right for their dates and wrong for every
438
- * question anyone asks of them, which surfaces as "the chart
439
- * disagrees with my statement".
440
- *
441
- * The x-axis stays an AGE, because that is how people think
442
- * about retiring. Age N is plotted at the close of the scheme
443
- * year N's birthday falls in — the year that birthday belongs
444
- * to — so the axis is unchanged and only the dates behind it
445
- * move onto the scheme's own calendar.
446
- *
447
- * Nothing is drawn before the ledger's own start. For a
448
- * statement that is the statement's date, and the reason is
449
- * not tidiness: a member enters one figure, not their history,
450
- * so anything earlier would be that figure run BACKWARDS
451
- * through rates nobody checked. An inverse calculation drawn
452
- * as history is a claim the tool cannot support.
453
- */
454
- function buildCurve(cash, todays) {
455
- const { today, dateOfBirth, retirementDate, npa } = cash;
456
- const endAge = Math.max(npa + 5, yearsBetween(dateOfBirth, retirementDate) + 5);
457
- /** The scheme year an age's birthday falls in. */
458
- const yearOfAge = (age) => schemeYearEndFor(new Date(dateOfBirth.getFullYear() + age, dateOfBirth.getMonth(), dateOfBirth.getDate()));
459
- /** The age whose birthday falls in a scheme year — the
460
- * inverse, used once to find where the axis starts. */
461
- const ageInYear = (schemeYearEnd) => {
462
- const end = schemeYearEndDate(schemeYearEnd);
463
- const birthday = new Date(schemeYearEnd, dateOfBirth.getMonth(), dateOfBirth.getDate());
464
- return schemeYearEnd - dateOfBirth.getFullYear()
465
- - (birthday > end ? 1 : 0);
466
- };
467
- const startAge = ageInYear(schemeYearEndFor(cash.curveFrom));
468
- const points = [];
469
- for (let label = startAge; label <= Math.ceil(endAge); label++) {
470
- const year = yearOfAge(label);
471
- const on = schemeYearEndDate(year);
472
- /* The age the member actually IS on that 31 March, not the
473
- whole age whose birthday the scheme year contains.
474
-
475
- Those differ by anything from nought to twelve months —
476
- the gap between a birthday and the following 31 March —
477
- so plotting at the whole age put every value up to a year
478
- early on the x-axis. Where "today" fell in that gap the
479
- curve ran BACKWARDS: a member born in June read 7,738 at
480
- 39, 8,577 at 40, then 7,854 at 40.2 for today, then
481
- 9,429 at 41. Three of those are right; the axis was
482
- wrong.
483
-
484
- A January birthday hides it, being three months from the
485
- year end. A June one puts nine months of accrual in the
486
- wrong place.
487
-
488
- Built as WHOLE AGE + fraction rather than as a span in
489
- 365.25-day years, so that `Math.floor(age)` is the age
490
- the member actually is on that 31 March — by calendar
491
- arithmetic, not within a rounding of it. Someone born on
492
- 1 April reads 42.997 at the year end before their 43rd
493
- birthday, which floors correctly today and sits three
494
- thousandths from flooring wrongly after enough leap
495
- days. The fraction still orders the points; only the
496
- whole part is now guaranteed. */
497
- const age = ageAtYearEnd(dateOfBirth, on);
498
- /* Two walks meet here, and the estimate owns everything up
499
- to and including the statement's own year — its last row
500
- IS the stated balance, so reading it there rather than
501
- the main ledger changes nothing and keeps the join
502
- seamless. */
503
- const from = (r) => r.history !== null && year <= r.history.to
504
- ? r.history.ledger
505
- : r.ledger;
506
- const row = from(cash).years.find((r) => r.schemeYearEnd === year);
507
- points.push({
508
- age,
509
- nominal: from(cash).atDate(on),
510
- real: from(todays).atDate(on),
511
- accrued: on <= today,
512
- /* Off the row where there is one, and otherwise from the
513
- SAME rule the row was built by — never a second copy of
514
- it here. Compared by scheme YEAR, matching the ledger:
515
- a point sits at a 31 March close, so a member who left
516
- in January of that year would read as deferred on the
517
- very year they were still paying in. */
518
- phase: row?.phase ?? phaseAt(year, schemeYearEndFor(cash.exitDate), schemeYearEndFor(cash.retirementDate)),
519
- });
520
- }
521
- return points;
522
- }
523
369
  //# sourceMappingURL=pension-projection.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6JG;AAEH,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,YAAY,GACb,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,YAAY,EAAE,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAC9D,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,qBAAqB,CAAC;AAE9D,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAKlD,OAAO,EAAC,SAAS,EAAC,MAAM,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BAAsB,EAAE,IAAI,CAAC,eAAe;YAC5C,MAAM;SACP,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IAET,OAAO;QACL,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG;QACjD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;QACzD;;;;;;;wCAOgC;QAChC,SAAS,EAAE,QAAQ,CACjB,KAAK,EACL,QAAQ,EACR,iBAAiB,CACf,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAC3D,CACF;QACD;;;;8BAIsB;QACtB,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC3D,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,KAAK;KACrB,CAAC;AACJ,CAAC"}
@@ -14,7 +14,9 @@ export interface ScalePoint {
14
14
  /**
15
15
  * Years of experience this point maps to (0-indexed), for scales the
16
16
  * source lists *by year of service* — the SAS and consultant scales,
17
- * whose figures step by year. Absent where the step is self-describing
17
+ * whose figures step by year, and every Agenda for Change band, whose
18
+ * "Year N" point is reached after N − 1 years in band. A pay path
19
+ * times a member's steps from it. Absent where the step is self-describing
18
20
  * (a training stage, a dental band + point) and carries no year axis.
19
21
  */
20
22
  yearsExperience?: number;
@@ -34,3 +36,11 @@ export interface ScalePoint {
34
36
  */
35
37
  nodalPoint?: string;
36
38
  }
39
+ /**
40
+ * A point on a stepped scale, which says when it is paid: every Agenda
41
+ * for Change point. A pay ladder takes these, so a point that cannot
42
+ * say when it is paid does not compile as a rung.
43
+ */
44
+ export interface SteppedPoint extends ScalePoint {
45
+ readonly yearsExperience: number;
46
+ }
package/dist/scales.d.ts CHANGED
@@ -36,26 +36,26 @@
36
36
  * Handbook, amendment 62" (#sa-41), Annex 9
37
37
  *
38
38
  * The other three nations' sources are cited in their own circular
39
- * files, beside the data they justify — including the qualification
40
- * that used to live in this header, that Scotland's MSG consolidated
41
- * table prints superseded 4.25% rates and must not be read instead of
42
- * the circular.
39
+ * files, beside the data they justify — including the warning that
40
+ * Scotland's MSG consolidated table prints superseded 4.25% rates and
41
+ * must not be read instead of the circular.
43
42
  *
44
43
  * POINT LABELS — one convention, all four nations. A point's label is
45
44
  * the year of service in which a member first reaches it: increment 1
46
45
  * is `Year 1`, and the top point takes a `+` because service continues
47
46
  * past it. No publisher prints such a label; every one is our reading
48
47
  * of an interval the publisher does print. For the three circular
49
- * nations that reading is now DERIVED in `afc-scales.ts` from the
50
- * transcribed interval, so a label and its interval cannot disagree.
51
- * England's are authored here, from the same convention.
48
+ * nations the year is derived in `afc-scales.ts` from the transcribed
49
+ * interval; England's are authored here as years. All four go through
50
+ * `afcPoint`, which writes the label and the year from one number, so
51
+ * a label and the timing a pay path reads from it cannot disagree.
52
52
  *
53
53
  * Labels are lookup keys for `afcResolver.fromScalePoint`, so changing
54
54
  * one is an API change, and the fixtures assert them.
55
55
  */
56
56
  import type { Nation, PayYear, YearLabel } from '@casomoltd/paye-calc';
57
57
  import type { DocumentSource } from './document-source.js';
58
- import type { ScalePoint } from './scale-point.js';
58
+ import type { SteppedPoint } from './scale-point.js';
59
59
  import type { AfcBandId } from './afc-band.js';
60
60
  export { AFC_BANDS, AFC_BAND_IDS } from './afc-band.js';
61
61
  export type { AfcBandId } from './afc-band.js';
@@ -71,7 +71,7 @@ export interface HcasZones {
71
71
  }
72
72
  interface AfcScaleYear {
73
73
  hcas: HcasZones;
74
- scales: Record<AfcBandId, ScalePoint[]>;
74
+ scales: Record<AfcBandId, SteppedPoint[]>;
75
75
  }
76
76
  export declare const NLW_HOURLY: Partial<Record<YearLabel, number>>;
77
77
  /**