@adminiumjs/manifest 0.3.79 → 0.3.81

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 (144) hide show
  1. package/dist/change-guards.d.ts +2 -0
  2. package/dist/change-guards.d.ts.map +1 -1
  3. package/dist/change-guards.js +7 -2
  4. package/dist/change-guards.js.map +1 -1
  5. package/dist/compose.d.ts.map +1 -1
  6. package/dist/compose.js +3 -0
  7. package/dist/compose.js.map +1 -1
  8. package/dist/expiry-notice.d.ts +68 -0
  9. package/dist/expiry-notice.d.ts.map +1 -0
  10. package/dist/expiry-notice.js +75 -0
  11. package/dist/expiry-notice.js.map +1 -0
  12. package/dist/from-template.d.ts +52 -0
  13. package/dist/from-template.d.ts.map +1 -0
  14. package/dist/from-template.js +89 -0
  15. package/dist/from-template.js.map +1 -0
  16. package/dist/index.d.ts +10 -1
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +10 -1
  19. package/dist/index.js.map +1 -1
  20. package/dist/instance.d.ts +2 -1
  21. package/dist/instance.d.ts.map +1 -1
  22. package/dist/instance.js +1 -0
  23. package/dist/instance.js.map +1 -1
  24. package/dist/leave/away.d.ts +67 -0
  25. package/dist/leave/away.d.ts.map +1 -0
  26. package/dist/leave/away.js +74 -0
  27. package/dist/leave/away.js.map +1 -0
  28. package/dist/leave/civil.d.ts +35 -0
  29. package/dist/leave/civil.d.ts.map +1 -0
  30. package/dist/leave/civil.js +75 -0
  31. package/dist/leave/civil.js.map +1 -0
  32. package/dist/leave/close-line.d.ts +91 -0
  33. package/dist/leave/close-line.d.ts.map +1 -0
  34. package/dist/leave/close-line.js +90 -0
  35. package/dist/leave/close-line.js.map +1 -0
  36. package/dist/leave/count.d.ts +82 -0
  37. package/dist/leave/count.d.ts.map +1 -0
  38. package/dist/leave/count.js +129 -0
  39. package/dist/leave/count.js.map +1 -0
  40. package/dist/leave/deciders.d.ts +81 -0
  41. package/dist/leave/deciders.d.ts.map +1 -0
  42. package/dist/leave/deciders.js +158 -0
  43. package/dist/leave/deciders.js.map +1 -0
  44. package/dist/leave/earning-year.d.ts +34 -0
  45. package/dist/leave/earning-year.d.ts.map +1 -0
  46. package/dist/leave/earning-year.js +113 -0
  47. package/dist/leave/earning-year.js.map +1 -0
  48. package/dist/leave/entitlement.d.ts +104 -0
  49. package/dist/leave/entitlement.d.ts.map +1 -0
  50. package/dist/leave/entitlement.js +59 -0
  51. package/dist/leave/entitlement.js.map +1 -0
  52. package/dist/leave/floors.d.ts +33 -0
  53. package/dist/leave/floors.d.ts.map +1 -0
  54. package/dist/leave/floors.js +55 -0
  55. package/dist/leave/floors.js.map +1 -0
  56. package/dist/leave/index.d.ts +26 -0
  57. package/dist/leave/index.d.ts.map +1 -0
  58. package/dist/leave/index.js +27 -0
  59. package/dist/leave/index.js.map +1 -0
  60. package/dist/leave/notice-gate.d.ts +41 -0
  61. package/dist/leave/notice-gate.d.ts.map +1 -0
  62. package/dist/leave/notice-gate.js +27 -0
  63. package/dist/leave/notice-gate.js.map +1 -0
  64. package/dist/leave/preset-czechia.d.ts +10 -0
  65. package/dist/leave/preset-czechia.d.ts.map +1 -0
  66. package/dist/leave/preset-czechia.js +69 -0
  67. package/dist/leave/preset-czechia.js.map +1 -0
  68. package/dist/leave/preset-denmark.d.ts +24 -0
  69. package/dist/leave/preset-denmark.d.ts.map +1 -0
  70. package/dist/leave/preset-denmark.js +31 -0
  71. package/dist/leave/preset-denmark.js.map +1 -0
  72. package/dist/leave/preset-england-wales.d.ts +10 -0
  73. package/dist/leave/preset-england-wales.d.ts.map +1 -0
  74. package/dist/leave/preset-england-wales.js +67 -0
  75. package/dist/leave/preset-england-wales.js.map +1 -0
  76. package/dist/leave/preset-france.d.ts +30 -0
  77. package/dist/leave/preset-france.d.ts.map +1 -0
  78. package/dist/leave/preset-france.js +31 -0
  79. package/dist/leave/preset-france.js.map +1 -0
  80. package/dist/leave/preset-germany.d.ts +30 -0
  81. package/dist/leave/preset-germany.d.ts.map +1 -0
  82. package/dist/leave/preset-germany.js +92 -0
  83. package/dist/leave/preset-germany.js.map +1 -0
  84. package/dist/leave/preset-us.d.ts +8 -0
  85. package/dist/leave/preset-us.d.ts.map +1 -0
  86. package/dist/leave/preset-us.js +48 -0
  87. package/dist/leave/preset-us.js.map +1 -0
  88. package/dist/leave/replay.d.ts +126 -0
  89. package/dist/leave/replay.d.ts.map +1 -0
  90. package/dist/leave/replay.js +158 -0
  91. package/dist/leave/replay.js.map +1 -0
  92. package/dist/leave/state.d.ts +64 -0
  93. package/dist/leave/state.d.ts.map +1 -0
  94. package/dist/leave/state.js +74 -0
  95. package/dist/leave/state.js.map +1 -0
  96. package/dist/leave/told.d.ts +37 -0
  97. package/dist/leave/told.d.ts.map +1 -0
  98. package/dist/leave/told.js +32 -0
  99. package/dist/leave/told.js.map +1 -0
  100. package/dist/leave/units.d.ts +21 -0
  101. package/dist/leave/units.d.ts.map +1 -0
  102. package/dist/leave/units.js +21 -0
  103. package/dist/leave/units.js.map +1 -0
  104. package/dist/leave-shape.d.ts +326 -0
  105. package/dist/leave-shape.d.ts.map +1 -0
  106. package/dist/leave-shape.js +166 -0
  107. package/dist/leave-shape.js.map +1 -0
  108. package/dist/leave-word.d.ts +90 -0
  109. package/dist/leave-word.d.ts.map +1 -0
  110. package/dist/leave-word.js +255 -0
  111. package/dist/leave-word.js.map +1 -0
  112. package/dist/outbox.d.ts +2 -0
  113. package/dist/outbox.d.ts.map +1 -1
  114. package/dist/outbox.js +5 -0
  115. package/dist/outbox.js.map +1 -1
  116. package/dist/person-import.d.ts +98 -0
  117. package/dist/person-import.d.ts.map +1 -0
  118. package/dist/person-import.js +270 -0
  119. package/dist/person-import.js.map +1 -0
  120. package/dist/record-classes.d.ts +99 -0
  121. package/dist/record-classes.d.ts.map +1 -0
  122. package/dist/record-classes.js +123 -0
  123. package/dist/record-classes.js.map +1 -0
  124. package/dist/removal.d.ts +1 -0
  125. package/dist/removal.d.ts.map +1 -1
  126. package/dist/removal.js +2 -0
  127. package/dist/removal.js.map +1 -1
  128. package/dist/roles.d.ts +23 -1
  129. package/dist/roles.d.ts.map +1 -1
  130. package/dist/roles.js +34 -5
  131. package/dist/roles.js.map +1 -1
  132. package/dist/schema.d.ts +625 -0
  133. package/dist/schema.d.ts.map +1 -1
  134. package/dist/schema.js +134 -14
  135. package/dist/schema.js.map +1 -1
  136. package/dist/staff-accounts.d.ts +102 -0
  137. package/dist/staff-accounts.d.ts.map +1 -0
  138. package/dist/staff-accounts.js +179 -0
  139. package/dist/staff-accounts.js.map +1 -0
  140. package/dist/words.d.ts +1 -1
  141. package/dist/words.d.ts.map +1 -1
  142. package/dist/words.js +85 -0
  143. package/dist/words.js.map +1 -1
  144. package/package.json +2 -2
@@ -0,0 +1,67 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * England and Wales: a starting point, to check with your adviser. Not for
4
+ * irregular-hours workers.
5
+ *
6
+ * The policy's days a year (`days_per_year`, bank holidays included) are the
7
+ * allowance: 33 when it names none, never below the 28 of 5.6 weeks
8
+ * (`floors.ts`). Full time is that less the 8 bank holidays, with the public
9
+ * holidays on top (25 days plus them by default). Part time is the whole
10
+ * figure × the share ((25 + 8) × the share), with the public holidays on their
11
+ * days taken from it. A change of terms keeps each term's own rule. Up to 5
12
+ * days carry to 31 March. What it does not model is `ENGLAND_WALES_LIMITS`.
13
+ */
14
+ import { daysBetween, daysInYear, yearEnd } from './civil.js';
15
+ import { shareOf, termsInYear } from './entitlement.js';
16
+ import { statutoryFloorOf } from './floors.js';
17
+ /** The days a year, bank holidays included, when a policy names none. */
18
+ export const ENGLAND_WALES_DEFAULT_DAYS = 33;
19
+ /** The bank holidays a full timer has on top of the rest. */
20
+ const BANK_HOLIDAYS = 8;
21
+ const gcd = (a, b) => (b === 0 ? a : gcd(b, a % b));
22
+ const fraction = (share) => `${String(share / gcd(share, 1000))}/${String(1000 / gcd(share, 1000))}`;
23
+ function lotsWith(days, person, year) {
24
+ const rest = days - BANK_HOLIDAYS;
25
+ return termsInYear(person, year).map((part) => {
26
+ const within = part.share < 1000;
27
+ const base = within ? days * part.share : rest * 1000;
28
+ const amount = shareOf(base, { numerator: daysBetween(part.from, part.to) + 1, denominator: daysInYear(year) });
29
+ return {
30
+ kind: 'grant',
31
+ tier: null,
32
+ usableFrom: part.from,
33
+ expiresOn: yearEnd(year),
34
+ amount,
35
+ rule: within ? `England ${String(year)}: (${String(rest)} + ${String(BANK_HOLIDAYS)}) × ${fraction(part.share)}, public holidays within` : `England ${String(year)}: ${String(rest)} days plus public holidays`,
36
+ ...(within ? { holidaysWithin: true } : {}),
37
+ };
38
+ });
39
+ }
40
+ /** What this preset does not do, for the setup screen and the adviser. */
41
+ export const ENGLAND_WALES_LIMITS = [
42
+ 'Not for irregular-hours or part-year workers: their holiday builds up at 12.07% of the hours they work, which this preset does not count.',
43
+ 'Gives a joiner their days for the year at once, pro rata. The rule that a worker in their first year builds up a twelfth a month is left to the policy.',
44
+ 'Runs the leave year from January to December. A leave year that starts on another day (often 1 April) is not modelled.',
45
+ 'Carries up to 5 days to 31 March by itself. Days a person could not take because of sickness or family leave carry only when HR records a reason.',
46
+ 'Records sickness but works out no statutory sick pay.',
47
+ 'Time off in lieu has no rule in law: any TOIL is the policy\'s own.',
48
+ 'Works out no holiday pay: not the 52-week average for pay that varies, nor what is paid for untaken days on leaving. The leaver\'s statement gives the days.',
49
+ ];
50
+ /** The preset with a policy's own days a year; a figure below the floor counts as the floor, and none as the default, marked for HR to confirm. */
51
+ export const englandWalesWith = (confirmed) => {
52
+ const days = confirmed === undefined || confirmed === null ? ENGLAND_WALES_DEFAULT_DAYS : Math.max(confirmed, statutoryFloorOf('england-wales').days);
53
+ return {
54
+ key: 'england-wales',
55
+ defaults: confirmed === undefined || confirmed === null ? [{ field: 'days_per_year', value: ENGLAND_WALES_DEFAULT_DAYS, isDefault: true, legalFigure: false, confirmBy: 'hr' }] : [],
56
+ minNoticeDays: 90,
57
+ graceDays: 14,
58
+ carry: { units: 5000, until: '03-31' },
59
+ holdLimitMonths: null,
60
+ holidaysWithin: (share) => share < 1000,
61
+ lotsFor: (person, year) => lotsWith(days, person, year),
62
+ limits: ENGLAND_WALES_LIMITS,
63
+ };
64
+ };
65
+ /** On the default figure. */
66
+ export const englandWales = englandWalesWith(null);
67
+ //# sourceMappingURL=preset-england-wales.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-england-wales.js","sourceRoot":"","sources":["../../src/leave/preset-england-wales.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;GAWG;AACH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,WAAW,EAA0D,MAAM,kBAAkB,CAAC;AAChH,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,yEAAyE;AACzE,MAAM,CAAC,MAAM,0BAA0B,GAAG,EAAE,CAAC;AAC7C,6DAA6D;AAC7D,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,MAAM,GAAG,GAAG,CAAC,CAAS,EAAE,CAAS,EAAU,EAAE,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;AAC5E,MAAM,QAAQ,GAAG,CAAC,KAAa,EAAU,EAAE,CAAC,GAAG,MAAM,CAAC,KAAK,GAAG,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,IAAI,MAAM,CAAC,IAAI,GAAG,GAAG,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC,EAAE,CAAC;AAErH,SAAS,QAAQ,CAAC,IAAY,EAAE,MAAyB,EAAE,IAAY;IACrE,MAAM,IAAI,GAAG,IAAI,GAAG,aAAa,CAAC;IAClC,OAAO,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAA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AAe,EAAE;IACzE,MAAM,IAAI,GAAG,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,0BAA0B,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,gBAAgB,CAAC,eAAe,CAAE,CAAC,IAAI,CAAC,CAAC;IACvJ,OAAO;QACL,GAAG,EAAE,eAAe;QACpB,QAAQ,EAAE,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,0BAA0B,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;QACpL,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;QACtC,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,GAAG,IAAI;QACvC,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC;QACvD,MAAM,EAAE,oBAAoB;KAC7B,CAAC;AACJ,CAAC,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,YAAY,GAAgB,gBAAgB,CAAC,IAAI,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * France (congés payés): a starting point, to check with your adviser.
3
+ *
4
+ * Counted in working days of a five-day week (jours ouvrés), the unit every
5
+ * preset's `days_per_year` is in: the law's 30 days counted Monday to
6
+ * Saturday (jours ouvrables) are 25 on five days. Counting 30 on a five-day
7
+ * pattern would give six weeks instead of five.
8
+ *
9
+ * The policy's days a year (25 when it names none, never below 25:
10
+ * `floors.ts`) × the share, earned month by month over the reference year,
11
+ * 1 June to 31 May, and that year's figure rounded up to a whole day. Days can
12
+ * be taken as they are earned. A reference year's days are kept to the
13
+ * 31 December after it ends, and what is left then carries to 31 May, so the
14
+ * days earned to 31 May 2027 can be taken to 31 May 2028.
15
+ *
16
+ * Not modelled (`FRANCE_LIMITS`): the extra days for taking leave outside
17
+ * 1 May to 31 October, earning at 2 days a month while sick, other absences
18
+ * that do not count as work, a taking period the firm sets differently, and
19
+ * the 15 months a person back from sickness has from their notice.
20
+ */
21
+ import type { LeavePreset } from './entitlement.js';
22
+ /** The days a year when a policy names none: the law's five weeks. */
23
+ export declare const FRANCE_DEFAULT_DAYS = 25;
24
+ /** What this preset does not do, for the setup screen and the adviser. */
25
+ export declare const FRANCE_LIMITS: readonly string[];
26
+ /** The preset with a policy's own days a year; a figure below the floor counts as the floor, and none as the default, marked for HR to confirm. */
27
+ export declare const franceWith: (confirmed?: number | null) => LeavePreset;
28
+ /** On the default figure. */
29
+ export declare const france: LeavePreset;
30
+ //# sourceMappingURL=preset-france.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-france.d.ts","sourceRoot":"","sources":["../../src/leave/preset-france.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;GAmBG;AACH,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAIpD,sEAAsE;AACtE,eAAO,MAAM,mBAAmB,KAAK,CAAC;AAEtC,0EAA0E;AAC1E,eAAO,MAAM,aAAa,EAAE,SAAS,MAAM,EAM1C,CAAC;AAEF,mJAAmJ;AACnJ,eAAO,MAAM,UAAU,GAAI,YAAY,MAAM,GAAG,IAAI,KAAG,WAatD,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,MAAM,EAAE,WAA8B,CAAC"}
@@ -0,0 +1,31 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ import { earningYearLots } from './earning-year.js';
3
+ import { statutoryFloorOf } from './floors.js';
4
+ /** The days a year when a policy names none: the law's five weeks. */
5
+ export const FRANCE_DEFAULT_DAYS = 25;
6
+ /** What this preset does not do, for the setup screen and the adviser. */
7
+ export const FRANCE_LIMITS = [
8
+ 'Counts in working days of a five-day week (jours ouvrés): 25 a year, not 30 counted Monday to Saturday.',
9
+ 'Does not add the one or two extra days for taking part of the main leave outside 1 May to 31 October (fractionnement). Add them by hand.',
10
+ 'Earns the full rate in every month employed: it does not lower what is earned while sick (2 days a month counted Monday to Saturday) or on other absences that do not count as work.',
11
+ 'Keeps a reference year\'s days to the 31 December after it ends and carries what is left to 31 May. A firm that sets another taking period must check its dates.',
12
+ 'Does not count the 15 months a person back from sickness has to take their days from the notice they get on return. Record a reason to carry them.',
13
+ ];
14
+ /** The preset with a policy's own days a year; a figure below the floor counts as the floor, and none as the default, marked for HR to confirm. */
15
+ export const franceWith = (confirmed) => {
16
+ const days = confirmed === undefined || confirmed === null ? FRANCE_DEFAULT_DAYS : Math.max(confirmed, statutoryFloorOf('france').days);
17
+ return {
18
+ key: 'france',
19
+ defaults: confirmed === undefined || confirmed === null ? [{ field: 'days_per_year', value: FRANCE_DEFAULT_DAYS, isDefault: true, legalFigure: false, confirmBy: 'hr' }] : [],
20
+ minNoticeDays: 90,
21
+ graceDays: 14,
22
+ carry: { units: null, until: '05-31' },
23
+ holdLimitMonths: null,
24
+ holidaysWithin: () => false,
25
+ lotsFor: (person, year) => earningYearLots({ startMonth: 6, days, roundTo: 'day', label: 'France' }, person, year),
26
+ limits: FRANCE_LIMITS,
27
+ };
28
+ };
29
+ /** On the default figure. */
30
+ export const france = franceWith(null);
31
+ //# sourceMappingURL=preset-france.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-france.js","sourceRoot":"","sources":["../../src/leave/preset-france.ts"],"names":[],"mappings":";AAsBA,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAE/C,sEAAsE;AACtE,MAAM,CAA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C,IAAI,CAAC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Germany (BUrlG): a starting point, to check with your adviser.
3
+ *
4
+ * 20 statutory days and the rest of the policy's days a year (`days_per_year`,
5
+ * 28 when it names none, never below 20: `floors.ts`) as extra, at full time,
6
+ * each times the share, kept as two lots (one when there is nothing extra). A joiner or leaver gets the rounding of BUrlG section 5 on the
7
+ * statutory days; a change of terms inside a year is shared by `termFractions`.
8
+ * Nothing carries without a reason, and a held lot goes to HR 15 months after
9
+ * the leave year. What it does not model is `GERMANY_LIMITS`.
10
+ */
11
+ import { type CivilDay } from './civil.js';
12
+ import { type LeavePreset } from './entitlement.js';
13
+ /** The days a year when a policy names none: 20 statutory and 8 extra. */
14
+ export declare const GERMANY_DEFAULT_DAYS = 28;
15
+ /** One term's year, for a person who joined or left in it or neither. */
16
+ export declare function germanEntitlement(start: CivilDay, end: CivilDay | null, year: number, share?: number, days?: number): {
17
+ statutory: number;
18
+ extra: number;
19
+ months: number;
20
+ full: boolean;
21
+ };
22
+ /** What this preset does not do, for the setup screen and the adviser. */
23
+ export declare const GERMANY_LIMITS: readonly string[];
24
+ /** The preset with a policy's own days a year; a figure below the floor counts as the floor, and none as the default, marked for HR to confirm. */
25
+ export declare const germanyWith: (confirmed?: number | null) => LeavePreset;
26
+ /** On the default figure. */
27
+ export declare const germany: LeavePreset;
28
+ /** The day a held lot of a leave year reaches its limit. */
29
+ export declare const holdLimitDay: (sourceYear: number, months: number) => CivilDay;
30
+ //# sourceMappingURL=preset-germany.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-germany.d.ts","sourceRoot":"","sources":["../../src/leave/preset-germany.ts"],"names":[],"mappings":"AACA;;;;;;;;;GASG;AACH,OAAO,EAA4E,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACrH,OAAO,EAA+D,KAAK,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAK/H,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,KAAK,CAAC;AAevC,yEAAyE;AACzE,wBAAgB,iBAAiB,CAAC,KAAK,EAAE,QAAQ,EAAE,GAAG,EAAE,QAAQ,GAAG,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,KAAK,SAAO,EAAE,IAAI,SAAuB,GAAG;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,OAAO,CAAA;CAAE,CAYrM;AAsBD,0EAA0E;AAC1E,eAAO,MAAM,cAAc,EAAE,SAAS,MAAM,EAQ3C,CAAC;AAEF,mJAAmJ;AACnJ,eAAO,MAAM,WAAW,GAAI,YAAY,MAAM,GAAG,IAAI,KAAG,WAavD,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,OAAO,EAAE,WAA+B,CAAC;AAEtD,4DAA4D;AAC5D,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,EAAE,QAAQ,MAAM,KAAG,QAAkD,CAAC"}
@@ -0,0 +1,92 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * Germany (BUrlG): a starting point, to check with your adviser.
4
+ *
5
+ * 20 statutory days and the rest of the policy's days a year (`days_per_year`,
6
+ * 28 when it names none, never below 20: `floors.ts`) as extra, at full time,
7
+ * each times the share, kept as two lots (one when there is nothing extra). A joiner or leaver gets the rounding of BUrlG section 5 on the
8
+ * statutory days; a change of terms inside a year is shared by `termFractions`.
9
+ * Nothing carries without a reason, and a held lot goes to HR 15 months after
10
+ * the leave year. What it does not model is `GERMANY_LIMITS`.
11
+ */
12
+ import { addDays, addMonths, fullMonths, laterDay, earlierDay, yearEnd, yearStart } from './civil.js';
13
+ import { shareOf, termFractions, termsInYear } from './entitlement.js';
14
+ import { statutoryFloorOf } from './floors.js';
15
+ import { ceilDiv, floorDiv } from './units.js';
16
+ const STATUTORY = 20;
17
+ /** The days a year when a policy names none: 20 statutory and 8 extra. */
18
+ export const GERMANY_DEFAULT_DAYS = 28;
19
+ /** BUrlG section 5: a part of a day of at least a half rounds up to a whole day; anything less stays as it is, in thousandths. */
20
+ function statutoryPartial(base, months) {
21
+ const whole = floorDiv(base * months, 12_000);
22
+ const rest = base * months - whole * 12_000;
23
+ return rest * 2 >= 12_000 ? (whole + 1) * 1000 : ceilDiv(base * months, 12);
24
+ }
25
+ /** Six months on, kept inside the month's first 28 days, as the waiting period is counted. */
26
+ function sixMonthsOn(start) {
27
+ const clipped = `${start.slice(0, 8)}${String(Math.min(Number(start.slice(8)), 28)).padStart(2, '0')}`;
28
+ return addMonths(clipped, 6);
29
+ }
30
+ /** One term's year, for a person who joined or left in it or neither. */
31
+ export function germanEntitlement(start, end, year, share = 1000, days = GERMANY_DEFAULT_DAYS) {
32
+ const first = yearStart(year);
33
+ const last = yearEnd(year);
34
+ const from = laterDay(start, first);
35
+ const to = end === null ? last : earlierDay(end, last);
36
+ const statutory = STATUTORY * share;
37
+ const extra = (days - STATUTORY) * share;
38
+ const months = fullMonths(from, to);
39
+ const joined = start >= first;
40
+ const left = end !== null && end <= last;
41
+ const full = left ? sixMonthsOn(start) <= addDays(end, 1) && end >= `${String(year)}-07-01` : joined ? start <= `${String(year)}-07-01` : true;
42
+ return { statutory: full ? statutory : statutoryPartial(statutory, months), extra: months === 12 ? extra : ceilDiv(extra * months, 12), months, full };
43
+ }
44
+ function lotsWith(days, person, year) {
45
+ const parts = termsInYear(person, year);
46
+ const extraDays = days - STATUTORY;
47
+ const lot = (tier, from, amount) => ({
48
+ kind: 'grant',
49
+ tier,
50
+ usableFrom: from,
51
+ expiresOn: yearEnd(year),
52
+ amount,
53
+ rule: `de-burlg ${String(year)}: ${tier === 'statutory' ? 'statutory' : 'extra days'}`,
54
+ });
55
+ // A policy at the statutory floor has no extra days: no empty lot for them.
56
+ const lots = (statutory, extra) => (extraDays > 0 ? [statutory, extra] : [statutory]);
57
+ if (parts.length === 1) {
58
+ const figures = germanEntitlement(person.started, person.lastDay ?? null, year, parts[0].share, days);
59
+ return lots(lot('statutory', parts[0].from, figures.statutory), lot('extra', parts[0].from, figures.extra));
60
+ }
61
+ return termFractions(parts, year).flatMap((part) => lots(lot('statutory', part.from, shareOf(STATUTORY * part.share, part)), lot('extra', part.from, shareOf(extraDays * part.share, part))));
62
+ }
63
+ /** What this preset does not do, for the setup screen and the adviser. */
64
+ export const GERMANY_LIMITS = [
65
+ 'Counts in five-day weeks: 20 statutory days. Somebody who works six days a week is owed 24 by law, which this preset does not work out.',
66
+ 'Does not hold back a joiner\'s days for the six-month waiting period (Wartezeit): they can be taken from the first day.',
67
+ 'Adds no days that other laws or agreements give: 5 more for a severely disabled person (SGB IX section 208), more for young people (JArbSchG), or a collective agreement\'s (Tarifvertrag). Set them in the policy.',
68
+ 'Treats the extra days like the statutory ones: they lapse only after a notice and are held through sickness. A contract may set other terms for them.',
69
+ 'Carries nothing by itself. Days carried to 31 March for urgent business or personal reasons (BUrlG section 7) need a reason HR records.',
70
+ 'Takes each place\'s public holidays, which differ by state, from the holiday add-on: it keeps no calendar of its own.',
71
+ 'Works out no holiday pay (the 13-week average), no holiday bonus (Urlaubsgeld), and no payment for untaken days on leaving (Urlaubsabgeltung). The leaver\'s statement gives the days.',
72
+ ];
73
+ /** The preset with a policy's own days a year; a figure below the floor counts as the floor, and none as the default, marked for HR to confirm. */
74
+ export const germanyWith = (confirmed) => {
75
+ const days = confirmed === undefined || confirmed === null ? GERMANY_DEFAULT_DAYS : Math.max(confirmed, statutoryFloorOf('germany').days);
76
+ return {
77
+ key: 'germany',
78
+ defaults: confirmed === undefined || confirmed === null ? [{ field: 'days_per_year', value: GERMANY_DEFAULT_DAYS, isDefault: true, legalFigure: false, confirmBy: 'hr' }] : [],
79
+ minNoticeDays: 90,
80
+ graceDays: 14,
81
+ carry: null,
82
+ holdLimitMonths: 15,
83
+ holidaysWithin: () => false,
84
+ lotsFor: (person, year) => lotsWith(days, person, year),
85
+ limits: GERMANY_LIMITS,
86
+ };
87
+ };
88
+ /** On the default figure. */
89
+ export const germany = germanyWith(null);
90
+ /** The day a held lot of a leave year reaches its limit. */
91
+ export const holdLimitDay = (sourceYear, months) => addMonths(yearEnd(sourceYear), months);
92
+ //# sourceMappingURL=preset-germany.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-germany.js","sourceRoot":"","sources":["../../src/leave/preset-germany.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;GASG;AACH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,QAAQ,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AACrH,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,WAAW,EAA0D,MAAM,kBAAkB,CAAC;AAC/H,OAAO,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE/C,MAAM,SAAS,GAAG,EAAE,CAAC;AACrB,0EAA0E;AAC1E,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,kIAAkI;AAClI,SAAS,gBAAgB,CAAC,IAAY,EAAE,MAAc;IACpD,MAAM,KAAK,GAAG,QAAQ,CAAC,IAAI,GAAG,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,MAAM,IAAI,GAAG,IAAI,GAAG,MAAM,GAAG,KAAK,GAAG,MAAM,CAAC;IAC5C,OAAO,IAAI,GAAG,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,MAAM,EAAE,EAAE,CAAC,CAAC;AAC9E,CAAC;AAED,8FAA8F;AAC9F,SAAS,WAAW,CAAC,KAAe;IAClC,MAAM,OAAO,GAAG,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,MAAM,CA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AK,EAAE,oBAAoB,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;QAC9K,aAAa,EAAE,EAAE;QACjB,SAAS,EAAE,EAAE;QACb,KAAK,EAAE,IAAI;QACX,eAAe,EAAE,EAAE;QACnB,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;QAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC;QACvD,MAAM,EAAE,cAAc;KACvB,CAAC;AACJ,CAAC,CAAC;AAEF,6BAA6B;AAC7B,MAAM,CAAC,MAAM,OAAO,GAAgB,WAAW,CAAC,IAAI,CAAC,CAAC;AAEtD,4DAA4D;AAC5D,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,UAAkB,EAAE,MAAc,EAAY,EAAE,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,MAAM,CAAC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { type LeavePreset } from './entitlement.js';
2
+ /** The starting figure when a policy names none. */
3
+ export declare const US_DEFAULT_DAYS = 15;
4
+ /** What this preset does not do, for the setup screen and the adviser. */
5
+ export declare const US_LIMITS: readonly string[];
6
+ /** The preset with a policy's own number of days. With none, it runs on the default and says so. */
7
+ export declare const unitedStates: (confirmed?: number | null) => LeavePreset;
8
+ //# sourceMappingURL=preset-us.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-us.d.ts","sourceRoot":"","sources":["../../src/leave/preset-us.ts"],"names":[],"mappings":"AASA,OAAO,EAAgD,KAAK,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAEhH,oDAAoD;AACpD,eAAO,MAAM,eAAe,KAAK,CAAC;AAclC,0EAA0E;AAC1E,eAAO,MAAM,SAAS,EAAE,SAAS,MAAM,EAOtC,CAAC;AAEF,oGAAoG;AACpG,eAAO,MAAM,YAAY,GAAI,YAAY,MAAM,GAAG,IAAI,KAAG,WAaxD,CAAC"}
@@ -0,0 +1,48 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * The United States: a starting point, to check with your adviser. No federal
4
+ * minimum exists, so the days a year are the policy's own: 15 is a default
5
+ * for HR to confirm, and is marked as one until they do. Earned month by month
6
+ * on one lot, rounded once. No accrual caps and no forfeiture: a lot never
7
+ * expires. What it does not model is `US_LIMITS`.
8
+ */
9
+ import { daysBetween, daysInYear } from './civil.js';
10
+ import { shareOf, termsInYear } from './entitlement.js';
11
+ /** The starting figure when a policy names none. */
12
+ export const US_DEFAULT_DAYS = 15;
13
+ function lotsWith(daysPerYear, person, year) {
14
+ return termsInYear(person, year).map((part) => ({
15
+ kind: 'grant',
16
+ tier: null,
17
+ usableFrom: part.from,
18
+ expiresOn: null,
19
+ amount: shareOf(daysPerYear * part.share, { numerator: daysBetween(part.from, part.to) + 1, denominator: daysInYear(year) }),
20
+ rule: `US ${String(year)}: ${String(daysPerYear)} days a year, earned monthly`,
21
+ earn: { every: 'month', from: part.from, to: part.to },
22
+ }));
23
+ }
24
+ /** What this preset does not do, for the setup screen and the adviser. */
25
+ export const US_LIMITS = [
26
+ 'No federal minimum exists: the days a year are the policy\'s own, 15 until HR confirms a figure.',
27
+ 'Records sick leave but not the paid sick leave laws of each state or city: how much is earned, capped and carried over.',
28
+ 'Has no cap on what builds up and lets nothing expire. A policy with a cap, or with days that lapse at the year\'s end (some states forbid it), is not modelled.',
29
+ 'Works out no payment for unused days when somebody leaves, which some states require. The leaver\'s statement gives the days.',
30
+ 'Earns days month by month, not by the hours worked.',
31
+ 'Does not count the 12 weeks of unpaid, protected leave under FMLA, or state family leave.',
32
+ ];
33
+ /** The preset with a policy's own number of days. With none, it runs on the default and says so. */
34
+ export const unitedStates = (confirmed) => {
35
+ const daysPerYear = confirmed ?? US_DEFAULT_DAYS;
36
+ return {
37
+ key: 'us',
38
+ defaults: confirmed === undefined || confirmed === null ? [{ field: 'days_per_year', value: US_DEFAULT_DAYS, isDefault: true, legalFigure: false, confirmBy: 'hr' }] : [],
39
+ minNoticeDays: 0,
40
+ graceDays: 0,
41
+ carry: { units: null, until: '12-31' },
42
+ holdLimitMonths: null,
43
+ holidaysWithin: () => false,
44
+ lotsFor: (person, year) => lotsWith(daysPerYear, person, year),
45
+ limits: US_LIMITS,
46
+ };
47
+ };
48
+ //# sourceMappingURL=preset-us.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-us.js","sourceRoot":"","sources":["../../src/leave/preset-us.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;GAMG;AACH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAiB,MAAM,YAAY,CAAC;AACpE,OAAO,EAAE,OAAO,EAAE,WAAW,EAA0D,MAAM,kBAAkB,CAAC;AAEhH,oDAAoD;AACpD,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAElC,SAAS,QAAQ,CAAC,WAAmB,EAAE,MAAyB,EAAE,IAAY;IAC5E,OAAO,WAAW,CAAC,MAAM,EAAE,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAqD,EAAE,EAAE,CAAC,CAAC;QAC/F,IAAI,EAAE,OAAgB;QACtB,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,IAAI,CAAC,IAAI;QACrB,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,KAAK,EAAE,EAAE,SAAS,EAAE,WAAW,CAAC,IAAI,CAAC,IAAI,EAAE,IAAI,CAAC,EAAE,CAAC,GAAG,CAAC,EAAE,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,EAAE,CAAC;QAC5H,IAAI,EAAE,MAAM,MAAM,CAAC,IAAI,CAAC,KAAK,MAAM,CAAC,WAAW,CAAC,8BAA8B;QAC9E,IAAI,EAAE,EAAE,KAAK,EAAE,OAAgB,EAAE,IAAI,EAAE,IAAI,CAAC,IAAI,EAAE,EAAE,EAAE,IAAI,CAAC,EAAE,EAAE;KAChE,CAAC,CAAC,CAAC;AACN,CAAC;AAED,0EAA0E;AAC1E,MAAM,CAAC,MAAM,SAAS,GAAsB;IAC1C,kGAAkG;IAClG,yHAAyH;IACzH,iKAAiK;IACjK,+HAA+H;IAC/H,qDAAqD;IACrD,2FAA2F;CAC5F,CAAC;AAEF,oGAAoG;AACpG,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,SAAyB,EAAe,EAAE;IACrE,MAAM,WAAW,GAAG,SAAS,IAAI,eAAe,CAAC;IACjD,OAAO;QACL,GAAG,EAAE,IAAI;QACT,QAAQ,EAAE,SAAS,KAAK,SAAS,IAAI,SAAS,KAAK,IAAI,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,eAAe,EAAE,SAAS,EAAE,IAAI,EAAE,WAAW,EAAE,KAAK,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE;QACzK,aAAa,EAAE,CAAC;QAChB,SAAS,EAAE,CAAC;QACZ,KAAK,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,KAAK,EAAE,OAAO,EAAE;QACtC,eAAe,EAAE,IAAI;QACrB,cAAc,EAAE,GAAG,EAAE,CAAC,KAAK;QAC3B,OAAO,EAAE,CAAC,MAAM,EAAE,IAAI,EAAE,EAAE,CAAC,QAAQ,CAAC,WAAW,EAAE,MAAM,EAAE,IAAI,CAAC;QAC9D,MAAM,EAAE,SAAS;KAClB,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1,126 @@
1
+ /**
2
+ * THE REPLAY: which lots each day charges, worked out whole from the lots and
3
+ * the days, so its answer depends on what is true and never on the order
4
+ * things were entered in.
5
+ *
6
+ * A row holds its slot while it is `live`. It charges a lot through its
7
+ * allocation, which is why a day a sick report displaced keeps charging until
8
+ * HR hands it back (`returnedAt`).
9
+ *
10
+ * Each day, in order, takes the earliest usable lot. A `held` lot keeps its
11
+ * old date, so it goes first, and stays spendable past it: those are the days
12
+ * the law says cannot lapse. A `sealed` lot still serves days up to its date.
13
+ *
14
+ * Two modes. `judge` refuses a person's own request when it is short. `absorb`
15
+ * never refuses, for what nobody may refuse (a past absence HR records, a
16
+ * calendar correction): the shortfall goes on an overdraft lot of that day's
17
+ * year, flagged for HR.
18
+ *
19
+ * The replay writes nothing. What it finds about a sealed lot it answers as
20
+ * posts, each with the key that makes it happen once: a late day takes back
21
+ * what lapsed, and days handed back after the date come back in a new lot.
22
+ */
23
+ import { type CivilDay } from './civil.js';
24
+ import type { DayPart } from './count.js';
25
+ import { type EarnRule } from './entitlement.js';
26
+ export type LotState = 'open' | 'held' | 'sealed';
27
+ export interface ReplayLot {
28
+ id: string;
29
+ tier?: string | null | undefined;
30
+ from: CivilDay;
31
+ /** The policy's expiry; empty for a lot that never expires. */
32
+ date: CivilDay | null;
33
+ state: LotState;
34
+ amount: number;
35
+ /** Units moved out to a later lot by a close. */
36
+ carriedOut?: number | undefined;
37
+ /** Units already handed back in a restored lot. */
38
+ restored?: number | undefined;
39
+ /** Units posted as lapsed. */
40
+ lapsed?: number | undefined;
41
+ earn?: EarnRule | null | undefined;
42
+ /** The lot a year's shortfall sits on. Never spent by the ordinary pass. */
43
+ overdraft?: boolean | undefined;
44
+ /** The leave year an overdraft lot is for. */
45
+ year?: number | undefined;
46
+ /** How many restored lots and lapse corrections have been posted from this lot: the next key's number. */
47
+ restores?: number | undefined;
48
+ corrections?: number | undefined;
49
+ }
50
+ export interface ReplayDay {
51
+ id: string;
52
+ day: CivilDay;
53
+ part: DayPart;
54
+ units: number;
55
+ live: boolean;
56
+ state?: string | undefined;
57
+ returnedAt?: string | null | undefined;
58
+ }
59
+ export interface Charge {
60
+ dayId: string;
61
+ lotId: string;
62
+ units: number;
63
+ }
64
+ export interface ReplayLotResult {
65
+ id: string;
66
+ used: number;
67
+ left: number;
68
+ }
69
+ export interface ReplayResult {
70
+ /** Whether every day found its units. */
71
+ ok: boolean;
72
+ /** How many units the days could not find. */
73
+ shortBy: number;
74
+ charges: Charge[];
75
+ lots: ReplayLotResult[];
76
+ /** The shortfall of each year, on its overdraft lot (a new one is named `overdraft:<year>`). HR sees these. */
77
+ overdraft: OverdraftUse[];
78
+ /** Lapses to take back, because a late day was charged to the lot. */
79
+ corrections: LotPost[];
80
+ /** Days handed back after the lot's date, to post as a new lot. */
81
+ restores: LotPost[];
82
+ }
83
+ export interface OverdraftUse {
84
+ year: number;
85
+ lotId: string;
86
+ units: number;
87
+ }
88
+ export interface LotPost {
89
+ lotId: string;
90
+ units: number;
91
+ postKey: string;
92
+ }
93
+ export type ReplayMode = 'judge' | 'absorb';
94
+ /** Whether a row charges a lot: it holds its slot, or a report displaced it and HR has not handed it back. */
95
+ export declare const isCharged: (day: Pick<ReplayDay, "live" | "state" | "returnedAt">) => boolean;
96
+ /** Keys compare as numbers when both are, so row 10 comes after row 9. */
97
+ export declare function compareIds(a: string, b: string): number;
98
+ /** The order lots are spent in: soonest date first (no date last), statutory before extra. */
99
+ export declare function compareLots(a: ReplayLot, b: ReplayLot): number;
100
+ export declare function compareDays(a: ReplayDay, b: ReplayDay): number;
101
+ export interface ReplayInput {
102
+ lots: readonly ReplayLot[];
103
+ days: readonly ReplayDay[];
104
+ /** `judge` when left out. */
105
+ mode?: ReplayMode | undefined;
106
+ /**
107
+ * In `judge`, the days being asked for now. A shortfall that was already
108
+ * there (an absence HR recorded) is no reason to refuse them: only what they
109
+ * add to it is. Left out, every day is judged.
110
+ */
111
+ fresh?: ReadonlySet<string> | undefined;
112
+ }
113
+ /** The replay. In `judge`, a refusal is `ok: false` with `shortBy`, and nothing it answers is to be written. */
114
+ export declare function replayLeave(input: ReplayInput): ReplayResult;
115
+ /** What must change in the stored charges for them to say what the replay said. */
116
+ export declare function diffCharges(stored: readonly (Charge & {
117
+ id: string;
118
+ })[], next: readonly Charge[]): {
119
+ add: Charge[];
120
+ change: {
121
+ id: string;
122
+ units: number;
123
+ }[];
124
+ remove: string[];
125
+ };
126
+ //# sourceMappingURL=replay.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"replay.d.ts","sourceRoot":"","sources":["../../src/leave/replay.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,OAAO,EAAU,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AACnD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAC1C,OAAO,EAAY,KAAK,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAE3D,MAAM,MAAM,QAAQ,GAAG,MAAM,GAAG,MAAM,GAAG,QAAQ,CAAC;AAElD,MAAM,WAAW,SAAS;IACxB,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;IACjC,IAAI,EAAE,QAAQ,CAAC;IACf,+DAA+D;IAC/D,IAAI,EAAE,QAAQ,GAAG,IAAI,CAAC;IACtB,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,iDAAiD;IACjD,UAAU,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAChC,mDAAmD;IACnD,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,8BAA8B;IAC9B,MAAM,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,IAAI,CAAC,EAAE,QAAQ,GAAG,IAAI,GAAG,SAAS,CAAC;IACnC,4EAA4E;IAC5E,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC,8CAA8C;IAC9C,IAAI,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC1B,0GAA0G;IAC1G,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;IAC9B,WAAW,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAClC;AAED,MAAM,WA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