@casomoltd/nhs-pay 0.26.0 → 0.28.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/additional-pension.js +57 -33
- package/dist/additional-pension.js.map +1 -1
- package/dist/dates.d.ts +2 -0
- package/dist/dates.js +17 -3
- package/dist/dates.js.map +1 -1
- package/dist/factor-basis.d.ts +1 -10
- package/dist/factor-basis.js +1 -10
- package/dist/factor-basis.js.map +1 -1
- package/dist/index.d.ts +5 -4
- package/dist/index.js +4 -4
- package/dist/index.js.map +1 -1
- package/dist/iso-date.d.ts +4 -9
- package/dist/iso-date.js +10 -11
- package/dist/iso-date.js.map +1 -1
- package/dist/member/benefits.d.ts +11 -0
- package/dist/member/benefits.js +179 -0
- package/dist/member/benefits.js.map +1 -0
- package/dist/member/index.d.ts +9 -0
- package/dist/member/index.js +9 -0
- package/dist/member/index.js.map +1 -0
- package/dist/member/service.d.ts +65 -0
- package/dist/member/service.js +166 -0
- package/dist/member/service.js.map +1 -0
- package/dist/{member-benefits.d.ts → member/types.d.ts} +30 -41
- package/dist/member/types.js +46 -0
- package/dist/member/types.js.map +1 -0
- package/dist/member/valuation.d.ts +67 -0
- package/dist/member/valuation.js +157 -0
- package/dist/member/valuation.js.map +1 -0
- package/dist/pension/ages.d.ts +105 -0
- package/dist/pension/ages.js +138 -0
- package/dist/pension/ages.js.map +1 -0
- package/dist/sections/section-1995.js +2 -1
- package/dist/sections/section-1995.js.map +1 -1
- package/dist/sections/section-2008.js +2 -1
- package/dist/sections/section-2008.js.map +1 -1
- package/dist/sections/section-2015.js +1 -1
- package/dist/sections/section-2015.js.map +1 -1
- package/dist/sources.d.ts +19 -2
- package/dist/sources.js +37 -3
- package/dist/sources.js.map +1 -1
- package/package.json +3 -3
- package/dist/member-benefits.js +0 -462
- package/dist/member-benefits.js.map +0 -1
- package/dist/npa.d.ts +0 -28
- package/dist/npa.js +0 -60
- package/dist/npa.js.map +0 -1
|
@@ -29,7 +29,7 @@ import { AP_0_717 } from './gad/additional-pension-0-717-2023-10-03.js';
|
|
|
29
29
|
import { AP_0_718 } from './gad/additional-pension-0-718-2023-10-03.js';
|
|
30
30
|
import { AP_0_719 } from './gad/additional-pension-0-719-2023-10-03.js';
|
|
31
31
|
import { isoDate, isoToDate } from './iso-date.js';
|
|
32
|
-
import { normalPensionAge } from './
|
|
32
|
+
import { normalPensionAge } from './pension/ages.js';
|
|
33
33
|
import { inflationFactor, TODAYS_MONEY_CPI } from './pension/prices.js';
|
|
34
34
|
import { factor2015 } from './sections/section-2015.js';
|
|
35
35
|
import { AP_FACTSHEET_2026 } from './sources.js';
|
|
@@ -59,27 +59,21 @@ export const ADDITIONAL_PENSION_PAYMENTS = {
|
|
|
59
59
|
/** Monthly, from pay, for whole years ending before the pension age. */
|
|
60
60
|
instalments: 'instalments',
|
|
61
61
|
};
|
|
62
|
+
/** Pence in a pound, as a price is rounded to. The same figure and
|
|
63
|
+
* rounding as `@casomoltd/paye-calc`'s money module, held here because
|
|
64
|
+
* the paye-calc release this library builds against does not export
|
|
65
|
+
* them; import them from paye-calc once a release that does is the
|
|
66
|
+
* floor of its peer range. */
|
|
67
|
+
const PENCE_PER_POUND = 100;
|
|
62
68
|
/** Every instalment table. Looked up by the pension age and cover each
|
|
63
69
|
* carries, so a table can be found only by what it says it is. */
|
|
64
70
|
const INSTALMENT_TABLES = [
|
|
65
71
|
AP_0_712, AP_0_713, AP_0_714, AP_0_715,
|
|
66
72
|
AP_0_716, AP_0_717, AP_0_718, AP_0_719,
|
|
67
73
|
];
|
|
68
|
-
/** The first day both the tables and the limit hold for
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
: ADDITIONAL_PENSION_LIMIT.from;
|
|
72
|
-
const refuse = (code, detail) => {
|
|
73
|
-
throw new AdditionalPensionUnavailable(ADDITIONAL_PENSION_REFUSALS[code], detail);
|
|
74
|
-
};
|
|
75
|
-
const roundToPenny = (pounds) => Math.round(pounds * 100) / 100;
|
|
76
|
-
/** The factor at an age and column, or the refusal naming what is
|
|
77
|
-
* missing. */
|
|
78
|
-
function priceAt(rows, firstAge, age, read, what) {
|
|
79
|
-
const row = rows[age - firstAge];
|
|
80
|
-
const value = row === undefined ? undefined : read(row);
|
|
81
|
-
return value ?? refuse('outsideTable', `${what} prints no price at age ${age}`);
|
|
82
|
-
}
|
|
74
|
+
/** The first day both the tables and the limit hold for, compared as
|
|
75
|
+
* dates (see `isoToDate`). */
|
|
76
|
+
const PRICED_FROM = new Date(Math.max(isoToDate(AP_0_703.provenance.implemented).getTime(), isoToDate(ADDITIONAL_PENSION_LIMIT.from).getTime()));
|
|
83
77
|
/**
|
|
84
78
|
* The price of buying `annual` a year of additional pension, as a lump
|
|
85
79
|
* sum or monthly instalments, read from GAD's tables at the member's age
|
|
@@ -93,25 +87,16 @@ function priceAt(rows, firstAge, age, read, what) {
|
|
|
93
87
|
*/
|
|
94
88
|
export function additionalPensionCost(input) {
|
|
95
89
|
const { annual, cover, payment, election, dateOfBirth } = input;
|
|
96
|
-
|
|
97
|
-
if (!wholeUnits) {
|
|
98
|
-
refuse('offUnit', `additional pension is bought in £`
|
|
99
|
-
+ `${ADDITIONAL_PENSION_UNIT} units, not £${annual}`);
|
|
100
|
-
}
|
|
101
|
-
if (annual > ADDITIONAL_PENSION_LIMIT.annual) {
|
|
102
|
-
refuse('overLimit', `£${annual} a year is over the `
|
|
103
|
-
+ `£${ADDITIONAL_PENSION_LIMIT.annual} limit`);
|
|
104
|
-
}
|
|
105
|
-
const outsidePricedDates = election < isoToDate(PRICED_FROM)
|
|
106
|
-
|| election >= isoToDate(ADDITIONAL_PENSION_LIMIT.until);
|
|
107
|
-
if (outsidePricedDates) {
|
|
108
|
-
refuse('outsideDates', `no tables and limit for an election on `
|
|
109
|
-
+ election.toDateString());
|
|
110
|
-
}
|
|
90
|
+
refuseUnpriced(annual, election);
|
|
111
91
|
const units = annual / ADDITIONAL_PENSION_UNIT;
|
|
112
92
|
const age = periodInYearsMonths(dateOfBirth, election).years;
|
|
113
93
|
if (payment.kind === ADDITIONAL_PENSION_PAYMENTS.lumpSum) {
|
|
114
|
-
const factor = priceAt(
|
|
94
|
+
const factor = priceAt({
|
|
95
|
+
rows: AP_0_703.rows,
|
|
96
|
+
firstAge: AP_0_703.firstAge,
|
|
97
|
+
read: (row) => row[cover],
|
|
98
|
+
what: 'Table 0-703',
|
|
99
|
+
}, age);
|
|
115
100
|
return { annual, cover, payment, cost: roundToPenny(units * factor),
|
|
116
101
|
table: AP_0_703.provenance };
|
|
117
102
|
}
|
|
@@ -119,7 +104,12 @@ export function additionalPensionCost(input) {
|
|
|
119
104
|
const npa = normalPensionAge(dateOfBirth);
|
|
120
105
|
const table = INSTALMENT_TABLES.find((t) => t.npa === npa && t.cover === cover);
|
|
121
106
|
invariant(table !== undefined, `no instalment table for a Normal Pension Age of ${npa}`);
|
|
122
|
-
const factor = priceAt(
|
|
107
|
+
const factor = priceAt({
|
|
108
|
+
rows: table.rows,
|
|
109
|
+
firstAge: table.firstAge,
|
|
110
|
+
read: (row) => row[payment.years - 1],
|
|
111
|
+
what: `Table ${table.provenance.tableRef} over ${payment.years} years`,
|
|
112
|
+
}, age);
|
|
123
113
|
return { annual, cover, payment, cost: roundToPenny(units * factor),
|
|
124
114
|
table: table.provenance };
|
|
125
115
|
}
|
|
@@ -160,4 +150,38 @@ export function additionalPensionToBuy(input) {
|
|
|
160
150
|
}
|
|
161
151
|
return annual;
|
|
162
152
|
}
|
|
153
|
+
/** Refuse a purchase no table prices: an amount off the unit or over the
|
|
154
|
+
* limit, or an election outside the dates the tables and limit hold for. */
|
|
155
|
+
function refuseUnpriced(annual, election) {
|
|
156
|
+
const wholeUnits = annual > 0 && annual % ADDITIONAL_PENSION_UNIT === 0;
|
|
157
|
+
if (!wholeUnits) {
|
|
158
|
+
refuse('offUnit', `additional pension is bought in £`
|
|
159
|
+
+ `${ADDITIONAL_PENSION_UNIT} units, not £${annual}`);
|
|
160
|
+
}
|
|
161
|
+
if (annual > ADDITIONAL_PENSION_LIMIT.annual) {
|
|
162
|
+
refuse('overLimit', `£${annual} a year is over the `
|
|
163
|
+
+ `£${ADDITIONAL_PENSION_LIMIT.annual} limit`);
|
|
164
|
+
}
|
|
165
|
+
const outsidePricedDates = election < PRICED_FROM
|
|
166
|
+
|| election >= isoToDate(ADDITIONAL_PENSION_LIMIT.until);
|
|
167
|
+
if (outsidePricedDates) {
|
|
168
|
+
refuse('outsideDates', `no tables and limit for an election on `
|
|
169
|
+
+ election.toDateString());
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
/** The factor at an age in a table's column, or the refusal naming what
|
|
173
|
+
* is missing. */
|
|
174
|
+
function priceAt({ rows, firstAge, read, what }, age) {
|
|
175
|
+
const row = rows[age - firstAge];
|
|
176
|
+
const value = row === undefined ? undefined : read(row);
|
|
177
|
+
return value ?? refuse('outsideTable', `${what} prints no price at age ${age}`);
|
|
178
|
+
}
|
|
179
|
+
/** Refuse a purchase with the code's reason and what was asked. */
|
|
180
|
+
function refuse(code, detail) {
|
|
181
|
+
throw new AdditionalPensionUnavailable(ADDITIONAL_PENSION_REFUSALS[code], detail);
|
|
182
|
+
}
|
|
183
|
+
/** An amount of pounds rounded to the nearest penny. */
|
|
184
|
+
function roundToPenny(pounds) {
|
|
185
|
+
return Math.round(pounds * PENCE_PER_POUND) / PENCE_PER_POUND;
|
|
186
|
+
}
|
|
163
187
|
//# sourceMappingURL=additional-pension.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"additional-pension.js","sourceRoot":"","sources":["../src/additional-pension.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAC,mBAAmB,EAAC,MAAM,YAAY,CAAC;AAC/C,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,SAAS,GACV,MAAM,aAAa,CAAC;AACrB,OAAO,EAAC,cAAc,EAAC,MAAM,mBAAmB,CAAC;AACjD,OAAO,EAA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AAG,GAAG,KAAK,SAAS,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACxD,OAAO,KAAK,IAAI,MAAM,CAAC,cAAc,EAAE,GAAG,IAAI,2BAA2B,GAAG,EAAE,CAAC,CAAC;AAClF,CAAC;AAED,mEAAmE;AACnE,SAAS,MAAM,CACb,IAA8C,EAC9C,MAAc;IAEd,MAAM,IAAI,4BAA4B,CAAC,2BAA2B,CAAC,IAAI,CAAC,EACtE,MAAM,CAAC,CAAC;AACZ,CAAC;AAED,wDAAwD;AACxD,SAAS,YAAY,CAAC,MAAc;IAClC,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,GAAG,eAAe,CAAC,GAAG,eAAe,CAAC;AAChE,CAAC"}
|
package/dist/dates.d.ts
CHANGED
|
@@ -47,6 +47,8 @@ export declare function periodInYearsMonths(from: Date, to: Date): {
|
|
|
47
47
|
export declare function monthsCountingPart(from: Date, to: Date): number;
|
|
48
48
|
/** The day after `date`: the end of a last day, as a period's end. */
|
|
49
49
|
export declare function dayAfter(date: Date): Date;
|
|
50
|
+
/** The day before `date`, as the last day of what ends before it. */
|
|
51
|
+
export declare function dayBefore(date: Date): Date;
|
|
50
52
|
/** Fractional years between two dates, in 365.25-day years —
|
|
51
53
|
* for compounding, never for factor-table lookups (see the
|
|
52
54
|
* module header). */
|
package/dist/dates.js
CHANGED
|
@@ -25,8 +25,18 @@
|
|
|
25
25
|
import { invariant } from './errors.js';
|
|
26
26
|
/** Months in a year, and in a scheme year. */
|
|
27
27
|
export const MONTHS_PER_YEAR = 12;
|
|
28
|
-
const
|
|
29
|
-
const
|
|
28
|
+
const HOURS_PER_DAY = 24;
|
|
29
|
+
const MINUTES_PER_HOUR = 60;
|
|
30
|
+
const SECONDS_PER_MINUTE = 60;
|
|
31
|
+
const MS_PER_SECOND = 1000;
|
|
32
|
+
const MS_PER_DAY = HOURS_PER_DAY * MINUTES_PER_HOUR * SECONDS_PER_MINUTE * MS_PER_SECOND;
|
|
33
|
+
/** The Julian year: the mean year over a leap cycle, so compounding over a
|
|
34
|
+
* span crossing 29 February neither gains nor loses a day. */
|
|
35
|
+
const DAYS_PER_YEAR = 365.25;
|
|
36
|
+
const MS_PER_YEAR = DAYS_PER_YEAR * MS_PER_DAY;
|
|
37
|
+
/** The most days a calendar month has, and so the most a period's days
|
|
38
|
+
* can count once its months are complete. */
|
|
39
|
+
const MOST_DAYS_IN_A_MONTH = 31;
|
|
30
40
|
/**
|
|
31
41
|
* Days a part month must reach to count as a whole one: SI 2015/94
|
|
32
42
|
* Sch 9 para 3(3) counts "an incomplete month that consists of at
|
|
@@ -67,7 +77,7 @@ export function periodInYearsMonths(from, to) {
|
|
|
67
77
|
const years = Math.floor(totalMonths / MONTHS_PER_YEAR);
|
|
68
78
|
const months = totalMonths % MONTHS_PER_YEAR;
|
|
69
79
|
invariant(years >= 0 && months >= 0 && months < MONTHS_PER_YEAR
|
|
70
|
-
&& days >= 0 && days <=
|
|
80
|
+
&& days >= 0 && days <= MOST_DAYS_IN_A_MONTH, `periodInYearsMonths produced an invalid period `
|
|
71
81
|
+ `${years}yr ${months}mo ${days}d for `
|
|
72
82
|
+ `${from.toISOString()} → ${to.toISOString()}`);
|
|
73
83
|
return { years, months, days };
|
|
@@ -88,6 +98,10 @@ export function monthsCountingPart(from, to) {
|
|
|
88
98
|
export function dayAfter(date) {
|
|
89
99
|
return new Date(date.getFullYear(), date.getMonth(), date.getDate() + 1);
|
|
90
100
|
}
|
|
101
|
+
/** The day before `date`, as the last day of what ends before it. */
|
|
102
|
+
export function dayBefore(date) {
|
|
103
|
+
return new Date(date.getFullYear(), date.getMonth(), date.getDate() - 1);
|
|
104
|
+
}
|
|
91
105
|
/** Fractional years between two dates, in 365.25-day years —
|
|
92
106
|
* for compounding, never for factor-table lookups (see the
|
|
93
107
|
* module header). */
|
package/dist/dates.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dates.js","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,MAAM,
|
|
1
|
+
{"version":3,"file":"dates.js","sourceRoot":"","sources":["../src/dates.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;GAuBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAEtC,8CAA8C;AAC9C,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,kBAAkB,GAAG,EAAE,CAAC;AAC9B,MAAM,aAAa,GAAG,IAAI,CAAC;AAC3B,MAAM,UAAU,GACd,aAAa,GAAG,gBAAgB,GAAG,kBAAkB,GAAG,aAAa,CAAC;AACxE;+DAC+D;AAC/D,MAAM,aAAa,GAAG,MAAM,CAAC;AAC7B,MAAM,WAAW,GAAG,aAAa,GAAG,UAAU,CAAC;AAC/C;8CAC8C;AAC9C,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEhC;;;;;GAKG;AACH,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAErC;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CACjC,IAAU,EACV,EAAQ;IAER;;;;;;;;qCAQiC;IACjC,SAAS,CACP,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,EAC7B,mCAAmC,CACpC,CAAC;IACF,SAAS,CACP,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CAAC,OAAO,EAAE,CAAC,EAC3B,iCAAiC,CAClC,CAAC;IACF,IAAI,WAAW,GACb,CAAC,EAAE,CAAC,WAAW,EAAE,GAAG,IA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IAAI,IAAI,CACtB,IAAI,CAAC,WAAW,EAAE,EAClB,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,GAAG,CAAC,EACvB,CAAC,CACF,CAAC,OAAO,EAAE,CAAC;IACZ,OAAO,IAAI,IAAI,CACb,IAAI,CAAC,WAAW,EAAE,EAClB,IAAI,CAAC,QAAQ,EAAE,GAAG,CAAC,EACnB,IAAI,CAAC,GAAG,CAAC,IAAI,CAAC,OAAO,EAAE,EAAE,OAAO,CAAC,CAClC,CAAC;AACJ,CAAC"}
|
package/dist/factor-basis.d.ts
CHANGED
|
@@ -1,15 +1,6 @@
|
|
|
1
|
+
import { LEGACY_PENSION_AGES } from './pension/ages.js';
|
|
1
2
|
import { FactorTable } from './gad/factor-table.js';
|
|
2
3
|
import type { FactorProvenance, FactorTableKind } from './gad/factor-table.js';
|
|
3
|
-
/**
|
|
4
|
-
* The fixed pension ages the legacy sections' factors are measured from,
|
|
5
|
-
* named for the section that sets each. The tables are keyed by pension
|
|
6
|
-
* age (see the header), and these are the only two a legacy benefit has;
|
|
7
|
-
* the 2015 Section's is the member's own Normal Pension Age.
|
|
8
|
-
*/
|
|
9
|
-
export declare const LEGACY_PENSION_AGES: {
|
|
10
|
-
readonly section1995: 60;
|
|
11
|
-
readonly section2008: 65;
|
|
12
|
-
};
|
|
13
4
|
/**
|
|
14
5
|
* The factor tables the library reads, named for what each is for. The
|
|
15
6
|
* value is GAD's own table reference, which is how the table is found in
|
package/dist/factor-basis.js
CHANGED
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
*/
|
|
19
19
|
import { periodInYearsMonths, npaDate } from './dates.js';
|
|
20
20
|
import { invariant } from './errors.js';
|
|
21
|
+
import { LEGACY_PENSION_AGES } from './pension/ages.js';
|
|
21
22
|
import { FactorTable } from './gad/factor-table.js';
|
|
22
23
|
import { ERF_0_420 } from './gad/erf-2023-06-30.js';
|
|
23
24
|
import { LRF_0_421 } from './gad/lrf-2023-06-30.js';
|
|
@@ -26,16 +27,6 @@ import { ERF_1_401 } from './gad/erf-1-401-2023-06-30.js';
|
|
|
26
27
|
import { ERF_1_402 } from './gad/erf-1-402-2023-06-30.js';
|
|
27
28
|
import { ERF_1_407 } from './gad/erf-1-407-2023-06-30.js';
|
|
28
29
|
import { LRF_2_416 } from './gad/lrf-2-416-2023-06-30.js';
|
|
29
|
-
/**
|
|
30
|
-
* The fixed pension ages the legacy sections' factors are measured from,
|
|
31
|
-
* named for the section that sets each. The tables are keyed by pension
|
|
32
|
-
* age (see the header), and these are the only two a legacy benefit has;
|
|
33
|
-
* the 2015 Section's is the member's own Normal Pension Age.
|
|
34
|
-
*/
|
|
35
|
-
export const LEGACY_PENSION_AGES = {
|
|
36
|
-
section1995: 60,
|
|
37
|
-
section2008: 65,
|
|
38
|
-
};
|
|
39
30
|
/**
|
|
40
31
|
* The factor tables the library reads, named for what each is for. The
|
|
41
32
|
* value is GAD's own table reference, which is how the table is found in
|
package/dist/factor-basis.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factor-basis.js","sourceRoot":"","sources":["../src/factor-basis.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AACH,OAAO,EAAC,mBAAmB,EAAE,OAAO,EAAC,MAAM,YAAY,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AACtC,OAAO,EAAC,WAAW,EAAC,MAAM,uBAAuB,CAAC;AAOlD,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,yBAAyB,CAAC;AAClD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MAAM,+BAA+B,CAAC;AACxD,OAAO,EAAC,SAAS,EAAC,MA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
|
|
|
25
25
|
export { isoDate, isoMonth, monthOf, firstOfMonth, monthToDate, isoToDate, isoDateOf, } from './iso-date.js';
|
|
26
26
|
export type { IsoDate, IsoMonth } from './iso-date.js';
|
|
27
27
|
export type { DocumentSourceFields, SourceCurrency, } from './document-source.js';
|
|
28
|
-
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
28
|
+
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, DHSC_PETITION_779519, FA2004_SCH36_PARA_23ZB, SPPA_NHS_CIRCULAR_2025_09, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
29
29
|
export { AWARD_FAMILIES, afcAward, anyNationSettled, awardFamilyFor, awardsFor, changesFor, } from './award.js';
|
|
30
30
|
export type { AwardFamily, ForthcomingChange, PayAward, PayChange, PayScaleId, } from './award.js';
|
|
31
31
|
export { payRound } from './pay-round.js';
|
|
@@ -36,10 +36,10 @@ export { ACTIVE_REVAL_BONUS_PCT, IN_SERVICE_REVALUATION, revaluationFor, } from
|
|
|
36
36
|
export type { RevaluationYear } from './revaluation.js';
|
|
37
37
|
export { buildPayPath, PAY_BASES, promotionalIndex } from './pay-path.js';
|
|
38
38
|
export type { PayBasis, PayPath, YearPay } from './pay-path.js';
|
|
39
|
-
export { ACCRUALS, memberBenefits, PAST_YEARS, PERIOD_KINDS, REMEDY, REMEDY_BASES, SECTION_OPENED, SECTIONS, } from './member
|
|
39
|
+
export { ACCRUALS, memberBenefits, PAST_YEARS, PERIOD_KINDS, REMEDY, REMEDY_BASES, SECTION_OPENED, SECTIONS, } from './member/index.js';
|
|
40
40
|
export { PAY_MEASURES } from './sections/final-salary.js';
|
|
41
41
|
export type { PayMeasure } from './sections/final-salary.js';
|
|
42
|
-
export type { Assumptions, Award, DeclaredPeriod, Holdings, LegacyRules, LegacySectionId, Member, MemberBenefits, PastYears, Position, RemedyBasis, RemedyElection, RetirementChoices, SectionId, ServicePeriod, } from './member
|
|
42
|
+
export type { Assumptions, Award, DeclaredPeriod, Holdings, LegacyRules, LegacySectionId, Member, MemberBenefits, PastYears, Position, RemedyBasis, RemedyElection, RetirementChoices, SectionId, ServicePeriod, } from './member/index.js';
|
|
43
43
|
export type { DeclaredPay, MemberPay } from './pay-path.js';
|
|
44
44
|
export { FACTOR_APPLIES, FACTOR_SOURCES } from './factor-basis.js';
|
|
45
45
|
export type { Applies2015, FactorOutcome } from './factor-basis.js';
|
|
@@ -50,7 +50,8 @@ export { ACCRUAL_RATE, erf2015For, factorProvenance, projectPension, retirementF
|
|
|
50
50
|
export { COMMUTATION_FACTOR, HMRC_LUMP_SUM_CAP_PCT, LUMP_SUM_ALLOWANCE, LUMP_SUM_CAPS, nhsCommutationLimits, VALUATION_FACTOR, commute, } from './commutation.js';
|
|
51
51
|
export type { CommutationLimits, CommutationResult, DatedAmount, LumpSumCap, LumpSumLimit, LumpSumLimits, } from './commutation.js';
|
|
52
52
|
export type { FactorProvenance, FactorTableKind, GadTableProvenance, } from './gad/factor-table.js';
|
|
53
|
-
export { normalPensionAge } from './
|
|
53
|
+
export { firstJoinedOf, LEGACY_PENSION_AGES, mayDrawOn, memberMinimumPensionAge, MPA_KEPT_AGE, MPA_RISE_JOINED_AFTER, normalPensionAge, } from './pension/ages.js';
|
|
54
|
+
export type { JoiningHistory } from './pension/ages.js';
|
|
54
55
|
export type { PensionEstimationInput, PensionProjectionInput, PensionProjectionResult, PensionStatementInput, } from './pension-projection.js';
|
|
55
56
|
export type { ProjectionPoint } from './pension/curve.js';
|
|
56
57
|
export type { ProjectionMoney } from './pension/money.js';
|
package/dist/index.js
CHANGED
|
@@ -20,7 +20,7 @@ export { ADDITIONAL_PENSION_REFUSALS, AdditionalPensionUnavailable, AmbiguousSca
|
|
|
20
20
|
// keeping its own copy of the url.
|
|
21
21
|
export { DocumentSource } from './document-source.js';
|
|
22
22
|
export { isoDate, isoMonth, monthOf, firstOfMonth, monthToDate, isoToDate, isoDateOf, } from './iso-date.js';
|
|
23
|
-
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
23
|
+
export { AFC_ENGLAND_SCALES_2025, AFC_ENGLAND_SCALES_2026, AFC_NI_2025, AFC_SCOTLAND, AFC_SCOTLAND_36_HOUR_WEEK, AFC_W_01_2026, AFC_W_02_2025, AFC_W_02_2026, AP_FACTSHEET_2026, DHSC_PETITION_779519, FA2004_SCH36_PARA_23ZB, SPPA_NHS_CIRCULAR_2025_09, HSC_TC8_05_2025, MD_W_01_2025, MD_W_01_2026, PC_MD_1_2026_R2, PCS_DD_2025_01, PCS_DD_2025_01_ADDENDUM, PCS_DD_2026_01, PCS_DD_2026_02, } from './sources.js';
|
|
24
24
|
// ── Pay awards ───────────────────────────────────
|
|
25
25
|
export { AWARD_FAMILIES, afcAward, anyNationSettled, awardFamilyFor, awardsFor, changesFor, } from './award.js';
|
|
26
26
|
// ── Pay rounds ───────────────────────────────────
|
|
@@ -39,7 +39,7 @@ export { buildPayPath, PAY_BASES, promotionalIndex } from './pay-path.js';
|
|
|
39
39
|
// A member's benefits across every section they hold: built once from
|
|
40
40
|
// the member, asked once per set of retirement choices. The sections
|
|
41
41
|
// themselves are internal.
|
|
42
|
-
export { ACCRUALS, memberBenefits, PAST_YEARS, PERIOD_KINDS, REMEDY, REMEDY_BASES, SECTION_OPENED, SECTIONS, } from './member
|
|
42
|
+
export { ACCRUALS, memberBenefits, PAST_YEARS, PERIOD_KINDS, REMEDY, REMEDY_BASES, SECTION_OPENED, SECTIONS, } from './member/index.js';
|
|
43
43
|
export { PAY_MEASURES } from './sections/final-salary.js';
|
|
44
44
|
export { FACTOR_APPLIES, FACTOR_SOURCES } from './factor-basis.js';
|
|
45
45
|
export { factor2015 } from './sections/section-2015.js';
|
|
@@ -57,8 +57,8 @@ export { ACCRUAL_RATE, erf2015For, factorProvenance, projectPension, retirementF
|
|
|
57
57
|
// the projection has already finished producing. Nothing in
|
|
58
58
|
// the projection calls into it.
|
|
59
59
|
export { COMMUTATION_FACTOR, HMRC_LUMP_SUM_CAP_PCT, LUMP_SUM_ALLOWANCE, LUMP_SUM_CAPS, nhsCommutationLimits, VALUATION_FACTOR, commute, } from './commutation.js';
|
|
60
|
-
// ──
|
|
61
|
-
export { normalPensionAge } from './
|
|
60
|
+
// ── Pension ages ─────────────────────────────────────
|
|
61
|
+
export { firstJoinedOf, LEGACY_PENSION_AGES, mayDrawOn, memberMinimumPensionAge, MPA_KEPT_AGE, MPA_RISE_JOINED_AFTER, normalPensionAge, } from './pension/ages.js';
|
|
62
62
|
// ── The pension ledger ───────────────────────────────
|
|
63
63
|
// A consumer reads the ledger only when it wants the workings.
|
|
64
64
|
export { createPrices, createPublishedPrices, inflationFactor, TODAYS_MONEY_CPI, } from './pension/prices.js';
|
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,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC;AAEzC,OAAO,EACL,SAAS,EACT,YAAY,EACZ,cAAc,EACd,aAAa,EACb,UAAU,EACV,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,UAAU,EACV,iBAAiB,EACjB,eAAe,GAChB,MAAM,aAAa,CAAC;AASrB,oDAAoD;AACpD,OAAO,EACL,YAAY,EACZ,sBAAsB,EACtB,gBAAgB,EAChB,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,eAAe,GAChB,MAAM,cAAc,CAAC;AAUtB,oDAAoD;AACpD,OAAO,EAAC,IAAI,EAAE,cAAc,EAAC,MAAM,WAAW,CAAC;AAU/C,OAAO,EAAC,WAAW,EAAE,cAAc,EAAE,eAAe,EAAC,MAAM,eAAe,CAAC;AAS3E,oDAAoD;AACpD,OAAO,EACL,cAAc,EACd,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,GACpB,MAAM,qBAAqB,CAAC;AAK7B,OAAO,EACL,aAAa,EACb,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,GAChB,MAAM,oBAAoB,CAAC;AAK5B,oDAAoD;AACpD,OAAO,EACL,wBAAwB,EACxB,2BAA2B,EAC3B,uBAAuB,EACvB,qBAAqB,EACrB,sBAAsB,GACvB,MAAM,yBAAyB,CAAC;AAKjC,OAAO,EAAC,yBAAyB,EAAC,MAAM,mCAAmC,CAAC;AAK5E,oDAAoD;AACpD,OAAO,EACL,2BAA2B,EAC3B,4BAA4B,EAC5B,mBAAmB,EACnB,gBAAgB,EAChB,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,uBAAuB,EACvB,0BAA0B,EAC1B,gBAAgB,GACjB,MAAM,aAAa,CAAC;AAGrB,oDAAoD;AACpD,uEAAuE;AACvE,sEAAsE;AACtE,mCAAmC;AACnC,OAAO,EAAC,cAAc,EAAC,MAAM,sBAAsB,CAAC;AACpD,OAAO,EACL,OAAO,EACP,QAAQ,EACR,OAAO,EACP,YAAY,EACZ,WAAW,EACX,SAAS,EACT,SAAS,GACV,MAAM,eAAe,CAAC;AAMvB,OAAO,EACL,uBAAuB,EACvB,uBAAuB,EACvB,WAAW,EACX,YAAY,EACZ,yBAAyB,EACzB,aAAa,EACb,aAAa,EACb,aAAa,EACb,iBAAiB,EACjB,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,eAAe,EACf,cAAc,EACd,uBAAuB,EACvB,cAAc,EACd,cAAc,GACf,MAAM,cAAc,CAAC;AAEtB,oDAAoD;AACpD,OAAO,EACL,cAAc,EACd,QAAQ,EACR,gBAAgB,EAChB,cAAc,EACd,SAAS,EACT,UAAU,GACX,MAAM,YAAY,CAAC;AASpB,oDAAoD;AACpD,sEAAsE;AACtE,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,gBAAgB,CAAC;AAGxC,oDAAoD;AACpD,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,gBAAgB,GACjB,MAAM,iBAAiB,CAAC;AAMzB,OAAO,EACL,sBAAsB,EACtB,sBAAsB,EACtB,cAAc,GACf,MAAM,kBAAkB,CAAC;AAG1B,sDAAsD;AACtD,sEAAsE;AACtE,uEAAuE;AACvE,YAAY;AACZ,OAAO,EAAC,YAAY,EAAE,SAAS,EAAE,gBAAgB,EAAC,MAAM,eAAe,CAAC;AAGxE,sDAAsD;AACtD,sEAAsE;AACtE,qEAAqE;AACrE,2BAA2B;AAC3B,OAAO,EACL,QAAQ,EACR,cAAc,EACd,UAAU,EACV,YAAY,EACZ,MAAM,EACN,YAAY,EACZ,cAAc,EACd,QAAQ,GACT,MAAM,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,oDAAoD;AACpD,OAAO,EAAC,QAAQ,EAAC,MAAM,iBAAiB,CAAC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AM,cAAc,CAAC;AAMtB,oDAAoD;AACpD,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,YAAY,GACb,MAAM,YAAY,CAAC;AAMpB,oDAAoD;AACpD,OAAO,EAAC,kBAAkB,EAAE,WAAW,EAAC,MAAM,gBAAgB,CAAC;AAE/D,iDAAiD;AACjD,OAAO,EAAC,cAAc,EAAE,cAAc,EAAE,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAG/E,oDAAoD;AACpD,OAAO,EACL,QAAQ,EACR,MAAM,EACN,SAAS,EACT,SAAS,EACT,gBAAgB,EAChB,SAAS,EACT,gBAAgB,EAChB,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,GACjB,MAAM,sBAAsB,CAAC"}
|
package/dist/iso-date.d.ts
CHANGED
|
@@ -10,15 +10,10 @@
|
|
|
10
10
|
* right one is the worst failure this data has, so the type system
|
|
11
11
|
* carries the distinction.
|
|
12
12
|
*
|
|
13
|
-
* Lives here rather than in `@casomoltd/paye-calc
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* it
|
|
17
|
-
*
|
|
18
|
-
* The concrete cost of NOT having this, before it existed: a consumer
|
|
19
|
-
* bridged the two precisions by writing `` `${award.expectedInPay}-01` ``
|
|
20
|
-
* — a hand-rolled splice on a month field, in the same codebase whose
|
|
21
|
-
* production error log was carrying `RangeError: Invalid Date`.
|
|
13
|
+
* Lives here rather than in `@casomoltd/paye-calc` because these brands
|
|
14
|
+
* guard text entering this library: a member's declared dates arrive as
|
|
15
|
+
* JSON-safe strings. paye-calc takes no dates as text, only `Date` values
|
|
16
|
+
* a caller builds, so it has no such boundary to guard.
|
|
22
17
|
*/
|
|
23
18
|
/** A 'YYYY-MM' month. Precision is part of the type. */
|
|
24
19
|
export type IsoMonth = string & {
|
package/dist/iso-date.js
CHANGED
|
@@ -10,15 +10,10 @@
|
|
|
10
10
|
* right one is the worst failure this data has, so the type system
|
|
11
11
|
* carries the distinction.
|
|
12
12
|
*
|
|
13
|
-
* Lives here rather than in `@casomoltd/paye-calc
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
* it
|
|
17
|
-
*
|
|
18
|
-
* The concrete cost of NOT having this, before it existed: a consumer
|
|
19
|
-
* bridged the two precisions by writing `` `${award.expectedInPay}-01` ``
|
|
20
|
-
* — a hand-rolled splice on a month field, in the same codebase whose
|
|
21
|
-
* production error log was carrying `RangeError: Invalid Date`.
|
|
13
|
+
* Lives here rather than in `@casomoltd/paye-calc` because these brands
|
|
14
|
+
* guard text entering this library: a member's declared dates arrive as
|
|
15
|
+
* JSON-safe strings. paye-calc takes no dates as text, only `Date` values
|
|
16
|
+
* a caller builds, so it has no such boundary to guard.
|
|
22
17
|
*/
|
|
23
18
|
import { invariant } from './errors.js';
|
|
24
19
|
/**
|
|
@@ -43,13 +38,17 @@ export function isoDate(value) {
|
|
|
43
38
|
invariant(/^\d{4}-\d{2}-\d{2}$/.test(value), `not a 'YYYY-MM-DD' date: ${value}`);
|
|
44
39
|
return value;
|
|
45
40
|
}
|
|
41
|
+
/** The characters of 'YYYY-MM', the month at the head of an ISO date. */
|
|
42
|
+
const ISO_MONTH_LENGTH = 'YYYY-MM'.length;
|
|
43
|
+
/** The digits of an ISO date's month and day. */
|
|
44
|
+
const ISO_PART_DIGITS = 'MM'.length;
|
|
46
45
|
/**
|
|
47
46
|
* The month a date falls in. The ONE place a day is deliberately
|
|
48
47
|
* dropped, named so the loss shows at the call site instead of inside
|
|
49
48
|
* a `String.slice` nobody reads.
|
|
50
49
|
*/
|
|
51
50
|
export function monthOf(date) {
|
|
52
|
-
return isoMonth(date.slice(0,
|
|
51
|
+
return isoMonth(date.slice(0, ISO_MONTH_LENGTH));
|
|
53
52
|
}
|
|
54
53
|
/**
|
|
55
54
|
* A month read as its first day.
|
|
@@ -101,7 +100,7 @@ export function isoToDate(iso) {
|
|
|
101
100
|
* before for any local midnight east of Greenwich in summer time.
|
|
102
101
|
*/
|
|
103
102
|
export function isoDateOf(date) {
|
|
104
|
-
const pad = (n) => String(n).padStart(
|
|
103
|
+
const pad = (n) => String(n).padStart(ISO_PART_DIGITS, '0');
|
|
105
104
|
return isoDate(`${date.getFullYear()}-${pad(date.getMonth() + 1)}-`
|
|
106
105
|
+ pad(date.getDate()));
|
|
107
106
|
}
|
package/dist/iso-date.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"iso-date.js","sourceRoot":"","sources":["../src/iso-date.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"iso-date.js","sourceRoot":"","sources":["../src/iso-date.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EAAC,SAAS,EAAC,MAAM,aAAa,CAAC;AAQtC;;;GAGG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAa;IACpC,SAAS,CACP,eAAe,CAAC,IAAI,CAAC,KAAK,CAAC,EAC3B,0BAA0B,KAAK,EAAE,CAClC,CAAC;IACF,OAAO,KAAiB,CAAC;AAC3B,CAAC;AAED;;;;;;;;;GASG;AACH,MAAM,UAAU,OAAO,CAAC,KAAa;IACnC,SAAS,CACP,qBAAqB,CAAC,IAAI,CAAC,KAAK,CAAC,EACjC,4BAA4B,KAAK,EAAE,CACpC,CAAC;IACF,OAAO,KAAgB,CAAC;AAC1B,CAAC;AAED,yEAAyE;AACzE,MAAM,gBAAgB,GAAG,SAAS,CAAC,MAAM,CAAC;AAE1C,iDAAiD;AACjD,MAAM,eAAe,GAAG,IAAI,CAAC,MAAM,CAAC;AAEpC;;;;GAIG;AACH,MAAM,UAAU,OAAO,CAAC,IAAa;IACnC,OAAO,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,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available` where there
|
|
4
|
+
* is no current pay to build pay from, `BenefitNotModelled` for service
|
|
5
|
+
* the library does not model, and RangeError for a declaration that
|
|
6
|
+
* cannot be true.
|
|
7
|
+
*
|
|
8
|
+
* `today` is required because it decides which answer comes back: it
|
|
9
|
+
* is the date the figures are as at, so a figure reproduces as at it.
|
|
10
|
+
*/
|
|
11
|
+
export declare function memberBenefits(member: Member, assumptions: Assumptions, today: Date): MemberBenefits;
|