@markwharton/eh-payroll 2.7.2 → 3.0.1
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/dist/client.d.ts +3 -3
- package/dist/client.js +4 -4
- package/dist/employee-types.generated.d.ts +1 -1
- package/dist/index.d.ts +2 -3
- package/dist/index.js +1 -1
- package/dist/types.d.ts +3 -7
- package/dist/types.js +3 -3
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* @see https://api.keypay.com.au/
|
|
8
8
|
*/
|
|
9
9
|
import type { EHConfig, EHLeaveRequest, EHLeaveRequestOptions, EHEmployeeLeaveRequestOptions, EHEmployeeOptions, EHStandardHours, EHLocation, EHEmployeeGroup, EHRosterShift, EHRosterShiftOptions, EHKiosk, EHKioskEmployee, EHKioskStaffOptions, EHEmployeeImage } from './types.js';
|
|
10
|
-
import type {
|
|
10
|
+
import type { EHEmployee } from './employee-types.generated.js';
|
|
11
11
|
import type { Result } from '@markwharton/api-core';
|
|
12
12
|
/**
|
|
13
13
|
* Employment Hero Payroll API Client
|
|
@@ -112,11 +112,11 @@ export declare class EHClient {
|
|
|
112
112
|
/**
|
|
113
113
|
* Get all employees
|
|
114
114
|
*/
|
|
115
|
-
getEmployees(options?: EHEmployeeOptions): Promise<Result<
|
|
115
|
+
getEmployees(options?: EHEmployeeOptions): Promise<Result<EHEmployee[]>>;
|
|
116
116
|
/**
|
|
117
117
|
* Get a single employee by ID
|
|
118
118
|
*/
|
|
119
|
-
getEmployee(employeeId: number): Promise<Result<
|
|
119
|
+
getEmployee(employeeId: number): Promise<Result<EHEmployee>>;
|
|
120
120
|
/**
|
|
121
121
|
* Get employee profile image
|
|
122
122
|
*
|
package/dist/client.js
CHANGED
|
@@ -321,8 +321,8 @@ export class EHClient {
|
|
|
321
321
|
params.set('$top', String(DEFAULT_PAGE_SIZE));
|
|
322
322
|
return this.fetchPaginated((skip) => {
|
|
323
323
|
params.set('$skip', String(skip));
|
|
324
|
-
return this.businessUrl(ENTITIES.
|
|
325
|
-
}, ENTITIES.
|
|
324
|
+
return this.businessUrl(ENTITIES.EHEmployee.path, params);
|
|
325
|
+
}, ENTITIES.EHEmployee.fields);
|
|
326
326
|
}, this.restrictedPersistOpt);
|
|
327
327
|
}
|
|
328
328
|
/**
|
|
@@ -330,9 +330,9 @@ export class EHClient {
|
|
|
330
330
|
*/
|
|
331
331
|
async getEmployee(employeeId) {
|
|
332
332
|
return this.cached(`employee:${employeeId}`, this.cacheTtl.employeesTtl, async () => {
|
|
333
|
-
const url = this.businessUrl(`${ENTITIES.
|
|
333
|
+
const url = this.businessUrl(`${ENTITIES.EHEmployee.path}/${employeeId}`);
|
|
334
334
|
return this.fetchAndParse(url, async (r) => {
|
|
335
|
-
return pickFields(await r.json(), ENTITIES.
|
|
335
|
+
return pickFields(await r.json(), ENTITIES.EHEmployee.fields);
|
|
336
336
|
});
|
|
337
337
|
}, this.restrictedPersistOpt);
|
|
338
338
|
}
|
|
@@ -79,7 +79,7 @@ export interface EHEmployeeCommon {
|
|
|
79
79
|
workTypes: string | null;
|
|
80
80
|
}
|
|
81
81
|
/** AU region employee (70 region-specific fields) */
|
|
82
|
-
export interface
|
|
82
|
+
export interface EHEmployee extends EHEmployeeCommon {
|
|
83
83
|
australianResident: boolean;
|
|
84
84
|
automaticallyApplyPublicHolidayNotWorkedEarningsLines: boolean;
|
|
85
85
|
awardId: number | null;
|
package/dist/index.d.ts
CHANGED
|
@@ -20,11 +20,10 @@
|
|
|
20
20
|
* ```
|
|
21
21
|
*/
|
|
22
22
|
export { EHClient } from './client.js';
|
|
23
|
-
export type { EHConfig, EHCacheConfig, EHRetryConfig, EHLeaveRequest,
|
|
24
|
-
export {
|
|
23
|
+
export type { EHConfig, EHCacheConfig, EHRetryConfig, EHLeaveRequest, EHLeaveRequestOptions, EHEmployeeLeaveRequestOptions, EHLeaveRequestStatus, EHEmployee, EHEmployeeOptions, EHStandardHours, EHLocation, EHEmployeeGroup, EHRosterShift, EHRosterShiftOptions, EHAttendanceStatus, EHKiosk, EHKioskEmployee, EHKioskStaffOptions, EHEmployeeImage, } from './types.js';
|
|
24
|
+
export { 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
|
-
export type { EHAuEmployee } from './employee-types.generated.js';
|
|
28
27
|
export { buildBasicAuthHeader } from './utils.js';
|
|
29
28
|
export { ok, err, getErrorMessage, pickFields, normalizeEnum, RateLimiter, TTLCache, MemoryCacheStore, LayeredCache } from '@markwharton/api-core';
|
|
30
29
|
export type { Result, RetryConfig, OnRequestCallback, ClientConfig, Cache, CacheStore, CacheGetOptions } from '@markwharton/api-core';
|
package/dist/index.js
CHANGED
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
// Main client
|
|
23
23
|
export { EHClient } from './client.js';
|
|
24
24
|
// Field definitions (for pickFields)
|
|
25
|
-
export {
|
|
25
|
+
export { EMPLOYEE_FIELDS, LEAVE_REQUEST_FIELDS, LOCATION_FIELDS, EMPLOYEE_GROUP_FIELDS, ROSTER_SHIFT_FIELDS, KIOSK_FIELDS, KIOSK_EMPLOYEE_FIELDS, ENTITIES, } from './types.js';
|
|
26
26
|
export { METHOD_TIERS } from './types.js';
|
|
27
27
|
// Utilities
|
|
28
28
|
export { buildBasicAuthHeader } from './utils.js';
|
package/dist/types.d.ts
CHANGED
|
@@ -53,11 +53,10 @@ export interface EHConfig extends ClientConfig {
|
|
|
53
53
|
* Employee from unstructured endpoint
|
|
54
54
|
*
|
|
55
55
|
* Region-specific types are generated from Swagger specs.
|
|
56
|
-
* EHEmployee is an alias for EHAuEmployee for backward compatibility.
|
|
57
56
|
*
|
|
58
57
|
* @see employee-types.generated.ts
|
|
59
58
|
*/
|
|
60
|
-
export type {
|
|
59
|
+
export type { EHEmployee } from './employee-types.generated.js';
|
|
61
60
|
/**
|
|
62
61
|
* Standard hours for an employee
|
|
63
62
|
*
|
|
@@ -216,9 +215,6 @@ export interface EHEmployeeImage {
|
|
|
216
215
|
/** Content type from response header (e.g., 'image/png') */
|
|
217
216
|
contentType: string;
|
|
218
217
|
}
|
|
219
|
-
/** Employee-scoped leave request (same shape, different API operation). */
|
|
220
|
-
export interface EHEmployeeLeaveRequest extends EHLeaveRequest {
|
|
221
|
-
}
|
|
222
218
|
/** Leave request status values */
|
|
223
219
|
export type EHLeaveRequestStatus = 'Approved' | 'Pending' | 'Rejected' | 'Cancelled';
|
|
224
220
|
/**
|
|
@@ -421,8 +417,8 @@ export declare const ROSTER_SHIFT_FIELDS: {
|
|
|
421
417
|
readonly published: true;
|
|
422
418
|
readonly accepted: true;
|
|
423
419
|
};
|
|
424
|
-
/** Fields for
|
|
425
|
-
export declare const
|
|
420
|
+
/** Fields for EHEmployee — set false to exclude from API responses */
|
|
421
|
+
export declare const EMPLOYEE_FIELDS: {
|
|
426
422
|
readonly id: true;
|
|
427
423
|
readonly externalId: true;
|
|
428
424
|
readonly firstName: true;
|
package/dist/types.js
CHANGED
|
@@ -41,8 +41,8 @@ export const ROSTER_SHIFT_FIELDS = {
|
|
|
41
41
|
workTypeId: true, workTypeName: true, startTime: true, endTime: true,
|
|
42
42
|
notes: true, published: true, accepted: true,
|
|
43
43
|
};
|
|
44
|
-
/** Fields for
|
|
45
|
-
export const
|
|
44
|
+
/** Fields for EHEmployee — set false to exclude from API responses */
|
|
45
|
+
export const EMPLOYEE_FIELDS = {
|
|
46
46
|
// Identity
|
|
47
47
|
id: true, externalId: true, firstName: true, surname: true, status: true,
|
|
48
48
|
// Dates
|
|
@@ -111,7 +111,7 @@ export const AU_EMPLOYEE_FIELDS = {
|
|
|
111
111
|
};
|
|
112
112
|
/** Entity registry — maps interface names to field specs and API path segments. */
|
|
113
113
|
export const ENTITIES = {
|
|
114
|
-
|
|
114
|
+
EHEmployee: { fields: EMPLOYEE_FIELDS, path: 'employee/unstructured', apiRef: 'employee/au-employee--get-employees', apiRefById: 'employee/au-employee--get-employee-by-id' },
|
|
115
115
|
EHLeaveRequest: { fields: LEAVE_REQUEST_FIELDS, path: 'leaverequest', apiRef: 'leave-requests/au-business-hours-leave-request--list-leave-requests' },
|
|
116
116
|
EHEmployeeLeaveRequest: { fields: LEAVE_REQUEST_FIELDS, path: 'employee/{employeeId}/leaverequest', apiRef: 'leave-requests/au-hours-leave-request--get-leave-requests' },
|
|
117
117
|
EHLocation: { fields: LOCATION_FIELDS, path: 'location', apiRef: 'location/au-location--get-locations' },
|