@casomoltd/nhs-pay 0.32.0 → 0.33.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 +23 -21
- package/dist/afc-scales.d.ts +43 -10
- package/dist/afc-scales.js +50 -16
- package/dist/afc-scales.js.map +1 -1
- package/dist/allowances.js +11 -11
- package/dist/allowances.js.map +1 -1
- package/dist/award.d.ts +3 -3
- package/dist/award.js +21 -21
- package/dist/award.js.map +1 -1
- package/dist/circulars/england-md-1-2026-r2.d.ts +13 -0
- package/dist/circulars/england-md-1-2026-r2.js +13 -0
- package/dist/circulars/england-md-1-2026-r2.js.map +1 -1
- package/dist/circulars/ni-hsc-tc8-05-2025.d.ts +22 -0
- package/dist/circulars/ni-hsc-tc8-05-2025.js +22 -0
- package/dist/circulars/ni-hsc-tc8-05-2025.js.map +1 -1
- package/dist/circulars/scotland-pcs-dd-2025-01.d.ts +20 -0
- package/dist/circulars/scotland-pcs-dd-2025-01.js +20 -0
- package/dist/circulars/scotland-pcs-dd-2025-01.js.map +1 -1
- package/dist/circulars/scotland-pcs-dd-2026-01.d.ts +19 -0
- package/dist/circulars/scotland-pcs-dd-2026-01.js +30 -10
- package/dist/circulars/scotland-pcs-dd-2026-01.js.map +1 -1
- package/dist/circulars/scotland-pcs-dd-2026-02.d.ts +10 -0
- package/dist/circulars/scotland-pcs-dd-2026-02.js +10 -0
- package/dist/circulars/scotland-pcs-dd-2026-02.js.map +1 -1
- package/dist/circulars/wales-mdw-01-2025.d.ts +17 -0
- package/dist/circulars/wales-mdw-01-2025.js +17 -0
- package/dist/circulars/wales-mdw-01-2025.js.map +1 -1
- package/dist/circulars/wales-mdw-01-2026.d.ts +20 -0
- package/dist/circulars/wales-mdw-01-2026.js +20 -0
- package/dist/circulars/wales-mdw-01-2026.js.map +1 -1
- package/dist/commutation.js +3 -2
- package/dist/commutation.js.map +1 -1
- package/dist/dental-grades.d.ts +25 -0
- package/dist/dental-grades.js +25 -0
- package/dist/dental-grades.js.map +1 -0
- package/dist/dental-scales.d.ts +5 -21
- package/dist/dental-scales.js +73 -72
- package/dist/dental-scales.js.map +1 -1
- package/dist/format.js +3 -2
- package/dist/format.js.map +1 -1
- package/dist/hcas-pcts.d.ts +1 -1
- package/dist/hcas-zone.d.ts +23 -0
- package/dist/hcas-zone.js +17 -0
- package/dist/hcas-zone.js.map +1 -0
- package/dist/hcas.d.ts +26 -18
- package/dist/hcas.js +45 -24
- package/dist/hcas.js.map +1 -1
- package/dist/index.d.ts +23 -14
- package/dist/index.js +13 -9
- package/dist/index.js.map +1 -1
- package/dist/medical-grades.d.ts +33 -0
- package/dist/medical-grades.js +33 -0
- package/dist/medical-grades.js.map +1 -0
- package/dist/medical-scales.d.ts +10 -33
- package/dist/medical-scales.js +104 -158
- package/dist/medical-scales.js.map +1 -1
- package/dist/member/input-period.d.ts +18 -5
- package/dist/member/input-period.js +24 -13
- package/dist/member/input-period.js.map +1 -1
- package/dist/pay-round.js +3 -3
- package/dist/pay-round.js.map +1 -1
- package/dist/pay-year.d.ts +17 -0
- package/dist/pay-year.js +20 -0
- package/dist/pay-year.js.map +1 -0
- package/dist/pension/ledger.d.ts +7 -0
- package/dist/pension/ledger.js +18 -11
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension.js +2 -1
- package/dist/pension.js.map +1 -1
- package/dist/post.d.ts +20 -21
- package/dist/post.js +54 -53
- package/dist/post.js.map +1 -1
- package/dist/published/england-afc.d.ts +29 -0
- package/dist/published/england-afc.js +142 -0
- package/dist/published/england-afc.js.map +1 -0
- package/dist/published/hcas-zones.d.ts +18 -0
- package/dist/published/hcas-zones.js +46 -0
- package/dist/published/hcas-zones.js.map +1 -0
- package/dist/published/wales-living-wage.d.ts +36 -0
- package/dist/published/wales-living-wage.js +30 -0
- package/dist/published/wales-living-wage.js.map +1 -0
- package/dist/regions.d.ts +25 -14
- package/dist/regions.js +61 -71
- package/dist/regions.js.map +1 -1
- package/dist/resolver.d.ts +46 -41
- package/dist/resolver.js +70 -142
- package/dist/resolver.js.map +1 -1
- package/dist/role.d.ts +3 -3
- package/dist/scale-point.d.ts +11 -7
- package/dist/scale-point.js +29 -1
- package/dist/scale-point.js.map +1 -1
- package/dist/scale-tables.d.ts +42 -60
- package/dist/scale-tables.js +65 -105
- package/dist/scale-tables.js.map +1 -1
- package/dist/scale-translators.d.ts +90 -0
- package/dist/scale-translators.js +97 -0
- package/dist/scale-translators.js.map +1 -0
- package/dist/scales.d.ts +138 -101
- package/dist/scales.js +221 -457
- package/dist/scales.js.map +1 -1
- package/dist/sources.d.ts +8 -12
- package/dist/sources.js +9 -15
- package/dist/sources.js.map +1 -1
- package/dist/take-home.js +1 -2
- package/dist/take-home.js.map +1 -1
- package/dist/values.d.ts +10 -3
- package/dist/values.js +11 -4
- package/dist/values.js.map +1 -1
- package/dist/working-week.d.ts +23 -8
- package/dist/working-week.js +55 -25
- package/dist/working-week.js.map +1 -1
- package/package.json +3 -3
- package/dist/bands.d.ts +0 -63
- package/dist/bands.js +0 -78
- package/dist/bands.js.map +0 -1
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The high cost area supplement's zones and their rates, per pay year, as
|
|
3
|
+
* the NHS Terms and Conditions of Service Handbook prints them. HCAS is
|
|
4
|
+
* England's: only its three London regions resolve a zone.
|
|
5
|
+
*
|
|
6
|
+
* The percentages hold from year to year; the cash floor and ceiling do
|
|
7
|
+
* not. NHS Employers uprates them with each pay award and prints one table
|
|
8
|
+
* per year, so a shared table would pay the current year's ceiling on last
|
|
9
|
+
* year's salary, which is why each year has its own.
|
|
10
|
+
*
|
|
11
|
+
* Source: "NHS Terms and Conditions of Service Handbook, amendment 62"
|
|
12
|
+
* (#sa-41, 1 June 2026), Annex 9 "High cost area supplements", Table 1
|
|
13
|
+
* (from 1 April 2026) and Table 2 (from 1 April 2025).
|
|
14
|
+
*/
|
|
15
|
+
import type { YearLabel } from '@casomoltd/paye-calc';
|
|
16
|
+
import type { HcasZones } from '../hcas-zone.js';
|
|
17
|
+
/** England's zones by the pay year whose award uprated them. */
|
|
18
|
+
export declare const HCAS_ZONES: Partial<Record<YearLabel, HcasZones>>;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The high cost area supplement's zones and their rates, per pay year, as
|
|
3
|
+
* the NHS Terms and Conditions of Service Handbook prints them. HCAS is
|
|
4
|
+
* England's: only its three London regions resolve a zone.
|
|
5
|
+
*
|
|
6
|
+
* The percentages hold from year to year; the cash floor and ceiling do
|
|
7
|
+
* not. NHS Employers uprates them with each pay award and prints one table
|
|
8
|
+
* per year, so a shared table would pay the current year's ceiling on last
|
|
9
|
+
* year's salary, which is why each year has its own.
|
|
10
|
+
*
|
|
11
|
+
* Source: "NHS Terms and Conditions of Service Handbook, amendment 62"
|
|
12
|
+
* (#sa-41, 1 June 2026), Annex 9 "High cost area supplements", Table 1
|
|
13
|
+
* (from 1 April 2026) and Table 2 (from 1 April 2025).
|
|
14
|
+
*/
|
|
15
|
+
import { YEAR_LABELS } from '@casomoltd/paye-calc';
|
|
16
|
+
import { HCAS_ZONE_IDS } from '../hcas-zone.js';
|
|
17
|
+
/** The zones from 1 April 2025. */
|
|
18
|
+
const HCAS_2025_26 = {
|
|
19
|
+
[HCAS_ZONE_IDS.INNER_LONDON]: {
|
|
20
|
+
rate: 20, min: 5609, max: 8466,
|
|
21
|
+
},
|
|
22
|
+
[HCAS_ZONE_IDS.OUTER_LONDON]: {
|
|
23
|
+
rate: 15, min: 4714, max: 5941,
|
|
24
|
+
},
|
|
25
|
+
[HCAS_ZONE_IDS.FRINGE]: {
|
|
26
|
+
rate: 5, min: 1303, max: 2198,
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/** The zones from 1 April 2026. */
|
|
30
|
+
const HCAS_2026_27 = {
|
|
31
|
+
[HCAS_ZONE_IDS.INNER_LONDON]: {
|
|
32
|
+
rate: 20, min: 5794, max: 8746,
|
|
33
|
+
},
|
|
34
|
+
[HCAS_ZONE_IDS.OUTER_LONDON]: {
|
|
35
|
+
rate: 15, min: 4870, max: 6137,
|
|
36
|
+
},
|
|
37
|
+
[HCAS_ZONE_IDS.FRINGE]: {
|
|
38
|
+
rate: 5, min: 1346, max: 2270,
|
|
39
|
+
},
|
|
40
|
+
};
|
|
41
|
+
/** England's zones by the pay year whose award uprated them. */
|
|
42
|
+
export const HCAS_ZONES = {
|
|
43
|
+
[YEAR_LABELS.Y2025_26]: HCAS_2025_26,
|
|
44
|
+
[YEAR_LABELS.Y2026_27]: HCAS_2026_27,
|
|
45
|
+
};
|
|
46
|
+
//# sourceMappingURL=hcas-zones.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hcas-zones.js","sourceRoot":"","sources":["../../src/published/hcas-zones.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAGH,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AACjD,OAAO,EAAC,aAAa,EAAC,MAAM,iBAAiB,CAAC;AAG9C,mCAAmC;AACnC,MAAM,YAAY,GAAc;IAC9B,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE;QAC5B,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;KAC/B;IACD,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE;QAC5B,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;KAC/B;IACD,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;KAC9B;CACF,CAAC;AAEF,mCAAmC;AACnC,MAAM,YAAY,GAAc;IAC9B,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE;QAC5B,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;KAC/B;IACD,CAAC,aAAa,CAAC,YAAY,CAAC,EAAE;QAC5B,IAAI,EAAE,EAAE,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;KAC/B;IACD,CAAC,aAAa,CAAC,MAAM,CAAC,EAAE;QACtB,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,GAAG,EAAE,IAAI;KAC9B;CACF,CAAC;AAEF,gEAAgE;AAChE,MAAM,CAAC,MAAM,UAAU,GAA0C;IAC/D,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,YAAY;IACpC,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,YAAY;CACrC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Welsh living-wage floor.
|
|
3
|
+
*
|
|
4
|
+
* The Welsh Government applies a Living Wage Foundation floor as an advance
|
|
5
|
+
* uplift. Low spine points below it (Band 2, Band 3 entry) are lifted to
|
|
6
|
+
* it.
|
|
7
|
+
*
|
|
8
|
+
* Source: AfC(W) 01/2026 pay letter (#sa-14), 6 Jan 2026 — the hourly in
|
|
9
|
+
* its Action paragraph, the annual in its own spine-point table.
|
|
10
|
+
*
|
|
11
|
+
* Both figures below are published by that letter, and neither derives from
|
|
12
|
+
* the other: it states the annual floor as a set value, not as hourly ×
|
|
13
|
+
* hours. Read the one you mean — `hourly` to name a rate, `annual` to apply
|
|
14
|
+
* the floor.
|
|
15
|
+
*
|
|
16
|
+
* They do reconcile on the publisher's own week-year: £26,300 ÷ (37.5 ×
|
|
17
|
+
* 365/7) = £13.4502, the printed £13.45. That agreement is a useful check
|
|
18
|
+
* on the divisor and NOT a licence to derive one figure from the other,
|
|
19
|
+
* because only the publisher's rounding makes it land.
|
|
20
|
+
*
|
|
21
|
+
* One record, not two maps: they are a single published pair, and separate
|
|
22
|
+
* maps let a year land in one and not the other, or pair a revised floor
|
|
23
|
+
* with a stale rate.
|
|
24
|
+
*/
|
|
25
|
+
import type { YearLabel } from '@casomoltd/paye-calc';
|
|
26
|
+
/** The Welsh living-wage floor for a year, as its pay
|
|
27
|
+
* letter states it. */
|
|
28
|
+
export interface WalesLivingWage {
|
|
29
|
+
/** The floor applied to low spine points. */
|
|
30
|
+
readonly annual: number;
|
|
31
|
+
/** The Living Wage Foundation rate the floor is set
|
|
32
|
+
* against — quotable, never a divisor. */
|
|
33
|
+
readonly hourly: number;
|
|
34
|
+
}
|
|
35
|
+
/** The floor by the year its pay letter sets it for. */
|
|
36
|
+
export declare const WALES_LIVING_WAGE: Partial<Record<YearLabel, WalesLivingWage>>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The Welsh living-wage floor.
|
|
3
|
+
*
|
|
4
|
+
* The Welsh Government applies a Living Wage Foundation floor as an advance
|
|
5
|
+
* uplift. Low spine points below it (Band 2, Band 3 entry) are lifted to
|
|
6
|
+
* it.
|
|
7
|
+
*
|
|
8
|
+
* Source: AfC(W) 01/2026 pay letter (#sa-14), 6 Jan 2026 — the hourly in
|
|
9
|
+
* its Action paragraph, the annual in its own spine-point table.
|
|
10
|
+
*
|
|
11
|
+
* Both figures below are published by that letter, and neither derives from
|
|
12
|
+
* the other: it states the annual floor as a set value, not as hourly ×
|
|
13
|
+
* hours. Read the one you mean — `hourly` to name a rate, `annual` to apply
|
|
14
|
+
* the floor.
|
|
15
|
+
*
|
|
16
|
+
* They do reconcile on the publisher's own week-year: £26,300 ÷ (37.5 ×
|
|
17
|
+
* 365/7) = £13.4502, the printed £13.45. That agreement is a useful check
|
|
18
|
+
* on the divisor and NOT a licence to derive one figure from the other,
|
|
19
|
+
* because only the publisher's rounding makes it land.
|
|
20
|
+
*
|
|
21
|
+
* One record, not two maps: they are a single published pair, and separate
|
|
22
|
+
* maps let a year land in one and not the other, or pair a revised floor
|
|
23
|
+
* with a stale rate.
|
|
24
|
+
*/
|
|
25
|
+
import { YEAR_LABELS } from '@casomoltd/paye-calc';
|
|
26
|
+
/** The floor by the year its pay letter sets it for. */
|
|
27
|
+
export const WALES_LIVING_WAGE = {
|
|
28
|
+
[YEAR_LABELS.Y2026_27]: { annual: 26300, hourly: 13.45 },
|
|
29
|
+
};
|
|
30
|
+
//# sourceMappingURL=wales-living-wage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wales-living-wage.js","sourceRoot":"","sources":["../../src/published/wales-living-wage.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAGH,OAAO,EAAC,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAYjD,wDAAwD;AACxD,MAAM,CAAC,MAAM,iBAAiB,GAE1B;IACF,CAAC,WAAW,CAAC,QAAQ,CAAC,EAAE,EAAC,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAC;CACvD,CAAC"}
|
package/dist/regions.d.ts
CHANGED
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AFC region codes
|
|
3
|
-
*
|
|
2
|
+
* AFC region codes: one value that collapses a nation and,
|
|
3
|
+
* in England, an HCAS zone.
|
|
4
4
|
*
|
|
5
5
|
* HCAS is England-only and mutually exclusive with
|
|
6
|
-
* non-England nations, so one
|
|
6
|
+
* non-England nations, so one code covers both. This
|
|
7
|
+
* module owns the mapping both ways: a region's nation and
|
|
8
|
+
* zone, and the region for a nation and zone.
|
|
7
9
|
*
|
|
8
10
|
* UI-specific concerns (cookies, URL params, selector
|
|
9
11
|
* options, zone labels) stay in the consumer.
|
|
10
12
|
*/
|
|
11
13
|
import type { TaxRegion, Nation } from '@casomoltd/paye-calc';
|
|
12
|
-
import type {
|
|
13
|
-
import type { HcasZoneId } from './hcas.js';
|
|
14
|
+
import type { HcasZoneId } from './hcas-zone.js';
|
|
14
15
|
export declare const AFC_REGIONS: {
|
|
15
16
|
readonly ENG: "eng";
|
|
16
17
|
readonly ENG_IL: "eng-il";
|
|
@@ -21,22 +22,32 @@ export declare const AFC_REGIONS: {
|
|
|
21
22
|
readonly NI: "ni";
|
|
22
23
|
};
|
|
23
24
|
export type AfcRegionId = (typeof AFC_REGIONS)[keyof typeof AFC_REGIONS];
|
|
24
|
-
/** Type guard for region codes. */
|
|
25
|
-
export declare function isAfcRegionId(raw: string): raw is AfcRegionId;
|
|
26
25
|
export interface ResolvedRegion {
|
|
27
26
|
id: AfcRegionId;
|
|
28
27
|
taxRegion: TaxRegion;
|
|
29
|
-
/**
|
|
30
|
-
|
|
31
|
-
isWales: boolean;
|
|
28
|
+
/** The region's HCAS zone, if it has one: England's London regions only. */
|
|
29
|
+
zone: HcasZoneId | null;
|
|
32
30
|
}
|
|
33
|
-
/**
|
|
31
|
+
/** Each HCAS zone's region code. Total over the zones by its type, so a
|
|
32
|
+
* zone with no region fails to compile; a region's own zone is read back
|
|
33
|
+
* from it ({@link afcRegionToHcasZone}), so the pairing is stated once. */
|
|
34
|
+
export declare const ZONE_TO_REGION: Readonly<Record<HcasZoneId, AfcRegionId>>;
|
|
35
|
+
/** Type guard for region codes. */
|
|
36
|
+
export declare function isAfcRegionId(raw: string): raw is AfcRegionId;
|
|
37
|
+
/** Resolve a region code to its tax region and HCAS zone. */
|
|
34
38
|
export declare function resolveRegion(id: AfcRegionId): ResolvedRegion;
|
|
35
39
|
/** Map an AfC region code to a paye-calc Nation. */
|
|
36
40
|
export declare function afcRegionToNation(id: AfcRegionId): Nation;
|
|
37
|
-
export declare const ZONE_TO_REGION: Record<HcasZoneId, AfcRegionId>;
|
|
38
41
|
/** Map an AfC region code to its HCAS zone,
|
|
39
42
|
* or null for non-HCAS regions. */
|
|
40
43
|
export declare function afcRegionToHcasZone(id: AfcRegionId): HcasZoneId | null;
|
|
41
|
-
/**
|
|
42
|
-
|
|
44
|
+
/** A nation's base AfC region: the one with no HCAS supplement, so its
|
|
45
|
+
* scale is the one the nation publishes. */
|
|
46
|
+
export declare function baseAfcRegion(nation: Nation): AfcRegionId;
|
|
47
|
+
/**
|
|
48
|
+
* The AfC region for a nation and, in England, an HCAS zone. Throws for a
|
|
49
|
+
* zone outside England: HCAS is England's only, so Wales with a fringe
|
|
50
|
+
* zone is a state the caller should not hold, not one to quietly read as
|
|
51
|
+
* England's fringe.
|
|
52
|
+
*/
|
|
53
|
+
export declare function afcRegionOf(nation: Nation, zone: HcasZoneId | null): AfcRegionId;
|
package/dist/regions.js
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* AFC region codes
|
|
3
|
-
*
|
|
2
|
+
* AFC region codes: one value that collapses a nation and,
|
|
3
|
+
* in England, an HCAS zone.
|
|
4
4
|
*
|
|
5
5
|
* HCAS is England-only and mutually exclusive with
|
|
6
|
-
* non-England nations, so one
|
|
6
|
+
* non-England nations, so one code covers both. This
|
|
7
|
+
* module owns the mapping both ways: a region's nation and
|
|
8
|
+
* zone, and the region for a nation and zone.
|
|
7
9
|
*
|
|
8
10
|
* UI-specific concerns (cookies, URL params, selector
|
|
9
11
|
* options, zone labels) stay in the consumer.
|
|
10
12
|
*/
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
+
import { NATION_KEYS, nationToTaxRegion, } from '@casomoltd/paye-calc';
|
|
14
|
+
import { HCAS_ZONE_IDS } from './hcas-zone.js';
|
|
15
|
+
import { invariant } from './errors.js';
|
|
16
|
+
// ── Types ───────────────────────────────────────
|
|
13
17
|
export const AFC_REGIONS = {
|
|
14
18
|
ENG: 'eng',
|
|
15
19
|
ENG_IL: 'eng-il',
|
|
@@ -19,85 +23,71 @@ export const AFC_REGIONS = {
|
|
|
19
23
|
SCO: 'sco',
|
|
20
24
|
NI: 'ni',
|
|
21
25
|
};
|
|
26
|
+
// ── Tables ──────────────────────────────────────
|
|
27
|
+
/** Each HCAS zone's region code. Total over the zones by its type, so a
|
|
28
|
+
* zone with no region fails to compile; a region's own zone is read back
|
|
29
|
+
* from it ({@link afcRegionToHcasZone}), so the pairing is stated once. */
|
|
30
|
+
export const ZONE_TO_REGION = {
|
|
31
|
+
[HCAS_ZONE_IDS.INNER_LONDON]: AFC_REGIONS.ENG_IL,
|
|
32
|
+
[HCAS_ZONE_IDS.OUTER_LONDON]: AFC_REGIONS.ENG_OL,
|
|
33
|
+
[HCAS_ZONE_IDS.FRINGE]: AFC_REGIONS.ENG_FR,
|
|
34
|
+
};
|
|
22
35
|
const AFC_REGION_ID_LIST = Object.values(AFC_REGIONS);
|
|
36
|
+
/** Each region code's nation. */
|
|
37
|
+
const REGION_NATION = {
|
|
38
|
+
[AFC_REGIONS.ENG]: NATION_KEYS.england,
|
|
39
|
+
[AFC_REGIONS.ENG_IL]: NATION_KEYS.england,
|
|
40
|
+
[AFC_REGIONS.ENG_OL]: NATION_KEYS.england,
|
|
41
|
+
[AFC_REGIONS.ENG_FR]: NATION_KEYS.england,
|
|
42
|
+
[AFC_REGIONS.WAL]: NATION_KEYS.wales,
|
|
43
|
+
[AFC_REGIONS.SCO]: NATION_KEYS.scotland,
|
|
44
|
+
[AFC_REGIONS.NI]: NATION_KEYS.northernIreland,
|
|
45
|
+
};
|
|
46
|
+
/** Each nation's base region: the one with no HCAS zone. */
|
|
47
|
+
const BASE_REGION = {
|
|
48
|
+
[NATION_KEYS.england]: AFC_REGIONS.ENG,
|
|
49
|
+
[NATION_KEYS.wales]: AFC_REGIONS.WAL,
|
|
50
|
+
[NATION_KEYS.scotland]: AFC_REGIONS.SCO,
|
|
51
|
+
[NATION_KEYS.northernIreland]: AFC_REGIONS.NI,
|
|
52
|
+
};
|
|
53
|
+
// ── Functions ───────────────────────────────────
|
|
23
54
|
/** Type guard for region codes. */
|
|
24
55
|
export function isAfcRegionId(raw) {
|
|
25
56
|
return AFC_REGION_ID_LIST.includes(raw);
|
|
26
57
|
}
|
|
27
|
-
|
|
28
|
-
[AFC_REGIONS.ENG]: {
|
|
29
|
-
taxRegion: TAX_REGIONS.rUK,
|
|
30
|
-
hcasProp: null,
|
|
31
|
-
isWales: false,
|
|
32
|
-
},
|
|
33
|
-
[AFC_REGIONS.ENG_IL]: {
|
|
34
|
-
taxRegion: TAX_REGIONS.rUK,
|
|
35
|
-
hcasProp: 'innerLondon',
|
|
36
|
-
isWales: false,
|
|
37
|
-
},
|
|
38
|
-
[AFC_REGIONS.ENG_OL]: {
|
|
39
|
-
taxRegion: TAX_REGIONS.rUK,
|
|
40
|
-
hcasProp: 'outerLondon',
|
|
41
|
-
isWales: false,
|
|
42
|
-
},
|
|
43
|
-
[AFC_REGIONS.ENG_FR]: {
|
|
44
|
-
taxRegion: TAX_REGIONS.rUK,
|
|
45
|
-
hcasProp: 'fringe',
|
|
46
|
-
isWales: false,
|
|
47
|
-
},
|
|
48
|
-
[AFC_REGIONS.WAL]: {
|
|
49
|
-
taxRegion: TAX_REGIONS.rUK,
|
|
50
|
-
hcasProp: null,
|
|
51
|
-
isWales: true,
|
|
52
|
-
},
|
|
53
|
-
[AFC_REGIONS.SCO]: {
|
|
54
|
-
taxRegion: TAX_REGIONS.scotland,
|
|
55
|
-
hcasProp: null,
|
|
56
|
-
isWales: false,
|
|
57
|
-
},
|
|
58
|
-
[AFC_REGIONS.NI]: {
|
|
59
|
-
taxRegion: TAX_REGIONS.rUK,
|
|
60
|
-
hcasProp: null,
|
|
61
|
-
isWales: false,
|
|
62
|
-
},
|
|
63
|
-
};
|
|
64
|
-
/** Resolve a region code to tax/HCAS/label info. */
|
|
58
|
+
/** Resolve a region code to its tax region and HCAS zone. */
|
|
65
59
|
export function resolveRegion(id) {
|
|
66
|
-
return {
|
|
60
|
+
return {
|
|
61
|
+
id,
|
|
62
|
+
taxRegion: nationToTaxRegion(REGION_NATION[id]),
|
|
63
|
+
zone: afcRegionToHcasZone(id),
|
|
64
|
+
};
|
|
67
65
|
}
|
|
68
|
-
// ── Region → Nation mapping ────────────────
|
|
69
|
-
const REGION_TO_NATION = {
|
|
70
|
-
[AFC_REGIONS.ENG]: 'england',
|
|
71
|
-
[AFC_REGIONS.ENG_IL]: 'england',
|
|
72
|
-
[AFC_REGIONS.ENG_OL]: 'england',
|
|
73
|
-
[AFC_REGIONS.ENG_FR]: 'england',
|
|
74
|
-
[AFC_REGIONS.WAL]: 'wales',
|
|
75
|
-
[AFC_REGIONS.SCO]: 'scotland',
|
|
76
|
-
[AFC_REGIONS.NI]: 'northern-ireland',
|
|
77
|
-
};
|
|
78
66
|
/** Map an AfC region code to a paye-calc Nation. */
|
|
79
67
|
export function afcRegionToNation(id) {
|
|
80
|
-
return
|
|
68
|
+
return REGION_NATION[id];
|
|
81
69
|
}
|
|
82
|
-
// ── Zone → Region mapping ─────────────────
|
|
83
|
-
export const ZONE_TO_REGION = {
|
|
84
|
-
'inner-london': AFC_REGIONS.ENG_IL,
|
|
85
|
-
'outer-london': AFC_REGIONS.ENG_OL,
|
|
86
|
-
fringe: AFC_REGIONS.ENG_FR,
|
|
87
|
-
};
|
|
88
|
-
// ── Region → Zone mapping ─────────────────
|
|
89
|
-
const REGION_TO_ZONE = Object.fromEntries(Object.entries(ZONE_TO_REGION)
|
|
90
|
-
.map(([z, r]) => [r, z]));
|
|
91
70
|
/** Map an AfC region code to its HCAS zone,
|
|
92
71
|
* or null for non-HCAS regions. */
|
|
93
72
|
export function afcRegionToHcasZone(id) {
|
|
94
|
-
|
|
73
|
+
const zones = Object.keys(ZONE_TO_REGION);
|
|
74
|
+
return zones.find((zone) => ZONE_TO_REGION[zone] === id) ?? null;
|
|
75
|
+
}
|
|
76
|
+
/** A nation's base AfC region: the one with no HCAS supplement, so its
|
|
77
|
+
* scale is the one the nation publishes. */
|
|
78
|
+
export function baseAfcRegion(nation) {
|
|
79
|
+
return BASE_REGION[nation];
|
|
95
80
|
}
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
81
|
+
/**
|
|
82
|
+
* The AfC region for a nation and, in England, an HCAS zone. Throws for a
|
|
83
|
+
* zone outside England: HCAS is England's only, so Wales with a fringe
|
|
84
|
+
* zone is a state the caller should not hold, not one to quietly read as
|
|
85
|
+
* England's fringe.
|
|
86
|
+
*/
|
|
87
|
+
export function afcRegionOf(nation, zone) {
|
|
88
|
+
if (zone === null)
|
|
89
|
+
return BASE_REGION[nation];
|
|
90
|
+
invariant(nation === NATION_KEYS.england, `afcRegionOf: ${nation} has no HCAS zone (${zone})`);
|
|
91
|
+
return ZONE_TO_REGION[zone];
|
|
102
92
|
}
|
|
103
93
|
//# sourceMappingURL=regions.js.map
|
package/dist/regions.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"regions.js","sourceRoot":"","sources":["../src/regions.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"regions.js","sourceRoot":"","sources":["../src/regions.ts"],"names":[],"mappings":"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"}
|
package/dist/resolver.d.ts
CHANGED
|
@@ -1,21 +1,50 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Pay-scale resolvers — build a {@link Post} from a
|
|
3
3
|
* published pay scale. The AfC resolver reads the
|
|
4
|
-
* Agenda-for-Change tables; medical
|
|
5
|
-
*
|
|
6
|
-
*
|
|
4
|
+
* Agenda-for-Change tables; the medical and dental resolvers
|
|
5
|
+
* read their own, all producing the same uniform Post.
|
|
6
|
+
* Polymorphism lives here, not on the Post.
|
|
7
7
|
*
|
|
8
8
|
* Each resolver stamps the Post's {@link Role} identity from
|
|
9
9
|
* the inputs it already holds (band / point / region), so the
|
|
10
10
|
* Post knows which scale position it came from.
|
|
11
11
|
*/
|
|
12
|
-
import type { Nation, PayYear
|
|
13
|
-
import type { AfcBandId } from './
|
|
12
|
+
import type { Nation, PayYear } from '@casomoltd/paye-calc';
|
|
13
|
+
import type { AfcBandId } from './afc-band.js';
|
|
14
14
|
import type { ScalePoint } from './scale-point.js';
|
|
15
15
|
import type { AfcRegionId } from './regions.js';
|
|
16
|
-
import type { MedicalGradeId } from './medical-
|
|
17
|
-
import type { DentalGradeId } from './dental-
|
|
16
|
+
import type { MedicalGradeId } from './medical-grades.js';
|
|
17
|
+
import type { DentalGradeId } from './dental-grades.js';
|
|
18
18
|
import { Post } from './post.js';
|
|
19
|
+
import type { PostIdentity } from './post.js';
|
|
20
|
+
/**
|
|
21
|
+
* The two years a Post is built from, as {@link PostIdentity} names them:
|
|
22
|
+
* the pay year whose scale a point was read from, and the tax year whose
|
|
23
|
+
* deductions apply. Both are required, for the reason given there.
|
|
24
|
+
*/
|
|
25
|
+
export type ScaleYears = Pick<PostIdentity, 'payYear' | 'taxYear'>;
|
|
26
|
+
/** An AfC point the caller holds, and where to price it. */
|
|
27
|
+
export interface AfcPointQuery extends ScaleYears {
|
|
28
|
+
readonly band: AfcBandId;
|
|
29
|
+
readonly point: ScalePoint;
|
|
30
|
+
readonly region: AfcRegionId;
|
|
31
|
+
}
|
|
32
|
+
/** An AfC point named by its label, and where to price it. */
|
|
33
|
+
export interface AfcLabelQuery extends ScaleYears {
|
|
34
|
+
readonly band: AfcBandId;
|
|
35
|
+
readonly pointLabel: string;
|
|
36
|
+
readonly region: AfcRegionId;
|
|
37
|
+
}
|
|
38
|
+
/** A medical or dental point the caller holds, and the Post it prices. */
|
|
39
|
+
export interface GradePointQuery<G extends string> extends PostIdentity {
|
|
40
|
+
readonly grade: G;
|
|
41
|
+
readonly point: ScalePoint;
|
|
42
|
+
}
|
|
43
|
+
/** A medical or dental point named by its label, and the Post it prices. */
|
|
44
|
+
export interface GradeLabelQuery<G extends string> extends PostIdentity {
|
|
45
|
+
readonly grade: G;
|
|
46
|
+
readonly pointLabel: string;
|
|
47
|
+
}
|
|
19
48
|
/**
|
|
20
49
|
* The uniform contract every pay family satisfies: build a
|
|
21
50
|
* Post from a salary, and enumerate what is published. The
|
|
@@ -24,8 +53,10 @@ import { Post } from './post.js';
|
|
|
24
53
|
* resolver's own interface, not this shared one.
|
|
25
54
|
*/
|
|
26
55
|
export interface PayScaleResolver<G extends string> {
|
|
27
|
-
|
|
28
|
-
|
|
56
|
+
/** An off-scale Post at a salary, in a nation and both years. */
|
|
57
|
+
fromSalary(salary: number, identity: PostIdentity): Post;
|
|
58
|
+
/** Grades with a published scale for this nation/year. Throws
|
|
59
|
+
* {@link ScaleUnavailable} where the nation publishes none that year. */
|
|
29
60
|
availableGrades(nation: Nation, year: PayYear): readonly G[];
|
|
30
61
|
/** Latest PAY year a grade is published for a nation, or null. */
|
|
31
62
|
latestYearFor(gradeId: G, nation: Nation): PayYear | null;
|
|
@@ -34,7 +65,7 @@ export interface PayScaleResolver<G extends string> {
|
|
|
34
65
|
* AfC resolver — adds a band + point + region entry. AfC
|
|
35
66
|
* take-home threads an {@link AfcRegionId} (nation + HCAS
|
|
36
67
|
* zone collapsed), not a bare Nation, so its scale-point
|
|
37
|
-
* path resolves the HCAS
|
|
68
|
+
* path resolves the HCAS gross itself.
|
|
38
69
|
*/
|
|
39
70
|
export interface AfcResolver extends PayScaleResolver<AfcBandId> {
|
|
40
71
|
/**
|
|
@@ -48,26 +79,9 @@ export interface AfcResolver extends PayScaleResolver<AfcBandId> {
|
|
|
48
79
|
* relabelling away from a repeat. A caller holding the point should
|
|
49
80
|
* not depend on the property.
|
|
50
81
|
*/
|
|
51
|
-
fromPoint(
|
|
52
|
-
|
|
53
|
-
year: PayYear,
|
|
54
|
-
/**
|
|
55
|
-
* The year whose tax, NI and pension tiers apply.
|
|
56
|
-
*
|
|
57
|
-
* REQUIRED, and deliberately not defaulted to `year`. A nation
|
|
58
|
-
* whose pay round runs late pays last year's salary under this
|
|
59
|
-
* year's deductions, and the contribution tier is set by the
|
|
60
|
-
* scheme year, not by the round the salary came from. When this
|
|
61
|
-
* defaulted, every caller that simply did not think about it got
|
|
62
|
-
* the salary's own year — which is how a Northern Irish reader's
|
|
63
|
-
* 2025-26 pay came to be priced at 2025-26 deductions in the
|
|
64
|
-
* 2026-27 tax year. Making it explicit costs one argument and
|
|
65
|
-
* removes the whole class.
|
|
66
|
-
*/
|
|
67
|
-
taxYear: TaxYear): Post;
|
|
68
|
-
fromScalePoint(band: AfcBandId, pointLabel: string, region: AfcRegionId, year: PayYear, taxYear: TaxYear): Post;
|
|
82
|
+
fromPoint(query: AfcPointQuery): Post;
|
|
83
|
+
fromScalePoint(query: AfcLabelQuery): Post;
|
|
69
84
|
}
|
|
70
|
-
export declare const afcResolver: AfcResolver;
|
|
71
85
|
/**
|
|
72
86
|
* A basic-pay-by-nation resolver (medical, dental) — like the AfC
|
|
73
87
|
* resolver, but its scale-point entry threads a bare {@link Nation}
|
|
@@ -85,22 +99,13 @@ export interface NationScaleResolver<G extends string> extends PayScaleResolver<
|
|
|
85
99
|
* over rather than round-trip through a string that may match
|
|
86
100
|
* several and throw.
|
|
87
101
|
*/
|
|
88
|
-
fromPoint(
|
|
89
|
-
|
|
90
|
-
year: PayYear,
|
|
91
|
-
/**
|
|
92
|
-
* The year whose tax, NI and pension tiers apply.
|
|
93
|
-
*
|
|
94
|
-
* REQUIRED, for the reason given on {@link AfcResolver.fromPoint}:
|
|
95
|
-
* defaulting it to the salary's own year is silent, and silence
|
|
96
|
-
* is what mispriced a nation whose pay round had run late.
|
|
97
|
-
*/
|
|
98
|
-
taxYear: TaxYear): Post;
|
|
99
|
-
fromScalePoint(grade: G, pointLabel: string, nation: Nation, year: PayYear, taxYear: TaxYear): Post;
|
|
102
|
+
fromPoint(query: GradePointQuery<G>): Post;
|
|
103
|
+
fromScalePoint(query: GradeLabelQuery<G>): Post;
|
|
100
104
|
}
|
|
101
105
|
/** Medical (doctors) resolver — a grade + point + nation entry. */
|
|
102
106
|
export type MedicalResolver = NationScaleResolver<MedicalGradeId>;
|
|
103
107
|
/** Salaried dental resolver — a grade + point + nation entry. */
|
|
104
108
|
export type DentalResolver = NationScaleResolver<DentalGradeId>;
|
|
109
|
+
export declare const afcResolver: AfcResolver;
|
|
105
110
|
export declare const medicalResolver: MedicalResolver;
|
|
106
111
|
export declare const dentalResolver: DentalResolver;
|