@casomoltd/nhs-pay 0.10.4 → 0.12.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 (69) hide show
  1. package/README.md +48 -0
  2. package/dist/award.d.ts +8 -8
  3. package/dist/award.js +8 -8
  4. package/dist/circulars/england-md-1-2026r.d.ts +2 -3
  5. package/dist/circulars/england-md-1-2026r.js +2 -3
  6. package/dist/circulars/england-md-1-2026r.js.map +1 -1
  7. package/dist/circulars/ni-hsc-tc8-05-2025.d.ts +2 -2
  8. package/dist/circulars/ni-hsc-tc8-05-2025.js +2 -2
  9. package/dist/circulars/scotland-pcs-dd-2025-01.d.ts +2 -3
  10. package/dist/circulars/scotland-pcs-dd-2025-01.js +2 -3
  11. package/dist/circulars/scotland-pcs-dd-2025-01.js.map +1 -1
  12. package/dist/circulars/scotland-pcs-dd-2026-01.d.ts +2 -2
  13. package/dist/circulars/scotland-pcs-dd-2026-01.js +2 -2
  14. package/dist/circulars/wales-mdw-01-2025.d.ts +2 -2
  15. package/dist/circulars/wales-mdw-01-2025.js +2 -2
  16. package/dist/circulars/wales-mdw-01-2026.d.ts +2 -2
  17. package/dist/circulars/wales-mdw-01-2026.js +2 -2
  18. package/dist/format.d.ts +8 -0
  19. package/dist/format.js +14 -0
  20. package/dist/format.js.map +1 -1
  21. package/dist/gad/erf-2023-06-30.d.ts +39 -3
  22. package/dist/gad/erf-2023-06-30.js +39 -3
  23. package/dist/gad/erf-2023-06-30.js.map +1 -1
  24. package/dist/gad/factor-table.d.ts +10 -0
  25. package/dist/gad/factor-table.js.map +1 -1
  26. package/dist/gad/lrf-2023-06-30.d.ts +39 -3
  27. package/dist/gad/lrf-2023-06-30.js +39 -3
  28. package/dist/gad/lrf-2023-06-30.js.map +1 -1
  29. package/dist/hcas-pcts.js +3 -1
  30. package/dist/hcas-pcts.js.map +1 -1
  31. package/dist/index.d.ts +15 -4
  32. package/dist/index.js +17 -5
  33. package/dist/index.js.map +1 -1
  34. package/dist/npa.d.ts +28 -0
  35. package/dist/npa.js +60 -0
  36. package/dist/npa.js.map +1 -0
  37. package/dist/pension/history.d.ts +105 -0
  38. package/dist/pension/history.js +115 -0
  39. package/dist/pension/history.js.map +1 -0
  40. package/dist/pension/ledger.d.ts +146 -0
  41. package/dist/pension/ledger.js +193 -0
  42. package/dist/pension/ledger.js.map +1 -0
  43. package/dist/pension/prices.d.ts +125 -0
  44. package/dist/pension/prices.js +108 -0
  45. package/dist/pension/prices.js.map +1 -0
  46. package/dist/pension/seed.d.ts +75 -0
  47. package/dist/pension/seed.js +82 -0
  48. package/dist/pension/seed.js.map +1 -0
  49. package/dist/pension/uplift.d.ts +151 -0
  50. package/dist/pension/uplift.js +135 -0
  51. package/dist/pension/uplift.js.map +1 -0
  52. package/dist/pension-projection.d.ts +249 -12
  53. package/dist/pension-projection.js +406 -101
  54. package/dist/pension-projection.js.map +1 -1
  55. package/dist/pension.js +9 -10
  56. package/dist/pension.js.map +1 -1
  57. package/dist/post.d.ts +24 -16
  58. package/dist/post.js +2 -3
  59. package/dist/post.js.map +1 -1
  60. package/dist/revaluation.d.ts +189 -0
  61. package/dist/revaluation.js +270 -0
  62. package/dist/revaluation.js.map +1 -0
  63. package/dist/scales.d.ts +17 -10
  64. package/dist/scales.js +17 -10
  65. package/dist/scales.js.map +1 -1
  66. package/dist/take-home.d.ts +9 -5
  67. package/dist/take-home.js +9 -5
  68. package/dist/take-home.js.map +1 -1
  69. package/package.json +2 -2
@@ -1,9 +1,18 @@
1
1
  /**
2
2
  * Verbatim transcription — GAD "NHSPS_EW — Consolidated Factor
3
- * Spreadsheet" (workbook: NHS EW Consolidated Factors 2023-03),
4
- * issued 30 June 2023. Sheet x-421 · PDF p.26.
3
+ * Spreadsheet", table 0-421, factors issued 30 June 2023.
4
+ * Sheet x-421 · PDF p.26.
5
5
  *
6
- * https://www.nhsbsa.nhs.uk/sites/default/files/2024-02/Early%20and%20Late%20Retirement%20Factors.pdf
6
+ * The WORKBOOK VERSION is deliberately not named: GAD reissues
7
+ * the consolidated workbook and a version pinned here rots
8
+ * silently. What is cited is what does not move — the table,
9
+ * and the date its factors were issued. Which workbook it was
10
+ * last checked against is a dated fact, and lives below.
11
+ *
12
+ * Sources: "NHSBSA, Early and Late Retirement Factors" (the
13
+ * member-facing extract) and "GAD NHS_EW Consolidated Factors,
14
+ * version 2026-01" (the workbook, and the source of record) —
15
+ * see docs/source-archive.md.
7
16
  *
8
17
  * Table 0-421 (LRF1): 2015 scheme late retirement factors — main
9
18
  * scheme pension, members retiring from active service. Unisex;
@@ -16,6 +25,33 @@
16
25
  * printed — the 10yr row prints a single 0-month value. Delete
17
26
  * this file whole when a later issue supersedes the table
18
27
  * (expected with the post-May-2026 SCAPE review).
28
+ *
29
+ * ── Checked against GAD's own workbook, 20 Aug 2026 ─
30
+ *
31
+ * Source of truth is the consolidated workbook, not the NHSBSA
32
+ * extract above: **NHS_EW Consolidated Factors, version
33
+ * 2026-01** (Date Modified 1 June 2026), the current issue.
34
+ * The extract carries the tables but not the version-control
35
+ * sheet, so it cannot answer whether they moved; the workbook
36
+ * can, and is the reason this check is possible at all.
37
+ *
38
+ * **This table is unchanged and still current.** Two checks,
39
+ * because a changelog is a claim and cell values are evidence:
40
+ *
41
+ * 1. Its *Version control* sheet shows x-421 last updated in
42
+ * version **2023-02**, dated 30 June 2023 — which is the
43
+ * `issued` date below, and the sheet's own "Date Factors
44
+ * Issued" cell agrees. Versions since (2023-03, 2023-04, two
45
+ * 2025-01 releases, 2026-01) updated other tables: 2026-01
46
+ * touched only x-201 to x-209 and x-301 to x-308.
47
+ * 2. Every cell of the x-421 sheet was diffed against the rows
48
+ * below — 11 rows — with **zero differences**.
49
+ *
50
+ * Re-run both before assuming a later workbook changed nothing:
51
+ * a table can be reissued without its number changing. Note
52
+ * x-423 arrived in 2025-01 and is NOT this table — it is an
53
+ * eligibility factor for actuarially reduced early retirement,
54
+ * looked up by age rather than by time to NPA.
19
55
  */
20
56
  /** 2015 scheme LRF — Table 0-421, issued 30 Jun 2023. */
21
57
  export declare const LRF_0_421: {
@@ -1,9 +1,18 @@
1
1
  /**
2
2
  * Verbatim transcription — GAD "NHSPS_EW — Consolidated Factor
3
- * Spreadsheet" (workbook: NHS EW Consolidated Factors 2023-03),
4
- * issued 30 June 2023. Sheet x-421 · PDF p.26.
3
+ * Spreadsheet", table 0-421, factors issued 30 June 2023.
4
+ * Sheet x-421 · PDF p.26.
5
5
  *
6
- * https://www.nhsbsa.nhs.uk/sites/default/files/2024-02/Early%20and%20Late%20Retirement%20Factors.pdf
6
+ * The WORKBOOK VERSION is deliberately not named: GAD reissues
7
+ * the consolidated workbook and a version pinned here rots
8
+ * silently. What is cited is what does not move — the table,
9
+ * and the date its factors were issued. Which workbook it was
10
+ * last checked against is a dated fact, and lives below.
11
+ *
12
+ * Sources: "NHSBSA, Early and Late Retirement Factors" (the
13
+ * member-facing extract) and "GAD NHS_EW Consolidated Factors,
14
+ * version 2026-01" (the workbook, and the source of record) —
15
+ * see docs/source-archive.md.
7
16
  *
8
17
  * Table 0-421 (LRF1): 2015 scheme late retirement factors — main
9
18
  * scheme pension, members retiring from active service. Unisex;
@@ -16,6 +25,33 @@
16
25
  * printed — the 10yr row prints a single 0-month value. Delete
17
26
  * this file whole when a later issue supersedes the table
18
27
  * (expected with the post-May-2026 SCAPE review).
28
+ *
29
+ * ── Checked against GAD's own workbook, 20 Aug 2026 ─
30
+ *
31
+ * Source of truth is the consolidated workbook, not the NHSBSA
32
+ * extract above: **NHS_EW Consolidated Factors, version
33
+ * 2026-01** (Date Modified 1 June 2026), the current issue.
34
+ * The extract carries the tables but not the version-control
35
+ * sheet, so it cannot answer whether they moved; the workbook
36
+ * can, and is the reason this check is possible at all.
37
+ *
38
+ * **This table is unchanged and still current.** Two checks,
39
+ * because a changelog is a claim and cell values are evidence:
40
+ *
41
+ * 1. Its *Version control* sheet shows x-421 last updated in
42
+ * version **2023-02**, dated 30 June 2023 — which is the
43
+ * `issued` date below, and the sheet's own "Date Factors
44
+ * Issued" cell agrees. Versions since (2023-03, 2023-04, two
45
+ * 2025-01 releases, 2026-01) updated other tables: 2026-01
46
+ * touched only x-201 to x-209 and x-301 to x-308.
47
+ * 2. Every cell of the x-421 sheet was diffed against the rows
48
+ * below — 11 rows — with **zero differences**.
49
+ *
50
+ * Re-run both before assuming a later workbook changed nothing:
51
+ * a table can be reissued without its number changing. Note
52
+ * x-423 arrived in 2025-01 and is NOT this table — it is an
53
+ * eligibility factor for actuarially reduced early retirement,
54
+ * looked up by age rather than by time to NPA.
19
55
  */
20
56
  /** 2015 scheme LRF — Table 0-421, issued 30 Jun 2023. */
21
57
  export const LRF_0_421 = {
@@ -1 +1 @@
1
- {"version":3,"file":"lrf-2023-06-30.js","sourceRoot":"","sources":["../../src/gad/lrf-2023-06-30.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAIH,yDAAyD;AACzD,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB,IAAI,EAAE,KAAK;IACX,UAAU,EAAE;QACV,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,OAAO;QACd,IAAI,EAAE,EAAE;QACR,WAAW,EAAE,MAAM;QACnB,MAAM,EAAE,YAAY;QACpB,SAAS,EAAE,0CAA0C;cACjD,+CAA+C;cAC/C,gBAAgB;QACpB,cAAc,EAAE,qCAAqC;cACjD,0CAA0C;KAC/C;IACD,IAAI,EAAE;QACJ,iDAAiD;QACjD,mCAAmC;QACnC,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;YACvC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,CAAC,EAAE,MAAM;QACnD,CAAC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK;YACvC,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EAAE,KAAK,EA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CAAC"}
package/dist/hcas-pcts.js CHANGED
@@ -8,7 +8,9 @@
8
8
  *
9
9
  * Browser-safe — no node:fs dependency.
10
10
  */
11
- // ── PCT data — NHS T&Cs Handbook Annex 8 (HCAS zones) ──
11
+ // ── PCT data — Annex 8, HCAS payment zones ──
12
+ // Source: "NHS Terms and Conditions of Service Handbook,
13
+ // amendment 62" (#sa-41) — see docs/source-archive.md.
12
14
  const INNER_LONDON_PCTS = [
13
15
  'Hammersmith & Fulham',
14
16
  'Kensington & Chelsea',
@@ -1 +1 @@
1
- {"version":3,"file":"hcas-pcts.js","sourceRoot":"","sources":["../src/hcas-pcts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,0DAA0D;AAE1D,MAAM,iBAAiB,GAAsB;IAC3C,sBAAsB;IACtB,sBAAsB;IACtB,aAAa;IACb,QAAQ;IACR,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,SAAS;IACT,UAAU;IACV,WAAW;IACX,YAAY;CACb,CAAC;AAEF,MAAM,iBAAiB,GAAsB;IAC3C,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,SAAS;IACT,UAAU;IACV,oBAAoB;IACpB,UAAU;IACV,QAAQ;IACR,WAAW;IACX,iBAAiB;IACjB,QAAQ;IACR,SAAS;IACT,WAAW;IACX,SAAS;IACT,UAAU;IACV,uBAAuB;IACvB,iBAAiB;CAClB,CAAC;AAEF,MAAM,WAAW,GAAsB;IACrC,+BAA+B;IAC/B,UAAU;IACV,kCAAkC;IAClC,gBAAgB;IAChB,QAAQ;IACR,UAAU;IACV,SAAS;IACT,WAAW;IACX,yCAAyC;IACzC,0BAA0B;IAC1B,uBAAuB;IACvB,wBAAwB;IACxB,kBAAkB;IAClB,mBAAmB;IACnB,QAAQ;IACR,6BAA6B;IAC7B,WAAW;IACX,6BAA6B;IAC7B,aAAa;IACb,sBAAsB;IACtB,cAAc;IACd,yBAAyB;CAC1B,CAAC;AA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;IAEX,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;AAClD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,WAAW;IACzB,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,KAAK,MAAM,EAAC,IAAI,EAAE,IAAI,EAAC,IAAI,SAAS,EAAE,CAAC;QACrC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/index.d.ts CHANGED
@@ -15,9 +15,20 @@ export { DENTAL_GRADES, DENTAL_GRADE_IDS, DENTAL_TAX_YEARS, getDentalScales, } f
15
15
  export type { DentalGradeId, DentalGradeMeta, } from './dental-scales.js';
16
16
  export { AwardUnavailable, PensionTiersUnavailable, RetirementFactorOutOfRange, ScaleUnavailable, } from './errors.js';
17
17
  export { afcAward } from './award.js';
18
- export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
19
- export type { FactorTableKind, } from './gad/factor-table.js';
20
- export type { CommutationResult, PensionEstimationInput, PensionProjectionInput, PensionProjectionResult, PensionStatementInput, ProjectionPoint, } from './pension-projection.js';
18
+ export { ACTIVE_REVAL_BONUS_PCT, IN_SERVICE_REVALUATION, publishedInflationBetween, revaluationFor, } from './revaluation.js';
19
+ export type { PublishedInflation, RevaluationYear, } from './revaluation.js';
20
+ export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, factorProvenance, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
21
+ export type { FactorProvenance, FactorTableKind, } from './gad/factor-table.js';
22
+ export { normalPensionAge } from './npa.js';
23
+ export type { CommutationResult, PensionEstimationInput, PensionProjectionInput, PensionProjectionResult, PensionStatementInput, ProjectionMoney, ProjectionPoint, } from './pension-projection.js';
24
+ export { createPrices } from './pension/prices.js';
25
+ export type { CpiEntry, Prices } from './pension/prices.js';
26
+ export { activeRatePct, deferredRatePct, upliftsFor, } from './pension/uplift.js';
27
+ export type { AppliedUplift, MemberPhase, UpliftSource, } from './pension/uplift.js';
28
+ export { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
29
+ export type { LedgerSeed } from './pension/seed.js';
30
+ export { buildLedger } from './pension/ledger.js';
31
+ export type { AppliedDrawing, LedgerRequest, LedgerYear, MemberLedger, } from './pension/ledger.js';
21
32
  export { HCAS_ZONE_IDS, calculateHcasSupplement, grossSalary, isHcasZoneId, } from './hcas.js';
22
33
  export type { HcasZoneId } from './hcas.js';
23
34
  export { getHcasPcts, getHcasZone, } from './hcas-pcts.js';
@@ -28,6 +39,6 @@ export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
28
39
  export type { AfcBandMeta, AfcScaleData, } from './bands.js';
29
40
  export { nhsTakeHome } from './take-home.js';
30
41
  export type { NhsTakeHomeOptions } from './take-home.js';
31
- export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, yearLabel, } from './format.js';
42
+ export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, formatPctPrecise, yearLabel, } from './format.js';
32
43
  export { TAX_REGIONS, TAX_YEARS, NATIONS, NATION_KEYS, TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, StudentLoanPlan, nationToTaxRegion, getTaxYearConfig, hoursPerYear, } from '@casomoltd/paye-calc';
33
44
  export type { Nation, TaxRegion, TaxYear, } from '@casomoltd/paye-calc';
package/dist/index.js CHANGED
@@ -12,15 +12,27 @@ export { DENTAL_GRADES, DENTAL_GRADE_IDS, DENTAL_TAX_YEARS, getDentalScales, } f
12
12
  export { AwardUnavailable, PensionTiersUnavailable, RetirementFactorOutOfRange, ScaleUnavailable, } from './errors.js';
13
13
  // ── AfC pay award ────────────────────────────────
14
14
  export { afcAward } from './award.js';
15
+ export { ACTIVE_REVAL_BONUS_PCT, IN_SERVICE_REVALUATION, publishedInflationBetween, revaluationFor, } from './revaluation.js';
15
16
  // ── Pension Projection ─────────────────────────────
16
17
  // Deliberate surface: the scenario-level API plus
17
18
  // yearlyAccrual (hub-site builds its pension-growth
18
19
  // chart from it). Date plumbing (periodInYearsMonths,
19
20
  // npaDate), raw maths (revalue), and factor-table
20
- // internals stay private — factors are reachable solely
21
- // through retirementFactor/projectPension, which own
22
- // the GAD rounding rules.
23
- export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
21
+ // internals stay private — factor VALUES are reachable
22
+ // solely through retirementFactor/projectPension, which
23
+ // own the GAD rounding rules; factor PROVENANCE is data
24
+ // (factorProvenance), so consumers cite it, never
25
+ // hand-type it.
26
+ export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, factorProvenance, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
27
+ // ── Normal pension age ───────────────────────────────
28
+ export { normalPensionAge } from './npa.js';
29
+ // ── The pension ledger ───────────────────────────────
30
+ // Additive: the projection API above is unchanged, and a
31
+ // consumer reads the ledger only when it wants the workings.
32
+ export { createPrices } from './pension/prices.js';
33
+ export { activeRatePct, deferredRatePct, upliftsFor, } from './pension/uplift.js';
34
+ export { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
35
+ export { buildLedger } from './pension/ledger.js';
24
36
  // ── HCAS ─────────────────────────────────────────
25
37
  export { HCAS_ZONE_IDS, calculateHcasSupplement, grossSalary, isHcasZoneId, } from './hcas.js';
26
38
  // ── HCAS PCTs ────────────────────────────────────
@@ -32,7 +44,7 @@ export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
32
44
  // ── Take-home ────────────────────────────────────
33
45
  export { nhsTakeHome } from './take-home.js';
34
46
  // ── Format ───────────────────────────────────────
35
- export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, yearLabel, } from './format.js';
47
+ export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, formatPctPrecise, yearLabel, } from './format.js';
36
48
  // ── Re-exports from paye-calc ────────────────────
37
49
  // Types that appear in our public API so consumers
38
50
  // don't need a direct paye-calc import for NHS work.
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAQrB,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAStB,oDAAoD;AACpD,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAU/C,OAAO,EAAC,WAAW,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAS3E,oDAAoD;AACpD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,GACjB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAK5B,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,YAAY,CAAC;AAEpC,sDAAsD;AACtD,kDAAkD;AAClD,oDAAoD;AACpD,sDAAsD;AACtD,kDAAkD;AAClD,wDAAwD;AACxD,qDAAqD;AACrD,0BAA0B;AAC1B,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,cAAc,EACd,gBAAgB,EAChB,aAAa,GACd,MAAM,yBAAyB,CAAC;AAajC,oDAAoD;AACpD,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AAMtB,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAMpB,oDAAoD;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,mDAAmD;AACnD,qDAAqD;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAA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AAEjD,OAAO,EACL,aAAa,EACb,eAAe,EACf,UAAU,GACX,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAAC;AAQhD,oDAAoD;AACpD,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AAMtB,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAMpB,oDAAoD;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAG3C,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,mDAAmD;AACnD,qDAAqD;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
package/dist/npa.d.ts ADDED
@@ -0,0 +1,28 @@
1
+ /**
2
+ * NHS 2015 scheme normal pension age.
3
+ *
4
+ * NPA = the member's State Pension age, with a floor of 65
5
+ * (NHSBSA 2015 Members' Guide V13, May 2024). The SPA timetable
6
+ * is legislated — Pensions Acts 1995/2007/2011/2014 — and
7
+ * reproduced in gov.uk's "State Pension age timetable"
8
+ * (last updated 15 May 2014; the legislated dates have not
9
+ * changed since — the 2023 SPA review left them as enacted).
10
+ *
11
+ * Whole years only. The Acts phase each rise through narrow
12
+ * transitional birth cohorts whose exact SPA is 65/66/67 plus
13
+ * some months; this function returns the NEXT whole year for
14
+ * those cohorts (66/67/68). Rounding up is member-conservative,
15
+ * in the same spirit as the ERF part-month round-up (GAD 2019
16
+ * guidance §2.3): a projection anchored on the later NPA can
17
+ * understate early-retirement pension by a few months' factor,
18
+ * never overstate it. Callers needing month-exact SPA for the
19
+ * transitional cohorts need the per-cohort tables in the Acts,
20
+ * which this library deliberately does not transcribe.
21
+ */
22
+ /**
23
+ * Normal pension age for a 2015-scheme member born on
24
+ * `dateOfBirth`, in whole years (see the module header for the
25
+ * transitional-cohort rounding). The result is what
26
+ * `projectPension` expects as its `npa` input.
27
+ */
28
+ export declare function normalPensionAge(dateOfBirth: Date): number;
package/dist/npa.js ADDED
@@ -0,0 +1,60 @@
1
+ /**
2
+ * NHS 2015 scheme normal pension age.
3
+ *
4
+ * NPA = the member's State Pension age, with a floor of 65
5
+ * (NHSBSA 2015 Members' Guide V13, May 2024). The SPA timetable
6
+ * is legislated — Pensions Acts 1995/2007/2011/2014 — and
7
+ * reproduced in gov.uk's "State Pension age timetable"
8
+ * (last updated 15 May 2014; the legislated dates have not
9
+ * changed since — the 2023 SPA review left them as enacted).
10
+ *
11
+ * Whole years only. The Acts phase each rise through narrow
12
+ * transitional birth cohorts whose exact SPA is 65/66/67 plus
13
+ * some months; this function returns the NEXT whole year for
14
+ * those cohorts (66/67/68). Rounding up is member-conservative,
15
+ * in the same spirit as the ERF part-month round-up (GAD 2019
16
+ * guidance §2.3): a projection anchored on the later NPA can
17
+ * understate early-retirement pension by a few months' factor,
18
+ * never overstate it. Callers needing month-exact SPA for the
19
+ * transitional cohorts need the per-cohort tables in the Acts,
20
+ * which this library deliberately does not transcribe.
21
+ */
22
+ import { invariant } from './errors.js';
23
+ /**
24
+ * 2015 scheme floor (Members' Guide V13). Everyone born before
25
+ * the first band below has SPA ≤ 65 (women's pre-equalisation
26
+ * SPA was lower still), so the floor is their NPA.
27
+ */
28
+ const NPA_FLOOR = 65;
29
+ /**
30
+ * Each band starts where the timetable first exceeds the
31
+ * previous whole year; the value is that rise's target age.
32
+ * Boundaries are dates of birth from gov.uk's timetable:
33
+ * - 6 Dec 1953 — first cohort with SPA above 65
34
+ * (Pensions Act 2011; phased to 6 Oct 1954, then exactly 66)
35
+ * - 6 Apr 1960 — first cohort above 66, "66 years and 1 month"
36
+ * (Pensions Act 2014; phased to 5 Mar 1961, then exactly 67)
37
+ * - 6 Apr 1977 — first cohort above 67
38
+ * (Pensions Act 2007; phased to 5 Apr 1978, then exactly 68)
39
+ */
40
+ const SPA_BANDS = [
41
+ { from: new Date(1953, 11, 6), npa: 66 },
42
+ { from: new Date(1960, 3, 6), npa: 67 },
43
+ { from: new Date(1977, 3, 6), npa: 68 },
44
+ ];
45
+ /**
46
+ * Normal pension age for a 2015-scheme member born on
47
+ * `dateOfBirth`, in whole years (see the module header for the
48
+ * transitional-cohort rounding). The result is what
49
+ * `projectPension` expects as its `npa` input.
50
+ */
51
+ export function normalPensionAge(dateOfBirth) {
52
+ invariant(!Number.isNaN(dateOfBirth.getTime()), 'normalPensionAge: invalid dateOfBirth');
53
+ let npa = NPA_FLOOR;
54
+ for (const band of SPA_BANDS) {
55
+ if (dateOfBirth >= band.from)
56
+ npa = band.npa;
57
+ }
58
+ return npa;
59
+ }
60
+ //# sourceMappingURL=npa.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"npa.js","sourceRoot":"","sources":["../src/npa.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;GAoBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC;;;;GAIG;AACH,MAAM,SAAS,GAAG,EAAE,CAAC;AAErB;;;;;;;;;;GAUG;AACH,MAAM,SAAS,GAAG;IAChB,EAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAC;IACtC,EAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAC;IACrC,EAAC,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC,CAAC,EAAE,GAAG,EAAE,EAAE,EAAC;CAC7B,CAAC;AAEX;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAAC,WAAiB;IAChD,SAAS,CACP,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC,EACpC,uCAAuC,CACxC,CAAC;IACF,IAAI,GAAG,GAAG,SAAS,CAAC;IACpB,KAAK,MAAM,IAAI,IAAI,SAAS,EAAE,CAAC;QAC7B,IAAI,WAAW,IAAI,IAAI,CAAC,IAAI;YAAE,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC"}
@@ -0,0 +1,105 @@
1
+ /**
2
+ * The years BEFORE a statement, estimated for illustration.
3
+ *
4
+ * A member hands over one figure — the pension accrued by their
5
+ * statement's date — and their join date. Everything between
6
+ * the two is unknown: this library has no route to anyone's
7
+ * year-by-year earnings. Without this the chart can only begin
8
+ * at the statement, and the join date — which the form asks for,
9
+ * visibly — does nothing at all.
10
+ *
11
+ * This fills that gap the only honest way available. It asks
12
+ * what FLAT pensionable pay, in today's money, would have
13
+ * produced exactly the balance the member states, over exactly
14
+ * the years they say they were in the scheme — and then walks
15
+ * that pay forward as the illustration.
16
+ *
17
+ * ── What it is and is not ───────────────────────────
18
+ *
19
+ * It is **for plotting**. It gives the built-up arm a shape and
20
+ * a starting point, and it is drawn in the same line as the
21
+ * rest because it is the same pension. What makes it honest is
22
+ * the disclosure beside it, not a different colour.
23
+ *
24
+ * It is **not a reconstruction of anyone's career**. Real
25
+ * earnings are not flat: the statement this was checked against
26
+ * runs £42k, £33k, £37k, £51k across four years, and no single
27
+ * figure produces that shape. What the estimate gets right is
28
+ * the ENDPOINT, exactly, and the trajectory approximately.
29
+ *
30
+ * It is **not an input to the projection**. Nothing after the
31
+ * statement reads it; the forward figures use the pay the
32
+ * member actually gave. A pension projected from a pay derived
33
+ * from that same pension would be arguing in a circle.
34
+ *
35
+ * ── Why it is calibrated by a walk, not a formula ───
36
+ *
37
+ * Closed form exists. With flat pay, a constant rate `r` and
38
+ * `n` whole years, the balance is
39
+ *
40
+ * P = (W / 54) x (r^n - 1) / (r - 1)
41
+ *
42
+ * and inverting gives `W = 54 P (r - 1) / (r^n - 1)`. That is
43
+ * the oracle the tests check this against, and it is exact for
44
+ * the case it describes.
45
+ *
46
+ * The code does not use it, because the cases it does not
47
+ * describe are ordinary. A member joining in September has a
48
+ * seven-twelfths first year. A join date before April 2015 is
49
+ * clamped to the scheme's own start. The first row of any walk
50
+ * carries no uplift. Each is a special case in the formula and
51
+ * none in a walk.
52
+ *
53
+ * So the calibration exploits the one structural fact that
54
+ * makes a walk enough: **the ledger is exactly LINEAR in pay.**
55
+ * Every slice is `pay x months / 12 / 54`, and everything after
56
+ * is multiplication by uplift factors and addition. Walk once
57
+ * at a pay of 1, read the closing balance, and that is the
58
+ * whole accumulation factor; the pay that hits any target is
59
+ * one division. One walk, exact, and no second copy of the
60
+ * recurrence to drift out of step with the first.
61
+ *
62
+ * ── Checked against a real statement ────────────────
63
+ *
64
+ * The estimate lands within 0.2% of a real member's own career
65
+ * average, once both are expressed in the same money — see
66
+ * `tests/golden-abs.test.ts`. That check matters more than it
67
+ * looks, because the naive comparison FAILS: the earnings
68
+ * printed on a statement are each year's cash, carrying that
69
+ * year's pay award inside them, so averaging them raw mixes
70
+ * 2021 pounds with 2025 pounds and reads low by a tenth.
71
+ */
72
+ import type { MemberLedger } from './ledger.js';
73
+ import type { Prices } from './prices.js';
74
+ /** An illustrative run-up to a stated balance. */
75
+ export interface EstimatedHistory {
76
+ /**
77
+ * The flat pensionable pay that reproduces the stated
78
+ * balance, in the money of the run it belongs to.
79
+ *
80
+ * Reportable, and worth reporting: it is the one number a
81
+ * reader can sanity-check the illustration against. Wildly
82
+ * below the pay they entered usually means the join date is
83
+ * earlier than their 2015-scheme service really began.
84
+ */
85
+ readonly impliedPay: number;
86
+ /** The walked years, ending exactly on the stated balance. */
87
+ readonly ledger: MemberLedger;
88
+ /** First and last scheme year covered, inclusive. */
89
+ readonly from: number;
90
+ readonly to: number;
91
+ }
92
+ /**
93
+ * Estimate the years from `joinDate` up to a stated balance.
94
+ *
95
+ * Null when there is nothing to draw — a member who joined in
96
+ * or after the statement's own scheme year has no run-up, and
97
+ * inventing one would put pension on the chart before they had
98
+ * any.
99
+ */
100
+ export declare function estimateHistory({ joinDate, statedBalance, statementSchemeYearEnd, prices, }: {
101
+ joinDate: Date;
102
+ statedBalance: number;
103
+ statementSchemeYearEnd: number;
104
+ prices: Prices;
105
+ }): EstimatedHistory | null;
@@ -0,0 +1,115 @@
1
+ /**
2
+ * The years BEFORE a statement, estimated for illustration.
3
+ *
4
+ * A member hands over one figure — the pension accrued by their
5
+ * statement's date — and their join date. Everything between
6
+ * the two is unknown: this library has no route to anyone's
7
+ * year-by-year earnings. Without this the chart can only begin
8
+ * at the statement, and the join date — which the form asks for,
9
+ * visibly — does nothing at all.
10
+ *
11
+ * This fills that gap the only honest way available. It asks
12
+ * what FLAT pensionable pay, in today's money, would have
13
+ * produced exactly the balance the member states, over exactly
14
+ * the years they say they were in the scheme — and then walks
15
+ * that pay forward as the illustration.
16
+ *
17
+ * ── What it is and is not ───────────────────────────
18
+ *
19
+ * It is **for plotting**. It gives the built-up arm a shape and
20
+ * a starting point, and it is drawn in the same line as the
21
+ * rest because it is the same pension. What makes it honest is
22
+ * the disclosure beside it, not a different colour.
23
+ *
24
+ * It is **not a reconstruction of anyone's career**. Real
25
+ * earnings are not flat: the statement this was checked against
26
+ * runs £42k, £33k, £37k, £51k across four years, and no single
27
+ * figure produces that shape. What the estimate gets right is
28
+ * the ENDPOINT, exactly, and the trajectory approximately.
29
+ *
30
+ * It is **not an input to the projection**. Nothing after the
31
+ * statement reads it; the forward figures use the pay the
32
+ * member actually gave. A pension projected from a pay derived
33
+ * from that same pension would be arguing in a circle.
34
+ *
35
+ * ── Why it is calibrated by a walk, not a formula ───
36
+ *
37
+ * Closed form exists. With flat pay, a constant rate `r` and
38
+ * `n` whole years, the balance is
39
+ *
40
+ * P = (W / 54) x (r^n - 1) / (r - 1)
41
+ *
42
+ * and inverting gives `W = 54 P (r - 1) / (r^n - 1)`. That is
43
+ * the oracle the tests check this against, and it is exact for
44
+ * the case it describes.
45
+ *
46
+ * The code does not use it, because the cases it does not
47
+ * describe are ordinary. A member joining in September has a
48
+ * seven-twelfths first year. A join date before April 2015 is
49
+ * clamped to the scheme's own start. The first row of any walk
50
+ * carries no uplift. Each is a special case in the formula and
51
+ * none in a walk.
52
+ *
53
+ * So the calibration exploits the one structural fact that
54
+ * makes a walk enough: **the ledger is exactly LINEAR in pay.**
55
+ * Every slice is `pay x months / 12 / 54`, and everything after
56
+ * is multiplication by uplift factors and addition. Walk once
57
+ * at a pay of 1, read the closing balance, and that is the
58
+ * whole accumulation factor; the pay that hits any target is
59
+ * one division. One walk, exact, and no second copy of the
60
+ * recurrence to drift out of step with the first.
61
+ *
62
+ * ── Checked against a real statement ────────────────
63
+ *
64
+ * The estimate lands within 0.2% of a real member's own career
65
+ * average, once both are expressed in the same money — see
66
+ * `tests/golden-abs.test.ts`. That check matters more than it
67
+ * looks, because the naive comparison FAILS: the earnings
68
+ * printed on a statement are each year's cash, carrying that
69
+ * year's pay award inside them, so averaging them raw mixes
70
+ * 2021 pounds with 2025 pounds and reads low by a tenth.
71
+ */
72
+ import { buildLedger } from './ledger.js';
73
+ import { schemeYearEndDate, seedFromJoinDate } from './seed.js';
74
+ /**
75
+ * Estimate the years from `joinDate` up to a stated balance.
76
+ *
77
+ * Null when there is nothing to draw — a member who joined in
78
+ * or after the statement's own scheme year has no run-up, and
79
+ * inventing one would put pension on the chart before they had
80
+ * any.
81
+ */
82
+ export function estimateHistory({ joinDate, statedBalance, statementSchemeYearEnd, prices, }) {
83
+ const seed = seedFromJoinDate(joinDate);
84
+ const first = seed.atSchemeYearEnd + 1;
85
+ if (first > statementSchemeYearEnd || statedBalance <= 0) {
86
+ return null;
87
+ }
88
+ const walk = (pensionableEarnings) => buildLedger({
89
+ seed,
90
+ pensionableEarnings,
91
+ // Accruing throughout, and drawing far enough out that no
92
+ // retirement factor lands inside the window.
93
+ exitDate: schemeYearEndDate(statementSchemeYearEnd),
94
+ retirementDate: schemeYearEndDate(statementSchemeYearEnd + 60),
95
+ prices,
96
+ drawingFor: () => null,
97
+ through: statementSchemeYearEnd,
98
+ });
99
+ // The accumulation factor, read off the model itself rather
100
+ // than re-derived: pay of 1 in, whole factor out.
101
+ const perPound = walk(1).closingAt(statementSchemeYearEnd);
102
+ // Finite AND positive, spelt out: `<= 0` alone lets NaN
103
+ // through, and a NaN factor would divide into an implied pay
104
+ // that renders as a real figure rather than an absent one.
105
+ if (!Number.isFinite(perPound) || perPound <= 0)
106
+ return null;
107
+ const impliedPay = statedBalance / perPound;
108
+ return {
109
+ impliedPay,
110
+ ledger: walk(impliedPay),
111
+ from: first,
112
+ to: statementSchemeYearEnd,
113
+ };
114
+ }
115
+ //# sourceMappingURL=history.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"history.js","sourceRoot":"","sources":["../../src/pension/history.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AAEH,OAAO,EAAC,WAAW,EAAC,MAAM,aAAa,CAAC;AAGxC,OAAO,EAAC,iBAAiB,EAAE,gBAA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