@casomoltd/nhs-pay 0.19.4 → 0.21.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.
Files changed (90) hide show
  1. package/README.md +95 -18
  2. package/dist/afc-scales.d.ts +14 -7
  3. package/dist/afc-scales.js +19 -19
  4. package/dist/afc-scales.js.map +1 -1
  5. package/dist/bands.d.ts +2 -2
  6. package/dist/commutation.d.ts +49 -5
  7. package/dist/commutation.js +124 -43
  8. package/dist/commutation.js.map +1 -1
  9. package/dist/dates.d.ts +2 -0
  10. package/dist/dates.js +4 -0
  11. package/dist/dates.js.map +1 -1
  12. package/dist/errors.d.ts +70 -12
  13. package/dist/errors.js +85 -19
  14. package/dist/errors.js.map +1 -1
  15. package/dist/factor-basis.d.ts +87 -0
  16. package/dist/factor-basis.js +99 -0
  17. package/dist/factor-basis.js.map +1 -0
  18. package/dist/gad/erf-1-401-2023-06-30.d.ts +47 -0
  19. package/dist/gad/erf-1-401-2023-06-30.js +73 -0
  20. package/dist/gad/erf-1-401-2023-06-30.js.map +1 -0
  21. package/dist/gad/erf-1-402-2023-06-30.d.ts +48 -0
  22. package/dist/gad/erf-1-402-2023-06-30.js +84 -0
  23. package/dist/gad/erf-1-402-2023-06-30.js.map +1 -0
  24. package/dist/gad/erf-1-407-2023-06-30.d.ts +47 -0
  25. package/dist/gad/erf-1-407-2023-06-30.js +73 -0
  26. package/dist/gad/erf-1-407-2023-06-30.js.map +1 -0
  27. package/dist/gad/erf-2023-06-30.d.ts +3 -0
  28. package/dist/gad/erf-2023-06-30.js +1 -0
  29. package/dist/gad/erf-2023-06-30.js.map +1 -1
  30. package/dist/gad/factor-table.d.ts +62 -31
  31. package/dist/gad/factor-table.js +67 -34
  32. package/dist/gad/factor-table.js.map +1 -1
  33. package/dist/gad/lrf-2-416-2023-06-30.d.ts +46 -0
  34. package/dist/gad/lrf-2-416-2023-06-30.js +72 -0
  35. package/dist/gad/lrf-2-416-2023-06-30.js.map +1 -0
  36. package/dist/gad/lrf-2023-06-30.d.ts +3 -0
  37. package/dist/gad/lrf-2023-06-30.js +1 -0
  38. package/dist/gad/lrf-2023-06-30.js.map +1 -1
  39. package/dist/gad/promotional-scale-2020.d.ts +37 -0
  40. package/dist/gad/promotional-scale-2020.js +38 -0
  41. package/dist/gad/promotional-scale-2020.js.map +1 -0
  42. package/dist/index.d.ts +17 -4
  43. package/dist/index.js +22 -13
  44. package/dist/index.js.map +1 -1
  45. package/dist/iso-date.d.ts +7 -0
  46. package/dist/iso-date.js +11 -0
  47. package/dist/iso-date.js.map +1 -1
  48. package/dist/member-benefits.d.ts +237 -0
  49. package/dist/member-benefits.js +440 -0
  50. package/dist/member-benefits.js.map +1 -0
  51. package/dist/pay-path.d.ts +70 -0
  52. package/dist/pay-path.js +155 -0
  53. package/dist/pay-path.js.map +1 -0
  54. package/dist/pension/curve.d.ts +74 -0
  55. package/dist/pension/curve.js +134 -0
  56. package/dist/pension/curve.js.map +1 -0
  57. package/dist/pension/history.js +3 -3
  58. package/dist/pension/history.js.map +1 -1
  59. package/dist/pension/ledger.d.ts +71 -31
  60. package/dist/pension/ledger.js +41 -6
  61. package/dist/pension/ledger.js.map +1 -1
  62. package/dist/pension/money.d.ts +23 -6
  63. package/dist/pension/money.js +23 -1
  64. package/dist/pension/money.js.map +1 -1
  65. package/dist/pension/uplift.d.ts +23 -0
  66. package/dist/pension/uplift.js +34 -1
  67. package/dist/pension/uplift.js.map +1 -1
  68. package/dist/pension-projection.d.ts +54 -52
  69. package/dist/pension-projection.js +65 -219
  70. package/dist/pension-projection.js.map +1 -1
  71. package/dist/scale-point.d.ts +11 -1
  72. package/dist/scales.d.ts +9 -9
  73. package/dist/scales.js +68 -67
  74. package/dist/scales.js.map +1 -1
  75. package/dist/sections/final-salary.d.ts +97 -0
  76. package/dist/sections/final-salary.js +99 -0
  77. package/dist/sections/final-salary.js.map +1 -0
  78. package/dist/sections/section-1995.d.ts +20 -0
  79. package/dist/sections/section-1995.js +52 -0
  80. package/dist/sections/section-1995.js.map +1 -0
  81. package/dist/sections/section-2008.d.ts +16 -0
  82. package/dist/sections/section-2008.js +44 -0
  83. package/dist/sections/section-2008.js.map +1 -0
  84. package/dist/sections/section-2015.d.ts +43 -0
  85. package/dist/sections/section-2015.js +57 -0
  86. package/dist/sections/section-2015.js.map +1 -0
  87. package/dist/values.d.ts +4 -5
  88. package/dist/values.js +4 -5
  89. package/dist/values.js.map +1 -1
  90. package/package.json +9 -5
@@ -0,0 +1,43 @@
1
+ import type { FactorOutcome } from '../factor-basis.js';
2
+ import type { MemberLedger, PayIn } from '../pension/ledger.js';
3
+ import type { Prices } from '../pension/prices.js';
4
+ import type { LedgerSeed } from '../pension/seed.js';
5
+ /**
6
+ * The factor for a pension determined under the 2015 Section's rules,
7
+ * drawn on `drawn`: 0-420 early and 0-421 late, by the period to or
8
+ * after the member's own pension age. The remedy window valued on the
9
+ * 2015 basis reads this too, because its benefits are determined under
10
+ * these rules although the legacy section pays them.
11
+ */
12
+ export declare function factor2015(dateOfBirth: Date, drawn: Date): FactorOutcome;
13
+ /** One career average walk in one ruler, and the pension it draws. */
14
+ interface CareerAverageRun {
15
+ readonly ledger: MemberLedger;
16
+ readonly seed: LedgerSeed;
17
+ /** At the drawing, before its factor. */
18
+ readonly revalued: number;
19
+ /** At the drawing, after its factor. */
20
+ readonly drawn: number;
21
+ }
22
+ /**
23
+ * Walk a career average pot in one ruler: the 2015 Section's own, or a
24
+ * remedy window valued on its rules. The same engine either way, on
25
+ * the same revaluation, to the same drawing — which is what makes the
26
+ * two elections comparable, because revaluation is linear in each
27
+ * year's accrual and the window's pot is exactly its own term.
28
+ *
29
+ * `through` is the last scheme year walked, so a caller drawing a
30
+ * curve past the drawing has rows to draw.
31
+ */
32
+ export declare function careerAverage({ seed, payIn, dateOfBirth, leaving, drawing, prices, through, }: {
33
+ readonly seed: LedgerSeed;
34
+ readonly payIn: PayIn;
35
+ readonly dateOfBirth: Date;
36
+ readonly leaving: Date;
37
+ readonly drawing: Date;
38
+ readonly prices: Prices;
39
+ readonly through: number;
40
+ }): CareerAverageRun & {
41
+ readonly factor: FactorOutcome;
42
+ };
43
+ export {};
@@ -0,0 +1,57 @@
1
+ /**
2
+ * The 2015 Section: career average at 1/54, a pension age that is the
3
+ * member's State Pension age with a floor of 65. Internal: reached only
4
+ * through the member's benefits.
5
+ */
6
+ import { npaDate } from '../dates.js';
7
+ import { FACTOR_SOURCES, readFactor } from '../factor-basis.js';
8
+ import { normalPensionAge } from '../npa.js';
9
+ import { atDrawing, buildLedger } from '../pension/ledger.js';
10
+ /**
11
+ * The factor for a pension determined under the 2015 Section's rules,
12
+ * drawn on `drawn`: 0-420 early and 0-421 late, by the period to or
13
+ * after the member's own pension age. The remedy window valued on the
14
+ * 2015 basis reads this too, because its benefits are determined under
15
+ * these rules although the legacy section pays them.
16
+ */
17
+ export function factor2015(dateOfBirth, drawn) {
18
+ const npa = normalPensionAge(dateOfBirth);
19
+ const at = npaDate(dateOfBirth, npa);
20
+ const basis = {
21
+ against: 'npa', npa, direction: drawn < at ? 'early' : 'late',
22
+ };
23
+ return readFactor(basis, dateOfBirth, drawn);
24
+ }
25
+ /**
26
+ * Walk a career average pot in one ruler: the 2015 Section's own, or a
27
+ * remedy window valued on its rules. The same engine either way, on
28
+ * the same revaluation, to the same drawing — which is what makes the
29
+ * two elections comparable, because revaluation is linear in each
30
+ * year's accrual and the window's pot is exactly its own term.
31
+ *
32
+ * `through` is the last scheme year walked, so a caller drawing a
33
+ * curve past the drawing has rows to draw.
34
+ */
35
+ export function careerAverage({ seed, payIn, dateOfBirth, leaving, drawing, prices, through, }) {
36
+ const factor = factor2015(dateOfBirth, drawing);
37
+ const ledger = buildLedger({
38
+ seed,
39
+ payIn,
40
+ exitDate: leaving,
41
+ retirementDate: drawing,
42
+ prices,
43
+ through,
44
+ drawingFor: () => ({
45
+ on: drawing,
46
+ factor: factor.factor,
47
+ table: factor.source === FACTOR_SOURCES.table
48
+ ? { kind: factor.tableKind, provenance: factor.provenance }
49
+ : null,
50
+ }),
51
+ });
52
+ return {
53
+ ledger, seed, factor,
54
+ ...atDrawing(ledger, drawing, factor.factor),
55
+ };
56
+ }
57
+ //# sourceMappingURL=section-2015.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"section-2015.js","sourceRoot":"","sources":["../../src/sections/section-2015.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,cAAc,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAE9D,OAAO,EAAC,gBAAgB,EAAC,MAAM,WAAW,CAAC;AAC3C,OAAO,EAAC,SAAS,EAAE,WAAW,EAAC,MAAM,sBAAsB,CAAC;AAK5D;;;;;;GAMG;AACH,MAAM,UAAU,UAAU,CACxB,WAAiB,EACjB,KAAW;IAEX,MAAM,GAAG,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAC;IAC1C,MAAM,EAAE,GAAG,OAAO,CAAC,WAAW,EAAE,GAAG,CAAC,CAAC;IACrC,MAAM,KAAK,GAAgB;QACzB,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,GAAG,EAAE,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM;KAC9D,CAAC;IACF,OAAO,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAYD;;;;;;;;;GASG;AACH,MAAM,UAAU,aAAa,CAAC,EAC5B,IAAI,EAAE,KAAK,EAAE,WAAW,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,GAS5D;IACC,MAAM,MAAM,GAAG,UAAU,CAAC,WAAW,EAAE,OAAO,CAAC,CAAC;IAChD,MAAM,MAAM,GAAG,WAAW,CAAC;QACzB,IAAI;QACJ,KAAK;QACL,QAAQ,EAAE,OAAO;QACjB,cAAc,EAAE,OAAO;QACvB,MAAM;QACN,OAAO;QACP,UAAU,EAAE,GAAG,EAAE,CAAC,CAAC;YACjB,EAAE,EAAE,OAAO;YACX,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,KAAK,EAAE,MAAM,CAAC,MAAM,KAAK,cAAc,CAAC,KAAK;gBAC3C,CAAC,CAAC,EAAC,IAAI,EAAE,MAAM,CAAC,SAAS,EAAE,UAAU,EAAE,MAAM,CAAC,UAAU,EAAC;gBACzD,CAAC,CAAC,IAAI;SACT,CAAC;KACH,CAAC,CAAC;IACH,OAAO;QACL,MAAM,EAAE,IAAI,EAAE,MAAM;QACpB,GAAG,SAAS,CAAC,MAAM,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,CAAC;KAC7C,CAAC;AACJ,CAAC"}
package/dist/values.d.ts CHANGED
@@ -3,11 +3,10 @@
3
3
  * and pension layers — a named home for paired fields
4
4
  * that would otherwise travel as loose primitives.
5
5
  *
6
- * Deferred: paye-calc will own a shared Range/MinMax value
7
- * object (Dev task 392d9af2-a639-81b2-ab03-c22c12007bde);
8
- * when it lands, re-point SalaryRange/PensionTier at it and
9
- * drop this local shape rather than keep a parallel interval
10
- * type.
6
+ * Deferred: this local shape stands until paye-calc owns a
7
+ * shared Range/MinMax value object. When it does, re-point
8
+ * SalaryRange and PensionTier at it rather than keep a
9
+ * parallel interval type.
11
10
  */
12
11
  /**
13
12
  * A closed salary interval. `max` may be Infinity for an
package/dist/values.js CHANGED
@@ -3,11 +3,10 @@
3
3
  * and pension layers — a named home for paired fields
4
4
  * that would otherwise travel as loose primitives.
5
5
  *
6
- * Deferred: paye-calc will own a shared Range/MinMax value
7
- * object (Dev task 392d9af2-a639-81b2-ab03-c22c12007bde);
8
- * when it lands, re-point SalaryRange/PensionTier at it and
9
- * drop this local shape rather than keep a parallel interval
10
- * type.
6
+ * Deferred: this local shape stands until paye-calc owns a
7
+ * shared Range/MinMax value object. When it does, re-point
8
+ * SalaryRange and PensionTier at it rather than keep a
9
+ * parallel interval type.
11
10
  */
12
11
  export {};
13
12
  //# sourceMappingURL=values.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"values.js","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG"}
1
+ {"version":3,"file":"values.js","sourceRoot":"","sources":["../src/values.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@casomoltd/nhs-pay",
3
- "version": "0.19.4",
4
- "description": "NHS Agenda for Change pay scales, pension tiers, regions, and take-home calculator",
3
+ "version": "0.21.0",
4
+ "description": "NHS pay scales and take-home pay, and a member's NHS pension across the 1995, 2008 and 2015 Sections",
5
5
  "homepage": "https://github.com/casomoltd/nhs-pay#readme",
6
6
  "bugs": "https://github.com/casomoltd/nhs-pay/issues",
7
7
  "type": "module",
@@ -29,9 +29,11 @@
29
29
  "jscpd": "jscpd ./src",
30
30
  "check:docs": "node scripts/check-api-docs.mjs",
31
31
  "lint:md": "remark --frail --quiet --no-stdout --rc-path node_modules/@casomoltd/tooling/bin/skills-lint.config.mjs docs CLAUDE.md README.md",
32
- "check": "check-gates && npm run lint && npm run typecheck && npm run knip && npm run jscpd && npm run check:docs && npm run check:archive && npm run test && npm run build",
32
+ "check": "check-gates && npm run check:private-refs && npm run check:personal-data && npm run lint && npm run typecheck && npm run knip && npm run jscpd && npm run check:docs && npm run check:archive && npm run test && npm run build",
33
33
  "prepare": "husky",
34
- "check:archive": "node scripts/check-source-archive.mjs"
34
+ "check:archive": "node scripts/check-source-archive.mjs",
35
+ "check:personal-data": "check-personal-data",
36
+ "check:private-refs": "check-private-refs"
35
37
  },
36
38
  "casomo": {
37
39
  "gates": {
@@ -49,6 +51,8 @@
49
51
  "agenda-for-change",
50
52
  "pay-scales",
51
53
  "pension",
54
+ "nhs-pension-scheme",
55
+ "mccloud",
52
56
  "take-home",
53
57
  "hcas"
54
58
  ],
@@ -67,7 +71,7 @@
67
71
  },
68
72
  "devDependencies": {
69
73
  "@casomoltd/paye-calc": "^0.7.0",
70
- "@casomoltd/tooling": "^0.26.0",
74
+ "@casomoltd/tooling": "^0.29.0",
71
75
  "@commitlint/cli": "^20.0.0",
72
76
  "@js-temporal/polyfill": "^0.5.1",
73
77
  "@types/node": "^25.5.0",