@casomoltd/nhs-pay 0.32.0 → 0.34.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 +24 -22
- package/dist/afc-band.d.ts +4 -4
- package/dist/afc-band.js +4 -4
- package/dist/afc-scales.d.ts +89 -60
- package/dist/afc-scales.js +166 -182
- 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/afc-shapes.d.ts +41 -21
- package/dist/circulars/afc-shapes.js +9 -8
- package/dist/circulars/afc-shapes.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-afc-06-2025.d.ts +3 -2
- package/dist/circulars/ni-hsc-afc-06-2025.js +3 -2
- package/dist/circulars/ni-hsc-afc-06-2025.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-pcts.js +1 -1
- package/dist/hcas-pcts.js.map +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 +25 -16
- package/dist/index.js +14 -10
- 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 +72 -0
- package/dist/published/england-afc.js +86 -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 +164 -102
- package/dist/scales.js +242 -462
- 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
package/dist/scales.js
CHANGED
|
@@ -1,451 +1,177 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* NHS Agenda for Change pay scales by
|
|
2
|
+
* NHS Agenda for Change pay scales by pay year, for every nation, and the
|
|
3
|
+
* lookups over them.
|
|
3
4
|
*
|
|
4
5
|
* Pure salary data — no metadata (labels, slugs, role
|
|
5
6
|
* descriptions); presentation copy is a consumer concern.
|
|
6
7
|
*
|
|
7
|
-
* ──
|
|
8
|
+
* ── Where each nation's figures come from ──
|
|
8
9
|
*
|
|
9
10
|
* Scotland, Wales and Northern Ireland each publish an AfC pay
|
|
10
11
|
* CIRCULAR, so each is transcribed verbatim in `src/circulars/*` and
|
|
11
12
|
* translated to canonical points by `afc-scales.ts`. This module holds
|
|
12
13
|
* the result, not the transcription.
|
|
13
14
|
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
20
|
-
*
|
|
21
|
-
*
|
|
22
|
-
* Sources for what is authored HERE, by the names they carry in
|
|
23
|
-
* docs/source-archive.md, which holds every publisher URL and
|
|
24
|
-
* archived copy:
|
|
25
|
-
* - "NHS Employers — AfC pay scales 2025/26"
|
|
26
|
-
* - "NHS Employers — AfC pay scales 2026/27" (note its hourly
|
|
27
|
-
* table has printing errors; this file reads the ANNUAL
|
|
28
|
-
* column, so they cannot reach us — see the manifest)
|
|
29
|
-
* - "NHS Employers, 2026 AfC pay scales poster" — the same award
|
|
30
|
-
* rendered a second time by the same publisher, which is what
|
|
31
|
-
* confirms the annual column above is untouched by those errors
|
|
32
|
-
* - "Health Careers — AfC pay rates"
|
|
33
|
-
* - NLW: "GOV.UK — national minimum wage rates"
|
|
34
|
-
* - Wales floor: "Wales, AFC(W) 01/2026 living wage"
|
|
35
|
-
* - HCAS rates: "NHS Terms and Conditions of Service
|
|
36
|
-
* Handbook, amendment 62" (#sa-41), Annex 9
|
|
37
|
-
*
|
|
38
|
-
* The other three nations' sources are cited in their own circular
|
|
39
|
-
* files, beside the data they justify — including the warning that
|
|
40
|
-
* Scotland's MSG consolidated table prints superseded 4.25% rates and
|
|
15
|
+
* England publishes no AfC circular, so its tables are transcribed from
|
|
16
|
+
* the publisher's page in `src/published/england-afc.ts` (the README's
|
|
17
|
+
* AfC pay scales rule) and translated by `afc-scales.ts` like the
|
|
18
|
+
* others. The HCAS zones and the Welsh living-wage floor sit beside it
|
|
19
|
+
* in `src/published/`, each citing its own
|
|
20
|
+
* source. The other three nations' sources are cited in their own
|
|
21
|
+
* circular files, beside the data they justify — including the warning
|
|
22
|
+
* that Scotland's MSG consolidated table prints superseded 4.25% rates and
|
|
41
23
|
* must not be read instead of the circular.
|
|
42
24
|
*
|
|
43
25
|
* POINT LABELS — one convention, all four nations. A point's label is
|
|
44
26
|
* the year of service in which a member first reaches it: increment 1
|
|
45
27
|
* is `Year 1`, and the top point takes a `+` because service continues
|
|
46
28
|
* past it. No publisher prints such a label; every one is our reading
|
|
47
|
-
* of an interval the publisher does print. For
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
* `afcPoint`, which writes the label and the year
|
|
29
|
+
* of an interval the publisher does print. For all four nations the
|
|
30
|
+
* year is derived in `afc-scales.ts`, from the transcribed interval
|
|
31
|
+
* (England, Wales, Northern Ireland) or Annex C's yearly increment
|
|
32
|
+
* (Scotland), through `afcPoint`, which writes the label and the year
|
|
33
|
+
* from one number, so
|
|
51
34
|
* a label and the timing a pay path reads from it cannot disagree.
|
|
52
35
|
*
|
|
53
36
|
* Labels are lookup keys for `afcResolver.fromScalePoint`, so changing
|
|
54
37
|
* one is an API change, and the fixtures assert them.
|
|
38
|
+
*
|
|
39
|
+
* Pension tiers are a separate read (`getPensionTiers`), since a nation
|
|
40
|
+
* can publish a scale for a year with no tier table.
|
|
55
41
|
*/
|
|
56
|
-
import { NATION_KEYS,
|
|
42
|
+
import { NATION_KEYS, YEAR_LABELS, closingYearOf, } from '@casomoltd/paye-calc';
|
|
57
43
|
import { ScaleUnavailable, invariant } from './errors.js';
|
|
58
44
|
import { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_W_02_2025, AFC_W_02_2026, } from './sources.js';
|
|
59
|
-
import {
|
|
60
|
-
import {
|
|
61
|
-
import {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// Table 2 (from 1 April 2025).
|
|
76
|
-
const HCAS_2025_26 = {
|
|
77
|
-
innerLondon: {
|
|
78
|
-
rate: 20, min: 5609, max: 8466,
|
|
79
|
-
},
|
|
80
|
-
outerLondon: {
|
|
81
|
-
rate: 15, min: 4714, max: 5941,
|
|
82
|
-
},
|
|
83
|
-
fringe: {
|
|
84
|
-
rate: 5, min: 1303, max: 2198,
|
|
85
|
-
},
|
|
45
|
+
import { onlyPointLabelled } from './scale-point.js';
|
|
46
|
+
import { salaryRangeOf } from './values.js';
|
|
47
|
+
import { ENGLAND_TABLES_2025_26, ENGLAND_TABLES_2026_27, NI_TABLES_2025_26, SCOTLAND_TABLES_2025_26, SCOTLAND_TABLES_2026_27, WALES_TABLES_2025_26, WALES_TABLES_2026_27, } from './afc-scales.js';
|
|
48
|
+
import { AFC_BAND_IDS } from './afc-band.js';
|
|
49
|
+
import { schemeYearOfPayYear } from './pay-year.js';
|
|
50
|
+
/** What {@link afcPayYearFor} finds for a scheme year. */
|
|
51
|
+
export const AFC_PAY_YEAR_KINDS = {
|
|
52
|
+
/** This library holds the nation's scale for the year. */
|
|
53
|
+
held: 'held',
|
|
54
|
+
/** The year is before the earliest scale this library holds for the
|
|
55
|
+
* nation. */
|
|
56
|
+
notHeld: 'notHeld',
|
|
57
|
+
/** The year is after the latest scale this library holds for the
|
|
58
|
+
* nation, and no later than the round after the tax year given: its
|
|
59
|
+
* award is awaited. A year further on is refused. */
|
|
60
|
+
awaited: 'awaited',
|
|
86
61
|
};
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
62
|
+
/**
|
|
63
|
+
* Every nation's published AfC scales, by pay year. Total over Nation, so
|
|
64
|
+
* adding a nation is a compile error here rather than a silent fall-through
|
|
65
|
+
* to England's. Each nation is its own even where the figures coincide.
|
|
66
|
+
*
|
|
67
|
+
* Held per (nation, year), source included: a year-blind citation puts the
|
|
68
|
+
* 2026/27 pay-scales page beneath a 2025-26 table, which reads as a claim
|
|
69
|
+
* the reader cannot check. England and Northern Ireland share a salary
|
|
70
|
+
* TABLE and do not share a SOURCE: NI publishes its own circular, and its
|
|
71
|
+
* figures matching England's is a fact about the two publishers rather
|
|
72
|
+
* than a licence to cite one for the other.
|
|
73
|
+
*
|
|
74
|
+
* Every nation's points come through `afc-scales.ts`: the three devolved
|
|
75
|
+
* nations from their verbatim circulars, England from its NHS Employers
|
|
76
|
+
* page in `published/`. Each record carries the nation-year's Band 1
|
|
77
|
+
* beside its ladder, so a new round is one entry here.
|
|
78
|
+
*/
|
|
79
|
+
const AFC_SCALE_YEARS = {
|
|
80
|
+
[NATION_KEYS.england]: {
|
|
81
|
+
[YEAR_LABELS.Y2025_26]: { ...ENGLAND_TABLES_2025_26, source: AFC_ENGLAND_SCALES_2025 },
|
|
82
|
+
[YEAR_LABELS.Y2026_27]: { ...ENGLAND_TABLES_2026_27, source: AFC_ENGLAND_SCALES_2026 },
|
|
93
83
|
},
|
|
94
|
-
|
|
95
|
-
|
|
84
|
+
[NATION_KEYS.northernIreland]: {
|
|
85
|
+
// One year: NI has issued no 2026-27 circular (see NI_TABLES_2025_26).
|
|
86
|
+
[YEAR_LABELS.Y2025_26]: { ...NI_TABLES_2025_26, source: AFC_NI_2025 },
|
|
96
87
|
},
|
|
97
|
-
|
|
98
|
-
//
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
// entry point, a 2-year progression interval and a top point,
|
|
104
|
-
// and the wage floor has compressed the two to the same cash
|
|
105
|
-
// figure — so the structure is published and the equality is
|
|
106
|
-
// the fact, not a reason to collapse it. Wales's Band 2 is the
|
|
107
|
-
// same shape and is modelled the same way.
|
|
108
|
-
'2': [
|
|
109
|
-
afcPoint(1, false, 24465),
|
|
110
|
-
afcPoint(3, true, 24465),
|
|
111
|
-
],
|
|
112
|
-
'3': [
|
|
113
|
-
afcPoint(1, false, 24937),
|
|
114
|
-
afcPoint(3, true, 26598),
|
|
115
|
-
],
|
|
116
|
-
'4': [
|
|
117
|
-
afcPoint(1, false, 27485),
|
|
118
|
-
afcPoint(4, true, 30162),
|
|
119
|
-
],
|
|
120
|
-
'5': [
|
|
121
|
-
afcPoint(1, false, 31049),
|
|
122
|
-
afcPoint(3, false, 33487),
|
|
123
|
-
afcPoint(5, true, 37796),
|
|
124
|
-
],
|
|
125
|
-
'6': [
|
|
126
|
-
afcPoint(1, false, 38682),
|
|
127
|
-
afcPoint(3, false, 40823),
|
|
128
|
-
afcPoint(6, true, 46580),
|
|
129
|
-
],
|
|
130
|
-
'7': [
|
|
131
|
-
afcPoint(1, false, 47810),
|
|
132
|
-
afcPoint(3, false, 50273),
|
|
133
|
-
afcPoint(6, true, 54710),
|
|
134
|
-
],
|
|
135
|
-
'8a': [
|
|
136
|
-
afcPoint(1, false, 55690),
|
|
137
|
-
afcPoint(3, false, 58487),
|
|
138
|
-
afcPoint(6, true, 62682),
|
|
139
|
-
],
|
|
140
|
-
'8b': [
|
|
141
|
-
afcPoint(1, false, 64455),
|
|
142
|
-
afcPoint(3, false, 68631),
|
|
143
|
-
afcPoint(6, true, 74896),
|
|
144
|
-
],
|
|
145
|
-
'8c': [
|
|
146
|
-
afcPoint(1, false, 76965),
|
|
147
|
-
afcPoint(3, false, 81652),
|
|
148
|
-
afcPoint(6, true, 88682),
|
|
149
|
-
],
|
|
150
|
-
'8d': [
|
|
151
|
-
afcPoint(1, false, 91342),
|
|
152
|
-
afcPoint(3, false, 96941),
|
|
153
|
-
afcPoint(6, true, 105337),
|
|
154
|
-
],
|
|
155
|
-
'9': [
|
|
156
|
-
afcPoint(1, false, 109179),
|
|
157
|
-
afcPoint(3, false, 115763),
|
|
158
|
-
afcPoint(6, true, 125637),
|
|
159
|
-
],
|
|
88
|
+
[NATION_KEYS.scotland]: {
|
|
89
|
+
// One circular restates both years: PCS(AFC)2026/1 revised the
|
|
90
|
+
// 2025-26 figure when the inflation guarantee triggered and restates
|
|
91
|
+
// 2026-27, so it is current for each.
|
|
92
|
+
[YEAR_LABELS.Y2025_26]: { ...SCOTLAND_TABLES_2025_26, source: AFC_SCOTLAND },
|
|
93
|
+
[YEAR_LABELS.Y2026_27]: { ...SCOTLAND_TABLES_2026_27, source: AFC_SCOTLAND },
|
|
160
94
|
},
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
hcas: HCAS_2026_27,
|
|
165
|
-
scales: {
|
|
166
|
-
// Two points, both 25272. The publisher prints Band 2 with an
|
|
167
|
-
// entry point, a 2-year progression interval and a top point,
|
|
168
|
-
// and the wage floor has compressed the two to the same cash
|
|
169
|
-
// figure — so the structure is published and the equality is
|
|
170
|
-
// the fact, not a reason to collapse it. Wales's Band 2 is the
|
|
171
|
-
// same shape and is modelled the same way.
|
|
172
|
-
'2': [
|
|
173
|
-
afcPoint(1, false, 25272),
|
|
174
|
-
afcPoint(3, true, 25272),
|
|
175
|
-
],
|
|
176
|
-
'3': [
|
|
177
|
-
afcPoint(1, false, 25760),
|
|
178
|
-
afcPoint(3, true, 27476),
|
|
179
|
-
],
|
|
180
|
-
'4': [
|
|
181
|
-
afcPoint(1, false, 28392),
|
|
182
|
-
afcPoint(4, true, 31157),
|
|
183
|
-
],
|
|
184
|
-
'5': [
|
|
185
|
-
afcPoint(1, false, 32073),
|
|
186
|
-
afcPoint(3, false, 34592),
|
|
187
|
-
afcPoint(5, true, 39043),
|
|
188
|
-
],
|
|
189
|
-
'6': [
|
|
190
|
-
afcPoint(1, false, 39959),
|
|
191
|
-
afcPoint(3, false, 42170),
|
|
192
|
-
afcPoint(6, true, 48117),
|
|
193
|
-
],
|
|
194
|
-
'7': [
|
|
195
|
-
afcPoint(1, false, 49387),
|
|
196
|
-
afcPoint(3, false, 51932),
|
|
197
|
-
afcPoint(6, true, 56515),
|
|
198
|
-
],
|
|
199
|
-
'8a': [
|
|
200
|
-
afcPoint(1, false, 57528),
|
|
201
|
-
afcPoint(3, false, 60417),
|
|
202
|
-
afcPoint(6, true, 64750),
|
|
203
|
-
],
|
|
204
|
-
'8b': [
|
|
205
|
-
afcPoint(1, false, 66582),
|
|
206
|
-
afcPoint(3, false, 70896),
|
|
207
|
-
afcPoint(6, true, 77368),
|
|
208
|
-
],
|
|
209
|
-
'8c': [
|
|
210
|
-
afcPoint(1, false, 79504),
|
|
211
|
-
afcPoint(3, false, 84346),
|
|
212
|
-
afcPoint(6, true, 91609),
|
|
213
|
-
],
|
|
214
|
-
'8d': [
|
|
215
|
-
afcPoint(1, false, 94356),
|
|
216
|
-
afcPoint(3, false, 100140),
|
|
217
|
-
afcPoint(6, true, 108814),
|
|
218
|
-
],
|
|
219
|
-
'9': [
|
|
220
|
-
afcPoint(1, false, 112782),
|
|
221
|
-
afcPoint(3, false, 119583),
|
|
222
|
-
afcPoint(6, true, 129783),
|
|
223
|
-
],
|
|
95
|
+
[NATION_KEYS.wales]: {
|
|
96
|
+
[YEAR_LABELS.Y2025_26]: { ...WALES_TABLES_2025_26, source: AFC_W_02_2025 },
|
|
97
|
+
[YEAR_LABELS.Y2026_27]: { ...WALES_TABLES_2026_27, source: AFC_W_02_2026 },
|
|
224
98
|
},
|
|
225
99
|
};
|
|
226
|
-
// ── Scotland 2025-26 ─────────────────────────────
|
|
227
|
-
// Scotland negotiates its own AfC award. The 2025-26
|
|
228
|
-
// settlement was 4.25%, but carried an inflation
|
|
229
|
-
// guarantee: at least one percentage point above average
|
|
230
|
-
// CPI for the calendar year of the uplift. 2025 CPI
|
|
231
|
-
// confirmed at 3.4%, so the guarantee bit and the rate
|
|
232
|
-
// became 4.4%, backdated to 1 April 2025 with arrears.
|
|
233
|
-
// Band structures differ from England (Band 2 has 2
|
|
234
|
-
// points, Bands 8a–9 have 2 points each).
|
|
235
|
-
// Source: "Scotland, PCS(AFC)2026/1" (#sa-13), Annex B,
|
|
236
|
-
// the revised 4.4% column.
|
|
237
|
-
const AFC_SCALES_2025_26_SCOTLAND = {
|
|
238
|
-
hcas: HCAS_2025_26,
|
|
239
|
-
// Points come from the verbatim circular via the
|
|
240
|
-
// translation layer, so the labels are DERIVED from the
|
|
241
|
-
// publisher's own progression column rather than typed
|
|
242
|
-
// beside the salaries where the two could disagree.
|
|
243
|
-
scales: SCOTLAND_SCALES_2025_26,
|
|
244
|
-
};
|
|
245
|
-
// ── Scotland 2026-27 ─────────────────────────────
|
|
246
|
-
// 3.75% on the REVISED 2025-26 base, so the inflation
|
|
247
|
-
// guarantee reaches this year too.
|
|
248
|
-
// Source: "Scotland, PCS(AFC)2026/1" (#sa-13), Annex B,
|
|
249
|
-
// effective 1 April 2026.
|
|
250
|
-
const AFC_SCALES_2026_27_SCOTLAND = {
|
|
251
|
-
hcas: HCAS_2026_27,
|
|
252
|
-
// Points come from the verbatim circular via the
|
|
253
|
-
// translation layer, so the labels are DERIVED from the
|
|
254
|
-
// publisher's own progression column rather than typed
|
|
255
|
-
// beside the salaries where the two could disagree.
|
|
256
|
-
scales: SCOTLAND_SCALES_2026_27,
|
|
257
|
-
};
|
|
258
|
-
// ── Wales ────────────────────────────────────────
|
|
259
|
-
//
|
|
260
|
-
// Wales runs its OWN pay ladder, transcribed here rather
|
|
261
|
-
// than derived from the England table. Both years are read
|
|
262
|
-
// from the Welsh circular's Annex 1: the ladders differ at
|
|
263
|
-
// every band from 4 upward, so England's figures plus a
|
|
264
|
-
// living-wage floor reproduce neither year. The floor lifts
|
|
265
|
-
// the bottom of a ladder and cannot raise its top.
|
|
266
|
-
//
|
|
267
|
-
// Structure differs from England too: Band 2 carries two
|
|
268
|
-
// points where England's has one.
|
|
269
|
-
//
|
|
270
|
-
// Band 1 is published in both years and closed to new
|
|
271
|
-
// entrants. It is absent from this ladder because
|
|
272
|
-
// AFC_BANDS starts at B2, and reachable through
|
|
273
|
-
// `afcBand1`, which reads it off the circular.
|
|
274
|
-
//
|
|
275
|
-
// Sources: "Wales, AfC(W) 02/2025" (#sa-44) and "Wales,
|
|
276
|
-
// AfC(W) 02/2026" (#sa-45), Annex 1 of each.
|
|
277
|
-
const AFC_SCALES_2025_26_WALES = {
|
|
278
|
-
hcas: HCAS_2025_26,
|
|
279
|
-
// Points come from the verbatim circular via the
|
|
280
|
-
// translation layer, so the labels are DERIVED from the
|
|
281
|
-
// publisher's own progression column rather than typed
|
|
282
|
-
// beside the salaries where the two could disagree.
|
|
283
|
-
scales: WALES_SCALES_2025_26,
|
|
284
|
-
};
|
|
285
|
-
const AFC_SCALES_2026_27_WALES = {
|
|
286
|
-
hcas: HCAS_2026_27,
|
|
287
|
-
// Points come from the verbatim circular via the
|
|
288
|
-
// translation layer, so the labels are DERIVED from the
|
|
289
|
-
// publisher's own progression column rather than typed
|
|
290
|
-
// beside the salaries where the two could disagree.
|
|
291
|
-
scales: WALES_SCALES_2026_27,
|
|
292
|
-
};
|
|
293
|
-
const AFC_SCALES_WALES = {
|
|
294
|
-
[TAX_YEARS.Y2025_26]: AFC_SCALES_2025_26_WALES,
|
|
295
|
-
[TAX_YEARS.Y2026_27]: AFC_SCALES_2026_27_WALES,
|
|
296
|
-
};
|
|
297
|
-
// ── National Living Wage (statutory, 21+) ────────
|
|
298
|
-
//
|
|
299
|
-
// Hourly rate set by the Low Pay Commission, keyed by the
|
|
300
|
-
// TAX year the rate runs in — the NLW changes on 1 April,
|
|
301
|
-
// so a tax year carries exactly one rate and the two line
|
|
302
|
-
// up. Rates move every April, so a year's entry is the
|
|
303
|
-
// rate announced FOR that April, never the one in force
|
|
304
|
-
// when the entry was written.
|
|
305
|
-
// Source: "GOV.UK — national minimum wage rates" (#sa-30).
|
|
306
|
-
export const NLW_HOURLY = {
|
|
307
|
-
[TAX_YEARS.Y2025_26]: 12.21,
|
|
308
|
-
[TAX_YEARS.Y2026_27]: 12.71,
|
|
309
|
-
};
|
|
310
100
|
/**
|
|
311
|
-
*
|
|
101
|
+
* England's latest AfC PAY year.
|
|
312
102
|
*
|
|
313
|
-
*
|
|
314
|
-
*
|
|
315
|
-
*
|
|
316
|
-
*
|
|
103
|
+
* Read from England's scale table, so it moves when a round is
|
|
104
|
+
* transcribed rather than by hand. Typed as a `PayYear`: an unbranded
|
|
105
|
+
* literal assigns to `TaxYear` and `PayYear` alike, and would pass into a
|
|
106
|
+
* tax-year parameter silently.
|
|
317
107
|
*
|
|
318
|
-
*
|
|
319
|
-
*
|
|
108
|
+
* NOT a site-wide "current year": Northern Ireland is a round behind.
|
|
109
|
+
* A consumer resolving figures for a reader's nation wants
|
|
110
|
+
* `latestAfcYear(nation)`; a consumer applying deductions wants the tax
|
|
111
|
+
* year in force, which it reads from its own clock.
|
|
320
112
|
*/
|
|
321
|
-
export
|
|
322
|
-
|
|
113
|
+
export const AFC_CURRENT_YEAR = latestAfcYear(NATION_KEYS.england);
|
|
114
|
+
/** The previous AfC pay year, for a year-on-year comparison: the one
|
|
115
|
+
* before {@link AFC_CURRENT_YEAR} in England's table. */
|
|
116
|
+
export const AFC_PREVIOUS_YEAR = previousAfcYear(NATION_KEYS.england);
|
|
117
|
+
/** The most rounds a pay year may sit from the tax year it is priced in:
|
|
118
|
+
* one, either way ({@link payRoundLag}). */
|
|
119
|
+
const MOST_ROUNDS_APART = 1;
|
|
120
|
+
/** A nation's AfC bands for a year, each with its ladder, salary range
|
|
121
|
+
* and source — synchronous, no file I/O. Every nation's ladder is
|
|
122
|
+
* transcribed from its own instrument, Northern Ireland's included
|
|
123
|
+
* though its figures match England's, so no nation's scale is computed
|
|
124
|
+
* from another's. `year` and `nation` are both required — the accessor
|
|
125
|
+
* never defaults a locale, since a forgotten `nation` would silently
|
|
126
|
+
* return England figures for every region. */
|
|
127
|
+
export function getAfcScales(year, nation) {
|
|
128
|
+
const { scales, source } = getScalesForYear(year, nation);
|
|
129
|
+
return AFC_BAND_IDS.map((band) => ({
|
|
130
|
+
band,
|
|
131
|
+
points: scales[band],
|
|
132
|
+
salary: salaryRangeOf(scales[band]),
|
|
133
|
+
source,
|
|
134
|
+
}));
|
|
323
135
|
}
|
|
324
|
-
export const WALES_LIVING_WAGE = {
|
|
325
|
-
[TAX_YEARS.Y2026_27]: { annual: 26300, hourly: 13.45 },
|
|
326
|
-
};
|
|
327
|
-
// ── Lookup by tax year ──────────────────────────
|
|
328
|
-
const AFC_SCALES = {
|
|
329
|
-
[TAX_YEARS.Y2025_26]: AFC_SCALES_2025_26,
|
|
330
|
-
[TAX_YEARS.Y2026_27]: AFC_SCALES_2026_27,
|
|
331
|
-
};
|
|
332
|
-
const AFC_SCALES_SCOTLAND = {
|
|
333
|
-
[TAX_YEARS.Y2025_26]: AFC_SCALES_2025_26_SCOTLAND,
|
|
334
|
-
[TAX_YEARS.Y2026_27]: AFC_SCALES_2026_27_SCOTLAND,
|
|
335
|
-
};
|
|
336
|
-
/** Every nation's published scale family — each nation its own, even
|
|
337
|
-
* where the figures coincide. Total over Nation, so adding a nation
|
|
338
|
-
* is a compile error here rather than a silent fall-through to
|
|
339
|
-
* England's. */
|
|
340
136
|
/**
|
|
341
|
-
*
|
|
342
|
-
*
|
|
343
|
-
*
|
|
344
|
-
* HSC (AfC) 06/2025 prints Bands 1 and 2 in its Basic Pay block as
|
|
345
|
-
* single flat figures; its entry/interval/top table starts at Band 3.
|
|
346
|
-
* England's publisher prints Band 2 with an entry point, a two-year
|
|
347
|
-
* interval and a top point. Same cash, different published structure —
|
|
348
|
-
* so NI cannot simply alias England's table, which is the whole reason
|
|
349
|
-
* the two nations' SOURCES are held apart.
|
|
350
|
-
*
|
|
351
|
-
* Every other band is England's, transcribed from a document that
|
|
352
|
-
* prints the same figures.
|
|
353
|
-
*/
|
|
354
|
-
/**
|
|
355
|
-
* Northern Ireland's ladder, from HSC (AfC) 06/2025 (3 December 2025,
|
|
356
|
-
* effective 1 April 2025).
|
|
357
|
-
*
|
|
358
|
-
* ONE year. NI has issued no 2026-27 AfC pay circular: the Health
|
|
359
|
-
* Minister stated a desire to proceed with 3.3% on 12 February 2026
|
|
360
|
-
* "subject to my budgetary position", and as at the most recent
|
|
361
|
-
* Assembly answer (AQW 49635/22-27, 15 July 2026) he "cannot" pay it
|
|
362
|
-
* "until I have clarity on my Department's budget". HSC staff are
|
|
363
|
-
* still on these rates. The 3.3% is still recorded in `award.ts` —
|
|
364
|
-
* announced and published are different things.
|
|
365
|
-
*
|
|
366
|
-
* The figures are England's for every band, because NI's circular
|
|
367
|
-
* prints the same numbers; they are AUTHORED here rather than derived
|
|
368
|
-
* from `AFC_SCALES` so that NI can diverge without a code change, and
|
|
369
|
-
* so that Band 2 does not depend on an unasserted property of
|
|
370
|
-
* England's table. NI's Basic Pay block prints Bands 1 and 2 as single
|
|
371
|
-
* flat figures and starts its entry/interval/top table at Band 3, so
|
|
372
|
-
* Band 2 is ONE point where England's is two.
|
|
137
|
+
* Band 1 for a nation and pay year. Throws {@link ScaleUnavailable} for a
|
|
138
|
+
* year that nation has not published, as {@link getAfcScales} does, so
|
|
139
|
+
* the two reads of one ladder fail the same way.
|
|
373
140
|
*
|
|
374
|
-
*
|
|
375
|
-
*
|
|
141
|
+
* Deliberately NOT part of `AFC_BANDS` or the scale list. Band 1 joining
|
|
142
|
+
* either shifts every index that reads the list by position, and this
|
|
143
|
+
* needs to shift nothing — it is a lookup beside the ladder, not a rung
|
|
144
|
+
* added to it.
|
|
376
145
|
*/
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
// page that prints it flat.
|
|
389
|
-
scales: NI_SCALES_2025_26,
|
|
390
|
-
},
|
|
391
|
-
};
|
|
392
|
-
const SCALE_FAMILIES = {
|
|
393
|
-
[NATION_KEYS.england]: AFC_SCALES,
|
|
394
|
-
[NATION_KEYS.northernIreland]: AFC_SCALES_NI,
|
|
395
|
-
[NATION_KEYS.scotland]: AFC_SCALES_SCOTLAND,
|
|
396
|
-
[NATION_KEYS.wales]: AFC_SCALES_WALES,
|
|
397
|
-
};
|
|
146
|
+
export function afcBand1(year, nation) {
|
|
147
|
+
const { band1, source } = getScalesForYear(year, nation);
|
|
148
|
+
return { ...band1, year, source, nation };
|
|
149
|
+
}
|
|
150
|
+
/** One band's published ladder for a pay year and nation. Every band is
|
|
151
|
+
* on every ladder (a nation-year's scales are total over the bands), so
|
|
152
|
+
* only the year and nation can be unpublished, which throws
|
|
153
|
+
* {@link ScaleUnavailable}. */
|
|
154
|
+
export function afcBandPoints(year, nation, band) {
|
|
155
|
+
return getScalesForYear(year, nation).scales[band];
|
|
156
|
+
}
|
|
398
157
|
/**
|
|
399
|
-
* The
|
|
400
|
-
*
|
|
401
|
-
*
|
|
402
|
-
*
|
|
403
|
-
* a
|
|
404
|
-
*
|
|
405
|
-
* England and Northern Ireland share a salary TABLE and do not share a
|
|
406
|
-
* SOURCE. NI publishes its own circular, with its own issuer, reference
|
|
407
|
-
* and date, and its figures matching England's is a fact about the two
|
|
408
|
-
* publishers rather than a licence to cite one for the other.
|
|
409
|
-
*
|
|
410
|
-
* Northern Ireland has one row, not two: it has published no 2026-27
|
|
411
|
-
* scales, so there is no 2026-27 table to cite.
|
|
158
|
+
* The point labelled `label` on an AfC band, with the band's points, for
|
|
159
|
+
* a pay year and nation, read from {@link getAfcScales}. Throws
|
|
160
|
+
* `ScaleUnavailable` where the year and nation publish no scale or the
|
|
161
|
+
* band has no such point, and `AmbiguousScalePoint` where the label names
|
|
162
|
+
* more than one, so a caller never prices a point it did not ask for.
|
|
412
163
|
*/
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
[NATION_KEYS.northernIreland]: {
|
|
419
|
-
// One year, matching the scales. There is no 2026-27 entry because
|
|
420
|
-
// there are no 2026-27 NI scales to cite — a source for a table
|
|
421
|
-
// that does not exist would be the false claim this map exists to
|
|
422
|
-
// prevent.
|
|
423
|
-
[TAX_YEARS.Y2025_26]: AFC_NI_2025,
|
|
424
|
-
},
|
|
425
|
-
[NATION_KEYS.scotland]: {
|
|
426
|
-
// One circular restates both years: PCS(AFC)2026/1 revised the
|
|
427
|
-
// 2025-26 figure when the inflation guarantee triggered and
|
|
428
|
-
// restates 2026-27, so it is current for each.
|
|
429
|
-
[TAX_YEARS.Y2025_26]: AFC_SCOTLAND,
|
|
430
|
-
[TAX_YEARS.Y2026_27]: AFC_SCOTLAND,
|
|
431
|
-
},
|
|
432
|
-
[NATION_KEYS.wales]: {
|
|
433
|
-
[TAX_YEARS.Y2025_26]: AFC_W_02_2025,
|
|
434
|
-
[TAX_YEARS.Y2026_27]: AFC_W_02_2026,
|
|
435
|
-
},
|
|
436
|
-
};
|
|
164
|
+
export function afcPointOf(year, nation, band, label) {
|
|
165
|
+
const points = afcBandPoints(year, nation, band);
|
|
166
|
+
const current = onlyPointLabelled(points, label, band, () => new ScaleUnavailable(nation, year, band, label));
|
|
167
|
+
return { points, current };
|
|
168
|
+
}
|
|
437
169
|
/** The circular or page that publishes a nation's AfC scales for a
|
|
438
170
|
* year. Throws for a combination that has no published scale, in step
|
|
439
171
|
* with {@link getScalesForYear} — a scale we cannot cite is a scale we
|
|
440
172
|
* should not be serving. */
|
|
441
173
|
export function afcScaleSource(year, nation) {
|
|
442
|
-
|
|
443
|
-
const key = year;
|
|
444
|
-
const source = AFC_SCALE_SOURCES[nation][key];
|
|
445
|
-
if (!source) {
|
|
446
|
-
throw new ScaleUnavailable(nation, year);
|
|
447
|
-
}
|
|
448
|
-
return source;
|
|
174
|
+
return getScalesForYear(year, nation).source;
|
|
449
175
|
}
|
|
450
176
|
/** PAY years a given nation publishes AfC scales for, oldest
|
|
451
177
|
* first. Nations do not move in lockstep — a year one has
|
|
@@ -458,19 +184,18 @@ export function afcScaleSource(year, nation) {
|
|
|
458
184
|
* one pay year while every nation shares the same tax year. */
|
|
459
185
|
export function afcPayYears(nation) {
|
|
460
186
|
// Sorted, not authoring order: the "oldest first" above is a
|
|
461
|
-
// guarantee callers rely on (`
|
|
462
|
-
//
|
|
463
|
-
// a new year were authored above an old one. Year labels
|
|
464
|
-
//
|
|
465
|
-
return Object.keys(
|
|
187
|
+
// guarantee callers rely on (`latestAfcYear` and `previousAfcYear` read
|
|
188
|
+
// the last two), and object-literal order would silently break it if
|
|
189
|
+
// a new year were authored above an old one. Year labels collate in year
|
|
190
|
+
// order because they are fixed-width and zero-padded.
|
|
191
|
+
return Object.keys(AFC_SCALE_YEARS[nation]).sort((a, b) => a.localeCompare(b));
|
|
466
192
|
}
|
|
467
193
|
/**
|
|
468
194
|
* The most recent year a nation has actually published AfC scales for.
|
|
469
195
|
*
|
|
470
|
-
* Nations do not move together
|
|
471
|
-
*
|
|
472
|
-
*
|
|
473
|
-
* 2026-27. A consumer that asks for a site-wide "current year" gets
|
|
196
|
+
* Nations do not move together: Northern Ireland's latest is a round
|
|
197
|
+
* behind the others (see `NI_TABLES_2025_26` in `afc-scales.ts`). A
|
|
198
|
+
* consumer that asks for a site-wide "current year" gets
|
|
474
199
|
* `ScaleUnavailable` there, which is correct but is not an answer; this
|
|
475
200
|
* is the answer.
|
|
476
201
|
*
|
|
@@ -478,9 +203,21 @@ export function afcPayYears(nation) {
|
|
|
478
203
|
* this library holds. A consumer deriving it would be re-computing,
|
|
479
204
|
* from the outside, something only these tables know.
|
|
480
205
|
*/
|
|
206
|
+
export function latestAfcYear(nation) {
|
|
207
|
+
const years = afcPayYears(nation);
|
|
208
|
+
const latest = years[years.length - 1];
|
|
209
|
+
if (!latest) {
|
|
210
|
+
// A plain Error, not ScaleUnavailable: that type's `year` is a
|
|
211
|
+
// TaxYear, and there is no year to name here. Casting a filler
|
|
212
|
+
// string into the union would make `error.year` lie to any caller
|
|
213
|
+
// that reads it.
|
|
214
|
+
throw new Error(`latestAfcYear: ${nation} publishes no AfC scale in any year`);
|
|
215
|
+
}
|
|
216
|
+
return latest;
|
|
217
|
+
}
|
|
481
218
|
/**
|
|
482
|
-
* How
|
|
483
|
-
*
|
|
219
|
+
* How many rounds `payYear` sits behind `taxYear`. Positive means the pay
|
|
220
|
+
* round is BEHIND the tax year; negative means it is ahead.
|
|
484
221
|
*
|
|
485
222
|
* ## The domain rule this exists to state
|
|
486
223
|
*
|
|
@@ -492,9 +229,9 @@ export function afcPayYears(nation) {
|
|
|
492
229
|
*
|
|
493
230
|
* They diverge in exactly one way. An AfC round is agreed and
|
|
494
231
|
* implemented by each nation separately, and a nation whose award is
|
|
495
|
-
* not yet funded keeps paying last year's scales into this tax year
|
|
496
|
-
*
|
|
497
|
-
*
|
|
232
|
+
* not yet funded keeps paying last year's scales into this tax year.
|
|
233
|
+
* Tax never waits: the thresholds change on 6 April whatever the
|
|
234
|
+
* employer has settled.
|
|
498
235
|
*
|
|
499
236
|
* So the legitimate values are:
|
|
500
237
|
*
|
|
@@ -502,26 +239,43 @@ export function afcPayYears(nation) {
|
|
|
502
239
|
* |---|---|
|
|
503
240
|
* | `0` | the award is implemented; pay year and tax year agree |
|
|
504
241
|
* | `1` | the award for this year is not yet in payment |
|
|
505
|
-
* | `-1` | next year's
|
|
242
|
+
* | `-1` | next year's round is out but its tax year has not begun |
|
|
506
243
|
*
|
|
507
|
-
* Anything else is a
|
|
508
|
-
*
|
|
509
|
-
* {@link assertPayYearLagIsSane} is where that is enforced.
|
|
244
|
+
* Anything else is a round that was never transcribed or a caller pricing
|
|
245
|
+
* a stale round, not a fact about the world ({@link isPayRoundInReach}).
|
|
510
246
|
*
|
|
511
|
-
*
|
|
512
|
-
*
|
|
513
|
-
*
|
|
247
|
+
* Counted in years from each label's closing year, not by position in a
|
|
248
|
+
* list of labels, so it holds however the labels are ordered. What this
|
|
249
|
+
* cannot catch is a pay year passed where a tax year was wanted: the
|
|
250
|
+
* distinct `PayYear` and `TaxYear` types are what stop that.
|
|
251
|
+
*/
|
|
252
|
+
export function payRoundLag(payYear, taxYear) {
|
|
253
|
+
return closingYearOf(taxYear) - closingYearOf(payYear);
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* True where `payYear` is a round this library will price under
|
|
257
|
+
* `taxYear`'s deductions: at most one round from it, either way
|
|
258
|
+
* ({@link payRoundLag}). One rule for every reader, so a caller refusing
|
|
259
|
+
* a stale round and this library checking its own tables cannot disagree
|
|
260
|
+
* about what "too far apart" means.
|
|
514
261
|
*/
|
|
515
|
-
export function
|
|
516
|
-
|
|
517
|
-
const pay = order.indexOf(latestAfcYear(nation));
|
|
518
|
-
const tax = order.indexOf(CURRENT_TAX_YEAR);
|
|
519
|
-
invariant(pay >= 0 && tax >= 0, `payYearLag: ${nation} resolves a year outside TAX_YEARS`);
|
|
520
|
-
return tax - pay;
|
|
262
|
+
export function isPayRoundInReach(payYear, taxYear) {
|
|
263
|
+
return Math.abs(payRoundLag(payYear, taxYear)) <= MOST_ROUNDS_APART;
|
|
521
264
|
}
|
|
522
265
|
/**
|
|
523
|
-
*
|
|
524
|
-
*
|
|
266
|
+
* How far a nation's newest published pay scales sit from `taxYear`:
|
|
267
|
+
* {@link payRoundLag} of {@link latestAfcYear}. Positive means the pay
|
|
268
|
+
* scales are BEHIND, which is the nations still paying an earlier round.
|
|
269
|
+
*
|
|
270
|
+
* `taxYear` is the caller's: this library holds no clock, so the tax year
|
|
271
|
+
* in force is a fact the consumer brings, read at its own build or run.
|
|
272
|
+
*/
|
|
273
|
+
export function latestRoundLag(nation, taxYear) {
|
|
274
|
+
return payRoundLag(latestAfcYear(nation), taxYear);
|
|
275
|
+
}
|
|
276
|
+
/**
|
|
277
|
+
* True while a nation is still paying an older round than `taxYear` — its
|
|
278
|
+
* award is announced or awaited, but not in payment.
|
|
525
279
|
*
|
|
526
280
|
* The domain question ("is this nation behind?") rather than a
|
|
527
281
|
* comparison against some particular year, so a consumer cannot get
|
|
@@ -529,54 +283,80 @@ export function payYearLag(nation) {
|
|
|
529
283
|
* "is it exactly 2025-26" and quietly says no for a nation two rounds
|
|
530
284
|
* behind, which is the case that most needs saying yes.
|
|
531
285
|
*/
|
|
532
|
-
export function isAwaitingPayAward(nation) {
|
|
533
|
-
return
|
|
286
|
+
export function isAwaitingPayAward(nation, taxYear) {
|
|
287
|
+
return latestRoundLag(nation, taxYear) > 0;
|
|
534
288
|
}
|
|
535
289
|
/**
|
|
536
|
-
* Fail loudly if any nation's
|
|
537
|
-
*
|
|
290
|
+
* Fail loudly if any nation's newest scale is out of reach of `taxYear`
|
|
291
|
+
* ({@link isPayRoundInReach}).
|
|
538
292
|
*
|
|
539
293
|
* A function rather than a module-scope check: this library is
|
|
540
294
|
* published, and a throw at import time would take down every consumer
|
|
541
295
|
* over a data problem they cannot fix. It runs in this repo's tests,
|
|
542
|
-
* which is where a transcription gap should surface
|
|
296
|
+
* which is where a transcription gap should surface, and a consumer can
|
|
297
|
+
* run it against the tax year it prices in.
|
|
543
298
|
*/
|
|
544
|
-
export function
|
|
545
|
-
for (const nation of Object.keys(
|
|
546
|
-
const
|
|
547
|
-
invariant(
|
|
548
|
-
+
|
|
549
|
-
+
|
|
550
|
-
+ '
|
|
299
|
+
export function assertLatestRoundsInReach(taxYear) {
|
|
300
|
+
for (const nation of Object.keys(AFC_SCALE_YEARS)) {
|
|
301
|
+
const latest = latestAfcYear(nation);
|
|
302
|
+
invariant(isPayRoundInReach(latest, taxYear), `${nation} is ${payRoundLag(latest, taxYear)} rounds from the `
|
|
303
|
+
+ `${taxYear} tax year: its newest published scale is ${latest}. A `
|
|
304
|
+
+ `gap beyond ${MOST_ROUNDS_APART} round means a pay round was never `
|
|
305
|
+
+ 'transcribed, not that a nation skipped one.');
|
|
551
306
|
}
|
|
552
307
|
}
|
|
553
|
-
|
|
308
|
+
/**
|
|
309
|
+
* The AfC pay year whose round runs over one scheme year, where this
|
|
310
|
+
* library holds its scale for the nation, and otherwise which side of the
|
|
311
|
+
* held years the scheme year falls ({@link AFC_PAY_YEAR_KINDS}). A pay year
|
|
312
|
+
* is one scheme year (`pay-year.ts`). `taxYear` is the tax year in force,
|
|
313
|
+
* which bounds how far ahead a round can be awaited.
|
|
314
|
+
*
|
|
315
|
+
* The round a scheme year names is not always the scale staff were paid
|
|
316
|
+
* on in it: a nation whose award is late still pays the previous round's
|
|
317
|
+
* scale (`latestRoundLag`, `latestAfcYear`). Ask those for that.
|
|
318
|
+
*/
|
|
319
|
+
export function afcPayYearFor(end, nation, taxYear) {
|
|
554
320
|
const years = afcPayYears(nation);
|
|
555
|
-
const
|
|
556
|
-
if (
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
//
|
|
560
|
-
// that
|
|
561
|
-
|
|
321
|
+
const year = years.find((y) => schemeYearOfPayYear(y) === end);
|
|
322
|
+
if (year !== undefined)
|
|
323
|
+
return { kind: AFC_PAY_YEAR_KINDS.held, year };
|
|
324
|
+
if (end > schemeYearOfPayYear(latestAfcYear(nation))) {
|
|
325
|
+
// A round can be awaited up to the one after `taxYear`; a year beyond
|
|
326
|
+
// that has no round to wait for, which this cannot answer.
|
|
327
|
+
const lastAwaitable = closingYearOf(taxYear) + MOST_ROUNDS_APART;
|
|
328
|
+
invariant(end <= lastAwaitable, `afcPayYearFor: the scheme year ending ${end} is past the next pay `
|
|
329
|
+
+ `round (${lastAwaitable})`);
|
|
330
|
+
return { kind: AFC_PAY_YEAR_KINDS.awaited };
|
|
562
331
|
}
|
|
563
|
-
|
|
332
|
+
// Below the latest and not found, so before the earliest: a nation's
|
|
333
|
+
// years run unbroken, and a gap among them is a round never
|
|
334
|
+
// transcribed.
|
|
335
|
+
invariant(years.every((y) => schemeYearOfPayYear(y) > end), `afcPayYearFor: ${nation} has no AfC scale for the scheme year ending `
|
|
336
|
+
+ `${end}, between years it does hold`);
|
|
337
|
+
return { kind: AFC_PAY_YEAR_KINDS.notHeld };
|
|
338
|
+
}
|
|
339
|
+
/** The AfC year a nation published before its latest, for a year-on-year
|
|
340
|
+
* comparison. Throws where the nation holds only one year. */
|
|
341
|
+
function previousAfcYear(nation) {
|
|
342
|
+
const years = afcPayYears(nation);
|
|
343
|
+
const previous = years.slice(0, -1).at(-1);
|
|
344
|
+
invariant(previous !== undefined, `previousAfcYear: ${nation} holds one AfC year only`);
|
|
345
|
+
return previous;
|
|
564
346
|
}
|
|
565
347
|
/** Resolve a nation's published scale table for a year.
|
|
566
348
|
* Every figure returned is transcribed from that nation's
|
|
567
|
-
* own instrument
|
|
568
|
-
*
|
|
569
|
-
*
|
|
570
|
-
* against its OWN document, so a divergence fails rather
|
|
571
|
-
* than propagating. Throws {@link ScaleUnavailable} for a
|
|
349
|
+
* own instrument, and each nation's fixture rows pin its
|
|
350
|
+
* values against its OWN document, so a divergence fails
|
|
351
|
+
* rather than propagating. Throws {@link ScaleUnavailable} for a
|
|
572
352
|
* year that nation has not published, rather than silently
|
|
573
353
|
* substituting another year's or nation's figures. */
|
|
574
|
-
|
|
354
|
+
function getScalesForYear(year, nation) {
|
|
575
355
|
const key = year;
|
|
576
|
-
const
|
|
577
|
-
if (!
|
|
356
|
+
const held = AFC_SCALE_YEARS[nation][key];
|
|
357
|
+
if (!held) {
|
|
578
358
|
throw new ScaleUnavailable(nation, year);
|
|
579
359
|
}
|
|
580
|
-
return
|
|
360
|
+
return held;
|
|
581
361
|
}
|
|
582
362
|
//# sourceMappingURL=scales.js.map
|