@t4dhg/mcp-factorial 10.1.0 → 11.0.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 +64 -43
- package/dist/api/attendance.d.ts +17 -1
- package/dist/api/attendance.d.ts.map +1 -1
- package/dist/api/attendance.js +38 -1
- package/dist/api/attendance.js.map +1 -1
- package/dist/api/documents.js +11 -11
- package/dist/api/documents.js.map +1 -1
- package/dist/api/index.d.ts +2 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/api/index.js +2 -2
- package/dist/api/index.js.map +1 -1
- package/dist/api/time-off.d.ts +6 -0
- package/dist/api/time-off.d.ts.map +1 -1
- package/dist/api/time-off.js +16 -5
- package/dist/api/time-off.js.map +1 -1
- package/dist/attendance/backfill.d.ts +27 -6
- package/dist/attendance/backfill.d.ts.map +1 -1
- package/dist/attendance/backfill.js +69 -14
- package/dist/attendance/backfill.js.map +1 -1
- package/dist/attendance/gate.js +1 -1
- package/dist/attendance/gate.js.map +1 -1
- package/dist/attendance/planner.d.ts +91 -3
- package/dist/attendance/planner.d.ts.map +1 -1
- package/dist/attendance/planner.js +204 -18
- package/dist/attendance/planner.js.map +1 -1
- package/dist/attendance/report.d.ts +39 -0
- package/dist/attendance/report.d.ts.map +1 -0
- package/dist/attendance/report.js +142 -0
- package/dist/attendance/report.js.map +1 -0
- package/dist/confirmation.d.ts.map +1 -1
- package/dist/confirmation.js +3 -2
- package/dist/confirmation.js.map +1 -1
- package/dist/endpoints.d.ts +2 -0
- package/dist/endpoints.d.ts.map +1 -1
- package/dist/endpoints.js +2 -0
- package/dist/endpoints.js.map +1 -1
- package/dist/errors.d.ts +6 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +10 -5
- package/dist/errors.js.map +1 -1
- package/dist/http-client.d.ts +51 -1
- package/dist/http-client.d.ts.map +1 -1
- package/dist/http-client.js +75 -7
- package/dist/http-client.js.map +1 -1
- package/dist/prompts/attendance.d.ts +55 -0
- package/dist/prompts/attendance.d.ts.map +1 -0
- package/dist/prompts/attendance.js +623 -0
- package/dist/prompts/attendance.js.map +1 -0
- package/dist/schemas/attendance.d.ts +123 -0
- package/dist/schemas/attendance.d.ts.map +1 -1
- package/dist/schemas/attendance.js +58 -0
- package/dist/schemas/attendance.js.map +1 -1
- package/dist/schemas/documents.d.ts +2 -2
- package/dist/schemas/index.d.ts +1 -1
- package/dist/schemas/index.d.ts.map +1 -1
- package/dist/schemas/index.js +1 -1
- package/dist/schemas/index.js.map +1 -1
- package/dist/schemas/projects.d.ts +2 -2
- package/dist/tools/attendance.d.ts.map +1 -1
- package/dist/tools/attendance.js +378 -82
- package/dist/tools/attendance.js.map +1 -1
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +6 -7
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/shared.d.ts +10 -1
- package/dist/tools/shared.d.ts.map +1 -1
- package/dist/tools/shared.js +33 -0
- package/dist/tools/shared.js.map +1 -1
- package/dist/tools/time-off.d.ts.map +1 -1
- package/dist/tools/time-off.js +9 -1
- package/dist/tools/time-off.js.map +1 -1
- package/dist/write-safety.d.ts +6 -0
- package/dist/write-safety.d.ts.map +1 -1
- package/dist/write-safety.js +7 -0
- package/dist/write-safety.js.map +1 -1
- package/llms.txt +12 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -39,7 +39,7 @@ The MCP server uses a hierarchical tool structure for optimal context usage. Ins
|
|
|
39
39
|
| `factorial_locations` | Location management | list, get, create, update, delete |
|
|
40
40
|
| `factorial_contracts` | Contract/salary data | list, get_with_employee, by_job_role, by_job_level |
|
|
41
41
|
| `factorial_time_off` | Leave management | 10 actions |
|
|
42
|
-
| `factorial_attendance` | Shifts and registro horario |
|
|
42
|
+
| `factorial_attendance` | Shifts and registro horario | 14 actions incl. clock_in, audit, log_range |
|
|
43
43
|
| `factorial_documents` | Document management | 8 actions (downloads require OAuth2 - see below) |
|
|
44
44
|
| `factorial_job_catalog` | Job roles/levels | list_roles, get_role, list_levels |
|
|
45
45
|
| `factorial_projects` | Project management | 16 actions for projects, tasks, workers, time |
|
|
@@ -75,37 +75,40 @@ factorial_discover({ category: 'employees' });
|
|
|
75
75
|
|
|
76
76
|
### 124 Operations Across 14 Categories
|
|
77
77
|
|
|
78
|
-
| Category | Operations
|
|
79
|
-
| --------------- |
|
|
80
|
-
| **Employees** | list, get, search, create, update, terminate
|
|
81
|
-
| **Teams** | list, get, create, update, delete
|
|
82
|
-
| **Locations** | list, get, create, update, delete
|
|
83
|
-
| **Time Off** | list_leaves, get_leave, list_types, get_type, list_allowances, create, update, cancel, approve, reject
|
|
84
|
-
| **Attendance** | list, get, create, update, delete, clock_in, clock_out, status, gaps, audit, log_range, log_days
|
|
85
|
-
| **Projects** | 16 operations for projects, tasks, workers, time records
|
|
86
|
-
| **Training** | 12 operations for trainings, sessions, enrollments
|
|
87
|
-
| **Work Areas** | list, get, create, update, archive, unarchive
|
|
88
|
-
| **ATS** | 17 operations for job postings, candidates, applications, hiring stages
|
|
89
|
-
| **Payroll** | list/get supplements, tax identifiers, family situations (read-only)
|
|
90
|
-
| **Documents** | 8 operations for folders, documents, and downloads (⚠️ downloads require OAuth2)
|
|
91
|
-
| **Job Catalog** | list_roles, get_role, list_levels (read-only)
|
|
92
|
-
| **Contracts** | list, get_with_employee, by_job_role, by_job_level (read-only)
|
|
78
|
+
| Category | Operations |
|
|
79
|
+
| --------------- | ----------------------------------------------------------------------------------------------------------------------------------------- |
|
|
80
|
+
| **Employees** | list, get, search, create, update, terminate |
|
|
81
|
+
| **Teams** | list, get, create, update, delete |
|
|
82
|
+
| **Locations** | list, get, create, update, delete |
|
|
83
|
+
| **Time Off** | list_leaves, get_leave, list_types, get_type, list_allowances, create, update, cancel, approve, reject |
|
|
84
|
+
| **Attendance** | list, get, create, update, delete, clock_in, clock_out, status, gaps, audit, log_range, log_days, list_edit_requests, create_edit_request |
|
|
85
|
+
| **Projects** | 16 operations for projects, tasks, workers, time records |
|
|
86
|
+
| **Training** | 12 operations for trainings, sessions, enrollments |
|
|
87
|
+
| **Work Areas** | list, get, create, update, archive, unarchive |
|
|
88
|
+
| **ATS** | 17 operations for job postings, candidates, applications, hiring stages |
|
|
89
|
+
| **Payroll** | list/get supplements, tax identifiers, family situations (read-only) |
|
|
90
|
+
| **Documents** | 8 operations for folders, documents, and downloads (⚠️ downloads require OAuth2) |
|
|
91
|
+
| **Job Catalog** | list_roles, get_role, list_levels (read-only) |
|
|
92
|
+
| **Contracts** | list, get_with_employee, by_job_role, by_job_level (read-only) |
|
|
93
93
|
|
|
94
94
|
### Attendance and Registro Horario
|
|
95
95
|
|
|
96
96
|
Factorial asks employees to record their working hours day by day. `factorial_attendance` lets Claude do that, for one day or for a whole month, and for any employee the API key can see.
|
|
97
97
|
|
|
98
|
-
Times are `HH:MM` in the company's local time, exactly as Factorial shows them. Records written by this server carry `source: "api"`, so they are distinguishable from live clocks in Factorial's own activity log.
|
|
98
|
+
Times are `HH:MM` in the company's local time, exactly as Factorial shows them; Factorial applies them in the company zone and the server never converts between zones. Records written by this server carry `source: "api"`, so they are distinguishable from live clocks in Factorial's own activity log.
|
|
99
99
|
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
|
103
|
-
|
|
|
104
|
-
| `
|
|
105
|
-
| `
|
|
106
|
-
| `
|
|
107
|
-
| `
|
|
108
|
-
| `
|
|
100
|
+
A write's **declared working time** (`date`, `clock_in`, `clock_out`) is independent of its **entry metadata**: Factorial stamps `created_at`, `updated_at` and `in_source`/`out_source` with when and how the record was entered, and those cannot be set or changed through the API. Every create, update, `clock_in`, `clock_out`, and every bulk preview and result, states the declared working time and says this once.
|
|
101
|
+
|
|
102
|
+
| Action | What it does |
|
|
103
|
+
| ------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
104
|
+
| `status` | Whether the employee is clocked in and since when. Always prints the configured identity. |
|
|
105
|
+
| `clock_in`, `clock_out` | Live clocking at the current time, or, given `date` and `time` (`HH:MM` company local), a declared moment for someone who forgot to clock. A declared moment in the future is refused before any request is sent. A declared `clock_out` is refused if nothing is open, or if the moment precedes the open shift's start. |
|
|
106
|
+
| `gaps` | Workdays in a date range where the contract expects more hours than were tracked. Weekends, bank holidays and full-day leave are excluded. |
|
|
107
|
+
| `audit` | One row per calendar day in a range: day type, expected and tracked hours, leave cover, the shifts on record and a status (`complete`, `missing`, `short`, `over`, `weekend`, `bank_holiday`, `on_leave`, `half_day_leave`, `no_contract_data`, `future`). `missing` is nothing on record; `short` is some hours tracked but under expected by more than the tolerance, shown with its delta. A signed-off date is marked separately and is closed for writing; `create_edit_request` is how it gets corrected. The header gives `expected` (bank holidays and leave at full contract minutes) alongside `workday expected` (what tracked hours should actually meet). `statuses` restricts the summary to a given set. `format` is `summary` (default, only the days needing attention), `table` (every day) or `json` (the ledger). The starting point for reconciling what was clocked against what should have been. |
|
|
108
|
+
| `log_range` | Apply a daily pattern (`segments`) to every workable day in a range. Skips weekends, bank holidays, days the contract expects 0 minutes, approved leave, future dates, signed-off dates, `exclude_dates`, and any segment overlapping an existing shift. |
|
|
109
|
+
| `log_days` | Write an explicit list of days with their segments, for migrating from another platform. Only refuses future dates, approved leave, signed-off dates and overlaps, so a Saturday someone worked can be written. |
|
|
110
|
+
| `list`, `get`, `create`, `update`, `delete` | Individual shift records. `list` needs `start_on` and `end_on` (or `ids`, or `updated_at`); Factorial ignores paging on this endpoint, so paging is client-side. `fields: "compact"` on `list` returns a smaller payload (date, clock_in, clock_out, minutes, in_source); `get` returns the complete record. |
|
|
111
|
+
| `list_edit_requests`, `create_edit_request` | Factorial's route for correcting a signed-off day, since hours cannot be written onto a reviewed date directly. Filing a request notifies whoever approves timesheets, so `create_edit_request` is previewed and token-gated even for the configured identity. |
|
|
109
112
|
|
|
110
113
|
```typescript
|
|
111
114
|
// Find the missing days first
|
|
@@ -132,30 +135,47 @@ factorial_attendance({ action: 'audit', start_on: '2026-03-01', end_on: '2026-03
|
|
|
132
135
|
|
|
133
136
|
"Today" for the future-date rule is the date in the zone of the machine running the server, so run it in the company's zone or accept that the boundary day may be off by one. Bank holidays come from the company's own calendar in Factorial (`worked_times.day_type`), so no holiday list is needed. Approved leave is read from `timeoff/leaves`; pass `skip_leave: false` when the source system is right and Factorial's leave record is stale. Half-day leave days are left out of `log_range` and named in the preview; write the worked half with `log_days`.
|
|
134
137
|
|
|
135
|
-
Nobody clocks in at exactly 09:00 every day, and a month of identical entries is the one pattern a real registro never shows. Pass `jitter_minutes` (5 to 10 is sensible) to `log_range` or `log_days` and each written time varies by up to that many minutes from your pattern.
|
|
138
|
+
Nobody clocks in at exactly 09:00 every day, and a month of identical entries is the one pattern a real registro never shows. Pass `jitter_minutes` (5 to 10 is sensible) to `log_range` or `log_days` and each written time varies by up to that many minutes from your pattern, within the day; segments never cross each other. Pass `variation_minutes` for a different kind of variation: it shifts a whole day by one deterministic offset so the start time drifts from day to day, which `jitter_minutes` cannot produce because it only varies segments within a day. Both are derived from the employee, the date and (for jitter) the segment, so the preview lists the exact times that will be written, the confirmation token binds to them, and a retry recognises its own earlier records. The records still carry `source: "api"`; these options make reconstructed hours realistic, they do not disguise where they came from.
|
|
139
|
+
|
|
140
|
+
Every `gaps`, `audit` and bulk-write preview starts with a `Data read` line: how many days of the window have contract data, and how many leave and shift records were read. Reads follow Factorial's pagination to the end, so a window of any length is complete; a date the API returned nothing for is reported as `no_contract_data` and never written, rather than passed off as a day that was not workable. Those dates normally precede the start of employment. If they do not, the read was incomplete and the result should not be trusted.
|
|
141
|
+
|
|
142
|
+
**Signed-off periods.** Once a date's timesheet has been reviewed in Factorial, it is closed for writing; a shift write on it is refused with a 403. `audit` reads `attendance/reviews` alongside the other facts and marks such dates signed off before anything is written; `log_range` and `log_days` skip them the same way they skip a weekend or an approved leave day. The way to correct a signed-off day is `create_edit_request`, which files a request that whoever approves timesheets then decides on; `list_edit_requests` reads what has been filed. Filing a request is previewed and token-gated even for the configured identity, because it notifies a person.
|
|
143
|
+
|
|
144
|
+
A date that does not exist, such as `2026-02-30`, is refused rather than silently rolled forward to the next valid date; a real leap day such as `2024-02-29` is accepted normally.
|
|
136
145
|
|
|
137
146
|
**Auditing a month.** Run `audit` for the range first. A day within `tolerance_minutes` (default 15) of its expected total counts as `complete`, so realistic clock-ins and jittered backfills do not read as shortfalls. Compare the ledger with what you know locally (your calendar, another time-tracking system, days you actually worked on a holiday), then fix the differences: `log_range` or `log_days` for missing days, `delete` or `update` for wrong records, and `audit` again to confirm every workday reads `complete`.
|
|
138
147
|
|
|
148
|
+
Five prompts wrap these workflows for the user, and a guide resource documents them for the model; see [5 MCP Prompts](#5-mcp-prompts) and `factorial://guides/registro-horario`. Some clients (Claude Code included) surface a prompt only as a slash command the human invokes, with no way for the model itself to read one, so each prompt's procedure is also published as a resource at `factorial://prompts/<name>`.
|
|
149
|
+
|
|
139
150
|
Set `FACTORIAL_EMPLOYEE_ID` to your own employee id so that `employee_id` can be omitted. Writes aimed at anyone else, and every bulk write, require a confirmation token; see [Safety & Security](#safety--security).
|
|
140
151
|
|
|
141
|
-
###
|
|
152
|
+
### 6 MCP Resources
|
|
153
|
+
|
|
154
|
+
| Resource URI | Description |
|
|
155
|
+
| ------------------------------------- | ----------------------------------------------------------------------------------- |
|
|
156
|
+
| `factorial://org-chart` | Complete organizational hierarchy (Markdown) |
|
|
157
|
+
| `factorial://guides/registro-horario` | How to audit, fill and maintain a registro horario with this server (Markdown) |
|
|
158
|
+
| `factorial://employees/directory` | Employee directory by team (Markdown) |
|
|
159
|
+
| `factorial://locations/directory` | Location directory with employee counts (Markdown) |
|
|
160
|
+
| `factorial://timeoff/policies` | All leave types and policies (JSON) |
|
|
161
|
+
| `factorial://teams/{team_id}` | Team details with member list (JSON, templated) |
|
|
162
|
+
| `factorial://prompts/{name}` | The procedure text of an attendance prompt, readable without invoking it (Markdown) |
|
|
163
|
+
|
|
164
|
+
### 5 MCP Prompts
|
|
142
165
|
|
|
143
|
-
|
|
144
|
-
| --------------------------------- | -------------------------------------------------- |
|
|
145
|
-
| `factorial://org-chart` | Complete organizational hierarchy (Markdown) |
|
|
146
|
-
| `factorial://employees/directory` | Employee directory by team (Markdown) |
|
|
147
|
-
| `factorial://locations/directory` | Location directory with employee counts (Markdown) |
|
|
148
|
-
| `factorial://timeoff/policies` | All leave types and policies (JSON) |
|
|
149
|
-
| `factorial://teams/{team_id}` | Team details with member list (JSON, templated) |
|
|
166
|
+
Prompts are procedures the user invokes (in Claude Code they appear as `/mcp__factorial__<name>` slash commands). The attendance prompts pre-read the data the procedure starts from and state the exact tool calls that follow, so a small model can carry the workflow through. A prompt never writes anything itself; writes go through `factorial_attendance` and its confirmation gate.
|
|
150
167
|
|
|
151
|
-
|
|
168
|
+
| Prompt | Arguments | What it does |
|
|
169
|
+
| ---------------------- | -------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
170
|
+
| `attendance_audit` | `start_on`, `end_on`, `employee_id` (all optional) | Runs the audit (default: this month to today, `FACTORIAL_EMPLOYEE_ID`) and asks for a read-only report: expected vs tracked, missing and over days by month, data-coverage warnings. |
|
|
171
|
+
| `attendance_fill` | `segments` (required), `start_on`, `end_on`, `employee_id`, `observations`, `jitter_minutes` | Reads the gaps and hands over the exact `log_range` call with the parsed pattern, then the preview, human confirmation, token, retry and verification steps. `segments` is `"09:00-14:00, 15:00-18:00"`. |
|
|
172
|
+
| `attendance_today` | `segments` (required), `employee_id`, `observations`, `jitter_minutes` | Reads today's status and decides: nothing on weekends, holidays, leave, open shifts or complete days; otherwise `log_days` for today, confirmed in the same session for the configured identity only. |
|
|
173
|
+
| `attendance_reconcile` | `known_absences` (required), `start_on`, `end_on`, `employee_id` | Runs the audit and reports only the days that disagree with a stated list of known absences (days off, sick days, trips). Read-only. |
|
|
174
|
+
| `attendance_fill_days` | `days` (required), `employee_id`, `observations`, `jitter_minutes` | Enters registro horario for a list of explicit dates, each with its own daily pattern, as one `log_days` call: preview, human confirmation, token, retry and verification. `days` is `[{"date":"2026-03-02","segments":"09:00-14:00, 15:00-18:00"}]`. |
|
|
175
|
+
| `summarize_team` | `team_id` | Team summary with members and roles. |
|
|
176
|
+
| `time_off_report` | `employee_id` | Time off report for an employee: allowances and recent leaves. |
|
|
152
177
|
|
|
153
|
-
|
|
154
|
-
| ----------------------- | ----------------------------------------------------------------- |
|
|
155
|
-
| `onboard-employee` | Generate personalized onboarding checklists |
|
|
156
|
-
| `analyze-org-structure` | Analyze org structure (reporting lines, team sizes, distribution) |
|
|
157
|
-
| `timeoff-report` | Generate time off reports by team or date range |
|
|
158
|
-
| `team-document-summary` | Summarize documents across a team (certifications, payslips, etc) |
|
|
178
|
+
**Running the daily record on a schedule.** MCP has no scheduler, so the schedule lives in the client. In Claude Code, `/schedule` creates a routine that invokes `attendance_today` with your pattern, and `/loop` repeats it while a session is open; any cron can run `claude -p` with the prompt as its input. The prompt writes only when today is a workday with nothing tracked, and only for the employee in `FACTORIAL_EMPLOYEE_ID`; it reports one line either way. The record it produces is a legal document of hours worked, so the pattern you schedule must be the hours you actually work, and the day you do not work needs a leave record or a manual correction.
|
|
159
179
|
|
|
160
180
|
### Architecture Features
|
|
161
181
|
|
|
@@ -376,7 +396,7 @@ The following operations require explicit confirmation (`confirm: true`). Called
|
|
|
376
396
|
|
|
377
397
|
### Operations Gated by a Confirmation Token
|
|
378
398
|
|
|
379
|
-
Attendance writes are gated by **who they target and how many records they touch**, which a per-operation policy cannot express. A first call writes nothing and returns a preview that names the person, the dates and the totals, plus a `confirmation_token` valid for
|
|
399
|
+
Attendance writes are gated by **who they target and how many records they touch**, which a per-operation policy cannot express. A first call writes nothing and returns a preview that names the person, the dates and the totals, plus a `confirmation_token` valid for fifteen minutes and bound to exactly that plan. Repeating the call with the token executes it; if the plan changed in between (someone wrote a shift), the token is refused and a new preview is issued. `confirm: true` cannot bypass this gate, because there is no token to pass on a first call.
|
|
380
400
|
|
|
381
401
|
Gated whenever the target is not the configured `FACTORIAL_EMPLOYEE_ID`, and always when that variable is unset:
|
|
382
402
|
|
|
@@ -390,6 +410,7 @@ Always gated, whatever the target, because volume is its own hazard:
|
|
|
390
410
|
|
|
391
411
|
- `factorial_attendance({ action: 'log_range' })` - Writes one or more shift records per workable day in a range
|
|
392
412
|
- `factorial_attendance({ action: 'log_days' })` - Writes an explicit list of days
|
|
413
|
+
- `factorial_attendance({ action: 'create_edit_request' })` - Files a request to change a timesheet, which notifies a person, so it is gated even for the configured identity
|
|
393
414
|
|
|
394
415
|
Re-running a bulk call after a partial failure is safe against its own earlier writes: the planner re-reads existing shifts and skips whatever overlaps. It does not protect against another writer between the read and the writes.
|
|
395
416
|
|
package/dist/api/attendance.d.ts
CHANGED
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
* - estimated_times and worked_times require employee_ids[] and start_on.
|
|
11
11
|
*/
|
|
12
12
|
import { type PaginatedResponse } from '../pagination.js';
|
|
13
|
-
import { type Shift, type OpenShift, type EstimatedTime, type WorkedTime, type CreateShiftInput, type UpdateShiftInput, type ClockInput } from '../schemas.js';
|
|
13
|
+
import { type Shift, type OpenShift, type EstimatedTime, type WorkedTime, type AttendanceReview, type EditTimesheetRequest, type CreateEditTimesheetRequestInput, type CreateShiftInput, type UpdateShiftInput, type ClockInput } from '../schemas.js';
|
|
14
14
|
import type { ListShiftsOptions, DailyTimesOptions } from '../types.js';
|
|
15
15
|
/**
|
|
16
16
|
* Format a Date as ISO 8601 with the offset of the machine running the server,
|
|
@@ -44,6 +44,22 @@ export declare function listOpenShifts(employeeId?: number): Promise<OpenShift[]
|
|
|
44
44
|
export declare function listEstimatedTimes(options: DailyTimesOptions): Promise<EstimatedTime[]>;
|
|
45
45
|
/** Tracked minutes and day type per day; the holiday calendar surfaces here */
|
|
46
46
|
export declare function listWorkedTimes(options: DailyTimesOptions): Promise<WorkedTime[]>;
|
|
47
|
+
/**
|
|
48
|
+
* Dates whose timesheet has been signed off, which are closed for writing.
|
|
49
|
+
*
|
|
50
|
+
* This is the only read that answers "can I write to this date". There is no
|
|
51
|
+
* period or lock resource in the 2026-07-01 API; a reviewed date is the lock.
|
|
52
|
+
*/
|
|
53
|
+
export declare function listReviews(options: DailyTimesOptions): Promise<AttendanceReview[]>;
|
|
54
|
+
/**
|
|
55
|
+
* Edit timesheet requests, Factorial's route for changing a signed-off day.
|
|
56
|
+
*
|
|
57
|
+
* Hours cannot be written directly onto a reviewed date; a request is filed and
|
|
58
|
+
* whoever approves timesheets decides.
|
|
59
|
+
*/
|
|
60
|
+
export declare function listEditTimesheetRequests(employeeIds?: number[]): Promise<EditTimesheetRequest[]>;
|
|
61
|
+
/** File a request to change a timesheet. This notifies whoever approves them. */
|
|
62
|
+
export declare function createEditTimesheetRequest(input: CreateEditTimesheetRequestInput): Promise<EditTimesheetRequest>;
|
|
47
63
|
/** Clock an employee in now */
|
|
48
64
|
export declare function clockIn(input: ClockInput, now?: Date): Promise<Shift>;
|
|
49
65
|
/** Clock an employee out now */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendance.d.ts","sourceRoot":"","sources":["../../src/api/attendance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,
|
|
1
|
+
{"version":3,"file":"attendance.d.ts","sourceRoot":"","sources":["../../src/api/attendance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAWH,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EAWL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,aAAa,EAClB,KAAK,UAAU,EACf,KAAK,gBAAgB,EACrB,KAAK,oBAAoB,EAC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;AAED,+EAA+E;AAC/E,wBAAsB,eAAe,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,UAAU,EAAE,CAAC,CASvF;AAED;;;;;GAKG;AACH,wBAAsB,WAAW,CAAC,OAAO,EAAE,iBAAiB,GAAG,OAAO,CAAC,gBAAgB,EAAE,CAAC,CASzF;AAED;;;;;GAKG;AACH,wBAAsB,yBAAyB,CAC7C,WAAW,CAAC,EAAE,MAAM,EAAE,GACrB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CAKjC;AAED,iFAAiF;AACjF,wBAAsB,0BAA0B,CAC9C,KAAK,EAAE,+BAA+B,GACrC,OAAO,CAAC,oBAAoB,CAAC,CAY/B;AAuBD,+BAA+B;AAC/B,wBAAsB,OAAO,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAEvF;AAED,gCAAgC;AAChC,wBAAsB,QAAQ,CAAC,KAAK,EAAE,UAAU,EAAE,GAAG,GAAE,IAAiB,GAAG,OAAO,CAAC,KAAK,CAAC,CAExF"}
|
package/dist/api/attendance.js
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
import { fetchList, fetchOne, postOne, patchOne, deleteOne, factorialRequest, } from '../http-client.js';
|
|
13
13
|
import { cache } from '../cache.js';
|
|
14
14
|
import { buildPaginationParams, sliceForPagination, } from '../pagination.js';
|
|
15
|
-
import { ShiftSchema, OpenShiftSchema, EstimatedTimeSchema, WorkedTimeSchema, CreateShiftInputSchema, UpdateShiftInputSchema, ClockInputSchema, } from '../schemas.js';
|
|
15
|
+
import { ShiftSchema, OpenShiftSchema, EstimatedTimeSchema, WorkedTimeSchema, AttendanceReviewSchema, EditTimesheetRequestSchema, CreateEditTimesheetRequestInputSchema, CreateShiftInputSchema, UpdateShiftInputSchema, ClockInputSchema, } from '../schemas.js';
|
|
16
16
|
import { parseData, parseArray } from '../schemas/shared.js';
|
|
17
17
|
import { AuditAction, auditedOperation } from '../audit.js';
|
|
18
18
|
import { validateId } from '../utils.js';
|
|
@@ -164,6 +164,43 @@ export async function listWorkedTimes(options) {
|
|
|
164
164
|
});
|
|
165
165
|
return parseArray('WorkedTime', WorkedTimeSchema, data);
|
|
166
166
|
}
|
|
167
|
+
/**
|
|
168
|
+
* Dates whose timesheet has been signed off, which are closed for writing.
|
|
169
|
+
*
|
|
170
|
+
* This is the only read that answers "can I write to this date". There is no
|
|
171
|
+
* period or lock resource in the 2026-07-01 API; a reviewed date is the lock.
|
|
172
|
+
*/
|
|
173
|
+
export async function listReviews(options) {
|
|
174
|
+
const data = await fetchList(ENDPOINTS.reviews, {
|
|
175
|
+
params: {
|
|
176
|
+
employee_ids: options.employee_ids,
|
|
177
|
+
start_on: options.start_on,
|
|
178
|
+
end_on: options.end_on,
|
|
179
|
+
},
|
|
180
|
+
});
|
|
181
|
+
return parseArray('AttendanceReview', AttendanceReviewSchema, data);
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Edit timesheet requests, Factorial's route for changing a signed-off day.
|
|
185
|
+
*
|
|
186
|
+
* Hours cannot be written directly onto a reviewed date; a request is filed and
|
|
187
|
+
* whoever approves timesheets decides.
|
|
188
|
+
*/
|
|
189
|
+
export async function listEditTimesheetRequests(employeeIds) {
|
|
190
|
+
const data = await fetchList(ENDPOINTS.editTimesheetRequests, {
|
|
191
|
+
params: { employee_ids: employeeIds },
|
|
192
|
+
});
|
|
193
|
+
return parseArray('EditTimesheetRequest', EditTimesheetRequestSchema, data);
|
|
194
|
+
}
|
|
195
|
+
/** File a request to change a timesheet. This notifies whoever approves them. */
|
|
196
|
+
export async function createEditTimesheetRequest(input) {
|
|
197
|
+
const body = CreateEditTimesheetRequestInputSchema.parse(input);
|
|
198
|
+
return auditedOperation(AuditAction.CREATE, 'edit_timesheet_request', body.employee_id, async () => {
|
|
199
|
+
const created = await postOne(ENDPOINTS.editTimesheetRequests, body);
|
|
200
|
+
cache.invalidatePrefix('shifts');
|
|
201
|
+
return parseData('EditTimesheetRequest', EditTimesheetRequestSchema, created);
|
|
202
|
+
});
|
|
203
|
+
}
|
|
167
204
|
async function clockAction(action, input, now) {
|
|
168
205
|
const body = ClockInputSchema.parse(input);
|
|
169
206
|
const endpoint = action === 'clock_in' ? ENDPOINTS.clockIn : ENDPOINTS.clockOut;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"attendance.js","sourceRoot":"","sources":["../../src/api/attendance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,
|
|
1
|
+
{"version":3,"file":"attendance.js","sourceRoot":"","sources":["../../src/api/attendance.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,OAAO,EACP,QAAQ,EACR,SAAS,EACT,gBAAgB,GACjB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AACpC,OAAO,EACL,qBAAqB,EACrB,kBAAkB,GAEnB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,WAAW,EACX,eAAe,EACf,mBAAmB,EACnB,gBAAgB,EAChB,sBAAsB,EACtB,0BAA0B,EAC1B,qCAAqC,EACrC,sBAAsB,EACtB,sBAAsB,EACtB,gBAAgB,GAWjB,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAC7D,O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C,WAAW,EAAE,KAAK,EAAE,GAAG,CAAC,CAAC;AAC9C,CAAC"}
|
package/dist/api/documents.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Document API endpoints: Folders, Documents, Downloads
|
|
3
3
|
*/
|
|
4
|
-
import { fetchList, fetchOne } from '../http-client.js';
|
|
4
|
+
import { fetchList, fetchOne, fetchPage } from '../http-client.js';
|
|
5
5
|
import { cached, CACHE_TTL } from '../cache.js';
|
|
6
6
|
import { debug } from '../config.js';
|
|
7
7
|
import { isOAuth2Configured, getOAuth2AccessToken } from '../oauth.js';
|
|
@@ -41,19 +41,19 @@ export async function listDocuments(options) {
|
|
|
41
41
|
const baseParams = new URLSearchParams(queryParams).toString();
|
|
42
42
|
const fullParams = baseParams ? `${baseParams}&${employeeIdsParam}` : employeeIdsParam;
|
|
43
43
|
// Make request with custom query string
|
|
44
|
-
const
|
|
45
|
-
debug(`listDocuments returned ${
|
|
46
|
-
sampleDocument:
|
|
47
|
-
missingNames:
|
|
44
|
+
const page = await fetchPage(`${ENDPOINTS.documents}?${fullParams}`);
|
|
45
|
+
debug(`listDocuments returned ${page.data.length} documents`, {
|
|
46
|
+
sampleDocument: page.data[0],
|
|
47
|
+
missingNames: page.data.filter(d => !d.filename).length,
|
|
48
48
|
});
|
|
49
|
-
return paginateResponse(
|
|
49
|
+
return paginateResponse(page.data, params.page, params.limit, page.meta?.total);
|
|
50
50
|
}
|
|
51
|
-
const
|
|
52
|
-
debug(`listDocuments returned ${
|
|
53
|
-
sampleDocument:
|
|
54
|
-
missingNames:
|
|
51
|
+
const page = await fetchPage(ENDPOINTS.documents, { params: queryParams });
|
|
52
|
+
debug(`listDocuments returned ${page.data.length} documents`, {
|
|
53
|
+
sampleDocument: page.data[0],
|
|
54
|
+
missingNames: page.data.filter(d => !d.filename).length,
|
|
55
55
|
});
|
|
56
|
-
return paginateResponse(
|
|
56
|
+
return paginateResponse(page.data, params.page, params.limit, page.meta?.total);
|
|
57
57
|
}
|
|
58
58
|
/**
|
|
59
59
|
* Get a specific document by ID
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/api/documents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"documents.js","sourceRoot":"","sources":["../../src/api/documents.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,KAAK,EAAE,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,aAAa,CAAC;AACvE,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AAEnG,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,uBAAuB,EAAE,MAAM,aAAa,CAAC;AACzF,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAG7C;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,WAAW;IAC/B,OAAO,MAAM,CAAC,aAAa,EAAE,GAAG,EAAE,CAAC,SAAS,CAAS,SAAS,CAAC,OAAO,CAAC,EAAE,SAAS,CAAC,OAAO,CAAC,CAAC;AAC9F,CAAC;AAED;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,SAAS,CAAC,EAAU;IACxC,UAAU,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC;IAEzB,OAAO,QAAQ,CAAS,cAAc,CAAC,SAAS,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC,CAAC;AACjE,CAAC;AAED;;GAE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H,MAAM,CAAC,KAAK,UAAU,wBAAwB,CAC5C,UAAkB,EAClB,SAAiB;IAEjB,OAAO,gBAAgB,CAAC,UAAU,EAAE,SAAS,CAAC,CAAC;AACjD,CAAC"}
|
package/dist/api/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ export { listEmployees, getEmployee, searchEmployees, createEmployee, updateEmpl
|
|
|
10
10
|
export { listTeams, getTeam, createTeam, updateTeam, deleteTeam } from './teams.js';
|
|
11
11
|
export { listLocations, getLocation, createLocation, updateLocation, deleteLocation, } from './locations.js';
|
|
12
12
|
export { listContracts, getLatestContract, getEmployeeWithContract, listEmployeesByJobRole, listEmployeesByJobLevel, type EmployeeWithContract, } from './contracts.js';
|
|
13
|
-
export { listLeaves, getLeave, listLeaveTypes, getLeaveType, listAllowances, createLeave, updateLeave, cancelLeave, approveLeave, rejectLeave, } from './time-off.js';
|
|
14
|
-
export { listShifts, listShiftsInRange, getShift, createShift, updateShift, deleteShift, listOpenShifts, listEstimatedTimes, listWorkedTimes, clockIn, clockOut, formatLocalIso, localToday, } from './attendance.js';
|
|
13
|
+
export { listLeaves, listLeavesInRange, getLeave, listLeaveTypes, getLeaveType, listAllowances, createLeave, updateLeave, cancelLeave, approveLeave, rejectLeave, } from './time-off.js';
|
|
14
|
+
export { listShifts, listShiftsInRange, getShift, createShift, updateShift, deleteShift, listOpenShifts, listEstimatedTimes, listWorkedTimes, clockIn, clockOut, formatLocalIso, localToday, listEditTimesheetRequests, createEditTimesheetRequest, } from './attendance.js';
|
|
15
15
|
export { listFolders, getFolder, listDocuments, getDocument, getDocumentDownloadUrls, downloadDocument, downloadEmployeePayslips, downloadEmployeeDocument, } from './documents.js';
|
|
16
16
|
export { listJobRoles, getJobRole, listJobLevels, getJobLevel } from './job-catalog.js';
|
|
17
17
|
export { listProjects, getProject, listProjectTasks, getProjectTask, listProjectWorkers, getProjectWorker, listTimeRecords, getTimeRecord, createProject, updateProject, deleteProject, createProjectTask, updateProjectTask, deleteProjectTask, assignProjectWorker, removeProjectWorker, createTimeRecord, updateTimeRecord, deleteTimeRecord, } from './projects.js';
|
package/dist/api/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAGpF,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,EACvB,KAAK,oBAAoB,GAC1B,MAAM,gBAAgB,CAAC;AAGxB,OAAO,EACL,UAAU,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,cAAc,EACd,UAAU,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAGH,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG1D,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,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M,eAAe,CAAC;AAGvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,oBAAoB,EACpB,kBAAkB,EAClB,uBAAuB,EACvB,qBAAqB,EACrB,cAAc,EACd,cAAc,EACd,cAAc,EACd,qBAAqB,EACrB,qBAAqB,EACrB,qBAAqB,EACrB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,eAAe,CAAC;AAGvB,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,eAAe,EACf,iBAAiB,GAClB,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EACL,eAAe,EACf,aAAa,EACb,cAAc,EACd,YAAY,EACZ,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,cAAc,EACd,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,eAAe,EACf,eAAe,EACf,eAAe,EACf,iBAAiB,EACjB,iBAAiB,EACjB,iBAAiB,EACjB,kBAAkB,GACnB,MAAM,UAAU,CAAC;AAGlB,OAAO,EACL,sBAAsB,EACtB,oBAAoB,EACpB,kBAAkB,EAClB,gBAAgB,EAChB,oBAAoB,EACpB,kBAAkB,GACnB,MAAM,cAAc,CAAC"}
|
package/dist/api/index.js
CHANGED
|
@@ -16,9 +16,9 @@ export { listLocations, getLocation, createLocation, updateLocation, deleteLocat
|
|
|
16
16
|
// Contracts
|
|
17
17
|
export { listContracts, getLatestContract, getEmployeeWithContract, listEmployeesByJobRole, listEmployeesByJobLevel, } from './contracts.js';
|
|
18
18
|
// Time Off
|
|
19
|
-
export { listLeaves, getLeave, listLeaveTypes, getLeaveType, listAllowances, createLeave, updateLeave, cancelLeave, approveLeave, rejectLeave, } from './time-off.js';
|
|
19
|
+
export { listLeaves, listLeavesInRange, getLeave, listLeaveTypes, getLeaveType, listAllowances, createLeave, updateLeave, cancelLeave, approveLeave, rejectLeave, } from './time-off.js';
|
|
20
20
|
// Attendance
|
|
21
|
-
export { listShifts, listShiftsInRange, getShift, createShift, updateShift, deleteShift, listOpenShifts, listEstimatedTimes, listWorkedTimes, clockIn, clockOut, formatLocalIso, localToday, } from './attendance.js';
|
|
21
|
+
export { listShifts, listShiftsInRange, getShift, createShift, updateShift, deleteShift, listOpenShifts, listEstimatedTimes, listWorkedTimes, clockIn, clockOut, formatLocalIso, localToday, listEditTimesheetRequests, createEditTimesheetRequest, } from './attendance.js';
|
|
22
22
|
// Documents
|
|
23
23
|
export { listFolders, getFolder, listDocuments, getDocument, getDocumentDownloadUrls, downloadDocument, downloadEmployeePayslips, downloadEmployeeDocument, } from './documents.js';
|
|
24
24
|
// Job Catalog
|
package/dist/api/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mBAAmB;AACnB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D,YAAY;AACZ,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,QAAQ;AACR,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpF,YAAY;AACZ,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,YAAY;AACZ,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,GAExB,MAAM,gBAAgB,CAAC;AAExB,WAAW;AACX,OAAO,EACL,UAAU,EACV,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,MAAM,eAAe,CAAC;AAEvB,aAAa;AACb,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,cAAc,EACd,UAAU,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,mBAAmB;AACnB,OAAO,EAAE,UAAU,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE1D,YAAY;AACZ,OAAO,EACL,aAAa,EACb,WAAW,EACX,eAAe,EACf,cAAc,EACd,cAAc,EACd,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AAExB,QAAQ;AACR,OAAO,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAEpF,YAAY;AACZ,OAAO,EACL,aAAa,EACb,WAAW,EACX,cAAc,EACd,cAAc,EACd,cAAc,GACf,MAAM,gBAAgB,CAAC;AAExB,YAAY;AACZ,OAAO,EACL,aAAa,EACb,iBAAiB,EACjB,uBAAuB,EACvB,sBAAsB,EACtB,uBAAuB,GAExB,MAAM,gBAAgB,CAAC;AAExB,WAAW;AACX,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,cAAc,EACd,YAAY,EACZ,cAAc,EACd,WAAW,EACX,WAAW,EACX,WAAW,EACX,YAAY,EACZ,WAAW,GACZ,MAAM,eAAe,CAAC;AAEvB,aAAa;AACb,OAAO,EACL,UAAU,EACV,iBAAiB,EACjB,QAAQ,EACR,WAAW,EACX,WAAW,EACX,WAAW,EACX,cAAc,EACd,kBAAkB,EAClB,eAAe,EACf,OAAO,EACP,QAAQ,EACR,cAAc,EACd,UAAU,EACV,yBAAyB,EACzB,0BAA0B,GAC3B,MAAM,iBAAiB,CAAC;AAEzB,YAAY;AACZ,OAAO,EACL,WAAW,EACX,SAAS,EACT,aAAa,EACb,WAAW,EACX,uBAAuB,EACvB,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d.ts
CHANGED
|
@@ -13,6 +13,12 @@ import type { ListLeavesOptions, ListAllowancesOptions } from '../types.js';
|
|
|
13
13
|
* validated at runtime.
|
|
14
14
|
*/
|
|
15
15
|
export declare function listLeaves(options?: ListLeavesOptions): Promise<PaginatedResponse<Leave>>;
|
|
16
|
+
/**
|
|
17
|
+
* Every leave of some employees overlapping a date window, across all pages.
|
|
18
|
+
* The planner reads leave cover with this so that an employee with more than
|
|
19
|
+
* a page of leave records in the window is never silently under-covered.
|
|
20
|
+
*/
|
|
21
|
+
export declare function listLeavesInRange(employeeIds: number[], from: string, to: string): Promise<Leave[]>;
|
|
16
22
|
/**
|
|
17
23
|
* Get a specific leave by ID
|
|
18
24
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-off.d.ts","sourceRoot":"","sources":["../../src/api/time-off.ts"],"names":[],"mappings":"AAAA;;GAEG;
|
|
1
|
+
{"version":3,"file":"time-off.d.ts","sourceRoot":"","sources":["../../src/api/time-off.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,OAAO,EAA2C,KAAK,iBAAiB,EAAE,MAAM,kBAAkB,CAAC;AACnG,OAAO,EAEL,KAAK,KAAK,EACV,KAAK,SAAS,EACd,KAAK,SAAS,EACd,KAAK,gBAAgB,EACrB,KAAK,gBAAgB,EACrB,KAAK,kBAAkB,EACxB,MAAM,eAAe,CAAC;AAKvB,OAAO,KAAK,EAAE,iBAAiB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAE5E;;;;;;;GAOG;AACH,wBAAsB,UAAU,CAC9B,OAAO,GAAE,iBAAsB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAmBnC;AAED;;;;GAIG;AACH,wBAAsB,iBAAiB,CACrC,WAAW,EAAE,MAAM,EAAE,EACrB,IAAI,EAAE,MAAM,EACZ,EAAE,EAAE,MAAM,GACT,OAAO,CAAC,KAAK,EAAE,CAAC,CAKlB;AAED;;GAEG;AACH,wBAAsB,QAAQ,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,KAAK,CAAC,CAKzD;AAED;;GAEG;AACH,wBAAsB,cAAc,IAAI,OAAO,CAAC,SAAS,EAAE,CAAC,CAM3D;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,SAAS,CAAC,CAIjE;AAED;;GAEG;AACH,wBAAsB,cAAc,CAClC,OAAO,CAAC,EAAE,qBAAqB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,SAAS,CAAC,CAAC,CAavC;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAKzE;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,KAAK,CAAC,CAOrF;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAM3D;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,CAUzF;AAED;;GAEG;AACH,wBAAsB,WAAW,CAAC,EAAE,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,kBAAkB,GAAG,OAAO,CAAC,KAAK,CAAC,CAUxF"}
|
package/dist/api/time-off.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Time Off API endpoints: Leaves, Leave Types, Allowances
|
|
3
3
|
*/
|
|
4
|
-
import { fetchList, fetchOne, postOne, patchOne, deleteOne, postAction } from '../http-client.js';
|
|
4
|
+
import { fetchList, fetchOne, fetchPage, postOne, patchOne, deleteOne, postAction, } from '../http-client.js';
|
|
5
5
|
import { cached, CACHE_TTL } from '../cache.js';
|
|
6
6
|
import { buildPaginationParams, paginateResponse } from '../pagination.js';
|
|
7
7
|
import { LeaveSchema, } from '../schemas.js';
|
|
@@ -19,7 +19,7 @@ import { ENDPOINTS, endpointWithId, endpointWithAction } from '../endpoints.js';
|
|
|
19
19
|
*/
|
|
20
20
|
export async function listLeaves(options = {}) {
|
|
21
21
|
const params = buildPaginationParams(options);
|
|
22
|
-
const
|
|
22
|
+
const page = await fetchPage(ENDPOINTS.leaves, {
|
|
23
23
|
params: {
|
|
24
24
|
employee_ids: options.employee_ids,
|
|
25
25
|
from: options.from,
|
|
@@ -28,7 +28,18 @@ export async function listLeaves(options = {}) {
|
|
|
28
28
|
limit: params.limit,
|
|
29
29
|
},
|
|
30
30
|
});
|
|
31
|
-
return paginateResponse(parseArray('Leave', LeaveSchema,
|
|
31
|
+
return paginateResponse(parseArray('Leave', LeaveSchema, page.data), params.page, params.limit, page.meta?.total);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Every leave of some employees overlapping a date window, across all pages.
|
|
35
|
+
* The planner reads leave cover with this so that an employee with more than
|
|
36
|
+
* a page of leave records in the window is never silently under-covered.
|
|
37
|
+
*/
|
|
38
|
+
export async function listLeavesInRange(employeeIds, from, to) {
|
|
39
|
+
const leaves = await fetchList(ENDPOINTS.leaves, {
|
|
40
|
+
params: { employee_ids: employeeIds, from, to },
|
|
41
|
+
});
|
|
42
|
+
return parseArray('Leave', LeaveSchema, leaves);
|
|
32
43
|
}
|
|
33
44
|
/**
|
|
34
45
|
* Get a specific leave by ID
|
|
@@ -62,8 +73,8 @@ export async function listAllowances(options) {
|
|
|
62
73
|
};
|
|
63
74
|
if (options?.employee_id)
|
|
64
75
|
queryParams.employee_id = options.employee_id;
|
|
65
|
-
const
|
|
66
|
-
return paginateResponse(
|
|
76
|
+
const page = await fetchPage(ENDPOINTS.allowances, { params: queryParams });
|
|
77
|
+
return paginateResponse(page.data, params.page, params.limit, page.meta?.total);
|
|
67
78
|
}
|
|
68
79
|
/**
|
|
69
80
|
* Create a new leave request
|
package/dist/api/time-off.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"time-off.js","sourceRoot":"","sources":["../../src/api/time-off.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"time-off.js","sourceRoot":"","sources":["../../src/api/time-off.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EACL,SAAS,EACT,QAAQ,EACR,SAAS,EACT,OAAO,EACP,QAAQ,EACR,SAAS,EACT,UAAU,GACX,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAChD,OAAO,EAAE,qBAAqB,EAAE,gBAAgB,EAA0B,MAAM,kBAAkB,CAAC;AACnG,OAAO,EACL,WAAW,GAOZ,MAAM,eAAe,CAAC;AACvB,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,EAAE,WAAW,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,iBAAiB,CAAC;AAGhF;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,UAAU,CAC9B,UAA6B,EAAE;IAE/B,MAAM,MAAM,GAAG,qBAAqB,CAAC,OAAO,CAAC,CAAC;IAE9C,MAAM,IAAI,GAAG,MAAM,SAAS,CAAU,SAAS,CAAC,MAAM,EAAE;QACtD,MAAM,EAAE;YACN,YAAY,EAAE,OAAO,CAAC,YAAY;YAClC,IAAI,EAAE,OAAO,CAAC,IAAI;YAClB,EAAE,EAAE,OAAO,CAAC,EAAE;YACd,IAAI,EAAE,MAAM,CAAC,IAAI;YACjB,KAAK,EAAE,MAAM,CAAC,KAAK;SACpB;KACF,CAAC,CAAC;IAEH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