assignment-user-matcher 1.16.0 → 1.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (166) hide show
  1. package/README.md +312 -20
  2. package/dist/escalation/policy.d.ts +11 -0
  3. package/dist/escalation/policy.d.ts.map +1 -1
  4. package/dist/escalation/policy.js +22 -1
  5. package/dist/forecasting/backtest.d.ts +52 -0
  6. package/dist/forecasting/backtest.d.ts.map +1 -0
  7. package/dist/forecasting/backtest.js +195 -0
  8. package/dist/forecasting/calendar.d.ts +44 -0
  9. package/dist/forecasting/calendar.d.ts.map +1 -0
  10. package/dist/forecasting/calendar.js +85 -0
  11. package/dist/forecasting/cover.d.ts +69 -0
  12. package/dist/forecasting/cover.d.ts.map +1 -0
  13. package/dist/forecasting/cover.js +103 -0
  14. package/dist/forecasting/days.d.ts +17 -0
  15. package/dist/forecasting/days.d.ts.map +1 -0
  16. package/dist/forecasting/days.js +35 -0
  17. package/dist/forecasting/distributions.d.ts +31 -0
  18. package/dist/forecasting/distributions.d.ts.map +1 -0
  19. package/dist/forecasting/distributions.js +154 -0
  20. package/dist/forecasting/effects.d.ts +88 -0
  21. package/dist/forecasting/effects.d.ts.map +1 -0
  22. package/dist/forecasting/effects.js +303 -0
  23. package/dist/forecasting/erlang.d.ts +31 -0
  24. package/dist/forecasting/erlang.d.ts.map +1 -0
  25. package/dist/forecasting/erlang.js +86 -0
  26. package/dist/forecasting/forecast.d.ts +7 -0
  27. package/dist/forecasting/forecast.d.ts.map +1 -0
  28. package/dist/forecasting/forecast.js +221 -0
  29. package/dist/forecasting/index.d.ts +18 -0
  30. package/dist/forecasting/index.d.ts.map +1 -0
  31. package/dist/forecasting/index.js +54 -0
  32. package/dist/forecasting/model.d.ts +145 -0
  33. package/dist/forecasting/model.d.ts.map +1 -0
  34. package/dist/forecasting/model.js +583 -0
  35. package/dist/forecasting/nowcast.d.ts +26 -0
  36. package/dist/forecasting/nowcast.d.ts.map +1 -0
  37. package/dist/forecasting/nowcast.js +92 -0
  38. package/dist/forecasting/simulation.d.ts +91 -0
  39. package/dist/forecasting/simulation.d.ts.map +1 -0
  40. package/dist/forecasting/simulation.js +478 -0
  41. package/dist/forecasting/spikes.d.ts +6 -0
  42. package/dist/forecasting/spikes.d.ts.map +1 -0
  43. package/dist/forecasting/spikes.js +73 -0
  44. package/dist/forecasting/staffing.d.ts +64 -0
  45. package/dist/forecasting/staffing.d.ts.map +1 -0
  46. package/dist/forecasting/staffing.js +765 -0
  47. package/dist/forecasting/stats.d.ts +11 -0
  48. package/dist/forecasting/stats.d.ts.map +1 -0
  49. package/dist/forecasting/stats.js +45 -0
  50. package/dist/forecasting/types.d.ts +299 -0
  51. package/dist/forecasting/types.d.ts.map +1 -0
  52. package/dist/forecasting/types.js +8 -0
  53. package/dist/index.d.ts +3 -2
  54. package/dist/index.d.ts.map +1 -1
  55. package/dist/index.js +8 -1
  56. package/dist/learning/auto-weights.d.ts +1 -5
  57. package/dist/learning/auto-weights.d.ts.map +1 -1
  58. package/dist/learning/auto-weights.js +0 -3
  59. package/dist/lua/book-slot.lua +84 -0
  60. package/dist/lua/claim-queued.lua +47 -0
  61. package/dist/managers/DecisionTraceManager.d.ts +15 -0
  62. package/dist/managers/DecisionTraceManager.d.ts.map +1 -1
  63. package/dist/managers/DecisionTraceManager.js +117 -11
  64. package/dist/managers/LearningManager.d.ts +12 -0
  65. package/dist/managers/LearningManager.d.ts.map +1 -1
  66. package/dist/managers/LearningManager.js +21 -7
  67. package/dist/managers/ReliabilityManager.d.ts +1 -2
  68. package/dist/managers/ReliabilityManager.d.ts.map +1 -1
  69. package/dist/managers/ReliabilityManager.js +1 -1
  70. package/dist/managers/TelemetryManager.d.ts.map +1 -1
  71. package/dist/managers/TelemetryManager.js +9 -3
  72. package/dist/managers/WorkflowManager.d.ts.map +1 -1
  73. package/dist/managers/WorkflowManager.js +3 -4
  74. package/dist/matcher.class.d.ts +319 -4
  75. package/dist/matcher.class.d.ts.map +1 -1
  76. package/dist/matcher.class.js +1428 -102
  77. package/dist/queries/lane-stats.d.ts +51 -0
  78. package/dist/queries/lane-stats.d.ts.map +1 -0
  79. package/dist/queries/lane-stats.js +78 -0
  80. package/dist/schedule/recurrence.d.ts +11 -0
  81. package/dist/schedule/recurrence.d.ts.map +1 -1
  82. package/dist/schedule/recurrence.js +19 -2
  83. package/dist/schedule/slot.d.ts +60 -0
  84. package/dist/schedule/slot.d.ts.map +1 -0
  85. package/dist/schedule/slot.js +86 -0
  86. package/dist/scheduling/constraints/availability.d.ts +2 -14
  87. package/dist/scheduling/constraints/availability.d.ts.map +1 -1
  88. package/dist/scheduling/constraints/availability.js +14 -15
  89. package/dist/scheduling/constraints/consecutive.d.ts +10 -0
  90. package/dist/scheduling/constraints/consecutive.d.ts.map +1 -1
  91. package/dist/scheduling/constraints/consecutive.js +64 -1
  92. package/dist/scheduling/constraints/contract.d.ts.map +1 -1
  93. package/dist/scheduling/constraints/contract.js +12 -3
  94. package/dist/scheduling/constraints/employee-scope.d.ts.map +1 -1
  95. package/dist/scheduling/constraints/employee-scope.js +10 -2
  96. package/dist/scheduling/constraints/group-composition.js +2 -2
  97. package/dist/scheduling/constraints/min-staffing.d.ts.map +1 -1
  98. package/dist/scheduling/constraints/min-staffing.js +51 -8
  99. package/dist/scheduling/constraints/rolling-hours.d.ts.map +1 -1
  100. package/dist/scheduling/constraints/rolling-hours.js +29 -4
  101. package/dist/scheduling/constraints/support.d.ts +4 -8
  102. package/dist/scheduling/constraints/support.d.ts.map +1 -1
  103. package/dist/scheduling/constraints/support.js +23 -2
  104. package/dist/scheduling/constraints/weekly-rest.d.ts +28 -0
  105. package/dist/scheduling/constraints/weekly-rest.d.ts.map +1 -1
  106. package/dist/scheduling/constraints/weekly-rest.js +108 -21
  107. package/dist/scheduling/engine/construction.d.ts.map +1 -1
  108. package/dist/scheduling/engine/construction.js +56 -7
  109. package/dist/scheduling/engine/objective.d.ts +0 -1
  110. package/dist/scheduling/engine/objective.d.ts.map +1 -1
  111. package/dist/scheduling/engine/objective.js +65 -6
  112. package/dist/scheduling/engine/search.d.ts +4 -0
  113. package/dist/scheduling/engine/search.d.ts.map +1 -1
  114. package/dist/scheduling/engine/search.js +2 -1
  115. package/dist/scheduling/engine/state.d.ts +14 -0
  116. package/dist/scheduling/engine/state.d.ts.map +1 -1
  117. package/dist/scheduling/engine/state.js +7 -0
  118. package/dist/scheduling/engine/timeline.d.ts +23 -1
  119. package/dist/scheduling/engine/timeline.d.ts.map +1 -1
  120. package/dist/scheduling/engine/timeline.js +85 -27
  121. package/dist/scheduling/engine/verdicts.d.ts +40 -1
  122. package/dist/scheduling/engine/verdicts.d.ts.map +1 -1
  123. package/dist/scheduling/engine/verdicts.js +177 -17
  124. package/dist/scheduling/index.d.ts +3 -2
  125. package/dist/scheduling/index.d.ts.map +1 -1
  126. package/dist/scheduling/index.js +7 -1
  127. package/dist/scheduling/model.d.ts +8 -4
  128. package/dist/scheduling/model.d.ts.map +1 -1
  129. package/dist/scheduling/model.js +239 -23
  130. package/dist/scheduling/operations.d.ts +174 -2
  131. package/dist/scheduling/operations.d.ts.map +1 -1
  132. package/dist/scheduling/operations.js +558 -21
  133. package/dist/scheduling/preference-report.d.ts +15 -0
  134. package/dist/scheduling/preference-report.d.ts.map +1 -0
  135. package/dist/scheduling/preference-report.js +111 -0
  136. package/dist/scheduling/preferences.d.ts +30 -0
  137. package/dist/scheduling/preferences.d.ts.map +1 -0
  138. package/dist/scheduling/preferences.js +85 -0
  139. package/dist/scheduling/resilience.d.ts +46 -0
  140. package/dist/scheduling/resilience.d.ts.map +1 -0
  141. package/dist/scheduling/resilience.js +45 -0
  142. package/dist/scheduling/scheduler.class.d.ts +12 -1
  143. package/dist/scheduling/scheduler.class.d.ts.map +1 -1
  144. package/dist/scheduling/scheduler.class.js +28 -4
  145. package/dist/scheduling/sites.d.ts +1 -1
  146. package/dist/scheduling/sites.d.ts.map +1 -1
  147. package/dist/scheduling/sites.js +34 -1
  148. package/dist/scheduling/time.d.ts +28 -6
  149. package/dist/scheduling/time.d.ts.map +1 -1
  150. package/dist/scheduling/time.js +59 -17
  151. package/dist/scheduling/types.d.ts +247 -7
  152. package/dist/scheduling/types.d.ts.map +1 -1
  153. package/dist/scoring/fair-arbitration.d.ts.map +1 -1
  154. package/dist/scoring/fair-arbitration.js +2 -1
  155. package/dist/tracing/decision-trace.d.ts +5 -0
  156. package/dist/tracing/decision-trace.d.ts.map +1 -1
  157. package/dist/tracing/decision-trace.js +3 -0
  158. package/dist/types/matcher.d.ts +369 -2
  159. package/dist/types/matcher.d.ts.map +1 -1
  160. package/dist/updates/assignment-update.d.ts +93 -0
  161. package/dist/updates/assignment-update.d.ts.map +1 -0
  162. package/dist/updates/assignment-update.js +91 -0
  163. package/dist/utils/keys.d.ts +10 -0
  164. package/dist/utils/keys.d.ts.map +1 -1
  165. package/dist/utils/keys.js +43 -0
  166. package/package.json +25 -3
@@ -10,7 +10,8 @@
10
10
  * is reading at the time.
11
11
  */
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.collectAggregateViolations = exports.collectPairViolations = exports.verdictsFor = void 0;
13
+ exports.anyHardDeltaGiven = exports.collectAggregateViolations = exports.hardBlocked = exports.anyHardDeltaIn = exports.readsCrew = exports.anyHardDelta = exports.pairViolationsFrom = exports.collectPairVerdicts = exports.collectPairViolations = exports.verdictsFor = void 0;
14
+ const support_1 = require("../constraints/support");
14
15
  /** Every rule's verdict on one pair, in registry order. */
15
16
  function verdictsFor(state, pair) {
16
17
  const out = [];
@@ -36,29 +37,165 @@ function verdictsFor(state, pair) {
36
37
  exports.verdictsFor = verdictsFor;
37
38
  /** Breaches attributable to individual assignments in the committed roster. */
38
39
  function collectPairViolations(state) {
40
+ return pairViolationsFrom(collectPairVerdicts(state));
41
+ }
42
+ exports.collectPairViolations = collectPairViolations;
43
+ /** Every committed pair with every rule's verdict on it, in assignment order. */
44
+ function collectPairVerdicts(state) {
39
45
  const out = [];
40
46
  for (const [shiftInstanceId, employees] of state.assignments) {
41
47
  for (const employeeId of employees) {
42
- for (const v of verdictsFor(state, { employeeId, shiftInstanceId })) {
43
- if (v.pass)
44
- continue;
45
- out.push({
46
- constraintId: v.ruleId,
47
- severity: v.severity,
48
- employeeId,
49
- shiftInstanceId,
50
- message: v.message,
51
- citation: v.citation,
52
- actual: v.actual,
53
- required: v.required,
54
- unit: v.unit,
55
- });
56
- }
48
+ const pair = { employeeId, shiftInstanceId };
49
+ out.push({ pair, verdicts: verdictsFor(state, pair) });
57
50
  }
58
51
  }
59
52
  return out;
60
53
  }
61
- exports.collectPairViolations = collectPairViolations;
54
+ exports.collectPairVerdicts = collectPairVerdicts;
55
+ /**
56
+ * The failing verdicts of `collectPairVerdicts`, as violations. Split out so a
57
+ * caller that reports the verdicts too (`checkCompliance`) judges each pair
58
+ * once rather than twice — the verdicts are the expensive part.
59
+ */
60
+ function pairViolationsFrom(pairVerdicts) {
61
+ const out = [];
62
+ for (const { pair, verdicts } of pairVerdicts) {
63
+ for (const v of verdicts) {
64
+ if (v.pass)
65
+ continue;
66
+ out.push({
67
+ constraintId: v.ruleId,
68
+ severity: v.severity,
69
+ employeeId: pair.employeeId,
70
+ shiftInstanceId: pair.shiftInstanceId,
71
+ message: v.message,
72
+ citation: v.citation,
73
+ actual: v.actual,
74
+ required: v.required,
75
+ unit: v.unit,
76
+ });
77
+ }
78
+ }
79
+ return out;
80
+ }
81
+ exports.pairViolationsFrom = pairViolationsFrom;
82
+ /**
83
+ * Relative cost of judging one pair, by rule id. Static facts (time off, site,
84
+ * qualification, availability) are a lookup; timeline rules probe windows.
85
+ * Unknown ids — custom rules — sort with the expensive ones.
86
+ */
87
+ const RULE_COST = {
88
+ 'time-off': 0,
89
+ 'site-eligibility': 0,
90
+ qualification: 0,
91
+ 'max-shift-duration': 0,
92
+ protections: 0,
93
+ availability: 0,
94
+ 'no-overlap': 1,
95
+ 'one-shift-per-day': 1,
96
+ 'group-composition': 1,
97
+ contract: 1,
98
+ 'hour-budget': 1,
99
+ 'engagement-floor': 1,
100
+ notice: 1,
101
+ 'min-rest': 2,
102
+ 'start-interval': 2,
103
+ 'site-travel-gap': 2,
104
+ 'shift-succession': 2,
105
+ 'daily-rest': 2,
106
+ };
107
+ const byCost = new WeakMap();
108
+ /**
109
+ * The context's rules, cheapest first. Only for questions whose answer does
110
+ * not depend on the order the rules are asked in — "does any hard rule
111
+ * object?" — where a cheap early rejection saves the window probes. Custom
112
+ * rules keep their place after every built-in one, so a custom rule is still
113
+ * only consulted once the built-ins have all passed.
114
+ */
115
+ function constraintsByCost(ctx) {
116
+ let ordered = byCost.get(ctx);
117
+ if (!ordered) {
118
+ const rank = (c) => (support_1.builtInConstraints.has(c) ? RULE_COST[c.id] ?? 3 : 10);
119
+ ordered = ctx.constraints
120
+ .map((c, index) => ({ c, index }))
121
+ .sort((a, b) => rank(a.c) - rank(b.c) || a.index - b.index)
122
+ .map(({ c }) => c);
123
+ byCost.set(ctx, ordered);
124
+ }
125
+ return ordered;
126
+ }
127
+ /** Whether any hard rule's `delta` objects to the pair — `hardCompliant`'s question, short-circuited. */
128
+ function anyHardDelta(ctx, state, pair) {
129
+ for (const c of constraintsByCost(ctx)) {
130
+ if (c.hardness === 'hard' && c.delta(state, pair) > 0)
131
+ return true;
132
+ }
133
+ return false;
134
+ }
135
+ exports.anyHardDelta = anyHardDelta;
136
+ /**
137
+ * Built-in rules whose per-pair judgement reads the instance's crew — who else
138
+ * is on the shift — rather than only the person's own timeline and records.
139
+ * Everything else a pair-scoped built-in reads moves only when the person does.
140
+ */
141
+ const CREW_RULES = new Set(['group-composition', 'hour-budget']);
142
+ /** Whether a built-in rule's per-pair judgement reads who else is on the shift. */
143
+ function readsCrew(c) {
144
+ return CREW_RULES.has(c.id);
145
+ }
146
+ exports.readsCrew = readsCrew;
147
+ const hardSplit = new WeakMap();
148
+ /**
149
+ * `anyHardDelta` over one half of the hard rules: those that read the crew of
150
+ * the instance, or those that read only the person. The two halves together
151
+ * are exactly `anyHardDelta`; splitting them lets a caller remember the
152
+ * person half for as long as the person's schedule stands still.
153
+ */
154
+ function anyHardDeltaIn(ctx, state, pair, half) {
155
+ let split = hardSplit.get(ctx);
156
+ if (!split) {
157
+ const hard = constraintsByCost(ctx).filter((c) => c.hardness === 'hard');
158
+ split = { person: hard.filter((c) => !CREW_RULES.has(c.id)), crew: hard.filter((c) => CREW_RULES.has(c.id)) };
159
+ hardSplit.set(ctx, split);
160
+ }
161
+ for (const c of split[half]) {
162
+ if (c.delta(state, pair) > 0)
163
+ return true;
164
+ }
165
+ return false;
166
+ }
167
+ exports.anyHardDeltaIn = anyHardDeltaIn;
168
+ /**
169
+ * Whether the pair is blocked: some verdict fails at hard severity, or some
170
+ * hard rule's `delta` objects. Equal to checking `verdictsFor(...).some(hard
171
+ * failure) || anyHardDelta(...)`, but stops at the first objection and reads a
172
+ * rule's verdict once where its delta is known to mirror it.
173
+ */
174
+ function hardBlocked(state, pair) {
175
+ for (const c of constraintsByCost(state.ctx)) {
176
+ if (c.verdict) {
177
+ const v = c.verdict(state, pair);
178
+ if (!v.pass && v.severity === 'hard')
179
+ return true;
180
+ if (c.hardness === 'hard') {
181
+ if ((0, support_1.deltaMirrorsVerdict)(c)) {
182
+ if (!v.pass)
183
+ return true;
184
+ }
185
+ else if (c.delta(state, pair) > 0) {
186
+ return true;
187
+ }
188
+ }
189
+ }
190
+ else if (c.hardness === 'hard' && c.delta(state, pair) > 0) {
191
+ // A rule without a verdict reports its hardness as its severity,
192
+ // so only a hard one can block.
193
+ return true;
194
+ }
195
+ }
196
+ return false;
197
+ }
198
+ exports.hardBlocked = hardBlocked;
62
199
  /** Breaches only a whole-roster view can see: coverage, quotas, team fairness. */
63
200
  function collectAggregateViolations(state) {
64
201
  const out = [];
@@ -72,3 +209,26 @@ function collectAggregateViolations(state) {
72
209
  return out;
73
210
  }
74
211
  exports.collectAggregateViolations = collectAggregateViolations;
212
+ /**
213
+ * `anyHardDelta` for a pair whose `verdictsFor` is already in hand. A rule
214
+ * without a verdict had its verdict synthesised from its delta, and a
215
+ * `fromVerdict` rule's delta mirrors its verdict, so only a rule with its own
216
+ * independent delta is asked again.
217
+ */
218
+ function anyHardDeltaGiven(state, pair, verdicts) {
219
+ const constraints = state.ctx.constraints;
220
+ for (let i = 0; i < constraints.length; i++) {
221
+ const c = constraints[i];
222
+ if (c.hardness !== 'hard')
223
+ continue;
224
+ if (!c.verdict || (0, support_1.deltaMirrorsVerdict)(c)) {
225
+ if (!verdicts[i].pass)
226
+ return true;
227
+ }
228
+ else if (c.delta(state, pair) > 0) {
229
+ return true;
230
+ }
231
+ }
232
+ return false;
233
+ }
234
+ exports.anyHardDeltaGiven = anyHardDeltaGiven;
@@ -3,11 +3,12 @@ export { ShiftScheduler, solveSchedule, ENGINE_VERSION } from './scheduler.class
3
3
  export { ScheduleValidationError } from './types';
4
4
  /** Directive 2003/88/EC Art 3 floor (11h), the default when `minRestMinutes` is omitted. */
5
5
  export { DEFAULT_MIN_REST_MINUTES } from './constraints/min-rest';
6
- export { checkCompliance, explainCandidate, repairSchedule, rankCandidates, diagnoseInfeasibility, type ComplianceReport, type Disruption, type RepairCandidate, type RepairResult, type InfeasibilityReport, } from './operations';
6
+ export { checkCompliance, explainCandidate, repairSchedule, rankCandidates, rankShiftsFor, assessShiftResilience, rankSwapPartners, checkSwap, diagnoseInfeasibility, type ComplianceReport, type SwapPartner, type SwapPartnerOptions, type SwapTrade, type SwapCheck, type Disruption, type RepairCandidate, type RepairResult, type InfeasibilityReport, type TagCover, type ResilienceOptions, } from './operations';
7
+ export { resilienceTier, type ResilienceTier, type ShiftResilience, type SkillResilience } from './resilience';
7
8
  export { PeriodClock, type MinuteRange, type ClockRange } from './time';
8
9
  export { expandShiftInstances } from './model';
9
10
  export { hours, days, weeklyAverageOver } from './rules';
10
11
  export { DEFAULT_CONTRACT_HOURS_WEIGHT, contractedPeriodMinutes, fullTimeWeeklyMinutes, resolveContractedWeeklyMinutes, } from './contract-hours';
11
- export type { AssignmentPair, AvailabilityRule, BreakRule, ClockRangeConfig, ConsecutiveRule, ConstraintOptions, ConstraintViolation, ContractHoursRule, ContractHoursSummary, DailyRestRule, DutyClassification, DutyQuota, Employee, EmployeeContract, EmployeeCost, EmployeeProtection, EngagementRule, FairnessRule, HistoricalAssignment, LedgerEntry, ModelContext, NightVolumeQuota, NightWorkRule, NoticeRule, ObjectiveWeights, OvertimeRule, Qualification, RestDayRule, RollingAverage, RuleVerdict, ScheduleInput, ScheduleProvenance, ScheduleResult, ScheduledAssignment, SchedulingConstraint, SearchState, Severity, ShiftInstance, ShiftTemplate, ShiftDemandOverride, Site, SiteIndex, TimeOffEntry, WeeklyRestRule, WorkingTimeLimits, WorkingTimeRules, } from './types';
12
+ export type { AssignmentPair, AvailabilityRule, BreakRule, ClockRangeConfig, ConsecutiveRule, ConstraintOptions, ConstraintViolation, ContractHoursRule, ContractHoursSummary, DailyRestRule, DutyClassification, DutyQuota, Employee, EmployeeContract, EmployeeCost, EmployeePreferenceReport, EmployeeProtection, EngagementRule, FairnessRule, HistoricalAssignment, LedgerEntry, ModelContext, NightVolumeQuota, NightWorkRule, NoticeRule, ObjectiveWeights, OvertimeRule, PreferenceObjective, PreferenceRuleOutcome, Qualification, RestDayRule, RollingAverage, RuleVerdict, ScheduleInput, ScheduleProvenance, ScheduleResult, SearchProgress, ScheduledAssignment, SchedulingConstraint, SearchState, Severity, ShiftInstance, ShiftTemplate, TagRequirement, ShiftDemandOverride, Site, SiteIndex, TimeOffEntry, WeeklyRestRule, WorkingTimeLimits, WorkingTimeRules, } from './types';
12
13
  export type { PersonTimeline, TimelineEntry, TimelineIndex } from './engine/timeline';
13
14
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/scheduling/index.ts"],"names":[],"mappings":"AAAA,+CAA+C;AAC/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAClF,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AiB,EACjB,oBAAoB,EACpB,aAAa,EACb,kBAAkB,EAClB,SAAS,EACT,QAAQ,EACR,gBAAgB,EAChB,YAAY,EACZ,wBAAwB,EACxB,kBAAkB,EAClB,cAAc,EACd,YAAY,EACZ,oBAAoB,EACpB,WAAW,EACX,YAAY,EACZ,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,gBAAgB,EAChB,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,aAAa,EACb,WAAW,EACX,cAAc,EACd,WAAW,EACX,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,oBAAoB,EACpB,WAAW,EACX,QAAQ,EACR,aAAa,EACb,aAAa,EACb,cAAc,EACd,mBAAmB,EACnB,IAAI,EACJ,SAAS,EACT,YAAY,EACZ,cAAc,EACd,iBAAiB,EACjB,gBAAgB,GACnB,MAAM,SAAS,CAAC;AAIjB,YAAY,EAAE,cAAc,EAAE,aAAa,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.resolveContractedWeeklyMinutes = exports.fullTimeWeeklyMinutes = exports.contractedPeriodMinutes = exports.DEFAULT_CONTRACT_HOURS_WEIGHT = exports.weeklyAverageOver = exports.days = exports.hours = exports.expandShiftInstances = exports.PeriodClock = exports.diagnoseInfeasibility = exports.rankCandidates = exports.repairSchedule = exports.explainCandidate = exports.checkCompliance = exports.DEFAULT_MIN_REST_MINUTES = exports.ScheduleValidationError = exports.ENGINE_VERSION = exports.solveSchedule = exports.ShiftScheduler = void 0;
3
+ exports.resolveContractedWeeklyMinutes = exports.fullTimeWeeklyMinutes = exports.contractedPeriodMinutes = exports.DEFAULT_CONTRACT_HOURS_WEIGHT = exports.weeklyAverageOver = exports.days = exports.hours = exports.expandShiftInstances = exports.PeriodClock = exports.resilienceTier = exports.diagnoseInfeasibility = exports.checkSwap = exports.rankSwapPartners = exports.assessShiftResilience = exports.rankShiftsFor = exports.rankCandidates = exports.repairSchedule = exports.explainCandidate = exports.checkCompliance = exports.DEFAULT_MIN_REST_MINUTES = exports.ScheduleValidationError = exports.ENGINE_VERSION = exports.solveSchedule = exports.ShiftScheduler = void 0;
4
4
  /** Public surface of the scheduling module. */
5
5
  var scheduler_class_1 = require("./scheduler.class");
6
6
  Object.defineProperty(exports, "ShiftScheduler", { enumerable: true, get: function () { return scheduler_class_1.ShiftScheduler; } });
@@ -17,7 +17,13 @@ Object.defineProperty(exports, "checkCompliance", { enumerable: true, get: funct
17
17
  Object.defineProperty(exports, "explainCandidate", { enumerable: true, get: function () { return operations_1.explainCandidate; } });
18
18
  Object.defineProperty(exports, "repairSchedule", { enumerable: true, get: function () { return operations_1.repairSchedule; } });
19
19
  Object.defineProperty(exports, "rankCandidates", { enumerable: true, get: function () { return operations_1.rankCandidates; } });
20
+ Object.defineProperty(exports, "rankShiftsFor", { enumerable: true, get: function () { return operations_1.rankShiftsFor; } });
21
+ Object.defineProperty(exports, "assessShiftResilience", { enumerable: true, get: function () { return operations_1.assessShiftResilience; } });
22
+ Object.defineProperty(exports, "rankSwapPartners", { enumerable: true, get: function () { return operations_1.rankSwapPartners; } });
23
+ Object.defineProperty(exports, "checkSwap", { enumerable: true, get: function () { return operations_1.checkSwap; } });
20
24
  Object.defineProperty(exports, "diagnoseInfeasibility", { enumerable: true, get: function () { return operations_1.diagnoseInfeasibility; } });
25
+ var resilience_1 = require("./resilience");
26
+ Object.defineProperty(exports, "resilienceTier", { enumerable: true, get: function () { return resilience_1.resilienceTier; } });
21
27
  // Time model, exported so hosts can resolve the same wall-clock the engine does.
22
28
  var time_1 = require("./time");
23
29
  Object.defineProperty(exports, "PeriodClock", { enumerable: true, get: function () { return time_1.PeriodClock; } });
@@ -24,8 +24,9 @@
24
24
  * days, and read only the first key of each time-off entry. All of those are
25
25
  * modeled properly here.
26
26
  */
27
- import type { AvailabilityRule, ConstraintOptions, ModelContext, ObjectiveWeights, ScheduleInput, SchedulingConstraint, ShiftInstance, ShiftTemplate, WorkingTimeRules } from './types';
27
+ import type { ConstraintOptions, ModelContext, ObjectiveWeights, ScheduleInput, SchedulingConstraint, ShiftInstance, ShiftTemplate, WorkingTimeRules } from './types';
28
28
  import { PeriodClock, MINUTES_PER_DAY } from './time';
29
+ export { availabilityApplies } from './preferences';
29
30
  export { daysBetween, addDays } from './time';
30
31
  /**
31
32
  * Expand a whole input's templates into the dated occurrences the engine will
@@ -38,10 +39,15 @@ export { daysBetween, addDays } from './time';
38
39
  * refers to.
39
40
  */
40
41
  export declare function expandShiftInstances(input: ScheduleInput): ShiftInstance[];
41
- /** Expand one template into its dated instances inside the period. */
42
42
  export declare function expandTemplate(template: ShiftTemplate, clock: PeriodClock, periodDays: number, context: {
43
43
  nightRule?: WorkingTimeRules['nightWork'];
44
44
  publicHolidays: Set<string>;
45
+ /**
46
+ * Per-site holiday calendars, replacing the roster calendar for shifts
47
+ * at that site. Present but empty means the site observes none — the
48
+ * distinction an `undefined` entry cannot carry.
49
+ */
50
+ holidaysBySite?: Map<string, Set<string>>;
45
51
  }): ShiftInstance[];
46
52
  /**
47
53
  * Merge the global rule set with one person's overrides.
@@ -58,7 +64,5 @@ export declare function resolveConstraints(options: ConstraintOptions | undefine
58
64
  * `ScheduleValidationError` on malformed input — never a silent wrong schedule.
59
65
  */
60
66
  export declare function buildModel(input: ScheduleInput): ModelContext;
61
- /** Whether an availability rule applies to a shift instance. */
62
- export declare function availabilityApplies(rule: AvailabilityRule, inst: ShiftInstance): boolean;
63
67
  export { MINUTES_PER_DAY };
64
68
  //# sourceMappingURL=model.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/scheduling/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AAEH,OAAO,KAAK,EAER,gBAAgB,EAChB,iBAAiB,EAGjB,YAAY,EACZ,gBAAgB,EAChB,a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