@kernhq/module-hr 0.18.1 → 0.20.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 (50) hide show
  1. package/dist/contract/capabilities.d.ts.map +1 -1
  2. package/dist/contract/capabilities.js +45 -0
  3. package/dist/contract/capabilities.js.map +1 -1
  4. package/dist/contract/exports.d.ts +459 -0
  5. package/dist/contract/exports.d.ts.map +1 -0
  6. package/dist/contract/exports.js +331 -0
  7. package/dist/contract/exports.js.map +1 -0
  8. package/dist/contract/index.d.ts +2 -0
  9. package/dist/contract/index.d.ts.map +1 -1
  10. package/dist/contract/index.js +2 -0
  11. package/dist/contract/index.js.map +1 -1
  12. package/dist/contract/permissions.d.ts +10 -2
  13. package/dist/contract/permissions.d.ts.map +1 -1
  14. package/dist/contract/permissions.js +44 -5
  15. package/dist/contract/permissions.js.map +1 -1
  16. package/dist/contract/rosters.d.ts +183 -0
  17. package/dist/contract/rosters.d.ts.map +1 -0
  18. package/dist/contract/rosters.js +138 -0
  19. package/dist/contract/rosters.js.map +1 -0
  20. package/dist/contract/router.d.ts +893 -0
  21. package/dist/contract/router.d.ts.map +1 -1
  22. package/dist/contract/router.js +220 -1
  23. package/dist/contract/router.js.map +1 -1
  24. package/dist/server/router.d.ts +1210 -0
  25. package/dist/server/router.d.ts.map +1 -1
  26. package/dist/server/router.js +578 -1
  27. package/dist/server/router.js.map +1 -1
  28. package/dist/server/schema.d.ts +727 -1
  29. package/dist/server/schema.d.ts.map +1 -1
  30. package/dist/server/schema.js +105 -0
  31. package/dist/server/schema.js.map +1 -1
  32. package/dist/server/services/exports.d.ts +321 -0
  33. package/dist/server/services/exports.d.ts.map +1 -0
  34. package/dist/server/services/exports.js +765 -0
  35. package/dist/server/services/exports.js.map +1 -0
  36. package/dist/server/services/rosters.d.ts +166 -0
  37. package/dist/server/services/rosters.d.ts.map +1 -0
  38. package/dist/server/services/rosters.js +268 -0
  39. package/dist/server/services/rosters.js.map +1 -0
  40. package/migrations/0012_rosters.sql +163 -0
  41. package/migrations/meta/0012_snapshot.json +4847 -0
  42. package/migrations/meta/_journal.json +7 -0
  43. package/package.json +1 -1
  44. package/src/client/messages.ts +13 -0
  45. package/src/contract/capabilities.ts +45 -0
  46. package/src/contract/exports.ts +354 -0
  47. package/src/contract/index.ts +2 -0
  48. package/src/contract/permissions.ts +47 -5
  49. package/src/contract/rosters.ts +156 -0
  50. package/src/contract/router.ts +256 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"exports.js","sourceRoot":"","sources":["../../../src/server/services/exports.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,MAAM,aAAa,CAAA;AAC9E,OAAO,EACL,uBAAuB,EACvB,qBAAqB,EACrB,qBAAqB,GACtB,MAAM,2BAA2B,CAAA;AAWlC,OAAO,EACL,WAAW,EACX,WAAW,EACX,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,EACb,MAAM,EACN,OAAO,EACP,SAAS,GACV,MAAM,cAAc,CAAA;AACrB,OAAO,EAAE,GAAG,EAAE,MAAM,SAAS,CAAA;AAC7B,OAAO,EACL,QAAQ,EAER,aAAa,EAEb,YAAY,EACZ,MAAM,GACP,MAAM,cAAc,CAAA;AAErB;;;;;;;;;;;;;;;;;GAiBG;AAEH,8EAA8E;AAE9E;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,OAAO,GAAG,GAAG,CAAA;AAE1B,iEAAiE;AACjE,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAA;AAE7B;;;;;;;;GAQG;AACH,MAAM,aAAa,GAAG,kBAAkB,CAAA;AAExC;;;;;;;;;;;;GAYG;AACH,MAAM,UAAU,QAAQ,CAAC,KAAgC;IACvD,IAAI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UAAU,CAAC,IAAI,EACf,UAAU,CAAC,IAAI,CAChB,CAAA;QAEH,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YACtB,QAAQ,EAAE,CAAC,CAAC,QAAQ;YACpB,YAAY,EAAE,CAAC,CAAC,YAAY;YAC5B,aAAa,EAAE,CAAC,CAAC,aAAa;YAC9B,IAAI,EAAE,CAAC,CAAC,IAAI;YACZ,IAAI,EAAE,CAAC,CAAC,IAAmC;YAC3C,IAAI,EAAE,GAAG,CAAC,CAAC,CAAC,IAAI,CAAC;YACjB,QAAQ,EAAE,MAAM,CAAC,CAAC,CAAC,QAAQ,IAAI,CAAC,CAAC;SAClC,CAAC,CAAC,CAAA;IACL,CAAC;CACF"}
@@ -0,0 +1,166 @@
1
+ import { type Tx } from '@kernhq/kernel';
2
+ import type { RosterDaySource } from '../../contract/rosters.js';
3
+ import type { ShiftSpec } from '../../policy/working-time.js';
4
+ import { rosterShifts } from '../schema.js';
5
+ /**
6
+ * What a person is rostered to work on a date.
7
+ *
8
+ * The arithmetic is the point of this file, and all of it is pure. A rotation is a cycle plus the
9
+ * date the cycle starts from, so what somebody works on any date at all — including dates before
10
+ * the anchor and dates years after it — is one modulus. Nothing is generated, stored, or swept:
11
+ * expanding a year of shifts per person into rows is what makes a roster impossible to change
12
+ * afterwards, because moving a crew forward by a day then means rewriting thousands of rows with no
13
+ * way left to tell which of them a human had already corrected.
14
+ *
15
+ * Only exceptions are rows. `roster_overrides` holds one day that differs, and an override that
16
+ * says "off" is a row with an empty `shift_ids` — the reason it is a row rather than a deletion is
17
+ * that "planned rest" and "nothing rosters this person" are different facts, and a screen that
18
+ * renders them the same tells somebody their absence was intended.
19
+ */
20
+ /**
21
+ * Days since 1970-01-01 for a civil date, by pure arithmetic.
22
+ *
23
+ * Not `new Date(iso).getTime() / 86400000`: that parses as UTC midnight and then everything the
24
+ * result touches is a step away from the runtime's own zone, and it is wrong by a day for anybody
25
+ * west of Greenwich the moment a caller formats it back. This is Howard Hinnant's `days_from_civil`
26
+ * — exact for every proleptic Gregorian date, with no `Date`, no zone and no daylight saving
27
+ * anywhere near it. A cycle index computed from instants would slip by one twice a year in every
28
+ * zone that observes it, which on a 4-on-4-off rotation puts a whole crew on the wrong shift.
29
+ */
30
+ export declare function dayNumber(date: string): number;
31
+ /** Whole days from `from` to `to`. Negative when `to` is the earlier date. */
32
+ export declare const daysBetween: (from: string, to: string) => number;
33
+ export interface RosterPatternSpec {
34
+ id: string;
35
+ anchorDate: string;
36
+ days: readonly (readonly string[])[];
37
+ }
38
+ export interface RosterAssignmentSpec {
39
+ patternId: string;
40
+ effectiveFrom: string;
41
+ effectiveTo: string | null;
42
+ cycleOffset: number;
43
+ }
44
+ export interface RosterOverrideSpec {
45
+ businessDate: string;
46
+ shiftIds: readonly string[];
47
+ note: string | null;
48
+ }
49
+ export interface PlannedDay {
50
+ businessDate: string;
51
+ shiftIds: string[];
52
+ source: RosterDaySource;
53
+ note: string | null;
54
+ }
55
+ /**
56
+ * Which position of the cycle a date falls on.
57
+ *
58
+ * `((raw % len) + len) % len` rather than `raw % len`, because JavaScript's `%` keeps the sign of
59
+ * the dividend: a date before the anchor gives a negative index, and `days[-3]` is `undefined` —
60
+ * which reads as a rest day rather than as an error. A roster asked about last month would then
61
+ * quietly report that everybody was off.
62
+ *
63
+ * Returns -1 for a pattern with no cycle at all, which is a misconfiguration rather than a rest day
64
+ * and is reported as `none` by the caller.
65
+ */
66
+ export declare function cycleIndexFor(pattern: Pick<RosterPatternSpec, 'anchorDate' | 'days'>, date: string, cycleOffset?: number): number;
67
+ /** The shifts a rotation puts on a date. `[]` is a planned rest day; null is no cycle to read. */
68
+ export declare function patternShiftIdsOn(pattern: Pick<RosterPatternSpec, 'anchorDate' | 'days'>, date: string, cycleOffset?: number): string[] | null;
69
+ /**
70
+ * The assignment in force on a date.
71
+ *
72
+ * The exclusion constraint makes two-in-force impossible in the database, so this is not resolving
73
+ * a conflict — it is refusing to depend on row order for the answer. `schedule_assignments` did
74
+ * depend on it for five migrations, and the symptom was a day sheet whose figures changed between
75
+ * one recomputation and the next on rows a locked payroll period had been filed against.
76
+ */
77
+ export declare function assignmentOn<A extends RosterAssignmentSpec>(assignments: readonly A[], date: string): A | null;
78
+ /**
79
+ * The roster for one person over a set of dates.
80
+ *
81
+ * Takes the dates rather than a range so a caller asking about two adjacent days — which is what
82
+ * the night-shift attribution needs — does not have to expand a range to get them.
83
+ *
84
+ * The precedence is override, then rotation, then nothing, and it is deliberate that an override
85
+ * wins even when it is empty: somebody taken off a Tuesday they were rostered for is off that
86
+ * Tuesday, and a rotation that could still speak over the top of that would undo the correction.
87
+ */
88
+ export declare function rosterPlan(input: {
89
+ dates: readonly string[];
90
+ assignments: readonly RosterAssignmentSpec[];
91
+ patterns: ReadonlyMap<string, RosterPatternSpec>;
92
+ overrides: readonly RosterOverrideSpec[];
93
+ }): PlannedDay[];
94
+ export type RosterShiftRow = typeof rosterShifts.$inferSelect;
95
+ /** A rostered shift as the working-time layer wants it. The one seam between the two. */
96
+ export declare const toShiftSpec: (shift: RosterShiftRow) => ShiftSpec;
97
+ /**
98
+ * A stable string for what a day was rostered as.
99
+ *
100
+ * `attendance_days.policy_hash` is what tells a recomputation whether a stored figure is stale, and
101
+ * `hashSchedule` keys only on the schedule id and the rounding policy. That is enough while a
102
+ * schedule is a week that only changes when the schedule row does; it is not enough once a roster
103
+ * can change one Tuesday, because the id and the rounding are identical either side of the change
104
+ * and the sheet would stay stale with nothing able to notice.
105
+ *
106
+ * So this folds in what the day was actually rostered as — the shift ids **and** their wall clocks,
107
+ * because editing a shift from 06:00 to 07:00 changes every day it appears on without changing an
108
+ * id anywhere.
109
+ */
110
+ export declare function rosterFingerprint(day: {
111
+ source: RosterDaySource;
112
+ shifts: readonly RosterShiftRow[];
113
+ }): string;
114
+ /** The ceiling on a coverage grid's person-days — a hundred people for a six-week rotation. */
115
+ export declare const MAX_COVERAGE_CELLS = 4200;
116
+ /**
117
+ * Why a range is refused, as a sentence.
118
+ *
119
+ * A roster range is cheap to expand and expensive to send, and a coverage grid multiplies by the
120
+ * population of an office. Both refusals name the number asked for as well as the ceiling, because
121
+ * "too long" without either is a message somebody has to guess their way out of.
122
+ */
123
+ export declare function rosterRefusal(input: {
124
+ from: string;
125
+ to: string;
126
+ coverage: boolean;
127
+ population?: number;
128
+ }): string | null;
129
+ export interface ResolvedRosterDay {
130
+ businessDate: string;
131
+ shifts: RosterShiftRow[];
132
+ source: RosterDaySource;
133
+ note: string | null;
134
+ }
135
+ export declare class RosterService {
136
+ /**
137
+ * Every shift in the workspace by id, **archived ones included**.
138
+ *
139
+ * A pattern and a stored override both point at a shift by id, so resolving only the live ones
140
+ * would silently empty out every rostered day that used a shift somebody archived last week —
141
+ * which reads as "nobody is working" rather than as "this shift is retired".
142
+ */
143
+ shiftsById(tx: Tx, workspaceId: string): Promise<Map<string, RosterShiftRow>>;
144
+ /**
145
+ * What each of `personIds` is rostered for on each of `dates`.
146
+ *
147
+ * One query per table for the whole population rather than one per person: a coverage grid over
148
+ * an office of eighty is otherwise 240 round trips for arithmetic that takes microseconds.
149
+ *
150
+ * `inArray` renders an expanded parameter list — `person_id in ($1, $2, …)`. That is deliberate
151
+ * and is not the same as binding one array: `= any($1::uuid[])` with drizzle expanding the array
152
+ * into a list produces `any(($1,$2)::uuid[])`, which Postgres rejects with 42846, "cannot cast
153
+ * type record to uuid[]".
154
+ */
155
+ plan(tx: Tx, workspaceId: string, personIds: readonly string[], dates: readonly string[]): Promise<Map<string, ResolvedRosterDay[]>>;
156
+ /** One person over a contiguous range — the shape a roster screen asks for. */
157
+ forPerson(tx: Tx, workspaceId: string, personId: string, from: string, to: string): Promise<ResolvedRosterDay[]>;
158
+ /**
159
+ * Refuse a pattern or an override that names a shift this workspace does not have.
160
+ *
161
+ * Checked on write rather than tolerated on read: a dangling id is invisible on the screen that
162
+ * created it and shows up weeks later as a person who is somehow rostered for nothing.
163
+ */
164
+ assertShiftsExist(tx: Tx, workspaceId: string, shiftIds: readonly string[]): Promise<void>;
165
+ }
166
+ //# sourceMappingURL=rosters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rosters.d.ts","sourceRoot":"","sources":["../../../src/server/services/rosters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAa,KAAK,EAAE,EAAE,MAAM,gBAAgB,CAAA;AAEnD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAGhE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAA;AAC7D,OAAO,EAAsD,YAAY,EAAE,MAAM,cAAc,CAAA;AAE/F;;;;;;;;;;;;;;GAcG;AAMH;;;;;;;;;GASG;AACH,wBAAgB,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAQ9C;AAED,8EAA8E;AAC9E,eAAO,MAAM,WAAW,GAAI,MAAM,MAAM,EAAE,IAAI,MAAM,KAAG,MAAyC,CAAA;AAEhG,MAAM,WAAW,iBAAiB;IAChC,EAAE,EAAE,MAAM,CAAA;IACV,UAAU,EAAE,MAAM,CAAA;IAClB,IAAI,EAAE,SAAS,CAAC,SAAS,MAAM,EAAE,CAAC,EAAE,CAAA;CACrC;AAED,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAA;IACjB,aAAa,EAAE,MAAM,CAAA;IACrB,WAAW,EAAE,MAAM,GAAG,IAAI,CAAA;IAC1B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAA;IAC3B,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,MAAM,WAAW,UAAU;IACzB,YAAY,EAAE,MAAM,CAAA;IACpB,QAAQ,EAAE,MAAM,EAAE,CAAA;IAClB,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,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,CAAA;IACZ,EAAE,EAAE,MAAM,CAAA;IACV,QAAQ,EAAE,OAAO,CAAA;IACjB,UAAU,CAAC,EAAE,MAAM,CAAA;CACpB,GAAG,MAAM,GAAG,IAAI,CAchB;AAMD,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAA;IACpB,MAAM,EAAE,cAAc,EAAE,CAAA;IACxB,MAAM,EAAE,eAAe,CAAA;IACvB,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CACpB;AAED,qBAAa,aAAa;IACxB;;;;;;OAMG;IACG,UAAU,CAAC,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,cAAc,CAAC,CAAC;IAKnF;;;;;;;;;;OAUG;IACG,IAAI,CACR,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,SAAS,MAAM,EAAE,EAC5B,KAAK,EAAE,SAAS,MAAM,EAAE,GACvB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,iBAAiB,EAAE,CAAC,CAAC;IAwE5C,+EAA+E;IACzE,SAAS,CACb,EAAE,EAAE,EAAE,EACN,WAAW,EAAE,MAAM,EACnB,QAAQ,EAAE,MAAM,EAChB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,iBAAiB,EAAE,CAAC;IAK/B;;;;;OAKG;IACG,iBAAiB,CAAC,EAAE,EAAE,EAAE,EAAE,WAAW,EAAE,MAAM,EAAE,QAAQ,EAAE,SAAS,MAAM,EAAE,GAAG,OAAO,CAAC,IAAI,CAAC;CAgBjG"}
@@ -0,0 +1,268 @@
1
+ import { KernError } from '@kernhq/kernel';
2
+ import { and, eq, gte, inArray, isNull, lte, or } from 'drizzle-orm';
3
+ import { MAX_COVERAGE_DAYS, MAX_ROSTER_DAYS } from '../../contract/rosters.js';
4
+ import { datesBetween } from '../../policy/calendar.js';
5
+ import { rosterAssignments, rosterOverrides, rosterPatterns, rosterShifts } from '../schema.js';
6
+ /**
7
+ * What a person is rostered to work on a date.
8
+ *
9
+ * The arithmetic is the point of this file, and all of it is pure. A rotation is a cycle plus the
10
+ * date the cycle starts from, so what somebody works on any date at all — including dates before
11
+ * the anchor and dates years after it — is one modulus. Nothing is generated, stored, or swept:
12
+ * expanding a year of shifts per person into rows is what makes a roster impossible to change
13
+ * afterwards, because moving a crew forward by a day then means rewriting thousands of rows with no
14
+ * way left to tell which of them a human had already corrected.
15
+ *
16
+ * Only exceptions are rows. `roster_overrides` holds one day that differs, and an override that
17
+ * says "off" is a row with an empty `shift_ids` — the reason it is a row rather than a deletion is
18
+ * that "planned rest" and "nothing rosters this person" are different facts, and a screen that
19
+ * renders them the same tells somebody their absence was intended.
20
+ */
21
+ // ---------------------------------------------------------------------------------------------
22
+ // pure: the calendar arithmetic
23
+ // ---------------------------------------------------------------------------------------------
24
+ /**
25
+ * Days since 1970-01-01 for a civil date, by pure arithmetic.
26
+ *
27
+ * Not `new Date(iso).getTime() / 86400000`: that parses as UTC midnight and then everything the
28
+ * result touches is a step away from the runtime's own zone, and it is wrong by a day for anybody
29
+ * west of Greenwich the moment a caller formats it back. This is Howard Hinnant's `days_from_civil`
30
+ * — exact for every proleptic Gregorian date, with no `Date`, no zone and no daylight saving
31
+ * anywhere near it. A cycle index computed from instants would slip by one twice a year in every
32
+ * zone that observes it, which on a 4-on-4-off rotation puts a whole crew on the wrong shift.
33
+ */
34
+ export function dayNumber(date) {
35
+ const [y, m, d] = date.split('-').map(Number);
36
+ const year = y - (m <= 2 ? 1 : 0);
37
+ const era = Math.floor(year / 400);
38
+ const yoe = year - era * 400;
39
+ const doy = Math.floor((153 * (m + (m > 2 ? -3 : 9)) + 2) / 5) + d - 1;
40
+ const doe = yoe * 365 + Math.floor(yoe / 4) - Math.floor(yoe / 100) + doy;
41
+ return era * 146_097 + doe - 719_468;
42
+ }
43
+ /** Whole days from `from` to `to`. Negative when `to` is the earlier date. */
44
+ export const daysBetween = (from, to) => dayNumber(to) - dayNumber(from);
45
+ /**
46
+ * Which position of the cycle a date falls on.
47
+ *
48
+ * `((raw % len) + len) % len` rather than `raw % len`, because JavaScript's `%` keeps the sign of
49
+ * the dividend: a date before the anchor gives a negative index, and `days[-3]` is `undefined` —
50
+ * which reads as a rest day rather than as an error. A roster asked about last month would then
51
+ * quietly report that everybody was off.
52
+ *
53
+ * Returns -1 for a pattern with no cycle at all, which is a misconfiguration rather than a rest day
54
+ * and is reported as `none` by the caller.
55
+ */
56
+ export function cycleIndexFor(pattern, date, cycleOffset = 0) {
57
+ const len = pattern.days.length;
58
+ if (len <= 0)
59
+ return -1;
60
+ const raw = daysBetween(pattern.anchorDate, date) + cycleOffset;
61
+ return ((raw % len) + len) % len;
62
+ }
63
+ /** The shifts a rotation puts on a date. `[]` is a planned rest day; null is no cycle to read. */
64
+ export function patternShiftIdsOn(pattern, date, cycleOffset = 0) {
65
+ const index = cycleIndexFor(pattern, date, cycleOffset);
66
+ if (index < 0)
67
+ return null;
68
+ return [...(pattern.days[index] ?? [])];
69
+ }
70
+ /**
71
+ * The assignment in force on a date.
72
+ *
73
+ * The exclusion constraint makes two-in-force impossible in the database, so this is not resolving
74
+ * a conflict — it is refusing to depend on row order for the answer. `schedule_assignments` did
75
+ * depend on it for five migrations, and the symptom was a day sheet whose figures changed between
76
+ * one recomputation and the next on rows a locked payroll period had been filed against.
77
+ */
78
+ export function assignmentOn(assignments, date) {
79
+ let best = null;
80
+ for (const a of assignments) {
81
+ if (a.effectiveFrom > date)
82
+ continue;
83
+ if (a.effectiveTo !== null && a.effectiveTo < date)
84
+ continue;
85
+ if (!best || a.effectiveFrom > best.effectiveFrom)
86
+ best = a;
87
+ }
88
+ return best;
89
+ }
90
+ /**
91
+ * The roster for one person over a set of dates.
92
+ *
93
+ * Takes the dates rather than a range so a caller asking about two adjacent days — which is what
94
+ * the night-shift attribution needs — does not have to expand a range to get them.
95
+ *
96
+ * The precedence is override, then rotation, then nothing, and it is deliberate that an override
97
+ * wins even when it is empty: somebody taken off a Tuesday they were rostered for is off that
98
+ * Tuesday, and a rotation that could still speak over the top of that would undo the correction.
99
+ */
100
+ export function rosterPlan(input) {
101
+ const byDate = new Map(input.overrides.map((o) => [o.businessDate, o]));
102
+ return input.dates.map((businessDate) => {
103
+ const override = byDate.get(businessDate);
104
+ if (override)
105
+ return {
106
+ businessDate,
107
+ shiftIds: [...override.shiftIds],
108
+ source: 'override',
109
+ note: override.note,
110
+ };
111
+ const assignment = assignmentOn(input.assignments, businessDate);
112
+ const pattern = assignment ? input.patterns.get(assignment.patternId) : undefined;
113
+ const ids = pattern ? patternShiftIdsOn(pattern, businessDate, assignment?.cycleOffset ?? 0) : null;
114
+ if (ids === null)
115
+ return { businessDate, shiftIds: [], source: 'none', note: null };
116
+ return { businessDate, shiftIds: ids, source: 'pattern', note: null };
117
+ });
118
+ }
119
+ /** A rostered shift as the working-time layer wants it. The one seam between the two. */
120
+ export const toShiftSpec = (shift) => ({
121
+ start: shift.startTime,
122
+ end: shift.endTime,
123
+ breakMinutes: shift.breakMinutes,
124
+ graceInMinutes: shift.graceInMinutes,
125
+ graceOutMinutes: shift.graceOutMinutes,
126
+ });
127
+ /**
128
+ * A stable string for what a day was rostered as.
129
+ *
130
+ * `attendance_days.policy_hash` is what tells a recomputation whether a stored figure is stale, and
131
+ * `hashSchedule` keys only on the schedule id and the rounding policy. That is enough while a
132
+ * schedule is a week that only changes when the schedule row does; it is not enough once a roster
133
+ * can change one Tuesday, because the id and the rounding are identical either side of the change
134
+ * and the sheet would stay stale with nothing able to notice.
135
+ *
136
+ * So this folds in what the day was actually rostered as — the shift ids **and** their wall clocks,
137
+ * because editing a shift from 06:00 to 07:00 changes every day it appears on without changing an
138
+ * id anywhere.
139
+ */
140
+ export function rosterFingerprint(day) {
141
+ const parts = day.shifts.map((s) => `${s.id}@${s.startTime}-${s.endTime}/${s.breakMinutes}/${s.graceInMinutes}/${s.graceOutMinutes}`);
142
+ return `${day.source}:${parts.join('+')}`;
143
+ }
144
+ /** The ceiling on a coverage grid's person-days — a hundred people for a six-week rotation. */
145
+ export const MAX_COVERAGE_CELLS = 4200;
146
+ /**
147
+ * Why a range is refused, as a sentence.
148
+ *
149
+ * A roster range is cheap to expand and expensive to send, and a coverage grid multiplies by the
150
+ * population of an office. Both refusals name the number asked for as well as the ceiling, because
151
+ * "too long" without either is a message somebody has to guess their way out of.
152
+ */
153
+ export function rosterRefusal(input) {
154
+ if (input.to < input.from)
155
+ return `The end date ${input.to} is before the start date ${input.from}.`;
156
+ const days = daysBetween(input.from, input.to) + 1;
157
+ const max = input.coverage ? MAX_COVERAGE_DAYS : MAX_ROSTER_DAYS;
158
+ if (days > max)
159
+ return input.coverage
160
+ ? `A coverage grid covers at most ${max} days, and this one asks for ${days}. Ask for a shorter range.`
161
+ : `A roster covers at most ${max} days, and this one asks for ${days}. Ask for a shorter range.`;
162
+ if (input.coverage && input.population !== undefined) {
163
+ const cells = input.population * days;
164
+ if (cells > MAX_COVERAGE_CELLS)
165
+ return `${input.population} people over ${days} days is ${cells} person-days, and a coverage grid resolves at most ${MAX_COVERAGE_CELLS}. Ask for one office, or a shorter range.`;
166
+ }
167
+ return null;
168
+ }
169
+ export class RosterService {
170
+ /**
171
+ * Every shift in the workspace by id, **archived ones included**.
172
+ *
173
+ * A pattern and a stored override both point at a shift by id, so resolving only the live ones
174
+ * would silently empty out every rostered day that used a shift somebody archived last week —
175
+ * which reads as "nobody is working" rather than as "this shift is retired".
176
+ */
177
+ async shiftsById(tx, workspaceId) {
178
+ const rows = await tx.select().from(rosterShifts).where(eq(rosterShifts.workspaceId, workspaceId));
179
+ return new Map(rows.map((r) => [r.id, r]));
180
+ }
181
+ /**
182
+ * What each of `personIds` is rostered for on each of `dates`.
183
+ *
184
+ * One query per table for the whole population rather than one per person: a coverage grid over
185
+ * an office of eighty is otherwise 240 round trips for arithmetic that takes microseconds.
186
+ *
187
+ * `inArray` renders an expanded parameter list — `person_id in ($1, $2, …)`. That is deliberate
188
+ * and is not the same as binding one array: `= any($1::uuid[])` with drizzle expanding the array
189
+ * into a list produces `any(($1,$2)::uuid[])`, which Postgres rejects with 42846, "cannot cast
190
+ * type record to uuid[]".
191
+ */
192
+ async plan(tx, workspaceId, personIds, dates) {
193
+ const out = new Map();
194
+ if (!personIds.length || !dates.length)
195
+ return out;
196
+ const sorted = [...dates].sort();
197
+ const first = sorted[0];
198
+ const last = sorted[sorted.length - 1];
199
+ const ids = [...new Set(personIds)];
200
+ const assignments = await tx
201
+ .select()
202
+ .from(rosterAssignments)
203
+ .where(and(eq(rosterAssignments.workspaceId, workspaceId), inArray(rosterAssignments.personId, ids), lte(rosterAssignments.effectiveFrom, last), or(isNull(rosterAssignments.effectiveTo), gte(rosterAssignments.effectiveTo, first))));
204
+ const overrides = await tx
205
+ .select()
206
+ .from(rosterOverrides)
207
+ .where(and(eq(rosterOverrides.workspaceId, workspaceId), inArray(rosterOverrides.personId, ids), inArray(rosterOverrides.businessDate, [...new Set(sorted)])));
208
+ const patternIds = [...new Set(assignments.map((a) => a.patternId))];
209
+ const patternRows = patternIds.length
210
+ ? await tx
211
+ .select()
212
+ .from(rosterPatterns)
213
+ .where(and(eq(rosterPatterns.workspaceId, workspaceId), inArray(rosterPatterns.id, patternIds)))
214
+ : [];
215
+ const patterns = new Map(patternRows.map((p) => [p.id, { id: p.id, anchorDate: p.anchorDate, days: p.days ?? [] }]));
216
+ const shifts = await this.shiftsById(tx, workspaceId);
217
+ for (const personId of ids) {
218
+ const plan = rosterPlan({
219
+ dates,
220
+ assignments: assignments.filter((a) => a.personId === personId),
221
+ patterns,
222
+ overrides: overrides
223
+ .filter((o) => o.personId === personId)
224
+ .map((o) => ({ businessDate: o.businessDate, shiftIds: o.shiftIds ?? [], note: o.note })),
225
+ });
226
+ out.set(personId, plan.map((day) => ({
227
+ businessDate: day.businessDate,
228
+ // A shift id with no row behind it is dropped rather than rendered as a hole: the only
229
+ // way to produce one is to point a pattern at an id that was never a shift, and the
230
+ // procedures below refuse that on write.
231
+ shifts: day.shiftIds.flatMap((id) => {
232
+ const shift = shifts.get(id);
233
+ return shift ? [shift] : [];
234
+ }),
235
+ source: day.source,
236
+ note: day.note,
237
+ })));
238
+ }
239
+ return out;
240
+ }
241
+ /** One person over a contiguous range — the shape a roster screen asks for. */
242
+ async forPerson(tx, workspaceId, personId, from, to) {
243
+ const plan = await this.plan(tx, workspaceId, [personId], datesBetween(from, to));
244
+ return plan.get(personId) ?? [];
245
+ }
246
+ /**
247
+ * Refuse a pattern or an override that names a shift this workspace does not have.
248
+ *
249
+ * Checked on write rather than tolerated on read: a dangling id is invisible on the screen that
250
+ * created it and shows up weeks later as a person who is somehow rostered for nothing.
251
+ */
252
+ async assertShiftsExist(tx, workspaceId, shiftIds) {
253
+ const wanted = [...new Set(shiftIds)];
254
+ if (!wanted.length)
255
+ return;
256
+ const found = await tx
257
+ .select({ id: rosterShifts.id })
258
+ .from(rosterShifts)
259
+ .where(and(eq(rosterShifts.workspaceId, workspaceId), inArray(rosterShifts.id, wanted)));
260
+ const have = new Set(found.map((r) => r.id));
261
+ const missing = wanted.filter((id) => !have.has(id));
262
+ if (missing.length)
263
+ throw KernError.badRequest(missing.length === 1
264
+ ? `This roster names a shift this workspace does not have: ${missing[0]}.`
265
+ : `This roster names shifts this workspace does not have: ${missing.join(', ')}.`);
266
+ }
267
+ }
268
+ //# sourceMappingURL=rosters.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rosters.js","sourceRoot":"","sources":["../../../src/server/services/rosters.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAW,MAAM,gBAAgB,CAAA;AACnD,OAAO,EAAE,GAAG,EAAE,EAAE,EAAE,GAAG,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,EAAE,EAAE,EAAE,MAAM,aAAa,CAAA;AAEpE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAA;AAC9E,OAAO,EAAE,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