@casomoltd/nhs-pay 0.21.1 → 0.22.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 (83) hide show
  1. package/README.md +9 -4
  2. package/dist/additional-pension.d.ts +104 -0
  3. package/dist/additional-pension.js +163 -0
  4. package/dist/additional-pension.js.map +1 -0
  5. package/dist/dates.d.ts +21 -8
  6. package/dist/dates.js +46 -18
  7. package/dist/dates.js.map +1 -1
  8. package/dist/errors.d.ts +26 -0
  9. package/dist/errors.js +29 -0
  10. package/dist/errors.js.map +1 -1
  11. package/dist/factor-basis.d.ts +75 -22
  12. package/dist/factor-basis.js +95 -24
  13. package/dist/factor-basis.js.map +1 -1
  14. package/dist/gad/additional-pension-0-703-2023-10-03.d.ts +180 -0
  15. package/dist/gad/additional-pension-0-703-2023-10-03.js +87 -0
  16. package/dist/gad/additional-pension-0-703-2023-10-03.js.map +1 -0
  17. package/dist/gad/additional-pension-0-712-2023-10-03.d.ts +35 -0
  18. package/dist/gad/additional-pension-0-712-2023-10-03.js +170 -0
  19. package/dist/gad/additional-pension-0-712-2023-10-03.js.map +1 -0
  20. package/dist/gad/additional-pension-0-713-2023-10-03.d.ts +35 -0
  21. package/dist/gad/additional-pension-0-713-2023-10-03.js +173 -0
  22. package/dist/gad/additional-pension-0-713-2023-10-03.js.map +1 -0
  23. package/dist/gad/additional-pension-0-714-2023-10-03.d.ts +35 -0
  24. package/dist/gad/additional-pension-0-714-2023-10-03.js +176 -0
  25. package/dist/gad/additional-pension-0-714-2023-10-03.js.map +1 -0
  26. package/dist/gad/additional-pension-0-715-2023-10-03.d.ts +35 -0
  27. package/dist/gad/additional-pension-0-715-2023-10-03.js +179 -0
  28. package/dist/gad/additional-pension-0-715-2023-10-03.js.map +1 -0
  29. package/dist/gad/additional-pension-0-716-2023-10-03.d.ts +35 -0
  30. package/dist/gad/additional-pension-0-716-2023-10-03.js +170 -0
  31. package/dist/gad/additional-pension-0-716-2023-10-03.js.map +1 -0
  32. package/dist/gad/additional-pension-0-717-2023-10-03.d.ts +35 -0
  33. package/dist/gad/additional-pension-0-717-2023-10-03.js +173 -0
  34. package/dist/gad/additional-pension-0-717-2023-10-03.js.map +1 -0
  35. package/dist/gad/additional-pension-0-718-2023-10-03.d.ts +35 -0
  36. package/dist/gad/additional-pension-0-718-2023-10-03.js +176 -0
  37. package/dist/gad/additional-pension-0-718-2023-10-03.js.map +1 -0
  38. package/dist/gad/additional-pension-0-719-2023-10-03.d.ts +35 -0
  39. package/dist/gad/additional-pension-0-719-2023-10-03.js +179 -0
  40. package/dist/gad/additional-pension-0-719-2023-10-03.js.map +1 -0
  41. package/dist/gad/additional-pension-table.d.ts +51 -0
  42. package/dist/gad/additional-pension-table.js +23 -0
  43. package/dist/gad/additional-pension-table.js.map +1 -0
  44. package/dist/gad/factor-table.d.ts +7 -3
  45. package/dist/gad/factor-table.js.map +1 -1
  46. package/dist/gad/lrf-0-422-2023-06-30.d.ts +45 -0
  47. package/dist/gad/lrf-0-422-2023-06-30.js +70 -0
  48. package/dist/gad/lrf-0-422-2023-06-30.js.map +1 -0
  49. package/dist/gad/lrf-2023-06-30.d.ts +3 -3
  50. package/dist/gad/lrf-2023-06-30.js +3 -3
  51. package/dist/index.d.ts +12 -8
  52. package/dist/index.js +7 -4
  53. package/dist/index.js.map +1 -1
  54. package/dist/member-benefits.d.ts +16 -1
  55. package/dist/member-benefits.js +19 -3
  56. package/dist/member-benefits.js.map +1 -1
  57. package/dist/pension/history.d.ts +0 -8
  58. package/dist/pension/history.js +10 -4
  59. package/dist/pension/history.js.map +1 -1
  60. package/dist/pension/ledger.d.ts +59 -32
  61. package/dist/pension/ledger.js +129 -100
  62. package/dist/pension/ledger.js.map +1 -1
  63. package/dist/pension/prices.d.ts +75 -58
  64. package/dist/pension/prices.js +111 -42
  65. package/dist/pension/prices.js.map +1 -1
  66. package/dist/pension/uplift.d.ts +32 -24
  67. package/dist/pension/uplift.js +66 -18
  68. package/dist/pension/uplift.js.map +1 -1
  69. package/dist/pension-projection.d.ts +3 -3
  70. package/dist/pension-projection.js +8 -13
  71. package/dist/pension-projection.js.map +1 -1
  72. package/dist/sections/section-1995.d.ts +2 -2
  73. package/dist/sections/section-1995.js +3 -3
  74. package/dist/sections/section-1995.js.map +1 -1
  75. package/dist/sections/section-2008.js +5 -3
  76. package/dist/sections/section-2008.js.map +1 -1
  77. package/dist/sections/section-2015.d.ts +8 -7
  78. package/dist/sections/section-2015.js +14 -10
  79. package/dist/sections/section-2015.js.map +1 -1
  80. package/dist/sources.d.ts +3 -0
  81. package/dist/sources.js +14 -0
  82. package/dist/sources.js.map +1 -1
  83. package/package.json +1 -1
@@ -1,50 +1,46 @@
1
1
  /**
2
- * The caller's CPI assumption, and the one conversion that
3
- * needs it.
2
+ * A run's price series: the CPI each scheme year revalues at, and
3
+ * the conversion of the caller's pay into a given year's money.
4
4
  *
5
- * Two jobs. The assumption itself, read as a `CpiEntry` for any
6
- * scheme year, and expressing the caller's pay in the money of
7
- * a given scheme year, which is that same rate applied.
5
+ * ── Today's money is a run, not a deflation ─────────
8
6
  *
9
- * ── There is no deflator here any more ──────────────
7
+ * Today's money is the SAME projection run with the inflation
8
+ * assumption set to zero, so the pension revalues at 1.5% a year
9
+ * while a member is paying in and not at all once they are
10
+ * deferred. The model runs twice and pairs the two readings;
11
+ * neither one is derived from the other.
10
12
  *
11
- * Today's money is NOT this projection divided by inflation. It
12
- * is the SAME projection run with the inflation assumption set
13
- * to zero, so the pension revalues at 1.5% a year while a
14
- * member is paying in and not at all once they are deferred.
15
- * `pension-projection.ts` runs the model twice and pairs the
16
- * two readings; neither one is derived from the other.
17
- *
18
- * That is a real difference, not a restatement of the same
19
- * arithmetic. Dividing a CPI + 1.5 projection by CPI gives
13
+ * Dividing a CPI + 1.5 projection by CPI would give
20
14
  * 1.5 / (1 + cpi) — 1.47% at a 2% assumption, because the 1.5
21
- * points are added before the growth and then eaten into by
22
- * the same year's inflation. Running at zero gives 1.5% flat.
23
- * The second is what the scheme's own rule reduces to when
24
- * inflation is ignored, and it is what the tool means by
25
- * today's money.
26
- *
27
- * Deleting the deflator deleted a great deal with it: an anchor
28
- * date, a face-value window, and the rule that a stated balance
29
- * must not be restated. At a zero assumption there is nothing
30
- * to restate, so that property now holds by construction rather
31
- * than by a clamp — which is why three separate attempts at
32
- * placing the anchor all failed and this does not.
15
+ * points are added before the growth and then eaten into by the
16
+ * same year's inflation. Running at zero gives 1.5% flat, which
17
+ * is what the scheme's own rule reduces to when inflation is
18
+ * ignored. It also leaves a stated balance exactly as stated, by
19
+ * construction: at zero there is nothing to restate it by.
33
20
  *
34
21
  * An uplift rule reads whatever entry it is handed and carries
35
22
  * it through to its receipt; it never branches on whether the
36
- * figure was measured or assumed. A PROJECTION is always handed
37
- * `assumedFor`: an Order is a nominal rate, and the
38
- * today's-money run is this same model at an assumption of
39
- * zero, so an Order applied inside it puts a whole year of CPI
40
- * into a reading defined to contain none. So there is one rate
41
- * here and it is the assumption.
23
+ * figure was measured or assumed. WHICH entry is this module's
24
+ * choice, made once per series:
42
25
  *
43
- * Reading the published record itself is a different question,
44
- * and `revaluation.ts` answers it: `revaluationFor`, beside the
45
- * table it reads.
26
+ * - `createPrices` hands out the assumption for every year. The
27
+ * today's-money run is always this series at zero: an Order is
28
+ * a nominal rate, and one applied inside that run puts a whole
29
+ * year of CPI into a reading defined to contain none
30
+ * (https://github.com/casomoltd/nhs-pay/issues/13).
31
+ * - `createPublishedPrices` is the CASH run as a member's Annual
32
+ * Benefit Statement prints it. A year a Revaluation Order
33
+ * covers takes that Order, SI and all, and a past year's pay
34
+ * is carried into its own year's cash by the same Orders' CPI.
35
+ * Both halves are nominal, so the Order applies to a balance
36
+ * in the money it was written for. Beyond the published record
37
+ * it is the assumption, as above.
46
38
  */
47
- import { appliedOnFor } from '../revaluation.js';
39
+ import { invariant } from '../errors.js';
40
+ import { appliedOnFor, IN_SERVICE_REVALUATION, revaluationFor, } from '../revaluation.js';
41
+ /** The CPI a today's-money run assumes, as a decimal: none, so every
42
+ * figure is read in the money of the run date. */
43
+ export const TODAYS_MONEY_CPI = 0;
48
44
  /**
49
45
  * How much more a pound of `asAt` money is than a pound of
50
46
  * `from` money, under the caller's assumption.
@@ -53,10 +49,9 @@ import { appliedOnFor } from '../revaluation.js';
53
49
  * a scheme year and the pot moves once a year, so a ruler that
54
50
  * compounded smoothly would drift against both inside every
55
51
  * year. The steps are the days the Orders actually land, read
56
- * from the table: 1 April through 2022, 6 April after. Reading
57
- * them off a hardcoded 6 April put a five-day window either
58
- * side of every pre-2023 April and counted a step that had not
59
- * happened.
52
+ * from the table: 1 April through 2022, 6 April after, so a
53
+ * date between the two Aprils of any year is read on the right
54
+ * side of that year's step.
60
55
  *
61
56
  * Symmetric, so a year behind the run date is divided by
62
57
  * exactly what a year ahead is multiplied by, and a caller
@@ -104,7 +99,7 @@ export function createPrices(assumedCpi, asOf) {
104
99
  it reaches a consumer through `row.uplift.from` — one
105
100
  level below the freeze on the row itself, and rewritable
106
101
  there unless it defends itself. */
107
- assumedFor: (schemeYearEnd) => Object.freeze({
102
+ cpiFor: (schemeYearEnd) => Object.freeze({
108
103
  schemeYearEnd, cpi: assumedPct, si: null,
109
104
  }),
110
105
  asOf,
@@ -114,4 +109,78 @@ export function createPrices(assumedCpi, asOf) {
114
109
  payAt: (todaysMoney, asAt) => valueAt(todaysMoney, asOf, asAt),
115
110
  };
116
111
  }
112
+ /**
113
+ * The price series of a cash run read the way an Annual Benefit
114
+ * Statement is: the published record wherever it exists, the
115
+ * caller's assumption beyond it.
116
+ *
117
+ * ONE per-year answer, `publishedCpiFor`, serves both halves, so
118
+ * the pot and the pay can never disagree about which years are
119
+ * published:
120
+ *
121
+ * - a year's uplift is its Order's CPI, SI on the entry;
122
+ * - pay is carried between the run date and any other date, in
123
+ * either direction, by the CPI of each Order landing between
124
+ * them, on the days the pot moves. The promotional curve that
125
+ * built the pay path measures growth ABOVE general pay, so the
126
+ * general half is still missing, and prices stand in for it.
127
+ * That reads pay as having kept pace with prices, which the pay
128
+ * awards of these years did not exactly do: it is the one
129
+ * estimate here, and the Orders themselves are the record.
130
+ *
131
+ * `valueAt` stays the assumption's: it carries an externally
132
+ * fixed amount between dates, which is not pay.
133
+ */
134
+ export function createPublishedPrices(assumedCpi, asOf) {
135
+ const assumed = createPrices(assumedCpi, asOf);
136
+ const cpiFor = (schemeYearEnd) => publishedCpiFor(schemeYearEnd, assumedCpi * 100);
137
+ return {
138
+ ...assumed,
139
+ cpiFor,
140
+ payAt: (todaysMoney, asAt) => todaysMoney * pricesBetween(asOf, asAt, cpiFor),
141
+ };
142
+ }
143
+ /**
144
+ * The CPI a scheme year revalues at when the published record is
145
+ * read: its Order where one was made, the assumption after the
146
+ * record ends. A year before the scheme's first Order, or a gap
147
+ * inside the record, has no honest answer and is refused.
148
+ */
149
+ function publishedCpiFor(schemeYearEnd, assumedPct) {
150
+ const order = revaluationFor(schemeYearEnd);
151
+ if (order !== null) {
152
+ return Object.freeze({
153
+ schemeYearEnd, cpi: order.septemberCpiPct, si: order.si,
154
+ });
155
+ }
156
+ const first = IN_SERVICE_REVALUATION[0];
157
+ const last = IN_SERVICE_REVALUATION.at(-1);
158
+ invariant(first !== undefined && last !== undefined, 'the Revaluation Order table is empty');
159
+ if (schemeYearEnd < first.yearEnd) {
160
+ throw new Error(`No Revaluation Order for ${schemeYearEnd}: `
161
+ + `the scheme's first is ${first.si}, for ${first.yearEnd}`);
162
+ }
163
+ if (schemeYearEnd <= last.yearEnd) {
164
+ throw new Error(`No Revaluation Order recorded for `
165
+ + `${schemeYearEnd}, inside the published record`);
166
+ }
167
+ return Object.freeze({ schemeYearEnd, cpi: assumedPct, si: null });
168
+ }
169
+ /**
170
+ * How much more a pound of `to` money is than a pound of `from`
171
+ * money, stepping on the days the pot moves by each step's own
172
+ * CPI. Symmetric, like `inflationFactor`.
173
+ */
174
+ function pricesBetween(from, to, cpiFor) {
175
+ const ahead = to >= from;
176
+ const [lo, hi] = ahead ? [from, to] : [to, from];
177
+ let factor = 1;
178
+ for (let year = lo.getFullYear(); year <= hi.getFullYear(); year++) {
179
+ const applied = appliedOnFor(year);
180
+ if (applied > lo && applied <= hi) {
181
+ factor *= 1 + cpiFor(year).cpi / 100;
182
+ }
183
+ }
184
+ return ahead ? factor : 1 / factor;
185
+ }
117
186
  //# sourceMappingURL=prices.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"prices.js","sourceRoot":"","sources":["../../src/pension/prices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AAEH,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AA4E/C;;;;;;;;;;;;;;;;GAgBG;AACH,MAAM,UAAU,eAAe,CAC7B,IAAU,EACV,IAAU,EACV,UAAkB;IAElB,MAAM,KAAK,GAAG,IAAI,IAAI,IAAI,CAAC;IAC3B,MAAM,KAAK,GAAG,KAAK;QACjB,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC;QAC3B,CAAC,CAAC,aAAa,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAC9B,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,UAAU,EAAE,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC;AAC1D,CAAC;AAED;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,IAAU,EAAE,EAAQ;IACzC,IAAI,KAAK,GAAG,CAAC,CAAC;IACd,KACE,IAAI,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,EAC7B,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EACxB,IAAI,EAAE,EACN,CAAC;QACD,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,OAAO,GAAG,IAAI,IAAI,OAAO,IAAI,EAAE;YAAE,KAAK,IAAI,CAAC,CAAC;IAClD,CAAC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ACvD,CAAC;IACD,OAAO,MAAM,CAAC,MAAM,CAAC,EAAC,aAAa,EAAE,GAAG,EAAE,UAAU,EAAE,EAAE,EAAE,IAAI,EAAC,CAAC,CAAC;AACnE,CAAC;AAED;;;;GAIG;AACH,SAAS,aAAa,CAAC,IAAU,EAAE,EAAQ,EAAE,MAAiB;IAC5D,MAAM,KAAK,GAAG,EAAE,IAAI,IAAI,CAAC;IACzB,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,EAAE,IAAI,CAAC,CAAC;IACjD,IAAI,MAAM,GAAG,CAAC,CAAC;IACf,KAAK,IAAI,IAAI,GAAG,EAAE,CAAC,WAAW,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,IAAI,EAAE,EAAE,CAAC;QACnE,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;QACnC,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,IAAI,EAAE,EAAE,CAAC;YAClC,MAAM,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,CAAC,GAAG,GAAG,GAAG,CAAC;QACvC,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AACrC,CAAC"}
@@ -38,13 +38,6 @@ import type { LedgerSeed } from './seed.js';
38
38
  * permits: phase is computed per year from the member's dates.
39
39
  */
40
40
  export type MemberPhase = 'active' | 'deferred' | 'inPayment';
41
- /** Active until the member leaves, deferred until they draw, in
42
- * payment after. Derived from dates; never entered.
43
- *
44
- * Lives beside the rule it selects, because the rule is a
45
- * function of phase alone and this is the only way a phase is
46
- * ever obtained. */
47
- export declare function phaseAt(year: number, exitYear: number, retireYear: number): MemberPhase;
48
41
  /** One uplift, as applied to a member's record. */
49
42
  export interface AppliedUplift {
50
43
  /** The date the POT moves — 1 April through 2022, 6 April from
@@ -53,7 +46,7 @@ export interface AppliedUplift {
53
46
  readonly appliedOn: Date;
54
47
  /** Percentage points applied to the whole balance. Negative
55
48
  * is legal. One rate for the year, never a blend: the phase
56
- * on the day it lands settles it (see `upliftOpening`). */
49
+ * on the day it lands settles it (see `openingUpliftFor`). */
57
50
  readonly percent: number;
58
51
  /** The CPI row this rate derives from. Provenance is READ from
59
52
  * here and stored nowhere else, so a figure and its source
@@ -71,6 +64,13 @@ export interface AppliedUplift {
71
64
  * walk's first step, not about this rule, and putting it here
72
65
  * would make every caller narrow a value it always gets. */
73
66
  export type UpliftSource = (schemeYearEnd: number) => AppliedUplift;
67
+ /** Active until the member leaves, deferred until they draw, in
68
+ * payment after. Derived from dates; never entered.
69
+ *
70
+ * Lives beside the rule it selects, because the rule is a
71
+ * function of phase alone and this is the only way a phase is
72
+ * ever obtained. */
73
+ export declare function phaseAt(year: number, exitYear: number, retireYear: number): MemberPhase;
74
74
  /** CPI + 1.5 points. A negative CPI is carried through, not
75
75
  * floored: September 2015's −0.1 gave a 1.4% uplift, not 1.5%. */
76
76
  export declare function activeRatePct(cpi: number): number;
@@ -100,9 +100,10 @@ export declare function deferredRatePct(cpi: number): number;
100
100
  * are the same arithmetic here, and differ only in the
101
101
  * provenance carried out beside the rate.
102
102
  *
103
- * Nothing in a projection calls this directly; both the walk and
104
- * the seed go through `openingUpliftFor`, which fixes the series
105
- * once so they cannot choose differently.
103
+ * The walk's opening rates and the seed both go through
104
+ * `openingUpliftFor`, which fixes the series once so they cannot
105
+ * choose differently. The ledger's leaver adjustment reads the
106
+ * in-service rate from here directly, from the same series.
106
107
  *
107
108
  * That the published rates ARE `CPI + 1.5` is not asserted here,
108
109
  * because nothing here reads them: the rule is checked against
@@ -135,19 +136,26 @@ export declare function upliftsFor(phase: MemberPhase, cpiFor: CpiSource): Uplif
135
136
  *
136
137
  * ── One rate after the seed ─────────────────────────
137
138
  *
138
- * `assumedFor` is read for every year, whether or not an Order
139
- * covers it. An Order is a NOMINAL rate, and today's money is
140
- * this same model at an assumption of ZERO, so one applied
141
- * inside that run puts a whole year of CPI into a reading
142
- * defined to hold none — 8.2 points for a member holding a 2024
143
- * statement, 3.2 for a 2025 one, so the size of it is a property
144
- * of the paperwork rather than of the member. Nor is the
145
- * exactness collectable: the year-end figure an Order produces
146
- * here also carries this library's guess at that year's pay, so
147
- * there is nothing to check it against until a statement the
148
- * member has not received.
149
- *
150
- * Decided at https://github.com/casomoltd/nhs-pay/issues/13
139
+ * `cpiFor` is read for every year, and the SERIES decides what
140
+ * it holds. A today's-money series holds the assumption
141
+ * throughout: an Order is a NOMINAL rate, and one applied inside
142
+ * a run at zero puts a whole year of CPI into a reading defined
143
+ * to hold none — 8.2 points for a member holding a 2024
144
+ * statement, 3.2 for a 2025 one. A published-history series
145
+ * (`createPublishedPrices`) holds the Order for every year one
146
+ * covers, because its pay is carried into the same years' cash
147
+ * and the Order meets a balance in the money it was made for.
148
+ *
149
+ * Why today's money never takes an Order:
150
+ * https://github.com/casomoltd/nhs-pay/issues/13
151
+ *
152
+ * ── The first increase after leaving ────────────────
153
+ *
154
+ * The year the member leaves in has already taken the in-service
155
+ * rate for the months served, as the ledger's leaver adjustment.
156
+ * So the uplift that opens the year after is a share of the
157
+ * deferred or in-payment rate: the months the pension has run by
158
+ * that April, over twelve. See `firstIncreaseShare`.
151
159
  */
152
160
  export declare function openingUpliftFor(seedSchemeYearEnd: number, exitDate: Date, retirementDate: Date, prices: Prices): AppliedUplift;
153
161
  /**
@@ -22,7 +22,9 @@
22
22
  * make the test of the +1.5 rule agree with itself.
23
23
  */
24
24
  import { ACTIVE_REVAL_BONUS_PCT, appliedOnFor, } from '../revaluation.js';
25
- import { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, seedFromStatement, } from './seed.js';
25
+ import { invariant } from '../errors.js';
26
+ import { dayAfter, monthsCountingPart, MONTHS_PER_YEAR } from '../dates.js';
27
+ import { schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, seedFromStatement, } from './seed.js';
26
28
  /** Active until the member leaves, deferred until they draw, in
27
29
  * payment after. Derived from dates; never entered.
28
30
  *
@@ -67,9 +69,10 @@ export function deferredRatePct(cpi) {
67
69
  * are the same arithmetic here, and differ only in the
68
70
  * provenance carried out beside the rate.
69
71
  *
70
- * Nothing in a projection calls this directly; both the walk and
71
- * the seed go through `openingUpliftFor`, which fixes the series
72
- * once so they cannot choose differently.
72
+ * The walk's opening rates and the seed both go through
73
+ * `openingUpliftFor`, which fixes the series once so they cannot
74
+ * choose differently. The ledger's leaver adjustment reads the
75
+ * in-service rate from here directly, from the same series.
73
76
  *
74
77
  * That the published rates ARE `CPI + 1.5` is not asserted here,
75
78
  * because nothing here reads them: the rule is checked against
@@ -114,23 +117,34 @@ export function upliftsFor(phase, cpiFor) {
114
117
  *
115
118
  * ── One rate after the seed ─────────────────────────
116
119
  *
117
- * `assumedFor` is read for every year, whether or not an Order
118
- * covers it. An Order is a NOMINAL rate, and today's money is
119
- * this same model at an assumption of ZERO, so one applied
120
- * inside that run puts a whole year of CPI into a reading
121
- * defined to hold none — 8.2 points for a member holding a 2024
122
- * statement, 3.2 for a 2025 one, so the size of it is a property
123
- * of the paperwork rather than of the member. Nor is the
124
- * exactness collectable: the year-end figure an Order produces
125
- * here also carries this library's guess at that year's pay, so
126
- * there is nothing to check it against until a statement the
127
- * member has not received.
128
- *
129
- * Decided at https://github.com/casomoltd/nhs-pay/issues/13
120
+ * `cpiFor` is read for every year, and the SERIES decides what
121
+ * it holds. A today's-money series holds the assumption
122
+ * throughout: an Order is a NOMINAL rate, and one applied inside
123
+ * a run at zero puts a whole year of CPI into a reading defined
124
+ * to hold none — 8.2 points for a member holding a 2024
125
+ * statement, 3.2 for a 2025 one. A published-history series
126
+ * (`createPublishedPrices`) holds the Order for every year one
127
+ * covers, because its pay is carried into the same years' cash
128
+ * and the Order meets a balance in the money it was made for.
129
+ *
130
+ * Why today's money never takes an Order:
131
+ * https://github.com/casomoltd/nhs-pay/issues/13
132
+ *
133
+ * ── The first increase after leaving ────────────────
134
+ *
135
+ * The year the member leaves in has already taken the in-service
136
+ * rate for the months served, as the ledger's leaver adjustment.
137
+ * So the uplift that opens the year after is a share of the
138
+ * deferred or in-payment rate: the months the pension has run by
139
+ * that April, over twelve. See `firstIncreaseShare`.
130
140
  */
131
141
  export function openingUpliftFor(seedSchemeYearEnd, exitDate, retirementDate, prices) {
132
142
  const phase = phaseAt(seedSchemeYearEnd + 1, schemeYearEndFor(exitDate), schemeYearEndFor(retirementDate));
133
- return upliftsFor(phase, prices.assumedFor)(seedSchemeYearEnd);
143
+ const uplift = upliftsFor(phase, prices.cpiFor)(seedSchemeYearEnd);
144
+ const firstAfterLeaving = seedSchemeYearEnd === schemeYearEndFor(exitDate);
145
+ if (!firstAfterLeaving)
146
+ return uplift;
147
+ return { ...uplift, percent: uplift.percent * firstIncreaseShare(exitDate, uplift.appliedOn) };
134
148
  }
135
149
  /**
136
150
  * A member's stated balance, on whatever date it is stated —
@@ -155,6 +169,20 @@ export function openingUpliftFor(seedSchemeYearEnd, exitDate, retirementDate, pr
155
169
  */
156
170
  export function seedFromBalanceAt(balance, asOf, exitDate, retirementDate, prices) {
157
171
  const lastYearEnd = schemeYearClosedBy(asOf);
172
+ /* A figure read after leaving, before the leaving year has closed,
173
+ already holds that year's part slice and its leaver adjustment,
174
+ and the walk would re-walk that year and add both again. Refused
175
+ rather than guessed at. With no month served there is neither,
176
+ and once the year has closed the seed is its closing and the walk
177
+ starts after it: both round-trip. */
178
+ const exitYear = schemeYearEndFor(exitDate);
179
+ const monthsServedBeforeLeaving = monthsCountingPart(schemeYearStartDate(exitYear), dayAfter(exitDate));
180
+ const leavingYearStillOpen = lastYearEnd < exitYear;
181
+ const readAfterServingPartOfLeavingYear = asOf > exitDate
182
+ && leavingYearStillOpen
183
+ && monthsServedBeforeLeaving > 0;
184
+ invariant(!readAfterServingPartOfLeavingYear, `a balance stated on ${asOf.toDateString()}, after leaving on `
185
+ + `${exitDate.toDateString()} in the same scheme year`);
158
186
  /* The uplift undone here is the one OPENING year
159
187
  `lastYearEnd + 1`, and it is the very object `buildLedger`
160
188
  re-applies to that year: inverting the walk exactly is this
@@ -165,4 +193,24 @@ export function seedFromBalanceAt(balance, asOf, exitDate, retirementDate, price
165
193
  const already = applied.appliedOn <= asOf;
166
194
  return seedFromStatement(already ? balance / (1 + applied.percent / 100) : balance, schemeYearEndDate(lastYearEnd));
167
195
  }
196
+ /**
197
+ * A pension's first increase after it begins is proportionate to the
198
+ * months it has run: HM Treasury's 2026 Pensions Increase tables
199
+ * give a preserved pension begun 22 February to 21 March 2026 one
200
+ * twelfth of the year's 3.8%, and one begun after that nothing on 6
201
+ * April 2026. Counted from the day after the last day of service to
202
+ * the increase, a part month of 16 days or more counting as one. The
203
+ * leaver index adjustment has already given the months served before
204
+ * leaving, so this is what stops a 31 March leaver taking that
205
+ * year's CPI twice.
206
+ *
207
+ * Source: "HM Treasury — 2026 pensions increase multiplier tables,
208
+ * Annexes B and C" — see docs/source-archive.md.
209
+ */
210
+ function firstIncreaseShare(exitDate, appliedOn) {
211
+ const months = monthsCountingPart(dayAfter(exitDate), appliedOn);
212
+ invariant(months <= MONTHS_PER_YEAR, `a first increase ${months} months after leaving on `
213
+ + exitDate.toDateString());
214
+ return months / MONTHS_PER_YEAR;
215
+ }
168
216
  //# sourceMappingURL=uplift.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"uplift.js","sourceRoot":"","sources":["../../src/pension/uplift.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,OAAO,EACL,sBAAsB,EACtB,YAAY,GACb,MAAM,mBAAmB,CAAC;AAE3B,OAAO,EACL,kBAAkB,EAClB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,WAAW,CAAC;AAmBnB;;;;;oBAKoB;AACpB,MAAM,UAAU,OAAO,CACrB,I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C,CAAC;IACjE,SAAS,CACP,MAAM,IAAI,eAAe,EACzB,oBAAoB,MAAM,2BAA2B;UACjD,QAAQ,CAAC,YAAY,EAAE,CAC5B,CAAC;IACF,OAAO,MAAM,GAAG,eAAe,CAAC;AAClC,CAAC"}
@@ -221,9 +221,9 @@ export interface PensionEstimationInput {
221
221
  export type PensionProjectionInput = PensionStatementInput | PensionEstimationInput;
222
222
  /** Full projection result */
223
223
  export interface PensionProjectionResult {
224
- /** Accrued pension at the close of the scheme year the exit
225
- * falls in, dated at that close — see docs/how-it-works.md,
226
- * "An exit date names a SCHEME YEAR, not a day". */
224
+ /** Accrued pension on the last day of service, the leaver
225
+ * index adjustment included and before any retirement factor —
226
+ * see docs/how-it-works.md, "Leaving is dated to the day". */
227
227
  accruedAtExit: ProjectionMoney;
228
228
  /** After revaluation, before ERF/LRF, at retirement */
229
229
  revaluedAtRetirement: ProjectionMoney;
@@ -157,8 +157,8 @@ import { ACCRUAL_RATE, atDrawing, buildLedger, flatPay, } from './pension/ledger
157
157
  import { estimateHistory } from './pension/history.js';
158
158
  import { seedFromBalanceAt } from './pension/uplift.js';
159
159
  import { buildCurve, walkThrough } from './pension/curve.js';
160
- import { schemeYearEndDate, schemeYearEndFor, seedFromJoinDate, } from './pension/seed.js';
161
- import { factorTable } from './factor-basis.js';
160
+ import { schemeYearEndDate, seedFromJoinDate } from './pension/seed.js';
161
+ import { FACTOR_TABLES, factorTable } from './factor-basis.js';
162
162
  // ── Constants ───────────────────────────────────────
163
163
  /* The accrual rate is owned by the ledger that applies it and
164
164
  re-exported here, so the record and every figure read off it
@@ -168,8 +168,8 @@ export { ACCRUAL_RATE };
168
168
  // The 2015 Section's two tables, read through the one set every
169
169
  // factor in the library comes from, so this and `memberBenefits`
170
170
  // cannot round the same drawing two ways.
171
- const ERF1 = factorTable('0-420');
172
- const LRF1 = factorTable('0-421');
171
+ const ERF1 = factorTable(FACTOR_TABLES.early2015);
172
+ const LRF1 = factorTable(FACTOR_TABLES.late2015);
173
173
  /**
174
174
  * Provenance of the 2015 Section's in-force table behind a factor
175
175
  * kind — the
@@ -270,9 +270,7 @@ export function projectPension(input, today = new Date()) {
270
270
  : resolveProjection({ ...input, assumedCpi: 0 }, today);
271
271
  const pair = (n, r, asAt) => ({ nominal: n, real: r, asAt });
272
272
  return {
273
- accruedAtExit: pair(cash.accruedAtExit, todays.accruedAtExit,
274
- // Dated at the close it is the closing of.
275
- schemeYearEndDate(schemeYearEndFor(cash.exitDate))),
273
+ accruedAtExit: pair(cash.accruedAtExit, todays.accruedAtExit, cash.exitDate),
276
274
  revaluedAtRetirement: pair(cash.revaluedAtRetirement, todays.revaluedAtRetirement, cash.retirementDate),
277
275
  annualPension: pair(cash.annualPension, todays.annualPension, cash.retirementDate),
278
276
  accruedNow: pair(cash.ledger.atDate(today), todays.ledger.atDate(today), today),
@@ -356,12 +354,9 @@ function resolveProjection(input, today) {
356
354
  Starting at today would also put a past leaving date
357
355
  outside the curve's range. */
358
356
  curveFrom: earliest(today, exitDate, schemeYearEndDate(history === null ? seed.atSchemeYearEnd : history.from - 1)),
359
- /* The close of that year, not the exit date — see
360
- docs/how-it-works.md, "An exit date names a SCHEME
361
- YEAR, not a day". Reading the date puts this a whole
362
- year's accrual below the rest of this object for a
363
- mid-year leaver. */
364
- accruedAtExit: ledger.closingAt(schemeYearEndFor(exitDate)),
357
+ // The leaving row settles on the last day of service, so the
358
+ // entitlement is read there, before any retirement factor.
359
+ accruedAtExit: ledger.accruedAt(exitDate),
365
360
  revaluedAtRetirement: revalued,
366
361
  annualPension: drawn,
367
362
  };
@@ -1 +1 @@
1
- {"version":3,"file":"pension-projection.js","sourceRoot":"","sources":["../src/pension-projection.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;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AE,cAAc,EAAE,GAAG;QACjD,MAAM,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM;QACzD;;;;;;;wCAOgC;QAChC,SAAS,EAAE,QAAQ,CACjB,KAAK,EACL,QAAQ,EACR,iBAAiB,CACf,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,eAAe,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,CAAC,CAC3D,CACF;QACD,6DAA6D;QAC7D,2DAA2D;QAC3D,aAAa,EAAE,MAAM,CAAC,SAAS,CAAC,QAAQ,CAAC;QACzC,oBAAoB,EAAE,QAAQ;QAC9B,aAAa,EAAE,KAAK;KACrB,CAAC;AACJ,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { FinalSalaryRules } from './final-salary.js';
2
- import type { FactorApplies, FactorOutcome } from '../factor-basis.js';
2
+ import type { Applies1995, FactorOutcome } from '../factor-basis.js';
3
3
  /**
4
4
  * The factor for a 1995 Section benefit drawn on `drawn`, for the
5
5
  * pension or for the automatic lump sum.
@@ -13,7 +13,7 @@ import type { FactorApplies, FactorOutcome } from '../factor-basis.js';
13
13
  * left first reads 1-403A/B and 1-409A/B, and which of those applies has
14
14
  * not been read at source: https://github.com/casomoltd/nhs-pay/issues/18
15
15
  */
16
- export declare function factor1995(dateOfBirth: Date, leaving: Date, drawn: Date, applies: FactorApplies): FactorOutcome;
16
+ export declare function factor1995(dateOfBirth: Date, leaving: Date, drawn: Date, applies: Applies1995): FactorOutcome;
17
17
  /** The 1995 Section's statute (SI 1995/300): 1/80 of the best single
18
18
  * year's pay of the last three, and three times the pension as an
19
19
  * automatic lump sum. */
@@ -5,9 +5,9 @@
5
5
  import { npaDate } from '../dates.js';
6
6
  import { bestSingleOf3, PAY_MEASURES } from './final-salary.js';
7
7
  import { BenefitNotModelled, NOT_MODELLED } from '../errors.js';
8
- import { FACTOR_APPLIES, FACTOR_SOURCES, readFactor } from '../factor-basis.js';
8
+ import { FACTOR_APPLIES, FACTOR_DIRECTIONS, FACTOR_SOURCES, LEGACY_PENSION_AGES, readFactor, } from '../factor-basis.js';
9
9
  /** The pension age the 1995 Section's reductions are measured from. */
10
- const PENSION_AGE = 60;
10
+ const PENSION_AGE = LEGACY_PENSION_AGES.section1995;
11
11
  /**
12
12
  * The factor for a 1995 Section benefit drawn on `drawn`, for the
13
13
  * pension or for the automatic lump sum.
@@ -30,7 +30,7 @@ export function factor1995(dateOfBirth, leaving, drawn, applies) {
30
30
  throw new BenefitNotModelled(NOT_MODELLED.preservedDrawnEarly, 'a 1995 Section benefit drawn before 60 from preserved benefits');
31
31
  }
32
32
  const basis = {
33
- against: PENSION_AGE, direction: 'early', applies,
33
+ against: PENSION_AGE, direction: FACTOR_DIRECTIONS.early, applies,
34
34
  };
35
35
  return readFactor(basis, dateOfBirth, drawn);
36
36
  }
@@ -1 +1 @@
1
- {"version":3,"file":"section-1995.js","sourceRoot":"","sources":["../../src/sections/section-1995.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,aAAa,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAE9D,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAK9E,uEAAuE;AACvE,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,UAAU,CACxB,WAAiB,EACjB,OAAa,EACb,KAAW,EACX,OAAsB;IAEtB,MAAM,KAAK,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IAChD,IAAI,KAAK,GAAG,KAAK,EAAE,CAAC;QAClB,OAAO,EAAC,MAAM,EAAE,cAAc,CAAC,YAAY,EAAE,MAAM,EAAE,CAAC,EAAC,CAA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,cAAc,CAAC,OAAO,CAAC;KAClE;CACF,CAAC"}
@@ -6,9 +6,9 @@
6
6
  import { npaDate } from '../dates.js';
7
7
  import { meanOf3ConsecutiveIn10, PAY_MEASURES } from './final-salary.js';
8
8
  import { BenefitNotModelled, NOT_MODELLED } from '../errors.js';
9
- import { readFactor } from '../factor-basis.js';
9
+ import { FACTOR_DIRECTIONS, LEGACY_PENSION_AGES, readFactor } from '../factor-basis.js';
10
10
  /** The pension age the 2008 Section's factors are measured from. */
11
- const PENSION_AGE = 65;
11
+ const PENSION_AGE = LEGACY_PENSION_AGES.section2008;
12
12
  /**
13
13
  * The factor for a 2008 Section pension drawn on `drawn`: 1-402 early,
14
14
  * 2-416 late.
@@ -25,7 +25,9 @@ export function factor2008(dateOfBirth, leaving, drawn) {
25
25
  }
26
26
  const basis = {
27
27
  against: PENSION_AGE,
28
- direction: drawn < sixtyFive ? 'early' : 'late',
28
+ direction: drawn < sixtyFive
29
+ ? FACTOR_DIRECTIONS.early
30
+ : FACTOR_DIRECTIONS.late,
29
31
  };
30
32
  return readFactor(basis, dateOfBirth, drawn);
31
33
  }
@@ -1 +1 @@
1
- {"version":3,"file":"section-2008.js","sourceRoot":"","sources":["../../src/sections/section-2008.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EAAC,OAAO,EAAC,MAAM,aAAa,CAAC;AACpC,OAAO,EAAC,sBAAsB,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAEvE,OAAO,EAAC,kBAAkB,EAAE,YAAY,EAAC,MAAM,cAAc,CAAC;AAC9D,OAAO,EAAC,UAAU,EAAC,MAAM,oBAAoB,CAAC;AAG9C,oEAAoE;AACpE,MAAM,WAAW,GAAG,EAAE,CAAC;AAEvB;;;;;;;;GAQG;AACH,MAAM,UAAU,UAAU,CACxB,WAAiB,EACjB,OAAa,EACb,KAAW;IAEX,MAAM,SAAS,GAAG,OAAO,CAAC,WAAW,EAAE,WAAW,CAAC,CAAC;IACpD,IAAI,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,KAAK,EAAE,CAAC;QACzC,MAAM,IAAI,kBAAkB,CAC1B,YAAY,CAAC,mBAAmB,EAChC,gEAAgE,CACjE,CAAC;IACJ,CAAC;IACD,MAAM,KAAK,GAAgB;QACzB,OAAO,EAAE,WAAW;QACpB,SAAS,EAAE,KAAK,GAAG,SAAS;YAC1B,CAAC,CAAC,iBAAiB,CAAC,KAAK;YACzB,CAAC,CAAC,iBAAiB,CAAC,IAAI;KAC3B,CAAC;IACF,OAAO,UAAU,CAAC,KAAK,EAAE,WAAW,EAAE,KAAK,CAAC,CAAC;AAC/C,CAAC;AAED;;6BAE6B;AAC7B,MAAM,CAAC,MAAM,UAAU,GAAqB;IAC1C,WAAW,EAAE,EAAE;IACf,UAAU,EAAE,YAAY,CAAC,sBAAsB;IAC/C,UAAU,EAAE,WAAW;IACvB,UAAU,EAAE,IAAI;IAChB,QAAQ,EAAE,sBAAsB;IAChC,aAAa,EAAE,UAAU;IACzB,gBAAgB,EAAE,IAAI;CACvB,CAAC"}
@@ -1,15 +1,16 @@
1
- import type { FactorOutcome } from '../factor-basis.js';
1
+ import type { Applies2015, FactorOutcome } from '../factor-basis.js';
2
2
  import type { MemberLedger, PayIn } from '../pension/ledger.js';
3
3
  import type { Prices } from '../pension/prices.js';
4
4
  import type { LedgerSeed } from '../pension/seed.js';
5
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.
6
+ * The factor for a benefit determined under the 2015 Section's rules,
7
+ * drawn on `drawn`, by the period to or after the member's own pension
8
+ * age: 0-420 early, and late 0-421 for the main pension or 0-422 for
9
+ * additional pension. The remedy window valued on the 2015 basis reads
10
+ * this too, because its benefits are determined under these rules
11
+ * although the legacy section pays them.
11
12
  */
12
- export declare function factor2015(dateOfBirth: Date, drawn: Date): FactorOutcome;
13
+ export declare function factor2015(dateOfBirth: Date, drawn: Date, applies: Applies2015): FactorOutcome;
13
14
  /** One career average walk in one ruler, and the pension it draws. */
14
15
  interface CareerAverageRun {
15
16
  readonly ledger: MemberLedger;