@adminiumjs/manifest 0.3.79 → 0.3.80

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 (128) 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/entitlement.d.ts +104 -0
  45. package/dist/leave/entitlement.d.ts.map +1 -0
  46. package/dist/leave/entitlement.js +59 -0
  47. package/dist/leave/entitlement.js.map +1 -0
  48. package/dist/leave/floors.d.ts +27 -0
  49. package/dist/leave/floors.d.ts.map +1 -0
  50. package/dist/leave/floors.js +37 -0
  51. package/dist/leave/floors.js.map +1 -0
  52. package/dist/leave/index.d.ts +22 -0
  53. package/dist/leave/index.d.ts.map +1 -0
  54. package/dist/leave/index.js +23 -0
  55. package/dist/leave/index.js.map +1 -0
  56. package/dist/leave/notice-gate.d.ts +41 -0
  57. package/dist/leave/notice-gate.d.ts.map +1 -0
  58. package/dist/leave/notice-gate.js +27 -0
  59. package/dist/leave/notice-gate.js.map +1 -0
  60. package/dist/leave/preset-england-wales.d.ts +10 -0
  61. package/dist/leave/preset-england-wales.d.ts.map +1 -0
  62. package/dist/leave/preset-england-wales.js +67 -0
  63. package/dist/leave/preset-england-wales.js.map +1 -0
  64. package/dist/leave/preset-germany.d.ts +30 -0
  65. package/dist/leave/preset-germany.d.ts.map +1 -0
  66. package/dist/leave/preset-germany.js +92 -0
  67. package/dist/leave/preset-germany.js.map +1 -0
  68. package/dist/leave/preset-us.d.ts +8 -0
  69. package/dist/leave/preset-us.d.ts.map +1 -0
  70. package/dist/leave/preset-us.js +48 -0
  71. package/dist/leave/preset-us.js.map +1 -0
  72. package/dist/leave/replay.d.ts +126 -0
  73. package/dist/leave/replay.d.ts.map +1 -0
  74. package/dist/leave/replay.js +158 -0
  75. package/dist/leave/replay.js.map +1 -0
  76. package/dist/leave/state.d.ts +64 -0
  77. package/dist/leave/state.d.ts.map +1 -0
  78. package/dist/leave/state.js +74 -0
  79. package/dist/leave/state.js.map +1 -0
  80. package/dist/leave/told.d.ts +32 -0
  81. package/dist/leave/told.d.ts.map +1 -0
  82. package/dist/leave/told.js +32 -0
  83. package/dist/leave/told.js.map +1 -0
  84. package/dist/leave/units.d.ts +21 -0
  85. package/dist/leave/units.d.ts.map +1 -0
  86. package/dist/leave/units.js +21 -0
  87. package/dist/leave/units.js.map +1 -0
  88. package/dist/leave-shape.d.ts +324 -0
  89. package/dist/leave-shape.d.ts.map +1 -0
  90. package/dist/leave-shape.js +164 -0
  91. package/dist/leave-shape.js.map +1 -0
  92. package/dist/leave-word.d.ts +86 -0
  93. package/dist/leave-word.d.ts.map +1 -0
  94. package/dist/leave-word.js +235 -0
  95. package/dist/leave-word.js.map +1 -0
  96. package/dist/outbox.d.ts +2 -0
  97. package/dist/outbox.d.ts.map +1 -1
  98. package/dist/outbox.js +5 -0
  99. package/dist/outbox.js.map +1 -1
  100. package/dist/person-import.d.ts +98 -0
  101. package/dist/person-import.d.ts.map +1 -0
  102. package/dist/person-import.js +270 -0
  103. package/dist/person-import.js.map +1 -0
  104. package/dist/record-classes.d.ts +99 -0
  105. package/dist/record-classes.d.ts.map +1 -0
  106. package/dist/record-classes.js +123 -0
  107. package/dist/record-classes.js.map +1 -0
  108. package/dist/removal.d.ts +1 -0
  109. package/dist/removal.d.ts.map +1 -1
  110. package/dist/removal.js +2 -0
  111. package/dist/removal.js.map +1 -1
  112. package/dist/roles.d.ts +23 -1
  113. package/dist/roles.d.ts.map +1 -1
  114. package/dist/roles.js +34 -5
  115. package/dist/roles.js.map +1 -1
  116. package/dist/schema.d.ts +601 -0
  117. package/dist/schema.d.ts.map +1 -1
  118. package/dist/schema.js +134 -14
  119. package/dist/schema.js.map +1 -1
  120. package/dist/staff-accounts.d.ts +102 -0
  121. package/dist/staff-accounts.d.ts.map +1 -0
  122. package/dist/staff-accounts.js +179 -0
  123. package/dist/staff-accounts.js.map +1 -0
  124. package/dist/words.d.ts +1 -1
  125. package/dist/words.d.ts.map +1 -1
  126. package/dist/words.js +80 -0
  127. package/dist/words.js.map +1 -1
  128. package/package.json +2 -2
@@ -0,0 +1,59 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * What a person is granted for a year, as the lots a policy would post. Each
4
+ * lot is rounded ONCE: rounding per month is how 2.08 × 12 becomes 24.96.
5
+ *
6
+ * A year with a change of terms gives each term its share. When every term
7
+ * runs from the first of a month to the last of one, the share is whole
8
+ * months; otherwise it is calendar days, so a change in mid-month never loses
9
+ * that month to both sides.
10
+ */
11
+ import { addDays, addMonths, daysBetween, daysInYear, earlierDay, fullMonths, isFirstOfMonth, isLastOfMonth, laterDay, yearEnd, yearStart } from './civil.js';
12
+ import { ceilDiv, floorDiv } from './units.js';
13
+ /** The person's terms inside a year, cut to when they work here. */
14
+ export function termsInYear(person, year) {
15
+ const first = laterDay(person.started, yearStart(year));
16
+ const last = person.lastDay === undefined || person.lastDay === null ? yearEnd(year) : earlierDay(person.lastDay, yearEnd(year));
17
+ const out = [];
18
+ for (const term of person.terms) {
19
+ const from = laterDay(term.from, first);
20
+ const to = term.to === null ? last : earlierDay(term.to, last);
21
+ if (from <= to)
22
+ out.push({ from, to, share: term.share });
23
+ }
24
+ return out.sort((a, b) => (a.from < b.from ? -1 : 1));
25
+ }
26
+ /** Each term's fraction of the year: whole months when the terms fall on month ends, else calendar days. */
27
+ export function termFractions(parts, year) {
28
+ const onMonths = parts.every((part) => isFirstOfMonth(part.from) && isLastOfMonth(part.to));
29
+ return parts.map((part) => (onMonths ? { ...part, numerator: fullMonths(part.from, part.to), denominator: 12 } : { ...part, numerator: daysBetween(part.from, part.to) + 1, denominator: daysInYear(year) }));
30
+ }
31
+ const periodsOf = (earn) => {
32
+ for (let count = 1; count <= 1200; count += 1)
33
+ if (addDays(addMonths(earn.from, count), -1) >= earn.to)
34
+ return count;
35
+ return 1200;
36
+ };
37
+ /**
38
+ * How much of a lot is earned by the end of a day: a share for each whole
39
+ * period gone, rounded down, and the last period is exactly the whole lot. A
40
+ * lot with no rule is earned in full.
41
+ */
42
+ export function earnedBy(lot, day) {
43
+ const earn = lot.earn;
44
+ if (earn === undefined || earn === null)
45
+ return lot.amount;
46
+ if (day < earn.from)
47
+ return 0;
48
+ if (day >= earn.to)
49
+ return lot.amount;
50
+ const periods = periodsOf(earn);
51
+ let gone = 0;
52
+ while (gone < periods && addDays(addMonths(earn.from, gone + 1), -1) <= day)
53
+ gone += 1;
54
+ return gone >= periods ? lot.amount : floorDiv(lot.amount * gone, periods);
55
+ }
56
+ export const totalOf = (lots) => lots.reduce((sum, lot) => sum + lot.amount, 0);
57
+ /** A proportion of a figure, rounded up once. */
58
+ export const shareOf = (base, part) => (part.numerator === part.denominator ? base : ceilDiv(base * part.numerator, part.denominator));
59
+ //# sourceMappingURL=entitlement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"entitlement.js","sourceRoot":"","sources":["../../src/leave/entitlement.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;GAQG;AACH,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,cAAc,EAAE,aAAa,EAAE,QAAQ,EAAE,OAAO,EAAE,SAAS,EAAiB,MAAM,YAAY,CAAC;AAC7K,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AA2C/C,oEAAoE;AACpE,MAAM,UAAU,WAAW,CAAC,MAAyB,EAAE,IAAY;IACjE,MAAM,KAAK,GAAG,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,KAAK,SAAS,IAAI,MAAM,CAAC,OAAO,KAAK,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC,MAAM,CAAC,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;IACjI,MAAM,GAAG,GAAsD,EAAE,CAAC;IAClE,KAAK,MAAM,IAAI,IAAI,MAAM,CAAC,KAAK,EAAE,CAAC;QA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G,EAAE,EAAE,CAAC,GAAG,GAAG,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC;AAE5G,iDAAiD;AACjD,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAY,EAAE,IAAiD,EAAU,EAAE,CAAC,CAAC,IAAI,CAAC,SAAS,KAAK,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,GAAG,IAAI,CAAC,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,CAAC,CAAC"}
@@ -0,0 +1,27 @@
1
+ /**
2
+ * The fewest days a year a country's law allows, against which a policy's own
3
+ * figure (`days_per_year`, a full-time year of five working days) is held. A
4
+ * preset takes the policy's figure as the contractual allowance and never
5
+ * goes below this; a lower figure is refused with the reason below.
6
+ *
7
+ * - England and Wales: 5.6 weeks, 28 days on five days a week, bank holidays
8
+ * included (a part-timer's share of it pro rata). The preset gives full
9
+ * timers the 8 bank holidays on top of the rest, so the default 33 is
10
+ * "25 days plus bank holidays".
11
+ * - Germany (BUrlG section 3): 24 working days on a six-day week, which is
12
+ * 20 on five; public holidays are never counted. The default 28 is 20
13
+ * statutory and 8 extra.
14
+ *
15
+ * The United States has no federal minimum.
16
+ */
17
+ export interface StatutoryFloor {
18
+ /** The fewest days a year on five days a week. */
19
+ days: number;
20
+ /** Why a lower figure is refused, in plain words. */
21
+ reason: string;
22
+ }
23
+ /** The floor of a preset, or null when its country has none. */
24
+ export declare const statutoryFloorOf: (preset: string | null) => StatutoryFloor | null;
25
+ /** Why a policy's days a year are below its country's floor, or null when they are not (or no figure is given). */
26
+ export declare function belowStatutoryFloor(preset: string | null, daysPerYear: number | null): string | null;
27
+ //# sourceMappingURL=floors.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floors.d.ts","sourceRoot":"","sources":["../../src/leave/floors.ts"],"names":[],"mappings":"AACA;;;;;;;;;;;;;;;GAeG;AAEH,MAAM,WAAW,cAAc;IAC7B,kDAAkD;IAClD,IAAI,EAAE,MAAM,CAAC;IACb,qDAAqD;IACrD,MAAM,EAAE,MAAM,CAAC;CAChB;AAaD,gEAAgE;AAChE,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,GAAG,IAAI,KAAG,cAAc,GAAG,IAA2D,CAAC;AAEtI,mHAAmH;AACnH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAIpG"}
@@ -0,0 +1,37 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * The fewest days a year a country's law allows, against which a policy's own
4
+ * figure (`days_per_year`, a full-time year of five working days) is held. A
5
+ * preset takes the policy's figure as the contractual allowance and never
6
+ * goes below this; a lower figure is refused with the reason below.
7
+ *
8
+ * - England and Wales: 5.6 weeks, 28 days on five days a week, bank holidays
9
+ * included (a part-timer's share of it pro rata). The preset gives full
10
+ * timers the 8 bank holidays on top of the rest, so the default 33 is
11
+ * "25 days plus bank holidays".
12
+ * - Germany (BUrlG section 3): 24 working days on a six-day week, which is
13
+ * 20 on five; public holidays are never counted. The default 28 is 20
14
+ * statutory and 8 extra.
15
+ *
16
+ * The United States has no federal minimum.
17
+ */
18
+ const FLOORS = {
19
+ 'england-wales': {
20
+ days: 28,
21
+ reason: 'England and Wales give at least 5.6 weeks a year: 28 days on five days a week, bank holidays included. Count the bank holidays in the figure (25 days plus bank holidays is 33).',
22
+ },
23
+ germany: {
24
+ days: 20,
25
+ reason: 'Germany gives at least 24 working days a year on a six-day week (BUrlG), which is 20 on five days a week. Public holidays are not counted in the figure.',
26
+ },
27
+ };
28
+ /** The floor of a preset, or null when its country has none. */
29
+ export const statutoryFloorOf = (preset) => (preset === null ? null : (FLOORS[preset] ?? null));
30
+ /** Why a policy's days a year are below its country's floor, or null when they are not (or no figure is given). */
31
+ export function belowStatutoryFloor(preset, daysPerYear) {
32
+ const floor = statutoryFloorOf(preset);
33
+ if (floor === null || daysPerYear === null)
34
+ return null;
35
+ return daysPerYear < floor.days ? floor.reason : null;
36
+ }
37
+ //# sourceMappingURL=floors.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"floors.js","sourceRoot":"","sources":["../../src/leave/floors.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;;;;;;;;;;;GAeG;AASH,MAAM,MAAM,GAA6C;IACvD,eAAe,EAAE;QACf,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,kLAAkL;KAC3L;IACD,OAAO,EAAE;QACP,IAAI,EAAE,EAAE;QACR,MAAM,EAAE,0JAA0J;KACnK;CACF,CAAC;AAEF,gEAAgE;AAChE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,MAAqB,EAAyB,EAAE,CAAC,CAAC,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,IAAI,CAAC,CAAC,CAAC;AAEtI,mHAAmH;AACnH,MAAM,UAAU,mBAAmB,CAAC,MAAqB,EAAE,WAA0B;IACnF,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,CAAC,CAAC;IACvC,IAAI,KAAK,KAAK,IAAI,IAAI,WAAW,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC;IACxD,OAAO,WAAW,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,CAAC;AACxD,CAAC"}
@@ -0,0 +1,22 @@
1
+ /**
2
+ * The pure leave core: no zod, no I/O, and no import but its own files and
3
+ * `../leave-shape.js`, so an app can vendor it and its demo can never disagree
4
+ * with the engine. Flat on purpose: the app's sync copies `leave/*.ts`.
5
+ */
6
+ export * from '../leave-shape.js';
7
+ export * from './units.js';
8
+ export * from './civil.js';
9
+ export * from './count.js';
10
+ export * from './entitlement.js';
11
+ export { englandWales, englandWalesWith, ENGLAND_WALES_DEFAULT_DAYS, ENGLAND_WALES_LIMITS } from './preset-england-wales.js';
12
+ export { germany, germanyWith, germanEntitlement, GERMANY_DEFAULT_DAYS, GERMANY_LIMITS, holdLimitDay } from './preset-germany.js';
13
+ export * from './floors.js';
14
+ export { unitedStates, US_DEFAULT_DAYS, US_LIMITS } from './preset-us.js';
15
+ export * from './replay.js';
16
+ export * from './state.js';
17
+ export * from './deciders.js';
18
+ export * from './told.js';
19
+ export * from './away.js';
20
+ export * from './notice-gate.js';
21
+ export * from './close-line.js';
22
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/leave/index.ts"],"names":[],"mappings":"AACA;;;;GAIG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC7H,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClI,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1E,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,23 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * The pure leave core: no zod, no I/O, and no import but its own files and
4
+ * `../leave-shape.js`, so an app can vendor it and its demo can never disagree
5
+ * with the engine. Flat on purpose: the app's sync copies `leave/*.ts`.
6
+ */
7
+ export * from '../leave-shape.js';
8
+ export * from './units.js';
9
+ export * from './civil.js';
10
+ export * from './count.js';
11
+ export * from './entitlement.js';
12
+ export { englandWales, englandWalesWith, ENGLAND_WALES_DEFAULT_DAYS, ENGLAND_WALES_LIMITS } from './preset-england-wales.js';
13
+ export { germany, germanyWith, germanEntitlement, GERMANY_DEFAULT_DAYS, GERMANY_LIMITS, holdLimitDay } from './preset-germany.js';
14
+ export * from './floors.js';
15
+ export { unitedStates, US_DEFAULT_DAYS, US_LIMITS } from './preset-us.js';
16
+ export * from './replay.js';
17
+ export * from './state.js';
18
+ export * from './deciders.js';
19
+ export * from './told.js';
20
+ export * from './away.js';
21
+ export * from './notice-gate.js';
22
+ export * from './close-line.js';
23
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/leave/index.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;GAIG;AACH,cAAc,mBAAmB,CAAC;AAClC,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,YAAY,CAAC;AAC3B,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,0BAA0B,EAAE,oBAAoB,EAAE,MAAM,2BAA2B,CAAC;AAC7H,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,oBAAoB,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAClI,cAAc,aAAa,CAAC;AAC5B,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAC1E,cAAc,aAAa,CAAC;AAC5B,cAAc,YAAY,CAAC;AAC3B,cAAc,eAAe,CAAC;AAC9B,cAAc,WAAW,CAAC;AAC1B,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,41 @@
1
+ /**
2
+ * THE GATE: days lapse only on all four of these. A notice proved to have
3
+ * reached the person, sent in good time, with no sickness or protected leave
4
+ * since, and for no more than it said. Whatever the gate does not let lapse is
5
+ * held: it stays the person's, and is spent first.
6
+ */
7
+ import { type CivilDay } from './civil.js';
8
+ /** A notice as the gate reads it. `proved` is the mail proof's answer, never the outbox's `sent`. */
9
+ export interface GateNotice {
10
+ id: string;
11
+ /** The day it went, in the person's location; empty until it has. */
12
+ sentOn: CivilDay | null;
13
+ /** What it said may lapse at year end. */
14
+ atRisk: number;
15
+ /** What it said carries over, and may lapse at `carryUntil`. */
16
+ carryUnits: number;
17
+ carryUntil: CivilDay | null;
18
+ proved: boolean;
19
+ /** Why it is not proved, for the screen. */
20
+ missing?: string | null | undefined;
21
+ }
22
+ export type GateStage = 'year-end' | 'carry' | 'held';
23
+ export type GateWhy = 'ok' | 'no-notice' | 'not-proved' | 'late' | 'away';
24
+ export interface GateInput {
25
+ stage: GateStage;
26
+ notice: GateNotice | null;
27
+ /** The day these units expire. For a held lot, the day its fresh notice takes effect. */
28
+ expires: CivilDay;
29
+ atRiskNow: number;
30
+ minNoticeDays: number;
31
+ /** Sickness or protected leave since the notice. */
32
+ away: boolean;
33
+ }
34
+ export interface GateAnswer {
35
+ lapse: number;
36
+ held: number;
37
+ why: GateWhy;
38
+ }
39
+ /** How much of what is at risk lapses, and why the rest does not. */
40
+ export declare function lapseGate(input: GateInput): GateAnswer;
41
+ //# sourceMappingURL=notice-gate.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notice-gate.d.ts","sourceRoot":"","sources":["../../src/leave/notice-gate.ts"],"names":[],"mappings":"AACA;;;;;GAKG;AACH,OAAO,EAAW,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEpD,qGAAqG;AACrG,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,qEAAqE;IACrE,MAAM,EAAE,QAAQ,GAAG,IAAI,CAAC;IACxB,0CAA0C;IAC1C,MAAM,EAAE,MAAM,CAAC;IACf,gEAAgE;IAChE,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC5B,MAAM,EAAE,OAAO,CAAC;IAChB,4CAA4C;IAC5C,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACrC;AAED,MAAM,MAAM,SAAS,GAAG,UAAU,GAAG,OAAO,GAAG,MAAM,CAAC;AACtD,MAAM,MAAM,OAAO,GAAG,IAAI,GAAG,WAAW,GAAG,YAAY,GAAG,MAAM,GAAG,MAAM,CAAC;AAE1E,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,SAAS,CAAC;IACjB,MAAM,EAAE,UAAU,GAAG,IAAI,CAAC;IAC1B,yFAAyF;IACzF,OAAO,EAAE,QAAQ,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,oDAAoD;IACpD,IAAI,EAAE,OAAO,CAAC;CACf;AAED,MAAM,WAAW,UAAU;IACzB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;IACb,GAAG,EAAE,OAAO,CAAC;CACd;AAED,qEAAqE;AACrE,wBAAgB,SAAS,CAAC,KAAK,EAAE,SAAS,GAAG,UAAU,CAWtD"}
@@ -0,0 +1,27 @@
1
+ // SPDX-License-Identifier: AGPL-3.0-only
2
+ /**
3
+ * THE GATE: days lapse only on all four of these. A notice proved to have
4
+ * reached the person, sent in good time, with no sickness or protected leave
5
+ * since, and for no more than it said. Whatever the gate does not let lapse is
6
+ * held: it stays the person's, and is spent first.
7
+ */
8
+ import { addDays } from './civil.js';
9
+ /** How much of what is at risk lapses, and why the rest does not. */
10
+ export function lapseGate(input) {
11
+ const { notice, atRiskNow } = input;
12
+ const keep = (why) => ({ lapse: 0, held: atRiskNow, why });
13
+ if (atRiskNow <= 0)
14
+ return { lapse: 0, held: 0, why: 'ok' };
15
+ if (input.away)
16
+ return keep('away');
17
+ if (notice === null || notice.sentOn === null)
18
+ return keep('no-notice');
19
+ if (!notice.proved)
20
+ return keep('not-proved');
21
+ if (notice.sentOn > addDays(input.expires, -input.minNoticeDays))
22
+ return keep('late');
23
+ const said = input.stage === 'carry' ? notice.carryUnits : notice.atRisk;
24
+ const lapse = Math.min(atRiskNow, Math.max(said, 0));
25
+ return { lapse, held: atRiskNow - lapse, why: 'ok' };
26
+ }
27
+ //# sourceMappingURL=notice-gate.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"notice-gate.js","sourceRoot":"","sources":["../../src/leave/notice-gate.ts"],"names":[],"mappings":"AAAA,yCAAyC;AACzC;;;;;GAKG;AACH,OAAO,EAAE,OAAO,EAAiB,MAAM,YAAY,CAAC;AAqCpD,qEAAqE;AACrE,MAAM,UAAU,SAAS,CAAC,KAAgB;IACxC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,GAAG,KAAK,CAAC;IACpC,MAAM,IAAI,GAAG,CAAC,GAAY,EAAc,EAAE,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,EAAE,CAAC,CAAC;IAChF,IAAI,SAAS,IAAI,CAAC;QAAE,OAAO,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;IAC5D,IAAI,KAAK,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACpC,IAAI,MAAM,KAAK,IAAI,IAAI,MAAM,CAAC,MAAM,KAAK,IAAI;QAAE,OAAO,IAAI,CAAC,WAAW,CAAC,CAAC;IACxE,IAAI,CAAC,MAAM,CAAC,MAAM;QAAE,OAAO,IAAI,CAAC,YAAY,CAAC,CAAC;IAC9C,IAAI,MAAM,CAAC,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC,KAAK,CAAC,aAAa,CAAC;QAAE,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC;IACtF,MAAM,IAAI,GAAG,KAAK,CAAC,KAAK,KAAK,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,UAAU,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC;IACzE,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACrD,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,SAAS,GAAG,KAAK,EAAE,GAAG,EAAE,IAAI,EAAE,CAAC;AACvD,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { type LeavePreset } from './entitlement.js';
2
+ /** The days a year, bank holidays included, when a policy names none. */
3
+ export declare const ENGLAND_WALES_DEFAULT_DAYS = 33;
4
+ /** What this preset does not do, for the setup screen and the adviser. */
5
+ export declare const ENGLAND_WALES_LIMITS: readonly string[];
6
+ /** 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. */
7
+ export declare const englandWalesWith: (confirmed?: number | null) => LeavePreset;
8
+ /** On the default figure. */
9
+ export declare const englandWales: LeavePreset;
10
+ //# sourceMappingURL=preset-england-wales.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"preset-england-wales.d.ts","sourceRoot":"","sources":["../../src/leave/preset-england-wales.ts"],"names":[],"mappings":"AAcA,OAAO,EAAgD,KAAK,WAAW,EAAgB,MAAM,kBAAkB,CAAC;AAGhH,yEAAyE;AACzE,eAAO,MAAM,0BAA0B,KAAK,CAAC;AAyB7C,0EAA0E;AAC1E,eAAO,MAAM,oBAAoB,EAAE,SAAS,MAAM,EAQjD,CAAC;AAEF,mJAAmJ;AACnJ,eAAO,MAAM,gBAAgB,GAAI,YAAY,MAAM,GAAG,IAAI,KAAG,WAa5D,CAAC;AAEF,6BAA6B;AAC7B,eAAO,MAAM,YAAY,EAAE,WAAoC,CAAC"}
@@ -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,MAA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,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
+ * 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,gB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/** 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,CAA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