@casomoltd/nhs-pay 0.4.15 → 0.5.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/dist/bands.d.ts CHANGED
@@ -1,29 +1,20 @@
1
1
  /**
2
- * Merge layer — combines static band metadata with
3
- * year-specific salary data and pension tiers.
2
+ * Merge layer — joins each AfC band id with its
3
+ * year-specific salary points and the year's pension
4
+ * tiers.
4
5
  *
5
- * Role descriptions sourced from NHS Employers:
6
- * https://www.nhsemployers.org/articles/pay-scales-202526
6
+ * Presentation copy (labels, slugs, role descriptions)
7
+ * is a hub-site concern and lives there, not in this
8
+ * domain library.
7
9
  */
8
10
  import type { TaxYear, Nation } from '@casomoltd/paye-calc';
9
11
  import type { AfcBandId, ScalePoint, HcasZones } from './scales.js';
10
12
  import type { PensionTier } from './pension.js';
11
- export interface AfcBandInfo {
12
- slug: string;
13
- label: string;
14
- roles: string;
15
- roleContext: string;
16
- }
17
- export declare const AFC_BAND_INFO: Record<AfcBandId, AfcBandInfo>;
13
+ import type { SalaryRange } from './values.js';
18
14
  export interface AfcBandMeta {
19
15
  band: AfcBandId;
20
- slug: string;
21
- label: string;
22
- roles: string;
23
- roleContext: string;
24
16
  points: ScalePoint[];
25
- salaryMin: number;
26
- salaryMax: number;
17
+ salary: SalaryRange;
27
18
  }
28
19
  export interface AfcScaleData {
29
20
  bands: AfcBandMeta[];
package/dist/bands.js CHANGED
@@ -1,126 +1,15 @@
1
1
  /**
2
- * Merge layer — combines static band metadata with
3
- * year-specific salary data and pension tiers.
2
+ * Merge layer — joins each AfC band id with its
3
+ * year-specific salary points and the year's pension
4
+ * tiers.
4
5
  *
5
- * Role descriptions sourced from NHS Employers:
6
- * https://www.nhsemployers.org/articles/pay-scales-202526
6
+ * Presentation copy (labels, slugs, role descriptions)
7
+ * is a hub-site concern and lives there, not in this
8
+ * domain library.
7
9
  */
8
10
  import { TAX_YEARS } from '@casomoltd/paye-calc';
9
- import { AFC_BAND_IDS, applyWalesFloor, getScalesForYear, } from './scales.js';
11
+ import { AFC_BAND_IDS, getScalesForYear, } from './scales.js';
10
12
  import { getPensionTiers } from './pension.js';
11
- export const AFC_BAND_INFO = {
12
- '2': {
13
- slug: 'nhs-band-2-pay',
14
- label: 'Band 2',
15
- roles: 'Healthcare assistants,'
16
- + ' housekeeping, security',
17
- roleContext: 'Entry-level support roles including'
18
- + ' domestic support workers,'
19
- + ' housekeeping assistants, drivers,'
20
- + ' security officers and healthcare'
21
- + ' assistants.',
22
- },
23
- '3': {
24
- slug: 'nhs-band-3-pay',
25
- label: 'Band 3',
26
- roles: 'Emergency care assistants,'
27
- + ' therapy support workers',
28
- roleContext: 'Experienced support roles such as'
29
- + ' emergency care assistants and'
30
- + ' occupational therapy support'
31
- + ' workers.',
32
- },
33
- '4': {
34
- slug: 'nhs-band-4-pay',
35
- label: 'Band 4',
36
- roles: 'Assistant practitioners,'
37
- + ' pharmacy technicians',
38
- roleContext: 'Roles requiring specialist training'
39
- + ' including assistant practitioners,'
40
- + ' pharmacy technicians, dental nurses'
41
- + ' and trainee psychological wellbeing'
42
- + ' practitioners.',
43
- },
44
- '5': {
45
- slug: 'nhs-band-5-pay',
46
- label: 'Band 5',
47
- roles: 'Newly qualified nurses,'
48
- + ' midwives, therapists',
49
- roleContext: 'The entry point for newly qualified'
50
- + ' clinical professionals including'
51
- + ' nurses, operating department'
52
- + ' practitioners, podiatrists and'
53
- + ' therapeutic radiographers.',
54
- },
55
- '6': {
56
- slug: 'nhs-band-6-pay',
57
- label: 'Band 6',
58
- roles: 'Senior nurses,'
59
- + ' specialist practitioners',
60
- roleContext: 'Experienced clinical and specialist'
61
- + ' roles such as school nurses,'
62
- + ' paramedics, estates officers and'
63
- + ' health records managers.',
64
- },
65
- '7': {
66
- slug: 'nhs-band-7-pay',
67
- label: 'Band 7',
68
- roles: 'Team leaders,'
69
- + ' advanced practitioners',
70
- roleContext: 'Advanced and management roles'
71
- + ' including communications managers,'
72
- + ' estates managers and advanced'
73
- + ' speech and language therapists.',
74
- },
75
- '8a': {
76
- slug: 'nhs-band-8a-pay',
77
- label: 'Band 8a',
78
- roles: 'Modern matrons, nurse consultants',
79
- roleContext: 'Senior specialist and management'
80
- + ' roles such as consultant'
81
- + ' prosthetists, dental laboratory'
82
- + ' managers, modern matrons and nurse'
83
- + ' consultants.',
84
- },
85
- '8b': {
86
- slug: 'nhs-band-8b-pay',
87
- label: 'Band 8b',
88
- roles: 'Heads of service, strategic managers',
89
- roleContext: 'Strategic management and senior'
90
- + ' clinical leadership including heads'
91
- + ' of education, clinical physiology'
92
- + ' service managers and head'
93
- + ' orthoptists.',
94
- },
95
- '8c': {
96
- slug: 'nhs-band-8c-pay',
97
- label: 'Band 8c',
98
- roles: 'Heads of HR,'
99
- + ' consultant clinical scientists',
100
- roleContext: 'Senior leadership roles such as'
101
- + ' heads of human resources,'
102
- + ' consultant clinical scientists and'
103
- + ' consultant paramedics.',
104
- },
105
- '8d': {
106
- slug: 'nhs-band-8d-pay',
107
- label: 'Band 8d',
108
- roles: 'Chief nurses, chief finance managers',
109
- roleContext: 'Executive-level clinical and'
110
- + ' corporate roles including consultant'
111
- + ' psychologists, chief nurses and'
112
- + ' chief finance managers.',
113
- },
114
- '9': {
115
- slug: 'nhs-band-9-pay',
116
- label: 'Band 9',
117
- roles: 'Directors, chief officers',
118
- roleContext: 'The most senior AfC roles including'
119
- + ' podiatric surgery consultants, chief'
120
- + ' finance managers and directors of'
121
- + ' estates and facilities.',
122
- },
123
- };
124
13
  /** Current financial year for band pages. */
125
14
  export const AFC_CURRENT_YEAR = TAX_YEARS.Y2026_27;
126
15
  /** Previous financial year for comparison. */
@@ -134,22 +23,15 @@ export function getAfcScales(year = AFC_CURRENT_YEAR, nation) {
134
23
  const scaleYear = getScalesForYear(year, nation);
135
24
  const pensionTiers = getPensionTiers(year);
136
25
  const bands = AFC_BAND_IDS.map((band) => {
137
- const info = AFC_BAND_INFO[band];
138
- const basePoints = scaleYear.scales[band];
139
- const points = nation === 'wales'
140
- ? basePoints.map((pt) => {
141
- const salary = applyWalesFloor(pt.salary, year);
142
- return salary !== pt.salary
143
- ? { ...pt, salary } : pt;
144
- })
145
- : basePoints;
26
+ const points = scaleYear.scales[band];
146
27
  const salaries = points.map((p) => p.salary);
147
28
  return {
148
29
  band,
149
- ...info,
150
30
  points,
151
- salaryMin: Math.min(...salaries),
152
- salaryMax: Math.max(...salaries),
31
+ salary: {
32
+ min: Math.min(...salaries),
33
+ max: Math.max(...salaries),
34
+ },
153
35
  };
154
36
  });
155
37
  return {
package/dist/bands.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bands.js","sourceRoot":"","sources":["../src/bands.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAKH,OAAO,EAAC,SAAS,EAAC,MAAM,sBAAsB,CAAC;AAM/C,OAAO,EACL,YAAY,EACZ,eAAe,EACf,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,OAAO,EAAC,eAAe,EAAC,MAAM,cAAc,CAAC;AAW7C,MAAM,CAAC,MAAM,aAAa,GAEtB;IACF,GAAG,EAAE;QACH,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,QAAQ;QACf,KAAK,EACH,wBAAwB;cACtB,yBAAyB;QAC7B,WAAW,EACT,qCAAqC;cACnC,4BAA4B;cAC5B,oCAAoC;cACpC,mCAAmC;cACnC,cAAc;KACnB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,QAAQ;QACf,KAAK,EACH,4BAA4B;cAC1B,0BAA0B;QAC9B,WAAW,EACT,mCAAmC;cACjC,gCAAgC;cAChC,+BAA+B;cAC/B,WAAW;KAChB;IACD,GAAG,EAAE;QACH,IAAI,EAAE,gBAAgB;QACtB,KAAK,EAAE,QAAQ;QACf,KAAK,EACH,0BAA0B;cACxB,uBAAuB;QAC3B,WAAW,EACT,qCAAqC;cACnC,qCAAqC;cACrC,sCAAsC;cACtC,sCAAsC;cAC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AAE;gBACN,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;gBAC1B,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,GAAG,QAAQ,CAAC;aAC3B;SACF,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,OAAO;QACL,KAAK;QACL,IAAI,EAAE,SAAS,CAAC,IAAI;QACpB,YAAY;KACb,CAAC;AACJ,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Errors for absent pay data. Fail loud — never silently
3
+ * substitute another year's or nation's figures.
4
+ */
5
+ import type { Nation, TaxYear } from '@casomoltd/paye-calc';
6
+ /**
7
+ * Thrown when no pay scale is published for a
8
+ * (nation, year), optionally narrowed to a grade and a
9
+ * scale point. The UI enumerates valid combinations first,
10
+ * so this signals genuine data-absence, not control flow.
11
+ */
12
+ export declare class ScaleUnavailable extends Error {
13
+ readonly nation: Nation;
14
+ readonly year: TaxYear;
15
+ readonly gradeId?: string | undefined;
16
+ /** Set when the scale exists but the point label doesn't. */
17
+ readonly pointLabel?: string | undefined;
18
+ constructor(nation: Nation, year: TaxYear, gradeId?: string | undefined,
19
+ /** Set when the scale exists but the point label doesn't. */
20
+ pointLabel?: string | undefined);
21
+ }
22
+ /**
23
+ * Thrown when NHS pension contribution tiers are not
24
+ * published for a tax year. Sibling of {@link ScaleUnavailable}
25
+ * so both absent-pay-data paths can be caught by type.
26
+ */
27
+ export declare class PensionTiersUnavailable extends Error {
28
+ readonly year: TaxYear;
29
+ constructor(year: TaxYear);
30
+ }
package/dist/errors.js ADDED
@@ -0,0 +1,51 @@
1
+ /**
2
+ * Errors for absent pay data. Fail loud — never silently
3
+ * substitute another year's or nation's figures.
4
+ */
5
+ /**
6
+ * Thrown when no pay scale is published for a
7
+ * (nation, year), optionally narrowed to a grade and a
8
+ * scale point. The UI enumerates valid combinations first,
9
+ * so this signals genuine data-absence, not control flow.
10
+ */
11
+ export class ScaleUnavailable extends Error {
12
+ nation;
13
+ year;
14
+ gradeId;
15
+ pointLabel;
16
+ constructor(nation, year, gradeId,
17
+ /** Set when the scale exists but the point label doesn't. */
18
+ pointLabel) {
19
+ super(scaleMessage(nation, year, gradeId, pointLabel));
20
+ this.nation = nation;
21
+ this.year = year;
22
+ this.gradeId = gradeId;
23
+ this.pointLabel = pointLabel;
24
+ this.name = 'ScaleUnavailable';
25
+ }
26
+ }
27
+ /**
28
+ * Thrown when NHS pension contribution tiers are not
29
+ * published for a tax year. Sibling of {@link ScaleUnavailable}
30
+ * so both absent-pay-data paths can be caught by type.
31
+ */
32
+ export class PensionTiersUnavailable extends Error {
33
+ year;
34
+ constructor(year) {
35
+ super(`No NHS pension tiers published for ${year}`);
36
+ this.year = year;
37
+ this.name = 'PensionTiersUnavailable';
38
+ }
39
+ }
40
+ function scaleMessage(nation, year, gradeId, pointLabel) {
41
+ if (pointLabel !== undefined) {
42
+ return `No scale point "${pointLabel}" for `
43
+ + `${gradeId} in ${nation} ${year}`;
44
+ }
45
+ if (gradeId !== undefined) {
46
+ return `No published scale for ${gradeId} in `
47
+ + `${nation} ${year}`;
48
+ }
49
+ return `No published pay scale for ${nation} ${year}`;
50
+ }
51
+ //# sourceMappingURL=errors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"errors.js","sourceRoot":"","sources":["../src/errors.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;;;;GAKG;AACH,MAAM,OAAO,gBAAiB,SAAQ,KAAK;IAE9B;IACA;IACA;IAEA;IALX,YACW,MAAc,EACd,IAAa,EACb,OAAgB;IACzB,6DAA6D;IACpD,UAAmB;QAE5B,KAAK,CAAC,YAAY,CAAC,MAAM,EAAE,IAAI,EAAE,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC;QAN9C,WAAM,GAAN,MAAM,CAAQ;QACd,SAAI,GAAJ,IAAI,CAAS;QACb,YAAO,GAAP,OAAO,CAAS;QAEhB,eAAU,GAAV,UAAU,CAAS;QAG5B,IAAI,CAAC,IAAI,GAAG,kBAAkB,CAAC;IACjC,CAAC;CACF;AAED;;;;GAIG;AACH,MAAM,OAAO,uBAAwB,SAAQ,KAAK;IAC3B;IAArB,YAAqB,IAAa;QAChC,KAAK,CAAC,sCAAsC,IAAI,EAAE,CAAC,CAAC;QADjC,SAAI,GAAJ,IAAI,CAAS;QAEhC,IAAI,CAAC,IAAI,GAAG,yBAAyB,CAAC;IACxC,CAAC;CACF;AAED,SAAS,YAAY,CACnB,MAAc,EACd,IAAa,EACb,OAAgB,EAChB,UAAmB;IAEnB,IAAI,UAAU,KAAK,SAAS,EAAE,CAAC;QAC7B,OAAO,mBAAmB,UAAU,QAAQ;cACxC,GAAG,OAAO,OAAO,MAAM,IAAI,IAAI,EAAE,CAAC;IACxC,CAAC;IACD,IAAI,OAAO,KAAK,SAAS,EAAE,CAAC;QAC1B,OAAO,0BAA0B,OAAO,MAAM;cAC1C,GAAG,MAAM,IAAI,IAAI,EAAE,CAAC;IAC1B,CAAC;IACD,OAAO,8BAA8B,MAAM,IAAI,IAAI,EAAE,CAAC;AACxD,CAAC"}
package/dist/format.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * GBP and percentage formatting helpers for NHS
3
- * pay data. Consolidates formatters previously split
4
- * across afc-format.ts and calculator format.ts.
3
+ * pay data.
5
4
  */
6
5
  import type { TaxYear } from '@casomoltd/paye-calc';
7
6
  /** Exact salary with £ sign — £31,049 */
package/dist/format.js CHANGED
@@ -1,7 +1,6 @@
1
1
  /**
2
2
  * GBP and percentage formatting helpers for NHS
3
- * pay data. Consolidates formatters previously split
4
- * across afc-format.ts and calculator format.ts.
3
+ * pay data.
5
4
  */
6
5
  // ── Intl formatters (reused across calls) ───────
7
6
  const gbpFormat = new Intl.NumberFormat('en-GB', {
@@ -1 +1 @@
1
- {"version":3,"file":"format.js","sourceRoot":"","sources":["../src/format.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,mDAAmD;AAEnD,MAAM,SAAS,GAAG,IAAI,IAAI,CA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AC9B,MAAM,UAAU,QAAQ,CAAC,CAAS;IAChC,OAAO,CACL,QAAQ;UACN,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,cAAc,CAAC,OAAO,CAAC,CACxC,CAAC;AACJ,CAAC;AAED,mDAAmD;AAEnD,sCAAsC;AACtC,MAAM,UAAU,MAAM,CAAC,CAAS;IAC9B,OAAO,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,GAAG,CAAC;AAC5B,CAAC;AAED,+CAA+C;AAC/C,MAAM,UAAU,SAAS,CAAC,CAAS;IACjC,OAAO,SAAS,CAAC,MAAM,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AACnC,CAAC;AAED,mDAAmD;AAEnD,4BAA4B;AAC5B,MAAM,UAAU,SAAS,CAAC,IAAa;IACrC,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAChC,CAAC"}
package/dist/hcas-pcts.js CHANGED
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * Browser-safe — no node:fs dependency.
10
10
  */
11
- // ── PCT data (from NHS Employers Annex 8) ───────
11
+ // ── PCT data — NHS T&Cs Handbook Annex 8 (HCAS zones) ──
12
12
  const INNER_LONDON_PCTS = [
13
13
  'Hammersmith & Fulham',
14
14
  'Kensington & Chelsea',
@@ -1 +1 @@
1
- {"version":3,"file":"hcas-pcts.js","sourceRoot":"","sources":["../src/hcas-pcts.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAIH,mDAAmD;AAEnD,MAAM,iBAAiB,GAAsB;IAC3C,sBAAsB;IACtB,sBAAsB;IACtB,aAAa;IACb,QAAQ;IACR,WAAW;IACX,gBAAgB;IAChB,eAAe;IACf,SAAS;IACT,UAAU;IACV,WAAW;IACX,YAAY;CACb,CAAC;AAEF,MAAM,iBAAiB,GAAsB;IAC3C,OAAO;IACP,QAAQ;IACR,QAAQ;IACR,YAAY;IACZ,UAAU;IACV,QAAQ;IACR,SAAS;IACT,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C,EAAC,IAAI,EAAE,cAAc,EAAE,IAAI,EAAE,iBAAiB,EAAC;IAC/C,EAAC,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,WAAW,EAAC;CACpC,CAAC;AAEF,mDAAmD;AAEnD,MAAM,SAAS,GACb,IAAI,GAAG,EAAE,CAAC;AAEZ,KAAK,MAAM,EAAC,IAAI,EAAE,IAAI,EAAC,IAAI,SAAS,EAAE,CAAC;IACrC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;QACvB,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,CAAC;IACzC,CAAC;AACH,CAAC;AASD,gDAAgD;AAChD,MAAM,UAAU,WAAW,CACzB,GAAW;IAEX,OAAO,SAAS,CAAC,GAAG,CAAC,GAAG,CAAC,WAAW,EAAE,CAAC,IAAI,IAAI,CAAC;AAClD,CAAC;AAED,oDAAoD;AACpD,MAAM,UAAU,WAAW;IACzB,MAAM,MAAM,GAAc,EAAE,CAAC;IAC7B,KAAK,MAAM,EAAC,IAAI,EAAE,IAAI,EAAC,IAAI,SAAS,EAAE,CAAC;QACrC,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,IAAI,CAAC,EAAC,IAAI,EAAE,GAAG,EAAC,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC;AAChB,CAAC"}
package/dist/hcas.d.ts CHANGED
@@ -5,7 +5,7 @@
5
5
  * Browser-safe — no node:fs dependency.
6
6
  */
7
7
  import type { TaxYear } from '@casomoltd/paye-calc';
8
- import type { HcasZones } from './scales.js';
8
+ import type { HcasZone, HcasZones } from './scales.js';
9
9
  import type { AfcRegionId } from './regions.js';
10
10
  export declare const HCAS_ZONE_IDS: {
11
11
  readonly INNER_LONDON: "inner-london";
@@ -19,10 +19,20 @@ export declare function isHcasZoneId(value: string): value is HcasZoneId;
19
19
  * Calculate HCAS supplement for a base salary.
20
20
  * Applies percentage rate clamped between min/max.
21
21
  */
22
- export declare function calculateHcasSupplement(baseSalary: number, zone: {
23
- rate: number;
24
- min: number;
25
- max: number;
26
- }): number;
27
- /** Base salary + Wales floor + HCAS supplement. */
22
+ export declare function calculateHcasSupplement(baseSalary: number, zone: HcasZone): number;
23
+ /**
24
+ * Produce a region's gross from a base salary: apply the Wales
25
+ * living-wage floor for Welsh regions, then the HCAS supplement
26
+ * for England high-cost zones.
27
+ *
28
+ * The floor is applied here — not only when building the Welsh
29
+ * scale table (`getScalesForYear`) — because callers regionalise
30
+ * an *England* base (e.g. the band pages, which render England
31
+ * scales for every region) and must still floor Welsh low bands.
32
+ * `applyWalesFloor` is idempotent, so a base already read from
33
+ * the floored Welsh table is unaffected. Do NOT drop the floor
34
+ * here: the table alone does not cover the regionalise path, and
35
+ * removing it silently underpays Welsh low bands (see the
36
+ * grossSalary↔table equivalence test).
37
+ */
28
38
  export declare function grossSalary(base: number, region: AfcRegionId, hcas: HcasZones, year: TaxYear): number;
package/dist/hcas.js CHANGED
@@ -4,8 +4,8 @@
4
4
  *
5
5
  * Browser-safe — no node:fs dependency.
6
6
  */
7
- import { resolveRegion } from './regions.js';
8
7
  import { applyWalesFloor } from './scales.js';
8
+ import { resolveRegion } from './regions.js';
9
9
  export const HCAS_ZONE_IDS = {
10
10
  INNER_LONDON: 'inner-london',
11
11
  OUTER_LONDON: 'outer-london',
@@ -24,16 +24,29 @@ export function calculateHcasSupplement(baseSalary, zone) {
24
24
  const raw = baseSalary * (zone.rate / 100);
25
25
  return Math.round(Math.min(Math.max(raw, zone.min), zone.max));
26
26
  }
27
- /** Base salary + Wales floor + HCAS supplement. */
27
+ /**
28
+ * Produce a region's gross from a base salary: apply the Wales
29
+ * living-wage floor for Welsh regions, then the HCAS supplement
30
+ * for England high-cost zones.
31
+ *
32
+ * The floor is applied here — not only when building the Welsh
33
+ * scale table (`getScalesForYear`) — because callers regionalise
34
+ * an *England* base (e.g. the band pages, which render England
35
+ * scales for every region) and must still floor Welsh low bands.
36
+ * `applyWalesFloor` is idempotent, so a base already read from
37
+ * the floored Welsh table is unaffected. Do NOT drop the floor
38
+ * here: the table alone does not cover the regionalise path, and
39
+ * removing it silently underpays Welsh low bands (see the
40
+ * grossSalary↔table equivalence test).
41
+ */
28
42
  export function grossSalary(base, region, hcas, year) {
29
- const resolved = resolveRegion(region);
30
- let salary = base;
31
- if (resolved.isWales) {
32
- salary = applyWalesFloor(salary, year);
33
- }
34
- if (resolved.hcasProp) {
35
- salary += calculateHcasSupplement(salary, hcas[resolved.hcasProp]);
43
+ const { hcasProp, isWales } = resolveRegion(region);
44
+ const floored = isWales
45
+ ? applyWalesFloor(base, year)
46
+ : base;
47
+ if (!hcasProp) {
48
+ return floored;
36
49
  }
37
- return salary;
50
+ return floored + calculateHcasSupplement(floored, hcas[hcasProp]);
38
51
  }
39
52
  //# sourceMappingURL=hcas.js.map
package/dist/hcas.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"hcas.js","sourceRoot":"","sources":["../src/hcas.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAKH,OAAO,EAAC,aAAa,EAAC,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAC,eAAe,EAAC,MAAM,aAAa,CAAC;AAE5C,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,YAAY,EAAE,cAAc;IAC5B,YAAY,EAAE,cAAc;IAC5B,MAAM,EAAE,QAAQ;CACR,CAAC;AAOX,MAAM,YAAY,GAChB,MAAM,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AAE/B,mDAAmD;AACnD,MAAM,UAAU,YAAY,CAC1B,KAAa;IAEb,OACE,YACD,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;AACpB,CAAC;AAED;;;GAGG;AACH,MAAM,UAAU,uBAAuB,CACrC,UAAkB,EAClB,IAA8C;IAE9C,MAAM,GAAG,GAAG,UAAU,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAA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AAG,GAAG,UAAU,GAAG,CAAC,IAAI,CAAC,IAAI,GAAG,GAAG,CAAC,CAAC;IAC3C,OAAO,IAAI,CAAC,KAAK,CACf,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,CAAC,GAAG,CAAC,CAC5C,CAAC;AACJ,CAAC;AAED;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,WAAW,CACzB,IAAY,EACZ,MAAmB,EACnB,IAAe,EACf,IAAa;IAEb,MAAM,EAAC,QAAQ,EAAE,OAAO,EAAC,GAAG,aAAa,CAAC,MAAM,CAAC,CAAC;IAClD,MAAM,OAAO,GAAG,OAAO;QACrB,CAAC,CAAC,eAAe,CAAC,IAAI,EAAE,IAAI,CAAC;QAC7B,CAAC,CAAC,IAAI,CAAC;IACT,IAAI,CAAC,QAAQ,EAAE,CAAC;QACd,OAAO,OAAO,CAAC;IACjB,CAAC;IACD,OAAO,OAAO,GAAG,uBAAuB,CACtC,OAAO,EAAE,IAAI,CAAC,QAAQ,CAAC,CACxB,CAAC;AACJ,CAAC"}
package/dist/index.d.ts CHANGED
@@ -1,17 +1,24 @@
1
1
  export { AFC_BANDS, AFC_BAND_IDS, AFC_HOURS_PER_YEAR, AFC_TAX_YEARS, NLW_HOURLY, WALES_LW_FLOOR, annualiseHourly, applyWalesFloor, } from './scales.js';
2
2
  export type { AfcBandId, HcasZone, HcasZones, ScalePoint, } from './scales.js';
3
- export { getEmployerPensionRate, getPensionTiers, lookupPensionTier, pensionTierRate, } from './pension.js';
3
+ export { PensionTiers, getEmployerPensionRate, getPensionTiers, getPensionTiersVO, lookupPensionTier, pensionTierRate, } from './pension.js';
4
4
  export type { EmployerPensionRate, PensionTier, } from './pension.js';
5
+ export type { SalaryRange } from './values.js';
6
+ export { Post } from './post.js';
7
+ export type { PostIdentity } from './post.js';
8
+ export type { AfcRole, Role, RoleKind, VsmRole, } from './role.js';
9
+ export { afcResolver } from './resolver.js';
10
+ export type { AfcResolver, PayScaleResolver, } from './resolver.js';
11
+ export { PensionTiersUnavailable, ScaleUnavailable, } from './errors.js';
5
12
  export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, lookupErf1, lookupLrf1, maxLumpSum, npaDate, periodInYearsMonths, projectPension, retirementFactor, revalue, yearlyAccrual, } from './pension-projection.js';
6
13
  export type { CommutationResult, PensionEstimationInput, PensionProjectionInput, PensionProjectionResult, PensionStatementInput, ProjectionPoint, } from './pension-projection.js';
7
14
  export { HCAS_ZONE_IDS, calculateHcasSupplement, grossSalary, isHcasZoneId, } from './hcas.js';
8
15
  export type { HcasZoneId } from './hcas.js';
9
16
  export { getHcasPcts, getHcasZone, } from './hcas-pcts.js';
10
17
  export type { HcasPct } from './hcas-pcts.js';
11
- export { AFC_REGIONS, ZONE_LABELS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, isAfcRegionId, isNation, resolveRegion, } from './regions.js';
18
+ export { AFC_REGIONS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, isAfcRegionId, isNation, resolveRegion, } from './regions.js';
12
19
  export type { AfcRegionId, ResolvedRegion, } from './regions.js';
13
- export { AFC_BAND_INFO, AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
14
- export type { AfcBandInfo, AfcBandMeta, AfcScaleData, } from './bands.js';
20
+ export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
21
+ export type { AfcBandMeta, AfcScaleData, } from './bands.js';
15
22
  export { nhsTakeHome } from './take-home.js';
16
23
  export { fmtMoney, fmtPct, fmtSalary, formatGBP, formatGBPPrecise, formatPct, yearLabel, } from './format.js';
17
24
  export { TAX_REGIONS, TAX_YEARS, NATIONS, NATION_KEYS, TakeHomePay, GrossAnnual, PensionBasis, PensionPercent, StudentLoanPlan, nationToTaxRegion, getTaxYearConfig, hoursPerYear, } from '@casomoltd/paye-calc';
package/dist/index.js CHANGED
@@ -1,7 +1,11 @@
1
1
  // ── Scales ───────────────────────────────────────
2
2
  export { AFC_BANDS, AFC_BAND_IDS, AFC_HOURS_PER_YEAR, AFC_TAX_YEARS, NLW_HOURLY, WALES_LW_FLOOR, annualiseHourly, applyWalesFloor, } from './scales.js';
3
3
  // ── Pension ──────────────────────────────────────
4
- export { getEmployerPensionRate, getPensionTiers, lookupPensionTier, pensionTierRate, } from './pension.js';
4
+ export { PensionTiers, getEmployerPensionRate, getPensionTiers, getPensionTiersVO, lookupPensionTier, pensionTierRate, } from './pension.js';
5
+ // ── Post & resolvers ─────────────────────────────
6
+ export { Post } from './post.js';
7
+ export { afcResolver } from './resolver.js';
8
+ export { PensionTiersUnavailable, ScaleUnavailable, } from './errors.js';
5
9
  // ── Pension Projection ─────────────────────────────
6
10
  export { ACCRUAL_RATE, COMMUTATION_FACTOR, commute, lookupErf1, lookupLrf1, maxLumpSum, npaDate, periodInYearsMonths, projectPension, retirementFactor, revalue, yearlyAccrual, } from './pension-projection.js';
7
11
  // ── HCAS ─────────────────────────────────────────
@@ -9,9 +13,9 @@ export { HCAS_ZONE_IDS, calculateHcasSupplement, grossSalary, isHcasZoneId, } fr
9
13
  // ── HCAS PCTs ────────────────────────────────────
10
14
  export { getHcasPcts, getHcasZone, } from './hcas-pcts.js';
11
15
  // ── Regions ──────────────────────────────────────
12
- export { AFC_REGIONS, ZONE_LABELS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, isAfcRegionId, isNation, resolveRegion, } from './regions.js';
16
+ export { AFC_REGIONS, ZONE_TO_REGION, afcRegionToHcasZone, afcRegionToNation, isAfcRegionId, isNation, resolveRegion, } from './regions.js';
13
17
  // ── Bands ────────────────────────────────────────
14
- export { AFC_BAND_INFO, AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
18
+ export { AFC_CURRENT_YEAR, AFC_PREVIOUS_YEAR, getAfcScales, } from './bands.js';
15
19
  // ── Take-home ────────────────────────────────────
16
20
  export { nhsTakeHome } from './take-home.js';
17
21
  // ── Format ───────────────────────────────────────
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAQrB,oDAAoD;AACpD,OAAO,EACL,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAMtB,sDAAsD;AACtD,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,aAAa,GACd,MAAM,yBAAyB,CAAC;AAUjC,oDAAoD;AACpD,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AAMtB,oDAAoD;AACpD,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAOpB,oDAAoD;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,mDAAmD;AACnD,qDAAqD;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EACL,SAAS,EACT,YAAY,EACZ,kBAAkB,EAClB,aAAa,EACb,UAAU,EACV,cAAc,EACd,eAAe,EACf,eAAe,GAChB,MAAM,aAAa,CAAC;AAQrB,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAStB,oDAAoD;AACpD,OAAO,EAAC,IAAI,EAAC,MAAM,WAAW,CAAC;AAQ/B,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC;AAK1C,OAAO,EACL,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAErB,sDAAsD;AACtD,OAAO,EACL,YAAY,EACZ,kBAAkB,EAClB,OAAO,EACP,UAAU,EACV,UAAU,EACV,UAAU,EACV,OAAO,EACP,mBAAmB,EACnB,cAAc,EACd,gBAAgB,EAChB,OAAO,EACP,aAAa,GACd,MAAM,yBAAyB,CAAC;AAUjC,oDAAoD;AACpD,OAAO,EACL,aAAa,EACb,uBAAuB,EACvB,WAAW,EACX,YAAY,GACb,MAAM,WAAW,CAAC;AAGnB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,WAAW,GACZ,MAAM,gBAAgB,CAAC;AAGxB,oDAAoD;AACpD,OAAO,EACL,WAAW,EACX,cAAc,EACd,mBAAmB,EACnB,iBAAiB,EACjB,aAAa,EACb,QAAQ,EACR,aAAa,GACd,MAAM,cAAc,CAAC;AAMtB,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAMpB,oDAAoD;AACpD,OAAO,EAAC,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE3C,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,SAAS,GACV,MAAM,aAAa,CAAC;AAErB,oDAAoD;AACpD,mDAAmD;AACnD,qDAAqD;AACrD,OAAO,EACL,WAAW,EACX,SAAS,EACT,OAAO,EACP,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,cAAc,EACd,eAAe,EACf,iBAAiB,EACjB,gBAAgB,EAChB,YAAY,GACb,MAAM,sBAAsB,CAAC"}
package/dist/pension.d.ts CHANGED
@@ -1,15 +1,16 @@
1
1
  /**
2
- * NHS pension tier types, lookup functions, and
3
- * year-specific tier data.
2
+ * NHS pension contributions: member tier types, the
3
+ * `PensionTiers` lookup value object, year-specific tier
4
+ * data, and the per-nation employer contribution rates.
4
5
  *
5
- * Source: https://www.nhsbsa.nhs.uk/member-hub/member-hub-contribution-rates
6
+ * Sources:
7
+ * - Member tiers: https://www.nhsbsa.nhs.uk/member-hub/member-hub-contribution-rates
8
+ * - Employer rates: see `EmployerPensionRate.source` per nation below.
6
9
  */
7
10
  import type { Nation, TaxYear } from '@casomoltd/paye-calc';
8
- export interface PensionTier {
11
+ import type { SalaryRange } from './values.js';
12
+ export interface PensionTier extends SalaryRange {
9
13
  tier: number;
10
- min: number;
11
- /** Infinity for the top tier */
12
- max: number;
13
14
  rate: number;
14
15
  }
15
16
  /**
@@ -39,6 +40,26 @@ export interface EmployerPensionRate {
39
40
  }
40
41
  /** Employer pension contribution for a nation's NHS scheme. */
41
42
  export declare function getEmployerPensionRate(nation: Nation): EmployerPensionRate;
43
+ /**
44
+ * A member's pension contribution tier table, owning the
45
+ * salary → tier / rate lookup. Wrap a tax year's tiers
46
+ * (see {@link getPensionTiersVO}) and query it directly,
47
+ * rather than re-scanning the array at each call site.
48
+ */
49
+ export declare class PensionTiers {
50
+ private readonly tiers;
51
+ constructor(tiers: readonly PensionTier[]);
52
+ /** Contribution rate (%) for a salary; 0 if unbanded. */
53
+ rateFor(salary: number): number;
54
+ /**
55
+ * Matching tier (1-based) and band for a salary, or
56
+ * null when no band contains it.
57
+ */
58
+ tierFor(salary: number): {
59
+ tier: number;
60
+ band: PensionTier;
61
+ } | null;
62
+ }
42
63
  /**
43
64
  * Pension contribution rate (%) for a salary.
44
65
  */
@@ -62,3 +83,8 @@ export declare function lookupPensionTier(salary: number, tiers: PensionTier[]):
62
83
  * tier — do not treat these as UK-wide.
63
84
  */
64
85
  export declare function getPensionTiers(year: TaxYear): PensionTier[];
86
+ /**
87
+ * {@link PensionTiers} value object for a tax year — the
88
+ * same data as {@link getPensionTiers}, ready to query.
89
+ */
90
+ export declare function getPensionTiersVO(year: TaxYear): PensionTiers;