@casomoltd/nhs-pay 0.20.0 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +26 -13
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/pension-projection.d.ts +29 -21
- package/dist/pension-projection.js +25 -22
- package/dist/pension-projection.js.map +1 -1
- package/package.json +6 -4
package/README.md
CHANGED
|
@@ -44,30 +44,42 @@ dependency.
|
|
|
44
44
|
### Look up a band's salary range
|
|
45
45
|
|
|
46
46
|
```ts
|
|
47
|
-
import {getAfcScales} from '@casomoltd/nhs-pay';
|
|
47
|
+
import {AFC_CURRENT_YEAR, getAfcScales} from '@casomoltd/nhs-pay';
|
|
48
48
|
|
|
49
|
-
|
|
49
|
+
// A scale belongs to a pay year and a nation; neither has a default.
|
|
50
|
+
const {bands} = getAfcScales(AFC_CURRENT_YEAR, 'england');
|
|
50
51
|
const band5 = bands.find((b) => b.band === '5')!;
|
|
51
|
-
console.log(band5.
|
|
52
|
-
console.log(band5.
|
|
53
|
-
console.log(band5.points);
|
|
52
|
+
console.log(band5.salary.min); // entry salary
|
|
53
|
+
console.log(band5.salary.max); // top of band
|
|
54
|
+
console.log(band5.points); // all pay points
|
|
54
55
|
```
|
|
55
56
|
|
|
56
57
|
### Calculate take-home for a Band 5 nurse
|
|
57
58
|
|
|
58
59
|
```ts
|
|
59
60
|
import {
|
|
60
|
-
|
|
61
|
+
AFC_CURRENT_YEAR,
|
|
61
62
|
getAfcScales,
|
|
63
|
+
getPensionTiers,
|
|
64
|
+
nationToTaxRegion,
|
|
65
|
+
nhsTakeHome,
|
|
62
66
|
pensionTierRate,
|
|
63
67
|
} from '@casomoltd/nhs-pay';
|
|
68
|
+
import {taxYear} from '@casomoltd/paye-calc';
|
|
64
69
|
|
|
65
|
-
const
|
|
70
|
+
const year = AFC_CURRENT_YEAR;
|
|
71
|
+
const {bands} = getAfcScales(year, 'england');
|
|
66
72
|
const band5 = bands.find((b) => b.band === '5')!;
|
|
67
|
-
const salary = band5.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const
|
|
73
|
+
const salary = band5.salary.min;
|
|
74
|
+
// The contribution tiers are their own dataset, fetched by year and nation.
|
|
75
|
+
const tax = taxYear(year);
|
|
76
|
+
const rate = pensionTierRate(salary, getPensionTiers(tax, 'england'));
|
|
77
|
+
|
|
78
|
+
// The tax year and region are required: a default would silently tax a
|
|
79
|
+
// Scottish member at rUK rates.
|
|
80
|
+
const thp = nhsTakeHome(
|
|
81
|
+
salary, rate / 100, tax, nationToTaxRegion('england'),
|
|
82
|
+
);
|
|
71
83
|
console.log(thp.net); // annual net
|
|
72
84
|
console.log(thp.incomeTax); // annual tax
|
|
73
85
|
console.log(thp.nationalInsurance); // annual NI
|
|
@@ -78,12 +90,13 @@ console.log(thp.pensionDeduction); // annual pension
|
|
|
78
90
|
|
|
79
91
|
```ts
|
|
80
92
|
import {
|
|
93
|
+
AFC_CURRENT_YEAR,
|
|
81
94
|
getAfcScales,
|
|
82
95
|
calculateHcasSupplement,
|
|
83
96
|
} from '@casomoltd/nhs-pay';
|
|
84
97
|
|
|
85
|
-
const {bands, hcas} = getAfcScales();
|
|
86
|
-
const base = bands[0].
|
|
98
|
+
const {bands, hcas} = getAfcScales(AFC_CURRENT_YEAR, 'england');
|
|
99
|
+
const base = bands[0].salary.min;
|
|
87
100
|
const supplement = calculateHcasSupplement(
|
|
88
101
|
base, hcas.innerLondon,
|
|
89
102
|
);
|
package/dist/index.d.ts
CHANGED
|
@@ -41,7 +41,7 @@ export { FACTOR_SOURCES } from './factor-basis.js';
|
|
|
41
41
|
export type { FactorOutcome } from './factor-basis.js';
|
|
42
42
|
export { CASH_CHOICES } from './commutation.js';
|
|
43
43
|
export type { CashChoice } from './commutation.js';
|
|
44
|
-
export { ACCRUAL_RATE, factorProvenance, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
|
|
44
|
+
export { ACCRUAL_RATE, erf2015For, factorProvenance, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
|
|
45
45
|
export { COMMUTATION_FACTOR, HMRC_LUMP_SUM_CAP_PCT, LUMP_SUM_ALLOWANCE, LUMP_SUM_CAPS, nhsCommutationLimits, VALUATION_FACTOR, commute, } from './commutation.js';
|
|
46
46
|
export type { CommutationLimits, CommutationResult, DatedAmount, LumpSumCap, LumpSumLimit, LumpSumLimits, } from './commutation.js';
|
|
47
47
|
export type { FactorProvenance, FactorTableKind, } from './gad/factor-table.js';
|
package/dist/index.js
CHANGED
|
@@ -41,13 +41,13 @@ export { PAY_MEASURES } from './sections/final-salary.js';
|
|
|
41
41
|
export { FACTOR_SOURCES } from './factor-basis.js';
|
|
42
42
|
export { CASH_CHOICES } from './commutation.js';
|
|
43
43
|
// ── Pension Projection ─────────────────────────────
|
|
44
|
-
// The 2015 Section's scenario-level API plus yearlyAccrual (
|
|
45
|
-
//
|
|
44
|
+
// The 2015 Section's scenario-level API, plus yearlyAccrual (one
|
|
45
|
+
// scheme year's accrual) and the period-keyed ERF. Date plumbing
|
|
46
46
|
// and factor-table internals stay private — a factor VALUE is reached
|
|
47
47
|
// only through a function that owns GAD's rounding rules; factor
|
|
48
48
|
// PROVENANCE is data (factorProvenance), so consumers cite it, never
|
|
49
49
|
// hand-type it.
|
|
50
|
-
export { ACCRUAL_RATE, factorProvenance, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
|
|
50
|
+
export { ACCRUAL_RATE, erf2015For, factorProvenance, projectPension, retirementFactor, yearlyAccrual, } from './pension-projection.js';
|
|
51
51
|
// ── Commutation ──────────────────────────────────────
|
|
52
52
|
// Its own module: a choice taken AT retirement, on a pension
|
|
53
53
|
// the projection has already finished producing. Nothing in
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD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|
* that uplift produced. `pension/ledger.ts` holds one row per
|
|
84
84
|
* scheme year; this module is the orchestrator over it.
|
|
85
85
|
*
|
|
86
|
-
* NHSBSA Key Notes — 2015 Scheme Estimates (V2), March 2025
|
|
87
|
-
* → Commutation rate: £12 lump sum per £1 pension
|
|
88
|
-
* → HMRC 25% cap on lump sum
|
|
89
|
-
*
|
|
90
86
|
* ── One rate after the seed ─────────────────────────
|
|
91
87
|
*
|
|
92
88
|
* A projection reads no published Revaluation Order. Every
|
|
@@ -192,8 +188,7 @@ export interface PensionStatementInput {
|
|
|
192
188
|
* it, and the estimate is calibrated to land exactly on the
|
|
193
189
|
* stated balance rather than near it.
|
|
194
190
|
*
|
|
195
|
-
* Omit and the
|
|
196
|
-
* is what it did before this existed.
|
|
191
|
+
* Omit it and the curve starts at the statement.
|
|
197
192
|
*/
|
|
198
193
|
joinDate?: Date;
|
|
199
194
|
dateOfBirth: Date;
|
|
@@ -240,9 +235,8 @@ export interface PensionProjectionResult {
|
|
|
240
235
|
* Reported here rather than left to a consumer reading the
|
|
241
236
|
* curve, because the curve is sampled at scheme year ends: a
|
|
242
237
|
* reader looking for "what have I got now" off the nearest
|
|
243
|
-
* plotted point gets a figure up to a year stale
|
|
244
|
-
*
|
|
245
|
-
* end and the April uplift. */
|
|
238
|
+
* plotted point gets a figure up to a year stale, from before
|
|
239
|
+
* both the year end and the April uplift. */
|
|
246
240
|
accruedNow: ProjectionMoney;
|
|
247
241
|
/** ERF or LRF factor applied */
|
|
248
242
|
factor: number;
|
|
@@ -253,21 +247,10 @@ export interface PensionProjectionResult {
|
|
|
253
247
|
factorType: FactorTableKind | null;
|
|
254
248
|
/** Gap between revalued and drawn pension, at retirement */
|
|
255
249
|
adjustmentAmount: ProjectionMoney;
|
|
256
|
-
/**
|
|
250
|
+
/** One point per scheme year end, in both readings */
|
|
257
251
|
curve: ProjectionPoint[];
|
|
258
252
|
/** Whether estimation path was used */
|
|
259
253
|
isEstimation: boolean;
|
|
260
|
-
/**
|
|
261
|
-
* The year-by-year record every figure above was read off.
|
|
262
|
-
*
|
|
263
|
-
* Additive, and the point of it is that a consumer showing
|
|
264
|
-
* its working cannot disagree with the headline: the rows ARE
|
|
265
|
-
* the derivation, not a re-derivation. A panel that recomputed
|
|
266
|
-
* "statement plus the Orders since" from the published CPI
|
|
267
|
-
* alone missed the in-service 1.5 points and the leaver's
|
|
268
|
-
* part-year blend, so it printed a sum that did not reach the
|
|
269
|
-
* number beside it.
|
|
270
|
-
*/
|
|
271
254
|
/**
|
|
272
255
|
* The illustrative years before the statement, or null when
|
|
273
256
|
* there are none to draw. Its `impliedPay` is in TODAY'S
|
|
@@ -275,6 +258,15 @@ export interface PensionProjectionResult {
|
|
|
275
258
|
* entered, and the one to caption with.
|
|
276
259
|
*/
|
|
277
260
|
estimatedHistory: EstimatedHistory | null;
|
|
261
|
+
/**
|
|
262
|
+
* The year-by-year record every figure above was read off.
|
|
263
|
+
*
|
|
264
|
+
* A consumer showing its working reads these rows rather than
|
|
265
|
+
* re-deriving them, because they ARE the derivation. "Statement
|
|
266
|
+
* plus the Orders since", recomputed from the published CPI
|
|
267
|
+
* alone, misses the in-service 1.5 points and the leaver's
|
|
268
|
+
* part-year blend, and so cannot reach the headline beside it.
|
|
269
|
+
*/
|
|
278
270
|
ledger: MemberLedger;
|
|
279
271
|
/**
|
|
280
272
|
* The price series this run used.
|
|
@@ -323,6 +315,22 @@ export declare function retirementFactor(retirementDate: Date, npDate: Date): {
|
|
|
323
315
|
factor: number;
|
|
324
316
|
type: FactorTableKind | null;
|
|
325
317
|
};
|
|
318
|
+
/**
|
|
319
|
+
* The **2015 Section's** early retirement factor for drawing a
|
|
320
|
+
* whole period before its pension age: {@link retirementFactor} for
|
|
321
|
+
* a caller that holds the period rather than the two dates it
|
|
322
|
+
* spans. The 1995 and 2008 Sections are keyed by age and are not
|
|
323
|
+
* read here. A whole period has no part-month to round, so the
|
|
324
|
+
* table is read at exactly that row. Months are 0 to 11; a period
|
|
325
|
+
* past the last printed row raises
|
|
326
|
+
* {@link RetirementFactorOutOfRange}. It stays when
|
|
327
|
+
* `projectPension` retires: a caller holding a period is not a
|
|
328
|
+
* projection.
|
|
329
|
+
*/
|
|
330
|
+
export declare function erf2015For(period: {
|
|
331
|
+
years: number;
|
|
332
|
+
months: number;
|
|
333
|
+
}): number;
|
|
326
334
|
/** Annual pension accrual for one year of service */
|
|
327
335
|
export declare function yearlyAccrual(pensionablePay: number): number;
|
|
328
336
|
/**
|
|
@@ -83,10 +83,6 @@
|
|
|
83
83
|
* that uplift produced. `pension/ledger.ts` holds one row per
|
|
84
84
|
* scheme year; this module is the orchestrator over it.
|
|
85
85
|
*
|
|
86
|
-
* NHSBSA Key Notes — 2015 Scheme Estimates (V2), March 2025
|
|
87
|
-
* → Commutation rate: £12 lump sum per £1 pension
|
|
88
|
-
* → HMRC 25% cap on lump sum
|
|
89
|
-
*
|
|
90
86
|
* ── One rate after the seed ─────────────────────────
|
|
91
87
|
*
|
|
92
88
|
* A projection reads no published Revaluation Order. Every
|
|
@@ -219,6 +215,21 @@ export function retirementFactor(retirementDate, npDate) {
|
|
|
219
215
|
const period = periodInYearsMonths(retirementDate, npDate);
|
|
220
216
|
return { factor: ERF1.factorFor(period), type: 'erf' };
|
|
221
217
|
}
|
|
218
|
+
/**
|
|
219
|
+
* The **2015 Section's** early retirement factor for drawing a
|
|
220
|
+
* whole period before its pension age: {@link retirementFactor} for
|
|
221
|
+
* a caller that holds the period rather than the two dates it
|
|
222
|
+
* spans. The 1995 and 2008 Sections are keyed by age and are not
|
|
223
|
+
* read here. A whole period has no part-month to round, so the
|
|
224
|
+
* table is read at exactly that row. Months are 0 to 11; a period
|
|
225
|
+
* past the last printed row raises
|
|
226
|
+
* {@link RetirementFactorOutOfRange}. It stays when
|
|
227
|
+
* `projectPension` retires: a caller holding a period is not a
|
|
228
|
+
* projection.
|
|
229
|
+
*/
|
|
230
|
+
export function erf2015For(period) {
|
|
231
|
+
return ERF1.factorFor({ ...period, days: 0 });
|
|
232
|
+
}
|
|
222
233
|
// ── Core Calculations ───────────────────────────────
|
|
223
234
|
/** Annual pension accrual for one year of service */
|
|
224
235
|
export function yearlyAccrual(pensionablePay) {
|
|
@@ -251,11 +262,8 @@ export function projectPension(input, today = new Date()) {
|
|
|
251
262
|
|
|
252
263
|
Cheap, deterministic and pure, so running the model twice
|
|
253
264
|
costs a few microseconds and buys a definition a reader can
|
|
254
|
-
check by hand
|
|
255
|
-
|
|
256
|
-
stated balance, and three failed attempts at placing the
|
|
257
|
-
anchor — all to arrive at 1.47% where the member's own
|
|
258
|
-
arithmetic says 1.5%. */
|
|
265
|
+
check by hand, where deflating arrives at 1.47% against the
|
|
266
|
+
member's own 1.5%. */
|
|
259
267
|
const cash = resolveProjection(input, today);
|
|
260
268
|
const todays = input.assumedCpi === 0
|
|
261
269
|
? cash
|
|
@@ -293,16 +301,12 @@ function resolveProjection(input, today) {
|
|
|
293
301
|
down §3.4) exist precisely for the part-months a date-exact
|
|
294
302
|
answer produces.
|
|
295
303
|
|
|
296
|
-
A
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
a whole number of years apart. That is its simplification
|
|
303
|
-
to declare, in its own methods, and it did not belong in
|
|
304
|
-
here: a library that has already thrown the precision away
|
|
305
|
-
cannot offer it back to the next caller. */
|
|
304
|
+
A consumer may want less than that, such as retirement
|
|
305
|
+
priced in whole years from NPA. It gets that by handing
|
|
306
|
+
this function two dates a whole number of years apart, and
|
|
307
|
+
declares the simplification in its own methods: a library
|
|
308
|
+
that has already thrown the precision away cannot offer it
|
|
309
|
+
back to the next caller. */
|
|
306
310
|
const isEstimation = input.kind === 'estimation';
|
|
307
311
|
const prices = createPrices(assumedCpi, today);
|
|
308
312
|
// The ONLY place the input variant is read.
|
|
@@ -349,9 +353,8 @@ function resolveProjection(input, today) {
|
|
|
349
353
|
The seed IS a balance at a scheme year end, so the months
|
|
350
354
|
between it and today are rows of this walk like any
|
|
351
355
|
other; starting the curve at today withholds them.
|
|
352
|
-
Starting at today also
|
|
353
|
-
the
|
|
354
|
-
floating in space beside a chart that begins after it. */
|
|
356
|
+
Starting at today would also put a past leaving date
|
|
357
|
+
outside the curve's range. */
|
|
355
358
|
curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null ? seed.atSchemeYearEnd : history.from - 1)),
|
|
356
359
|
/* The close of that year, not the exit date — see
|
|
357
360
|
docs/how-it-works.md, "An exit date names a SCHEME
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA
|
|
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,iBAAiB,EAAC,MAAM,qBAAqB,CAAC;AACtD,OAAO,EAAC,UAAU,EAAE,WAAW,EAAC,MAAM,oBAAoB,CAAC;AAE3D,OAAO,EACL,iBAAiB,EACjB,gBAAgB,EAChB,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAC,WAAW,EAAC,MAAM,mBAAmB,CAAC;AA8I9C,uDAAuD;AAEvD;;sCAEsC;AACtC,OA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;8BAIsB;QACtB,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC;QAC3D,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,KAAK;KACrB,CAAC;AACJ,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casomoltd/nhs-pay",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"description": "NHS pay scales and take-home pay, and a member's NHS pension across the 1995, 2008 and 2015 Sections",
|
|
5
5
|
"homepage": "https://github.com/casomoltd/nhs-pay#readme",
|
|
6
6
|
"bugs": "https://github.com/casomoltd/nhs-pay/issues",
|
|
@@ -29,9 +29,11 @@
|
|
|
29
29
|
"jscpd": "jscpd ./src",
|
|
30
30
|
"check:docs": "node scripts/check-api-docs.mjs",
|
|
31
31
|
"lint:md": "remark --frail --quiet --no-stdout --rc-path node_modules/@casomoltd/tooling/bin/skills-lint.config.mjs docs CLAUDE.md README.md",
|
|
32
|
-
"check": "check-gates && npm run lint && npm run typecheck && npm run knip && npm run jscpd && npm run check:docs && npm run check:archive && npm run test && npm run build",
|
|
32
|
+
"check": "check-gates && npm run check:private-refs && npm run check:personal-data && npm run lint && npm run typecheck && npm run knip && npm run jscpd && npm run check:docs && npm run check:archive && npm run test && npm run build",
|
|
33
33
|
"prepare": "husky",
|
|
34
|
-
"check:archive": "node scripts/check-source-archive.mjs"
|
|
34
|
+
"check:archive": "node scripts/check-source-archive.mjs",
|
|
35
|
+
"check:personal-data": "check-personal-data",
|
|
36
|
+
"check:private-refs": "check-private-refs"
|
|
35
37
|
},
|
|
36
38
|
"casomo": {
|
|
37
39
|
"gates": {
|
|
@@ -69,7 +71,7 @@
|
|
|
69
71
|
},
|
|
70
72
|
"devDependencies": {
|
|
71
73
|
"@casomoltd/paye-calc": "^0.7.0",
|
|
72
|
-
"@casomoltd/tooling": "^0.
|
|
74
|
+
"@casomoltd/tooling": "^0.29.0",
|
|
73
75
|
"@commitlint/cli": "^20.0.0",
|
|
74
76
|
"@js-temporal/polyfill": "^0.5.1",
|
|
75
77
|
"@types/node": "^25.5.0",
|