@casomoltd/nhs-pay 0.30.0 → 0.32.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 (82) hide show
  1. package/README.md +71 -252
  2. package/dist/bands.d.ts +9 -1
  3. package/dist/bands.js +20 -0
  4. package/dist/bands.js.map +1 -1
  5. package/dist/document-source.d.ts +32 -7
  6. package/dist/document-source.js +32 -8
  7. package/dist/document-source.js.map +1 -1
  8. package/dist/errors.d.ts +57 -11
  9. package/dist/errors.js +85 -28
  10. package/dist/errors.js.map +1 -1
  11. package/dist/factor-basis.d.ts +23 -3
  12. package/dist/factor-basis.js +40 -28
  13. package/dist/factor-basis.js.map +1 -1
  14. package/dist/index.d.ts +16 -14
  15. package/dist/index.js +9 -8
  16. package/dist/index.js.map +1 -1
  17. package/dist/member/benefits.js +25 -13
  18. package/dist/member/benefits.js.map +1 -1
  19. package/dist/member/index.d.ts +1 -1
  20. package/dist/member/input-period.d.ts +4 -4
  21. package/dist/member/input-period.js +11 -9
  22. package/dist/member/input-period.js.map +1 -1
  23. package/dist/member/service.d.ts +4 -0
  24. package/dist/member/service.js +9 -3
  25. package/dist/member/service.js.map +1 -1
  26. package/dist/member/types.d.ts +81 -49
  27. package/dist/member/types.js.map +1 -1
  28. package/dist/member/valuation.d.ts +10 -8
  29. package/dist/member/valuation.js +14 -21
  30. package/dist/member/valuation.js.map +1 -1
  31. package/dist/pay-path.d.ts +21 -25
  32. package/dist/pay-path.js +85 -67
  33. package/dist/pay-path.js.map +1 -1
  34. package/dist/pension/ages.d.ts +6 -4
  35. package/dist/pension/ages.js +6 -4
  36. package/dist/pension/ages.js.map +1 -1
  37. package/dist/pension/curve.d.ts +2 -1
  38. package/dist/pension/curve.js +15 -7
  39. package/dist/pension/curve.js.map +1 -1
  40. package/dist/pension/history.d.ts +18 -3
  41. package/dist/pension/history.js +12 -5
  42. package/dist/pension/history.js.map +1 -1
  43. package/dist/pension/ledger.d.ts +15 -9
  44. package/dist/pension/ledger.js +95 -59
  45. package/dist/pension/ledger.js.map +1 -1
  46. package/dist/pension/money.d.ts +2 -0
  47. package/dist/pension/money.js +4 -0
  48. package/dist/pension/money.js.map +1 -1
  49. package/dist/pension/prices.d.ts +11 -2
  50. package/dist/pension/prices.js +35 -14
  51. package/dist/pension/prices.js.map +1 -1
  52. package/dist/pension/scheme-year.d.ts +59 -0
  53. package/dist/pension/scheme-year.js +80 -0
  54. package/dist/pension/scheme-year.js.map +1 -0
  55. package/dist/pension/seed.d.ts +66 -50
  56. package/dist/pension/seed.js +111 -65
  57. package/dist/pension/seed.js.map +1 -1
  58. package/dist/pension/uplift.d.ts +38 -54
  59. package/dist/pension/uplift.js +38 -68
  60. package/dist/pension/uplift.js.map +1 -1
  61. package/dist/pension-projection.js +30 -22
  62. package/dist/pension-projection.js.map +1 -1
  63. package/dist/post.d.ts +1 -10
  64. package/dist/post.js +1 -12
  65. package/dist/post.js.map +1 -1
  66. package/dist/revaluation.d.ts +56 -41
  67. package/dist/revaluation.js +76 -62
  68. package/dist/revaluation.js.map +1 -1
  69. package/dist/scale-point.d.ts +6 -0
  70. package/dist/sections/final-salary.d.ts +3 -8
  71. package/dist/sections/final-salary.js +6 -10
  72. package/dist/sections/final-salary.js.map +1 -1
  73. package/dist/sections/section-2015.d.ts +3 -4
  74. package/dist/sections/section-2015.js +1 -1
  75. package/dist/sections/section-2015.js.map +1 -1
  76. package/dist/sources.d.ts +14 -0
  77. package/dist/sources.js +24 -0
  78. package/dist/sources.js.map +1 -1
  79. package/dist/take-home.d.ts +4 -20
  80. package/dist/take-home.js +3 -23
  81. package/dist/take-home.js.map +1 -1
  82. package/package.json +3 -3
@@ -1 +1 @@
1
- {"version":3,"file":"prices.js","sourceRoot":"","sources":["../../src/pension/prices.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACv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,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,QAAQ,GAAG,aAAa,CAAC,IAAI,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvC,IAAI,OAAO,GAAG,EAAE,IAAI,OAAO,IAAI,EAAE,EAAE,CAAC;YAClC,MAAM,IAAI,CAAC,GAAG,eAAe,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,GAAG,CAAC,CAAC;QACtD,CAAC;IACH,CAAC;IACD,OAAO,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC;AACrC,CAAC"}
@@ -0,0 +1,59 @@
1
+ /**
2
+ * The scheme year: the NHS Pension Scheme's own 1 April to 31 March cycle,
3
+ * the one an Annual Benefit Statement closes on and a ledger walks.
4
+ *
5
+ * Named by the calendar year its 31 March falls in, as paye-calc's
6
+ * `taxYearEnd.ts` names a tax year by its 5 April. Imports nothing, so
7
+ * every module that dates a pension can read it without a cycle.
8
+ */
9
+ declare const SCHEME_YEAR_END: unique symbol;
10
+ /**
11
+ * A scheme year, named by the calendar year its 31 March falls in: 2026
12
+ * means 1 April 2025 to 31 March 2026.
13
+ *
14
+ * Branded because the number has a twin: paye-calc's `TaxYearEnd` names a
15
+ * tax year by the year its 5 April falls in, a bare number of the same
16
+ * size, and passing one for the other moves every date by five days. Each
17
+ * brand makes the other a compile error. A `SchemeYearEnd` comes only from
18
+ * {@link schemeYearEnd} or a function here that returns one; arithmetic on
19
+ * one gives a plain number, which is minted again to be used as one.
20
+ */
21
+ export type SchemeYearEnd = number & {
22
+ readonly [SCHEME_YEAR_END]: 'scheme-year-end';
23
+ };
24
+ /** Read `year` as the calendar year a scheme year ends in — the only way
25
+ * to mint a {@link SchemeYearEnd} from a number. Throws RangeError for a
26
+ * year that is not a whole four-digit year. */
27
+ export declare function schemeYearEnd(year: number): SchemeYearEnd;
28
+ /** The scheme year after `year`. */
29
+ export declare function schemeYearAfter(year: SchemeYearEnd): SchemeYearEnd;
30
+ /** The scheme year before `year`. */
31
+ export declare function schemeYearBefore(year: SchemeYearEnd): SchemeYearEnd;
32
+ /**
33
+ * The scheme year a date falls in, named by the year it ENDS.
34
+ *
35
+ * The cycle is the scheme's own — 1 April to 31 March — and it
36
+ * is the same one an Annual Benefit Statement closes on: a
37
+ * statement marked *Updated To 31/03/2025* reports scheme year
38
+ * 2025, so its figure seeds that row's close untouched. 1 Apr
39
+ * 2025 and 31 Mar 2026 are both scheme year 2026.
40
+ */
41
+ export declare function schemeYearEndFor(date: Date): SchemeYearEnd;
42
+ /** 31 March of the given scheme year. */
43
+ export declare function schemeYearEndDate(year: SchemeYearEnd): Date;
44
+ /** 1 April opening the given scheme year. */
45
+ export declare function schemeYearStartDate(year: SchemeYearEnd): Date;
46
+ /** Whether `date` is a 31 March, the close of the scheme year it falls
47
+ * in and the date an Annual Benefit Statement runs to. */
48
+ export declare function isSchemeYearEnd(date: Date): boolean;
49
+ /**
50
+ * The scheme year that had already CLOSED by `date` — the year
51
+ * a balance stated on that date belongs to.
52
+ *
53
+ * Taking the day after makes 31 March land on the year it ends
54
+ * rather than the one before it. Shared with the caller that
55
+ * picks the real-terms anchor, which has to know the seed's year
56
+ * BEFORE a `Prices` exists to build the seed with.
57
+ */
58
+ export declare function schemeYearClosedBy(date: Date): SchemeYearEnd;
59
+ export {};
@@ -0,0 +1,80 @@
1
+ /**
2
+ * The scheme year: the NHS Pension Scheme's own 1 April to 31 March cycle,
3
+ * the one an Annual Benefit Statement closes on and a ledger walks.
4
+ *
5
+ * Named by the calendar year its 31 March falls in, as paye-calc's
6
+ * `taxYearEnd.ts` names a tax year by its 5 April. Imports nothing, so
7
+ * every module that dates a pension can read it without a cycle.
8
+ */
9
+ /** The month a scheme year ends in, as `Date` counts months from nought:
10
+ * March. */
11
+ const MARCH_MONTH_INDEX = 2;
12
+ /** The month a scheme year opens in: April. */
13
+ const APRIL_MONTH_INDEX = 3;
14
+ /** The day of March a scheme year ends on. */
15
+ const LAST_DAY_OF_SCHEME_YEAR = 31;
16
+ /** The day of April a scheme year opens on. */
17
+ const FIRST_DAY_OF_SCHEME_YEAR = 1;
18
+ /** The years a mint accepts: four digits, since `Date` reads a year below
19
+ * 100 as one in the 1900s. */
20
+ const FIRST_YEAR = 1000;
21
+ const LAST_YEAR = 9999;
22
+ /** Read `year` as the calendar year a scheme year ends in — the only way
23
+ * to mint a {@link SchemeYearEnd} from a number. Throws RangeError for a
24
+ * year that is not a whole four-digit year. */
25
+ export function schemeYearEnd(year) {
26
+ if (!Number.isInteger(year) || year < FIRST_YEAR || year > LAST_YEAR) {
27
+ throw new RangeError(`schemeYearEnd: ${year} is not a whole four-digit year`);
28
+ }
29
+ return year;
30
+ }
31
+ /** The scheme year after `year`. */
32
+ export function schemeYearAfter(year) {
33
+ return schemeYearEnd(year + 1);
34
+ }
35
+ /** The scheme year before `year`. */
36
+ export function schemeYearBefore(year) {
37
+ return schemeYearEnd(year - 1);
38
+ }
39
+ /**
40
+ * The scheme year a date falls in, named by the year it ENDS.
41
+ *
42
+ * The cycle is the scheme's own — 1 April to 31 March — and it
43
+ * is the same one an Annual Benefit Statement closes on: a
44
+ * statement marked *Updated To 31/03/2025* reports scheme year
45
+ * 2025, so its figure seeds that row's close untouched. 1 Apr
46
+ * 2025 and 31 Mar 2026 are both scheme year 2026.
47
+ */
48
+ export function schemeYearEndFor(date) {
49
+ return schemeYearEnd(date.getMonth() >= APRIL_MONTH_INDEX
50
+ ? date.getFullYear() + 1
51
+ : date.getFullYear());
52
+ }
53
+ /** 31 March of the given scheme year. */
54
+ export function schemeYearEndDate(year) {
55
+ return new Date(year, MARCH_MONTH_INDEX, LAST_DAY_OF_SCHEME_YEAR);
56
+ }
57
+ /** 1 April opening the given scheme year. */
58
+ export function schemeYearStartDate(year) {
59
+ return new Date(year - 1, APRIL_MONTH_INDEX, FIRST_DAY_OF_SCHEME_YEAR);
60
+ }
61
+ /** Whether `date` is a 31 March, the close of the scheme year it falls
62
+ * in and the date an Annual Benefit Statement runs to. */
63
+ export function isSchemeYearEnd(date) {
64
+ return date.getMonth() === MARCH_MONTH_INDEX
65
+ && date.getDate() === LAST_DAY_OF_SCHEME_YEAR;
66
+ }
67
+ /**
68
+ * The scheme year that had already CLOSED by `date` — the year
69
+ * a balance stated on that date belongs to.
70
+ *
71
+ * Taking the day after makes 31 March land on the year it ends
72
+ * rather than the one before it. Shared with the caller that
73
+ * picks the real-terms anchor, which has to know the seed's year
74
+ * BEFORE a `Prices` exists to build the seed with.
75
+ */
76
+ export function schemeYearClosedBy(date) {
77
+ const dayAfter = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
78
+ return schemeYearBefore(schemeYearEndFor(dayAfter));
79
+ }
80
+ //# sourceMappingURL=scheme-year.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scheme-year.js","sourceRoot":"","sources":["../../src/pension/scheme-year.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAkBH;aACa;AACb,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,+CAA+C;AAC/C,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,8CAA8C;AAC9C,MAAM,uBAAuB,GAAG,EAAE,CAAC;AACnC,+CAA+C;AAC/C,MAAM,wBAAwB,GAAG,CAAC,CAAC;AACnC;+BAC+B;AAC/B,MAAM,UAAU,GAA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O,EAAE,KAAK,uBAAuB,CAAC;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,kBAAkB,CAAC,IAAU;IAC3C,MAAM,QAAQ,GAAG,IAAI,IAAI,CACvB,IAAI,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,QAAQ,EAAE,EAAE,IAAI,CAAC,OAAO,EAAE,GAAG,CAAC,CACxD,CAAC;IACF,OAAO,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,CAAC,CAAC,CAAC;AACtD,CAAC"}
@@ -1,11 +1,5 @@
1
- /**
2
- * Where the walk starts, and what it starts from.
3
- *
4
- * This is the ENTIRETY of the statement-versus-estimation
5
- * difference: the two input variants are read exactly once, here,
6
- * to fill this object, and nothing downstream may ask which
7
- * produced it.
8
- */
1
+ import type { Prices } from './prices.js';
2
+ import type { SchemeYearEnd } from './scheme-year.js';
9
3
  /** An initial condition, not an abstraction. */
10
4
  export interface LedgerSeed {
11
5
  /** Nominal £/yr already banked at the close of
@@ -14,7 +8,7 @@ export interface LedgerSeed {
14
8
  readonly opening: number;
15
9
  /** The scheme year the opening balance sits AT. The walk
16
10
  * starts at the year after this one. */
17
- readonly atSchemeYearEnd: number;
11
+ readonly atSchemeYearEnd: SchemeYearEnd;
18
12
  /** The date service actually begins INSIDE the first walked
19
13
  * year, when that year is a part year — null when it is whole.
20
14
  * Only the join route can produce a value here: a statement
@@ -22,59 +16,65 @@ export interface LedgerSeed {
22
16
  * whole. The first year's PAY is scaled by this; the 1/54
23
17
  * divisor never is. */
24
18
  readonly accruingFrom: Date | null;
19
+ /** Whether the walk can answer for a date before the close of
20
+ * `atSchemeYearEnd`. A walk that opens the membership held
21
+ * nothing then, so it can; a statement gives a balance at its 31
22
+ * March and nothing of the dates before it, so a read there is
23
+ * refused rather than answered with the statement's balance.
24
+ * `seedFromBalanceAt` answers, for `projectPension`'s figure
25
+ * stated on any day: see there. */
26
+ readonly answersBefore: boolean;
25
27
  /** Whether `opening` is the scheme's own figure or ours. No
26
28
  * arithmetic reads this — it exists so a consumer can tell a
27
29
  * figure a member could check against paper from one this
28
30
  * library produced. */
29
- readonly basis: 'given' | 'derived';
31
+ readonly basis: SeedBasis;
30
32
  }
33
+ /** A balance a member was told, and the date it was stated on. */
34
+ interface StatedBalance {
35
+ readonly balance: number;
36
+ readonly asOf: Date;
37
+ }
38
+ /** Whose figure a seed's opening balance is: the scheme's, read off a
39
+ * statement or stated by the member, or this library's own. */
40
+ export declare const SEED_BASES: {
41
+ readonly given: "given";
42
+ readonly derived: "derived";
43
+ };
44
+ export type SeedBasis = (typeof SEED_BASES)[keyof typeof SEED_BASES];
31
45
  /**
32
- * The first scheme year a walk from this seed produces.
33
- *
34
- * The seed is a balance standing AT a year end, so the walk opens
35
- * on the year after it. Both the ledger and the illustrative
36
- * run-up need that year — one to start its loop, the other to
37
- * decide there is anything to draw — and a rule spelled out twice
38
- * is a rule that can drift, so it is read from the seed that
39
- * carries it.
40
- */
41
- export declare function firstWalkedYear(seed: LedgerSeed): number;
42
- /**
43
- * The scheme year a date falls in, named by the year it ENDS.
44
- *
45
- * The cycle is the scheme's own — 1 April to 31 March — and it
46
- * is the same one an Annual Benefit Statement closes on: a
47
- * statement marked *Updated To 31/03/2025* reports scheme year
48
- * 2025, so its figure seeds that row's close untouched. 1 Apr
49
- * 2025 and 31 Mar 2026 are both scheme year 2026.
50
- */
51
- export declare function schemeYearEndFor(date: Date): number;
52
- /** 31 March of the given scheme year. */
53
- export declare function schemeYearEndDate(schemeYearEnd: number): Date;
54
- /** 1 April opening the given scheme year. */
55
- export declare function schemeYearStartDate(schemeYearEnd: number): Date;
56
- /**
57
- * The scheme year that had already CLOSED by `date` — the year
58
- * a balance stated on that date belongs to.
46
+ * Route 1: the scheme has already told us the balance, at the close
47
+ * of `yearEnd`. A statement is as at 31 March, so its year is all it
48
+ * needs: a mid-year date cannot be expressed.
59
49
  *
60
- * Taking the day after makes 31 March land on the year it ends
61
- * rather than the one before it. Shared with the caller that
62
- * picks the real-terms anchor, which has to know the seed's year
63
- * BEFORE a `Prices` exists to build the seed with.
50
+ * Yields basis 'given', and `accruingFrom` null: the first walked
51
+ * year is the one AFTER the statement's, which is always whole.
52
+ * Nothing before the statement is answered.
64
53
  */
65
- export declare function schemeYearClosedBy(date: Date): number;
54
+ export declare function seedFromStatement(accruedPension: number, yearEnd: SchemeYearEnd): LedgerSeed;
66
55
  /**
67
- * Route 1: the scheme has already told us the balance.
56
+ * A member's stated balance, on whatever date it is stated —
57
+ * the day they read it, or the day their statement prints. That
58
+ * is a position mid-scheme-year, and a seed is a year-end
59
+ * closing balance, so it has to be carried back to one.
68
60
  *
69
- * Precondition: `statementDate` IS a scheme year end (31 March).
70
- * A mid-year statement date is a caller error, not a value to
71
- * round — the accrued figure would not correspond to any closing
72
- * balance. Throw; never silently snap to a year end.
61
+ * In November the April uplift has already been applied to the
62
+ * figure being read, so dividing it out lands on the last
63
+ * year-end closing balance and the walk re-applies it — no
64
+ * double count, and no year of accrual thrown away. On a date
65
+ * before that April the figure already IS the year-end balance
66
+ * and nothing is divided, which is why a statement printed on
67
+ * 31 March passes through untouched.
73
68
  *
74
- * Yields basis 'given', and `accruingFrom` null: the first walked
75
- * year is the one AFTER the statement's, which is always whole.
69
+ * ONE route for both the dated and the undated case, because
70
+ * there is only one question: what was the closing balance at
71
+ * the year end before this date? `seedFromStatement` takes a
72
+ * year end and nothing else; this is what finds one.
73
+ * A balance is read on arbitrary days — a statement printed on
74
+ * 7 November is a real one — though it is valued as at 31 March,
75
+ * so the strict form alone could not serve a figure read today.
76
76
  */
77
- export declare function seedFromStatement(accruedPension: number, statementDate: Date): LedgerSeed;
77
+ export declare function seedFromBalanceAt({ balance, asOf }: StatedBalance, exitDate: Date, retirementDate: Date, prices: Prices): LedgerSeed;
78
78
  /**
79
79
  * Route 2: we compute the balance from the beginning.
80
80
  *
@@ -84,3 +84,19 @@ export declare function seedFromStatement(accruedPension: number, statementDate:
84
84
  * year's pay.
85
85
  */
86
86
  export declare function seedFromJoinDate(joinDate: Date): LedgerSeed;
87
+ /**
88
+ * The first scheme year a walk from this seed produces.
89
+ *
90
+ * The seed is a balance standing AT a year end, so the walk opens
91
+ * on the year after it. Both the ledger and the illustrative
92
+ * run-up need that year — one to start its loop, the other to
93
+ * decide there is anything to draw — and a rule spelled out twice
94
+ * is a rule that can drift, so it is read from the seed that
95
+ * carries it.
96
+ */
97
+ export declare function firstWalkedYear(seed: LedgerSeed): SchemeYearEnd;
98
+ /** The first date a walk from `seed` answers on: its close, where it does
99
+ * not answer before itself (a statement); null where it answers every
100
+ * date. The one producer the ledger refuses by and the member reports. */
101
+ export declare function answersFrom(seed: LedgerSeed): Date | null;
102
+ export {};
@@ -2,79 +2,83 @@
2
2
  * Where the walk starts, and what it starts from.
3
3
  *
4
4
  * This is the ENTIRETY of the statement-versus-estimation
5
- * difference: the two input variants are read exactly once, here,
6
- * to fill this object, and nothing downstream may ask which
7
- * produced it.
5
+ * difference: every route to a seed — a statement, a balance stated
6
+ * on any day, or the join date — is read exactly once, here, to fill
7
+ * this object, and nothing downstream may ask which produced it. The
8
+ * one thing a reader may ask is `answersBefore`, a capability rather
9
+ * than a route: whether a date before the seed has an answer at all,
10
+ * which is the ledger's to know before it reads one.
8
11
  */
12
+ import { dayAfter, monthsCountingPart } from '../dates.js';
9
13
  import { invariant } from '../errors.js';
14
+ import { pointsToDecimal } from './prices.js';
15
+ import { schemeYearAfter, schemeYearBefore, schemeYearClosedBy, schemeYearEndDate, schemeYearEndFor, schemeYearStartDate, } from './scheme-year.js';
16
+ import { openingUpliftFor } from './uplift.js';
17
+ /** Whose figure a seed's opening balance is: the scheme's, read off a
18
+ * statement or stated by the member, or this library's own. */
19
+ export const SEED_BASES = {
20
+ given: 'given',
21
+ derived: 'derived',
22
+ };
10
23
  /**
11
- * The first scheme year a walk from this seed produces.
24
+ * Route 1: the scheme has already told us the balance, at the close
25
+ * of `yearEnd`. A statement is as at 31 March, so its year is all it
26
+ * needs: a mid-year date cannot be expressed.
12
27
  *
13
- * The seed is a balance standing AT a year end, so the walk opens
14
- * on the year after it. Both the ledger and the illustrative
15
- * run-up need that year — one to start its loop, the other to
16
- * decide there is anything to draw — and a rule spelled out twice
17
- * is a rule that can drift, so it is read from the seed that
18
- * carries it.
28
+ * Yields basis 'given', and `accruingFrom` null: the first walked
29
+ * year is the one AFTER the statement's, which is always whole.
30
+ * Nothing before the statement is answered.
19
31
  */
20
- export function firstWalkedYear(seed) {
21
- return seed.atSchemeYearEnd + 1;
32
+ export function seedFromStatement(accruedPension, yearEnd) {
33
+ return givenSeed(accruedPension, yearEnd, false);
22
34
  }
23
35
  /**
24
- * The scheme year a date falls in, named by the year it ENDS.
36
+ * A member's stated balance, on whatever date it is stated —
37
+ * the day they read it, or the day their statement prints. That
38
+ * is a position mid-scheme-year, and a seed is a year-end
39
+ * closing balance, so it has to be carried back to one.
25
40
  *
26
- * The cycle is the scheme's own — 1 April to 31 March — and it
27
- * is the same one an Annual Benefit Statement closes on: a
28
- * statement marked *Updated To 31/03/2025* reports scheme year
29
- * 2025, so its figure seeds that row's close untouched. 1 Apr
30
- * 2025 and 31 Mar 2026 are both scheme year 2026.
31
- */
32
- export function schemeYearEndFor(date) {
33
- return date.getMonth() >= 3
34
- ? date.getFullYear() + 1
35
- : date.getFullYear();
36
- }
37
- /** 31 March of the given scheme year. */
38
- export function schemeYearEndDate(schemeYearEnd) {
39
- return new Date(schemeYearEnd, 2, 31);
40
- }
41
- /** 1 April opening the given scheme year. */
42
- export function schemeYearStartDate(schemeYearEnd) {
43
- return new Date(schemeYearEnd - 1, 3, 1);
44
- }
45
- /**
46
- * The scheme year that had already CLOSED by `date` — the year
47
- * a balance stated on that date belongs to.
41
+ * In November the April uplift has already been applied to the
42
+ * figure being read, so dividing it out lands on the last
43
+ * year-end closing balance and the walk re-applies it — no
44
+ * double count, and no year of accrual thrown away. On a date
45
+ * before that April the figure already IS the year-end balance
46
+ * and nothing is divided, which is why a statement printed on
47
+ * 31 March passes through untouched.
48
48
  *
49
- * Taking the day after makes 31 March land on the year it ends
50
- * rather than the one before it. Shared with the caller that
51
- * picks the real-terms anchor, which has to know the seed's year
52
- * BEFORE a `Prices` exists to build the seed with.
49
+ * ONE route for both the dated and the undated case, because
50
+ * there is only one question: what was the closing balance at
51
+ * the year end before this date? `seedFromStatement` takes a
52
+ * year end and nothing else; this is what finds one.
53
+ * A balance is read on arbitrary days — a statement printed on
54
+ * 7 November is a real one — though it is valued as at 31 March,
55
+ * so the strict form alone could not serve a figure read today.
53
56
  */
54
- export function schemeYearClosedBy(date) {
55
- const dayAfter = new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
56
- return schemeYearEndFor(dayAfter) - 1;
57
- }
58
- /**
59
- * Route 1: the scheme has already told us the balance.
60
- *
61
- * Precondition: `statementDate` IS a scheme year end (31 March).
62
- * A mid-year statement date is a caller error, not a value to
63
- * round — the accrued figure would not correspond to any closing
64
- * balance. Throw; never silently snap to a year end.
65
- *
66
- * Yields basis 'given', and `accruingFrom` null: the first walked
67
- * year is the one AFTER the statement's, which is always whole.
68
- */
69
- export function seedFromStatement(accruedPension, statementDate) {
70
- invariant(statementDate.getMonth() === 2 && statementDate.getDate() === 31, 'statementDate must be a scheme year end (31 March), got '
71
- + statementDate.toDateString());
72
- return {
73
- opening: accruedPension,
74
- atSchemeYearEnd: statementDate.getFullYear(),
75
- accruingFrom: null,
76
- basis: 'given',
77
- };
57
+ export function seedFromBalanceAt({ balance, asOf }, exitDate, retirementDate, prices) {
58
+ const lastYearEnd = schemeYearClosedBy(asOf);
59
+ /* A figure read after leaving, before the leaving year has closed,
60
+ already holds that year's part slice and its leaver adjustment,
61
+ and the walk would re-walk that year and add both again. Refused
62
+ rather than guessed at. With no month served there is neither,
63
+ and once the year has closed the seed is its closing and the walk
64
+ starts after it: both round-trip. */
65
+ const exitYear = schemeYearEndFor(exitDate);
66
+ const monthsServedBeforeLeaving = monthsCountingPart(schemeYearStartDate(exitYear), dayAfter(exitDate));
67
+ const leavingYearStillOpen = lastYearEnd < exitYear;
68
+ const readAfterServingPartOfLeavingYear = asOf > exitDate
69
+ && leavingYearStillOpen
70
+ && monthsServedBeforeLeaving > 0;
71
+ invariant(!readAfterServingPartOfLeavingYear, `a balance stated on ${asOf.toDateString()}, after leaving on `
72
+ + `${exitDate.toDateString()} in the same scheme year`);
73
+ /* The uplift undone here is the one OPENING year
74
+ `lastYearEnd + 1`, and it is the very object `buildLedger`
75
+ re-applies to that year: inverting the walk exactly is this
76
+ function's only job, so both sides ask `openingUpliftFor`
77
+ rather than each naming the phase, the year and the CPI
78
+ series for themselves. */
79
+ const applied = openingUpliftFor(lastYearEnd, exitDate, retirementDate, prices);
80
+ const already = applied.appliedOn <= asOf;
81
+ return seedFromStatedBalance(already ? balance / (1 + pointsToDecimal(applied.percent)) : balance, lastYearEnd);
78
82
  }
79
83
  /**
80
84
  * Route 2: we compute the balance from the beginning.
@@ -87,9 +91,51 @@ export function seedFromStatement(accruedPension, statementDate) {
87
91
  export function seedFromJoinDate(joinDate) {
88
92
  return {
89
93
  opening: 0,
90
- atSchemeYearEnd: schemeYearEndFor(joinDate) - 1,
94
+ atSchemeYearEnd: schemeYearBefore(schemeYearEndFor(joinDate)),
91
95
  accruingFrom: joinDate,
92
- basis: 'derived',
96
+ answersBefore: true,
97
+ basis: SEED_BASES.derived,
98
+ };
99
+ }
100
+ /**
101
+ * The first scheme year a walk from this seed produces.
102
+ *
103
+ * The seed is a balance standing AT a year end, so the walk opens
104
+ * on the year after it. Both the ledger and the illustrative
105
+ * run-up need that year — one to start its loop, the other to
106
+ * decide there is anything to draw — and a rule spelled out twice
107
+ * is a rule that can drift, so it is read from the seed that
108
+ * carries it.
109
+ */
110
+ export function firstWalkedYear(seed) {
111
+ return schemeYearAfter(seed.atSchemeYearEnd);
112
+ }
113
+ /** The first date a walk from `seed` answers on: its close, where it does
114
+ * not answer before itself (a statement); null where it answers every
115
+ * date. The one producer the ledger refuses by and the member reports. */
116
+ export function answersFrom(seed) {
117
+ return seed.answersBefore ? null : schemeYearEndDate(seed.atSchemeYearEnd);
118
+ }
119
+ /**
120
+ * A balance a member gave on any day, already carried back to the
121
+ * close of `yearEnd` (see `seedFromBalanceAt`). `projectPension`
122
+ * reads its leaving and today against it, and a leaving can fall
123
+ * before the year end the figure is carried back to, so a date
124
+ * before the seed is answered with the seed's balance. The 31 March
125
+ * rule that refuses such a read binds `memberBenefits`' statement,
126
+ * which never comes through here.
127
+ */
128
+ function seedFromStatedBalance(balance, yearEnd) {
129
+ return givenSeed(balance, yearEnd, true);
130
+ }
131
+ /** A balance the scheme or the member gave, at the close of `yearEnd`. */
132
+ function givenSeed(opening, yearEnd, answersBefore) {
133
+ return {
134
+ opening,
135
+ atSchemeYearEnd: yearEnd,
136
+ accruingFrom: null,
137
+ answersBefore,
138
+ basis: SEED_BASES.given,
93
139
  };
94
140
  }
95
141
  //# sourceMappingURL=seed.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"seed.js","sourceRoot":"","sources":["../../src/pension/seed.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAyBvC;;;;;;;;;GASG;AACH,MAAM,UAAU,eAAe,CAAC,IAAgB;IAC9C,OAAO,IAAI,CAAC,eAAe,GAAG,CAAC,CAAC;AAClC,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,gBAAgB,CAAC,IAAU;IACzC,OAAO,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC;QACzB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,GAAG,CAAC;QACxB,CAAC,CAAC,IAAI,CAAC,WAAW,EAAE,CAAC;AACzB,CAAC;AAED,yCAAyC;AACzC,MAAM,UAAU,iBAAiB,CAAC,aAAqB;IACrD,OAAO,IAAI,IAAI,CAAC,aAAa,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,mBAAm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