@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.
- package/README.md +48 -0
- package/dist/award.d.ts +8 -8
- package/dist/award.js +8 -8
- package/dist/circulars/england-md-1-2026r.d.ts +2 -3
- package/dist/circulars/england-md-1-2026r.js +2 -3
- package/dist/circulars/england-md-1-2026r.js.map +1 -1
- package/dist/circulars/ni-hsc-tc8-05-2025.d.ts +2 -2
- package/dist/circulars/ni-hsc-tc8-05-2025.js +2 -2
- package/dist/circulars/scotland-pcs-dd-2025-01.d.ts +2 -3
- package/dist/circulars/scotland-pcs-dd-2025-01.js +2 -3
- package/dist/circulars/scotland-pcs-dd-2025-01.js.map +1 -1
- package/dist/circulars/scotland-pcs-dd-2026-01.d.ts +2 -2
- package/dist/circulars/scotland-pcs-dd-2026-01.js +2 -2
- package/dist/circulars/wales-mdw-01-2025.d.ts +2 -2
- package/dist/circulars/wales-mdw-01-2025.js +2 -2
- package/dist/circulars/wales-mdw-01-2026.d.ts +2 -2
- package/dist/circulars/wales-mdw-01-2026.js +2 -2
- package/dist/format.d.ts +8 -0
- package/dist/format.js +14 -0
- package/dist/format.js.map +1 -1
- package/dist/gad/erf-2023-06-30.d.ts +39 -3
- package/dist/gad/erf-2023-06-30.js +39 -3
- package/dist/gad/erf-2023-06-30.js.map +1 -1
- package/dist/gad/factor-table.d.ts +10 -0
- package/dist/gad/factor-table.js.map +1 -1
- package/dist/gad/lrf-2023-06-30.d.ts +39 -3
- package/dist/gad/lrf-2023-06-30.js +39 -3
- package/dist/gad/lrf-2023-06-30.js.map +1 -1
- package/dist/hcas-pcts.js +3 -1
- package/dist/hcas-pcts.js.map +1 -1
- package/dist/index.d.ts +15 -4
- package/dist/index.js +17 -5
- package/dist/index.js.map +1 -1
- package/dist/npa.d.ts +28 -0
- package/dist/npa.js +60 -0
- package/dist/npa.js.map +1 -0
- package/dist/pension/history.d.ts +105 -0
- package/dist/pension/history.js +115 -0
- package/dist/pension/history.js.map +1 -0
- package/dist/pension/ledger.d.ts +146 -0
- package/dist/pension/ledger.js +193 -0
- package/dist/pension/ledger.js.map +1 -0
- package/dist/pension/prices.d.ts +125 -0
- package/dist/pension/prices.js +108 -0
- package/dist/pension/prices.js.map +1 -0
- package/dist/pension/seed.d.ts +75 -0
- package/dist/pension/seed.js +82 -0
- package/dist/pension/seed.js.map +1 -0
- package/dist/pension/uplift.d.ts +151 -0
- package/dist/pension/uplift.js +135 -0
- package/dist/pension/uplift.js.map +1 -0
- package/dist/pension-projection.d.ts +249 -12
- package/dist/pension-projection.js +406 -101
- package/dist/pension-projection.js.map +1 -1
- package/dist/pension.js +9 -10
- package/dist/pension.js.map +1 -1
- package/dist/post.d.ts +24 -16
- package/dist/post.js +2 -3
- package/dist/post.js.map +1 -1
- package/dist/revaluation.d.ts +189 -0
- package/dist/revaluation.js +270 -0
- package/dist/revaluation.js.map +1 -0
- package/dist/scales.d.ts +17 -10
- package/dist/scales.js +17 -10
- package/dist/scales.js.map +1 -1
- package/dist/take-home.d.ts +9 -5
- package/dist/take-home.js +9 -5
- package/dist/take-home.js.map +1 -1
- package/package.json +2 -2
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the walk starts, and what it starts from.
|
|
3
|
+
*
|
|
4
|
+
* This is the ENTIRETY of the statement-versus-estimation
|
|
5
|
+
* difference: the two input variants are read exactly once, here,
|
|
6
|
+
* to fill this object, and nothing downstream may ask which
|
|
7
|
+
* produced it.
|
|
8
|
+
*/
|
|
9
|
+
import { invariant } from '../errors.js';
|
|
10
|
+
/**
|
|
11
|
+
* The scheme year a date falls in, named by the year it ENDS.
|
|
12
|
+
*
|
|
13
|
+
* The cycle is the scheme's own — 1 April to 31 March — and it
|
|
14
|
+
* is the same one an Annual Benefit Statement closes on: a
|
|
15
|
+
* statement marked *Updated To 31/03/2025* reports scheme year
|
|
16
|
+
* 2025, so its figure seeds that row's close untouched. 1 Apr
|
|
17
|
+
* 2025 and 31 Mar 2026 are both scheme year 2026.
|
|
18
|
+
*/
|
|
19
|
+
export function schemeYearEndFor(date) {
|
|
20
|
+
return date.getMonth() >= 3
|
|
21
|
+
? date.getFullYear() + 1
|
|
22
|
+
: date.getFullYear();
|
|
23
|
+
}
|
|
24
|
+
/** 31 March of the given scheme year. */
|
|
25
|
+
export function schemeYearEndDate(schemeYearEnd) {
|
|
26
|
+
return new Date(schemeYearEnd, 2, 31);
|
|
27
|
+
}
|
|
28
|
+
/** 1 April opening the given scheme year. */
|
|
29
|
+
export function schemeYearStartDate(schemeYearEnd) {
|
|
30
|
+
return new Date(schemeYearEnd - 1, 3, 1);
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* The scheme year that had already CLOSED by `date` — the year
|
|
34
|
+
* a balance stated on that date belongs to.
|
|
35
|
+
*
|
|
36
|
+
* Taking the day after makes 31 March land on the year it ends
|
|
37
|
+
* rather than the one before it. Shared with the caller that
|
|
38
|
+
* picks the real-terms anchor, which has to know the seed's year
|
|
39
|
+
* BEFORE a `Prices` exists to build the seed with.
|
|
40
|
+
*/
|
|
41
|
+
export function schemeYearClosedBy(date) {
|
|
42
|
+
const dayAfter = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
|
|
43
|
+
return schemeYearEndFor(dayAfter) - 1;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Route 1: the scheme has already told us the balance.
|
|
47
|
+
*
|
|
48
|
+
* Precondition: `statementDate` IS a scheme year end (31 March).
|
|
49
|
+
* A mid-year statement date is a caller error, not a value to
|
|
50
|
+
* round — the accrued figure would not correspond to any closing
|
|
51
|
+
* balance. Throw; never silently snap to a year end.
|
|
52
|
+
*
|
|
53
|
+
* Yields basis 'given', and `accruingFrom` null: the first walked
|
|
54
|
+
* year is the one AFTER the statement's, which is always whole.
|
|
55
|
+
*/
|
|
56
|
+
export function seedFromStatement(accruedPension, statementDate) {
|
|
57
|
+
invariant(statementDate.getMonth() === 2 && statementDate.getDate() === 31, 'statementDate must be a scheme year end (31 March), got '
|
|
58
|
+
+ statementDate.toDateString());
|
|
59
|
+
return {
|
|
60
|
+
opening: accruedPension,
|
|
61
|
+
atSchemeYearEnd: statementDate.getFullYear(),
|
|
62
|
+
accruingFrom: null,
|
|
63
|
+
basis: 'given',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Route 2: we compute the balance from the beginning.
|
|
68
|
+
*
|
|
69
|
+
* Opening is zero and the walk starts in the join date's own
|
|
70
|
+
* scheme year, which is a PART year whenever the member did not
|
|
71
|
+
* join on 1 April — hence `accruingFrom`, which scales that
|
|
72
|
+
* year's pay.
|
|
73
|
+
*/
|
|
74
|
+
export function seedFromJoinDate(joinDate) {
|
|
75
|
+
return {
|
|
76
|
+
opening: 0,
|
|
77
|
+
atSchemeYearEnd: schemeYearEndFor(joinDate) - 1,
|
|
78
|
+
accruingFrom: joinDate,
|
|
79
|
+
basis: 'derived',
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=seed.js.map
|
|
@@ -0,0 +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,CAAC,CAAC;AACxC,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,mBAAmB,CAAC,aAAqB;IACvD,OAAO,IAAI,IAAI,CAAC,aAAa,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;AAC3C,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAU;IAC3C,MAAM,QAAQ,GAAG,IAAI,IAAI,CACvB,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CACxD,CAAC;IACF,OAAO,gBAAgB,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;AACxC,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,iBAAiB,CAC/B,cAAsB,EACtB,aAAmB;IAEnB,SAAS,CACP,aAAa,CAAC,QAAQ,EAAE,KAAK,CAAC,IAAI,aAAa,CAAC,OAAO,EAAE,KAAK,EAAE,EAChE,0DAA0D;UACtD,aAAa,CAAC,YAAY,EAAE,CACjC,CAAC;IACF,OAAO;QACL,OAAO,EAAE,cAAc;QACvB,eAAe,EAAE,aAAa,CAAC,WAAW,EAAE;QAC5C,YAAY,EAAE,IAAI;QAClB,KAAK,EAAE,OAAO;KACf,CAAC;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"}
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The uplift rule: a function of PHASE alone.
|
|
3
|
+
*
|
|
4
|
+
* Both published rate columns are pure functions of the CPI
|
|
5
|
+
* figure, verified against every year the library holds:
|
|
6
|
+
*
|
|
7
|
+
* active CPI + 1.5, a negative CPI carried through
|
|
8
|
+
* deferred/paid max(0, CPI), floored
|
|
9
|
+
*
|
|
10
|
+
* `rate = CPI + 1.5` holds on 11 of 11 rows, 2016–2026. The
|
|
11
|
+
* Pensions Increase column of the 2020 Valuation Report App. E
|
|
12
|
+
* equals `max(0, CPI)` on 8 of 8 published years, 2016–2023 —
|
|
13
|
+
* including 2016, where −0.1 CPI gives 1.4 active and 0.0
|
|
14
|
+
* deferred, and 2023's 10.1 spike.
|
|
15
|
+
*
|
|
16
|
+
* So there is no second rate table. The published Pensions
|
|
17
|
+
* Increase figures are a GOLDEN TEST, not production data.
|
|
18
|
+
*
|
|
19
|
+
* Note the direction: CPI is sourced independently from each
|
|
20
|
+
* Order's operative words and the rates derive forward from it.
|
|
21
|
+
* Never the reverse — back-computing CPI as `rate − 1.5` would
|
|
22
|
+
* make the test of the +1.5 rule agree with itself.
|
|
23
|
+
*/
|
|
24
|
+
import type { CpiEntry, CpiSource, Prices } from './prices.js';
|
|
25
|
+
/**
|
|
26
|
+
* The three phases. Ordered by date and DERIVED from the member's
|
|
27
|
+
* own dates: a phase is never "entered", so there are no
|
|
28
|
+
* transitions to guard and no machine to run.
|
|
29
|
+
*
|
|
30
|
+
* FOUNDING ASSUMPTION, and this is where it lives: the phases are
|
|
31
|
+
* TOTALLY ORDERED and each occurs at most once, because the input
|
|
32
|
+
* carries a single exitDate. One unbroken membership — join,
|
|
33
|
+
* contribute, leave, draw. A career break or a return to the
|
|
34
|
+
* scheme cannot be expressed, and would be modelled as continuous
|
|
35
|
+
* active service, OVERSTATING the pension. Relaxing it later
|
|
36
|
+
* means allowing the sequence to repeat, which this shape already
|
|
37
|
+
* permits: phase is computed per year from the member's dates.
|
|
38
|
+
*/
|
|
39
|
+
export type MemberPhase = 'active' | 'deferred' | 'inPayment';
|
|
40
|
+
/** Active until the member leaves, deferred until they draw, in
|
|
41
|
+
* payment after. Derived from dates; never entered.
|
|
42
|
+
*
|
|
43
|
+
* Lives beside the rule it selects, because the rule is a
|
|
44
|
+
* function of phase alone and this is the only way a phase is
|
|
45
|
+
* ever obtained. */
|
|
46
|
+
export declare function phaseAt(year: number, exitYear: number, retireYear: number): MemberPhase;
|
|
47
|
+
/** One uplift, as applied to a member's record. */
|
|
48
|
+
export interface AppliedUplift {
|
|
49
|
+
/** The date the POT moves — 1 April through 2022, 6 April from
|
|
50
|
+
* 2023. Not the order's commencement, and not the Pensions
|
|
51
|
+
* Increase date, which is a third date again. */
|
|
52
|
+
readonly appliedOn: Date;
|
|
53
|
+
/** Percentage points applied to the whole balance. Negative
|
|
54
|
+
* is legal. One rate for the year, never a blend: the phase
|
|
55
|
+
* on the day it lands settles it (see `upliftOpening`). */
|
|
56
|
+
readonly percent: number;
|
|
57
|
+
/** The CPI row this rate derives from. Provenance is READ from
|
|
58
|
+
* here and stored nowhere else, so a figure and its source
|
|
59
|
+
* cannot drift apart. */
|
|
60
|
+
readonly from: CpiEntry;
|
|
61
|
+
}
|
|
62
|
+
/** Where one year's uplift comes from. A single operation, so a
|
|
63
|
+
* phase fixes its rule once and the walker never branches.
|
|
64
|
+
*
|
|
65
|
+
* TOTAL: every scheme year asked for has an uplift. The rate is
|
|
66
|
+
* a `CpiSource` reading and a series has no gaps, so there is no
|
|
67
|
+
* year to answer "none" about. A ROW that carries no uplift —
|
|
68
|
+
* the first of a walk, which opens nothing — says so in its own
|
|
69
|
+
* field, `LedgerYear.uplift`; nullability there is about the
|
|
70
|
+
* walk's first step, not about this rule, and putting it here
|
|
71
|
+
* would make every caller narrow a value it always gets. */
|
|
72
|
+
export type UpliftSource = (schemeYearEnd: number) => AppliedUplift;
|
|
73
|
+
/** CPI + 1.5 points. A negative CPI is carried through, not
|
|
74
|
+
* floored: September 2015's −0.1 gave a 1.4% uplift, not 1.5%. */
|
|
75
|
+
export declare function activeRatePct(cpi: number): number;
|
|
76
|
+
/** Pensions Increase: CPI, floored at zero. Prices falling does
|
|
77
|
+
* not claw a pension back.
|
|
78
|
+
*
|
|
79
|
+
* A DIFFERENT instrument from the one above. The in-service rate
|
|
80
|
+
* comes from the Public Service Pensions Revaluation Order, made
|
|
81
|
+
* under s.9(2) Public Service Pensions Act 2013; this one is
|
|
82
|
+
* Pensions Increase, made by the annual Pensions Increase
|
|
83
|
+
* (Review) Order under s.59 Social Security Pensions Act 1975,
|
|
84
|
+
* and it is what lifts a preserved pension and one in payment.
|
|
85
|
+
* Two orders, two section powers, the same September CPI.
|
|
86
|
+
*
|
|
87
|
+
* Sources: "HM Treasury — 2026 pensions increase multiplier
|
|
88
|
+
* tables, covering note" and "HM Treasury — 2026 pensions
|
|
89
|
+
* increase multiplier tables, Annexes B and C" — see
|
|
90
|
+
* docs/source-archive.md. */
|
|
91
|
+
export declare function deferredRatePct(cpi: number): number;
|
|
92
|
+
/**
|
|
93
|
+
* The whole rule, in one factory.
|
|
94
|
+
*
|
|
95
|
+
* Takes a CPI READER rather than the whole table: the rule is a
|
|
96
|
+
* function of phase and a series, and WHICH series is the
|
|
97
|
+
* caller's question, not this one's. Whatever entry it is handed
|
|
98
|
+
* goes through unbranched — an Order's figure and an assumption
|
|
99
|
+
* are the same arithmetic here, and differ only in the
|
|
100
|
+
* provenance carried out beside the rate.
|
|
101
|
+
*
|
|
102
|
+
* Nothing in a projection calls this directly; both the walk and
|
|
103
|
+
* the seed go through `openingUpliftFor`, which fixes the series
|
|
104
|
+
* once so they cannot choose differently.
|
|
105
|
+
*
|
|
106
|
+
* That the published rates ARE `CPI + 1.5` is not asserted here,
|
|
107
|
+
* because nothing here reads them: the rule is checked against
|
|
108
|
+
* the TABLE, on all eleven rows at once, by
|
|
109
|
+
* `tests/prices.test.ts` — "reproduces every published rate, 11
|
|
110
|
+
* of 11". That check owns it, and it fires whether or not any
|
|
111
|
+
* caller ever asks for a published year.
|
|
112
|
+
*/
|
|
113
|
+
export declare function upliftsFor(phase: MemberPhase, cpiFor: CpiSource): UpliftSource;
|
|
114
|
+
/**
|
|
115
|
+
* The uplift that OPENS the scheme year after
|
|
116
|
+
* `seedSchemeYearEnd` — the one question the seed and the walk
|
|
117
|
+
* must never answer differently.
|
|
118
|
+
*
|
|
119
|
+
* A seed is a balance standing at a year end and the walk's
|
|
120
|
+
* first step revalues it; `seedFromBalanceAt` divides that same
|
|
121
|
+
* step back out of a figure read mid-year. Three coordinates
|
|
122
|
+
* settle the answer — the phase the member is in for the year
|
|
123
|
+
* being OPENED, the year the rate is labelled by, and the CPI
|
|
124
|
+
* series it is read from — and a difference in any one of them
|
|
125
|
+
* stops a member's own stated balance round-tripping, with
|
|
126
|
+
* nothing in the output to show it. Hence one producer that both
|
|
127
|
+
* call: a coordinate spelled out twice is a coordinate that can
|
|
128
|
+
* drift.
|
|
129
|
+
*
|
|
130
|
+
* The rate is labelled by the year that just ENDED, which is why
|
|
131
|
+
* the seed's own year is the argument: SI 2016/438, applied 1
|
|
132
|
+
* April 2016, opens the year ending 31 March 2017. The
|
|
133
|
+
* off-by-one is the scheme's, not ours.
|
|
134
|
+
*
|
|
135
|
+
* ── One rate after the seed ─────────────────────────
|
|
136
|
+
*
|
|
137
|
+
* `assumedFor` is read for every year, whether or not an Order
|
|
138
|
+
* covers it. An Order is a NOMINAL rate, and today's money is
|
|
139
|
+
* this same model at an assumption of ZERO, so one applied
|
|
140
|
+
* inside that run puts a whole year of CPI into a reading
|
|
141
|
+
* defined to hold none — 8.2 points for a member holding a 2024
|
|
142
|
+
* statement, 3.2 for a 2025 one, so the size of it is a property
|
|
143
|
+
* of the paperwork rather than of the member. Nor is the
|
|
144
|
+
* exactness collectable: the year-end figure an Order produces
|
|
145
|
+
* here also carries this library's guess at that year's pay, so
|
|
146
|
+
* there is nothing to check it against until a statement the
|
|
147
|
+
* member has not received.
|
|
148
|
+
*
|
|
149
|
+
* Decided at https://github.com/casomoltd/nhs-pay/issues/13
|
|
150
|
+
*/
|
|
151
|
+
export declare function openingUpliftFor(seedSchemeYearEnd: number, exitDate: Date, retirementDate: Date, prices: Prices): AppliedUplift;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The uplift rule: a function of PHASE alone.
|
|
3
|
+
*
|
|
4
|
+
* Both published rate columns are pure functions of the CPI
|
|
5
|
+
* figure, verified against every year the library holds:
|
|
6
|
+
*
|
|
7
|
+
* active CPI + 1.5, a negative CPI carried through
|
|
8
|
+
* deferred/paid max(0, CPI), floored
|
|
9
|
+
*
|
|
10
|
+
* `rate = CPI + 1.5` holds on 11 of 11 rows, 2016–2026. The
|
|
11
|
+
* Pensions Increase column of the 2020 Valuation Report App. E
|
|
12
|
+
* equals `max(0, CPI)` on 8 of 8 published years, 2016–2023 —
|
|
13
|
+
* including 2016, where −0.1 CPI gives 1.4 active and 0.0
|
|
14
|
+
* deferred, and 2023's 10.1 spike.
|
|
15
|
+
*
|
|
16
|
+
* So there is no second rate table. The published Pensions
|
|
17
|
+
* Increase figures are a GOLDEN TEST, not production data.
|
|
18
|
+
*
|
|
19
|
+
* Note the direction: CPI is sourced independently from each
|
|
20
|
+
* Order's operative words and the rates derive forward from it.
|
|
21
|
+
* Never the reverse — back-computing CPI as `rate − 1.5` would
|
|
22
|
+
* make the test of the +1.5 rule agree with itself.
|
|
23
|
+
*/
|
|
24
|
+
import { ACTIVE_REVAL_BONUS_PCT, appliedOnFor, } from '../revaluation.js';
|
|
25
|
+
import { schemeYearEndFor } from './seed.js';
|
|
26
|
+
/** Active until the member leaves, deferred until they draw, in
|
|
27
|
+
* payment after. Derived from dates; never entered.
|
|
28
|
+
*
|
|
29
|
+
* Lives beside the rule it selects, because the rule is a
|
|
30
|
+
* function of phase alone and this is the only way a phase is
|
|
31
|
+
* ever obtained. */
|
|
32
|
+
export function phaseAt(year, exitYear, retireYear) {
|
|
33
|
+
if (year <= exitYear)
|
|
34
|
+
return 'active';
|
|
35
|
+
return year < retireYear ? 'deferred' : 'inPayment';
|
|
36
|
+
}
|
|
37
|
+
/** CPI + 1.5 points. A negative CPI is carried through, not
|
|
38
|
+
* floored: September 2015's −0.1 gave a 1.4% uplift, not 1.5%. */
|
|
39
|
+
export function activeRatePct(cpi) {
|
|
40
|
+
return cpi + ACTIVE_REVAL_BONUS_PCT;
|
|
41
|
+
}
|
|
42
|
+
/** Pensions Increase: CPI, floored at zero. Prices falling does
|
|
43
|
+
* not claw a pension back.
|
|
44
|
+
*
|
|
45
|
+
* A DIFFERENT instrument from the one above. The in-service rate
|
|
46
|
+
* comes from the Public Service Pensions Revaluation Order, made
|
|
47
|
+
* under s.9(2) Public Service Pensions Act 2013; this one is
|
|
48
|
+
* Pensions Increase, made by the annual Pensions Increase
|
|
49
|
+
* (Review) Order under s.59 Social Security Pensions Act 1975,
|
|
50
|
+
* and it is what lifts a preserved pension and one in payment.
|
|
51
|
+
* Two orders, two section powers, the same September CPI.
|
|
52
|
+
*
|
|
53
|
+
* Sources: "HM Treasury — 2026 pensions increase multiplier
|
|
54
|
+
* tables, covering note" and "HM Treasury — 2026 pensions
|
|
55
|
+
* increase multiplier tables, Annexes B and C" — see
|
|
56
|
+
* docs/source-archive.md. */
|
|
57
|
+
export function deferredRatePct(cpi) {
|
|
58
|
+
return Math.max(0, cpi);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* The whole rule, in one factory.
|
|
62
|
+
*
|
|
63
|
+
* Takes a CPI READER rather than the whole table: the rule is a
|
|
64
|
+
* function of phase and a series, and WHICH series is the
|
|
65
|
+
* caller's question, not this one's. Whatever entry it is handed
|
|
66
|
+
* goes through unbranched — an Order's figure and an assumption
|
|
67
|
+
* are the same arithmetic here, and differ only in the
|
|
68
|
+
* provenance carried out beside the rate.
|
|
69
|
+
*
|
|
70
|
+
* Nothing in a projection calls this directly; both the walk and
|
|
71
|
+
* the seed go through `openingUpliftFor`, which fixes the series
|
|
72
|
+
* once so they cannot choose differently.
|
|
73
|
+
*
|
|
74
|
+
* That the published rates ARE `CPI + 1.5` is not asserted here,
|
|
75
|
+
* because nothing here reads them: the rule is checked against
|
|
76
|
+
* the TABLE, on all eleven rows at once, by
|
|
77
|
+
* `tests/prices.test.ts` — "reproduces every published rate, 11
|
|
78
|
+
* of 11". That check owns it, and it fires whether or not any
|
|
79
|
+
* caller ever asks for a published year.
|
|
80
|
+
*/
|
|
81
|
+
export function upliftsFor(phase, cpiFor) {
|
|
82
|
+
const ratePct = phase === 'active'
|
|
83
|
+
? activeRatePct
|
|
84
|
+
: deferredRatePct;
|
|
85
|
+
return (schemeYearEnd) => {
|
|
86
|
+
const from = cpiFor(schemeYearEnd);
|
|
87
|
+
return {
|
|
88
|
+
appliedOn: appliedOnFor(schemeYearEnd),
|
|
89
|
+
percent: ratePct(from.cpi),
|
|
90
|
+
from,
|
|
91
|
+
};
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* The uplift that OPENS the scheme year after
|
|
96
|
+
* `seedSchemeYearEnd` — the one question the seed and the walk
|
|
97
|
+
* must never answer differently.
|
|
98
|
+
*
|
|
99
|
+
* A seed is a balance standing at a year end and the walk's
|
|
100
|
+
* first step revalues it; `seedFromBalanceAt` divides that same
|
|
101
|
+
* step back out of a figure read mid-year. Three coordinates
|
|
102
|
+
* settle the answer — the phase the member is in for the year
|
|
103
|
+
* being OPENED, the year the rate is labelled by, and the CPI
|
|
104
|
+
* series it is read from — and a difference in any one of them
|
|
105
|
+
* stops a member's own stated balance round-tripping, with
|
|
106
|
+
* nothing in the output to show it. Hence one producer that both
|
|
107
|
+
* call: a coordinate spelled out twice is a coordinate that can
|
|
108
|
+
* drift.
|
|
109
|
+
*
|
|
110
|
+
* The rate is labelled by the year that just ENDED, which is why
|
|
111
|
+
* the seed's own year is the argument: SI 2016/438, applied 1
|
|
112
|
+
* April 2016, opens the year ending 31 March 2017. The
|
|
113
|
+
* off-by-one is the scheme's, not ours.
|
|
114
|
+
*
|
|
115
|
+
* ── One rate after the seed ─────────────────────────
|
|
116
|
+
*
|
|
117
|
+
* `assumedFor` is read for every year, whether or not an Order
|
|
118
|
+
* covers it. An Order is a NOMINAL rate, and today's money is
|
|
119
|
+
* this same model at an assumption of ZERO, so one applied
|
|
120
|
+
* inside that run puts a whole year of CPI into a reading
|
|
121
|
+
* defined to hold none — 8.2 points for a member holding a 2024
|
|
122
|
+
* statement, 3.2 for a 2025 one, so the size of it is a property
|
|
123
|
+
* of the paperwork rather than of the member. Nor is the
|
|
124
|
+
* exactness collectable: the year-end figure an Order produces
|
|
125
|
+
* here also carries this library's guess at that year's pay, so
|
|
126
|
+
* there is nothing to check it against until a statement the
|
|
127
|
+
* member has not received.
|
|
128
|
+
*
|
|
129
|
+
* Decided at https://github.com/casomoltd/nhs-pay/issues/13
|
|
130
|
+
*/
|
|
131
|
+
export function openingUpliftFor(seedSchemeYearEnd, exitDate, retirementDate, prices) {
|
|
132
|
+
const phase = phaseAt(seedSchemeYearEnd + 1, schemeYearEndFor(exitDate), schemeYearEndFor(retirementDate));
|
|
133
|
+
return upliftsFor(phase, prices.assumedFor)(seedSchemeYearEnd);
|
|
134
|
+
}
|
|
135
|
+
//# sourceMappingURL=uplift.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uplift.js","sourceRoot":"","sources":["../../src/pension/uplift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,sBAAsB,EACtB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAkB3C;;;;;oBAKoB;AACpB,MAAM,UAAU,OAAO,CACrB,IAAY,EAAE,QAAgB,EAAE,UAAkB;IAElD,IAAI,IAAI,IAAI,QAAQ;QAAE,OAAO,QAAQ,CAAC;IACtC,OAAO,IAAI,GAAG,UAAU,CAAC,CAAC,CAAC,UAAU,CAAC,CAAC,CAAC,WAAW,CAAC;AACtD,CAAC;AAgCD;kEACkE;AAClE,MAAM,UAAU,aAAa,CAAC,GAAW;IACvC,OAAO,GAAG,GAAG,sBAAsB,CAAC;AACtC,CAAC;AAED;;;;;;;;;;;;;;6BAc6B;AAC7B,MAAM,UAAU,eAAe,CAAC,GAAW;IACzC,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AAC1B,CAAC;AAED;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,UAAU,UAAU,CACxB,KAAkB,EAClB,MAAiB;IAEjB,MAAM,OAAO,GAAG,KAAK,KAAK,QAAQ;QAChC,CAAC,CAAC,aAAa;QACf,CAAC,CAAC,eAAe,CAAC;IAEpB,OAAO,CAAC,aAAa,EAAE,EAAE;QACvB,MAAM,IAAI,GAAG,MAAM,CAAC,aAAa,CAAC,CAAC;QACnC,OAAO;YACL,SAAS,EAAE,YAAY,CAAC,aAAa,CAAC;YACtC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;YAC1B,IAAI;SACL,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoCG;AACH,MAAM,UAAU,gBAAgB,CAC9B,iBAAyB,EACzB,QAAc,EACd,cAAoB,EACpB,MAAc;IAEd,MAAM,KAAK,GAAG,OAAO,CACnB,iBAAiB,GAAG,CAAC,EACrB,gBAAgB,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,cAAc,CAAC,CACjC,CAAC;IACF,OAAO,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,iBAAiB,CAAC,CAAC;AACjE,CAAC"}
|