rotacloud 1.0.48 → 1.0.51
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/cjs/interfaces/index.d.ts +4 -0
- package/dist/cjs/interfaces/index.js +4 -0
- package/dist/cjs/interfaces/logbook-category.interface.d.ts +1 -0
- package/dist/cjs/interfaces/pin.interface.d.ts +3 -0
- package/dist/cjs/interfaces/pin.interface.js +2 -0
- package/dist/cjs/interfaces/terminal.interface.d.ts +20 -0
- package/dist/cjs/interfaces/terminal.interface.js +2 -0
- package/dist/cjs/interfaces/user.interface.d.ts +8 -1
- package/dist/cjs/interfaces/users-clocked-in.interface.d.ts +13 -0
- package/dist/cjs/interfaces/users-clocked-in.interface.js +2 -0
- package/dist/cjs/interfaces/users-clocked-out.interface.d.ts +26 -0
- package/dist/cjs/interfaces/users-clocked-out.interface.js +2 -0
- package/dist/cjs/models/attendance.model.d.ts +5 -5
- package/dist/cjs/models/availability-pattern.model.js +12 -0
- package/dist/cjs/models/daily-revenue.model.js +3 -0
- package/dist/cjs/models/index.d.ts +2 -0
- package/dist/cjs/models/index.js +2 -0
- package/dist/cjs/models/logbook-category.model.d.ts +1 -1
- package/dist/cjs/models/logbook-category.model.js +2 -0
- package/dist/cjs/models/terminal.model.d.ts +7 -6
- package/dist/cjs/models/terminal.model.js +14 -0
- package/dist/cjs/models/users-clocked-in.model.d.ts +14 -0
- package/dist/cjs/models/users-clocked-in.model.js +19 -0
- package/dist/cjs/models/users-clocked-out.model.d.ts +27 -0
- package/dist/cjs/models/users-clocked-out.model.js +31 -0
- package/dist/cjs/rotacloud.d.ts +7 -4
- package/dist/cjs/rotacloud.js +7 -4
- package/dist/cjs/services/index.d.ts +6 -1
- package/dist/cjs/services/index.js +6 -1
- package/dist/cjs/services/pins.service.d.ts +11 -0
- package/dist/cjs/services/pins.service.js +16 -0
- package/dist/cjs/services/terminals-active.service.d.ts +35 -0
- package/dist/cjs/services/terminals-active.service.js +103 -0
- package/dist/cjs/services/terminals.service.d.ts +32 -0
- package/dist/cjs/services/terminals.service.js +108 -0
- package/dist/cjs/services/users-clock-in.service.d.ts +62 -0
- package/dist/cjs/services/users-clock-in.service.js +118 -0
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/index.d.ts +4 -0
- package/dist/mjs/interfaces/index.js +4 -0
- package/dist/mjs/interfaces/logbook-category.interface.d.ts +1 -0
- package/dist/mjs/interfaces/pin.interface.d.ts +3 -0
- package/dist/mjs/interfaces/pin.interface.js +1 -0
- package/dist/mjs/interfaces/terminal.interface.d.ts +20 -0
- package/dist/mjs/interfaces/terminal.interface.js +1 -0
- package/dist/mjs/interfaces/user.interface.d.ts +8 -1
- package/dist/mjs/interfaces/users-clocked-in.interface.d.ts +13 -0
- package/dist/mjs/interfaces/users-clocked-in.interface.js +1 -0
- package/dist/mjs/interfaces/users-clocked-out.interface.d.ts +26 -0
- package/dist/mjs/interfaces/users-clocked-out.interface.js +1 -0
- package/dist/mjs/models/attendance.model.d.ts +5 -5
- package/dist/mjs/models/availability-pattern.model.js +12 -0
- package/dist/mjs/models/daily-revenue.model.js +3 -0
- package/dist/mjs/models/index.d.ts +2 -0
- package/dist/mjs/models/index.js +2 -0
- package/dist/mjs/models/logbook-category.model.d.ts +1 -1
- package/dist/mjs/models/logbook-category.model.js +1 -0
- package/dist/mjs/models/terminal.model.d.ts +7 -6
- package/dist/mjs/models/terminal.model.js +14 -0
- package/dist/mjs/models/users-clocked-in.model.d.ts +14 -0
- package/dist/mjs/models/users-clocked-in.model.js +14 -0
- package/dist/mjs/models/users-clocked-out.model.d.ts +27 -0
- package/dist/mjs/models/users-clocked-out.model.js +26 -0
- package/dist/mjs/rotacloud.d.ts +7 -4
- package/dist/mjs/rotacloud.js +7 -4
- package/dist/mjs/services/index.d.ts +6 -1
- package/dist/mjs/services/index.js +6 -1
- package/dist/mjs/services/pins.service.d.ts +11 -0
- package/dist/mjs/services/pins.service.js +12 -0
- package/dist/mjs/services/terminals-active.service.d.ts +35 -0
- package/dist/mjs/services/terminals-active.service.js +43 -0
- package/dist/mjs/services/terminals.service.d.ts +32 -0
- package/dist/mjs/services/terminals.service.js +48 -0
- package/dist/mjs/services/users-clock-in.service.d.ts +62 -0
- package/dist/mjs/services/users-clock-in.service.js +57 -0
- package/dist/mjs/version.js +1 -1
- package/package.json +2 -2
- package/src/interfaces/index.ts +4 -0
- package/src/interfaces/logbook-category.interface.ts +1 -0
- package/src/interfaces/pin.interface.ts +16 -0
- package/src/interfaces/terminal.interface.ts +21 -0
- package/src/interfaces/user.interface.ts +9 -1
- package/src/interfaces/users-clocked-in.interface.ts +14 -0
- package/src/interfaces/users-clocked-out.interface.ts +27 -0
- package/src/models/attendance.model.ts +5 -5
- package/src/models/availability-pattern.model.ts +12 -0
- package/src/models/daily-revenue.model.ts +3 -0
- package/src/models/days-off.model.ts +1 -0
- package/src/models/index.ts +2 -0
- package/src/models/logbook-category.model.ts +2 -1
- package/src/models/terminal.model.ts +21 -6
- package/src/models/toil-accrual.model.ts +1 -0
- package/src/models/toil-allowance.model.ts +1 -0
- package/src/models/users-clocked-in.model.ts +27 -0
- package/src/models/users-clocked-out.model.ts +52 -0
- package/src/rotacloud.ts +11 -3
- package/src/services/index.ts +6 -1
- package/src/services/pins.service.ts +16 -0
- package/src/services/terminals-active.service.ts +75 -0
- package/src/services/terminals.service.ts +78 -0
- package/src/services/users-clock-in.service.ts +125 -0
- package/src/version.ts +1 -1
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { ApiLocationCoordinate } from '../interfaces/index.js';
|
|
1
|
+
import { ApiLocationCoordinate, ApiTerminal } from '../interfaces/index.js';
|
|
2
2
|
export declare class Terminal {
|
|
3
3
|
id: number;
|
|
4
4
|
deleted: boolean;
|
|
5
5
|
name: string;
|
|
6
6
|
active: boolean;
|
|
7
|
-
|
|
8
|
-
device: string;
|
|
9
|
-
version: string;
|
|
10
|
-
ip: string;
|
|
11
|
-
location: ApiLocationCoordinate;
|
|
7
|
+
platform: string | null;
|
|
8
|
+
device: string | null;
|
|
9
|
+
version: string | null;
|
|
10
|
+
ip: string | null;
|
|
11
|
+
location: ApiLocationCoordinate | null;
|
|
12
12
|
timezone: number;
|
|
13
13
|
require_photo: boolean;
|
|
14
14
|
require_photo_breaks: boolean;
|
|
15
|
+
constructor(terminal: ApiTerminal);
|
|
15
16
|
}
|
|
@@ -1,2 +1,16 @@
|
|
|
1
1
|
export class Terminal {
|
|
2
|
+
constructor(terminal) {
|
|
3
|
+
this.id = terminal.id;
|
|
4
|
+
this.deleted = terminal.deleted;
|
|
5
|
+
this.name = terminal.name;
|
|
6
|
+
this.active = terminal.active;
|
|
7
|
+
this.platform = terminal.platform;
|
|
8
|
+
this.device = terminal.device;
|
|
9
|
+
this.version = terminal.version;
|
|
10
|
+
this.ip = terminal.ip;
|
|
11
|
+
this.location = terminal.location;
|
|
12
|
+
this.timezone = terminal.timezone;
|
|
13
|
+
this.require_photo = terminal.require_photo;
|
|
14
|
+
this.require_photo_breaks = terminal.require_photo_breaks;
|
|
15
|
+
}
|
|
2
16
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ApiUserClockedIn, ApiShift, ApiTerminalLocation } from '../interfaces/index.js';
|
|
2
|
+
export declare class UserClockedIn {
|
|
3
|
+
user: number;
|
|
4
|
+
location: unknown;
|
|
5
|
+
role: number;
|
|
6
|
+
in_time: number;
|
|
7
|
+
minutes_late: number;
|
|
8
|
+
shift: Pick<ApiShift, 'id' | 'start_time' | 'end_time' | 'minutes_break' | 'location' | 'role'>;
|
|
9
|
+
in_method: string;
|
|
10
|
+
in_location: ApiTerminalLocation;
|
|
11
|
+
in_device: string | null;
|
|
12
|
+
in_terminal: number | null;
|
|
13
|
+
constructor(apiUserClockedIn: ApiUserClockedIn);
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export class UserClockedIn {
|
|
2
|
+
constructor(apiUserClockedIn) {
|
|
3
|
+
this.user = apiUserClockedIn.user;
|
|
4
|
+
this.location = apiUserClockedIn.location;
|
|
5
|
+
this.role = apiUserClockedIn.role;
|
|
6
|
+
this.in_time = apiUserClockedIn.in_time;
|
|
7
|
+
this.minutes_late = apiUserClockedIn.minutes_late;
|
|
8
|
+
this.shift = apiUserClockedIn.shift;
|
|
9
|
+
this.in_method = apiUserClockedIn.in_method;
|
|
10
|
+
this.in_location = apiUserClockedIn.in_location;
|
|
11
|
+
this.in_device = apiUserClockedIn.in_device ?? null;
|
|
12
|
+
this.in_terminal = apiUserClockedIn.in_terminal ?? null;
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ApiShift, ApiTerminalLocation, ApiUserClockedOut } from '../interfaces/index.js';
|
|
2
|
+
export declare class UserClockedOut {
|
|
3
|
+
id: number;
|
|
4
|
+
deleted: boolean;
|
|
5
|
+
approved: boolean;
|
|
6
|
+
user: number;
|
|
7
|
+
location: unknown;
|
|
8
|
+
role: number;
|
|
9
|
+
in_time: number;
|
|
10
|
+
out_time: number;
|
|
11
|
+
minutes_break: number;
|
|
12
|
+
minutes_late: number;
|
|
13
|
+
hours: number;
|
|
14
|
+
hours_auto: number;
|
|
15
|
+
hours_is_auto: number;
|
|
16
|
+
notes: string | null;
|
|
17
|
+
shift: Pick<ApiShift, 'id' | 'start_time' | 'end_time' | 'minutes_break' | 'location' | 'role'>;
|
|
18
|
+
in_method: string;
|
|
19
|
+
in_location: ApiTerminalLocation;
|
|
20
|
+
in_device: string | null;
|
|
21
|
+
in_terminal: number | null;
|
|
22
|
+
out_method: string;
|
|
23
|
+
out_location: ApiTerminalLocation;
|
|
24
|
+
out_device: string | null;
|
|
25
|
+
out_terminal: number | null;
|
|
26
|
+
constructor(apiUserClockedOut: ApiUserClockedOut);
|
|
27
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
export class UserClockedOut {
|
|
2
|
+
constructor(apiUserClockedOut) {
|
|
3
|
+
this.id = apiUserClockedOut.id;
|
|
4
|
+
this.deleted = apiUserClockedOut.deleted;
|
|
5
|
+
this.approved = apiUserClockedOut.approved;
|
|
6
|
+
this.user = apiUserClockedOut.user;
|
|
7
|
+
this.location = apiUserClockedOut.location;
|
|
8
|
+
this.role = apiUserClockedOut.role;
|
|
9
|
+
this.in_time = apiUserClockedOut.in_time;
|
|
10
|
+
this.out_time = apiUserClockedOut.out_time;
|
|
11
|
+
this.minutes_break = apiUserClockedOut.minutes_break;
|
|
12
|
+
this.minutes_late = apiUserClockedOut.minutes_late;
|
|
13
|
+
this.hours = apiUserClockedOut.hours;
|
|
14
|
+
this.hours_auto = apiUserClockedOut.hours_auto;
|
|
15
|
+
this.notes = apiUserClockedOut.notes ?? null;
|
|
16
|
+
this.shift = apiUserClockedOut.shift;
|
|
17
|
+
this.in_method = apiUserClockedOut.in_method;
|
|
18
|
+
this.in_location = apiUserClockedOut.in_location;
|
|
19
|
+
this.in_device = apiUserClockedOut.in_device ?? null;
|
|
20
|
+
this.in_terminal = apiUserClockedOut.in_terminal ?? null;
|
|
21
|
+
this.out_method = apiUserClockedOut.out_method;
|
|
22
|
+
this.out_location = apiUserClockedOut.out_location;
|
|
23
|
+
this.out_device = apiUserClockedOut.out_device ?? null;
|
|
24
|
+
this.out_terminal = apiUserClockedOut.out_terminal ?? null;
|
|
25
|
+
}
|
|
26
|
+
}
|
package/dist/mjs/rotacloud.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, SettingsService, ShiftsService, ToilAccrualsService, ToilAllowanceService, UsersService } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DayNotesService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveTypesService, LeaveService, LocationsService, RolesService, SettingsService, ShiftsService, TerminalsService, TerminalsActiveService, ToilAccrualsService, ToilAllowanceService, UsersService, UsersClockInService } from './services/index.js';
|
|
2
2
|
import { SDKConfig } from './interfaces/index.js';
|
|
3
|
-
import {
|
|
4
|
-
import { LeaveTypesService } from './services/leave-types.service.js';
|
|
3
|
+
import { PinsService } from './services/pins.service.js';
|
|
5
4
|
export declare class RotaCloud {
|
|
6
5
|
static config: SDKConfig;
|
|
7
6
|
defaultAPIURI: string | undefined;
|
|
@@ -16,14 +15,18 @@ export declare class RotaCloud {
|
|
|
16
15
|
group: GroupsService;
|
|
17
16
|
leaveEmbargoes: LeaveEmbargoesService;
|
|
18
17
|
leaveRequests: LeaveRequestService;
|
|
19
|
-
leave: LeaveService;
|
|
20
18
|
leaveTypes: LeaveTypesService;
|
|
19
|
+
leave: LeaveService;
|
|
21
20
|
locations: LocationsService;
|
|
21
|
+
pins: PinsService;
|
|
22
22
|
roles: RolesService;
|
|
23
23
|
settings: SettingsService;
|
|
24
24
|
shifts: ShiftsService;
|
|
25
|
+
terminals: TerminalsService;
|
|
26
|
+
terminalsActive: TerminalsActiveService;
|
|
25
27
|
toilAccruals: ToilAccrualsService;
|
|
26
28
|
toilAllowance: ToilAllowanceService;
|
|
29
|
+
usersClockInService: UsersClockInService;
|
|
27
30
|
users: UsersService;
|
|
28
31
|
constructor(config: SDKConfig);
|
|
29
32
|
get config(): SDKConfig;
|
package/dist/mjs/rotacloud.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RetryStrategy, RolesService, SettingsService, ShiftsService, ToilAccrualsService, ToilAllowanceService, UsersService, } from './services/index.js';
|
|
2
|
-
import {
|
|
3
|
-
import { LeaveTypesService } from './services/leave-types.service.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DayNotesService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveTypesService, LeaveService, LocationsService, RetryStrategy, RolesService, SettingsService, ShiftsService, TerminalsService, TerminalsActiveService, ToilAccrualsService, ToilAllowanceService, UsersService, UsersClockInService, } from './services/index.js';
|
|
2
|
+
import { PinsService } from './services/pins.service.js';
|
|
4
3
|
const DEFAULT_CONFIG = {
|
|
5
4
|
baseUri: 'https://api.rotacloud.com/v1',
|
|
6
5
|
retry: RetryStrategy.Exponential,
|
|
@@ -19,14 +18,18 @@ export class RotaCloud {
|
|
|
19
18
|
this.group = new GroupsService();
|
|
20
19
|
this.leaveEmbargoes = new LeaveEmbargoesService();
|
|
21
20
|
this.leaveRequests = new LeaveRequestService();
|
|
22
|
-
this.leave = new LeaveService();
|
|
23
21
|
this.leaveTypes = new LeaveTypesService();
|
|
22
|
+
this.leave = new LeaveService();
|
|
24
23
|
this.locations = new LocationsService();
|
|
24
|
+
this.pins = new PinsService();
|
|
25
25
|
this.roles = new RolesService();
|
|
26
26
|
this.settings = new SettingsService();
|
|
27
27
|
this.shifts = new ShiftsService();
|
|
28
|
+
this.terminals = new TerminalsService();
|
|
29
|
+
this.terminalsActive = new TerminalsActiveService();
|
|
28
30
|
this.toilAccruals = new ToilAccrualsService();
|
|
29
31
|
this.toilAllowance = new ToilAllowanceService();
|
|
32
|
+
this.usersClockInService = new UsersClockInService();
|
|
30
33
|
this.users = new UsersService();
|
|
31
34
|
this.config = {
|
|
32
35
|
...DEFAULT_CONFIG,
|
|
@@ -5,15 +5,20 @@ export * from './auth.service.js';
|
|
|
5
5
|
export * from './availability.service.js';
|
|
6
6
|
export * from './daily-budgets.service.js';
|
|
7
7
|
export * from './daily-revenue.service.js';
|
|
8
|
+
export * from './day-notes.service.js';
|
|
8
9
|
export * from './days-off.service.js';
|
|
9
10
|
export * from './groups.service.js';
|
|
10
|
-
export * from './leave-request.service.js';
|
|
11
11
|
export * from './leave-embargoes.service.js';
|
|
12
|
+
export * from './leave-request.service.js';
|
|
13
|
+
export * from './leave-types.service.js';
|
|
12
14
|
export * from './leave.service.js';
|
|
13
15
|
export * from './locations.service.js';
|
|
14
16
|
export * from './roles.service.js';
|
|
15
17
|
export * from './settings.service.js';
|
|
16
18
|
export * from './shifts.service.js';
|
|
19
|
+
export * from './terminals.service.js';
|
|
20
|
+
export * from './terminals-active.service.js';
|
|
17
21
|
export * from './toil-accruals.service.js';
|
|
18
22
|
export * from './toil-allowance.service.js';
|
|
23
|
+
export * from './users-clock-in.service.js';
|
|
19
24
|
export * from './users.service.js';
|
|
@@ -5,15 +5,20 @@ export * from './auth.service.js';
|
|
|
5
5
|
export * from './availability.service.js';
|
|
6
6
|
export * from './daily-budgets.service.js';
|
|
7
7
|
export * from './daily-revenue.service.js';
|
|
8
|
+
export * from './day-notes.service.js';
|
|
8
9
|
export * from './days-off.service.js';
|
|
9
10
|
export * from './groups.service.js';
|
|
10
|
-
export * from './leave-request.service.js';
|
|
11
11
|
export * from './leave-embargoes.service.js';
|
|
12
|
+
export * from './leave-request.service.js';
|
|
13
|
+
export * from './leave-types.service.js';
|
|
12
14
|
export * from './leave.service.js';
|
|
13
15
|
export * from './locations.service.js';
|
|
14
16
|
export * from './roles.service.js';
|
|
15
17
|
export * from './settings.service.js';
|
|
16
18
|
export * from './shifts.service.js';
|
|
19
|
+
export * from './terminals.service.js';
|
|
20
|
+
export * from './terminals-active.service.js';
|
|
17
21
|
export * from './toil-accruals.service.js';
|
|
18
22
|
export * from './toil-allowance.service.js';
|
|
23
|
+
export * from './users-clock-in.service.js';
|
|
19
24
|
export * from './users.service.js';
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiPin } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
export declare class PinsService extends Service {
|
|
5
|
+
private apiPath;
|
|
6
|
+
get(id: string): Promise<ApiPin>;
|
|
7
|
+
get(id: string, options?: {
|
|
8
|
+
rawResponse: true;
|
|
9
|
+
} & Options): Promise<AxiosResponse<ApiPin, any>>;
|
|
10
|
+
get(id: string, options?: Options): Promise<ApiPin>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
export class PinsService extends Service {
|
|
3
|
+
constructor() {
|
|
4
|
+
super(...arguments);
|
|
5
|
+
this.apiPath = '/pins';
|
|
6
|
+
}
|
|
7
|
+
get(id, options) {
|
|
8
|
+
return super
|
|
9
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
10
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
|
|
11
|
+
}
|
|
12
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiTerminal, ApiTerminalLocation } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
import { Terminal } from '../models/terminal.model.js';
|
|
5
|
+
interface LaunchTerminal {
|
|
6
|
+
terminal: number;
|
|
7
|
+
device: string;
|
|
8
|
+
location?: ApiTerminalLocation;
|
|
9
|
+
}
|
|
10
|
+
interface PingTerminal {
|
|
11
|
+
action: string;
|
|
12
|
+
device: string;
|
|
13
|
+
}
|
|
14
|
+
declare class TerminalsActiveService extends Service {
|
|
15
|
+
private apiPath;
|
|
16
|
+
launchTerminal(data: LaunchTerminal): Promise<Terminal>;
|
|
17
|
+
launchTerminal(data: LaunchTerminal, options: {
|
|
18
|
+
rawResponse: true;
|
|
19
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
20
|
+
launchTerminal(data: LaunchTerminal, options: Options): Promise<Terminal>;
|
|
21
|
+
pingTerminal(id: number, data: PingTerminal): Promise<number>;
|
|
22
|
+
pingTerminal(id: number, data: PingTerminal, options: {
|
|
23
|
+
rawResponse: true;
|
|
24
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
25
|
+
pingTerminal(id: number, data: PingTerminal, options: Options): Promise<number>;
|
|
26
|
+
list(options?: Options): AsyncGenerator<Terminal, void, unknown>;
|
|
27
|
+
listAll(options?: Options): Promise<Terminal[]>;
|
|
28
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiTerminal[], any>, any, unknown>;
|
|
29
|
+
closeTerminal(id: number): Promise<number>;
|
|
30
|
+
closeTerminal(id: number, options: {
|
|
31
|
+
rawResponse: true;
|
|
32
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
33
|
+
closeTerminal(id: number, options: Options): Promise<number>;
|
|
34
|
+
}
|
|
35
|
+
export { TerminalsActiveService };
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { Terminal } from '../models/terminal.model.js';
|
|
3
|
+
class TerminalsActiveService extends Service {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.apiPath = '/terminals_active';
|
|
7
|
+
}
|
|
8
|
+
launchTerminal(data, options) {
|
|
9
|
+
return super
|
|
10
|
+
.fetch({
|
|
11
|
+
url: `${this.apiPath}`,
|
|
12
|
+
data,
|
|
13
|
+
method: 'POST',
|
|
14
|
+
})
|
|
15
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Terminal(res.data)));
|
|
16
|
+
}
|
|
17
|
+
pingTerminal(id, data, options) {
|
|
18
|
+
return super
|
|
19
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
|
|
20
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
|
|
21
|
+
}
|
|
22
|
+
async *list(options) {
|
|
23
|
+
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
24
|
+
yield new Terminal(res);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
async listAll(options) {
|
|
28
|
+
const users = [];
|
|
29
|
+
for await (const user of this.list(options)) {
|
|
30
|
+
users.push(user);
|
|
31
|
+
}
|
|
32
|
+
return users;
|
|
33
|
+
}
|
|
34
|
+
listByPage(options) {
|
|
35
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
36
|
+
}
|
|
37
|
+
closeTerminal(id, options) {
|
|
38
|
+
return super
|
|
39
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
40
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
export { TerminalsActiveService };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiTerminal } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
|
+
import { Terminal } from '../models/terminal.model.js';
|
|
5
|
+
declare type RequiredProps = 'name' | 'timezone';
|
|
6
|
+
declare class TerminalsService extends Service {
|
|
7
|
+
private apiPath;
|
|
8
|
+
create(data: RequirementsOf<ApiTerminal, RequiredProps>): Promise<Terminal>;
|
|
9
|
+
create(data: RequirementsOf<ApiTerminal, RequiredProps>, options: {
|
|
10
|
+
rawResponse: true;
|
|
11
|
+
} & Options): Promise<AxiosResponse<ApiTerminal, any>>;
|
|
12
|
+
create(data: RequirementsOf<ApiTerminal, RequiredProps>, options: Options): Promise<Terminal>;
|
|
13
|
+
get(id: number): Promise<Terminal>;
|
|
14
|
+
get(id: number, options: {
|
|
15
|
+
rawResponse: true;
|
|
16
|
+
} & Options): Promise<AxiosResponse<ApiTerminal, any>>;
|
|
17
|
+
get(id: number, options: Options): Promise<Terminal>;
|
|
18
|
+
update(id: number, data: Partial<ApiTerminal>): Promise<Terminal>;
|
|
19
|
+
update(id: number, data: Partial<ApiTerminal>, options: {
|
|
20
|
+
rawResponse: true;
|
|
21
|
+
} & Options): Promise<AxiosResponse<ApiTerminal, any>>;
|
|
22
|
+
update(id: number, data: Partial<ApiTerminal>, options: Options): Promise<Terminal>;
|
|
23
|
+
closeTerminal(id: number): Promise<number>;
|
|
24
|
+
closeTerminal(id: number, options: {
|
|
25
|
+
rawResponse: true;
|
|
26
|
+
} & Options): Promise<AxiosResponse<number, any>>;
|
|
27
|
+
closeTerminal(id: number, options: Options): Promise<number>;
|
|
28
|
+
list(options?: Options): AsyncGenerator<Terminal, void, unknown>;
|
|
29
|
+
listAll(options?: Options): Promise<Terminal[]>;
|
|
30
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiTerminal[], any>, any, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export { TerminalsService };
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { Terminal } from '../models/terminal.model.js';
|
|
3
|
+
class TerminalsService extends Service {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.apiPath = '/terminals';
|
|
7
|
+
}
|
|
8
|
+
create(data, options) {
|
|
9
|
+
return super
|
|
10
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
11
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Terminal(res.data)));
|
|
12
|
+
}
|
|
13
|
+
get(id, options) {
|
|
14
|
+
return super
|
|
15
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
16
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Terminal(res.data)));
|
|
17
|
+
}
|
|
18
|
+
update(id, data, options) {
|
|
19
|
+
return super
|
|
20
|
+
.fetch({
|
|
21
|
+
url: `${this.apiPath}/${id}`,
|
|
22
|
+
data,
|
|
23
|
+
method: 'POST',
|
|
24
|
+
})
|
|
25
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Terminal(res.data)));
|
|
26
|
+
}
|
|
27
|
+
closeTerminal(id, options) {
|
|
28
|
+
return super
|
|
29
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
30
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
31
|
+
}
|
|
32
|
+
async *list(options) {
|
|
33
|
+
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
34
|
+
yield new Terminal(res);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
async listAll(options) {
|
|
38
|
+
const users = [];
|
|
39
|
+
for await (const user of this.list(options)) {
|
|
40
|
+
users.push(user);
|
|
41
|
+
}
|
|
42
|
+
return users;
|
|
43
|
+
}
|
|
44
|
+
listByPage(options) {
|
|
45
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
export { TerminalsService };
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiUserBreak, ApiUserClockedIn, ApiUserClockedOut, ApiTerminalLocation } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
|
+
import { UserClockedIn, UserClockedOut } from '../models/index.js';
|
|
5
|
+
interface UserClockIn {
|
|
6
|
+
method: string;
|
|
7
|
+
shift: number;
|
|
8
|
+
terminal: number;
|
|
9
|
+
user: number;
|
|
10
|
+
photo?: string;
|
|
11
|
+
location: ApiTerminalLocation;
|
|
12
|
+
}
|
|
13
|
+
interface UserClockOut extends Omit<UserClockIn, 'user' | 'shift'> {
|
|
14
|
+
}
|
|
15
|
+
interface UserBreak {
|
|
16
|
+
method: string;
|
|
17
|
+
action: string;
|
|
18
|
+
terminal: number;
|
|
19
|
+
photo?: string;
|
|
20
|
+
location: ApiTerminalLocation;
|
|
21
|
+
}
|
|
22
|
+
declare class UserBreak {
|
|
23
|
+
start_time: number;
|
|
24
|
+
start_location: ApiTerminalLocation;
|
|
25
|
+
end_time: number | null;
|
|
26
|
+
end_location: ApiTerminalLocation | null;
|
|
27
|
+
constructor(apiUserBreak: ApiUserBreak);
|
|
28
|
+
}
|
|
29
|
+
declare type RequiredPropsClockIn = 'method';
|
|
30
|
+
declare type RequiredPropsBreak = 'method' | 'action';
|
|
31
|
+
declare class UsersClockInService extends Service {
|
|
32
|
+
private apiPath;
|
|
33
|
+
getClockedInUser(id: number): Promise<UserClockedIn>;
|
|
34
|
+
getClockedInUser(id: number, options: {
|
|
35
|
+
rawResponse: true;
|
|
36
|
+
} & Options): Promise<AxiosResponse<ApiUserClockedIn, any>>;
|
|
37
|
+
getClockedInUser(id: number, options: Options): Promise<UserClockedIn>;
|
|
38
|
+
list(options?: Options): AsyncGenerator<UserClockedIn, void, unknown>;
|
|
39
|
+
listAll(options?: Options): Promise<UserClockedIn[]>;
|
|
40
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiUserClockedIn[], any>, any, unknown>;
|
|
41
|
+
clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>): Promise<UserClockedIn>;
|
|
42
|
+
clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>, options: {
|
|
43
|
+
rawResponse: true;
|
|
44
|
+
} & Options): Promise<AxiosResponse<ApiUserClockedIn, any>>;
|
|
45
|
+
clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>, options: Options): Promise<UserClockedIn>;
|
|
46
|
+
clockOut(id: number, data: UserClockOut): Promise<UserClockedOut>;
|
|
47
|
+
clockOut(id: number, data: UserClockOut, options: {
|
|
48
|
+
rawResponse: true;
|
|
49
|
+
} & Options): Promise<AxiosResponse<ApiUserClockedOut, any>>;
|
|
50
|
+
clockOut(id: number, data: UserClockOut, options: Options): Promise<UserClockedOut>;
|
|
51
|
+
startBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>): Promise<UserBreak>;
|
|
52
|
+
startBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: {
|
|
53
|
+
rawResponse: true;
|
|
54
|
+
} & Options): Promise<AxiosResponse<ApiUserBreak, any>>;
|
|
55
|
+
startBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: Options): Promise<UserBreak>;
|
|
56
|
+
endBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>): Promise<UserBreak>;
|
|
57
|
+
endBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: {
|
|
58
|
+
rawResponse: true;
|
|
59
|
+
} & Options): Promise<AxiosResponse<ApiUserBreak, any>>;
|
|
60
|
+
endBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: Options): Promise<UserBreak>;
|
|
61
|
+
}
|
|
62
|
+
export { UsersClockInService };
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { UserClockedIn, UserClockedOut } from '../models/index.js';
|
|
3
|
+
class UserBreak {
|
|
4
|
+
constructor(apiUserBreak) {
|
|
5
|
+
this.start_time = apiUserBreak.start_time;
|
|
6
|
+
this.start_location = apiUserBreak.start_location;
|
|
7
|
+
this.end_time = apiUserBreak.end_time ?? null;
|
|
8
|
+
this.end_location = apiUserBreak.end_location ?? null;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class UsersClockInService extends Service {
|
|
12
|
+
constructor() {
|
|
13
|
+
super(...arguments);
|
|
14
|
+
this.apiPath = '/users_clocked_in';
|
|
15
|
+
}
|
|
16
|
+
getClockedInUser(id, options) {
|
|
17
|
+
return super
|
|
18
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
19
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new UserClockedIn(res.data)));
|
|
20
|
+
}
|
|
21
|
+
async *list(options) {
|
|
22
|
+
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
23
|
+
yield new UserClockedIn(res);
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
async listAll(options) {
|
|
27
|
+
const users = [];
|
|
28
|
+
for await (const user of this.list(options)) {
|
|
29
|
+
users.push(user);
|
|
30
|
+
}
|
|
31
|
+
return users;
|
|
32
|
+
}
|
|
33
|
+
listByPage(options) {
|
|
34
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
35
|
+
}
|
|
36
|
+
clockIn(data, options) {
|
|
37
|
+
return super
|
|
38
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
39
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new UserClockedIn(res.data)));
|
|
40
|
+
}
|
|
41
|
+
clockOut(id, data, options) {
|
|
42
|
+
return super
|
|
43
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'DELETE' })
|
|
44
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new UserClockedOut(res.data)));
|
|
45
|
+
}
|
|
46
|
+
startBreak(id, data, options) {
|
|
47
|
+
return super
|
|
48
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
|
|
49
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new UserBreak(res.data)));
|
|
50
|
+
}
|
|
51
|
+
endBreak(id, data, options) {
|
|
52
|
+
return super
|
|
53
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
|
|
54
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new UserBreak(res.data)));
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
export { UsersClockInService };
|
package/dist/mjs/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const Version = { version: '1.0.
|
|
1
|
+
export const Version = { version: '1.0.51' };
|
package/package.json
CHANGED
package/src/interfaces/index.ts
CHANGED
|
@@ -23,11 +23,15 @@ export * from './location.interface.js';
|
|
|
23
23
|
export * from './logbook-category.interface.js';
|
|
24
24
|
export * from './logbook-event.interface.js';
|
|
25
25
|
export * from './pay-period.interface.js';
|
|
26
|
+
export * from './pin.interface.js';
|
|
26
27
|
export * from './role-rate.interface.js';
|
|
27
28
|
export * from './role.interface.js';
|
|
28
29
|
export * from './sdk-config.interface.js';
|
|
29
30
|
export * from './settings.interface.js';
|
|
30
31
|
export * from './shift.interface.js';
|
|
32
|
+
export * from './terminal.interface.js';
|
|
31
33
|
export * from './toil-accrual.interface.js';
|
|
32
34
|
export * from './toil-allowance.interface.js';
|
|
33
35
|
export * from './user.interface.js';
|
|
36
|
+
export * from './users-clocked-in.interface.js';
|
|
37
|
+
export * from './users-clocked-out.interface.js';
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ApiUser } from './index.js';
|
|
2
|
+
|
|
3
|
+
export interface ApiPin
|
|
4
|
+
extends Omit<
|
|
5
|
+
ApiUser,
|
|
6
|
+
| 'created_at'
|
|
7
|
+
| 'created_by'
|
|
8
|
+
| 'deleted_at'
|
|
9
|
+
| 'deleted_by'
|
|
10
|
+
| 'middle_name'
|
|
11
|
+
| 'preferred_name'
|
|
12
|
+
| 'two_factor_enabled'
|
|
13
|
+
| 'has_account'
|
|
14
|
+
| 'invite_sent'
|
|
15
|
+
| 'pin'
|
|
16
|
+
> {}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
export interface ApiTerminal {
|
|
2
|
+
id: number;
|
|
3
|
+
deleted: boolean;
|
|
4
|
+
name: string;
|
|
5
|
+
active: boolean;
|
|
6
|
+
platform: string | null;
|
|
7
|
+
device: string | null;
|
|
8
|
+
version: string | null;
|
|
9
|
+
ip: string | null;
|
|
10
|
+
location: any | null; // todo
|
|
11
|
+
timezone: number;
|
|
12
|
+
require_photo: boolean;
|
|
13
|
+
require_photo_breaks: boolean;
|
|
14
|
+
debug: boolean;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface ApiTerminalLocation {
|
|
18
|
+
lat: number;
|
|
19
|
+
lng: number;
|
|
20
|
+
accuracy: number;
|
|
21
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiLeaveRate, ApiRoleRate } from './index.js';
|
|
1
|
+
import { ApiLeaveRate, ApiRoleRate, ApiTerminalLocation } from './index.js';
|
|
2
2
|
|
|
3
3
|
export interface ApiUser {
|
|
4
4
|
id: number;
|
|
@@ -36,4 +36,12 @@ export interface ApiUser {
|
|
|
36
36
|
leave_rates_unit: string;
|
|
37
37
|
leave_rates_type: string;
|
|
38
38
|
notes: string | null;
|
|
39
|
+
pin: string | null;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export interface ApiUserBreak {
|
|
43
|
+
start_time: number;
|
|
44
|
+
start_location: ApiTerminalLocation;
|
|
45
|
+
end_time?: number;
|
|
46
|
+
end_location?: ApiTerminalLocation;
|
|
39
47
|
}
|