@markwharton/eh-payroll 2.7.1 → 2.7.2
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 +3 -0
- package/dist/client.d.ts +9 -1
- package/dist/client.js +22 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.js +1 -1
- package/dist/types.d.ts +16 -0
- package/dist/types.js +1 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -84,6 +84,7 @@ All methods return `Result<T>` — see [api-core Result Pattern](../../README.md
|
|
|
84
84
|
| `validateApiKey()` | — | `Result<void>` |
|
|
85
85
|
| `getEmployees(options?)` | `EHEmployeeOptions?` | `Result<EHAuEmployee[]>` |
|
|
86
86
|
| `getEmployee(employeeId)` | `number` | `Result<EHAuEmployee>` |
|
|
87
|
+
| `getEmployeeImage(employeeId)` | `number` | `Result<EHEmployeeImage>` |
|
|
87
88
|
| `getStandardHours(employeeId)` | `number` | `Result<EHStandardHours>` |
|
|
88
89
|
| `getLocations()` | — | `Result<EHLocation[]>` |
|
|
89
90
|
| `getEmployeeGroups()` | — | `Result<EHEmployeeGroup[]>` |
|
|
@@ -115,6 +116,8 @@ Returns leave requests with all filters applied server-side. The business-level
|
|
|
115
116
|
| `employeeId` | `number` | Filter by employee ID |
|
|
116
117
|
| `leaveCategoryId` | `number` | Filter by leave category ID |
|
|
117
118
|
| `locationId` | `number` | Filter by location ID |
|
|
119
|
+
| `groupBy` | `'Employee' \| 'LeaveType'` | Group results by employee or leave type |
|
|
120
|
+
| `restrictOverlappingLeave` | `boolean` | Restrict results to leave overlapping the date range |
|
|
118
121
|
|
|
119
122
|
### `getEmployeeLeaveRequests()`
|
|
120
123
|
|
package/dist/client.d.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*
|
|
7
7
|
* @see https://api.keypay.com.au/
|
|
8
8
|
*/
|
|
9
|
-
import type { EHConfig, EHLeaveRequest, EHLeaveRequestOptions, EHEmployeeLeaveRequestOptions, EHEmployeeOptions, EHStandardHours, EHLocation, EHEmployeeGroup, EHRosterShift, EHRosterShiftOptions, EHKiosk, EHKioskEmployee, EHKioskStaffOptions } from './types.js';
|
|
9
|
+
import type { EHConfig, EHLeaveRequest, EHLeaveRequestOptions, EHEmployeeLeaveRequestOptions, EHEmployeeOptions, EHStandardHours, EHLocation, EHEmployeeGroup, EHRosterShift, EHRosterShiftOptions, EHKiosk, EHKioskEmployee, EHKioskStaffOptions, EHEmployeeImage } from './types.js';
|
|
10
10
|
import type { EHAuEmployee } from './employee-types.generated.js';
|
|
11
11
|
import type { Result } from '@markwharton/api-core';
|
|
12
12
|
/**
|
|
@@ -117,6 +117,14 @@ export declare class EHClient {
|
|
|
117
117
|
* Get a single employee by ID
|
|
118
118
|
*/
|
|
119
119
|
getEmployee(employeeId: number): Promise<Result<EHAuEmployee>>;
|
|
120
|
+
/**
|
|
121
|
+
* Get employee profile image
|
|
122
|
+
*
|
|
123
|
+
* Returns binary image data. Not cached (large binary blobs).
|
|
124
|
+
*
|
|
125
|
+
* @see https://api.keypay.com.au/australia/reference/employee/au-employee--get-employee-profile-image.html
|
|
126
|
+
*/
|
|
127
|
+
getEmployeeImage(employeeId: number): Promise<Result<EHEmployeeImage>>;
|
|
120
128
|
/**
|
|
121
129
|
* Get standard hours for an employee (includes FTE value)
|
|
122
130
|
*/
|
package/dist/client.js
CHANGED
|
@@ -235,6 +235,10 @@ export class EHClient {
|
|
|
235
235
|
parts.push(`lcid:${options.leaveCategoryId}`);
|
|
236
236
|
if (options?.locationId != null)
|
|
237
237
|
parts.push(`lid:${options.locationId}`);
|
|
238
|
+
if (options?.groupBy)
|
|
239
|
+
parts.push(`gb:${options.groupBy}`);
|
|
240
|
+
if (options?.restrictOverlappingLeave)
|
|
241
|
+
parts.push('rol');
|
|
238
242
|
const cacheKey = parts.join(':');
|
|
239
243
|
return this.cached(cacheKey, this.cacheTtl.leaveRequestsTtl, async () => {
|
|
240
244
|
const params = new URLSearchParams();
|
|
@@ -250,6 +254,10 @@ export class EHClient {
|
|
|
250
254
|
params.set('LeaveCategoryId', String(options.leaveCategoryId));
|
|
251
255
|
if (options?.locationId != null)
|
|
252
256
|
params.set('LocationId', String(options.locationId));
|
|
257
|
+
if (options?.groupBy)
|
|
258
|
+
params.set('GroupBy', options.groupBy);
|
|
259
|
+
if (options?.restrictOverlappingLeave)
|
|
260
|
+
params.set('RestrictOverlappingLeave', 'true');
|
|
253
261
|
const url = this.businessUrl(ENTITIES.EHLeaveRequest.path, params);
|
|
254
262
|
return this.fetchAndParse(url, async (r) => {
|
|
255
263
|
return (await r.json())
|
|
@@ -328,6 +336,20 @@ export class EHClient {
|
|
|
328
336
|
});
|
|
329
337
|
}, this.restrictedPersistOpt);
|
|
330
338
|
}
|
|
339
|
+
/**
|
|
340
|
+
* Get employee profile image
|
|
341
|
+
*
|
|
342
|
+
* Returns binary image data. Not cached (large binary blobs).
|
|
343
|
+
*
|
|
344
|
+
* @see https://api.keypay.com.au/australia/reference/employee/au-employee--get-employee-profile-image.html
|
|
345
|
+
*/
|
|
346
|
+
async getEmployeeImage(employeeId) {
|
|
347
|
+
const url = this.businessUrl(`employee/${employeeId}/image`);
|
|
348
|
+
return this.fetchAndParse(url, async (r) => ({
|
|
349
|
+
data: await r.arrayBuffer(),
|
|
350
|
+
contentType: r.headers.get('content-type') || 'application/octet-stream',
|
|
351
|
+
}));
|
|
352
|
+
}
|
|
331
353
|
// ============================================================================
|
|
332
354
|
// Standard Hours
|
|
333
355
|
// ============================================================================
|
package/dist/index.d.ts
CHANGED
|
@@ -20,13 +20,13 @@
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export { EHClient } from './client.js';
|
|
23
|
-
export type { EHConfig, EHCacheConfig, EHRetryConfig, EHLeaveRequest, EHEmployeeLeaveRequest, EHLeaveRequestOptions, EHEmployeeLeaveRequestOptions, EHLeaveRequestStatus, EHEmployee, EHEmployeeOptions, EHStandardHours, EHLocation, EHEmployeeGroup, EHRosterShift, EHRosterShiftOptions, EHAttendanceStatus, EHKiosk, EHKioskEmployee, EHKioskStaffOptions, } from './types.js';
|
|
23
|
+
export type { EHConfig, EHCacheConfig, EHRetryConfig, EHLeaveRequest, EHEmployeeLeaveRequest, EHLeaveRequestOptions, EHEmployeeLeaveRequestOptions, EHLeaveRequestStatus, EHEmployee, EHEmployeeOptions, EHStandardHours, EHLocation, EHEmployeeGroup, EHRosterShift, EHRosterShiftOptions, EHAttendanceStatus, EHKiosk, EHKioskEmployee, EHKioskStaffOptions, EHEmployeeImage, } from './types.js';
|
|
24
24
|
export { AU_EMPLOYEE_FIELDS, LEAVE_REQUEST_FIELDS, LOCATION_FIELDS, EMPLOYEE_GROUP_FIELDS, ROSTER_SHIFT_FIELDS, KIOSK_FIELDS, KIOSK_EMPLOYEE_FIELDS, ENTITIES, } from './types.js';
|
|
25
25
|
export type { AccessTier } from './types.js';
|
|
26
26
|
export { METHOD_TIERS } from './types.js';
|
|
27
27
|
export type { EHAuEmployee } from './employee-types.generated.js';
|
|
28
28
|
export { buildBasicAuthHeader } from './utils.js';
|
|
29
|
-
export { ok, err, getErrorMessage, pickFields, RateLimiter, TTLCache, MemoryCacheStore, LayeredCache } from '@markwharton/api-core';
|
|
29
|
+
export { ok, err, getErrorMessage, pickFields, normalizeEnum, RateLimiter, TTLCache, MemoryCacheStore, LayeredCache } from '@markwharton/api-core';
|
|
30
30
|
export type { Result, RetryConfig, OnRequestCallback, ClientConfig, Cache, CacheStore, CacheGetOptions } from '@markwharton/api-core';
|
|
31
31
|
export { EH_API_BASE, EH_REGION_URLS } from './constants.js';
|
|
32
32
|
export type { EHRegion } from './constants.js';
|
package/dist/index.js
CHANGED
|
@@ -27,7 +27,7 @@ export { METHOD_TIERS } from './types.js';
|
|
|
27
27
|
// Utilities
|
|
28
28
|
export { buildBasicAuthHeader } from './utils.js';
|
|
29
29
|
// Re-exported from @markwharton/api-core
|
|
30
|
-
export { ok, err, getErrorMessage, pickFields, RateLimiter, TTLCache, MemoryCacheStore, LayeredCache } from '@markwharton/api-core';
|
|
30
|
+
export { ok, err, getErrorMessage, pickFields, normalizeEnum, RateLimiter, TTLCache, MemoryCacheStore, LayeredCache } from '@markwharton/api-core';
|
|
31
31
|
// Constants
|
|
32
32
|
export { EH_API_BASE, EH_REGION_URLS } from './constants.js';
|
|
33
33
|
// Errors
|
package/dist/types.d.ts
CHANGED
|
@@ -204,6 +204,18 @@ export interface EHLeaveRequest {
|
|
|
204
204
|
/** Status: Approved, Pending, Rejected, Cancelled */
|
|
205
205
|
status: string;
|
|
206
206
|
}
|
|
207
|
+
/**
|
|
208
|
+
* Employee profile image
|
|
209
|
+
*
|
|
210
|
+
* From GET /business/{id}/employee/{eid}/image
|
|
211
|
+
* Returns binary data with content type.
|
|
212
|
+
*/
|
|
213
|
+
export interface EHEmployeeImage {
|
|
214
|
+
/** Image data as ArrayBuffer */
|
|
215
|
+
data: ArrayBuffer;
|
|
216
|
+
/** Content type from response header (e.g., 'image/png') */
|
|
217
|
+
contentType: string;
|
|
218
|
+
}
|
|
207
219
|
/** Employee-scoped leave request (same shape, different API operation). */
|
|
208
220
|
export interface EHEmployeeLeaveRequest extends EHLeaveRequest {
|
|
209
221
|
}
|
|
@@ -227,6 +239,10 @@ export interface EHLeaveRequestOptions {
|
|
|
227
239
|
leaveCategoryId?: number;
|
|
228
240
|
/** Filter by location ID (→ API LocationId) */
|
|
229
241
|
locationId?: number;
|
|
242
|
+
/** Group results by 'Employee' or 'LeaveType' (→ API GroupBy) */
|
|
243
|
+
groupBy?: 'Employee' | 'LeaveType';
|
|
244
|
+
/** Restrict results to leave overlapping the date range (→ API RestrictOverlappingLeave) */
|
|
245
|
+
restrictOverlappingLeave?: boolean;
|
|
230
246
|
}
|
|
231
247
|
/**
|
|
232
248
|
* Options for getEmployeeLeaveRequests
|
package/dist/types.js
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markwharton/eh-payroll",
|
|
3
|
-
"version": "2.7.
|
|
3
|
+
"version": "2.7.2",
|
|
4
4
|
"description": "Employment Hero Payroll API client",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"clean": "rm -rf dist"
|
|
17
17
|
},
|
|
18
18
|
"dependencies": {
|
|
19
|
-
"@markwharton/api-core": "^1.6.
|
|
19
|
+
"@markwharton/api-core": "^1.6.1"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^20.10.0",
|