@t4dhg/mcp-factorial 9.0.0 → 10.1.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.
- package/README.md +84 -14
- package/dist/api/attendance.d.ts +37 -13
- package/dist/api/attendance.d.ts.map +1 -1
- package/dist/api/attendance.js +161 -31
- package/dist/api/attendance.js.map +1 -1
- package/dist/api/documents.d.ts +4 -3
- package/dist/api/documents.d.ts.map +1 -1
- package/dist/api/documents.js +4 -3
- package/dist/api/documents.js.map +1 -1
- package/dist/api/employees.d.ts +5 -3
- package/dist/api/employees.d.ts.map +1 -1
- package/dist/api/employees.js +5 -3
- package/dist/api/employees.js.map +1 -1
- package/dist/api/index.d.ts +1 -1
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/time-off.d.ts +6 -1
- package/dist/api/time-off.d.ts.map +1 -1
- package/dist/api/time-off.js +20 -16
- package/dist/api/time-off.js.map +1 -1
- package/dist/attendance/backfill.d.ts +38 -0
- package/dist/attendance/backfill.d.ts.map +1 -0
- package/dist/attendance/backfill.js +109 -0
- package/dist/attendance/backfill.js.map +1 -0
- package/dist/attendance/gate.d.ts +40 -0
- package/dist/attendance/gate.d.ts.map +1 -0
- package/dist/attendance/gate.js +63 -0
- package/dist/attendance/gate.js.map +1 -0
- package/dist/attendance/identity.d.ts +27 -0
- package/dist/attendance/identity.d.ts.map +1 -0
- package/dist/attendance/identity.js +73 -0
- package/dist/attendance/identity.js.map +1 -0
- package/dist/attendance/planner.d.ts +189 -0
- package/dist/attendance/planner.d.ts.map +1 -0
- package/dist/attendance/planner.js +427 -0
- package/dist/attendance/planner.js.map +1 -0
- package/dist/endpoints.d.ts +5 -0
- package/dist/endpoints.d.ts.map +1 -1
- package/dist/endpoints.js +5 -0
- package/dist/endpoints.js.map +1 -1
- package/dist/http-client.d.ts +14 -1
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +36 -7
- package/dist/http-client.js.map +1 -1
- package/dist/schemas/ats.d.ts +4 -4
- package/dist/schemas/attendance.d.ts +367 -0
- package/dist/schemas/attendance.d.ts.map +1 -0
- package/dist/schemas/attendance.js +159 -0
- package/dist/schemas/attendance.js.map +1 -0
- package/dist/schemas/documents.d.ts +2 -2
- package/dist/schemas/index.d.ts +2 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +3 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/projects.d.ts +4 -4
- package/dist/schemas/time-off.d.ts +59 -148
- package/dist/schemas/time-off.d.ts.map +1 -1
- package/dist/schemas/time-off.js +22 -53
- package/dist/schemas/time-off.js.map +1 -1
- package/dist/schemas/training.d.ts +2 -2
- package/dist/tools/attendance.d.ts +9 -1
- package/dist/tools/attendance.d.ts.map +1 -1
- package/dist/tools/attendance.js +364 -24
- package/dist/tools/attendance.js.map +1 -1
- package/dist/tools/index.js +1 -1
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/shared.d.ts +2 -2
- package/dist/tools/shared.d.ts.map +1 -1
- package/dist/tools/shared.js +15 -2
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/time-off.d.ts.map +1 -1
- package/dist/tools/time-off.js +15 -6
- package/dist/tools/time-off.js.map +1 -1
- package/dist/types.d.ts +28 -13
- package/dist/types.d.ts.map +1 -1
- package/dist/write-safety.d.ts +18 -0
- package/dist/write-safety.d.ts.map +1 -1
- package/dist/write-safety.js +19 -0
- package/dist/write-safety.js.map +1 -1
- package/llms.txt +7 -4
- package/package.json +1 -1
|
@@ -0,0 +1,189 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backfill planner for attendance shifts (registro horario).
|
|
3
|
+
*
|
|
4
|
+
* Everything in this module is pure: no network, no clock, no configuration.
|
|
5
|
+
* The caller gathers facts from the API (worked_times, estimated_times,
|
|
6
|
+
* existing shifts, approved leaves) and the planner turns them plus the
|
|
7
|
+
* requested segments into an explicit list of writes and skips. Every rule is
|
|
8
|
+
* a unit test in src/__tests__/unit/attendance/planner.test.ts.
|
|
9
|
+
*/
|
|
10
|
+
/** A working segment on one day, in company local wall-clock time */
|
|
11
|
+
export interface Segment {
|
|
12
|
+
clock_in: string;
|
|
13
|
+
clock_out: string;
|
|
14
|
+
}
|
|
15
|
+
/** One planned shift record */
|
|
16
|
+
export interface PlannedWrite extends Segment {
|
|
17
|
+
date: string;
|
|
18
|
+
}
|
|
19
|
+
/** What is known about one calendar day for one employee */
|
|
20
|
+
export interface DayFacts {
|
|
21
|
+
/** worked_times.day_type: workday | saturday | sunday | bank_holiday */
|
|
22
|
+
day_type: string;
|
|
23
|
+
/** estimated_times.expected_minutes, from the contract pattern */
|
|
24
|
+
expected_minutes: number;
|
|
25
|
+
/** worked_times.tracked_minutes */
|
|
26
|
+
tracked_minutes: number;
|
|
27
|
+
}
|
|
28
|
+
/** An existing shift as the API reports it; clock_out null means still open */
|
|
29
|
+
export interface ExistingShift {
|
|
30
|
+
date: string;
|
|
31
|
+
clock_in: string;
|
|
32
|
+
clock_out: string | null;
|
|
33
|
+
}
|
|
34
|
+
/** How an approved leave covers a date */
|
|
35
|
+
export type LeaveCover = 'full' | 'beggining_of_day' | 'end_of_day';
|
|
36
|
+
/** The subset of a leave record the planner needs */
|
|
37
|
+
export interface LeaveLike {
|
|
38
|
+
start_on: string;
|
|
39
|
+
finish_on: string;
|
|
40
|
+
half_day: string | null;
|
|
41
|
+
approved: boolean | null;
|
|
42
|
+
deleted_at: string | null;
|
|
43
|
+
}
|
|
44
|
+
export interface PlanFacts {
|
|
45
|
+
/** Today's date, YYYY-MM-DD, in the zone the caller considers local */
|
|
46
|
+
today: string;
|
|
47
|
+
/** Per-date facts; a date missing from the map has no contract data */
|
|
48
|
+
days: Map<string, DayFacts>;
|
|
49
|
+
/** Existing shifts for the employee within the planned dates */
|
|
50
|
+
shifts: ExistingShift[];
|
|
51
|
+
/** Approved leave cover per date, see expandLeaves */
|
|
52
|
+
leaves: Map<string, LeaveCover>;
|
|
53
|
+
}
|
|
54
|
+
export interface RangeRequest {
|
|
55
|
+
mode: 'range';
|
|
56
|
+
employee_id: number;
|
|
57
|
+
dates: string[];
|
|
58
|
+
segments: Segment[];
|
|
59
|
+
skip_leave: boolean;
|
|
60
|
+
/** Vary each written time by up to this many minutes, deterministically per record */
|
|
61
|
+
jitter_minutes?: number;
|
|
62
|
+
}
|
|
63
|
+
export interface DaysRequest {
|
|
64
|
+
mode: 'days';
|
|
65
|
+
employee_id: number;
|
|
66
|
+
days: Array<{
|
|
67
|
+
date: string;
|
|
68
|
+
segments: Segment[];
|
|
69
|
+
}>;
|
|
70
|
+
skip_leave: boolean;
|
|
71
|
+
/** Vary each written time by up to this many minutes, deterministically per record */
|
|
72
|
+
jitter_minutes?: number;
|
|
73
|
+
}
|
|
74
|
+
export type PlanRequest = RangeRequest | DaysRequest;
|
|
75
|
+
export type SkipReason = 'future_date' | 'weekend' | 'bank_holiday' | 'not_workable' | 'on_leave' | 'half_day_leave';
|
|
76
|
+
export interface SkippedDay {
|
|
77
|
+
date: string;
|
|
78
|
+
reason: SkipReason;
|
|
79
|
+
detail?: string;
|
|
80
|
+
}
|
|
81
|
+
export interface SkippedSegment extends Segment {
|
|
82
|
+
date: string;
|
|
83
|
+
reason: 'overlaps_existing';
|
|
84
|
+
detail: string;
|
|
85
|
+
}
|
|
86
|
+
export interface BackfillPlan {
|
|
87
|
+
writes: PlannedWrite[];
|
|
88
|
+
skippedDays: SkippedDay[];
|
|
89
|
+
skippedSegments: SkippedSegment[];
|
|
90
|
+
totals: {
|
|
91
|
+
days: number;
|
|
92
|
+
records: number;
|
|
93
|
+
minutes: number;
|
|
94
|
+
};
|
|
95
|
+
}
|
|
96
|
+
export interface Gap {
|
|
97
|
+
date: string;
|
|
98
|
+
expected_minutes: number;
|
|
99
|
+
tracked_minutes: number;
|
|
100
|
+
missing_minutes: number;
|
|
101
|
+
half_day_leave: 'beggining_of_day' | 'end_of_day' | null;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* A day whose tracked minutes are within this distance of the expected minutes
|
|
105
|
+
* counts as complete. Real clock-ins are never exact, and jittered backfills
|
|
106
|
+
* are deliberately not, so a strict comparison would flag nearly every day.
|
|
107
|
+
*/
|
|
108
|
+
export declare const DEFAULT_TOLERANCE_MINUTES = 15;
|
|
109
|
+
/** Parse "HH:MM" into minutes since midnight; anything else is rejected */
|
|
110
|
+
export declare function parseHHMM(value: string): number;
|
|
111
|
+
/** True when two [start, end) intervals share any time; touching does not count */
|
|
112
|
+
export declare function intervalsOverlap(a: [number, number], b: [number, number]): boolean;
|
|
113
|
+
/** Every date from start to end inclusive */
|
|
114
|
+
export declare function enumerateDates(start: string, end: string): string[];
|
|
115
|
+
/**
|
|
116
|
+
* Validate the segments of one day: HH:MM only, clock_in strictly before
|
|
117
|
+
* clock_out, no overnight shifts, no overlap between segments.
|
|
118
|
+
*/
|
|
119
|
+
export declare function validateSegments(segments: Segment[]): void;
|
|
120
|
+
/**
|
|
121
|
+
* Turn leave records into a per-date cover map. Only approved, undeleted
|
|
122
|
+
* leaves count; a pending (approved: null) or rejected leave does not block
|
|
123
|
+
* anything. A later leave over the same date never downgrades a full cover.
|
|
124
|
+
*/
|
|
125
|
+
export declare function expandLeaves(leaves: LeaveLike[]): Map<string, LeaveCover>;
|
|
126
|
+
/**
|
|
127
|
+
* Apply per-record variation to a day's segments. Nobody clocks in at exactly
|
|
128
|
+
* 09:00 every day, so a month of identical times is the one pattern a real
|
|
129
|
+
* registro never shows. The variation is derived from a hash of the employee,
|
|
130
|
+
* the date and the segment, so re-planning the same request yields the same
|
|
131
|
+
* times: the preview shows exactly what will be written, the confirmation
|
|
132
|
+
* token binds to it, and a retry after a partial failure recognises its own
|
|
133
|
+
* earlier writes. Segments never cross each other or midnight.
|
|
134
|
+
*/
|
|
135
|
+
export declare function jitterSegments(employeeId: number, date: string, segments: Segment[], magnitude: number): Segment[];
|
|
136
|
+
/**
|
|
137
|
+
* Build the plan. Skip reasons are evaluated in the documented order and the
|
|
138
|
+
* first match wins. Explicit days skip the weekday, holiday and workability
|
|
139
|
+
* rules on purpose: migration must be able to write a Saturday someone worked.
|
|
140
|
+
*/
|
|
141
|
+
export declare function buildBackfillPlan(request: PlanRequest, facts: PlanFacts): BackfillPlan;
|
|
142
|
+
/**
|
|
143
|
+
* Stable digest of who and what a plan writes, including the note stored on
|
|
144
|
+
* every record; the confirmation token is bound to it.
|
|
145
|
+
*/
|
|
146
|
+
export declare function planFingerprint(employeeId: number, writes: PlannedWrite[], observations?: string): string;
|
|
147
|
+
/**
|
|
148
|
+
* Workdays up to today where the contract expects more than was tracked and no
|
|
149
|
+
* full-day leave applies. Future dates are left out, since log_range would
|
|
150
|
+
* refuse them anyway.
|
|
151
|
+
*/
|
|
152
|
+
export declare function computeGaps(facts: PlanFacts, toleranceMinutes?: number): Gap[];
|
|
153
|
+
export type LedgerStatus = 'future' | 'weekend' | 'bank_holiday' | 'not_workable' | 'on_leave' | 'half_day_leave' | 'complete' | 'missing' | 'over';
|
|
154
|
+
export interface LedgerDay {
|
|
155
|
+
date: string;
|
|
156
|
+
day_type: string | null;
|
|
157
|
+
expected_minutes: number;
|
|
158
|
+
tracked_minutes: number;
|
|
159
|
+
leave: LeaveCover | null;
|
|
160
|
+
shifts: Array<{
|
|
161
|
+
clock_in: string;
|
|
162
|
+
clock_out: string | null;
|
|
163
|
+
minutes: number | null;
|
|
164
|
+
}>;
|
|
165
|
+
status: LedgerStatus;
|
|
166
|
+
/** tracked minus expected; negative means hours are missing */
|
|
167
|
+
delta_minutes: number;
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* One row per calendar day in the range, with everything the planner knows
|
|
171
|
+
* about it, for auditing what was clocked against what the contract, the
|
|
172
|
+
* company calendar and the leave record say should have been.
|
|
173
|
+
*/
|
|
174
|
+
export declare function computeLedger(dates: string[], facts: PlanFacts, toleranceMinutes?: number): LedgerDay[];
|
|
175
|
+
/** 720 -> "12h", 750 -> "12h30" */
|
|
176
|
+
export declare function hours(minutes: number): string;
|
|
177
|
+
/**
|
|
178
|
+
* Render the plan the way the confirmation step shows it. It always names the
|
|
179
|
+
* person, because the company-wide key makes writing someone else's hours the
|
|
180
|
+
* mistake worth catching.
|
|
181
|
+
*/
|
|
182
|
+
export declare function formatPlanPreview(plan: BackfillPlan, employee: {
|
|
183
|
+
id: number;
|
|
184
|
+
name: string;
|
|
185
|
+
}, range: {
|
|
186
|
+
start: string;
|
|
187
|
+
end: string;
|
|
188
|
+
}, request: PlanRequest, observations?: string): string;
|
|
189
|
+
//# sourceMappingURL=planner.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.d.ts","sourceRoot":"","sources":["../../src/attendance/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAIH,qEAAqE;AACrE,MAAM,WAAW,OAAO;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,+BAA+B;AAC/B,MAAM,WAAW,YAAa,SAAQ,OAAO;IAC3C,IAAI,EAAE,MAAM,CAAC;CACd;AAED,4DAA4D;AAC5D,MAAM,WAAW,QAAQ;IACvB,wEAAwE;IACxE,QAAQ,EAAE,MAAM,CAAC;IACjB,kEAAkE;IAClE,gBAAgB,EAAE,MAAM,CAAC;IACzB,mCAAmC;IACnC,eAAe,EAAE,MAAM,CAAC;CACzB;AAED,+EAA+E;AAC/E,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAC1B;AAED,0CAA0C;AAC1C,MAAM,MAAM,UAAU,GAAG,MAAM,GAAG,kBAAkB,GAAG,YAAY,CAAC;AAEpE,qDAAqD;AACrD,MAAM,WAAW,SAAS;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,MAAM,CAAC;IAClB,QAA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G,MAAM,CAI7C;AAQD;;;;GAIG;AACH,wBAAgB,iBAAiB,CAC/B,IAAI,EAAE,YAAY,EAClB,QAAQ,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EACtC,KAAK,EAAE;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,GAAG,EAAE,MAAM,CAAA;CAAE,EACrC,OAAO,EAAE,WAAW,EACpB,YAAY,CAAC,EAAE,MAAM,GACpB,MAAM,CAqDR"}
|
|
@@ -0,0 +1,427 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Backfill planner for attendance shifts (registro horario).
|
|
3
|
+
*
|
|
4
|
+
* Everything in this module is pure: no network, no clock, no configuration.
|
|
5
|
+
* The caller gathers facts from the API (worked_times, estimated_times,
|
|
6
|
+
* existing shifts, approved leaves) and the planner turns them plus the
|
|
7
|
+
* requested segments into an explicit list of writes and skips. Every rule is
|
|
8
|
+
* a unit test in src/__tests__/unit/attendance/planner.test.ts.
|
|
9
|
+
*/
|
|
10
|
+
import { createHash } from 'node:crypto';
|
|
11
|
+
const HHMM = /^([01]\d|2[0-3]):([0-5]\d)$/;
|
|
12
|
+
const DATE = /^\d{4}-\d{2}-\d{2}$/;
|
|
13
|
+
const END_OF_DAY = 24 * 60;
|
|
14
|
+
/**
|
|
15
|
+
* A day whose tracked minutes are within this distance of the expected minutes
|
|
16
|
+
* counts as complete. Real clock-ins are never exact, and jittered backfills
|
|
17
|
+
* are deliberately not, so a strict comparison would flag nearly every day.
|
|
18
|
+
*/
|
|
19
|
+
export const DEFAULT_TOLERANCE_MINUTES = 15;
|
|
20
|
+
/** Parse "HH:MM" into minutes since midnight; anything else is rejected */
|
|
21
|
+
export function parseHHMM(value) {
|
|
22
|
+
const match = HHMM.exec(value);
|
|
23
|
+
if (!match) {
|
|
24
|
+
throw new Error(`Time "${value}" must be HH:MM in 24-hour company local time`);
|
|
25
|
+
}
|
|
26
|
+
return Number(match[1]) * 60 + Number(match[2]);
|
|
27
|
+
}
|
|
28
|
+
/** True when two [start, end) intervals share any time; touching does not count */
|
|
29
|
+
export function intervalsOverlap(a, b) {
|
|
30
|
+
return a[0] < b[1] && b[0] < a[1];
|
|
31
|
+
}
|
|
32
|
+
function assertDate(value) {
|
|
33
|
+
if (!DATE.test(value) || Number.isNaN(Date.parse(`${value}T00:00:00Z`))) {
|
|
34
|
+
throw new Error(`Date "${value}" must be YYYY-MM-DD`);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/** Every date from start to end inclusive */
|
|
38
|
+
export function enumerateDates(start, end) {
|
|
39
|
+
assertDate(start);
|
|
40
|
+
assertDate(end);
|
|
41
|
+
if (start > end) {
|
|
42
|
+
throw new Error(`start_on ${start} is after end_on ${end}`);
|
|
43
|
+
}
|
|
44
|
+
const dates = [];
|
|
45
|
+
const cursor = new Date(`${start}T00:00:00Z`);
|
|
46
|
+
const last = new Date(`${end}T00:00:00Z`);
|
|
47
|
+
while (cursor <= last) {
|
|
48
|
+
dates.push(cursor.toISOString().slice(0, 10));
|
|
49
|
+
cursor.setUTCDate(cursor.getUTCDate() + 1);
|
|
50
|
+
}
|
|
51
|
+
return dates;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Validate the segments of one day: HH:MM only, clock_in strictly before
|
|
55
|
+
* clock_out, no overnight shifts, no overlap between segments.
|
|
56
|
+
*/
|
|
57
|
+
export function validateSegments(segments) {
|
|
58
|
+
if (segments.length === 0) {
|
|
59
|
+
throw new Error('segments must contain at least one {clock_in, clock_out} entry');
|
|
60
|
+
}
|
|
61
|
+
const intervals = segments.map(segment => {
|
|
62
|
+
const start = parseHHMM(segment.clock_in);
|
|
63
|
+
const end = parseHHMM(segment.clock_out);
|
|
64
|
+
if (end < start) {
|
|
65
|
+
throw new Error(`Segment ${segment.clock_in}-${segment.clock_out} ends before it starts. Overnight shifts ` +
|
|
66
|
+
'are not supported by the bulk actions; use the create action with reference_date instead.');
|
|
67
|
+
}
|
|
68
|
+
if (end === start) {
|
|
69
|
+
throw new Error(`Segment ${segment.clock_in}-${segment.clock_out}: clock_in must be before clock_out`);
|
|
70
|
+
}
|
|
71
|
+
return [start, end];
|
|
72
|
+
});
|
|
73
|
+
for (let i = 0; i < intervals.length; i++) {
|
|
74
|
+
for (let j = i + 1; j < intervals.length; j++) {
|
|
75
|
+
if (intervalsOverlap(intervals[i], intervals[j])) {
|
|
76
|
+
throw new Error(`Segments ${segments[i].clock_in}-${segments[i].clock_out} and ` +
|
|
77
|
+
`${segments[j].clock_in}-${segments[j].clock_out} overlap each other`);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Turn leave records into a per-date cover map. Only approved, undeleted
|
|
84
|
+
* leaves count; a pending (approved: null) or rejected leave does not block
|
|
85
|
+
* anything. A later leave over the same date never downgrades a full cover.
|
|
86
|
+
*/
|
|
87
|
+
export function expandLeaves(leaves) {
|
|
88
|
+
const cover = new Map();
|
|
89
|
+
for (const leave of leaves) {
|
|
90
|
+
if (leave.approved !== true || leave.deleted_at !== null)
|
|
91
|
+
continue;
|
|
92
|
+
const kind = leave.half_day === 'beggining_of_day' || leave.half_day === 'end_of_day'
|
|
93
|
+
? leave.half_day
|
|
94
|
+
: 'full';
|
|
95
|
+
for (const date of enumerateDates(leave.start_on, leave.finish_on)) {
|
|
96
|
+
const existing = cover.get(date);
|
|
97
|
+
if (existing === 'full')
|
|
98
|
+
continue;
|
|
99
|
+
cover.set(date, kind);
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return cover;
|
|
103
|
+
}
|
|
104
|
+
function daySkipReason(date, request, facts) {
|
|
105
|
+
if (date > facts.today) {
|
|
106
|
+
return {
|
|
107
|
+
date,
|
|
108
|
+
reason: 'future_date',
|
|
109
|
+
detail: `today is ${facts.today} in the zone of the machine running the server`,
|
|
110
|
+
};
|
|
111
|
+
}
|
|
112
|
+
const day = facts.days.get(date);
|
|
113
|
+
if (request.mode === 'range') {
|
|
114
|
+
if (day?.day_type === 'saturday' || day?.day_type === 'sunday') {
|
|
115
|
+
return { date, reason: 'weekend' };
|
|
116
|
+
}
|
|
117
|
+
if (day?.day_type === 'bank_holiday') {
|
|
118
|
+
return { date, reason: 'bank_holiday' };
|
|
119
|
+
}
|
|
120
|
+
if (!day || day.expected_minutes <= 0) {
|
|
121
|
+
return {
|
|
122
|
+
date,
|
|
123
|
+
reason: 'not_workable',
|
|
124
|
+
detail: day ? 'contract expects 0 minutes' : 'no contract data for this date',
|
|
125
|
+
};
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
if (request.skip_leave) {
|
|
129
|
+
const cover = facts.leaves.get(date);
|
|
130
|
+
if (cover === 'full') {
|
|
131
|
+
return { date, reason: 'on_leave', detail: 'approved leave' };
|
|
132
|
+
}
|
|
133
|
+
if (cover && request.mode === 'range') {
|
|
134
|
+
return {
|
|
135
|
+
date,
|
|
136
|
+
reason: 'half_day_leave',
|
|
137
|
+
detail: `approved half-day leave (${cover}); write it with log_days if the other half was worked`,
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return null;
|
|
142
|
+
}
|
|
143
|
+
function existingIntervals(shifts, date) {
|
|
144
|
+
return shifts
|
|
145
|
+
.filter(shift => shift.date === date)
|
|
146
|
+
.map(shift => {
|
|
147
|
+
let start;
|
|
148
|
+
let end;
|
|
149
|
+
try {
|
|
150
|
+
start = parseHHMM(shift.clock_in);
|
|
151
|
+
end = shift.clock_out === null ? END_OF_DAY : parseHHMM(shift.clock_out);
|
|
152
|
+
}
|
|
153
|
+
catch {
|
|
154
|
+
throw new Error(`An existing shift on ${date} has times the planner cannot read ` +
|
|
155
|
+
`(${shift.clock_in}-${shift.clock_out ?? 'open'}). Fix or delete that record first.`);
|
|
156
|
+
}
|
|
157
|
+
// An overnight existing shift (clock_out before clock_in) occupies to end of day.
|
|
158
|
+
if (end < start)
|
|
159
|
+
end = END_OF_DAY;
|
|
160
|
+
const label = `${shift.clock_in}-${shift.clock_out ?? 'open'}`;
|
|
161
|
+
return [start, end, label];
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
function formatHHMM(minutes) {
|
|
165
|
+
const clamped = Math.max(0, Math.min(END_OF_DAY - 1, minutes));
|
|
166
|
+
return `${String(Math.floor(clamped / 60)).padStart(2, '0')}:${String(clamped % 60).padStart(2, '0')}`;
|
|
167
|
+
}
|
|
168
|
+
/** Deterministic integer in [-magnitude, magnitude] derived from the record's identity */
|
|
169
|
+
function deterministicOffset(seed, magnitude) {
|
|
170
|
+
if (magnitude <= 0)
|
|
171
|
+
return 0;
|
|
172
|
+
const digest = createHash('sha256').update(seed).digest();
|
|
173
|
+
const value = digest.readUInt32BE(0) % (2 * magnitude + 1);
|
|
174
|
+
return value - magnitude;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Apply per-record variation to a day's segments. Nobody clocks in at exactly
|
|
178
|
+
* 09:00 every day, so a month of identical times is the one pattern a real
|
|
179
|
+
* registro never shows. The variation is derived from a hash of the employee,
|
|
180
|
+
* the date and the segment, so re-planning the same request yields the same
|
|
181
|
+
* times: the preview shows exactly what will be written, the confirmation
|
|
182
|
+
* token binds to it, and a retry after a partial failure recognises its own
|
|
183
|
+
* earlier writes. Segments never cross each other or midnight.
|
|
184
|
+
*/
|
|
185
|
+
export function jitterSegments(employeeId, date, segments, magnitude) {
|
|
186
|
+
if (magnitude <= 0)
|
|
187
|
+
return segments;
|
|
188
|
+
const ordered = [...segments].sort((a, b) => parseHHMM(a.clock_in) - parseHHMM(b.clock_in));
|
|
189
|
+
const result = [];
|
|
190
|
+
let previousEnd = -Infinity;
|
|
191
|
+
ordered.forEach((segment, index) => {
|
|
192
|
+
const baseStart = parseHHMM(segment.clock_in);
|
|
193
|
+
const baseEnd = parseHHMM(segment.clock_out);
|
|
194
|
+
const nextStart = index + 1 < ordered.length ? parseHHMM(ordered[index + 1].clock_in) : Infinity;
|
|
195
|
+
let start = baseStart + deterministicOffset(`${employeeId}|${date}|${index}|in`, magnitude);
|
|
196
|
+
let end = baseEnd + deterministicOffset(`${employeeId}|${date}|${index}|out`, magnitude);
|
|
197
|
+
// Never start before the previous segment ended, never end after the next one may start.
|
|
198
|
+
start = Math.max(start, previousEnd, 0);
|
|
199
|
+
end = Math.min(end, nextStart - magnitude - 1, END_OF_DAY - 1);
|
|
200
|
+
if (end <= start) {
|
|
201
|
+
start = baseStart;
|
|
202
|
+
end = baseEnd;
|
|
203
|
+
}
|
|
204
|
+
previousEnd = end;
|
|
205
|
+
result.push({ clock_in: formatHHMM(start), clock_out: formatHHMM(end) });
|
|
206
|
+
});
|
|
207
|
+
return result;
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Build the plan. Skip reasons are evaluated in the documented order and the
|
|
211
|
+
* first match wins. Explicit days skip the weekday, holiday and workability
|
|
212
|
+
* rules on purpose: migration must be able to write a Saturday someone worked.
|
|
213
|
+
*/
|
|
214
|
+
export function buildBackfillPlan(request, facts) {
|
|
215
|
+
const requested = request.mode === 'range'
|
|
216
|
+
? request.dates.map(date => ({ date, segments: request.segments }))
|
|
217
|
+
: request.days;
|
|
218
|
+
if (request.mode === 'range') {
|
|
219
|
+
validateSegments(request.segments);
|
|
220
|
+
}
|
|
221
|
+
else {
|
|
222
|
+
const seen = new Set();
|
|
223
|
+
for (const day of request.days) {
|
|
224
|
+
assertDate(day.date);
|
|
225
|
+
if (seen.has(day.date)) {
|
|
226
|
+
throw new Error(`Date ${day.date} appears more than once in days`);
|
|
227
|
+
}
|
|
228
|
+
seen.add(day.date);
|
|
229
|
+
validateSegments(day.segments);
|
|
230
|
+
}
|
|
231
|
+
}
|
|
232
|
+
const writes = [];
|
|
233
|
+
const skippedDays = [];
|
|
234
|
+
const skippedSegments = [];
|
|
235
|
+
const writtenDates = new Set();
|
|
236
|
+
let minutes = 0;
|
|
237
|
+
for (const { date, segments } of requested) {
|
|
238
|
+
const skip = daySkipReason(date, request, facts);
|
|
239
|
+
if (skip) {
|
|
240
|
+
skippedDays.push(skip);
|
|
241
|
+
continue;
|
|
242
|
+
}
|
|
243
|
+
const existing = existingIntervals(facts.shifts, date);
|
|
244
|
+
const planned = jitterSegments(request.employee_id, date, segments, request.jitter_minutes ?? 0);
|
|
245
|
+
for (const segment of planned) {
|
|
246
|
+
const interval = [
|
|
247
|
+
parseHHMM(segment.clock_in),
|
|
248
|
+
parseHHMM(segment.clock_out),
|
|
249
|
+
];
|
|
250
|
+
const clash = existing.find(([start, end]) => intervalsOverlap(interval, [start, end]));
|
|
251
|
+
if (clash) {
|
|
252
|
+
skippedSegments.push({
|
|
253
|
+
date,
|
|
254
|
+
...segment,
|
|
255
|
+
reason: 'overlaps_existing',
|
|
256
|
+
detail: `overlaps existing ${clash[2]}`,
|
|
257
|
+
});
|
|
258
|
+
continue;
|
|
259
|
+
}
|
|
260
|
+
writes.push({ date, ...segment });
|
|
261
|
+
writtenDates.add(date);
|
|
262
|
+
minutes += interval[1] - interval[0];
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
return {
|
|
266
|
+
writes,
|
|
267
|
+
skippedDays,
|
|
268
|
+
skippedSegments,
|
|
269
|
+
totals: { days: writtenDates.size, records: writes.length, minutes },
|
|
270
|
+
};
|
|
271
|
+
}
|
|
272
|
+
/**
|
|
273
|
+
* Stable digest of who and what a plan writes, including the note stored on
|
|
274
|
+
* every record; the confirmation token is bound to it.
|
|
275
|
+
*/
|
|
276
|
+
export function planFingerprint(employeeId, writes, observations) {
|
|
277
|
+
const canonical = writes
|
|
278
|
+
.map(w => `${w.date} ${w.clock_in} ${w.clock_out}`)
|
|
279
|
+
.sort()
|
|
280
|
+
.join('\n');
|
|
281
|
+
return createHash('sha256')
|
|
282
|
+
.update(`${employeeId}\n${observations ?? ''}\n${canonical}`)
|
|
283
|
+
.digest('hex');
|
|
284
|
+
}
|
|
285
|
+
/**
|
|
286
|
+
* Workdays up to today where the contract expects more than was tracked and no
|
|
287
|
+
* full-day leave applies. Future dates are left out, since log_range would
|
|
288
|
+
* refuse them anyway.
|
|
289
|
+
*/
|
|
290
|
+
export function computeGaps(facts, toleranceMinutes = DEFAULT_TOLERANCE_MINUTES) {
|
|
291
|
+
const gaps = [];
|
|
292
|
+
for (const [date, day] of [...facts.days.entries()].sort(([a], [b]) => a.localeCompare(b))) {
|
|
293
|
+
if (date > facts.today)
|
|
294
|
+
continue;
|
|
295
|
+
if (day.day_type !== 'workday')
|
|
296
|
+
continue;
|
|
297
|
+
if (day.expected_minutes - day.tracked_minutes <= toleranceMinutes)
|
|
298
|
+
continue;
|
|
299
|
+
const cover = facts.leaves.get(date);
|
|
300
|
+
if (cover === 'full')
|
|
301
|
+
continue;
|
|
302
|
+
gaps.push({
|
|
303
|
+
date,
|
|
304
|
+
expected_minutes: day.expected_minutes,
|
|
305
|
+
tracked_minutes: day.tracked_minutes,
|
|
306
|
+
missing_minutes: day.expected_minutes - day.tracked_minutes,
|
|
307
|
+
half_day_leave: cover ?? null,
|
|
308
|
+
});
|
|
309
|
+
}
|
|
310
|
+
return gaps;
|
|
311
|
+
}
|
|
312
|
+
/**
|
|
313
|
+
* One row per calendar day in the range, with everything the planner knows
|
|
314
|
+
* about it, for auditing what was clocked against what the contract, the
|
|
315
|
+
* company calendar and the leave record say should have been.
|
|
316
|
+
*/
|
|
317
|
+
export function computeLedger(dates, facts, toleranceMinutes = DEFAULT_TOLERANCE_MINUTES) {
|
|
318
|
+
return dates.map(date => {
|
|
319
|
+
const day = facts.days.get(date);
|
|
320
|
+
const leave = facts.leaves.get(date) ?? null;
|
|
321
|
+
const shifts = facts.shifts
|
|
322
|
+
.filter(s => s.date === date)
|
|
323
|
+
.sort((a, b) => a.clock_in.localeCompare(b.clock_in))
|
|
324
|
+
.map(s => ({
|
|
325
|
+
clock_in: s.clock_in,
|
|
326
|
+
clock_out: s.clock_out,
|
|
327
|
+
minutes: s.clock_out === null ? null : parseHHMM(s.clock_out) - parseHHMM(s.clock_in),
|
|
328
|
+
}));
|
|
329
|
+
const expected = day?.expected_minutes ?? 0;
|
|
330
|
+
const tracked = day?.tracked_minutes ?? 0;
|
|
331
|
+
let status;
|
|
332
|
+
if (date > facts.today)
|
|
333
|
+
status = 'future';
|
|
334
|
+
else if (day?.day_type === 'saturday' || day?.day_type === 'sunday')
|
|
335
|
+
status = 'weekend';
|
|
336
|
+
else if (day?.day_type === 'bank_holiday')
|
|
337
|
+
status = 'bank_holiday';
|
|
338
|
+
else if (leave === 'full')
|
|
339
|
+
status = 'on_leave';
|
|
340
|
+
else if (leave)
|
|
341
|
+
status = 'half_day_leave';
|
|
342
|
+
else if (expected <= 0)
|
|
343
|
+
status = 'not_workable';
|
|
344
|
+
else if (expected - tracked > toleranceMinutes)
|
|
345
|
+
status = 'missing';
|
|
346
|
+
else if (tracked - expected > toleranceMinutes)
|
|
347
|
+
status = 'over';
|
|
348
|
+
else
|
|
349
|
+
status = 'complete';
|
|
350
|
+
return {
|
|
351
|
+
date,
|
|
352
|
+
day_type: day?.day_type ?? null,
|
|
353
|
+
expected_minutes: expected,
|
|
354
|
+
tracked_minutes: tracked,
|
|
355
|
+
leave,
|
|
356
|
+
shifts,
|
|
357
|
+
status,
|
|
358
|
+
delta_minutes: tracked - expected,
|
|
359
|
+
};
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
/** 720 -> "12h", 750 -> "12h30" */
|
|
363
|
+
export function hours(minutes) {
|
|
364
|
+
const whole = Math.floor(minutes / 60);
|
|
365
|
+
const rest = minutes % 60;
|
|
366
|
+
return rest === 0 ? `${whole}h` : `${whole}h${String(rest).padStart(2, '0')}`;
|
|
367
|
+
}
|
|
368
|
+
function countBy(items) {
|
|
369
|
+
const counts = new Map();
|
|
370
|
+
for (const item of items)
|
|
371
|
+
counts.set(item.reason, (counts.get(item.reason) ?? 0) + 1);
|
|
372
|
+
return counts;
|
|
373
|
+
}
|
|
374
|
+
/**
|
|
375
|
+
* Render the plan the way the confirmation step shows it. It always names the
|
|
376
|
+
* person, because the company-wide key makes writing someone else's hours the
|
|
377
|
+
* mistake worth catching.
|
|
378
|
+
*/
|
|
379
|
+
export function formatPlanPreview(plan, employee, range, request, observations) {
|
|
380
|
+
const lines = [];
|
|
381
|
+
lines.push(`Plan for ${employee.name} (${employee.id})`);
|
|
382
|
+
lines.push(`${range.start} .. ${range.end}`);
|
|
383
|
+
lines.push('');
|
|
384
|
+
lines.push(` ${plan.totals.days} days to write, ${plan.totals.records} shift records, ${hours(plan.totals.minutes)}`);
|
|
385
|
+
if (request.mode === 'range') {
|
|
386
|
+
lines.push(` ${request.segments.map(s => `${s.clock_in}-${s.clock_out}`).join(' and ')}`);
|
|
387
|
+
}
|
|
388
|
+
if (observations) {
|
|
389
|
+
lines.push(` Note on every record: "${observations}"`);
|
|
390
|
+
}
|
|
391
|
+
if (request.jitter_minutes && request.jitter_minutes > 0) {
|
|
392
|
+
lines.push(` Each time varies by up to ${request.jitter_minutes} minutes from the pattern (fixed per record, shown below).`);
|
|
393
|
+
}
|
|
394
|
+
if (plan.writes.length > 0 && plan.writes.length <= 62) {
|
|
395
|
+
lines.push('');
|
|
396
|
+
lines.push(' Records to write:');
|
|
397
|
+
for (const w of plan.writes)
|
|
398
|
+
lines.push(` ${w.date} ${w.clock_in}-${w.clock_out}`);
|
|
399
|
+
}
|
|
400
|
+
if (plan.skippedDays.length > 0) {
|
|
401
|
+
lines.push('');
|
|
402
|
+
lines.push(` Skipping ${plan.skippedDays.length} days:`);
|
|
403
|
+
const byReason = countBy(plan.skippedDays);
|
|
404
|
+
const labels = {
|
|
405
|
+
future_date: 'in the future',
|
|
406
|
+
weekend: 'weekend',
|
|
407
|
+
bank_holiday: 'bank holiday',
|
|
408
|
+
not_workable: 'not workable under the contract',
|
|
409
|
+
on_leave: 'approved leave',
|
|
410
|
+
half_day_leave: 'half-day leave, write it with log_days if the other half was worked',
|
|
411
|
+
};
|
|
412
|
+
for (const [reason, count] of byReason) {
|
|
413
|
+
const dates = plan.skippedDays.filter(d => d.reason === reason).map(d => d.date);
|
|
414
|
+
const suffix = reason === 'weekend' ? '' : ` (${dates.join(', ')})`;
|
|
415
|
+
lines.push(` ${count} ${labels[reason]}${suffix}`);
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
if (plan.skippedSegments.length > 0) {
|
|
419
|
+
lines.push('');
|
|
420
|
+
lines.push(` Skipping ${plan.skippedSegments.length} segments that overlap existing shifts:`);
|
|
421
|
+
for (const segment of plan.skippedSegments) {
|
|
422
|
+
lines.push(` ${segment.date} ${segment.clock_in}-${segment.clock_out} ${segment.detail}`);
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
return lines.join('\n');
|
|
426
|
+
}
|
|
427
|
+
//# sourceMappingURL=planner.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"planner.js","sourceRoot":"","sources":["../../src/attendance/planner.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AA6GzC,MAAM,IAAI,GAAG,6BAA6B,CAAC;AAC3C,MAAM,IAAI,GAAG,qBAAqB,CAAC;AACnC,MAAM,UAAU,GAAG,EAAE,GAAG,EAAE,CAAC;AAE3B;;;;GAIG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,EAAE,CAAC;AAE5C,2EAA2E;AAC3E,MAAM,UAAU,SAAS,CAAC,KAAa;IACrC,MAAM,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,CAAC,KAAK,EAAE,CAAC;QACX,MAAM,IAAI,KAAK,CAAC,SAAS,KAAK,+CAA+C,CAAC,CAAC;IACjF,CAAC;IACD,OAAO,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC;AAClD,CAAC;AAED,mFAAmF;AACnF,MAAM,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,OAAO,OAAO,CAAC,IAAI,IAAI,OAAO,CAAC,QAAQ,IAAI,OAAO,CAAC,SAAS,IAAI,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC;QAC/F,CAAC;IACH,CAAC;IAED,OAAO,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;AAC1B,CAAC"}
|
package/dist/endpoints.d.ts
CHANGED
|
@@ -17,6 +17,11 @@ export declare const ENDPOINTS: {
|
|
|
17
17
|
readonly leaveTypes: "/timeoff/leave-types";
|
|
18
18
|
readonly allowances: "/timeoff/allowances";
|
|
19
19
|
readonly shifts: "/attendance/shifts";
|
|
20
|
+
readonly openShifts: "/attendance/open_shifts";
|
|
21
|
+
readonly estimatedTimes: "/attendance/estimated_times";
|
|
22
|
+
readonly workedTimes: "/attendance/worked_times";
|
|
23
|
+
readonly clockIn: "/attendance/shifts/clock_in";
|
|
24
|
+
readonly clockOut: "/attendance/shifts/clock_out";
|
|
20
25
|
readonly folders: "/documents/folders";
|
|
21
26
|
readonly documents: "/documents/documents";
|
|
22
27
|
readonly jobRoles: "/job_catalog/roles";
|
package/dist/endpoints.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS
|
|
1
|
+
{"version":3,"file":"endpoints.d.ts","sourceRoot":"","sources":["../src/endpoints.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH;;GAEG;AACH,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAwDZ,CAAC;AAEX;;GAEG;AACH,MAAM,MAAM,WAAW,GAAG,MAAM,OAAO,SAAS,CAAC;AAEjD;;GAEG;AACH,wBAAgB,cAAc,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,GAAG,MAAM,CAEnE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,QAAQ,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,MAAM,CAEvF"}
|