@markwharton/eh-payroll 2.7.0 → 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 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
@@ -420,11 +436,11 @@ export declare const AU_EMPLOYEE_FIELDS: {
420
436
  readonly jobTitle: true;
421
437
  readonly employmentAgreement: false;
422
438
  readonly employmentAgreementId: false;
423
- readonly paySchedule: false;
439
+ readonly paySchedule: true;
424
440
  readonly payRateTemplate: false;
425
- readonly rate: false;
426
- readonly rateUnit: false;
427
- readonly hoursPerWeek: false;
441
+ readonly rate: true;
442
+ readonly rateUnit: true;
443
+ readonly hoursPerWeek: true;
428
444
  readonly hoursPerDay: false;
429
445
  readonly primaryPayCategory: false;
430
446
  readonly payConditionRuleSet: false;
@@ -432,7 +448,7 @@ export declare const AU_EMPLOYEE_FIELDS: {
432
448
  readonly automaticallyPayEmployee: false;
433
449
  readonly primaryLocation: true;
434
450
  readonly locations: false;
435
- readonly tags: false;
451
+ readonly tags: true;
436
452
  readonly workTypes: false;
437
453
  readonly reportingDimensionValues: false;
438
454
  readonly leaveAccrualStartDateType: false;
package/dist/types.js CHANGED
@@ -50,10 +50,10 @@ export const AU_EMPLOYEE_FIELDS = {
50
50
  // Employment
51
51
  employmentType: true, jobTitle: true, employmentAgreement: false, employmentAgreementId: false,
52
52
  // Pay
53
- paySchedule: false, payRateTemplate: false, rate: false, rateUnit: false, hoursPerWeek: false, hoursPerDay: false,
53
+ paySchedule: true, payRateTemplate: false, rate: true, rateUnit: true, hoursPerWeek: true, hoursPerDay: false,
54
54
  primaryPayCategory: false, payConditionRuleSet: false, overrideTemplateRate: false, automaticallyPayEmployee: false,
55
55
  // Location/org
56
- primaryLocation: true, locations: false, tags: false, workTypes: false, reportingDimensionValues: false,
56
+ primaryLocation: true, locations: false, tags: true, workTypes: false, reportingDimensionValues: false,
57
57
  // Leave
58
58
  leaveAccrualStartDateType: false, leaveTemplate: false, leaveYearStart: false,
59
59
  // Flags
@@ -138,5 +138,6 @@ export const METHOD_TIERS = {
138
138
  getLeaveRequests: 'restricted',
139
139
  getEmployeeLeaveRequests: 'restricted',
140
140
  getEmployee: 'restricted',
141
+ getEmployeeImage: 'restricted',
141
142
  getStandardHours: 'restricted',
142
143
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markwharton/eh-payroll",
3
- "version": "2.7.0",
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.0"
19
+ "@markwharton/api-core": "^1.6.1"
20
20
  },
21
21
  "devDependencies": {
22
22
  "@types/node": "^20.10.0",