@casomoltd/nhs-pay 0.12.0 → 0.13.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.
package/README.md CHANGED
@@ -129,6 +129,7 @@ import {projectPension, commute} from '@casomoltd/nhs-pay';
129
129
  const projection = projectPension({
130
130
  kind: 'statement',
131
131
  accruedPension: 5000, // from the Annual Benefit Statement
132
+ statementDate: new Date(2026, 2, 31), // the date it names
132
133
  currentSalary: 54000,
133
134
  dateOfBirth: new Date(1990, 0, 1),
134
135
  exitDate: new Date(2035, 0, 1),
@@ -141,7 +142,7 @@ console.log(projection.factorType); // 'erf'
141
142
  console.log(projection.curve); // chart-ready points
142
143
 
143
144
  const {lumpSum, residualPension} = commute(
144
- projection.annualPension, 1, // take the HMRC max
145
+ projection.annualPension.nominal, 1, // take the HMRC max
145
146
  );
146
147
  ```
147
148
 
@@ -75,7 +75,11 @@ export class FactorTable {
75
75
  + `${policy.rangeWord} range`);
76
76
  }
77
77
  this.kind = kind;
78
- this.provenance = provenance;
78
+ /* Frozen because a table is a process-wide singleton: the
79
+ citation a member's drawing row carries IS this object,
80
+ not a copy, so one write through a ledger row would
81
+ restate the source of every projection after it. */
82
+ this.provenance = Object.freeze(provenance);
79
83
  this.rows = rows;
80
84
  }
81
85
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"factor-table.js","sourceRoot":"","sources":["../../src/gad/factor-table.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EACL,SAAS,EACT,0BAA0B,GAC3B,MAAM,cAAc,CAAC;AAkCtB;;;;;;;GAOG;AACH,MAAM,WAAW,GAAG;IAClB,GAAG,EAAE;QACH,QAAQ,EAAE,IAAI;QACd,6DAA6D;QAC7D,6DAA6D;QAC7D,2DAA2D;QAC3D,6DAA6D;QAC7D,2CAA2C;QAC3C,OAAO,EAAE,CAAC,IAAY,EAAE,IAAY,EAAE,EAAE,CAAC,IAAI,IAAI,IAAI;QACrD,SA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WAAW,qBAAqB;cAC/C,GAAG,MAAM,CAAC,KAAK,MAAM,MAAM,CAAC,MAAM,KAAK;cACvC,GAAG,MAAM,CAAC,IAAI,GAAG,CACtB,CAAC;QACF,IAAI,EAAC,KAAK,EAAE,MAAM,EAAC,GAAG,MAAM,CAAC;QAC7B,IAAI,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,IAAI,MAAM,CAAC,IAAI,GAAG,CAAC,EAAE,CAAC;YACvD,MAAM,IAAI,CAAC,CAAC;YACZ,IAAI,MAAM,IAAI,cAAc,EAAE,CAAC;gBAC7B,MAAM,GAAG,CAAC,CAAC;gBACX,KAAK,IAAI,CAAC,CAAC;YACb,CAAC;QACH,CAAC;QACD,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAEd,CAAC;QACd,MAAM,MAAM,GAAG,GAAG,EAAE,CAAC,MAAM,CAAC,CAAC;QAC7B,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;YACzB,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,MAAM,GAAG,CAAC,CAAC;YAClC,MAAM,IAAI,0BAA0B,CAClC,IAAI,CAAC,UAAU,CAAC,WAAW,EAC3B,KAAK,EACL,MAAM,EACN,IAAI,EACJ,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,GAAG,CAAC,CAC3B,CAAC;QACJ,CAAC;QACD,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
package/dist/index.d.ts CHANGED
@@ -15,20 +15,21 @@ 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 { 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';
18
+ export { ACTIVE_REVAL_BONUS_PCT, IN_SERVICE_REVALUATION, revaluationFor, } from './revaluation.js';
19
+ export type { RevaluationYear } from './revaluation.js';
20
+ export { ACCRUAL_RATE, COMMUTATION_FACTOR, HMRC_LUMP_SUM_CAP_PCT, commute, factorProvenance, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
21
21
  export type { FactorProvenance, FactorTableKind, } from './gad/factor-table.js';
22
22
  export { normalPensionAge } from './npa.js';
23
23
  export type { CommutationResult, PensionEstimationInput, PensionProjectionInput, PensionProjectionResult, PensionStatementInput, ProjectionMoney, ProjectionPoint, } from './pension-projection.js';
24
24
  export { createPrices } from './pension/prices.js';
25
- export type { CpiEntry, Prices } from './pension/prices.js';
25
+ export type { CpiEntry, CpiSource, Prices, } from './pension/prices.js';
26
26
  export { activeRatePct, deferredRatePct, upliftsFor, } from './pension/uplift.js';
27
27
  export type { AppliedUplift, MemberPhase, UpliftSource, } from './pension/uplift.js';
28
28
  export { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
29
29
  export type { LedgerSeed } from './pension/seed.js';
30
30
  export { buildLedger } from './pension/ledger.js';
31
31
  export type { AppliedDrawing, LedgerRequest, LedgerYear, MemberLedger, } from './pension/ledger.js';
32
+ export type { EstimatedHistory } from './pension/history.js';
32
33
  export { HCAS_ZONE_IDS, calculateHcasSupplement, grossSalary, isHcasZoneId, } from './hcas.js';
33
34
  export type { HcasZoneId } from './hcas.js';
34
35
  export { getHcasPcts, getHcasZone, } from './hcas-pcts.js';
package/dist/index.js CHANGED
@@ -12,18 +12,18 @@ 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
+ export { ACTIVE_REVAL_BONUS_PCT, IN_SERVICE_REVALUATION, revaluationFor, } from './revaluation.js';
16
16
  // ── Pension Projection ─────────────────────────────
17
17
  // Deliberate surface: the scenario-level API plus
18
18
  // yearlyAccrual (hub-site builds its pension-growth
19
19
  // chart from it). Date plumbing (periodInYearsMonths,
20
- // npaDate), raw maths (revalue), and factor-table
21
- // internals stay private — factor VALUES are reachable
22
- // solely through retirementFactor/projectPension, which
23
- // own the GAD rounding rules; factor PROVENANCE is data
20
+ // npaDate) and factor-table internals stay private —
21
+ // factor VALUES are reachable solely through
22
+ // retirementFactor/projectPension, which own the GAD
23
+ // rounding rules; factor PROVENANCE is data
24
24
  // (factorProvenance), so consumers cite it, never
25
25
  // hand-type it.
26
- export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, factorProvenance, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
26
+ export { ACCRUAL_RATE, COMMUTATION_FACTOR, HMRC_LUMP_SUM_CAP_PCT, commute, factorProvenance, maxLumpSum, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
27
27
  // ── Normal pension age ───────────────────────────────
28
28
  export { normalPensionAge } from './npa.js';
29
29
  // ── The pension ledger ───────────────────────────────
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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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"}
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,MA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AAe,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;AAShD,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"}
@@ -70,7 +70,7 @@
70
70
  * 2021 pounds with 2025 pounds and reads low by a tenth.
71
71
  */
72
72
  import { buildLedger } from './ledger.js';
73
- import { schemeYearEndDate, seedFromJoinDate } from './seed.js';
73
+ import { firstWalkedYear, schemeYearEndDate, seedFromJoinDate, } from './seed.js';
74
74
  /**
75
75
  * Estimate the years from `joinDate` up to a stated balance.
76
76
  *
@@ -81,7 +81,7 @@ import { schemeYearEndDate, seedFromJoinDate } from './seed.js';
81
81
  */
82
82
  export function estimateHistory({ joinDate, statedBalance, statementSchemeYearEnd, prices, }) {
83
83
  const seed = seedFromJoinDate(joinDate);
84
- const first = seed.atSchemeYearEnd + 1;
84
+ const first = firstWalkedYear(seed);
85
85
  if (first > statementSchemeYearEnd || statedBalance <= 0) {
86
86
  return null;
87
87
  }
@@ -1 +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,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAqB9D;;;;;;;GAOG;AACH,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,aAAa,EACb,sBAAsB,EACtB,MAAM,GAMP;IACC,MAAM,IAAI,GAAG,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IACxC,MAAM,KAAK,GAAG,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;IACvC,IAAI,KAAK,GAAG,sBAAsB,IAAI,aAAa,IAAI,CAAC,EAAE,CAAC;QACzD,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,IAAI,GAAG,CAAC,mBAA2B,EAAE,EAAE,CAAC,WAAW,CAAC;QACxD,IAAI;QACJ,mBAAmB;QACnB,0DAA0D;QAC1D,6CAA6C;QAC7C,QAAQ,EAAE,iBAAiB,CAAC,sBAAsB,CAAC;QACnD,cAAc,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,EAAE,CAAC;QAC9D,MAAM;QACN,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,OAAO,EAA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AAQ,EAAE,iBAAiB,CAAC,sBAAsB,CAAC;QACnD,cAAc,EAAE,iBAAiB,CAAC,sBAAsB,GAAG,EAAE,CAAC;QAC9D,MAAM;QACN,UAAU,EAAE,GAAG,EAAE,CAAC,IAAI;QACtB,OAAO,EAAE,sBAAsB;KAChC,CAAC,CAAC;IAEH,4DAA4D;IAC5D,kDAAkD;IAClD,MAAM,QAAQ,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC,sBAAsB,CAAC,CAAC;IAC3D,wDAAwD;IACxD,6DAA6D;IAC7D,2DAA2D;IAC3D,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,CAAC,IAAI,QAAQ,IAAI,CAAC;QAAE,OAAO,IAAI,CAAC;IAE7D,MAAM,UAAU,GAAG,aAAa,GAAG,QAAQ,CAAC;IAC5C,OAAO;QACL,UAAU;QACV,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC;QACxB,IAAI,EAAE,KAAK;QACX,EAAE,EAAE,sBAAsB;KAC3B,CAAC;AACJ,CAAC"}
@@ -2,12 +2,12 @@
2
2
  * The member's pension as a balance-forward periodic ledger.
3
3
  *
4
4
  * closing(N) = [closing(N−1) × (1 + uplift(N)) + earned(N)]
5
- * × factor(N) − cash(N)
5
+ * × factor(N)
6
6
  *
7
- * One uniform row per scheme year. `factor` is 1 and `cash` is 0
8
- * on every row but the retirement one, so there is no branch in
9
- * the recurrence — only a multiplier that is usually the
10
- * identity, the same trick as an uplift of zero.
7
+ * One uniform row per scheme year. `factor` is 1 on every row but
8
+ * the retirement one, so there is no branch in the recurrence —
9
+ * only a multiplier that is usually the identity, the same trick
10
+ * as an uplift of zero.
11
11
  *
12
12
  * **The order is load-bearing.** The pot is revalued FIRST and
13
13
  * the year's slice added after, so a slice earns no revaluation
@@ -18,24 +18,33 @@
18
18
  * source on every call, never stored, and every row is frozen at
19
19
  * construction.
20
20
  */
21
- import type { FactorProvenance } from '../gad/factor-table.js';
21
+ import type { FactorProvenance, FactorTableKind } from '../gad/factor-table.js';
22
22
  import type { Prices } from './prices.js';
23
23
  import type { AppliedUplift, MemberPhase } from './uplift.js';
24
24
  import type { LedgerSeed } from './seed.js';
25
+ /**
26
+ * 1/54 of pensionable pay, the 2015 CARE accrual rate — NHSBSA
27
+ * 2015 Members' Guide (V13) p.6.
28
+ *
29
+ * Lives beside the recurrence that applies it, so the row's own
30
+ * slice and every figure a consumer reads come from one constant
31
+ * rather than a literal here and a name somewhere else.
32
+ */
33
+ export declare const ACCRUAL_RATE: number;
25
34
  /** The retirement event, recorded on the year it falls in. */
26
35
  export interface AppliedDrawing {
27
36
  /** The retirement date itself — drawing is date-based, by
28
37
  * years and months from NPA, not annual. */
29
38
  readonly on: Date;
30
39
  readonly factor: number;
31
- readonly kind: 'erf' | 'lrf';
32
- /** Which issue of which table the factor came from. */
33
- readonly provenance: FactorProvenance;
34
- /** Pension given up and cash taken, or null if none was. */
35
- readonly commuted: {
36
- readonly pensionGivenUp: number;
37
- readonly lumpSum: number;
38
- } | null;
40
+ /** Which table the factor was read from, or null where none
41
+ * was: retiring at NPA is neither early nor late, and naming
42
+ * a table there would cite an early-retirement reduction to a
43
+ * member who took none. */
44
+ readonly kind: FactorTableKind | null;
45
+ /** Which issue of that table the factor came from. Null
46
+ * exactly when `kind` is — there is no issue to cite. */
47
+ readonly provenance: FactorProvenance | null;
39
48
  }
40
49
  /** One scheme year, accounted for the way the scheme accounts
41
50
  * for it. Every field is nominal £/yr unless said otherwise. */
@@ -48,7 +57,7 @@ export interface LedgerYear {
48
57
  * accruing. In a partial year this is the PAY scaled by months
49
58
  * worked — the 1/54 divisor is never pro-rated. */
50
59
  readonly pensionableEarnings: number | null;
51
- /** pensionableEarnings / 54, or 0. */
60
+ /** pensionableEarnings × {@link ACCRUAL_RATE}, or 0. */
52
61
  readonly earned: number;
53
62
  /**
54
63
  * Whether this year's earnings are the scheme's own figure or
@@ -80,10 +89,10 @@ export interface LedgerYear {
80
89
  readonly revalued: number;
81
90
  /** The retirement transform, on the one row where it happens. */
82
91
  readonly drawing: AppliedDrawing | null;
83
- /** (revalued + earned) × factor − pension given up. Before the
84
- * drawing row an accrued ENTITLEMENT; after it, a pension IN
85
- * PAYMENT — the same money, with `drawing` the dated record of
86
- * the moment it changed character. */
92
+ /** (revalued + earned) × factor. Before the drawing row an
93
+ * accrued ENTITLEMENT; after it, a pension IN PAYMENT — the
94
+ * same money, with `drawing` the dated record of the moment it
95
+ * changed character. */
87
96
  readonly closing: number;
88
97
  }
89
98
  /** Named indices into the ledger, not stored copies of it. */
@@ -134,12 +143,17 @@ export interface LedgerRequest {
134
143
  * is the invariant that catches it.
135
144
  */
136
145
  readonly pensionableEarnings: number;
137
- /** Last day of service. */
146
+ /**
147
+ * A date in the last scheme year of service. Only the year it
148
+ * names is read: the member is active for all of it and the
149
+ * in-service rate stops at its close, so two dates inside one
150
+ * scheme year are the same input — see `rowFor`.
151
+ */
138
152
  readonly exitDate: Date;
139
153
  readonly retirementDate: Date;
140
154
  readonly prices: Prices;
141
- /** Built once, against the balance standing at retirement. */
142
- readonly drawingFor: (revalued: number) => AppliedDrawing | null;
155
+ /** The retirement event, built once for the year it falls in. */
156
+ readonly drawingFor: () => AppliedDrawing | null;
143
157
  /** Last scheme year to walk. */
144
158
  readonly through: number;
145
159
  }
@@ -2,12 +2,12 @@
2
2
  * The member's pension as a balance-forward periodic ledger.
3
3
  *
4
4
  * closing(N) = [closing(N−1) × (1 + uplift(N)) + earned(N)]
5
- * × factor(N) − cash(N)
5
+ * × factor(N)
6
6
  *
7
- * One uniform row per scheme year. `factor` is 1 and `cash` is 0
8
- * on every row but the retirement one, so there is no branch in
9
- * the recurrence — only a multiplier that is usually the
10
- * identity, the same trick as an uplift of zero.
7
+ * One uniform row per scheme year. `factor` is 1 on every row but
8
+ * the retirement one, so there is no branch in the recurrence —
9
+ * only a multiplier that is usually the identity, the same trick
10
+ * as an uplift of zero.
11
11
  *
12
12
  * **The order is load-bearing.** The pot is revalued FIRST and
13
13
  * the year's slice added after, so a slice earns no revaluation
@@ -21,13 +21,22 @@
21
21
  import { invariant } from '../errors.js';
22
22
  import { periodInYearsMonths } from '../dates.js';
23
23
  import { openingUpliftFor, phaseAt } from './uplift.js';
24
- import { schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, } from './seed.js';
25
- /** Complete months from `from` to `to`, capped at a scheme year. */
24
+ import { firstWalkedYear, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, } from './seed.js';
25
+ /**
26
+ * 1/54 of pensionable pay, the 2015 CARE accrual rate — NHSBSA
27
+ * 2015 Members' Guide (V13) p.6.
28
+ *
29
+ * Lives beside the recurrence that applies it, so the row's own
30
+ * slice and every figure a consumer reads come from one constant
31
+ * rather than a literal here and a name somewhere else.
32
+ */
33
+ export const ACCRUAL_RATE = 1 / 54;
34
+ /** Complete months from `from` to `to`. */
26
35
  function completeMonths(from, to) {
27
36
  if (to <= from)
28
37
  return 0;
29
38
  const { years, months } = periodInYearsMonths(from, to);
30
- return Math.min(12, years * 12 + months);
39
+ return years * 12 + months;
31
40
  }
32
41
  /**
33
42
  * Nominal pay for a year, scaled where the year is partial.
@@ -91,12 +100,11 @@ function rowFor(ctx) {
91
100
  : null;
92
101
  const earned = pensionableEarnings === null
93
102
  ? 0
94
- : pensionableEarnings / 54;
103
+ : pensionableEarnings * ACCRUAL_RATE;
95
104
  const drawing = year === retireYear
96
- ? req.drawingFor(revalued + earned)
105
+ ? req.drawingFor()
97
106
  : null;
98
107
  const factor = drawing?.factor ?? 1;
99
- const givenUp = drawing?.commuted?.pensionGivenUp ?? 0;
100
108
  // The one nonsense the shape still permits. An invariant
101
109
  // rather than three row subtypes: nothing about a row's
102
110
  // BEHAVIOUR differs by phase, so there is nothing to dispatch
@@ -112,21 +120,27 @@ function rowFor(ctx) {
112
120
  uplift: uplift === null ? null : Object.freeze(uplift),
113
121
  revalued,
114
122
  drawing: drawing === null ? null : Object.freeze(drawing),
115
- closing: (revalued + earned) * factor - givenUp,
123
+ closing: (revalued + earned) * factor,
116
124
  });
117
125
  }
118
126
  export function buildLedger(req) {
119
127
  const { seed, exitDate, retirementDate, through } = req;
120
128
  const exitYear = schemeYearEndFor(exitDate);
121
129
  const retireYear = schemeYearEndFor(retirementDate);
122
- const first = seed.atSchemeYearEnd + 1;
130
+ const first = firstWalkedYear(seed);
123
131
  const years = [];
124
132
  let opening = seed.opening;
125
133
  for (let year = first; year <= through; year++) {
126
134
  const row = rowFor({
127
135
  year,
128
136
  opening,
129
- isFirst: years.length === 0 && seed.basis === 'derived',
137
+ /* No uplift opens a walk that opens the MEMBERSHIP: there
138
+ is no banked balance to revalue. Read off the seed's
139
+ own content — `accruingFrom` is a date only when service
140
+ begins inside the first walked year — never off which
141
+ route produced it, which the seed's own doc forbids
142
+ anything downstream from asking. */
143
+ isFirst: years.length === 0 && seed.accruingFrom !== null,
130
144
  req, first, exitYear, retireYear,
131
145
  });
132
146
  years.push(row);
@@ -1 +1 @@
1
- {"version":3,"file":"ledger.js","sourceRoot":"","sources":["../../src/pension/ledger.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,mBAAmB,EAAC,MAAM,aAAa,CAAC;AAIhD,OAAO,EAAC,gBAAgB,EAAE,OAAO,EAAC,MAAM,aAAa,CAAC;AAEtD,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,WAAW,CAAC;AA+HnB,oEAAoE;AACpE,SAAS,cAAc,CAAC,IAAU,EAAE,EAAQ;IAC1C,IAAI,EAAE,IAAI,IAAI;QAAE,OAAO,CAAC,CAAC;IACzB,MAAM,EAAC,KAAK,EAAE,MAAM,EAAC,GAAG,mBAAmB,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;IACtD,OAAO,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,KAAK,GAAG,EAAE,GAAG,MAAM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,CAAC;YACvB,CAAC;YACD,IAAI,iBAAiB,CAAC,GAAG,CAAC,aAAa,CAAC,IAAI,IAAI,EAAE,CAAC;gBACjD,KAAK,GAAG,UAAU;oBAChB,CAAC,CAAC,GAAG,CAAC,QAAQ,GAAG,GAAG,CAAC,MAAM;oBAC3B,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC;YAClB,CAAC;QACH,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC,CAAC;IAEF,OAAO,MAAM,CAAC,MAAM,CAAC;QACnB,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,CAAC,IAAU,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,KAAK,CAAC;QACzD,SAAS,EAAE,CAAC,IAAU,EAAE,EAAE,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,EAAE,IAAI,CAAC;QAC3D,SAAS,CAAC,aAAqB;YAC7B,IAAI,aAAa,IAAI,IAAI,CAAC,eAAe,EAAE,CAAC;gBAC1C,OAAO,IAAI,CAAC,OAAO,CAAC;YACtB,CAAC;YACD,MAAM,GAAG,GAAG,MAAM,CAAC,IAAI,CACrB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,aAAa,CACzC,CAAC;YACF,SAAS,CACP,GAAG,KAAK,SAAS,EACjB,eAAe,aAAa,qBAAqB,CAClD,CAAC;YACF,OAAO,GAAG,CAAC,OAAO,CAAC;QACrB,CAAC;QACD,YAAY,EAAE,GAAG,EAAE,CACjB,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,mBAAmB,KAAK,IAAI,CAAC;KAC3D,CAAC,CAAC;AACL,CAAC"}
@@ -41,9 +41,8 @@
41
41
  * here and it is the assumption.
42
42
  *
43
43
  * Reading the published record itself is a different question,
44
- * and `revaluation.ts` answers it: `revaluationFor` for one
45
- * year, `publishedInflationBetween` for a window, both beside
46
- * the table they read.
44
+ * and `revaluation.ts` answers it: `revaluationFor`, beside the
45
+ * table it reads.
47
46
  */
48
47
  /** One year of the September CPI series, and where it came from. */
49
48
  export interface CpiEntry {
@@ -41,9 +41,8 @@
41
41
  * here and it is the assumption.
42
42
  *
43
43
  * Reading the published record itself is a different question,
44
- * and `revaluation.ts` answers it: `revaluationFor` for one
45
- * year, `publishedInflationBetween` for a window, both beside
46
- * the table they read.
44
+ * and `revaluation.ts` answers it: `revaluationFor`, beside the
45
+ * table it reads.
47
46
  */
48
47
  import { appliedOnFor } from '../revaluation.js';
49
48
  /**
@@ -99,7 +98,12 @@ function aprilsBetween(from, to) {
99
98
  export function createPrices(assumedCpi, asOf) {
100
99
  const assumedPct = assumedCpi * 100;
101
100
  return {
102
- assumedFor: (schemeYearEnd) => ({
101
+ /* Frozen at the mint. A `CpiEntry` is the provenance a
102
+ ledger row's rate is READ from rather than a copy of, so
103
+ it reaches a consumer through `row.uplift.from` — one
104
+ level below the freeze on the row itself, and rewritable
105
+ there unless it defends itself. */
106
+ assumedFor: (schemeYearEnd) => Object.freeze({
103
107
  schemeYearEnd, cpi: assumedPct, si: null,
104
108
  }),
105
109
  payAt: (todaysMoney, asAt) => todaysMoney * inflationFactor(asAt, asOf, assumedCpi),
@@ -1 +1 @@
1
- {"version":3,"file":"prices.js","sourceRoot":"","sources":["../../src/pension/prices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8CG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAsD/C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAU,EACV,IAAU,EACV,UAAkB;IAElB,MAAM,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC;IAC3B,MAAM,KAAK,GAAG,KAAK;QACjB,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC;QAC3B,CAAC,CAAC,aAAa,CAAC,IA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edgerSeed {
28
28
  * library produced. */
29
29
  readonly basis: 'given' | 'derived';
30
30
  }
31
+ /**
32
+ * The first scheme year a walk from this seed produces.
33
+ *
34
+ * The seed is a balance standing AT a year end, so the walk opens
35
+ * on the year after it. Both the ledger and the illustrative
36
+ * run-up need that year — one to start its loop, the other to
37
+ * decide there is anything to draw — and a rule spelled out twice
38
+ * is a rule that can drift, so it is read from the seed that
39
+ * carries it.
40
+ */
41
+ export declare function firstWalkedYear(seed: LedgerSeed): number;
31
42
  /**
32
43
  * The scheme year a date falls in, named by the year it ENDS.
33
44
  *
@@ -7,6 +7,19 @@
7
7
  * produced it.
8
8
  */
9
9
  import { invariant } from '../errors.js';
10
+ /**
11
+ * The first scheme year a walk from this seed produces.
12
+ *
13
+ * The seed is a balance standing AT a year end, so the walk opens
14
+ * on the year after it. Both the ledger and the illustrative
15
+ * run-up need that year — one to start its loop, the other to
16
+ * decide there is anything to draw — and a rule spelled out twice
17
+ * is a rule that can drift, so it is read from the seed that
18
+ * carries it.
19
+ */
20
+ export function firstWalkedYear(seed) {
21
+ return seed.atSchemeYearEnd + 1;
22
+ }
10
23
  /**
11
24
  * The scheme year a date falls in, named by the year it ENDS.
12
25
  *
@@ -1 +1 @@
1
- {"version":3,"file":"seed.js","sourceRoot":"","sources":["../../src/pension/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAyBvC;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAU;IACzC,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;QACzB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;QACxB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AACzB,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,iBAAiB,CAAC,aAAqB;IACrD,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,C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AACJ,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,UAAU,gBAAgB,CAAC,QAAc;IAC7C,OAAO;QACL,OAAO,EAAE,CAAC;QACV,eAAe,EAAE,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC;QAC/C,YAAY,EAAE,QAAQ;QACtB,KAAK,EAAE,SAAS;KACjB,CAAC;AACJ,CAAC"}
@@ -123,12 +123,13 @@
123
123
  * it. No figure from it is recorded here — the earnings
124
124
  * beside those rates are the member's and stay out.
125
125
  *
126
- * It settled the ORDER of the accrual loop, previously an
127
- * untested assumption: a year's slice is added AFTER the pot
128
- * is revalued, never before, so a slice earns no revaluation
129
- * in the scheme year it is earned. The other order overstated
130
- * that statement by 3.2%, and every internal test still
131
- * passed. `pension/ledger.ts` is written in that order and
126
+ * It settles the ORDER of the accrual loop, which no internal
127
+ * test can: a year's slice is added AFTER the pot is revalued,
128
+ * never before, so a slice earns no revaluation in the scheme
129
+ * year it is earned. Reversing the two overstates this
130
+ * statement by 3.2% — and every internal test still passes,
131
+ * because each order is self-consistent.
132
+ * `pension/ledger.ts` is written in that order and
132
133
  * `revaluation never touches the year's own slice` holds it
133
134
  * there.
134
135
  *
@@ -154,6 +155,7 @@
154
155
  * 0.6% high over a full career at 2% CPI. That is now fixed,
155
156
  * at the cost described above.
156
157
  */
158
+ import { ACCRUAL_RATE } from './pension/ledger.js';
157
159
  import type { EstimatedHistory } from './pension/history.js';
158
160
  import type { MemberLedger } from './pension/ledger.js';
159
161
  import type { MemberPhase } from './pension/uplift.js';
@@ -219,13 +221,17 @@ export interface PensionStatementInput {
219
221
  accruedPension: number;
220
222
  /**
221
223
  * The date the statement valued that figure at — an ABS
222
- * carries one ("updated to 31/03/2025"), and it is
223
- * typically months behind whenever the member reads it.
224
- * Omit only when the figure really is current: defaulting
225
- * to `today` silently throws away every month of accrual
226
- * and revaluation since the statement was issued.
224
+ * carries one ("updated to 31/03/2025"), and it is typically
225
+ * months behind whenever the member reads it.
226
+ *
227
+ * REQUIRED, because it selects which scheme year the balance
228
+ * seeds. A caller reading a figure off paper and one reading
229
+ * it off a portal today are stating different positions, and
230
+ * a default would pick one of them silently — for a balance
231
+ * a year old, at the cost of every month of accrual and
232
+ * revaluation since. Pass `today` to mean "this is current".
227
233
  */
228
- statementDate?: Date;
234
+ statementDate: Date;
229
235
  /** Current pensionable pay */
230
236
  currentSalary: number;
231
237
  /**
@@ -299,7 +305,11 @@ export interface PensionProjectionResult {
299
305
  accruedNow: ProjectionMoney;
300
306
  /** ERF or LRF factor applied */
301
307
  factor: number;
302
- factorType: FactorTableKind | 'none';
308
+ /** Which factor table `factor` came from, or null where none
309
+ * applied. Retiring at NPA is neither early nor late: the
310
+ * factor is 1 and there is no table to name, so a consumer
311
+ * rendering `factorProvenance` has nothing to render. */
312
+ factorType: FactorTableKind | null;
303
313
  /** Gap between revalued and drawn pension, at retirement */
304
314
  adjustmentAmount: ProjectionMoney;
305
315
  /** Curve data for chart (both views) */
@@ -331,10 +341,21 @@ export interface PensionProjectionResult {
331
341
  * recomputing and disagreeing with the headline. */
332
342
  todaysMoneyLedger: MemberLedger;
333
343
  }
334
- /** 1/54 accrual rate — NHS 2015 CARE scheme */
335
- export declare const ACCRUAL_RATE: number;
344
+ export { ACCRUAL_RATE };
336
345
  /** Commutation: £12 lump sum per £1 pension */
337
346
  export declare const COMMUTATION_FACTOR = 12;
347
+ /**
348
+ * The most of a member's benefits HMRC lets them take as a
349
+ * tax-free lump sum, as a percentage.
350
+ *
351
+ * Exported because it is the only part of the commutation rule
352
+ * a member can be told directly — {@link maxLumpSum} is the cap
353
+ * in pounds, which answers "how much" but never "why that
354
+ * much". A consumer explaining the swap needs this figure, and
355
+ * a consumer that writes its own copy of it is one that can
356
+ * drift from the library that applies it.
357
+ */
358
+ export declare const HMRC_LUMP_SUM_CAP_PCT = 25;
338
359
  /**
339
360
  * Provenance of the in-force table behind a factor kind — the
340
361
  * citation facts (table ref, guidance name, issue date, source
@@ -347,21 +368,35 @@ export declare function factorProvenance(kind: FactorTableKind): FactorProvenanc
347
368
  * Determine whether ERF or LRF applies and return the
348
369
  * factor. The rounding rules (ERF up §2.3, LRF down §3.4)
349
370
  * live on the tables themselves — see FactorTable.
371
+ *
372
+ * `type` is null where neither table applies. Retiring exactly
373
+ * at NPA is not an early retirement with a factor of 1: naming
374
+ * a table there hands a consumer an ERF citation to render at a
375
+ * member who took no reduction.
350
376
  */
351
377
  export declare function retirementFactor(retirementDate: Date, npDate: Date): {
352
378
  factor: number;
353
- type: FactorTableKind | 'none';
379
+ type: FactorTableKind | null;
354
380
  };
355
381
  /** Annual pension accrual for one year of service */
356
382
  export declare function yearlyAccrual(pensionablePay: number): number;
357
383
  /**
358
- * Compound revaluation over a number of years.
359
- * Caller passes CPI + 1.5% for active, CPI for deferred.
360
- */
361
- export declare function revalue(pension: number, annualRate: number, years: number): number;
362
- /**
363
- * Maximum tax-free lump sum under HMRC 25% rule.
364
- * Formula: (20 × pension) / (3 + 20/commutationFactor)
384
+ * Maximum tax-free lump sum under the HMRC cap.
385
+ *
386
+ * The cap is on the lump sum as a share of the CAPITAL VALUE of
387
+ * the benefits, and taking a lump sum lowers the pension that
388
+ * value is measured from — so the answer is a fixed point, not
389
+ * a percentage of anything the caller already holds. With `c`
390
+ * the cap and `f` the commutation factor, capital value is
391
+ * `20 × residual + lumpSum`, and solving
392
+ *
393
+ * L = c × (20 × (P − L/f) + L)
394
+ *
395
+ * for L gives the expression below. Written from
396
+ * {@link HMRC_LUMP_SUM_CAP_PCT} rather than from its
397
+ * rearrangement — the familiar `(20P) / (3 + 20/f)` is this
398
+ * same solution with `c = 0.25` already substituted in, which
399
+ * hides the one number a reader would want to check.
365
400
  */
366
401
  export declare function maxLumpSum(adjustedPension: number): number;
367
402
  /**
@@ -123,12 +123,13 @@
123
123
  * it. No figure from it is recorded here — the earnings
124
124
  * beside those rates are the member's and stay out.
125
125
  *
126
- * It settled the ORDER of the accrual loop, previously an
127
- * untested assumption: a year's slice is added AFTER the pot
128
- * is revalued, never before, so a slice earns no revaluation
129
- * in the scheme year it is earned. The other order overstated
130
- * that statement by 3.2%, and every internal test still
131
- * passed. `pension/ledger.ts` is written in that order and
126
+ * It settles the ORDER of the accrual loop, which no internal
127
+ * test can: a year's slice is added AFTER the pot is revalued,
128
+ * never before, so a slice earns no revaluation in the scheme
129
+ * year it is earned. Reversing the two overstates this
130
+ * statement by 3.2% — and every internal test still passes,
131
+ * because each order is self-consistent.
132
+ * `pension/ledger.ts` is written in that order and
132
133
  * `revaluation never touches the year's own slice` holds it
133
134
  * there.
134
135
  *
@@ -157,18 +158,32 @@
157
158
  import { invariant } from './errors.js';
158
159
  import { npaDate, periodInYearsMonths, yearsBetween, } from './dates.js';
159
160
  import { createPrices } from './pension/prices.js';
160
- import { buildLedger } from './pension/ledger.js';
161
+ import { ACCRUAL_RATE, buildLedger } from './pension/ledger.js';
161
162
  import { estimateHistory } from './pension/history.js';
162
- import { openingUpliftFor } from './pension/uplift.js';
163
+ import { openingUpliftFor, phaseAt } from './pension/uplift.js';
163
164
  import { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, seedFromJoinDate, seedFromStatement, } from './pension/seed.js';
164
165
  import { FactorTable } from './gad/factor-table.js';
165
166
  import { ERF_0_420 } from './gad/erf-2023-06-30.js';
166
167
  import { LRF_0_421 } from './gad/lrf-2023-06-30.js';
167
168
  // ── Constants ───────────────────────────────────────
168
- /** 1/54 accrual rate — NHS 2015 CARE scheme */
169
- export const ACCRUAL_RATE = 1 / 54;
169
+ /* The accrual rate is owned by the ledger that applies it and
170
+ re-exported here, so the record and every figure read off it
171
+ cannot hold two different 1/54s. */
172
+ export { ACCRUAL_RATE };
170
173
  /** Commutation: £12 lump sum per £1 pension */
171
174
  export const COMMUTATION_FACTOR = 12;
175
+ /**
176
+ * The most of a member's benefits HMRC lets them take as a
177
+ * tax-free lump sum, as a percentage.
178
+ *
179
+ * Exported because it is the only part of the commutation rule
180
+ * a member can be told directly — {@link maxLumpSum} is the cap
181
+ * in pounds, which answers "how much" but never "why that
182
+ * much". A consumer explaining the swap needs this figure, and
183
+ * a consumer that writes its own copy of it is one that can
184
+ * drift from the library that applies it.
185
+ */
186
+ export const HMRC_LUMP_SUM_CAP_PCT = 25;
172
187
  // ── Factor Tables ───────────────────────────────────
173
188
  // Which issue is in force is exactly these two constructions —
174
189
  // swap the import when GAD supersedes a table (the two tables
@@ -192,6 +207,11 @@ export function factorProvenance(kind) {
192
207
  * Determine whether ERF or LRF applies and return the
193
208
  * factor. The rounding rules (ERF up §2.3, LRF down §3.4)
194
209
  * live on the tables themselves — see FactorTable.
210
+ *
211
+ * `type` is null where neither table applies. Retiring exactly
212
+ * at NPA is not an early retirement with a factor of 1: naming
213
+ * a table there hands a consumer an ERF citation to render at a
214
+ * member who took no reduction.
195
215
  */
196
216
  export function retirementFactor(retirementDate, npDate) {
197
217
  if (retirementDate >= npDate) {
@@ -199,7 +219,7 @@ export function retirementFactor(retirementDate, npDate) {
199
219
  const period = periodInYearsMonths(npDate, retirementDate);
200
220
  if (period.years === 0 && period.months === 0
201
221
  && period.days === 0) {
202
- return { factor: 1, type: 'none' };
222
+ return { factor: 1, type: null };
203
223
  }
204
224
  return { factor: LRF1.factorFor(period), type: 'lrf' };
205
225
  }
@@ -212,22 +232,29 @@ export function retirementFactor(retirementDate, npDate) {
212
232
  export function yearlyAccrual(pensionablePay) {
213
233
  return pensionablePay * ACCRUAL_RATE;
214
234
  }
215
- /**
216
- * Compound revaluation over a number of years.
217
- * Caller passes CPI + 1.5% for active, CPI for deferred.
218
- */
219
- export function revalue(pension, annualRate, years) {
220
- if (years <= 0)
221
- return pension;
222
- return pension * Math.pow(1 + annualRate, years);
223
- }
224
235
  // ── Commutation ─────────────────────────────────────
225
236
  /**
226
- * Maximum tax-free lump sum under HMRC 25% rule.
227
- * Formula: (20 × pension) / (3 + 20/commutationFactor)
237
+ * Maximum tax-free lump sum under the HMRC cap.
238
+ *
239
+ * The cap is on the lump sum as a share of the CAPITAL VALUE of
240
+ * the benefits, and taking a lump sum lowers the pension that
241
+ * value is measured from — so the answer is a fixed point, not
242
+ * a percentage of anything the caller already holds. With `c`
243
+ * the cap and `f` the commutation factor, capital value is
244
+ * `20 × residual + lumpSum`, and solving
245
+ *
246
+ * L = c × (20 × (P − L/f) + L)
247
+ *
248
+ * for L gives the expression below. Written from
249
+ * {@link HMRC_LUMP_SUM_CAP_PCT} rather than from its
250
+ * rearrangement — the familiar `(20P) / (3 + 20/f)` is this
251
+ * same solution with `c = 0.25` already substituted in, which
252
+ * hides the one number a reader would want to check.
228
253
  */
229
254
  export function maxLumpSum(adjustedPension) {
230
- return (20 * adjustedPension) / (3 + 20 / COMMUTATION_FACTOR);
255
+ const cap = HMRC_LUMP_SUM_CAP_PCT / 100;
256
+ return ((20 * cap * adjustedPension)
257
+ / (1 - cap + (20 * cap) / COMMUTATION_FACTOR));
231
258
  }
232
259
  /**
233
260
  * Calculate commutation at a given fraction of max.
@@ -355,7 +382,7 @@ function resolveProjection(input, today) {
355
382
  // The ONLY place the input variant is read.
356
383
  const seed = isEstimation
357
384
  ? seedFromJoinDate(input.joinDate)
358
- : seedFromBalanceAt(input.accruedPension, input.statementDate ?? today, exitDate, retirementDate, prices);
385
+ : seedFromBalanceAt(input.accruedPension, input.statementDate, exitDate, retirementDate, prices);
359
386
  const { factor, type: factorType } = retirementFactor(retirementDate, npaDate(dateOfBirth, npa));
360
387
  const retireYear = schemeYearEndFor(retirementDate);
361
388
  // Walk five years past the later of NPA and retirement, which
@@ -371,9 +398,10 @@ function resolveProjection(input, today) {
371
398
  drawingFor: () => ({
372
399
  on: retirementDate,
373
400
  factor,
374
- kind: factorType === 'none' ? 'erf' : factorType,
375
- provenance: factorProvenance(factorType === 'none' ? 'erf' : factorType),
376
- commuted: null,
401
+ kind: factorType,
402
+ provenance: factorType === null
403
+ ? null
404
+ : factorProvenance(factorType),
377
405
  }),
378
406
  });
379
407
  // Absent when retirement falls at or before the seed's own
@@ -402,7 +430,7 @@ function resolveProjection(input, today) {
402
430
  : null;
403
431
  return {
404
432
  today, dateOfBirth, exitDate, retirementDate, npa,
405
- prices, ledger, history, isEstimation, factor, factorType,
433
+ ledger, history, isEstimation, factor, factorType,
406
434
  /* The earliest date the ledger holds a balance for, which
407
435
  is the seed's own year end — NOT today.
408
436
 
@@ -531,14 +559,13 @@ function buildCurve(cash, todays) {
531
559
  nominal: from(cash).atDate(on),
532
560
  real: from(todays).atDate(on),
533
561
  accrued: on <= today,
534
- // Compared by scheme YEAR, matching the ledger's own
535
- // rule, not by date: a point sits at a 31 March close, so
536
- // a member who left in January of that year would read as
537
- // deferred on the very year they were still paying in.
538
- phase: row?.phase
539
- ?? (year <= schemeYearEndFor(cash.exitDate)
540
- ? 'active'
541
- : 'deferred'),
562
+ /* Off the row where there is one, and otherwise from the
563
+ SAME rule the row was built by — never a second copy of
564
+ it here. Compared by scheme YEAR, matching the ledger:
565
+ a point sits at a 31 March close, so a member who left
566
+ in January of that year would read as deferred on the
567
+ very year they were still paying in. */
568
+ phase: row?.phase ?? phaseAt(year, schemeYearEndFor(cash.exitDate), schemeYearEndFor(cash.retirementDate)),
542
569
  });
543
570
  }
544
571
  return points;
@@ -1 +1 @@
1
- {"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2JG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EACL,OAAO,EACP,mBAAmB,EACnB,YAAY,GACb,MAAM,YAAY,CAAC;AACpB,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EAAC,WAAW,EAAC,MAAM,qBAAqB,CAA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E,GAAG,iBAAiB,CAAC,IAAI,CAAC,CAAC;QACnC;;;;;;;;;;;;;;;;;;;;;;;;2CAwBmC;QACnC,MAAM,GAAG,GAAG,YAAY,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC;QAC1C;;;;uBAIe;QACf,MAAM,IAAI,GAAG,CAAC,CAAW,EAAE,EAAE,CAC3B,CAAC,CAAC,OAAO,KAAK,IAAI,IAAI,IAAI,IAAI,CAAC,CAAC,OAAO,CAAC,EAAE;YACxC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM;YAClB,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC;QACf,MAAM,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,IAAI,CAC/B,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,aAAa,KAAK,IAAI,CAChC,CAAC;QACF,MAAM,CAAC,IAAI,CAAC;YACV,GAAG;YACH,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,EAAE,CAAC;YAC7B,OAAO,EAAE,EAAE,IAAI,KAAK;YACpB;;;;;sDAK0C;YAC1C,KAAK,EAAE,GAAG,EAAE,KAAK,IAAI,OAAO,CAC1B,IAAI,EACJ,gBAAgB,CAAC,IAAI,CAAC,QAAQ,CAAC,EAC/B,gBAAgB,CAAC,IAAI,CAAC,cAAc,CAAC,CACtC;SACF,CAAC,CAAC;IACL,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
@@ -90,9 +90,6 @@
90
90
  * than guessing for a year not held — which now means only a
91
91
  * year whose order has not yet been made.
92
92
  *
93
- * The projection in pension-projection.ts compounds rather
94
- * than adds — https://github.com/casomoltd/nhs-pay/issues/10
95
- *
96
93
  * ── Not this table ──────────────────────────────────
97
94
  *
98
95
  * Deferred 2015 benefits and all pensions in payment rise by
@@ -147,43 +144,3 @@ export declare function revaluationFor(yearEnd: number): RevaluationYear | null;
147
144
  * deflated a year that had not passed.
148
145
  */
149
146
  export declare function appliedOnFor(yearEnd: number): Date;
150
- /** What prices did between two dates, as far as the published
151
- * orders reach. */
152
- export interface PublishedInflation {
153
- /** Compounded CPI factor for every uplift APPLIED in
154
- * `(from, to]`. 1 when none fall in the window. */
155
- readonly factor: number;
156
- /** The date the last counted uplift was applied, or `from`
157
- * where none were. Everything after it is unpublished and is
158
- * the caller's problem — normally an assumed rate. */
159
- readonly publishedTo: Date;
160
- }
161
- /**
162
- * How much prices rose between two dates, using the Treasury
163
- * Order figures rather than a forecast.
164
- *
165
- * **This exists because a past period is a matter of record.**
166
- * Restating a member's own statement figure in today's money
167
- * means dividing out the inflation since the statement was
168
- * made, and that inflation has already happened and already
169
- * been legislated. Using an assumed CPI there quietly reports
170
- * a forecast as history.
171
- *
172
- * Found by reconciling the statement this file already cites
173
- * (updated to 31/03/2025, linked above). Between its date and
174
- * a reading in August 2026 the orders compound to 1.017 x
175
- * 1.038, where an assumed 2% over the same window gives about
176
- * 1.028 — so the figure was restated some 2.7% light, and
177
- * every projection derived from it inherited the gap.
178
- *
179
- * **The uplift date is what counts, not the scheme year.** Each
180
- * order names the day it applies (1 April through 2022, 6 April
181
- * from 2023), and a member's statement is dated wherever it
182
- * falls between two of them — so the window is tested against
183
- * `appliedOn` and nothing is apportioned within a year.
184
- *
185
- * Returns how far the published record actually reaches, so a
186
- * caller can price the remainder itself rather than being
187
- * handed a number that silently stops early.
188
- */
189
- export declare function publishedInflationBetween(from: Date, to: Date): PublishedInflation;
@@ -90,9 +90,6 @@
90
90
  * than guessing for a year not held — which now means only a
91
91
  * year whose order has not yet been made.
92
92
  *
93
- * The projection in pension-projection.ts compounds rather
94
- * than adds — https://github.com/casomoltd/nhs-pay/issues/10
95
- *
96
93
  * ── Not this table ──────────────────────────────────
97
94
  *
98
95
  * Deferred 2015 benefits and all pensions in payment rise by
@@ -219,52 +216,4 @@ export function appliedOnFor(yearEnd) {
219
216
  // the two conventions sit an hour apart.
220
217
  return new Date(y, m - 1, d);
221
218
  }
222
- /**
223
- * How much prices rose between two dates, using the Treasury
224
- * Order figures rather than a forecast.
225
- *
226
- * **This exists because a past period is a matter of record.**
227
- * Restating a member's own statement figure in today's money
228
- * means dividing out the inflation since the statement was
229
- * made, and that inflation has already happened and already
230
- * been legislated. Using an assumed CPI there quietly reports
231
- * a forecast as history.
232
- *
233
- * Found by reconciling the statement this file already cites
234
- * (updated to 31/03/2025, linked above). Between its date and
235
- * a reading in August 2026 the orders compound to 1.017 x
236
- * 1.038, where an assumed 2% over the same window gives about
237
- * 1.028 — so the figure was restated some 2.7% light, and
238
- * every projection derived from it inherited the gap.
239
- *
240
- * **The uplift date is what counts, not the scheme year.** Each
241
- * order names the day it applies (1 April through 2022, 6 April
242
- * from 2023), and a member's statement is dated wherever it
243
- * falls between two of them — so the window is tested against
244
- * `appliedOn` and nothing is apportioned within a year.
245
- *
246
- * Returns how far the published record actually reaches, so a
247
- * caller can price the remainder itself rather than being
248
- * handed a number that silently stops early.
249
- */
250
- export function publishedInflationBetween(from, to) {
251
- let factor = 1;
252
- let publishedTo = from;
253
- for (const year of IN_SERVICE_REVALUATION) {
254
- // Built as a LOCAL date, matching how every other date in
255
- // this library is constructed. Parsing the ISO string
256
- // instead makes it UTC midnight, and under BST the two
257
- // conventions sit an hour apart — which is nothing in
258
- // money but is enough to stop an exact test being exact,
259
- // and exactness is the only way to tell this arithmetic
260
- // is right.
261
- const [y, m, d] = year.appliedOn.split('-').map(Number);
262
- const applied = new Date(y, m - 1, d);
263
- if (applied > from && applied <= to) {
264
- factor *= 1 + year.septemberCpiPct / 100;
265
- publishedTo = applied;
266
- }
267
- }
268
- return { factor, publishedTo };
269
- }
270
219
  //# sourceMappingURL=revaluation.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"revaluation.js","sourceRoot":"","sources":["../src/revaluation.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;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,OAAO,EAAE,GAAG;QACZ,SAAS,EAAE,YAAY;QACvB,EAAE,EAAE,aAAa;KAClB;IACD;QACE,OAAO,EAAE,IAAI;QACb,eAAe,EAAE,GAAG;QACpB,OAAO,EAAE,GAAG;QACZ,SAAS,EAAE,YAAY;QACvB,EAAE,EAAE,aAAa;KAClB;CACF,CAAC;AAEF;qDACqD;AACrD,MAAM,UAAU,cAAc,CAC5B,OAAe;IAEf,OAAO,sBAAsB,CAAC,IAAI,CAChC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,OAAO,KAAK,OAAO,CACnC,IAAI,IAAI,CAAC;AACZ,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,YAAY,CAAC,OAAe;IAC1C,MAAM,SAAS,GAAG,cAAc,CAAC,OAAO,CAAC,CAAC;IAC1C,IAAI,SAAS,KAAK,IAAI;QAAE,OAAO,IAAI,IAAI,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;IACvD,MAAM,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;IAC7D,0DAA0D;IAC1D,2DAA2D;IAC3D,yCAAyC;IACzC,OAAO,IAAI,IAAI,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC,CAAC;AAC/B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@casomoltd/nhs-pay",
3
- "version": "0.12.0",
3
+ "version": "0.13.0",
4
4
  "description": "NHS Agenda for Change pay scales, pension tiers, regions, and take-home calculator",
5
5
  "homepage": "https://github.com/casomoltd/nhs-pay#readme",
6
6
  "bugs": "https://github.com/casomoltd/nhs-pay/issues",