@casomoltd/nhs-pay 0.30.0 → 0.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +69 -251
- package/dist/bands.d.ts +9 -1
- package/dist/bands.js +20 -0
- package/dist/bands.js.map +1 -1
- package/dist/document-source.d.ts +16 -0
- package/dist/document-source.js +3 -1
- package/dist/document-source.js.map +1 -1
- package/dist/errors.d.ts +46 -11
- package/dist/errors.js +68 -28
- package/dist/errors.js.map +1 -1
- package/dist/factor-basis.d.ts +14 -0
- package/dist/factor-basis.js.map +1 -1
- package/dist/index.d.ts +13 -11
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/member/benefits.js +18 -11
- package/dist/member/benefits.js.map +1 -1
- package/dist/member/index.d.ts +1 -1
- package/dist/member/input-period.d.ts +4 -4
- package/dist/member/input-period.js +11 -9
- package/dist/member/input-period.js.map +1 -1
- package/dist/member/service.d.ts +4 -0
- package/dist/member/service.js +9 -3
- package/dist/member/service.js.map +1 -1
- package/dist/member/types.d.ts +81 -49
- package/dist/member/types.js.map +1 -1
- package/dist/member/valuation.d.ts +10 -8
- package/dist/member/valuation.js +17 -21
- package/dist/member/valuation.js.map +1 -1
- package/dist/pay-path.d.ts +21 -25
- package/dist/pay-path.js +85 -67
- package/dist/pay-path.js.map +1 -1
- package/dist/pension/ages.d.ts +6 -4
- package/dist/pension/ages.js +6 -4
- package/dist/pension/ages.js.map +1 -1
- package/dist/pension/curve.d.ts +2 -1
- package/dist/pension/curve.js +15 -7
- package/dist/pension/curve.js.map +1 -1
- package/dist/pension/history.d.ts +18 -3
- package/dist/pension/history.js +12 -5
- package/dist/pension/history.js.map +1 -1
- package/dist/pension/ledger.d.ts +15 -9
- package/dist/pension/ledger.js +91 -56
- package/dist/pension/ledger.js.map +1 -1
- package/dist/pension/prices.d.ts +11 -2
- package/dist/pension/prices.js +35 -14
- package/dist/pension/prices.js.map +1 -1
- package/dist/pension/scheme-year.d.ts +59 -0
- package/dist/pension/scheme-year.js +80 -0
- package/dist/pension/scheme-year.js.map +1 -0
- package/dist/pension/seed.d.ts +66 -50
- package/dist/pension/seed.js +111 -65
- package/dist/pension/seed.js.map +1 -1
- package/dist/pension/uplift.d.ts +13 -33
- package/dist/pension/uplift.js +11 -56
- package/dist/pension/uplift.js.map +1 -1
- package/dist/pension-projection.js +30 -22
- package/dist/pension-projection.js.map +1 -1
- package/dist/post.d.ts +1 -10
- package/dist/post.js +1 -12
- package/dist/post.js.map +1 -1
- package/dist/revaluation.d.ts +34 -35
- package/dist/revaluation.js +41 -41
- package/dist/revaluation.js.map +1 -1
- package/dist/scale-point.d.ts +6 -0
- package/dist/sections/final-salary.d.ts +3 -8
- package/dist/sections/final-salary.js +13 -9
- package/dist/sections/final-salary.js.map +1 -1
- package/dist/sections/section-2015.d.ts +2 -1
- package/dist/sections/section-2015.js.map +1 -1
- package/dist/sources.d.ts +10 -0
- package/dist/sources.js +20 -0
- package/dist/sources.js.map +1 -1
- package/dist/take-home.d.ts +4 -20
- package/dist/take-home.js +3 -23
- package/dist/take-home.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,27 +1,12 @@
|
|
|
1
1
|
# @casomoltd/nhs-pay
|
|
2
2
|
|
|
3
|
-
NHS pay scales — Agenda for Change plus medical & dental —
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
NHS pension across the 1995, 2008 and 2015 Sections: final salary
|
|
7
|
-
and career average, the McCloud remedy window valued on either
|
|
8
|
-
basis, early and late retirement factors, and tax-free cash across
|
|
9
|
-
the whole drawing.
|
|
10
|
-
|
|
11
|
-
See [`docs/pay-frameworks.md`](docs/pay-frameworks.md) for the domain
|
|
12
|
-
model — the pay frameworks (AfC, medical, dental, VSM), the shared
|
|
13
|
-
scale-resolver core, and where the consumer boundary sits.
|
|
3
|
+
NHS pay scales — Agenda for Change plus medical & dental — with pension tiers, regions, HCAS supplements, and a take-home calculator built on top of `@casomoltd/paye-calc`. And a member's NHS pension across the 1995, 2008 and 2015 Sections: final salary and career average, the McCloud remedy window valued on either basis, early and late retirement factors, and tax-free cash across the whole drawing.
|
|
4
|
+
|
|
5
|
+
See [`docs/pay-frameworks.md`](docs/pay-frameworks.md) for the domain model — the pay frameworks (AfC, medical, dental, VSM), the shared scale-resolver core, and where the consumer boundary sits.
|
|
14
6
|
|
|
15
7
|
## About Casomo
|
|
16
8
|
|
|
17
|
-
Casomo is a [registered UK limited company][companies-house]
|
|
18
|
-
founded and directed by
|
|
19
|
-
[David Mohamad](https://github.com/dkmohamad). It builds focused
|
|
20
|
-
software tools and offers engineering consulting. This library
|
|
21
|
-
powers the NHS pay calculators and explainers on
|
|
22
|
-
[casomo.co.uk](https://casomo.co.uk) — where the differentiator is
|
|
23
|
-
showing **take-home** pay (after tax, NI and pension), not just the
|
|
24
|
-
gross figures most published sources stop at.
|
|
9
|
+
Casomo is a [registered UK limited company][companies-house] founded and directed by [David Mohamad](https://github.com/dkmohamad). It builds focused software tools and offers engineering consulting. This library powers the NHS pay calculators and explainers on [casomo.co.uk](https://casomo.co.uk) — where the differentiator is showing **take-home** pay (after tax, NI and pension), not just the gross figures most published sources stop at.
|
|
25
10
|
|
|
26
11
|
- **Portfolio** — [casomo.co.uk](https://casomo.co.uk)
|
|
27
12
|
- **Consulting** — [casomoltd.com](https://casomoltd.com)
|
|
@@ -36,8 +21,7 @@ npm install @casomoltd/nhs-pay
|
|
|
36
21
|
|
|
37
22
|
Public on the npm registry — no auth or `.npmrc` config needed.
|
|
38
23
|
|
|
39
|
-
Requires `@casomoltd/paye-calc` as a peer dependency; the range it
|
|
40
|
-
accepts is `peerDependencies` in [`package.json`](package.json).
|
|
24
|
+
Requires `@casomoltd/paye-calc` as a peer dependency; the range it accepts is `peerDependencies` in [`package.json`](package.json).
|
|
41
25
|
|
|
42
26
|
## Usage
|
|
43
27
|
|
|
@@ -114,10 +98,7 @@ fmtPct(8.3); // '8.3%'
|
|
|
114
98
|
|
|
115
99
|
### Take-home for a doctor or dentist
|
|
116
100
|
|
|
117
|
-
Medical and dental grades resolve the same way as AfC, via a
|
|
118
|
-
per-family resolver. `getMedicalScales(year, nation)` lists the
|
|
119
|
-
grades published for a nation and year; `fromPoint` builds a
|
|
120
|
-
`Post` (gross, pension tier, tax, NI, take-home) from one point.
|
|
101
|
+
Medical and dental grades resolve the same way as AfC, via a per-family resolver. `getMedicalScales(year, nation)` lists the grades published for a nation and year; `fromPoint` builds a `Post` (gross, pension tier, tax, NI, take-home) from one point.
|
|
121
102
|
|
|
122
103
|
```ts
|
|
123
104
|
import {getMedicalScales, medicalResolver} from '@casomoltd/nhs-pay';
|
|
@@ -135,16 +116,9 @@ console.log(post.takeHome.net); // annual net after tax + NI + pension
|
|
|
135
116
|
console.log(consultant.source.reference); // the circular it came from
|
|
136
117
|
```
|
|
137
118
|
|
|
138
|
-
`fromPoint` takes the point itself. There is also
|
|
139
|
-
`fromScalePoint(grade, label, …)` for a caller holding only a label,
|
|
140
|
-
but a label does not identify a point on every scale — England's
|
|
141
|
-
consultant scale is 20 payroll steps over 5 threshold labels, so
|
|
142
|
-
`'Threshold 4'` names six of them and that call throws
|
|
143
|
-
`AmbiguousScalePoint` rather than picking one.
|
|
119
|
+
`fromPoint` takes the point itself. There is also `fromScalePoint(grade, label, …)` for a caller holding only a label, but a label does not identify a point on every scale — England's consultant scale is 20 payroll steps over 5 threshold labels, so `'Threshold 4'` names six of them and that call throws `AmbiguousScalePoint` rather than picking one.
|
|
144
120
|
|
|
145
|
-
`getDentalScales` / `dentalResolver` mirror this for salaried
|
|
146
|
-
dental grades. Both fail loud (`ScaleUnavailable`) for an
|
|
147
|
-
unpublished nation/year or grade rather than defaulting.
|
|
121
|
+
`getDentalScales` / `dentalResolver` mirror this for salaried dental grades. Both fail loud (`ScaleUnavailable`) for an unpublished nation/year or grade rather than defaulting.
|
|
148
122
|
|
|
149
123
|
### Value a member's pension across sections
|
|
150
124
|
|
|
@@ -181,8 +155,9 @@ const benefits = memberBenefits(
|
|
|
181
155
|
benefits.remedy; // true: in service by 31 March 2012 and after 2015
|
|
182
156
|
benefits.now(); // held today, the remedy window on the legacy basis
|
|
183
157
|
|
|
184
|
-
// Asked once per
|
|
185
|
-
|
|
158
|
+
// Asked once per election the member is compared on: both bases here,
|
|
159
|
+
// because they have a remedy window. Every section is drawn on one date.
|
|
160
|
+
for (const kind of benefits.elections) {
|
|
186
161
|
const position = benefits.at({
|
|
187
162
|
leaving: isoDate('2039-09-30'),
|
|
188
163
|
drawing: isoDate('2039-09-30'),
|
|
@@ -190,6 +165,7 @@ for (const kind of ['legacy-basis', 'section-2015-basis'] as const) {
|
|
|
190
165
|
cash: {kind: 'maximum'},
|
|
191
166
|
});
|
|
192
167
|
position.awards; // one per section and basis, each factored
|
|
168
|
+
position.section2015; // the 2015 Section's ledgers, estimated history, curve
|
|
193
169
|
position.crystallised; // the pension and automatic lump sum, summed
|
|
194
170
|
position.cash; // the cash taken across the whole
|
|
195
171
|
}
|
|
@@ -203,22 +179,11 @@ const period = benefits.pensionInputPeriod(taxYearEnd(2027), {
|
|
|
203
179
|
const input = definedBenefitInput(period); // the year's input amount
|
|
204
180
|
```
|
|
205
181
|
|
|
206
|
-
Each section keeps its own rules — denominator, pay measure,
|
|
207
|
-
pension age, lump sum, factors — so no caller can combine them
|
|
208
|
-
into one the scheme lacks. Pay comes from the member's pay path
|
|
209
|
-
(`promotionalIndex` is GAD's curve behind it). Service the library
|
|
210
|
-
does not model, such as a break, is refused with
|
|
211
|
-
`BenefitNotModelled` and a `code` to branch on; `NOT_MODELLED`
|
|
212
|
-
links each code to the issue tracking it. See
|
|
213
|
-
[*A member's benefits across sections*](docs/how-it-works.md#a-members-benefits-across-sections)
|
|
214
|
-
for the model. How each arrangement's pension input is valued is
|
|
215
|
-
[*A year's pension input*](docs/how-it-works.md#a-years-pension-input).
|
|
182
|
+
Each section keeps its own rules — denominator, pay measure, pension age, lump sum, factors — so no caller can combine them into one the scheme lacks. Pay comes from the member's pay path (`promotionalIndex` is GAD's curve behind it). Service the library does not model, such as a break, is refused with `BenefitNotModelled` and a `code` to branch on; `NOT_MODELLED` links each code to the issue tracking it. See [*A member's benefits across sections*](docs/how-it-works.md#a-members-benefits-across-sections) for the model. How each arrangement's pension input is valued is [*A year's pension input*](docs/how-it-works.md#a-years-pension-input).
|
|
216
183
|
|
|
217
184
|
### Project a 2015 Section pension on flat pay
|
|
218
185
|
|
|
219
|
-
**Deprecated.** `projectPension` is kept for this flat-pay question
|
|
220
|
-
until [#21](https://github.com/casomoltd/nhs-pay/issues/21); for a
|
|
221
|
-
member across sections, use `memberBenefits` above.
|
|
186
|
+
**Deprecated.** `projectPension` is kept for this flat-pay question until [#21](https://github.com/casomoltd/nhs-pay/issues/21); for a member across sections, use `memberBenefits` above.
|
|
222
187
|
|
|
223
188
|
```ts
|
|
224
189
|
import {
|
|
@@ -268,47 +233,21 @@ console.log(limit.real.amount, limit.real.binding);
|
|
|
268
233
|
console.log(limit.nominal.amount, limit.nominal.binding);
|
|
269
234
|
```
|
|
270
235
|
|
|
271
|
-
The maximum is the **lower** of two caps, and **both are
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
the
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
restate the rule.
|
|
279
|
-
|
|
280
|
-
Why that name is left as it is, and what moves where when it
|
|
281
|
-
changes: [*The two caps on tax-free
|
|
282
|
-
cash*](docs/how-it-works.md#the-two-caps-on-tax-free-cash).
|
|
283
|
-
|
|
284
|
-
There is **one limit per ruler, and no single flag**, because the
|
|
285
|
-
two can genuinely disagree: `real` is the model run at zero CPI
|
|
286
|
-
while the allowance is carried forward at CPI, so around the
|
|
287
|
-
crossover the allowance binds in today's money while the scheme
|
|
288
|
-
limb still binds in cash. Show the limit belonging to the ruler
|
|
289
|
-
on screen. See
|
|
290
|
-
[*The two caps on tax-free cash*](docs/how-it-works.md#the-two-caps-on-tax-free-cash).
|
|
291
|
-
|
|
292
|
-
Without a statement figure, `kind: 'estimation'` accrues from a
|
|
293
|
-
`joinDate` instead. ERF/LRF factors are transcribed verbatim from
|
|
294
|
-
the GAD consolidated factor workbook (30 June 2023 issue) with
|
|
295
|
-
GAD's own rounding rules; a retirement date beyond the printed
|
|
296
|
-
tables throws `RetirementFactorOutOfRange`.
|
|
236
|
+
The maximum is the **lower** of two caps, and **both are statutory**: 25% of the capital value of the benefits, and the Lump Sum Allowance. The scheme's own contribution to the swap is the 12:1 rate and nothing else, so a consumer must not attribute the 25% to the scheme — `LUMP_SUM_CAPS.Scheme` names the discriminant, not the rule's author. `binding` says which cap stopped it, so a consumer can explain the figure rather than restate the rule.
|
|
237
|
+
|
|
238
|
+
Why that name is left as it is, and what moves where when it changes: [*The two caps on tax-free cash*](docs/how-it-works.md#the-two-caps-on-tax-free-cash).
|
|
239
|
+
|
|
240
|
+
There is **one limit per ruler, and no single flag**, because the two can genuinely disagree: `real` is the model run at zero CPI while the allowance is carried forward at CPI, so around the crossover the allowance binds in today's money while the scheme limb still binds in cash. Show the limit belonging to the ruler on screen. See [*The two caps on tax-free cash*](docs/how-it-works.md#the-two-caps-on-tax-free-cash).
|
|
241
|
+
|
|
242
|
+
Without a statement figure, `kind: 'estimation'` accrues from a `joinDate` instead. ERF/LRF factors are transcribed verbatim from the GAD consolidated factor workbook (30 June 2023 issue) with GAD's own rounding rules; a retirement date beyond the printed tables throws `RetirementFactorOutOfRange`.
|
|
297
243
|
|
|
298
244
|
## How it works
|
|
299
245
|
|
|
300
|
-
[`docs/how-it-works.md`](docs/how-it-works.md) — the model this
|
|
301
|
-
library implements: the recurrence it walks, what a scheme year
|
|
302
|
-
and an exit date mean to it, why cash and today's money are two
|
|
303
|
-
runs rather than one and a deflator, and every assumption it
|
|
304
|
-
makes, declared. Read it before trusting a figure.
|
|
246
|
+
[`docs/how-it-works.md`](docs/how-it-works.md) — the model this library implements: the recurrence it walks, what a scheme year and an exit date mean to it, why cash and today's money are two runs rather than one and a deflator, and every assumption it makes, declared. Read it before trusting a figure.
|
|
305
247
|
|
|
306
248
|
## API reference
|
|
307
249
|
|
|
308
|
-
[`docs/api.md`](docs/api.md) — every export, organised by
|
|
309
|
-
domain, with typed signatures and short notes. Kept in sync with
|
|
310
|
-
the code by a check-time drift gate. Agents may prefer the
|
|
311
|
-
shipped `dist/*.d.ts`, which carry the full JSDoc per module.
|
|
250
|
+
[`docs/api.md`](docs/api.md) — every export, organised by domain, with typed signatures and short notes. Kept in sync with the code by a check-time drift gate. Agents may prefer the shipped `dist/*.d.ts`, which carry the full JSDoc per module.
|
|
312
251
|
|
|
313
252
|
## Data sources
|
|
314
253
|
|
|
@@ -319,8 +258,7 @@ shipped `dist/*.d.ts`, which carry the full JSDoc per module.
|
|
|
319
258
|
| 2025-26 | England, NI, Wales | [NHS Employers pay scales 2025/26][scales-2526] |
|
|
320
259
|
| 2026-27 | England, NI | [NHS Employers pay scales 2026/27][scales-2627] |
|
|
321
260
|
|
|
322
|
-
Cross-checked against [NHSPRB 39th Report (2026)][nhsprb-39],
|
|
323
|
-
Table A25 (AfC 2025/26 data for England, NI, Wales).
|
|
261
|
+
Cross-checked against [NHSPRB 39th Report (2026)][nhsprb-39], Table A25 (AfC 2025/26 data for England, NI, Wales).
|
|
324
262
|
|
|
325
263
|
[scales-2526]: https://www.nhsemployers.org/articles/pay-scales-202526
|
|
326
264
|
[scales-2627]: https://www.nhsemployers.org/articles/pay-scales-202627
|
|
@@ -348,99 +286,37 @@ Table A25 (AfC 2025/26 data for England, NI, Wales).
|
|
|
348
286
|
[s276]: https://www.legislation.gov.uk/ukpga/2004/12/section/276
|
|
349
287
|
[s637p]: https://www.legislation.gov.uk/ukpga/2003/1/part/9/chapter/15A
|
|
350
288
|
|
|
351
|
-
Reconciled line by line against a real **Annual Benefit
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
[
|
|
358
|
-
links themselves in the header of
|
|
359
|
-
[`tests/golden-abs.test.ts`](tests/golden-abs.test.ts) — beside
|
|
360
|
-
the assertions they justify, which is where a citation belongs
|
|
361
|
-
and where it cannot drift from what it is citing.
|
|
362
|
-
|
|
363
|
-
The statement is the source of truth and the library never
|
|
364
|
-
restates it: enter its figure and ask for its own date, and you
|
|
365
|
-
are handed back exactly what it says. See
|
|
366
|
-
[*Two rulers, one model*](docs/how-it-works.md#two-rulers-one-model)
|
|
367
|
-
for how cash and today's money are produced, and
|
|
368
|
-
[*Which series applies a published Order*](docs/how-it-works.md#which-series-applies-a-published-order)
|
|
369
|
-
for when a legislated rate is applied and why today's money
|
|
370
|
-
never takes one.
|
|
371
|
-
|
|
372
|
-
That promise is exact for a statement handed over **with its
|
|
373
|
-
date**. Passing the figure undated instead asks a different
|
|
374
|
-
question — "this is my balance today" — and the library must
|
|
375
|
-
then work backwards to the year end, at its own revaluation rule
|
|
376
|
-
rather than the scheme's. For a member who left at a year end
|
|
377
|
-
the two differ; see
|
|
378
|
-
[*Reading a statement back applies the SAME rule*](docs/how-it-works.md#reading-a-statement-back-applies-the-same-rule)
|
|
379
|
-
for the size of it and why passing the date avoids it.
|
|
289
|
+
Reconciled line by line against a real **Annual Benefit Statement** (2015 Section, updated to 31/03/2025, name and membership number redacted), and against a ten-year projection built by hand from it.
|
|
290
|
+
|
|
291
|
+
Both are archived and inventoried in [`docs/source-archive.md`](docs/source-archive.md), with the links themselves in the header of [`tests/golden-abs.test.ts`](tests/golden-abs.test.ts) — beside the assertions they justify, which is where a citation belongs and where it cannot drift from what it is citing.
|
|
292
|
+
|
|
293
|
+
The statement is the source of truth and the library never restates it: enter its figure and ask for its own date, and you are handed back exactly what it says. See [*Two rulers, one model*](docs/how-it-works.md#two-rulers-one-model) for how cash and today's money are produced, and [*Which series applies a published Order*](docs/how-it-works.md#which-series-applies-a-published-order) for when a legislated rate is applied and why today's money never takes one.
|
|
294
|
+
|
|
295
|
+
That promise is exact for a statement handed over **with its date**. Passing the figure undated instead asks a different question — "this is my balance today" — and the library must then work backwards to the year end, at its own revaluation rule rather than the scheme's. For a member who left at a year end the two differ; see [*Reading a statement back applies the SAME rule*](docs/how-it-works.md#reading-a-statement-back-applies-the-same-rule) for the size of it and why passing the date avoids it.
|
|
380
296
|
|
|
381
297
|
### Scotland
|
|
382
298
|
|
|
383
|
-
Scotland negotiates its own AfC award independently and
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
has 2 points (vs 1 in England) and Bands 8a–9 have 2
|
|
389
|
-
points each (vs 3).
|
|
390
|
-
|
|
391
|
-
Source: [PCS(AFC)2026/1][scot-circular] — Scottish Health
|
|
392
|
-
Workforce Directorate circular (23 Jan 2026). Annex B holds
|
|
393
|
-
both years' rate tables; Annex C sets them out increment by
|
|
394
|
-
increment and corroborates Annex B point for point.
|
|
395
|
-
|
|
396
|
-
Scotland's 2025-26 settlement was 4.25%, but carried an
|
|
397
|
-
inflation guarantee — at least one percentage point above
|
|
398
|
-
average CPI for the calendar year of the uplift. 2025 CPI
|
|
399
|
-
confirmed at 3.4%, so the guarantee triggered and the rate
|
|
400
|
-
was revised to 4.4%, backdated to 1 April 2025 with arrears.
|
|
401
|
-
2026-27's 3.75% then applies to the revised base, so both
|
|
402
|
-
years moved. Take both from Annex B rather than the MSG
|
|
403
|
-
consolidated table, which still prints the original 4.25%
|
|
404
|
-
rates.
|
|
299
|
+
Scotland negotiates its own AfC award independently and has completely different base salaries from England. Separate scale tables are stored for each tax year — `getAfcScales(year, 'scotland')` returns Scotland figures directly. Scotland also has structural differences: Band 2 has 2 points (vs 1 in England) and Bands 8a–9 have 2 points each (vs 3).
|
|
300
|
+
|
|
301
|
+
Source: [PCS(AFC)2026/1][scot-circular] — Scottish Health Workforce Directorate circular (23 Jan 2026). Annex B holds both years' rate tables; Annex C sets them out increment by increment and corroborates Annex B point for point.
|
|
302
|
+
|
|
303
|
+
Scotland's 2025-26 settlement was 4.25%, but carried an inflation guarantee — at least one percentage point above average CPI for the calendar year of the uplift. 2025 CPI confirmed at 3.4%, so the guarantee triggered and the rate was revised to 4.4%, backdated to 1 April 2025 with arrears. 2026-27's 3.75% then applies to the revised base, so both years moved. Take both from Annex B rather than the MSG consolidated table, which still prints the original 4.25% rates.
|
|
405
304
|
|
|
406
305
|
[scot-circular]: https://www.publications.scot.nhs.uk/files/pcs2026-afc-01.pdf
|
|
407
306
|
|
|
408
307
|
### Wales
|
|
409
308
|
|
|
410
|
-
Wales runs its own pay ladder and both years are transcribed
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
Point labels come from each circular's own "years until
|
|
422
|
-
eligible for pay progression" column, so they are stated by
|
|
423
|
-
the Welsh source rather than borrowed from England's table,
|
|
424
|
-
and they do not always agree with England's for the same band.
|
|
425
|
-
|
|
426
|
-
The living-wage floor is real but separate: it is an advance
|
|
427
|
-
payment that lifts the lowest points, which is why the 2026/27
|
|
428
|
-
uplift explicitly does not apply to them. `WALES_LIVING_WAGE`
|
|
429
|
-
carries both published figures — the annual floor and the hourly
|
|
430
|
-
rate it is set against — for reference; nothing derives a scale
|
|
431
|
-
from it, and neither figure derives from the other.
|
|
432
|
-
Source: [AfC(W) 01/2026][wales-lw] (6 Jan 2026).
|
|
433
|
-
|
|
434
|
-
Band 1 is published in both years (£24,833, then £26,300) and
|
|
435
|
-
closed to new entrants. It is absent from `AFC_BANDS`, the same
|
|
436
|
-
gap Scotland has.
|
|
437
|
-
|
|
438
|
-
Both Welsh years were transcribed during an outage of the NHS Wales
|
|
439
|
-
web estate (2 September 2026), so the circulars were read from NHS
|
|
440
|
-
Wales Employers' copy rather than the publisher's own. Each file was
|
|
441
|
-
checked byte-for-byte against a copy downloaded from `www.nhs.wales`
|
|
442
|
-
the previous day, before the outage, and both matched. The links
|
|
443
|
-
above are the publisher's, which is where these documents live.
|
|
309
|
+
Wales runs its own pay ladder and both years are transcribed from it: [AfC(W) 02/2025][wales-2025] (29 May 2025) and [AfC(W) 02/2026][wales-2026] (12 Feb 2026), Annex 1 of each.
|
|
310
|
+
|
|
311
|
+
Wales is **not** England's table with a floor applied. The two ladders differ at every band from 4 upward, where no floor reaches: Band 9 tops out at £131,732 in Wales against £129,783 in England. A floor lifts the bottom of a ladder and cannot raise its top. Wales also carries two Band 2 points where England has one.
|
|
312
|
+
|
|
313
|
+
Point labels come from each circular's own "years until eligible for pay progression" column, so they are stated by the Welsh source rather than borrowed from England's table, and they do not always agree with England's for the same band.
|
|
314
|
+
|
|
315
|
+
The living-wage floor is real but separate: it is an advance payment that lifts the lowest points, which is why the 2026/27 uplift explicitly does not apply to them. `WALES_LIVING_WAGE` carries both published figures — the annual floor and the hourly rate it is set against — for reference; nothing derives a scale from it, and neither figure derives from the other. Source: [AfC(W) 01/2026][wales-lw] (6 Jan 2026).
|
|
316
|
+
|
|
317
|
+
Band 1 is published in both years (£24,833, then £26,300) and closed to new entrants. It is absent from `AFC_BANDS`, the same gap Scotland has.
|
|
318
|
+
|
|
319
|
+
Both Welsh years were transcribed during an outage of the NHS Wales web estate (2 September 2026), so the circulars were read from NHS Wales Employers' copy rather than the publisher's own. Each file was checked byte-for-byte against a copy downloaded from `www.nhs.wales` the previous day, before the outage, and both matched. The links above are the publisher's, which is where these documents live.
|
|
444
320
|
|
|
445
321
|
[wales-2025]: https://www.nhs.wales/files/pc-resources/afc-w-02-2025-pdf-2-pdf/
|
|
446
322
|
[wales-2026]: https://www.nhs.wales/files/pc-resources/afc-w-02-2026-pdf-pdf/
|
|
@@ -460,10 +336,7 @@ above are the publisher's, which is where these documents live.
|
|
|
460
336
|
|
|
461
337
|
## Medical & dental pay scales
|
|
462
338
|
|
|
463
|
-
Doctors and dentists are paid on a separate set of pay circulars —
|
|
464
|
-
one per nation — from Agenda for Change. This library encodes them
|
|
465
|
-
so it can render **take-home** (not just gross) for medical and
|
|
466
|
-
dental grades, which is what most published sources omit.
|
|
339
|
+
Doctors and dentists are paid on a separate set of pay circulars — one per nation — from Agenda for Change. This library encodes them so it can render **take-home** (not just gross) for medical and dental grades, which is what most published sources omit.
|
|
467
340
|
|
|
468
341
|
| Nation | Circular | Year | Source |
|
|
469
342
|
| ------ | -------- | ---- | ------ |
|
|
@@ -480,78 +353,33 @@ dental grades, which is what most published sources omit.
|
|
|
480
353
|
[md-wal]: https://www.nhs.wales/hpb/nhs-pay-and-conditions/
|
|
481
354
|
[md-ni]: https://www.health-ni.gov.uk/publications/hsc-tc8-052025
|
|
482
355
|
|
|
483
|
-
Wales's 2026/27 round is a 3.5% uplift (3.75% for salaried
|
|
484
|
-
dentists) and removes the closed Associate Specialist (MC01)
|
|
485
|
-
code, so that grade resolves only at 2025/26.
|
|
356
|
+
Wales's 2026/27 round is a 3.5% uplift (3.75% for salaried dentists) and removes the closed Associate Specialist (MC01) code, so that grade resolves only at 2025/26.
|
|
486
357
|
|
|
487
|
-
NI 2025/26 pension member tiers (HSC — distinct thresholds *and*
|
|
488
|
-
rates from NHSBSA) are sourced from [HSC Pensions][hsc-pension].
|
|
358
|
+
NI 2025/26 pension member tiers (HSC — distinct thresholds *and* rates from NHSBSA) are sourced from [HSC Pensions][hsc-pension].
|
|
489
359
|
|
|
490
360
|
[hsc-pension]: https://hscpensions.hscni.net/
|
|
491
361
|
|
|
492
362
|
### How the data is modelled
|
|
493
363
|
|
|
494
|
-
The circulars vary widely in structure (nodal training points,
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
transcribed or **recorded with a reason** for skipping it, so
|
|
504
|
-
nothing is silently dropped and each file diffs against the PDF
|
|
505
|
-
top-to-bottom.
|
|
506
|
-
2. **Translation layer** (`src/medical-scales.ts`,
|
|
507
|
-
`src/dental-scales.ts`) — selects which scales feed the
|
|
508
|
-
calculator and maps each verbatim row to a canonical scale point.
|
|
509
|
-
Inclusive by default: closed-to-new-entrant grades, devolved
|
|
510
|
-
training variants, GP registrars and the Community Dental Service
|
|
511
|
-
are all wired.
|
|
512
|
-
3. **Canonical domain** (`getMedicalScales` / `getDentalScales` +
|
|
513
|
-
`medicalResolver` / `dentalResolver`) — a uniform
|
|
514
|
-
`(grade, nation, year) → scale points` view, identical in shape
|
|
515
|
-
to the AfC resolver.
|
|
516
|
-
|
|
517
|
-
**Scope.** *(a)* every basic-pay salary scale, including
|
|
518
|
-
closed-to-new-entrant grades still paid to incumbents, plus *(b)*
|
|
519
|
-
earnings-affecting supplements expressed as an annual £ (Clinical
|
|
520
|
-
Impact / Excellence awards, DPH and intensity supplements). Pure
|
|
521
|
-
expense tables (mileage, fees) and self-employed GDS/UDA dentist
|
|
522
|
-
contract income are out of scope.
|
|
523
|
-
|
|
524
|
-
**Unpublished data fails loud.** England and Wales publish complete
|
|
525
|
-
2026/27 rounds. Scotland's 2026/27 circular uplifts training grades
|
|
526
|
-
only, so its consultant / SAS / GP / dental scales resolve to the
|
|
527
|
-
complete 2025/26 round (PCS(DD)2025/01) until the Scottish
|
|
528
|
-
Government publishes the non-training uplift; Northern Ireland's
|
|
529
|
-
latest circular is 2025/26 throughout. Each grade resolves at its
|
|
530
|
-
own cited year and `latestYearFor(grade, nation)` reports it —
|
|
531
|
-
figures are never silently carried forward, and a query for an
|
|
532
|
-
unpublished (year, nation) throws rather than defaulting to another
|
|
533
|
-
nation's or year's figures.
|
|
364
|
+
The circulars vary widely in structure (nodal training points, consultant thresholds, SAS experience bands, GP ranges, dental spines), so the data is built in three layers that decouple transcription fidelity from the uniform domain model:
|
|
365
|
+
|
|
366
|
+
1. **Verbatim circular** (`src/circulars/*.ts`) — one file per PDF, each table transcribed 1:1 in source order with a row shape that mirrors that table's own columns, under a comment citing the Annex / section / page. Every table in the circular is either transcribed or **recorded with a reason** for skipping it, so nothing is silently dropped and each file diffs against the PDF top-to-bottom.
|
|
367
|
+
2. **Translation layer** (`src/medical-scales.ts`, `src/dental-scales.ts`) — selects which scales feed the calculator and maps each verbatim row to a canonical scale point. Inclusive by default: closed-to-new-entrant grades, devolved training variants, GP registrars and the Community Dental Service are all wired.
|
|
368
|
+
3. **Canonical domain** (`getMedicalScales` / `getDentalScales` + `medicalResolver` / `dentalResolver`) — a uniform `(grade, nation, year) → scale points` view, identical in shape to the AfC resolver.
|
|
369
|
+
|
|
370
|
+
**Scope.** *(a)* every basic-pay salary scale, including closed-to-new-entrant grades still paid to incumbents, plus *(b)* earnings-affecting supplements expressed as an annual £ (Clinical Impact / Excellence awards, DPH and intensity supplements). Pure expense tables (mileage, fees) and self-employed GDS/UDA dentist contract income are out of scope.
|
|
371
|
+
|
|
372
|
+
**Unpublished data fails loud.** England and Wales publish complete 2026/27 rounds. Scotland's 2026/27 circular uplifts training grades only, so its consultant / SAS / GP / dental scales resolve to the complete 2025/26 round (PCS(DD)2025/01) until the Scottish Government publishes the non-training uplift; Northern Ireland's latest circular is 2025/26 throughout. Each grade resolves at its own cited year and `latestYearFor(grade, nation)` reports it — figures are never silently carried forward, and a query for an unpublished (year, nation) throws rather than defaulting to another nation's or year's figures.
|
|
534
373
|
|
|
535
374
|
## Test fixtures
|
|
536
375
|
|
|
537
|
-
`tests/working-week.test.ts` pins the AfC week and its 365/7 year
|
|
538
|
-
|
|
539
|
-
the
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
part-time (0.6 FTE). Gross figures are derived from
|
|
545
|
-
`getAfcScales(year, nation)` using the sources above.
|
|
546
|
-
Pension, tax, NI and net values are computed by
|
|
547
|
-
`nhsTakeHome` and should be cross-checked against:
|
|
548
|
-
|
|
549
|
-
- [NHS Employers pay scales 2025/26][scales-2526] and
|
|
550
|
-
[2026/27][scales-2627] for England/NI gross
|
|
551
|
-
- [PCS(AFC)2026/1][scot-circular] Annex B for Scotland
|
|
552
|
-
gross
|
|
553
|
-
- [NHSBSA pension contribution rates 2025/26][pension-2526]
|
|
554
|
-
for pension tier rates
|
|
376
|
+
`tests/working-week.test.ts` pins the AfC week and its 365/7 year against every hourly rate Scotland's circular prints beside a salary, and the Welsh living-wage pair.
|
|
377
|
+
|
|
378
|
+
`tests/fixtures/band-take-home.csv` — golden-value rows covering bands 5, 7, 8a across all 4 nations (England, Scotland, Wales, NI), both tax years, 3 HCAS zones, and part-time (0.6 FTE). Gross figures are derived from `getAfcScales(year, nation)` using the sources above. Pension, tax, NI and net values are computed by `nhsTakeHome` and should be cross-checked against:
|
|
379
|
+
|
|
380
|
+
- [NHS Employers pay scales 2025/26][scales-2526] and [2026/27][scales-2627] for England/NI gross
|
|
381
|
+
- [PCS(AFC)2026/1][scot-circular] Annex B for Scotland gross
|
|
382
|
+
- [NHSBSA pension contribution rates 2025/26][pension-2526] for pension tier rates
|
|
555
383
|
|
|
556
384
|
## Tax years
|
|
557
385
|
|
|
@@ -564,10 +392,7 @@ AfC scale + pension coverage (all four nations):
|
|
|
564
392
|
| 2025-26 | Yes | Yes |
|
|
565
393
|
| 2026-27 | Yes | Yes |
|
|
566
394
|
|
|
567
|
-
Medical & dental coverage is per-nation (England/Wales 2026/27;
|
|
568
|
-
Scotland 2026/27 for training grades and 2025/26 for the rest;
|
|
569
|
-
NI 2025/26) — see
|
|
570
|
-
[Medical & dental pay scales](#medical--dental-pay-scales).
|
|
395
|
+
Medical & dental coverage is per-nation (England/Wales 2026/27; Scotland 2026/27 for training grades and 2025/26 for the rest; NI 2025/26) — see [Medical & dental pay scales](#medical--dental-pay-scales).
|
|
571
396
|
|
|
572
397
|
## Development
|
|
573
398
|
|
|
@@ -581,13 +406,6 @@ npm run test:watch # vitest watch mode
|
|
|
581
406
|
|
|
582
407
|
## License
|
|
583
408
|
|
|
584
|
-
AGPL-3.0-only — see [LICENSE](LICENSE).
|
|
585
|
-
Copyright © 2026 Casomo Ltd.
|
|
409
|
+
AGPL-3.0-only — see [LICENSE](LICENSE). Copyright © 2026 Casomo Ltd.
|
|
586
410
|
|
|
587
|
-
There is no linking exception: combine this library with your
|
|
588
|
-
own code and the combined work is AGPL too, and letting people
|
|
589
|
-
use that work over a network obliges you to offer them its
|
|
590
|
-
source. Charging money is not what triggers this, and not
|
|
591
|
-
charging is no exemption. A commercial licence is available for
|
|
592
|
-
use that needs to stay closed — enquire via
|
|
593
|
-
[casomoltd.com](https://casomoltd.com).
|
|
411
|
+
There is no linking exception: combine this library with your own code and the combined work is AGPL too, and letting people use that work over a network obliges you to offer them its source. Charging money is not what triggers this, and not charging is no exemption. A commercial licence is available for use that needs to stay closed — enquire via [casomoltd.com](https://casomoltd.com).
|
package/dist/bands.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import type { PayYear, Nation } from '@casomoltd/paye-calc';
|
|
11
11
|
import type { AfcBandId, HcasZones } from './scales.js';
|
|
12
|
-
import type { SteppedPoint } from './scale-point.js';
|
|
12
|
+
import type { PayLadder, SteppedPoint } from './scale-point.js';
|
|
13
13
|
import type { DocumentSource } from './document-source.js';
|
|
14
14
|
import type { SalaryRange } from './values.js';
|
|
15
15
|
export interface AfcBandMeta {
|
|
@@ -53,3 +53,11 @@ export declare const AFC_PREVIOUS_YEAR: PayYear;
|
|
|
53
53
|
* silently return England figures for every region (the exact bug
|
|
54
54
|
* this signature prevents). */
|
|
55
55
|
export declare function getAfcScales(year: PayYear, nation: Nation): AfcScaleData;
|
|
56
|
+
/**
|
|
57
|
+
* The point labelled `label` on an AfC band, with the band's points, for
|
|
58
|
+
* a pay year and nation, read from {@link getAfcScales}. Throws
|
|
59
|
+
* `ScaleUnavailable` where the year and nation publish no scale or the
|
|
60
|
+
* band has no such point, and `AmbiguousScalePoint` where the label names
|
|
61
|
+
* more than one, so a caller never prices a point it did not ask for.
|
|
62
|
+
*/
|
|
63
|
+
export declare function afcPointOf(year: PayYear, nation: Nation, band: AfcBandId, label: string): PayLadder;
|
package/dist/bands.js
CHANGED
|
@@ -9,6 +9,7 @@
|
|
|
9
9
|
*/
|
|
10
10
|
import { TAX_YEARS } from '@casomoltd/paye-calc';
|
|
11
11
|
import { AFC_BAND_IDS, afcScaleSource, getScalesForYear, } from './scales.js';
|
|
12
|
+
import { AmbiguousScalePoint, ScaleUnavailable } from './errors.js';
|
|
12
13
|
/**
|
|
13
14
|
* The AfC PAY year England, Scotland and Wales are currently on.
|
|
14
15
|
*
|
|
@@ -55,4 +56,23 @@ export function getAfcScales(year, nation) {
|
|
|
55
56
|
hcas: scaleYear.hcas,
|
|
56
57
|
};
|
|
57
58
|
}
|
|
59
|
+
/**
|
|
60
|
+
* The point labelled `label` on an AfC band, with the band's points, for
|
|
61
|
+
* a pay year and nation, read from {@link getAfcScales}. Throws
|
|
62
|
+
* `ScaleUnavailable` where the year and nation publish no scale or the
|
|
63
|
+
* band has no such point, and `AmbiguousScalePoint` where the label names
|
|
64
|
+
* more than one, so a caller never prices a point it did not ask for.
|
|
65
|
+
*/
|
|
66
|
+
export function afcPointOf(year, nation, band, label) {
|
|
67
|
+
const found = getAfcScales(year, nation).bands.find((b) => b.band === band);
|
|
68
|
+
const matches = found?.points.filter((p) => p.label === label) ?? [];
|
|
69
|
+
const current = matches.at(0);
|
|
70
|
+
if (found === undefined || current === undefined) {
|
|
71
|
+
throw new ScaleUnavailable(nation, year, band, label);
|
|
72
|
+
}
|
|
73
|
+
if (matches.length > 1) {
|
|
74
|
+
throw new AmbiguousScalePoint(band, label, matches.length);
|
|
75
|
+
}
|
|
76
|
+
return { points: found.points, current };
|
|
77
|
+
}
|
|
58
78
|
//# sourceMappingURL=bands.js.map
|
package/dist/bands.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bands.js","sourceRoot":"","sources":["../src/bands.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAM/C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"bands.js","sourceRoot":"","sources":["../src/bands.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAM/C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAC,mBAAmB,EAAE,gBAAgB,EAAC,MAAM,aAAa,CAAC;AA0BlE;;;;;;;;;;;;;GAaG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAY,SAAS,CAAC,QAAQ,CAAC;AAE5D,gEAAgE;AAChE,MAAM,CAAC,MAAM,iBAAiB,GAAY,SAAS,CAAC,QAAQ,CAAC;AAE7D;;;;;;;gCAOgC;AAChC,MAAM,UAAU,YAAY,CAC1B,IAAa,EACb,MAAc;IAEd,MAAM,SAAS,GAAG,gBAAgB,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IACjD,MAAM,MAAM,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAE5C,MAAM,KAAK,GAAG,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACtC,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACtC,MAAM,QAAQ,GAAG,MAAM,CAAC,GAAG,CACzB,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAChB,CAAC;QACF,OAAO;YACL,IAAI;YACJ,MAAM;YACN,MAAM,EAAE;gBACN,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;gBAC1B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;aAC3B;YACD,MAAM;SACP,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,IAAI,EAAE,SAAS,CAAC,IAAI;KACrB,CAAC;AACJ,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,IAAa,EACb,MAAc,EACd,IAAe,EACf,KAAa;IAEb,MAAM,KAAK,GAAG,YAAY,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,IAAI,CAAC,CAAC;IAC5E,MAAM,OAAO,GAAG,KAAK,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,KAAK,KAAK,KAAK,CAAC,IAAI,EAAE,CAAC;IACrE,MAAM,OAAO,GAAG,OAAO,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;IAC9B,IAAI,KAAK,KAAK,SAAS,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QACjD,MAAM,IAAI,gBAAgB,CAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;IACxD,CAAC;IACD,IAAI,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACvB,MAAM,IAAI,mBAAmB,CAAC,IAAI,EAAE,KAAK,EAAE,OAAO,CAAC,MAAM,CAAC,CAAC;IAC7D,CAAC;IACD,OAAO,EAAC,MAAM,EAAE,KAAK,CAAC,MAAM,EAAE,OAAO,EAAC,CAAC;AACzC,CAAC"}
|
|
@@ -139,3 +139,19 @@ export declare class DocumentSource {
|
|
|
139
139
|
* identical to a fresh one.
|
|
140
140
|
*/
|
|
141
141
|
export type SourceCurrency = 'current' | 'lapsed' | 'unknown';
|
|
142
|
+
/**
|
|
143
|
+
* A publisher's web page that prints no issue date: what it is, and the
|
|
144
|
+
* day it was read. Its own type rather than a {@link DocumentSource},
|
|
145
|
+
* whose `issued` a consumer prints as the date of publication, so an
|
|
146
|
+
* undated page cannot be shown as published on the day it was read.
|
|
147
|
+
*/
|
|
148
|
+
export interface PageSource {
|
|
149
|
+
/** Who publishes it — 'NHSBSA'. */
|
|
150
|
+
readonly issuer: string;
|
|
151
|
+
/** The page's own title, as printed. */
|
|
152
|
+
readonly reference: string;
|
|
153
|
+
/** The page itself, for a consumer to link. */
|
|
154
|
+
readonly url: string;
|
|
155
|
+
/** ISO date the page was read; it prints no date of its own. */
|
|
156
|
+
readonly retrieved: IsoDate;
|
|
157
|
+
}
|
package/dist/document-source.js
CHANGED
|
@@ -18,6 +18,8 @@
|
|
|
18
18
|
* scale carries one too, and `award.ts` imports every scale module —
|
|
19
19
|
* so defining it there would make a scale citing its source a cycle.
|
|
20
20
|
*/
|
|
21
|
+
/** The characters of an ISO timestamp that are its date, `YYYY-MM-DD`. */
|
|
22
|
+
const ISO_DATE_LENGTH = 10;
|
|
21
23
|
/**
|
|
22
24
|
* A document this library cites — not commentary about it. Held on the
|
|
23
25
|
* record so a consumer cites the document rather than keeping its own
|
|
@@ -72,7 +74,7 @@ export class DocumentSource {
|
|
|
72
74
|
if (!this.nextExpected) {
|
|
73
75
|
return 'unknown';
|
|
74
76
|
}
|
|
75
|
-
return this.nextExpected >= now.toISOString().slice(0,
|
|
77
|
+
return this.nextExpected >= now.toISOString().slice(0, ISO_DATE_LENGTH)
|
|
76
78
|
? 'current'
|
|
77
79
|
: 'lapsed';
|
|
78
80
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"document-source.js","sourceRoot":"","sources":["../src/document-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;
|
|
1
|
+
{"version":3,"file":"document-source.js","sourceRoot":"","sources":["../src/document-source.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;GAmBG;AAIH,0EAA0E;AAC1E,MAAM,eAAe,GAAG,EAAE,CAAC;AA8D3B;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,OAAO,cAAc;IACzB,8DAA8D;IACrD,MAAM,CAAS;IACxB,mEAAmE;IAC1D,SAAS,CAAS;IAC3B,+CAA+C;IACtC,GAAG,CAAS;IACrB,wCAAwC;IAC/B,MAAM,CAAU;IACzB,sDAAsD;IAC7C,YAAY,CAAW;IAChC;iCAC6B;IACpB,kBAAkB,CAAU;IAErC,YAAY,MAA4B;QACtC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,SAAS,GAAG,MAAM,CAAC,SAAS,CAAC;QAClC,IAAI,CAAC,GAAG,GAAG,MAAM,CAAC,GAAG,CAAC;QACtB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC,MAAM,CAAC;QAC5B,IAAI,CAAC,YAAY,GAAG,MAAM,CAAC,YAAY,CAAC;QACxC,IAAI,CAAC,kBAAkB,GAAG,MAAM,CAAC,kBAAkB,CAAC;IACtD,CAAC;IAED;;;;;;;;;;OAUG;IACH,UAAU,CAAC,GAAS;QAClB,IAAI,CAAC,IAAI,CAAC,YAAY,EAAE,CAAC;YACvB,OAAO,SAAS,CAAC;QACnB,CAAC;QACD,OAAO,IAAI,CAAC,YAAY,IAAI,GAAG,CAAC,WAAW,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC;YACrE,CAAC,CAAC,SAAS;YACX,CAAC,CAAC,QAAQ,CAAC;IACf,CAAC;CACF"}
|