@casomoltd/nhs-pay 0.30.0 → 0.32.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 +71 -252
- package/dist/bands.d.ts +9 -1
- package/dist/bands.js +20 -0
- package/dist/bands.js.map +1 -1
- package/dist/document-source.d.ts +32 -7
- package/dist/document-source.js +32 -8
- package/dist/document-source.js.map +1 -1
- package/dist/errors.d.ts +57 -11
- package/dist/errors.js +85 -28
- package/dist/errors.js.map +1 -1
- package/dist/factor-basis.d.ts +23 -3
- package/dist/factor-basis.js +40 -28
- package/dist/factor-basis.js.map +1 -1
- package/dist/index.d.ts +16 -14
- package/dist/index.js +9 -8
- package/dist/index.js.map +1 -1
- package/dist/member/benefits.js +25 -13
- package/dist/member/benefits.js.map +1 -1
- package/dist/member/index.d.ts +1 -1
- package/dist/member/input-period.d.ts +4 -4
- package/dist/member/input-period.js +11 -9
- package/dist/member/input-period.js.map +1 -1
- package/dist/member/service.d.ts +4 -0
- package/dist/member/service.js +9 -3
- package/dist/member/service.js.map +1 -1
- package/dist/member/types.d.ts +81 -49
- package/dist/member/types.js.map +1 -1
- package/dist/member/valuation.d.ts +10 -8
- package/dist/member/valuation.js +14 -21
- package/dist/member/valuation.js.map +1 -1
- package/dist/pay-path.d.ts +21 -25
- package/dist/pay-path.js +85 -67
- package/dist/pay-path.js.map +1 -1
- package/dist/pension/ages.d.ts +6 -4
- package/dist/pension/ages.js +6 -4
- package/dist/pension/ages.js.map +1 -1
- package/dist/pension/curve.d.ts +2 -1
- package/dist/pension/curve.js +15 -7
- package/dist/pension/curve.js.map +1 -1
- package/dist/pension/history.d.ts +18 -3
- package/dist/pension/history.js +12 -5
- package/dist/pension/history.js.map +1 -1
- package/dist/pension/ledger.d.ts +15 -9
- package/dist/pension/ledger.js +95 -59
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension/money.d.ts +2 -0
- package/dist/pension/money.js +4 -0
- package/dist/pension/money.js.map +1 -1
- package/dist/pension/prices.d.ts +11 -2
- package/dist/pension/prices.js +35 -14
- package/dist/pension/prices.js.map +1 -1
- package/dist/pension/scheme-year.d.ts +59 -0
- package/dist/pension/scheme-year.js +80 -0
- package/dist/pension/scheme-year.js.map +1 -0
- package/dist/pension/seed.d.ts +66 -50
- package/dist/pension/seed.js +111 -65
- package/dist/pension/seed.js.map +1 -1
- package/dist/pension/uplift.d.ts +38 -54
- package/dist/pension/uplift.js +38 -68
- package/dist/pension/uplift.js.map +1 -1
- package/dist/pension-projection.js +30 -22
- package/dist/pension-projection.js.map +1 -1
- package/dist/post.d.ts +1 -10
- package/dist/post.js +1 -12
- package/dist/post.js.map +1 -1
- package/dist/revaluation.d.ts +56 -41
- package/dist/revaluation.js +76 -62
- package/dist/revaluation.js.map +1 -1
- package/dist/scale-point.d.ts +6 -0
- package/dist/sections/final-salary.d.ts +3 -8
- package/dist/sections/final-salary.js +6 -10
- package/dist/sections/final-salary.js.map +1 -1
- package/dist/sections/section-2015.d.ts +3 -4
- package/dist/sections/section-2015.js +1 -1
- package/dist/sections/section-2015.js.map +1 -1
- package/dist/sources.d.ts +14 -0
- package/dist/sources.js +24 -0
- package/dist/sources.js.map +1 -1
- package/dist/take-home.d.ts +4 -20
- package/dist/take-home.js +3 -23
- package/dist/take-home.js.map +1 -1
- package/package.json +3 -3
package/dist/pension/uplift.d.ts
CHANGED
|
@@ -7,14 +7,16 @@
|
|
|
7
7
|
* active CPI + 1.5, a negative CPI carried through
|
|
8
8
|
* deferred/paid max(0, CPI), floored
|
|
9
9
|
*
|
|
10
|
-
* `rate = CPI + 1.5` holds on
|
|
10
|
+
* `rate = CPI + 1.5` holds on every applied rate held, 2016–2025,
|
|
11
|
+
* in `tests/fixtures/revaluation-applied.csv`. The
|
|
11
12
|
* Pensions Increase column of the 2020 Valuation Report App. E
|
|
12
13
|
* equals `max(0, CPI)` on 8 of 8 published years, 2016–2023 —
|
|
13
14
|
* including 2016, where −0.1 CPI gives 1.4 active and 0.0
|
|
14
15
|
* deferred, and 2023's 10.1 spike.
|
|
15
16
|
*
|
|
16
|
-
* So there is no second rate table. The published
|
|
17
|
-
* Increase figures are
|
|
17
|
+
* So there is no second rate table. The published applied rates
|
|
18
|
+
* and Pensions Increase figures are GOLDEN TESTS, not production
|
|
19
|
+
* data.
|
|
18
20
|
*
|
|
19
21
|
* Note the direction: CPI is sourced independently from each
|
|
20
22
|
* Order's operative words and the rates derive forward from it.
|
|
@@ -22,22 +24,9 @@
|
|
|
22
24
|
* make the test of the +1.5 rule agree with itself.
|
|
23
25
|
*/
|
|
24
26
|
import type { CpiEntry, CpiSource, Prices } from './prices.js';
|
|
25
|
-
import type {
|
|
26
|
-
/**
|
|
27
|
-
|
|
28
|
-
* own dates: a phase is never "entered", so there are no
|
|
29
|
-
* transitions to guard and no machine to run.
|
|
30
|
-
*
|
|
31
|
-
* FOUNDING ASSUMPTION, and this is where it lives: the phases are
|
|
32
|
-
* TOTALLY ORDERED and each occurs at most once, because the input
|
|
33
|
-
* carries a single exitDate. One unbroken membership — join,
|
|
34
|
-
* contribute, leave, draw. A career break or a return to the
|
|
35
|
-
* scheme cannot be expressed, and would be modelled as continuous
|
|
36
|
-
* active service, OVERSTATING the pension. Relaxing it later
|
|
37
|
-
* means allowing the sequence to repeat, which this shape already
|
|
38
|
-
* permits: phase is computed per year from the member's dates.
|
|
39
|
-
*/
|
|
40
|
-
export type MemberPhase = 'active' | 'deferred' | 'inPayment';
|
|
27
|
+
import type { SchemeYearEnd } from './scheme-year.js';
|
|
28
|
+
/** One of {@link MEMBER_PHASES}. */
|
|
29
|
+
export type MemberPhase = (typeof MEMBER_PHASES)[keyof typeof MEMBER_PHASES];
|
|
41
30
|
/** One uplift, as applied to a member's record. */
|
|
42
31
|
export interface AppliedUplift {
|
|
43
32
|
/** The date the POT moves — 1 April through 2022, 6 April from
|
|
@@ -63,23 +52,40 @@ export interface AppliedUplift {
|
|
|
63
52
|
* field, `LedgerYear.uplift`; nullability there is about the
|
|
64
53
|
* walk's first step, not about this rule, and putting it here
|
|
65
54
|
* would make every caller narrow a value it always gets. */
|
|
66
|
-
export type UpliftSource = (schemeYearEnd:
|
|
55
|
+
export type UpliftSource = (schemeYearEnd: SchemeYearEnd) => AppliedUplift;
|
|
56
|
+
/**
|
|
57
|
+
* The three phases. Ordered by date and DERIVED from the member's
|
|
58
|
+
* own dates: a phase is never "entered", so there are no
|
|
59
|
+
* transitions to guard and no machine to run.
|
|
60
|
+
*
|
|
61
|
+
* FOUNDING ASSUMPTION, and this is where it lives: the phases are
|
|
62
|
+
* TOTALLY ORDERED and each occurs at most once, because the input
|
|
63
|
+
* carries a single exitDate. One unbroken membership — join,
|
|
64
|
+
* contribute, leave, draw. A career break or a return to the
|
|
65
|
+
* scheme cannot be expressed, and would be modelled as continuous
|
|
66
|
+
* active service, OVERSTATING the pension. Relaxing it later
|
|
67
|
+
* means allowing the sequence to repeat, which this shape already
|
|
68
|
+
* permits: phase is computed per year from the member's dates.
|
|
69
|
+
*/
|
|
70
|
+
export declare const MEMBER_PHASES: {
|
|
71
|
+
readonly active: "active";
|
|
72
|
+
readonly deferred: "deferred";
|
|
73
|
+
readonly inPayment: "inPayment";
|
|
74
|
+
};
|
|
67
75
|
/** Active until the member leaves, deferred until they draw, in
|
|
68
76
|
* payment after. Derived from dates; never entered.
|
|
69
77
|
*
|
|
70
78
|
* Lives beside the rule it selects, because the rule is a
|
|
71
79
|
* function of phase alone and this is the only way a phase is
|
|
72
80
|
* ever obtained. */
|
|
73
|
-
export declare function phaseAt(year:
|
|
74
|
-
/** CPI + 1.5 points. A negative CPI is carried through, not
|
|
75
|
-
* floored: September 2015's −0.1 gave a 1.4% uplift, not 1.5%. */
|
|
76
|
-
export declare function activeRatePct(cpi: number): number;
|
|
81
|
+
export declare function phaseAt(year: SchemeYearEnd, exitYear: SchemeYearEnd, retireYear: SchemeYearEnd): MemberPhase;
|
|
77
82
|
/** Pensions Increase: CPI, floored at zero. Prices falling does
|
|
78
83
|
* not claw a pension back.
|
|
79
84
|
*
|
|
80
|
-
* A DIFFERENT instrument from the
|
|
81
|
-
*
|
|
82
|
-
*
|
|
85
|
+
* A DIFFERENT instrument from the in-service rate
|
|
86
|
+
* (`activeRatePct`, in `revaluation.ts`), which comes from the
|
|
87
|
+
* Public Service Pensions Revaluation Order, made under s.9(2)
|
|
88
|
+
* Public Service Pensions Act 2013; this one is
|
|
83
89
|
* Pensions Increase, made by the annual Pensions Increase
|
|
84
90
|
* (Review) Order under s.59 Social Security Pensions Act 1975,
|
|
85
91
|
* and it is what lifts a preserved pension and one in payment.
|
|
@@ -107,10 +113,10 @@ export declare function deferredRatePct(cpi: number): number;
|
|
|
107
113
|
*
|
|
108
114
|
* That the published rates ARE `CPI + 1.5` is not asserted here,
|
|
109
115
|
* because nothing here reads them: the rule is checked against
|
|
110
|
-
*
|
|
111
|
-
*
|
|
112
|
-
*
|
|
113
|
-
*
|
|
116
|
+
* every applied rate at once, by `tests/prices.test.ts` —
|
|
117
|
+
* "reproduces every applied rate". That check owns it, and it
|
|
118
|
+
* fires whether or not any caller ever asks for a published
|
|
119
|
+
* year.
|
|
114
120
|
*/
|
|
115
121
|
export declare function upliftsFor(phase: MemberPhase, cpiFor: CpiSource): UpliftSource;
|
|
116
122
|
/**
|
|
@@ -157,26 +163,4 @@ export declare function upliftsFor(phase: MemberPhase, cpiFor: CpiSource): Uplif
|
|
|
157
163
|
* deferred or in-payment rate: the months the pension has run by
|
|
158
164
|
* that April, over twelve. See `firstIncreaseShare`.
|
|
159
165
|
*/
|
|
160
|
-
export declare function openingUpliftFor(seedSchemeYearEnd:
|
|
161
|
-
/**
|
|
162
|
-
* A member's stated balance, on whatever date it is stated —
|
|
163
|
-
* the day they read it, or the day their statement prints. That
|
|
164
|
-
* is a position mid-scheme-year, and a seed is a year-end
|
|
165
|
-
* closing balance, so it has to be carried back to one.
|
|
166
|
-
*
|
|
167
|
-
* In November the April uplift has already been applied to the
|
|
168
|
-
* figure being read, so dividing it out lands on the last
|
|
169
|
-
* year-end closing balance and the walk re-applies it — no
|
|
170
|
-
* double count, and no year of accrual thrown away. On a date
|
|
171
|
-
* before that April the figure already IS the year-end balance
|
|
172
|
-
* and nothing is divided, which is why a statement printed on
|
|
173
|
-
* 31 March passes through untouched.
|
|
174
|
-
*
|
|
175
|
-
* ONE route for both the dated and the undated case, because
|
|
176
|
-
* there is only one question: what was the closing balance at
|
|
177
|
-
* the year end before this date? `seedFromStatement` stays
|
|
178
|
-
* strict about wanting a year end; this is what finds it.
|
|
179
|
-
* Statements print on arbitrary days — 7 November is a real
|
|
180
|
-
* one — so the strict form alone could not serve them.
|
|
181
|
-
*/
|
|
182
|
-
export declare function seedFromBalanceAt(balance: number, asOf: Date, exitDate: Date, retirementDate: Date, prices: Prices): LedgerSeed;
|
|
166
|
+
export declare function openingUpliftFor(seedSchemeYearEnd: SchemeYearEnd, exitDate: Date, retirementDate: Date, prices: Prices): AppliedUplift;
|
package/dist/pension/uplift.js
CHANGED
|
@@ -7,24 +7,45 @@
|
|
|
7
7
|
* active CPI + 1.5, a negative CPI carried through
|
|
8
8
|
* deferred/paid max(0, CPI), floored
|
|
9
9
|
*
|
|
10
|
-
* `rate = CPI + 1.5` holds on
|
|
10
|
+
* `rate = CPI + 1.5` holds on every applied rate held, 2016–2025,
|
|
11
|
+
* in `tests/fixtures/revaluation-applied.csv`. The
|
|
11
12
|
* Pensions Increase column of the 2020 Valuation Report App. E
|
|
12
13
|
* equals `max(0, CPI)` on 8 of 8 published years, 2016–2023 —
|
|
13
14
|
* including 2016, where −0.1 CPI gives 1.4 active and 0.0
|
|
14
15
|
* deferred, and 2023's 10.1 spike.
|
|
15
16
|
*
|
|
16
|
-
* So there is no second rate table. The published
|
|
17
|
-
* Increase figures are
|
|
17
|
+
* So there is no second rate table. The published applied rates
|
|
18
|
+
* and Pensions Increase figures are GOLDEN TESTS, not production
|
|
19
|
+
* data.
|
|
18
20
|
*
|
|
19
21
|
* Note the direction: CPI is sourced independently from each
|
|
20
22
|
* Order's operative words and the rates derive forward from it.
|
|
21
23
|
* Never the reverse — back-computing CPI as `rate − 1.5` would
|
|
22
24
|
* make the test of the +1.5 rule agree with itself.
|
|
23
25
|
*/
|
|
24
|
-
import {
|
|
26
|
+
import { activeRatePct, appliedOnFor } from '../revaluation.js';
|
|
25
27
|
import { invariant } from '../errors.js';
|
|
26
28
|
import { dayAfter, monthsCountingPart, MONTHS_PER_YEAR } from '../dates.js';
|
|
27
|
-
import {
|
|
29
|
+
import { schemeYearAfter, schemeYearEndFor } from './scheme-year.js';
|
|
30
|
+
/**
|
|
31
|
+
* The three phases. Ordered by date and DERIVED from the member's
|
|
32
|
+
* own dates: a phase is never "entered", so there are no
|
|
33
|
+
* transitions to guard and no machine to run.
|
|
34
|
+
*
|
|
35
|
+
* FOUNDING ASSUMPTION, and this is where it lives: the phases are
|
|
36
|
+
* TOTALLY ORDERED and each occurs at most once, because the input
|
|
37
|
+
* carries a single exitDate. One unbroken membership — join,
|
|
38
|
+
* contribute, leave, draw. A career break or a return to the
|
|
39
|
+
* scheme cannot be expressed, and would be modelled as continuous
|
|
40
|
+
* active service, OVERSTATING the pension. Relaxing it later
|
|
41
|
+
* means allowing the sequence to repeat, which this shape already
|
|
42
|
+
* permits: phase is computed per year from the member's dates.
|
|
43
|
+
*/
|
|
44
|
+
export const MEMBER_PHASES = {
|
|
45
|
+
active: 'active',
|
|
46
|
+
deferred: 'deferred',
|
|
47
|
+
inPayment: 'inPayment',
|
|
48
|
+
};
|
|
28
49
|
/** Active until the member leaves, deferred until they draw, in
|
|
29
50
|
* payment after. Derived from dates; never entered.
|
|
30
51
|
*
|
|
@@ -33,20 +54,16 @@ import { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStar
|
|
|
33
54
|
* ever obtained. */
|
|
34
55
|
export function phaseAt(year, exitYear, retireYear) {
|
|
35
56
|
if (year <= exitYear)
|
|
36
|
-
return
|
|
37
|
-
return year < retireYear ?
|
|
38
|
-
}
|
|
39
|
-
/** CPI + 1.5 points. A negative CPI is carried through, not
|
|
40
|
-
* floored: September 2015's −0.1 gave a 1.4% uplift, not 1.5%. */
|
|
41
|
-
export function activeRatePct(cpi) {
|
|
42
|
-
return cpi + ACTIVE_REVAL_BONUS_PCT;
|
|
57
|
+
return MEMBER_PHASES.active;
|
|
58
|
+
return year < retireYear ? MEMBER_PHASES.deferred : MEMBER_PHASES.inPayment;
|
|
43
59
|
}
|
|
44
60
|
/** Pensions Increase: CPI, floored at zero. Prices falling does
|
|
45
61
|
* not claw a pension back.
|
|
46
62
|
*
|
|
47
|
-
* A DIFFERENT instrument from the
|
|
48
|
-
*
|
|
49
|
-
*
|
|
63
|
+
* A DIFFERENT instrument from the in-service rate
|
|
64
|
+
* (`activeRatePct`, in `revaluation.ts`), which comes from the
|
|
65
|
+
* Public Service Pensions Revaluation Order, made under s.9(2)
|
|
66
|
+
* Public Service Pensions Act 2013; this one is
|
|
50
67
|
* Pensions Increase, made by the annual Pensions Increase
|
|
51
68
|
* (Review) Order under s.59 Social Security Pensions Act 1975,
|
|
52
69
|
* and it is what lifts a preserved pension and one in payment.
|
|
@@ -76,13 +93,13 @@ export function deferredRatePct(cpi) {
|
|
|
76
93
|
*
|
|
77
94
|
* That the published rates ARE `CPI + 1.5` is not asserted here,
|
|
78
95
|
* because nothing here reads them: the rule is checked against
|
|
79
|
-
*
|
|
80
|
-
*
|
|
81
|
-
*
|
|
82
|
-
*
|
|
96
|
+
* every applied rate at once, by `tests/prices.test.ts` —
|
|
97
|
+
* "reproduces every applied rate". That check owns it, and it
|
|
98
|
+
* fires whether or not any caller ever asks for a published
|
|
99
|
+
* year.
|
|
83
100
|
*/
|
|
84
101
|
export function upliftsFor(phase, cpiFor) {
|
|
85
|
-
const ratePct = phase ===
|
|
102
|
+
const ratePct = phase === MEMBER_PHASES.active
|
|
86
103
|
? activeRatePct
|
|
87
104
|
: deferredRatePct;
|
|
88
105
|
return (schemeYearEnd) => {
|
|
@@ -139,60 +156,13 @@ export function upliftsFor(phase, cpiFor) {
|
|
|
139
156
|
* that April, over twelve. See `firstIncreaseShare`.
|
|
140
157
|
*/
|
|
141
158
|
export function openingUpliftFor(seedSchemeYearEnd, exitDate, retirementDate, prices) {
|
|
142
|
-
const phase = phaseAt(seedSchemeYearEnd
|
|
159
|
+
const phase = phaseAt(schemeYearAfter(seedSchemeYearEnd), schemeYearEndFor(exitDate), schemeYearEndFor(retirementDate));
|
|
143
160
|
const uplift = upliftsFor(phase, prices.cpiFor)(seedSchemeYearEnd);
|
|
144
161
|
const firstAfterLeaving = seedSchemeYearEnd === schemeYearEndFor(exitDate);
|
|
145
162
|
if (!firstAfterLeaving)
|
|
146
163
|
return uplift;
|
|
147
164
|
return { ...uplift, percent: uplift.percent * firstIncreaseShare(exitDate, uplift.appliedOn) };
|
|
148
165
|
}
|
|
149
|
-
/**
|
|
150
|
-
* A member's stated balance, on whatever date it is stated —
|
|
151
|
-
* the day they read it, or the day their statement prints. That
|
|
152
|
-
* is a position mid-scheme-year, and a seed is a year-end
|
|
153
|
-
* closing balance, so it has to be carried back to one.
|
|
154
|
-
*
|
|
155
|
-
* In November the April uplift has already been applied to the
|
|
156
|
-
* figure being read, so dividing it out lands on the last
|
|
157
|
-
* year-end closing balance and the walk re-applies it — no
|
|
158
|
-
* double count, and no year of accrual thrown away. On a date
|
|
159
|
-
* before that April the figure already IS the year-end balance
|
|
160
|
-
* and nothing is divided, which is why a statement printed on
|
|
161
|
-
* 31 March passes through untouched.
|
|
162
|
-
*
|
|
163
|
-
* ONE route for both the dated and the undated case, because
|
|
164
|
-
* there is only one question: what was the closing balance at
|
|
165
|
-
* the year end before this date? `seedFromStatement` stays
|
|
166
|
-
* strict about wanting a year end; this is what finds it.
|
|
167
|
-
* Statements print on arbitrary days — 7 November is a real
|
|
168
|
-
* one — so the strict form alone could not serve them.
|
|
169
|
-
*/
|
|
170
|
-
export function seedFromBalanceAt(balance, asOf, exitDate, retirementDate, prices) {
|
|
171
|
-
const lastYearEnd = schemeYearClosedBy(asOf);
|
|
172
|
-
/* A figure read after leaving, before the leaving year has closed,
|
|
173
|
-
already holds that year's part slice and its leaver adjustment,
|
|
174
|
-
and the walk would re-walk that year and add both again. Refused
|
|
175
|
-
rather than guessed at. With no month served there is neither,
|
|
176
|
-
and once the year has closed the seed is its closing and the walk
|
|
177
|
-
starts after it: both round-trip. */
|
|
178
|
-
const exitYear = schemeYearEndFor(exitDate);
|
|
179
|
-
const monthsServedBeforeLeaving = monthsCountingPart(schemeYearStartDate(exitYear), dayAfter(exitDate));
|
|
180
|
-
const leavingYearStillOpen = lastYearEnd < exitYear;
|
|
181
|
-
const readAfterServingPartOfLeavingYear = asOf > exitDate
|
|
182
|
-
&& leavingYearStillOpen
|
|
183
|
-
&& monthsServedBeforeLeaving > 0;
|
|
184
|
-
invariant(!readAfterServingPartOfLeavingYear, `a balance stated on ${asOf.toDateString()}, after leaving on `
|
|
185
|
-
+ `${exitDate.toDateString()} in the same scheme year`);
|
|
186
|
-
/* The uplift undone here is the one OPENING year
|
|
187
|
-
`lastYearEnd + 1`, and it is the very object `buildLedger`
|
|
188
|
-
re-applies to that year: inverting the walk exactly is this
|
|
189
|
-
function's only job, so both sides ask `openingUpliftFor`
|
|
190
|
-
rather than each naming the phase, the year and the CPI
|
|
191
|
-
series for themselves. */
|
|
192
|
-
const applied = openingUpliftFor(lastYearEnd, exitDate, retirementDate, prices);
|
|
193
|
-
const already = applied.appliedOn <= asOf;
|
|
194
|
-
return seedFromStatement(already ? balance / (1 + applied.percent / 100) : balance, schemeYearEndDate(lastYearEnd));
|
|
195
|
-
}
|
|
196
166
|
/**
|
|
197
167
|
* A pension's first increase after it begins is proportionate to the
|
|
198
168
|
* months it has run: HM Treasury's 2026 Pensions Increase tables
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"uplift.js","sourceRoot":"","sources":["../../src/pension/uplift.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"uplift.js","sourceRoot":"","s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a,CAAC;YACtC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC;YAC1B,IAAI;SACL,CAAC;IACJ,CAAC,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2CG;AACH,MAAM,UAAU,gBAAgB,CAC9B,iBAAgC,EAChC,QAAc,EACd,cAAoB,EACpB,MAAc;IAEd,MAAM,KAAK,GAAG,OAAO,CACnB,eAAe,CAAC,iBAAiB,CAAC,EAClC,gBAAgB,CAAC,QAAQ,CAAC,EAC1B,gBAAgB,CAAC,cAAc,CAAC,CACjC,CAAC;IACF,MAAM,MAAM,GAAG,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,iBAAiB,CAAC,CAAC;IACnE,MAAM,iBAAiB,GAAG,iBAAiB,KAAK,gBAAgB,CAAC,QAAQ,CAAC,CAAC;IAC3E,IAAI,CAAC,iBAAiB;QAAE,OAAO,MAAM,CAAC;IACtC,OAAO,EAAC,GAAG,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,OAAO,GAAG,kBAAkB,CAC7D,QAAQ,EAAE,MAAM,CAAC,SAAS,CAC3B,EAAC,CAAC;AACL,CAAC;AAED;;;;;;;;;;;;;GAaG;AACH,SAAS,kBAAkB,CAAC,QAAc,EAAE,SAAe;IACzD,MAAM,MAAM,GAAG,kBAAkB,CAAC,QAAQ,CAAC,QAAQ,CAAC,EAAE,SAAS,CAAC,CAAC;IACjE,SAAS,CACP,MAAM,IAAI,eAAe,EACzB,oBAAoB,MAAM,2BAA2B;UACjD,QAAQ,CAAC,YAAY,EAAE,CAC5B,CAAC;IACF,OAAO,MAAM,GAAG,eAAe,CAAC;AAClC,CAAC"}
|
|
@@ -155,9 +155,9 @@ import { earliest, npaDate, periodInYearsMonths, } from './dates.js';
|
|
|
155
155
|
import { createPrices } from './pension/prices.js';
|
|
156
156
|
import { ACCRUAL_RATE, atDrawing, buildLedger, flatPay, } from './pension/ledger.js';
|
|
157
157
|
import { estimateHistory } from './pension/history.js';
|
|
158
|
-
import { seedFromBalanceAt } from './pension/uplift.js';
|
|
159
158
|
import { buildCurve, walkThrough } from './pension/curve.js';
|
|
160
|
-
import {
|
|
159
|
+
import { schemeYearBefore, schemeYearEndDate } from './pension/scheme-year.js';
|
|
160
|
+
import { seedFromBalanceAt, seedFromJoinDate } from './pension/seed.js';
|
|
161
161
|
import { FACTOR_TABLES, factorTable } from './factor-basis.js';
|
|
162
162
|
// ── Constants ───────────────────────────────────────
|
|
163
163
|
/* The accrual rate is owned by the ledger that applies it and
|
|
@@ -289,8 +289,30 @@ export function projectPension(input, today = new Date()) {
|
|
|
289
289
|
todaysMoneyLedger: todays.ledger,
|
|
290
290
|
};
|
|
291
291
|
}
|
|
292
|
+
/** The flat-pay walk from `seed` to the drawing, and the factor the
|
|
293
|
+
* drawing takes. */
|
|
294
|
+
function walkToDrawing(input, seed, prices) {
|
|
295
|
+
const { currentSalary, dateOfBirth, exitDate, retirementDate, npa } = input;
|
|
296
|
+
const { factor, type: factorType } = retirementFactor(retirementDate, npaDate(dateOfBirth, npa));
|
|
297
|
+
const ledger = buildLedger({
|
|
298
|
+
seed,
|
|
299
|
+
payIn: flatPay(currentSalary),
|
|
300
|
+
exitDate,
|
|
301
|
+
retirementDate,
|
|
302
|
+
prices,
|
|
303
|
+
through: walkThrough(retirementDate, npaDate(dateOfBirth, npa)),
|
|
304
|
+
drawingFor: () => ({
|
|
305
|
+
on: retirementDate,
|
|
306
|
+
factor,
|
|
307
|
+
table: factorType === null
|
|
308
|
+
? null
|
|
309
|
+
: { kind: factorType, provenance: factorProvenance(factorType) },
|
|
310
|
+
}),
|
|
311
|
+
});
|
|
312
|
+
return { ledger, factor, factorType };
|
|
313
|
+
}
|
|
292
314
|
function resolveProjection(input, today) {
|
|
293
|
-
const {
|
|
315
|
+
const { dateOfBirth, exitDate, retirementDate, npa, assumedCpi } = input;
|
|
294
316
|
/* The drawing date is used EXACTLY AS GIVEN, to the day.
|
|
295
317
|
Retiring on a birthday, mid-month, or on a scheme year end
|
|
296
318
|
are three different questions and this function answers
|
|
@@ -310,24 +332,8 @@ function resolveProjection(input, today) {
|
|
|
310
332
|
// The ONLY place the input variant is read.
|
|
311
333
|
const seed = isEstimation
|
|
312
334
|
? seedFromJoinDate(input.joinDate)
|
|
313
|
-
: seedFromBalanceAt(input.accruedPension, input.statementDate, exitDate, retirementDate, prices);
|
|
314
|
-
const { factor,
|
|
315
|
-
const through = walkThrough(retirementDate, npaDate(dateOfBirth, npa));
|
|
316
|
-
const ledger = buildLedger({
|
|
317
|
-
seed,
|
|
318
|
-
payIn: flatPay(currentSalary),
|
|
319
|
-
exitDate,
|
|
320
|
-
retirementDate,
|
|
321
|
-
prices,
|
|
322
|
-
through,
|
|
323
|
-
drawingFor: () => ({
|
|
324
|
-
on: retirementDate,
|
|
325
|
-
factor,
|
|
326
|
-
table: factorType === null
|
|
327
|
-
? null
|
|
328
|
-
: { kind: factorType, provenance: factorProvenance(factorType) },
|
|
329
|
-
}),
|
|
330
|
-
});
|
|
335
|
+
: seedFromBalanceAt({ balance: input.accruedPension, asOf: input.statementDate }, exitDate, retirementDate, prices);
|
|
336
|
+
const { ledger, factor, factorType } = walkToDrawing(input, seed, prices);
|
|
331
337
|
const { revalued, drawn } = atDrawing(ledger, retirementDate, factor);
|
|
332
338
|
/* Illustration only, and only where a statement leaves a gap:
|
|
333
339
|
an estimation path already walks from the join date, so
|
|
@@ -353,7 +359,9 @@ function resolveProjection(input, today) {
|
|
|
353
359
|
other; starting the curve at today withholds them.
|
|
354
360
|
Starting at today would also put a past leaving date
|
|
355
361
|
outside the curve's range. */
|
|
356
|
-
curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null
|
|
362
|
+
curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null
|
|
363
|
+
? seed.atSchemeYearEnd
|
|
364
|
+
: schemeYearBefore(history.from))),
|
|
357
365
|
// The leaving row settles on the last day of service, so the
|
|
358
366
|
// entitlement is read there, before any retirement factor.
|
|
359
367
|
accruedAtExit: ledger.accruedAt(exitDate),
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwJG;AAEH,OAAO,EACL,QAAQ,EACR,OAAO,EACP,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,GAC9C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAC,
|
|
1
|
+
{"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAwJG;AAEH,OAAO,EACL,QAAQ,EACR,OAAO,EACP,mBAAmB,GACpB,MAAM,YAAY,CAAC;AAEpB,OAAO,EAAC,YAAY,EAAC,MAAM,qBAAqB,CAAC;AAEjD,OAAO,EACL,YAAY,EAAE,SAAS,EAAE,WAAW,EAAE,OAAO,GAC9C,MAAM,qBAAqB,CAAC;AAC7B,OAAO,EAAC,eAAe,EAAC,MAAM,sBAAsB,CAAC;AAGrD,OAAO,EAAC,UAAU,EAAE,WAAW,EA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AAW;WACnC,KAAK,CAAC,QAAQ,KAAK,SAAS;QACjC,CAAC,CAAC,eAAe,CAAC;YACd,QAAQ,EAAE,KAAK,CAAC,QAAQ;YACxB,aAAa,EAAE,IAAI,CAAC,OAAO;YAC3B,sBAAsB,EAAE,IAAI,CAAC,eAAe;YAC5C,MAAM;SACP,CAAC;QACJ,CAAC,CAAC,IAAI,CAAC;IAET,OAAO;QACL,KAAK,EAAE,WAAW,EAAE,QAAQ,EAAE,cAAc,EAAE,GAAG;QACjD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;QACzD;;;;;;;wCAOgC;QAChC,SAAS,EAAE,QAAQ,CACjB,KAAK,EACL,QAAQ,EACR,iBAAiB,CACf,OAAO,KAAK,IAAI;YACd,CAAC,CAAC,IAAI,CAAC,eAAe;YACtB,CAAC,CAAC,gBAAgB,CAAC,OAAO,CAAC,IAAI,CAAC,CACnC,CACF;QACD,6DAA6D;QAC7D,2DAA2D;QAC3D,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QACzC,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,KAAK;KACrB,CAAC;AACJ,CAAC"}
|
package/dist/post.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* a value by building a new one (see {@link Post.withSalary},
|
|
11
11
|
* {@link Post.withAdjustments}).
|
|
12
12
|
*/
|
|
13
|
-
import type { Nation, PayYear, TaxYear, TakeHomePay,
|
|
13
|
+
import type { Nation, PayYear, TaxYear, TakeHomePay, StudentLoanPlan, TaxCode } from '@casomoltd/paye-calc';
|
|
14
14
|
import type { Role } from './role.js';
|
|
15
15
|
import type { DocumentSource } from './document-source.js';
|
|
16
16
|
import type { PayAward } from './award.js';
|
|
@@ -196,15 +196,6 @@ export declare class Post {
|
|
|
196
196
|
private get _pensionFraction();
|
|
197
197
|
/** Full take-home breakdown (tax, NI, pension, net). */
|
|
198
198
|
get takeHome(): TakeHomePay;
|
|
199
|
-
/**
|
|
200
|
-
* The pension annual allowance this post's year meets, with the
|
|
201
|
-
* scheme's defined-benefit pension input: read it here, not off
|
|
202
|
-
* `takeHome`, whose own allowance has no scheme input. The input is
|
|
203
|
-
* this year's accrual alone (`nhsAnnualAllowance`): a post knows no
|
|
204
|
-
* member history, so revaluation of pension already built up is not
|
|
205
|
-
* counted.
|
|
206
|
-
*/
|
|
207
|
-
get annualAllowance(): AnnualAllowance;
|
|
208
199
|
/** Annual income tax (£). */
|
|
209
200
|
get tax(): number;
|
|
210
201
|
/** Annual national insurance (£). */
|
package/dist/post.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
*/
|
|
13
13
|
import { nationToTaxRegion } from '@casomoltd/paye-calc';
|
|
14
14
|
import { getPensionTiersVO } from './pension.js';
|
|
15
|
-
import {
|
|
15
|
+
import { nhsTakeHome } from './take-home.js';
|
|
16
16
|
import { awardsFor } from './award.js';
|
|
17
17
|
import { afcScaleSource } from './scales.js';
|
|
18
18
|
import { ScaleUnavailable } from './errors.js';
|
|
@@ -201,17 +201,6 @@ export class Post {
|
|
|
201
201
|
taxCode: this.adjustments.taxCode,
|
|
202
202
|
});
|
|
203
203
|
}
|
|
204
|
-
/**
|
|
205
|
-
* The pension annual allowance this post's year meets, with the
|
|
206
|
-
* scheme's defined-benefit pension input: read it here, not off
|
|
207
|
-
* `takeHome`, whose own allowance has no scheme input. The input is
|
|
208
|
-
* this year's accrual alone (`nhsAnnualAllowance`): a post knows no
|
|
209
|
-
* member history, so revaluation of pension already built up is not
|
|
210
|
-
* counted.
|
|
211
|
-
*/
|
|
212
|
-
get annualAllowance() {
|
|
213
|
-
return nhsAnnualAllowance(this.pensionablePay, this._pensionFraction, this.identity.taxYear, nationToTaxRegion(this.identity.nation));
|
|
214
|
-
}
|
|
215
204
|
/** Annual income tax (£). */
|
|
216
205
|
get tax() {
|
|
217
206
|
return this.takeHome.incomeTax;
|
package/dist/post.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"post.js","sourceRoot":"","sources":["../src/post.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AASvD,OAAO,EAAC,iBAAiB,EAAC,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,OAAO,EAAC,SAAS,EAAC,MAAM,YAAY,CAAC;AAErC,OAAO,EAAC,cAAc,EAAC,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAC7C,OAAO,EAAC,gBAAgB,EAAC,MAAM,qBAAqB,CAAC;AACrD,OAAO,EAAC,eAAe,EAAC,MAAM,oBAAoB,CAAC;AAGnD;;6CAE6C;AAC7C,SAAS,WAAW,CAClB,KAAoD,EACpD,KAAQ,EACR,QAA4C;IAE5C,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,CAAC;IAClD,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,gBAAgB,CACxB,QAAQ,CAAC,MAAM,EAAE,QAAQ,CAAC,OAAO,EAAE,KAAK,CACzC,CAAC;IACJ,CAAC;IACD,OAAO,IAAI,CAAC,MAAM,CAAC;AACrB,CAAC;AAED,uEAAuE;AACvE,SAAS,OAAO,CAAC,IAAU;IACzB,QAAQ,IAAI,CAAC,IAAI,EAAE,CAAC;QAClB,KAAK,KAAK;YACR,OAAO,IAAI,CAAC,IAAI,CAAC;QACnB,KAAK,SAAS,CAAC;QACf,KAAK,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