@casomoltd/nhs-pay 0.5.0 → 0.7.2
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 +134 -3
- package/dist/award.d.ts +32 -0
- package/dist/award.js +59 -0
- package/dist/award.js.map +1 -0
- package/dist/bands.d.ts +8 -8
- package/dist/bands.js +6 -8
- package/dist/bands.js.map +1 -1
- package/dist/circulars/england-md-1-2026r.d.ts +257 -0
- package/dist/circulars/england-md-1-2026r.js +302 -0
- package/dist/circulars/england-md-1-2026r.js.map +1 -0
- package/dist/circulars/ni-hsc-tc8-05-2025.d.ts +166 -0
- package/dist/circulars/ni-hsc-tc8-05-2025.js +249 -0
- package/dist/circulars/ni-hsc-tc8-05-2025.js.map +1 -0
- package/dist/circulars/scotland-pcs-dd-2026-01.d.ts +34 -0
- package/dist/circulars/scotland-pcs-dd-2026-01.js +96 -0
- package/dist/circulars/scotland-pcs-dd-2026-01.js.map +1 -0
- package/dist/circulars/wales-mdw-01-2025.d.ts +130 -0
- package/dist/circulars/wales-mdw-01-2025.js +221 -0
- package/dist/circulars/wales-mdw-01-2025.js.map +1 -0
- package/dist/dental-scales.d.ts +44 -0
- package/dist/dental-scales.js +103 -0
- package/dist/dental-scales.js.map +1 -0
- package/dist/errors.d.ts +33 -5
- package/dist/errors.js +44 -6
- package/dist/errors.js.map +1 -1
- package/dist/index.d.ts +14 -7
- package/dist/index.js +8 -3
- package/dist/index.js.map +1 -1
- package/dist/medical-scales.d.ts +64 -0
- package/dist/medical-scales.js +153 -0
- package/dist/medical-scales.js.map +1 -0
- package/dist/pension.d.ts +18 -15
- package/dist/pension.js +99 -25
- package/dist/pension.js.map +1 -1
- package/dist/post.d.ts +78 -3
- package/dist/post.js +59 -6
- package/dist/post.js.map +1 -1
- package/dist/resolver.d.ts +17 -0
- package/dist/resolver.js +61 -0
- package/dist/resolver.js.map +1 -1
- package/dist/role.d.ts +25 -4
- package/dist/role.js +1 -2
- package/dist/role.js.map +1 -1
- package/dist/scale-point.d.ts +21 -0
- package/dist/scale-point.js +2 -0
- package/dist/scale-point.js.map +1 -0
- package/dist/scale-tables.d.ts +69 -0
- package/dist/scale-tables.js +98 -0
- package/dist/scale-tables.js.map +1 -0
- package/dist/scales.d.ts +2 -5
- package/dist/scales.js +1 -1
- package/dist/scales.js.map +1 -1
- package/dist/take-home.d.ts +36 -7
- package/dist/take-home.js +59 -13
- package/dist/take-home.js.map +1 -1
- package/package.json +2 -2
package/dist/post.js
CHANGED
|
@@ -7,19 +7,30 @@
|
|
|
7
7
|
* A façade: every derived value delegates to the existing
|
|
8
8
|
* NHS modules ({@link nhsTakeHome}, {@link PensionTiers});
|
|
9
9
|
* nothing is absorbed here. A Post never mutates — change
|
|
10
|
-
* a value by building a new one (see {@link Post.withSalary}
|
|
10
|
+
* a value by building a new one (see {@link Post.withSalary},
|
|
11
|
+
* {@link Post.withAdjustments}).
|
|
11
12
|
*/
|
|
12
13
|
import { nationToTaxRegion } from '@casomoltd/paye-calc';
|
|
13
14
|
import { getPensionTiersVO } from './pension.js';
|
|
14
15
|
import { nhsTakeHome } from './take-home.js';
|
|
16
|
+
/** The identity adjustments: full-time, no sacrifice/loans/override, in-scheme. */
|
|
17
|
+
export const NO_ADJUSTMENTS = {
|
|
18
|
+
fte: 1,
|
|
19
|
+
salarySacrifice: 0,
|
|
20
|
+
studentLoans: new Set(),
|
|
21
|
+
taxCode: null,
|
|
22
|
+
pensionOptedOut: false,
|
|
23
|
+
};
|
|
15
24
|
export class Post {
|
|
16
25
|
identity;
|
|
17
26
|
salary;
|
|
18
27
|
role;
|
|
19
|
-
|
|
28
|
+
adjustments;
|
|
29
|
+
constructor(identity, salary, role, adjustments = NO_ADJUSTMENTS) {
|
|
20
30
|
this.identity = identity;
|
|
21
31
|
this.salary = salary;
|
|
22
32
|
this.role = role;
|
|
33
|
+
this.adjustments = adjustments;
|
|
23
34
|
}
|
|
24
35
|
/**
|
|
25
36
|
* Build a Post from a gross salary — whatever the member
|
|
@@ -29,13 +40,41 @@ export class Post {
|
|
|
29
40
|
*
|
|
30
41
|
* A bare salary is a `vsm` role (an off-scale post); a
|
|
31
42
|
* scale-point resolver passes the scale identity instead.
|
|
43
|
+
* Personal circumstances are added afterwards with
|
|
44
|
+
* {@link Post.withAdjustments}.
|
|
32
45
|
*/
|
|
33
46
|
static fromSalary(salary, nation, year, role = { kind: 'vsm' }) {
|
|
34
47
|
return new Post({ nation, taxYear: year }, salary, role);
|
|
35
48
|
}
|
|
36
|
-
/**
|
|
49
|
+
/**
|
|
50
|
+
* Pensionable pay: the pay the NHS pension contribution rate/tier
|
|
51
|
+
* are worked out on. Here = the FTE-pro-rated scale salary less any
|
|
52
|
+
* pensionable-reducing salary sacrifice ({@link PostAdjustments.salarySacrifice}).
|
|
53
|
+
*
|
|
54
|
+
* We treat the whole scale salary (incl. HCAS) as pensionable and do
|
|
55
|
+
* not model non-pensionable elements (overtime above WTE, one-off /
|
|
56
|
+
* non-consolidated awards, expenses). Since 1 October 2022 tiers use
|
|
57
|
+
* ACTUAL (not whole-time-equivalent) pensionable pay. Under this
|
|
58
|
+
* model all salary sacrifice reduces both bases, so pensionable pay
|
|
59
|
+
* also serves as the tax/NI-assessable gross handed to the engine.
|
|
60
|
+
* Sources: NHSBSA 2015 Members Guide
|
|
61
|
+
* https://www.nhsbsa.nhs.uk/sites/default/files/2024-05/2015%20Members%20Guide%20%28V13%29%2005.2024.pdf ;
|
|
62
|
+
* cost of being in the scheme https://www.nhsbsa.nhs.uk/member-hub/cost-being-scheme
|
|
63
|
+
*/
|
|
64
|
+
get pensionablePay() {
|
|
65
|
+
const fteSalary = Math.round(this.salary * this.adjustments.fte);
|
|
66
|
+
return Math.max(0, fteSalary - this.adjustments.salarySacrifice);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Member contribution rate (%). The tier's single rate applies to
|
|
70
|
+
* the WHOLE of {@link Post.pensionablePay} (a slab/cliff-edge rate,
|
|
71
|
+
* not a marginal band); 0 when opted out.
|
|
72
|
+
*/
|
|
37
73
|
get pensionRate() {
|
|
38
|
-
|
|
74
|
+
if (this.adjustments.pensionOptedOut) {
|
|
75
|
+
return 0;
|
|
76
|
+
}
|
|
77
|
+
return getPensionTiersVO(this.identity.taxYear, this.identity.nation).rateFor(this.pensionablePay);
|
|
39
78
|
}
|
|
40
79
|
/**
|
|
41
80
|
* Annual member pension contribution (£) — read from the
|
|
@@ -47,7 +86,10 @@ export class Post {
|
|
|
47
86
|
}
|
|
48
87
|
/** Full take-home breakdown (tax, NI, pension, net). */
|
|
49
88
|
get takeHome() {
|
|
50
|
-
return nhsTakeHome(this.
|
|
89
|
+
return nhsTakeHome(this.pensionablePay, this.pensionRate / 100, this.identity.taxYear, nationToTaxRegion(this.identity.nation), {
|
|
90
|
+
studentLoans: this.adjustments.studentLoans,
|
|
91
|
+
taxCode: this.adjustments.taxCode,
|
|
92
|
+
});
|
|
51
93
|
}
|
|
52
94
|
/** Annual income tax (£). */
|
|
53
95
|
get tax() {
|
|
@@ -59,7 +101,18 @@ export class Post {
|
|
|
59
101
|
}
|
|
60
102
|
/** The same post at a different salary (e.g. a raise). */
|
|
61
103
|
withSalary(salary) {
|
|
62
|
-
return new Post(this.identity, salary, this.role);
|
|
104
|
+
return new Post(this.identity, salary, this.role, this.adjustments);
|
|
105
|
+
}
|
|
106
|
+
/**
|
|
107
|
+
* The same post with some personal circumstances changed —
|
|
108
|
+
* merged over the current adjustments, so a caller sets only
|
|
109
|
+
* the fields it cares about (the rest stay at their defaults).
|
|
110
|
+
*/
|
|
111
|
+
withAdjustments(patch) {
|
|
112
|
+
return new Post(this.identity, this.salary, this.role, {
|
|
113
|
+
...this.adjustments,
|
|
114
|
+
...patch,
|
|
115
|
+
});
|
|
63
116
|
}
|
|
64
117
|
}
|
|
65
118
|
//# sourceMappingURL=post.js.map
|
package/dist/post.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"post.js","sourceRoot":"","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,IAAI,CAAC,WAAW;YACnB,GAAG,KAAK;SACT,CAAC,CAAC;IACL,CAAC;CACF"}
|
package/dist/resolver.d.ts
CHANGED
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
import type { Nation, TaxYear } from '@casomoltd/paye-calc';
|
|
13
13
|
import type { AfcBandId } from './scales.js';
|
|
14
14
|
import type { AfcRegionId } from './regions.js';
|
|
15
|
+
import type { MedicalGradeId } from './medical-scales.js';
|
|
16
|
+
import type { DentalGradeId } from './dental-scales.js';
|
|
15
17
|
import { Post } from './post.js';
|
|
16
18
|
/**
|
|
17
19
|
* The uniform contract every pay family satisfies: build a
|
|
@@ -37,3 +39,18 @@ export interface AfcResolver extends PayScaleResolver<AfcBandId> {
|
|
|
37
39
|
fromScalePoint(band: AfcBandId, pointLabel: string, region: AfcRegionId, year: TaxYear): Post;
|
|
38
40
|
}
|
|
39
41
|
export declare const afcResolver: AfcResolver;
|
|
42
|
+
/**
|
|
43
|
+
* A basic-pay-by-nation resolver (medical, dental) — like the AfC
|
|
44
|
+
* resolver, but its scale-point entry threads a bare {@link Nation}
|
|
45
|
+
* (no HCAS/region), and it stamps a family-specific {@link Role} via
|
|
46
|
+
* the `toRole` builder its factory is given.
|
|
47
|
+
*/
|
|
48
|
+
export interface NationScaleResolver<G extends string> extends PayScaleResolver<G> {
|
|
49
|
+
fromScalePoint(grade: G, pointLabel: string, nation: Nation, year: TaxYear): Post;
|
|
50
|
+
}
|
|
51
|
+
/** Medical (doctors) resolver — a grade + point + nation entry. */
|
|
52
|
+
export type MedicalResolver = NationScaleResolver<MedicalGradeId>;
|
|
53
|
+
/** Salaried dental resolver — a grade + point + nation entry. */
|
|
54
|
+
export type DentalResolver = NationScaleResolver<DentalGradeId>;
|
|
55
|
+
export declare const medicalResolver: MedicalResolver;
|
|
56
|
+
export declare const dentalResolver: DentalResolver;
|
package/dist/resolver.js
CHANGED
|
@@ -13,6 +13,8 @@ import { AFC_TAX_YEARS } from './scales.js';
|
|
|
13
13
|
import { afcRegionToNation } from './regions.js';
|
|
14
14
|
import { getAfcScales } from './bands.js';
|
|
15
15
|
import { grossSalary } from './hcas.js';
|
|
16
|
+
import { getMedicalScales, MEDICAL_TAX_YEARS } from './medical-scales.js';
|
|
17
|
+
import { getDentalScales, DENTAL_TAX_YEARS } from './dental-scales.js';
|
|
16
18
|
import { ScaleUnavailable } from './errors.js';
|
|
17
19
|
import { Post } from './post.js';
|
|
18
20
|
export const afcResolver = {
|
|
@@ -52,4 +54,63 @@ export const afcResolver = {
|
|
|
52
54
|
return null;
|
|
53
55
|
},
|
|
54
56
|
};
|
|
57
|
+
// Medical & dental scales carry basic pay by nation (no HCAS), so their
|
|
58
|
+
// scale-point entry threads a Nation, not an AfC region. Each family
|
|
59
|
+
// owns the list of years it publishes (MEDICAL/DENTAL_TAX_YEARS, derived
|
|
60
|
+
// from its own tables), which `latestYearFor` probes newest-first.
|
|
61
|
+
/**
|
|
62
|
+
* Grade IDs published for a nation/year, or `[]` if the whole
|
|
63
|
+
* combination is unpublished — a non-throwing probe for `latestYearFor`
|
|
64
|
+
* (which walks years that may not all exist for a nation), distinct
|
|
65
|
+
* from `availableGrades`, which fails loud like the AfC resolver.
|
|
66
|
+
*/
|
|
67
|
+
function publishedGrades(load) {
|
|
68
|
+
try {
|
|
69
|
+
return load().map((m) => m.grade);
|
|
70
|
+
}
|
|
71
|
+
catch (e) {
|
|
72
|
+
if (e instanceof ScaleUnavailable) {
|
|
73
|
+
return [];
|
|
74
|
+
}
|
|
75
|
+
throw e;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Build a {@link NationScaleResolver} over a family's `getScales`
|
|
80
|
+
* accessor and its {@link Role} stamp. Both the medical and dental
|
|
81
|
+
* resolvers are this factory with different data and role — the
|
|
82
|
+
* polymorphism the design intends, with no per-family machinery.
|
|
83
|
+
*/
|
|
84
|
+
function makeNationScaleResolver(getScales, toRole, years) {
|
|
85
|
+
return {
|
|
86
|
+
fromSalary(salary, nation, year) {
|
|
87
|
+
return Post.fromSalary(salary, nation, year);
|
|
88
|
+
},
|
|
89
|
+
fromScalePoint(grade, pointLabel, nation, year) {
|
|
90
|
+
const meta = getScales(year, nation).find((m) => m.grade === grade);
|
|
91
|
+
if (!meta) {
|
|
92
|
+
throw new ScaleUnavailable(nation, year, grade);
|
|
93
|
+
}
|
|
94
|
+
const point = meta.points.find((p) => p.label === pointLabel);
|
|
95
|
+
if (!point) {
|
|
96
|
+
throw new ScaleUnavailable(nation, year, grade, pointLabel);
|
|
97
|
+
}
|
|
98
|
+
return Post.fromSalary(point.salary, nation, year, toRole(grade, point, nation));
|
|
99
|
+
},
|
|
100
|
+
availableGrades(nation, year) {
|
|
101
|
+
return getScales(year, nation).map((m) => m.grade);
|
|
102
|
+
},
|
|
103
|
+
latestYearFor(gradeId, nation) {
|
|
104
|
+
for (const year of years) {
|
|
105
|
+
const published = publishedGrades(() => getScales(year, nation)).includes(gradeId);
|
|
106
|
+
if (published) {
|
|
107
|
+
return year;
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
return null;
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
export const medicalResolver = makeNationScaleResolver(getMedicalScales, (grade, point, nation) => ({ kind: 'medical', grade, point, nation }), MEDICAL_TAX_YEARS);
|
|
115
|
+
export const dentalResolver = makeNationScaleResolver(getDentalScales, (grade, point, nation) => ({ kind: 'dental', grade, point, nation }), DENTAL_TAX_YEARS);
|
|
55
116
|
//# sourceMappingURL=resolver.js.map
|
package/dist/resolver.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;
|
|
1
|
+
{"version":3,"file":"resolver.js","sourceRoot":"","sources":["../src/resolver.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAC,aAAa,EAAC,MAAM,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ED,aAAa,CAAC,OAAO,EAAE,MAAM;YAC3B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;gBACzB,MAAM,SAAS,GAAG,eAAe,CAAC,GAAG,EAAE,CACrC,SAAS,CAAC,IAAI,EAAE,MAAM,CAAC,CACxB,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC;gBACpB,IAAI,SAAS,EAAE,CAAC;oBACd,OAAO,IAAI,CAAC;gBACd,CAAC;YACH,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;KACF,CAAC;AACJ,CAAC;AAQD,MAAM,CAAC,MAAM,eAAe,GAAoB,uBAAuB,CACrE,gBAAgB,EAChB,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAC,CAAC,EACnE,iBAAiB,CAClB,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAmB,uBAAuB,CACnE,eAAe,EACf,CAAC,KAAK,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,CAAC,EAAC,IAAI,EAAE,QAAQ,EAAE,KAAK,EAAE,KAAK,EAAE,MAAM,EAAC,CAAC,EAClE,gBAAgB,CACjB,CAAC"}
|
package/dist/role.d.ts
CHANGED
|
@@ -7,11 +7,14 @@
|
|
|
7
7
|
* Resolvers set it and every Post carries one, so a Post is
|
|
8
8
|
* never an anonymous salary that has forgotten what it is.
|
|
9
9
|
*
|
|
10
|
-
* `afc
|
|
11
|
-
* join when their scales land (Phase 2).
|
|
10
|
+
* `afc`, `vsm`, `medical` and `dental` all ship today.
|
|
12
11
|
*/
|
|
13
|
-
import type { AfcBandId
|
|
12
|
+
import type { AfcBandId } from './scales.js';
|
|
13
|
+
import type { ScalePoint } from './scale-point.js';
|
|
14
14
|
import type { AfcRegionId } from './regions.js';
|
|
15
|
+
import type { MedicalGradeId } from './medical-scales.js';
|
|
16
|
+
import type { DentalGradeId } from './dental-scales.js';
|
|
17
|
+
import type { Nation } from '@casomoltd/paye-calc';
|
|
15
18
|
/** An Agenda-for-Change post: a band at a point, in a region. */
|
|
16
19
|
export interface AfcRole {
|
|
17
20
|
readonly kind: 'afc';
|
|
@@ -19,6 +22,24 @@ export interface AfcRole {
|
|
|
19
22
|
readonly point: ScalePoint;
|
|
20
23
|
readonly region: AfcRegionId;
|
|
21
24
|
}
|
|
25
|
+
/**
|
|
26
|
+
* A doctor post: a medical grade at a scale point, in a nation.
|
|
27
|
+
* Basic medical pay has no HCAS/region model, so the identity
|
|
28
|
+
* carries a bare {@link Nation}, not an AfC region.
|
|
29
|
+
*/
|
|
30
|
+
export interface MedicalRole {
|
|
31
|
+
readonly kind: 'medical';
|
|
32
|
+
readonly grade: MedicalGradeId;
|
|
33
|
+
readonly point: ScalePoint;
|
|
34
|
+
readonly nation: Nation;
|
|
35
|
+
}
|
|
36
|
+
/** A salaried dental post: a dental grade at a scale point, in a nation. */
|
|
37
|
+
export interface DentalRole {
|
|
38
|
+
readonly kind: 'dental';
|
|
39
|
+
readonly grade: DentalGradeId;
|
|
40
|
+
readonly point: ScalePoint;
|
|
41
|
+
readonly nation: Nation;
|
|
42
|
+
}
|
|
22
43
|
/**
|
|
23
44
|
* A bare custom salary — an off-scale / very-senior-manager
|
|
24
45
|
* post with no published scale point. Its identity is the
|
|
@@ -27,5 +48,5 @@ export interface AfcRole {
|
|
|
27
48
|
export interface VsmRole {
|
|
28
49
|
readonly kind: 'vsm';
|
|
29
50
|
}
|
|
30
|
-
export type Role = AfcRole | VsmRole;
|
|
51
|
+
export type Role = AfcRole | VsmRole | MedicalRole | DentalRole;
|
|
31
52
|
export type RoleKind = Role['kind'];
|
package/dist/role.js
CHANGED
|
@@ -7,8 +7,7 @@
|
|
|
7
7
|
* Resolvers set it and every Post carries one, so a Post is
|
|
8
8
|
* never an anonymous salary that has forgotten what it is.
|
|
9
9
|
*
|
|
10
|
-
* `afc
|
|
11
|
-
* join when their scales land (Phase 2).
|
|
10
|
+
* `afc`, `vsm`, `medical` and `dental` all ship today.
|
|
12
11
|
*/
|
|
13
12
|
export {};
|
|
14
13
|
//# sourceMappingURL=role.js.map
|
package/dist/role.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"role.js","sourceRoot":"","sources":["../src/role.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The canonical pay-scale point — the single shape every pay scale
|
|
3
|
+
* reduces to (AfC band points, medical grades, dental spines), read by
|
|
4
|
+
* the resolvers to build a Post. Domain-neutral: it belongs to no one
|
|
5
|
+
* pay family, which is why it lives here rather than in any one scale
|
|
6
|
+
* file.
|
|
7
|
+
*/
|
|
8
|
+
export interface ScalePoint {
|
|
9
|
+
/** The point's own step identity: a band point, pay-scale code,
|
|
10
|
+
* training stage, consultant threshold, or dental band + point. */
|
|
11
|
+
label: string;
|
|
12
|
+
/** Annual gross salary at this point. */
|
|
13
|
+
salary: number;
|
|
14
|
+
/**
|
|
15
|
+
* Years of experience this point maps to (0-indexed), for scales the
|
|
16
|
+
* source lists *by year of service* — the SAS and consultant scales,
|
|
17
|
+
* whose figures step by year. Absent where the step is self-describing
|
|
18
|
+
* (a training stage, a dental band + point) and carries no year axis.
|
|
19
|
+
*/
|
|
20
|
+
yearsExperience?: number;
|
|
21
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-point.js","sourceRoot":"","sources":["../src/scale-point.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared machinery for the non-AfC pay families (medical, dental).
|
|
3
|
+
*
|
|
4
|
+
* The canonical domain shape: a family's scales key on
|
|
5
|
+
* `(grade, nation, year)` and resolve to `ScalePoint[]`, uniform with
|
|
6
|
+
* AfC. Verbatim transcription lives in `circulars/*`; the per-family
|
|
7
|
+
* selection + mapping lives in the translation layers
|
|
8
|
+
* (`medical-scales.ts`, `dental-scales.ts`). This module owns only the
|
|
9
|
+
* canonical container, the grouping accessor, and the translators
|
|
10
|
+
* generic enough to be shared across both families.
|
|
11
|
+
*/
|
|
12
|
+
import type { Nation, TaxYear } from '@casomoltd/paye-calc';
|
|
13
|
+
import type { ScalePoint } from './scale-point.js';
|
|
14
|
+
import type { SalaryRange } from './values.js';
|
|
15
|
+
/** A grade's canonical scale points in a nation/year, with its range. */
|
|
16
|
+
export interface GradeMeta<G extends string> {
|
|
17
|
+
grade: G;
|
|
18
|
+
points: readonly ScalePoint[];
|
|
19
|
+
salary: SalaryRange;
|
|
20
|
+
}
|
|
21
|
+
/** Canonical basic-pay tables keyed year → nation → grade → points. */
|
|
22
|
+
export type GradeScaleTables<G extends string> = Partial<Record<TaxYear, Partial<Record<Nation, Partial<Record<G, readonly ScalePoint[]>>>>>>;
|
|
23
|
+
/**
|
|
24
|
+
* Group a nation/year's grades into metas, in `gradeIds` order. `year`
|
|
25
|
+
* and `nation` are both required; an absent combination throws
|
|
26
|
+
* {@link ScaleUnavailable} rather than defaulting to another nation's
|
|
27
|
+
* or year's figures.
|
|
28
|
+
*/
|
|
29
|
+
export declare function resolveGradeMetas<G extends string>(tables: GradeScaleTables<G>, gradeIds: readonly G[], year: TaxYear, nation: Nation): GradeMeta<G>[];
|
|
30
|
+
/**
|
|
31
|
+
* An incremental scale with no distinct labels beyond position: the
|
|
32
|
+
* first point is "Minimum", the rest "Point 1", "Point 2", … (the
|
|
33
|
+
* devolved training grades). Input is the salary column, top to bottom.
|
|
34
|
+
*/
|
|
35
|
+
export declare const stepped: (salaries: readonly number[]) => readonly ScalePoint[];
|
|
36
|
+
/** A two-point salary range (salaried GP), min then max. */
|
|
37
|
+
export declare const range: (r: SalaryRange) => readonly ScalePoint[];
|
|
38
|
+
/** Plain "Point 1", "Point 2"… labelling (1-based). */
|
|
39
|
+
export declare const numbered: (salaries: readonly number[]) => readonly ScalePoint[];
|
|
40
|
+
/** One point per row, labelled by the row's `stage` (training grades). */
|
|
41
|
+
export declare const byStage: (rows: readonly {
|
|
42
|
+
stage: string;
|
|
43
|
+
salary: number;
|
|
44
|
+
}[]) => readonly ScalePoint[];
|
|
45
|
+
/**
|
|
46
|
+
* One point per row, labelled by the row's pay-scale `code`. Carries the
|
|
47
|
+
* row's `yearsExperience` onto the point where the source lists one (the
|
|
48
|
+
* SAS scales) — the code alone is opaque, so the year is the reader-facing
|
|
49
|
+
* axis; rows without it (GP educators, closed grades) stay code-only.
|
|
50
|
+
*/
|
|
51
|
+
export declare const byCode: (rows: readonly {
|
|
52
|
+
code: string;
|
|
53
|
+
salary: number;
|
|
54
|
+
yearsExperience?: number;
|
|
55
|
+
}[]) => readonly ScalePoint[];
|
|
56
|
+
/** One point per row, labelled "Band {band} Point {point}" (dental spine). */
|
|
57
|
+
export declare const bySpine: (rows: readonly {
|
|
58
|
+
band: string | number;
|
|
59
|
+
point: number;
|
|
60
|
+
salary: number;
|
|
61
|
+
}[]) => readonly ScalePoint[];
|
|
62
|
+
/**
|
|
63
|
+
* The `salaries` of the named incremental scale in a circular's list.
|
|
64
|
+
* Fails loud (at module load) on a mapping key that doesn't match a
|
|
65
|
+
* source scale — a translation-layer typo can't ship silently.
|
|
66
|
+
*/
|
|
67
|
+
export declare const scaleSalaries: <T extends {
|
|
68
|
+
salaries: readonly number[];
|
|
69
|
+
}>(rows: readonly T[], match: (r: T) => boolean, key: string) => readonly number[];
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared machinery for the non-AfC pay families (medical, dental).
|
|
3
|
+
*
|
|
4
|
+
* The canonical domain shape: a family's scales key on
|
|
5
|
+
* `(grade, nation, year)` and resolve to `ScalePoint[]`, uniform with
|
|
6
|
+
* AfC. Verbatim transcription lives in `circulars/*`; the per-family
|
|
7
|
+
* selection + mapping lives in the translation layers
|
|
8
|
+
* (`medical-scales.ts`, `dental-scales.ts`). This module owns only the
|
|
9
|
+
* canonical container, the grouping accessor, and the translators
|
|
10
|
+
* generic enough to be shared across both families.
|
|
11
|
+
*/
|
|
12
|
+
import { ScaleUnavailable } from './errors.js';
|
|
13
|
+
/**
|
|
14
|
+
* Group a nation/year's grades into metas, in `gradeIds` order. `year`
|
|
15
|
+
* and `nation` are both required; an absent combination throws
|
|
16
|
+
* {@link ScaleUnavailable} rather than defaulting to another nation's
|
|
17
|
+
* or year's figures.
|
|
18
|
+
*/
|
|
19
|
+
export function resolveGradeMetas(tables, gradeIds, year, nation) {
|
|
20
|
+
const grades = tables[year]?.[nation];
|
|
21
|
+
const metas = grades
|
|
22
|
+
? gradeIds.flatMap((grade) => {
|
|
23
|
+
const points = grades[grade];
|
|
24
|
+
if (!points) {
|
|
25
|
+
return [];
|
|
26
|
+
}
|
|
27
|
+
const salaries = points.map((p) => p.salary);
|
|
28
|
+
return [
|
|
29
|
+
{
|
|
30
|
+
grade,
|
|
31
|
+
points,
|
|
32
|
+
salary: {
|
|
33
|
+
min: Math.min(...salaries),
|
|
34
|
+
max: Math.max(...salaries),
|
|
35
|
+
},
|
|
36
|
+
},
|
|
37
|
+
];
|
|
38
|
+
})
|
|
39
|
+
: [];
|
|
40
|
+
if (metas.length === 0) {
|
|
41
|
+
throw new ScaleUnavailable(nation, year);
|
|
42
|
+
}
|
|
43
|
+
return metas;
|
|
44
|
+
}
|
|
45
|
+
// ── Shared translators ──────────────────────────
|
|
46
|
+
// Small pure maps from a circular's verbatim rows to canonical points.
|
|
47
|
+
// The per-family selection (which scale feeds which grade) lives in the
|
|
48
|
+
// `*-scales.ts` translation layers; these translators are the pieces
|
|
49
|
+
// generic enough to be shared by both.
|
|
50
|
+
/**
|
|
51
|
+
* An incremental scale with no distinct labels beyond position: the
|
|
52
|
+
* first point is "Minimum", the rest "Point 1", "Point 2", … (the
|
|
53
|
+
* devolved training grades). Input is the salary column, top to bottom.
|
|
54
|
+
*/
|
|
55
|
+
export const stepped = (salaries) => salaries.map((salary, i) => ({
|
|
56
|
+
label: i === 0 ? 'Minimum' : `Point ${i}`,
|
|
57
|
+
salary,
|
|
58
|
+
}));
|
|
59
|
+
/** A two-point salary range (salaried GP), min then max. */
|
|
60
|
+
export const range = (r) => [
|
|
61
|
+
{ label: 'Range minimum', salary: r.min },
|
|
62
|
+
{ label: 'Range maximum', salary: r.max },
|
|
63
|
+
];
|
|
64
|
+
/** Plain "Point 1", "Point 2"… labelling (1-based). */
|
|
65
|
+
export const numbered = (salaries) => salaries.map((salary, i) => ({ label: `Point ${i + 1}`, salary }));
|
|
66
|
+
/** One point per row, labelled by the row's `stage` (training grades). */
|
|
67
|
+
export const byStage = (rows) => rows.map((r) => ({ label: r.stage, salary: r.salary }));
|
|
68
|
+
/**
|
|
69
|
+
* One point per row, labelled by the row's pay-scale `code`. Carries the
|
|
70
|
+
* row's `yearsExperience` onto the point where the source lists one (the
|
|
71
|
+
* SAS scales) — the code alone is opaque, so the year is the reader-facing
|
|
72
|
+
* axis; rows without it (GP educators, closed grades) stay code-only.
|
|
73
|
+
*/
|
|
74
|
+
export const byCode = (rows) => rows.map((r) => ({
|
|
75
|
+
label: r.code,
|
|
76
|
+
salary: r.salary,
|
|
77
|
+
...(r.yearsExperience !== undefined
|
|
78
|
+
? { yearsExperience: r.yearsExperience }
|
|
79
|
+
: {}),
|
|
80
|
+
}));
|
|
81
|
+
/** One point per row, labelled "Band {band} Point {point}" (dental spine). */
|
|
82
|
+
export const bySpine = (rows) => rows.map((r) => ({
|
|
83
|
+
label: `Band ${r.band} Point ${r.point}`,
|
|
84
|
+
salary: r.salary,
|
|
85
|
+
}));
|
|
86
|
+
/**
|
|
87
|
+
* The `salaries` of the named incremental scale in a circular's list.
|
|
88
|
+
* Fails loud (at module load) on a mapping key that doesn't match a
|
|
89
|
+
* source scale — a translation-layer typo can't ship silently.
|
|
90
|
+
*/
|
|
91
|
+
export const scaleSalaries = (rows, match, key) => {
|
|
92
|
+
const found = rows.find(match);
|
|
93
|
+
if (!found) {
|
|
94
|
+
throw new Error(`scale-tables: no source scale for "${key}"`);
|
|
95
|
+
}
|
|
96
|
+
return found.salaries;
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=scale-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"scale-tables.js","sourceRoot":"","sources":["../src/scale-tables.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;AAc7C;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAC/B,MAA2B,EAC3B,QAAsB,EACtB,IAAa,EACb,MAAc;IAEd,MAAM,MAAM,GAAG,MAAM,CAAC,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,CAAC;IACtC,MAAM,KAAK,GAAG,MAAM;QAClB,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE;YACzB,MAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC;YAC7B,IAAI,CAAC,MAAM,EAAE,CAAC;gBACZ,OAAO,EAAE,CAAC;YACZ,CAAC;YACD,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC;YAC7C,OAAO;gBACL;oBACE,KAAK;oBACL,MAAM;oBACN,MAAM,EAAE;wBACN,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;wBAC1B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;qBAC3B;iBACF;aACF,CAAC;QACJ,CAAC,CAAC;QACJ,CAAC,CAAC,EAAE,CAAC;IACP,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,gBAAgB,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ClD,EAAE,CACzB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACf,KAAK,EAAE,CAAC,CAAC,IAAI;IACb,MAAM,EAAE,CAAC,CAAC,MAAM;IAChB,GAAG,CAAC,CAAC,CAAC,eAAe,KAAK,SAAS;QACjC,CAAC,CAAC,EAAC,eAAe,EAAE,CAAC,CAAC,eAAe,EAAC;QACtC,CAAC,CAAC,EAAE,CAAC;CACR,CAAC,CAAC,CAAC;AAEN,8EAA8E;AAC9E,MAAM,CAAC,MAAM,OAAO,GAAG,CACrB,IAAuE,EAChD,EAAE,CACzB,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;IACf,KAAK,EAAE,QAAQ,CAAC,CAAC,IAAI,UAAU,CAAC,CAAC,KAAK,EAAE;IACxC,MAAM,EAAE,CAAC,CAAC,MAAM;CACjB,CAAC,CAAC,CAAC;AAEN;;;;GAIG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG,CAC3B,IAAkB,EAClB,KAAwB,EACxB,GAAW,EACQ,EAAE;IACrB,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,sCAAsC,GAAG,GAAG,CAAC,CAAC;IAChE,CAAC;IACD,OAAO,KAAK,CAAC,QAAQ,CAAC;AACxB,CAAC,CAAC"}
|
package/dist/scales.d.ts
CHANGED
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
* (2025-26 rates revised by PCS(AFC)2026/1; 2026-27 in its Annex B)
|
|
17
17
|
*/
|
|
18
18
|
import type { Nation, TaxYear } from '@casomoltd/paye-calc';
|
|
19
|
+
import type { ScalePoint } from './scale-point.js';
|
|
19
20
|
export declare const AFC_BANDS: {
|
|
20
21
|
readonly B2: "2";
|
|
21
22
|
readonly B3: "3";
|
|
@@ -32,10 +33,6 @@ export declare const AFC_BANDS: {
|
|
|
32
33
|
export type AfcBandId = (typeof AFC_BANDS)[keyof typeof AFC_BANDS];
|
|
33
34
|
/** Ordered band IDs — use for iteration. */
|
|
34
35
|
export declare const AFC_BAND_IDS: AfcBandId[];
|
|
35
|
-
export interface ScalePoint {
|
|
36
|
-
label: string;
|
|
37
|
-
salary: number;
|
|
38
|
-
}
|
|
39
36
|
export interface HcasZone {
|
|
40
37
|
rate: number;
|
|
41
38
|
min: number;
|
|
@@ -79,5 +76,5 @@ export declare const AFC_TAX_YEARS: TaxYear[];
|
|
|
79
76
|
* England/NI base, England/NI use the base as-is. Throws
|
|
80
77
|
* {@link ScaleUnavailable} for an unpublished year rather
|
|
81
78
|
* than silently substituting another year's figures. */
|
|
82
|
-
export declare function getScalesForYear(year: TaxYear, nation
|
|
79
|
+
export declare function getScalesForYear(year: TaxYear, nation: Nation): AfcScaleYear;
|
|
83
80
|
export {};
|
package/dist/scales.js
CHANGED
|
@@ -342,7 +342,7 @@ function floorScaleYear(scaleYear, year) {
|
|
|
342
342
|
* England/NI base, England/NI use the base as-is. Throws
|
|
343
343
|
* {@link ScaleUnavailable} for an unpublished year rather
|
|
344
344
|
* than silently substituting another year's figures. */
|
|
345
|
-
export function getScalesForYear(year, nation
|
|
345
|
+
export function getScalesForYear(year, nation) {
|
|
346
346
|
const family = nation === NATION_KEYS.scotland
|
|
347
347
|
? AFC_SCALES_SCOTLAND
|
|
348
348
|
: AFC_SCALES;
|
package/dist/scales.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scales.js","sourceRoot":"","sources":["../src/scales.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAAC,WAAW,EAAE,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAC,gBAAgB,EAAC,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"scales.js","sourceRoot":"","sources":["../src/scales.ts"],"names":[],"mapp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,IAAI,CAAC,CAAC;IAC1B,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,MAAM,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC;IAC3C,CAAC;IACD,OAAO,MAAM,KAAK,WAAW,CAAC,KAAK;QACjC,CAAC,CAAC,cAAc,CAAC,IAAI,EAAE,IAAI,CAAC;QAC5B,CAAC,CAAC,IAAI,CAAC;AACX,CAAC"}
|
package/dist/take-home.d.ts
CHANGED
|
@@ -1,12 +1,41 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Pre-configured TakeHomePay for NHS
|
|
3
|
-
*
|
|
4
|
-
*
|
|
2
|
+
* Pre-configured TakeHomePay for NHS staff.
|
|
3
|
+
*
|
|
4
|
+
* The NHS Pension Scheme uses a NET PAY ARRANGEMENT: the member
|
|
5
|
+
* contribution is deducted from pay BEFORE income tax is calculated
|
|
6
|
+
* (so tax relief is automatic at the member's marginal rate), but is
|
|
7
|
+
* NOT deducted before National Insurance — NI is assessed on the full
|
|
8
|
+
* gross, including the pension contribution. Getting this wrong (also
|
|
9
|
+
* reducing NI by the pension) overstates take-home; the invariant in
|
|
10
|
+
* {@link nhsTakeHome} guards against it.
|
|
11
|
+
*
|
|
12
|
+
* Sources:
|
|
13
|
+
* - Net pay arrangement — HMRC PTM044230:
|
|
14
|
+
* https://www.gov.uk/hmrc-internal-manuals/pensions-tax-manual/ptm044230
|
|
15
|
+
* - Deducted before tax, not before NI — LITRG:
|
|
16
|
+
* https://www.litrg.org.uk/pensions/paying-pensions/tax-relief-pension-contributions/how-tax-relief-given-pension-contributions
|
|
5
17
|
*/
|
|
6
18
|
import { TakeHomePay } from '@casomoltd/paye-calc';
|
|
7
|
-
import type { TaxYear, TaxRegion } from '@casomoltd/paye-calc';
|
|
19
|
+
import type { TaxYear, TaxRegion, StudentLoanPlan, TaxCode } from '@casomoltd/paye-calc';
|
|
8
20
|
/**
|
|
9
|
-
*
|
|
10
|
-
*
|
|
21
|
+
* Generic PAYE deductions layered on the NHS salary — the paye-calc
|
|
22
|
+
* inputs a bare scale salary doesn't carry. Each is optional and
|
|
23
|
+
* defaults to "none". These are paye-calc's own concerns (nhs-pay
|
|
24
|
+
* forwards them, never re-implements the maths).
|
|
11
25
|
*/
|
|
12
|
-
export
|
|
26
|
+
export interface NhsTakeHomeOptions {
|
|
27
|
+
/** Student-loan plans being repaid (default: none). */
|
|
28
|
+
readonly studentLoans?: ReadonlySet<StudentLoanPlan>;
|
|
29
|
+
/** Tax-code override, or null/absent to derive from salary. */
|
|
30
|
+
readonly taxCode?: TaxCode | null;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @param salary Gross annual pay assessed for tax/NI (already
|
|
34
|
+
* FTE-adjusted and net of any salary sacrifice)
|
|
35
|
+
* @param pensionRate Decimal fraction (e.g. 0.098); 0 = opted out
|
|
36
|
+
* @param taxYear Which pay/tax year — required, no silent default
|
|
37
|
+
* @param taxRegion Which tax region — required; omitting it would
|
|
38
|
+
* silently tax a Scottish member at rUK rates
|
|
39
|
+
* @param options Student loans / tax-code override
|
|
40
|
+
*/
|
|
41
|
+
export declare function nhsTakeHome(salary: number, pensionRate: number, taxYear: TaxYear, taxRegion: TaxRegion, options?: NhsTakeHomeOptions): TakeHomePay;
|