@casomoltd/nhs-pay 0.19.4 → 0.20.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 +69 -5
- package/dist/afc-scales.d.ts +14 -7
- package/dist/afc-scales.js +19 -19
- package/dist/afc-scales.js.map +1 -1
- package/dist/bands.d.ts +2 -2
- package/dist/commutation.d.ts +49 -5
- package/dist/commutation.js +124 -43
- package/dist/commutation.js.map +1 -1
- package/dist/dates.d.ts +2 -0
- package/dist/dates.js +4 -0
- package/dist/dates.js.map +1 -1
- package/dist/errors.d.ts +70 -12
- package/dist/errors.js +85 -19
- package/dist/errors.js.map +1 -1
- package/dist/factor-basis.d.ts +87 -0
- package/dist/factor-basis.js +99 -0
- package/dist/factor-basis.js.map +1 -0
- package/dist/gad/erf-1-401-2023-06-30.d.ts +47 -0
- package/dist/gad/erf-1-401-2023-06-30.js +73 -0
- package/dist/gad/erf-1-401-2023-06-30.js.map +1 -0
- package/dist/gad/erf-1-402-2023-06-30.d.ts +48 -0
- package/dist/gad/erf-1-402-2023-06-30.js +84 -0
- package/dist/gad/erf-1-402-2023-06-30.js.map +1 -0
- package/dist/gad/erf-1-407-2023-06-30.d.ts +47 -0
- package/dist/gad/erf-1-407-2023-06-30.js +73 -0
- package/dist/gad/erf-1-407-2023-06-30.js.map +1 -0
- package/dist/gad/erf-2023-06-30.d.ts +3 -0
- package/dist/gad/erf-2023-06-30.js +1 -0
- package/dist/gad/erf-2023-06-30.js.map +1 -1
- package/dist/gad/factor-table.d.ts +62 -31
- package/dist/gad/factor-table.js +67 -34
- package/dist/gad/factor-table.js.map +1 -1
- package/dist/gad/lrf-2-416-2023-06-30.d.ts +46 -0
- package/dist/gad/lrf-2-416-2023-06-30.js +72 -0
- package/dist/gad/lrf-2-416-2023-06-30.js.map +1 -0
- package/dist/gad/lrf-2023-06-30.d.ts +3 -0
- package/dist/gad/lrf-2023-06-30.js +1 -0
- package/dist/gad/lrf-2023-06-30.js.map +1 -1
- package/dist/gad/promotional-scale-2020.d.ts +37 -0
- package/dist/gad/promotional-scale-2020.js +38 -0
- package/dist/gad/promotional-scale-2020.js.map +1 -0
- package/dist/index.d.ts +16 -3
- package/dist/index.js +21 -12
- package/dist/index.js.map +1 -1
- package/dist/iso-date.d.ts +7 -0
- package/dist/iso-date.js +11 -0
- package/dist/iso-date.js.map +1 -1
- package/dist/member-benefits.d.ts +237 -0
- package/dist/member-benefits.js +440 -0
- package/dist/member-benefits.js.map +1 -0
- package/dist/pay-path.d.ts +70 -0
- package/dist/pay-path.js +155 -0
- package/dist/pay-path.js.map +1 -0
- package/dist/pension/curve.d.ts +74 -0
- package/dist/pension/curve.js +134 -0
- package/dist/pension/curve.js.map +1 -0
- package/dist/pension/history.js +3 -3
- package/dist/pension/history.js.map +1 -1
- package/dist/pension/ledger.d.ts +71 -31
- package/dist/pension/ledger.js +41 -6
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension/money.d.ts +23 -6
- package/dist/pension/money.js +23 -1
- package/dist/pension/money.js.map +1 -1
- package/dist/pension/uplift.d.ts +23 -0
- package/dist/pension/uplift.js +34 -1
- package/dist/pension/uplift.js.map +1 -1
- package/dist/pension-projection.d.ts +25 -31
- package/dist/pension-projection.js +40 -197
- package/dist/pension-projection.js.map +1 -1
- package/dist/scale-point.d.ts +11 -1
- package/dist/scales.d.ts +9 -9
- package/dist/scales.js +68 -67
- package/dist/scales.js.map +1 -1
- package/dist/sections/final-salary.d.ts +97 -0
- package/dist/sections/final-salary.js +99 -0
- package/dist/sections/final-salary.js.map +1 -0
- package/dist/sections/section-1995.d.ts +20 -0
- package/dist/sections/section-1995.js +52 -0
- package/dist/sections/section-1995.js.map +1 -0
- package/dist/sections/section-2008.d.ts +16 -0
- package/dist/sections/section-2008.js +44 -0
- package/dist/sections/section-2008.js.map +1 -0
- package/dist/sections/section-2015.d.ts +43 -0
- package/dist/sections/section-2015.js +57 -0
- package/dist/sections/section-2015.js.map +1 -0
- package/dist/values.d.ts +4 -5
- package/dist/values.js +4 -5
- package/dist/values.js.map +1 -1
- package/package.json +5 -3
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 2008 Section: final salary on reckonable pay, a pension age of 65,
|
|
3
|
+
* no automatic lump sum. Internal: reached only through the member's
|
|
4
|
+
* benefits.
|
|
5
|
+
*/
|
|
6
|
+
import { npaDate } from '../dates.js';
|
|
7
|
+
import { meanOf3ConsecutiveIn10, PAY_MEASURES } from './final-salary.js';
|
|
8
|
+
import { BenefitNotModelled, NOT_MODELLED } from '../errors.js';
|
|
9
|
+
import { readFactor } from '../factor-basis.js';
|
|
10
|
+
/** The pension age the 2008 Section's factors are measured from. */
|
|
11
|
+
const PENSION_AGE = 65;
|
|
12
|
+
/**
|
|
13
|
+
* The factor for a 2008 Section pension drawn on `drawn`: 1-402 early,
|
|
14
|
+
* 2-416 late.
|
|
15
|
+
*
|
|
16
|
+
* **An early drawing from preserved benefits is refused**, as in the
|
|
17
|
+
* 1995 Section: 1-402 is printed for members retiring early, and whether
|
|
18
|
+
* it also serves a member who left first has not been read at source:
|
|
19
|
+
* https://github.com/casomoltd/nhs-pay/issues/18
|
|
20
|
+
*/
|
|
21
|
+
export function factor2008(dateOfBirth, leaving, drawn) {
|
|
22
|
+
const sixtyFive = npaDate(dateOfBirth, PENSION_AGE);
|
|
23
|
+
if (drawn < sixtyFive && leaving < drawn) {
|
|
24
|
+
throw new BenefitNotModelled(NOT_MODELLED.preservedDrawnEarly, 'a 2008 Section pension drawn before 65 from preserved benefits');
|
|
25
|
+
}
|
|
26
|
+
const basis = {
|
|
27
|
+
against: PENSION_AGE,
|
|
28
|
+
direction: drawn < sixtyFive ? 'early' : 'late',
|
|
29
|
+
};
|
|
30
|
+
return readFactor(basis, dateOfBirth, drawn);
|
|
31
|
+
}
|
|
32
|
+
/** The 2008 Section's statute (SI 2008/653): 1/60 of reckonable pay,
|
|
33
|
+
* the best average of three consecutive years in the last ten, and
|
|
34
|
+
* no automatic lump sum. */
|
|
35
|
+
export const RULES_2008 = {
|
|
36
|
+
denominator: 60,
|
|
37
|
+
payMeasure: PAY_MEASURES.meanOf3ConsecutiveIn10,
|
|
38
|
+
pensionAge: PENSION_AGE,
|
|
39
|
+
lateUplift: true,
|
|
40
|
+
finalPay: meanOf3ConsecutiveIn10,
|
|
41
|
+
pensionFactor: factor2008,
|
|
42
|
+
automaticLumpSum: null,
|
|
43
|
+
};
|
|
44
|
+
//# sourceMappingURL=section-2008.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-2008.js","sourceRoot":"","sources":["../../src/sections/section-2008.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG9C,oEAAoE;AACpE,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,WAAiB,EACjB,OAAa,EACb,KAAW;IAEX,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpD,IAAI,KAAK,GAAG,SAAS,IAAI,OAAO,GAAG,KAAK,EAAE,CAAC;QACzC,MAAM,IAAI,kBAAkB,CAC1B,YAAY,CAAC,mBAAmB,EAChC,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAgB;QACzB,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,KAAK,GAAG,SAAS,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;KAChD,CAAC;IACF,OAAO,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED;;6BAE6B;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,YAAY,CAAC,sBAAsB;IAC/C,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,sBAAsB;IAChC,aAAa,EAAE,UAAU;IACzB,gBAAgB,EAAE,IAAI;CACvB,CAAC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import type { FactorOutcome } from '../factor-basis.js';
|
|
2
|
+
import type { MemberLedger, PayIn } from '../pension/ledger.js';
|
|
3
|
+
import type { Prices } from '../pension/prices.js';
|
|
4
|
+
import type { LedgerSeed } from '../pension/seed.js';
|
|
5
|
+
/**
|
|
6
|
+
* The factor for a pension determined under the 2015 Section's rules,
|
|
7
|
+
* drawn on `drawn`: 0-420 early and 0-421 late, by the period to or
|
|
8
|
+
* after the member's own pension age. The remedy window valued on the
|
|
9
|
+
* 2015 basis reads this too, because its benefits are determined under
|
|
10
|
+
* these rules although the legacy section pays them.
|
|
11
|
+
*/
|
|
12
|
+
export declare function factor2015(dateOfBirth: Date, drawn: Date): FactorOutcome;
|
|
13
|
+
/** One career average walk in one ruler, and the pension it draws. */
|
|
14
|
+
interface CareerAverageRun {
|
|
15
|
+
readonly ledger: MemberLedger;
|
|
16
|
+
readonly seed: LedgerSeed;
|
|
17
|
+
/** At the drawing, before its factor. */
|
|
18
|
+
readonly revalued: number;
|
|
19
|
+
/** At the drawing, after its factor. */
|
|
20
|
+
readonly drawn: number;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Walk a career average pot in one ruler: the 2015 Section's own, or a
|
|
24
|
+
* remedy window valued on its rules. The same engine either way, on
|
|
25
|
+
* the same revaluation, to the same drawing — which is what makes the
|
|
26
|
+
* two elections comparable, because revaluation is linear in each
|
|
27
|
+
* year's accrual and the window's pot is exactly its own term.
|
|
28
|
+
*
|
|
29
|
+
* `through` is the last scheme year walked, so a caller drawing a
|
|
30
|
+
* curve past the drawing has rows to draw.
|
|
31
|
+
*/
|
|
32
|
+
export declare function careerAverage({ seed, payIn, dateOfBirth, leaving, drawing, prices, through, }: {
|
|
33
|
+
readonly seed: LedgerSeed;
|
|
34
|
+
readonly payIn: PayIn;
|
|
35
|
+
readonly dateOfBirth: Date;
|
|
36
|
+
readonly leaving: Date;
|
|
37
|
+
readonly drawing: Date;
|
|
38
|
+
readonly prices: Prices;
|
|
39
|
+
readonly through: number;
|
|
40
|
+
}): CareerAverageRun & {
|
|
41
|
+
readonly factor: FactorOutcome;
|
|
42
|
+
};
|
|
43
|
+
export {};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The 2015 Section: career average at 1/54, a pension age that is the
|
|
3
|
+
* member's State Pension age with a floor of 65. Internal: reached only
|
|
4
|
+
* through the member's benefits.
|
|
5
|
+
*/
|
|
6
|
+
import { npaDate } from '../dates.js';
|
|
7
|
+
import { FACTOR_SOURCES, readFactor } from '../factor-basis.js';
|
|
8
|
+
import { normalPensionAge } from '../npa.js';
|
|
9
|
+
import { atDrawing, buildLedger } from '../pension/ledger.js';
|
|
10
|
+
/**
|
|
11
|
+
* The factor for a pension determined under the 2015 Section's rules,
|
|
12
|
+
* drawn on `drawn`: 0-420 early and 0-421 late, by the period to or
|
|
13
|
+
* after the member's own pension age. The remedy window valued on the
|
|
14
|
+
* 2015 basis reads this too, because its benefits are determined under
|
|
15
|
+
* these rules although the legacy section pays them.
|
|
16
|
+
*/
|
|
17
|
+
export function factor2015(dateOfBirth, drawn) {
|
|
18
|
+
const npa = normalPensionAge(dateOfBirth);
|
|
19
|
+
const at = npaDate(dateOfBirth, npa);
|
|
20
|
+
const basis = {
|
|
21
|
+
against: 'npa', npa, direction: drawn < at ? 'early' : 'late',
|
|
22
|
+
};
|
|
23
|
+
return readFactor(basis, dateOfBirth, drawn);
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Walk a career average pot in one ruler: the 2015 Section's own, or a
|
|
27
|
+
* remedy window valued on its rules. The same engine either way, on
|
|
28
|
+
* the same revaluation, to the same drawing — which is what makes the
|
|
29
|
+
* two elections comparable, because revaluation is linear in each
|
|
30
|
+
* year's accrual and the window's pot is exactly its own term.
|
|
31
|
+
*
|
|
32
|
+
* `through` is the last scheme year walked, so a caller drawing a
|
|
33
|
+
* curve past the drawing has rows to draw.
|
|
34
|
+
*/
|
|
35
|
+
export function careerAverage({ seed, payIn, dateOfBirth, leaving, drawing, prices, through, }) {
|
|
36
|
+
const factor = factor2015(dateOfBirth, drawing);
|
|
37
|
+
const ledger = buildLedger({
|
|
38
|
+
seed,
|
|
39
|
+
payIn,
|
|
40
|
+
exitDate: leaving,
|
|
41
|
+
retirementDate: drawing,
|
|
42
|
+
prices,
|
|
43
|
+
through,
|
|
44
|
+
drawingFor: () => ({
|
|
45
|
+
on: drawing,
|
|
46
|
+
factor: factor.factor,
|
|
47
|
+
table: factor.source === FACTOR_SOURCES.table
|
|
48
|
+
? { kind: factor.tableKind, provenance: factor.provenance }
|
|
49
|
+
: null,
|
|
50
|
+
}),
|
|
51
|
+
});
|
|
52
|
+
return {
|
|
53
|
+
ledger, seed, factor,
|
|
54
|
+
...atDrawing(ledger, drawing, factor.factor),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=section-2015.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"section-2015.js","sourceRoot":"","sources":["../../src/sections/section-2015.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,cAAc,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAK5D;;;;;;GAMG;AACH,MA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 +3,10 @@
|
|
|
3
3
|
* and pension layers — a named home for paired fields
|
|
4
4
|
* that would otherwise travel as loose primitives.
|
|
5
5
|
*
|
|
6
|
-
* Deferred: paye-calc
|
|
7
|
-
* object
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* type.
|
|
6
|
+
* Deferred: this local shape stands until paye-calc owns a
|
|
7
|
+
* shared Range/MinMax value object. When it does, re-point
|
|
8
|
+
* SalaryRange and PensionTier at it rather than keep a
|
|
9
|
+
* parallel interval type.
|
|
11
10
|
*/
|
|
12
11
|
/**
|
|
13
12
|
* A closed salary interval. `max` may be Infinity for an
|
package/dist/values.js
CHANGED
|
@@ -3,11 +3,10 @@
|
|
|
3
3
|
* and pension layers — a named home for paired fields
|
|
4
4
|
* that would otherwise travel as loose primitives.
|
|
5
5
|
*
|
|
6
|
-
* Deferred: paye-calc
|
|
7
|
-
* object
|
|
8
|
-
*
|
|
9
|
-
*
|
|
10
|
-
* type.
|
|
6
|
+
* Deferred: this local shape stands until paye-calc owns a
|
|
7
|
+
* shared Range/MinMax value object. When it does, re-point
|
|
8
|
+
* SalaryRange and PensionTier at it rather than keep a
|
|
9
|
+
* parallel interval type.
|
|
11
10
|
*/
|
|
12
11
|
export {};
|
|
13
12
|
//# sourceMappingURL=values.js.map
|
package/dist/values.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"values.js","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"values.js","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@casomoltd/nhs-pay",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"description": "NHS
|
|
3
|
+
"version": "0.20.0",
|
|
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",
|
|
7
7
|
"type": "module",
|
|
@@ -49,6 +49,8 @@
|
|
|
49
49
|
"agenda-for-change",
|
|
50
50
|
"pay-scales",
|
|
51
51
|
"pension",
|
|
52
|
+
"nhs-pension-scheme",
|
|
53
|
+
"mccloud",
|
|
52
54
|
"take-home",
|
|
53
55
|
"hcas"
|
|
54
56
|
],
|
|
@@ -67,7 +69,7 @@
|
|
|
67
69
|
},
|
|
68
70
|
"devDependencies": {
|
|
69
71
|
"@casomoltd/paye-calc": "^0.7.0",
|
|
70
|
-
"@casomoltd/tooling": "^0.
|
|
72
|
+
"@casomoltd/tooling": "^0.28.0",
|
|
71
73
|
"@commitlint/cli": "^20.0.0",
|
|
72
74
|
"@js-temporal/polyfill": "^0.5.1",
|
|
73
75
|
"@types/node": "^25.5.0",
|