@jsb188/schedule 1.1.11

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 (60) hide show
  1. package/package.json +61 -0
  2. package/src/constants/schedule.ts +549 -0
  3. package/src/css.d.ts +7 -0
  4. package/src/libs/gantt-geometry.ts +771 -0
  5. package/src/libs/gantt-histogram.ts +124 -0
  6. package/src/libs/gantt-keyboard.ts +113 -0
  7. package/src/libs/gantt-state.ts +57 -0
  8. package/src/libs/gantt-url.ts +63 -0
  9. package/src/modules/Gantt.helpers.ts +138 -0
  10. package/src/modules/Gantt.tsx +719 -0
  11. package/src/types/schedule.d.ts +1149 -0
  12. package/src/ui/ActivityFormUI.tsx +133 -0
  13. package/src/ui/GanttEditorsUI.tsx +102 -0
  14. package/src/ui/GanttHistogramUI.tsx +236 -0
  15. package/src/ui/GanttUI.tsx +792 -0
  16. package/src/ui/ProjectFormUI.tsx +273 -0
  17. package/src/ui/ProjectMobileListUI.tsx +80 -0
  18. package/src/ui/ProjectToolbarUI.tsx +54 -0
  19. package/src/ui/RelationshipListUI.tsx +176 -0
  20. package/src/ui/ScheduleRunUI.tsx +173 -0
  21. package/src/ui/ScheduleSettingsUI.tsx +420 -0
  22. package/src/utils/coverage.helpers.ts +679 -0
  23. package/src/utils/coverage.ts +630 -0
  24. package/src/utils/cpm.helpers.ts +674 -0
  25. package/src/utils/cpm.ts +907 -0
  26. package/src/utils/cpmLeveling.helpers.ts +564 -0
  27. package/src/utils/cpmLeveling.ts +367 -0
  28. package/src/utils/defaults.ts +8 -0
  29. package/src/utils/eligibility.ts +457 -0
  30. package/src/utils/planCsv.ts +344 -0
  31. package/src/utils/predecessorText.ts +96 -0
  32. package/src/utils/recurrence.ts +616 -0
  33. package/src/utils/request.ts +153 -0
  34. package/src/utils/resource.ts +182 -0
  35. package/src/utils/rule.ts +216 -0
  36. package/src/utils/run.ts +43 -0
  37. package/src/utils/series.ts +161 -0
  38. package/src/utils/slot.ts +208 -0
  39. package/src/utils/workTime.ts +1382 -0
  40. package/tests/coverage.fixtures.ts +111 -0
  41. package/tests/coverage.test.ts +503 -0
  42. package/tests/cpm.bench.test.ts +154 -0
  43. package/tests/cpm.test.ts +354 -0
  44. package/tests/cpmCorrectness.test.ts +327 -0
  45. package/tests/cpmLeveling.test.ts +471 -0
  46. package/tests/eligibility.test.ts +320 -0
  47. package/tests/gantt-geometry.test.ts +367 -0
  48. package/tests/gantt-histogram.test.ts +78 -0
  49. package/tests/gantt-keyboard.test.ts +69 -0
  50. package/tests/helpers/cpmFixtures.ts +101 -0
  51. package/tests/projectInputs.test.ts +165 -0
  52. package/tests/recurrence.test.ts +68 -0
  53. package/tests/request.test.ts +99 -0
  54. package/tests/resource.test.ts +95 -0
  55. package/tests/rule.test.ts +98 -0
  56. package/tests/series.test.ts +120 -0
  57. package/tests/workTime.test.ts +1007 -0
  58. package/tests/workTimeContracts.test.ts +111 -0
  59. package/tsconfig.json +13 -0
  60. package/vitest.config.ts +8 -0
package/package.json ADDED
@@ -0,0 +1,61 @@
1
+ {
2
+ "name": "@jsb188/schedule",
3
+ "version": "1.1.11",
4
+ "description": "Scheduling engines and contracts shared by the server and clients: working-time calendars, critical path scheduling, recurrence, and coverage rules.",
5
+ "license": "ISC",
6
+ "author": "jsb188",
7
+ "type": "module",
8
+ "exports": {
9
+ "./constants/schedule.ts": "./src/constants/schedule.ts",
10
+ "./libs/gantt-geometry.ts": "./src/libs/gantt-geometry.ts",
11
+ "./modules/Gantt.tsx": "./src/modules/Gantt.tsx",
12
+ "./types/schedule.d.ts": "./src/types/schedule.d.ts",
13
+ "./ui/ActivityFormUI.tsx": "./src/ui/ActivityFormUI.tsx",
14
+ "./ui/GanttUI.tsx": "./src/ui/GanttUI.tsx",
15
+ "./ui/ProjectFormUI.tsx": "./src/ui/ProjectFormUI.tsx",
16
+ "./ui/ProjectToolbarUI.tsx": "./src/ui/ProjectToolbarUI.tsx",
17
+ "./ui/RelationshipListUI.tsx": "./src/ui/RelationshipListUI.tsx",
18
+ "./ui/ScheduleRunUI.tsx": "./src/ui/ScheduleRunUI.tsx",
19
+ "./utils/coverage.ts": "./src/utils/coverage.ts",
20
+ "./utils/cpm.ts": "./src/utils/cpm.ts",
21
+ "./utils/recurrence.ts": "./src/utils/recurrence.ts",
22
+ "./utils/slot.ts": "./src/utils/slot.ts",
23
+ "./utils/workTime.ts": "./src/utils/workTime.ts",
24
+ "./utils/cpm.helpers.ts": "./src/utils/cpm.helpers.ts",
25
+ "./utils/cpmLeveling.ts": "./src/utils/cpmLeveling.ts",
26
+ "./utils/cpmLeveling.helpers.ts": "./src/utils/cpmLeveling.helpers.ts",
27
+ "./utils/coverage.helpers.ts": "./src/utils/coverage.helpers.ts",
28
+ "./utils/rule.ts": "./src/utils/rule.ts",
29
+ "./utils/eligibility.ts": "./src/utils/eligibility.ts",
30
+ "./utils/resource.ts": "./src/utils/resource.ts",
31
+ "./utils/series.ts": "./src/utils/series.ts",
32
+ "./utils/request.ts": "./src/utils/request.ts",
33
+ "./utils/defaults.ts": "./src/utils/defaults.ts",
34
+ "./libs/gantt-keyboard.ts": "./src/libs/gantt-keyboard.ts",
35
+ "./libs/gantt-state.ts": "./src/libs/gantt-state.ts",
36
+ "./modules/Gantt.helpers.ts": "./src/modules/Gantt.helpers.ts",
37
+ "./libs/gantt-histogram.ts": "./src/libs/gantt-histogram.ts",
38
+ "./ui/GanttHistogramUI.tsx": "./src/ui/GanttHistogramUI.tsx",
39
+ "./libs/gantt-url.ts": "./src/libs/gantt-url.ts",
40
+ "./utils/predecessorText.ts": "./src/utils/predecessorText.ts",
41
+ "./utils/run.ts": "./src/utils/run.ts",
42
+ "./utils/planCsv.ts": "./src/utils/planCsv.ts",
43
+ "./ui/ScheduleSettingsUI.tsx": "./src/ui/ScheduleSettingsUI.tsx",
44
+ "./ui/GanttEditorsUI.tsx": "./src/ui/GanttEditorsUI.tsx",
45
+ "./ui/ProjectMobileListUI.tsx": "./src/ui/ProjectMobileListUI.tsx"
46
+ },
47
+ "dependencies": {
48
+ "luxon": "^3.7.2"
49
+ },
50
+ "peerDependencies": {
51
+ "@jsb188/app": "1.1.11",
52
+ "@jsb188/react-web": "1.1.11",
53
+ "react": "^19.2.8",
54
+ "jotai": "^2.13.1",
55
+ "@jsb188/sheet": "1.1.11"
56
+ },
57
+ "scripts": {
58
+ "test": "vitest run --config ./vitest.config.ts --passWithNoTests",
59
+ "build": "tsc"
60
+ }
61
+ }
@@ -0,0 +1,549 @@
1
+ import type { ScheduleRuleKindEnum } from '../types/schedule.d.ts';
2
+
3
+ /* Shared scheduling contracts for project plans and coverage calendars. */
4
+
5
+ export const SCHEDULE_MODE_ENUMS = ['PROJECT', 'COVERAGE'] as const;
6
+
7
+ // The home view a mode opens on; every mode can still switch to the others
8
+ export const SCHEDULE_DEFAULT_VIEW_ENUMS = [
9
+ 'GANTT',
10
+ 'WEEK',
11
+ 'MONTH',
12
+ 'AGENDA',
13
+ ] as const;
14
+
15
+ /**
16
+ * Working-time calendars
17
+ *
18
+ * A work calendar says which minutes count as work. Durations in PROJECT mode
19
+ * are working minutes, so a five-day task spanning a weekend lands on the
20
+ * following Tuesday. COVERAGE calendars use the same object for operating
21
+ * hours (when a room must be covered).
22
+ */
23
+
24
+ // Weekdays use the JavaScript convention: 0 = Sunday ... 6 = Saturday
25
+ export const SCHEDULE_WEEKDAY_KEYS = [
26
+ '0',
27
+ '1',
28
+ '2',
29
+ '3',
30
+ '4',
31
+ '5',
32
+ '6',
33
+ ] as const;
34
+
35
+ // A calendar that never reaches working time in this many days is treated as
36
+ // empty; walking past it would only spin
37
+
38
+ // The platform standard calendar every organization starts from
39
+ export const SCHEDULE_STANDARD_WORK_CALENDAR_KEY = 'STANDARD_8X5';
40
+
41
+ /**
42
+ * Resources
43
+ *
44
+ * One table serves both engines. A person is a LABOR resource (optionally
45
+ * linked to a login through accountId), a crane is EQUIPMENT, concrete is
46
+ * MATERIAL, and a classroom or booth is SPACE. Roster assignments and
47
+ * project activity assignments both point at this table, which is the only
48
+ * place the two engines meet.
49
+ */
50
+
51
+ export const SCHEDULE_RESOURCE_KIND_ENUMS = [
52
+ 'LABOR',
53
+ 'EQUIPMENT',
54
+ 'MATERIAL',
55
+ 'SPACE',
56
+ ] as const;
57
+
58
+ /**
59
+ * Calendar items (COVERAGE and CALENDAR modes)
60
+ */
61
+
62
+ // SHIFT carries staffing requirements, EVENT is a plain calendar entry, BLOCK
63
+ // marks time a resource is unavailable (closure, maintenance, cleaning)
64
+ export const SCHEDULE_OCCURRENCE_KIND_ENUMS = [
65
+ 'SHIFT',
66
+ 'EVENT',
67
+ 'BLOCK',
68
+ ] as const;
69
+
70
+ // Only PUBLISHED rows are visible to workers
71
+ export const SCHEDULE_OCCURRENCE_STATUS_ENUMS = [
72
+ 'DRAFT',
73
+ 'PUBLISHED',
74
+ 'CANCELED',
75
+ ] as const;
76
+
77
+ export const SCHEDULE_ASSIGNMENT_STATUS_ENUMS = [
78
+ 'ASSIGNED',
79
+ 'RELEASED',
80
+ ] as const;
81
+
82
+ /**
83
+ * Coverage rules. Each kind maps to exactly one evaluator, so adding a rule
84
+ * kind is one evaluator plus one value here and in the DDL CHECK constraint.
85
+ *
86
+ * REQUIRED_COUNT a slot needs N assignees matching its predicate
87
+ * DERIVED_COUNT N is computed from a demand quantity (ratios)
88
+ * RESOURCE_CAPACITY a SPACE resource holds at most C concurrent items
89
+ * ACTOR_WINDOW_AGGREGATE per-person rolling-window limits (overtime, rest)
90
+ * ELIGIBILITY_AT_TIME the assignee holds a qualification valid then
91
+ */
92
+
93
+ export const SCHEDULE_RULE_KIND_ENUMS = [
94
+ 'REQUIRED_COUNT',
95
+ 'DERIVED_COUNT',
96
+ 'ROOM_CAPACITY',
97
+ 'OPERATING_HOURS',
98
+ 'ELIGIBILITY',
99
+ 'ACTOR_WINDOW_AGGREGATE',
100
+ ] as const;
101
+
102
+ // BLOCK prevents publishing the window; WARN records the breach and lets the
103
+ // publisher acknowledge it
104
+ export const SCHEDULE_RULE_SEVERITY_ENUMS = ['BLOCK', 'WARN'] as const;
105
+
106
+ /**
107
+ * Recurrence
108
+ *
109
+ * The stored recurrence spec is a closed structured object rather than an
110
+ * RFC 5545 RRULE string: it is validated on write, expanded deterministically,
111
+ * and rendered to an RRULE line only when a calendar feed is generated.
112
+ */
113
+
114
+ export const SCHEDULE_RECURRENCE_FREQ_ENUMS = [
115
+ 'DAILY',
116
+ 'WEEKLY',
117
+ 'MONTHLY',
118
+ 'YEARLY',
119
+ ] as const;
120
+
121
+ // Largest repeat interval accepted ("every N weeks")
122
+ export const SCHEDULE_RECURRENCE_MAX_INTERVAL = 52;
123
+
124
+ // Hard ceiling on expander iterations for one call; only trips on a
125
+ // malformed rule (weekly recurrence over ten years is ~520 steps)
126
+ export const SCHEDULE_RECURRENCE_MAX_ITERATIONS = 20_000;
127
+
128
+ // A byMonthDay of -1 means "the last day of the month"
129
+ export const SCHEDULE_RECURRENCE_LAST_DAY_OF_MONTH = -1;
130
+
131
+ /**
132
+ * Materialization: how far ahead the horizon job keeps concrete occurrence
133
+ * rows, how far back a first pass may reach, and per-pass caps.
134
+ */
135
+
136
+ export const SCHEDULE_MATERIALIZATION_HORIZON_DAYS = 180;
137
+ export const SCHEDULE_MATERIALIZATION_MAX_BACKFILL_DAYS = 30;
138
+ export const SCHEDULE_MATERIALIZATION_MAX_PER_PASS = 500;
139
+ export const SCHEDULE_MATERIALIZATION_SERIES_PER_TICK = 50;
140
+ export const SCHEDULE_MATERIALIZATION_TOP_UP_MAX_PASSES = 5;
141
+
142
+ /**
143
+ * Query limits
144
+ */
145
+
146
+ // Longest calendar window one query may request; refused rather than clipped
147
+ export const SCHEDULE_QUERY_MAX_WINDOW_DAYS = 400;
148
+
149
+ // Most occurrences one window read may return
150
+ export const SCHEDULE_QUERY_MAX_OCCURRENCES = 2000;
151
+
152
+ // Longest one occurrence may span (31 days)
153
+ export const SCHEDULE_OCCURRENCE_MAX_DURATION_MINUTES = 31 * 24 * 60;
154
+
155
+ /**
156
+ * Projects (PROJECT mode)
157
+ *
158
+ * Everything below is the critical-path model: a project holds a work
159
+ * breakdown structure, activities with durations and logic, and the engine
160
+ * computes dates on every schedule run from the data date forward.
161
+ */
162
+
163
+ export const SCHEDULE_PROJECT_STATUS_ENUMS = [
164
+ 'PLANNING',
165
+ 'ACTIVE',
166
+ 'ON_HOLD',
167
+ 'COMPLETE',
168
+ 'ARCHIVED',
169
+ ] as const;
170
+
171
+ /**
172
+ * Activity types, matching the behaviors planners expect:
173
+ *
174
+ * TASK duration-driven work
175
+ * START_MILESTONE zero duration, marks a start
176
+ * FINISH_MILESTONE zero duration, marks a finish
177
+ * LEVEL_OF_EFFORT stretches to span the activities it is linked to
178
+ * (supervision, site facilities); never drives logic
179
+ * WBS_SUMMARY spans every activity under its WBS node
180
+ */
181
+
182
+ export const SCHEDULE_ACTIVITY_TYPE_ENUMS = [
183
+ 'TASK',
184
+ 'START_MILESTONE',
185
+ 'FINISH_MILESTONE',
186
+ 'LEVEL_OF_EFFORT',
187
+ 'WBS_SUMMARY',
188
+ ] as const;
189
+
190
+ export const SCHEDULE_ACTIVITY_STATUS_ENUMS = [
191
+ 'NOT_STARTED',
192
+ 'IN_PROGRESS',
193
+ 'COMPLETE',
194
+ ] as const;
195
+
196
+ // Which two of Duration, Units and Units/Time stay fixed when the third changes
197
+
198
+ // How percent complete is measured
199
+
200
+ // Relationship types between a predecessor and a successor
201
+ export const SCHEDULE_RELATIONSHIP_TYPE_ENUMS = [
202
+ 'FS',
203
+ 'SS',
204
+ 'FF',
205
+ 'SF',
206
+ ] as const;
207
+
208
+ /**
209
+ * Date constraints. Soft constraints pin one side of the logic; MANDATORY
210
+ * constraints override the logic entirely and are flagged when they do.
211
+ */
212
+
213
+ export const SCHEDULE_CONSTRAINT_TYPE_ENUMS = [
214
+ 'START_ON',
215
+ 'START_ON_OR_AFTER',
216
+ 'START_ON_OR_BEFORE',
217
+ 'FINISH_ON',
218
+ 'FINISH_ON_OR_AFTER',
219
+ 'FINISH_ON_OR_BEFORE',
220
+ 'MANDATORY_START',
221
+ 'MANDATORY_FINISH',
222
+ 'AS_LATE_AS_POSSIBLE',
223
+ ] as const;
224
+
225
+ // What an in-progress activity's remaining work waits for
226
+ // RETAINED remaining work still honours unfinished predecessors
227
+ // OVERRIDE remaining work resumes at the data date regardless
228
+ export const SCHEDULE_PROGRESS_LOGIC_ENUMS = ['RETAINED', 'OVERRIDE'] as const;
229
+
230
+ // Which calendar measures a relationship's lag
231
+ export const SCHEDULE_LAG_CALENDAR_ENUMS = [
232
+ 'PREDECESSOR',
233
+ 'SUCCESSOR',
234
+ 'PROJECT',
235
+ 'CONTINUOUS',
236
+ ] as const;
237
+
238
+ // How an assignment's units spread across its activity's duration
239
+
240
+ export const SCHEDULE_PROJECT_RUN_STATUS_ENUMS = [
241
+ 'QUEUED',
242
+ 'RUNNING',
243
+ 'COMPLETE',
244
+ 'FAILED',
245
+ 'CANCELLED',
246
+ 'SUPERSEDED',
247
+ ] as const;
248
+
249
+ /**
250
+ * Engine diagnostics, reported on every schedule run. ERROR codes stop the
251
+ * run; WARN codes are recorded and the run completes.
252
+ */
253
+
254
+ export const SCHEDULE_DIAGNOSTIC_CODE_ENUMS = [
255
+ // existing
256
+ 'CYCLE',
257
+ 'EMPTY_CALENDAR',
258
+ 'UNKNOWN_ACTIVITY',
259
+ 'OPEN_START',
260
+ 'OPEN_FINISH',
261
+ 'NEGATIVE_FLOAT',
262
+ 'CONSTRAINT_OVERRIDES_LOGIC',
263
+ 'OUT_OF_SEQUENCE',
264
+ 'ACTUALS_AFTER_DATA_DATE',
265
+ // new
266
+ 'INVALID_INPUT', // ERROR (duplicate id, unparsable instant, invalid zone, bad enum) or WARN (NaN/negative duration or lag → 0, illegal secondary constraint → ignored, duplicate relationship pair → first kept, bad leveling rows → skipped)
267
+ 'UNKNOWN_CALENDAR', // WARN, once per distinct unknown calendarId, default used
268
+ 'CONSTRAINT_BEFORE_DATA_DATE', // WARN, a MANDATORY_* / START_ON* / FINISH_ON* date earlier than the floor was raised to the floor (or is inert)
269
+ 'CALENDAR_RANGE_EXCEEDED', // ERROR, a walk exceeded SCHEDULE_WORK_TIME_MAX_SPAN_DAYS (names calendarId + activityId)
270
+ 'RESOURCE_OVERALLOCATED', // WARN, per (resource, contiguous stretch of days) still over after leveling; per assignment whose daily demand exceeds the resource's best day
271
+ 'LEVELING_DELAYED', // INFO, per delayed activity (minutes, resourceId)
272
+ 'LEVELING_EXCEEDED_FLOAT', // WARN, levelWithinFloat refused every start whose finish ≤ LF; placed at its bound start, overallocation kept
273
+ 'LEVELING_EXCEEDED_HORIZON', // WARN, no feasible start inside the horizon; placed at its bound start
274
+ ] as const;
275
+
276
+ // Total float at or below this many minutes marks an activity critical
277
+ export const SCHEDULE_CRITICAL_FLOAT_THRESHOLD_MINUTES = 0;
278
+
279
+ // Guards against a network no browser or worker could render
280
+ export const SCHEDULE_PROJECT_MAX_ACTIVITIES = 20_000;
281
+ export const SCHEDULE_PROJECT_MAX_RELATIONSHIPS = 100_000;
282
+
283
+ /**
284
+ * Where an activity came from; the provenance the RFP extraction pipeline
285
+ * writes so a planner can review machine-proposed scope
286
+ */
287
+
288
+ export const SCHEDULE_SOURCE_KIND_ENUMS = [
289
+ 'MANUAL',
290
+ 'IMPORT',
291
+ 'EXTRACTION',
292
+ 'AGENT',
293
+ ] as const;
294
+
295
+ export const SCHEDULE_SOURCE_REVIEW_STATUS_ENUMS = [
296
+ 'UNREVIEWED',
297
+ 'ACCEPTED',
298
+ 'REJECTED',
299
+ ] as const;
300
+
301
+ /**
302
+ * Column widths shared with the DDL
303
+ */
304
+
305
+ export const SCHEDULE_TITLE_MAX_LENGTH = 255;
306
+ export const SCHEDULE_NAME_MAX_LENGTH = 150;
307
+ export const SCHEDULE_CODE_MAX_LENGTH = 40;
308
+ export const SCHEDULE_KEY_MAX_LENGTH = 60;
309
+ export const SCHEDULE_SLOT_LABEL_MAX_LENGTH = 100;
310
+
311
+ /**
312
+ * Doc access: calendars and projects use the same access_grants rows Sheets
313
+ * and Notes use, keyed by these entity types
314
+ */
315
+
316
+ export const SCHEDULE_CALENDAR_ACCESS_ENTITY_TYPE = 'SCHEDULE_CALENDAR';
317
+ export const SCHEDULE_PROJECT_ACCESS_ENTITY_TYPE = 'SCHEDULE_PROJECT';
318
+
319
+ /* Durable scheduling workflow states and audited assignment origins. */
320
+ export const SCHEDULE_ASSIGNMENT_VIA_ENUMS = [
321
+ 'MANUAL',
322
+ 'REQUEST',
323
+ 'IMPORT',
324
+ 'AGENT',
325
+ ] as const;
326
+ export const SCHEDULE_ASSIGNMENT_RELEASE_REASON_ENUMS = [
327
+ 'MANUAL',
328
+ 'REQUEST',
329
+ 'OCCURRENCE_CANCELED',
330
+ 'SERIES_CHANGE',
331
+ 'RESOURCE_RETIRED',
332
+ 'AGENT',
333
+ ] as const;
334
+ export const SCHEDULE_REQUEST_KIND_ENUMS = ['CLAIM', 'DROP', 'SWAP'] as const;
335
+ export const SCHEDULE_REQUEST_STATUS_ENUMS = [
336
+ 'PENDING',
337
+ 'ACCEPTED_BY_COUNTERPARTY',
338
+ 'APPROVED',
339
+ 'DECLINED',
340
+ 'CANCELLED',
341
+ 'EXPIRED',
342
+ ] as const;
343
+ export const SCHEDULE_PROJECT_RUN_KIND_ENUMS = ['CPM', 'LEVEL'] as const;
344
+ export const SCHEDULE_PROJECT_RUN_TRIGGER_ENUMS = [
345
+ 'MANUAL',
346
+ 'AUTO',
347
+ 'IMPORT',
348
+ 'AGENT',
349
+ ] as const;
350
+ export const SCHEDULE_NOTIFICATION_STATUS_ENUMS = [
351
+ 'PENDING',
352
+ 'SENT',
353
+ 'FAILED',
354
+ 'DEAD',
355
+ ] as const;
356
+ export const SCHEDULE_NOTIFICATION_EVENT_KIND_ENUMS = [
357
+ 'SCHEDULE_PUBLISHED',
358
+ 'ASSIGNMENT_CHANGED',
359
+ 'OCCURRENCE_CHANGED',
360
+ 'REQUEST_OPENED',
361
+ 'REQUEST_DECIDED',
362
+ 'TIME_OFF_DECIDED',
363
+ 'VIOLATION_RAISED',
364
+ 'SCHEDULE_RUN_COMPLETE',
365
+ 'MILESTONE_AT_RISK',
366
+ 'RESOURCE_OVERALLOCATED',
367
+ ] as const;
368
+ export const SCHEDULE_SECONDARY_CONSTRAINT_TYPE_ENUMS = [
369
+ 'START_ON_OR_AFTER',
370
+ 'START_ON_OR_BEFORE',
371
+ 'FINISH_ON_OR_AFTER',
372
+ 'FINISH_ON_OR_BEFORE',
373
+ ] as const;
374
+
375
+ /* Operation defaults select navigation and vocabulary; both surfaces stay available. */
376
+ export const SCHEDULE_DEFAULTS_BY_OPERATION = {
377
+ CONSTRUCTION: {
378
+ defaultSurface: 'PROJECT',
379
+ defaultView: 'GANTT',
380
+ vocabulary: 'PROJECT',
381
+ },
382
+ UTILITIES: {
383
+ defaultSurface: 'PROJECT',
384
+ defaultView: 'GANTT',
385
+ vocabulary: 'PROJECT',
386
+ },
387
+ CHILDCARE: {
388
+ defaultSurface: 'COVERAGE',
389
+ defaultView: 'WEEK',
390
+ vocabulary: 'STAFFING',
391
+ },
392
+ RESTAURANT: {
393
+ defaultSurface: 'COVERAGE',
394
+ defaultView: 'WEEK',
395
+ vocabulary: 'STAFFING',
396
+ },
397
+ } as const;
398
+
399
+ export const SCHEDULE_DEFAULT_SURFACE = 'COVERAGE';
400
+ export const SCHEDULE_CALENDAR_DEFAULT_SETTINGS = {
401
+ requests: {
402
+ autoApproveClaims: false,
403
+ autoApproveDrops: false,
404
+ requireCounterpartyConsent: true,
405
+ minNoticeHours: 24,
406
+ requestExpiryHours: 72,
407
+ },
408
+ notify: { channels: ['IN_APP'] },
409
+ } as const;
410
+
411
+ export const SCHEDULE_CRITICALITY_MODE_ENUMS = [
412
+ 'FLOAT',
413
+ 'LONGEST_PATH',
414
+ ] as const;
415
+
416
+ export const SCHEDULE_LEVELING_PRIORITY_RULE_ENUMS = [
417
+ 'TOTAL_FLOAT',
418
+ 'LATE_START',
419
+ 'EARLY_START',
420
+ 'PRIORITY',
421
+ 'ORDINAL',
422
+ 'DURATION',
423
+ ] as const;
424
+
425
+ export const SCHEDULE_LEVELING_DEFAULT_PRIORITY_RULE = [
426
+ 'TOTAL_FLOAT',
427
+ 'LATE_START',
428
+ 'EARLY_START',
429
+ 'PRIORITY',
430
+ ] as const;
431
+
432
+ export const SCHEDULE_LEVELING_PRIORITY_DEFAULT = 5;
433
+
434
+ export const SCHEDULE_LEVELING_PRIORITY_MIN = 1;
435
+
436
+ export const SCHEDULE_LEVELING_PRIORITY_MAX = 10;
437
+
438
+ export const SCHEDULE_LEVELING_DEFAULT_HORIZON_DAYS = 730;
439
+
440
+ export const SCHEDULE_LEVELING_MIN_HORIZON_DAYS = 30;
441
+
442
+ export const SCHEDULE_LEVELING_MAX_HORIZON_DAYS = 3660;
443
+
444
+ export const SCHEDULE_LEVELING_LEDGER_GUARD_DAYS = 366;
445
+
446
+ export const SCHEDULE_DIAGNOSTIC_CAP_PER_CODE = 200;
447
+
448
+ export const SCHEDULE_DIAGNOSTIC_MAX_ACTIVITY_IDS = 50;
449
+
450
+ export const SCHEDULE_CYCLE_MESSAGE_MAX_HOPS = 20;
451
+
452
+ export const SCHEDULE_WORK_TIME_MAX_SPAN_DAYS = 14_610;
453
+
454
+ export const SCHEDULE_DIAGNOSTIC_SEVERITY_ENUMS = [
455
+ 'ERROR',
456
+ 'WARN',
457
+ 'INFO',
458
+ ] as const;
459
+
460
+ export const SCHEDULE_RULE_SUBJECT_BY_KIND = {
461
+ REQUIRED_COUNT: 'ROOM',
462
+ DERIVED_COUNT: 'ROOM',
463
+ ROOM_CAPACITY: 'ROOM',
464
+ OPERATING_HOURS: 'ROOM',
465
+ ELIGIBILITY: 'PERSON',
466
+ ACTOR_WINDOW_AGGREGATE: 'PERSON',
467
+ } as const satisfies Record<ScheduleRuleKindEnum, 'ROOM' | 'PERSON'>;
468
+
469
+ export const SCHEDULE_IMPLICIT_RULE_KINDS = [
470
+ 'REQUIRED_COUNT',
471
+ 'ROOM_CAPACITY',
472
+ 'ELIGIBILITY',
473
+ ] as const;
474
+
475
+ export const SCHEDULE_ELIGIBILITY_VIOLATION_CODE_ENUMS = [
476
+ 'NOT_LABOR',
477
+ 'RESOURCE_RETIRED',
478
+ 'SLOT_UNKNOWN',
479
+ 'PREDICATE_MISMATCH',
480
+ 'QUALIFICATION_EXPIRED',
481
+ 'TIME_OFF',
482
+ 'OVERLAP',
483
+ ] as const;
484
+
485
+ export const SCHEDULE_ACTOR_WINDOW_VIOLATION_CODE_ENUMS = [
486
+ 'HOURS',
487
+ 'REST',
488
+ ] as const;
489
+
490
+ export const SCHEDULE_ELIGIBILITY_REASON_ENUMS = [
491
+ 'COVERAGE_IMPACT',
492
+ 'NOT_LABOR',
493
+ 'RESOURCE_RETIRED',
494
+ 'OCCURRENCE_NOT_SHIFT',
495
+ 'OCCURRENCE_ENDED',
496
+ 'ALREADY_ASSIGNED',
497
+ 'SLOT_UNKNOWN',
498
+ 'SLOT_FULL',
499
+ 'NO_MATCHING_SLOT',
500
+ 'PREDICATE_MISMATCH',
501
+ 'QUALIFICATION_EXPIRED',
502
+ 'QUALIFICATION_EXPIRES_DURING_SHIFT',
503
+ 'TIME_OFF',
504
+ 'OVERLAP',
505
+ 'WINDOW_HOURS_EXCEEDED',
506
+ 'MIN_REST',
507
+ ] as const;
508
+
509
+ export const SCHEDULE_COVERAGE_DIAGNOSTIC_CODE_ENUMS = [
510
+ 'RATIO_NOT_CONFIGURED', // demand key with no ratio in the effective DERIVED_COUNT rule
511
+ 'OPERATING_HOURS_NOT_CONFIGURED', // an OPERATING_HOURS rule applies but the calendar has no/empty work calendar
512
+ 'QUALIFICATION_EXPIRY_INVALID', // expiresAt unparsable in engine input (treated as expired; never "never expires")
513
+ 'UNKNOWN_RESOURCE', // assignment/room/demand/time-off/rule references a resource not in input
514
+ 'UNKNOWN_SLOT_KEY', // assignment.slotKey not on its occurrence (also an ELIGIBILITY/SLOT_UNKNOWN violation)
515
+ 'RULE_CONFIG_INVALID', // rule row failed validateScheduleRuleConfig at evaluation time
516
+ 'RULE_SUBJECT_KIND_MISMATCH', // rule.resourceId kind ≠ SCHEDULE_RULE_SUBJECT_BY_KIND[kind]
517
+ 'VIOLATION_CAP', // pre-merge cap reached; output truncated
518
+ ] as const;
519
+
520
+ export const SCHEDULE_TIME_OFF_STATUS_ENUMS = [
521
+ 'PENDING',
522
+ 'APPROVED',
523
+ 'DECLINED',
524
+ 'CANCELLED',
525
+ ] as const;
526
+
527
+ export const SCHEDULE_NOTIFY_CHANNEL_ENUMS = [
528
+ 'IN_APP',
529
+ 'EMAIL',
530
+ 'SMS',
531
+ ] as const;
532
+
533
+ export const SCHEDULE_COVERAGE_MAX_WINDOW_DAYS = 62;
534
+
535
+ export const SCHEDULE_COVERAGE_MAX_VIOLATIONS = 50_000;
536
+
537
+ export const SCHEDULE_ACTOR_WINDOW_MAX_DAYS = 31;
538
+
539
+ export const SCHEDULE_RESOURCE_MAX_QUALIFICATIONS = 50;
540
+
541
+ export const SCHEDULE_RESOURCE_MAX_ROLES = 20;
542
+
543
+ export const SCHEDULE_RESOURCE_MAX_TAGS = 50;
544
+
545
+ export const SCHEDULE_RULE_MAX_RATIO = 50;
546
+
547
+ export const SCHEDULE_RULE_MAX_MIN_ADULTS = 99;
548
+
549
+ export const SCHEDULE_VIOLATION_KEY_MAX_LENGTH = 255;
package/src/css.d.ts ADDED
@@ -0,0 +1,7 @@
1
+ /*
2
+ * Vite resolves CSS side-effect imports natively; tsc does not know about them
3
+ * and would fail this package's isolated typecheck as soon as it follows an
4
+ * import into a sibling package that ships one.
5
+ */
6
+
7
+ declare module '*.css';