rotacloud 1.0.10 → 1.0.13
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/availability.interface.d.ts +2 -2
- package/dist/cjs/interfaces/query-params/availability-query-params.interface.d.ts +7 -0
- package/dist/cjs/models/availability.model.d.ts +2 -2
- package/dist/cjs/models/user.model.d.ts +31 -1
- package/dist/cjs/models/user.model.js +31 -1
- package/dist/cjs/rotacloud.d.ts +2 -1
- package/dist/cjs/rotacloud.js +1 -0
- package/dist/cjs/services/accounts.service.d.ts +1 -0
- package/dist/cjs/services/accounts.service.js +34 -0
- package/dist/cjs/services/attendance.service.d.ts +1 -0
- package/dist/cjs/services/attendance.service.js +34 -0
- package/dist/cjs/services/availability.service.d.ts +13 -0
- package/dist/cjs/services/availability.service.js +55 -0
- package/dist/cjs/services/days-off.service.d.ts +1 -0
- package/dist/cjs/services/days-off.service.js +34 -0
- package/dist/cjs/services/groups.service.d.ts +1 -0
- package/dist/cjs/services/groups.service.js +34 -0
- package/dist/cjs/services/index.d.ts +1 -0
- package/dist/cjs/services/index.js +1 -0
- package/dist/cjs/services/leave-embargoes.service.d.ts +1 -0
- package/dist/cjs/services/leave-embargoes.service.js +34 -0
- package/dist/cjs/services/leave-request.service.d.ts +1 -0
- package/dist/cjs/services/leave-request.service.js +34 -0
- package/dist/cjs/services/leave.service.d.ts +1 -0
- package/dist/cjs/services/leave.service.js +37 -3
- package/dist/cjs/services/locations.service.d.ts +1 -0
- package/dist/cjs/services/locations.service.js +34 -0
- package/dist/cjs/services/roles.service.d.ts +1 -0
- package/dist/cjs/services/roles.service.js +34 -0
- package/dist/cjs/services/shifts.service.d.ts +1 -0
- package/dist/cjs/services/shifts.service.js +34 -0
- package/dist/cjs/services/users.service.d.ts +1 -0
- package/dist/cjs/services/users.service.js +34 -0
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/availability.interface.d.ts +2 -2
- package/dist/mjs/interfaces/query-params/availability-query-params.interface.d.ts +7 -0
- package/dist/mjs/models/availability.model.d.ts +2 -2
- package/dist/mjs/models/user.model.d.ts +31 -1
- package/dist/mjs/models/user.model.js +31 -1
- package/dist/mjs/rotacloud.d.ts +2 -1
- package/dist/mjs/rotacloud.js +2 -1
- package/dist/mjs/services/accounts.service.d.ts +1 -0
- package/dist/mjs/services/accounts.service.js +12 -0
- package/dist/mjs/services/attendance.service.d.ts +1 -0
- package/dist/mjs/services/attendance.service.js +12 -0
- package/dist/mjs/services/availability.service.d.ts +13 -0
- package/dist/mjs/services/availability.service.js +16 -0
- package/dist/mjs/services/days-off.service.d.ts +1 -0
- package/dist/mjs/services/days-off.service.js +12 -0
- package/dist/mjs/services/groups.service.d.ts +1 -0
- package/dist/mjs/services/groups.service.js +12 -0
- package/dist/mjs/services/index.d.ts +1 -0
- package/dist/mjs/services/index.js +1 -0
- package/dist/mjs/services/leave-embargoes.service.d.ts +1 -0
- package/dist/mjs/services/leave-embargoes.service.js +12 -0
- package/dist/mjs/services/leave-request.service.d.ts +1 -0
- package/dist/mjs/services/leave-request.service.js +12 -0
- package/dist/mjs/services/leave.service.d.ts +1 -0
- package/dist/mjs/services/leave.service.js +12 -0
- package/dist/mjs/services/locations.service.d.ts +1 -0
- package/dist/mjs/services/locations.service.js +12 -0
- package/dist/mjs/services/roles.service.d.ts +1 -0
- package/dist/mjs/services/roles.service.js +12 -0
- package/dist/mjs/services/shifts.service.d.ts +1 -0
- package/dist/mjs/services/shifts.service.js +12 -0
- package/dist/mjs/services/users.service.d.ts +1 -0
- package/dist/mjs/services/users.service.js +12 -0
- package/dist/mjs/version.js +1 -1
- package/fixup +1 -0
- package/package.json +1 -1
- package/src/interfaces/availability.interface.ts +2 -2
- package/src/interfaces/query-params/availability-query-params.interface.ts +7 -0
- package/src/models/availability.model.ts +2 -2
- package/src/models/user.model.ts +62 -2
- package/src/rotacloud.ts +2 -0
- package/src/services/accounts.service.ts +13 -0
- package/src/services/attendance.service.ts +13 -0
- package/src/services/availability.service.ts +23 -0
- package/src/services/days-off.service.ts +13 -0
- package/src/services/groups.service.ts +13 -0
- package/src/services/index.ts +1 -0
- package/src/services/leave-embargoes.service.ts +13 -0
- package/src/services/leave-request.service.ts +13 -0
- package/src/services/leave.service.ts +13 -0
- package/src/services/locations.service.ts +13 -0
- package/src/services/roles.service.ts +13 -0
- package/src/services/shifts.service.ts +13 -0
- package/src/services/users.service.ts +13 -0
- package/src/version.ts +1 -1
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
12
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
13
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -55,6 +64,31 @@ class LocationsService extends index_js_1.Service {
|
|
|
55
64
|
}
|
|
56
65
|
});
|
|
57
66
|
}
|
|
67
|
+
listAll() {
|
|
68
|
+
var e_2, _a;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
const locations = [];
|
|
72
|
+
try {
|
|
73
|
+
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
|
+
const location = _c.value;
|
|
75
|
+
locations.push(location);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e_2) throw e_2.error; }
|
|
84
|
+
}
|
|
85
|
+
return locations;
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return err;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
58
92
|
listByPage(options) {
|
|
59
93
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
60
94
|
}
|
|
@@ -20,6 +20,7 @@ declare class RolesService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiRole, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<Role>;
|
|
22
22
|
list(options?: Options<RolesQueryParams & InternalQueryParams>): AsyncGenerator<Role, void, unknown>;
|
|
23
|
+
listAll(): Promise<Role[]>;
|
|
23
24
|
listByPage(options?: Options<RolesQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiRole[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiRole>): Promise<Role>;
|
|
25
26
|
update(id: number, data: Partial<ApiRole>, options: {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
12
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
13
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -55,6 +64,31 @@ class RolesService extends index_js_1.Service {
|
|
|
55
64
|
}
|
|
56
65
|
});
|
|
57
66
|
}
|
|
67
|
+
listAll() {
|
|
68
|
+
var e_2, _a;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
const roles = [];
|
|
72
|
+
try {
|
|
73
|
+
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
|
+
const role = _c.value;
|
|
75
|
+
roles.push(role);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e_2) throw e_2.error; }
|
|
84
|
+
}
|
|
85
|
+
return roles;
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return err;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
58
92
|
listByPage(options) {
|
|
59
93
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
60
94
|
}
|
|
@@ -20,6 +20,7 @@ declare class ShiftsService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiShift, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<Shift>;
|
|
22
22
|
list(options?: Options<ShiftsQueryParams & InternalQueryParams>): AsyncGenerator<Shift, void, unknown>;
|
|
23
|
+
listAll(): Promise<Shift[]>;
|
|
23
24
|
listByPage(options?: Options<ShiftsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiShift[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiShift>): Promise<Shift>;
|
|
25
26
|
update(id: number, data: Partial<ApiShift>, options: {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
12
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
13
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -55,6 +64,31 @@ class ShiftsService extends index_js_1.Service {
|
|
|
55
64
|
}
|
|
56
65
|
});
|
|
57
66
|
}
|
|
67
|
+
listAll() {
|
|
68
|
+
var e_2, _a;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
const shifts = [];
|
|
72
|
+
try {
|
|
73
|
+
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
|
+
const shift = _c.value;
|
|
75
|
+
shifts.push(shift);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e_2) throw e_2.error; }
|
|
84
|
+
}
|
|
85
|
+
return shifts;
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return err;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
58
92
|
listByPage(options) {
|
|
59
93
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
60
94
|
}
|
|
@@ -20,6 +20,7 @@ declare class UsersService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiUser, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<User>;
|
|
22
22
|
list(options?: Options<UsersQueryParams & InternalQueryParams>): AsyncGenerator<User, void, unknown>;
|
|
23
|
+
listAll(): Promise<User[]>;
|
|
23
24
|
listByPage(options?: Options<UsersQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiUser[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiUser>): Promise<User>;
|
|
25
26
|
update(id: number, data: Partial<ApiUser>, options: {
|
|
@@ -1,4 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
3
|
+
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
4
|
+
return new (P || (P = Promise))(function (resolve, reject) {
|
|
5
|
+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
6
|
+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
7
|
+
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
8
|
+
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
9
|
+
});
|
|
10
|
+
};
|
|
2
11
|
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
3
12
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
4
13
|
var m = o[Symbol.asyncIterator], i;
|
|
@@ -55,6 +64,31 @@ class UsersService extends index_js_1.Service {
|
|
|
55
64
|
}
|
|
56
65
|
});
|
|
57
66
|
}
|
|
67
|
+
listAll() {
|
|
68
|
+
var e_2, _a;
|
|
69
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
70
|
+
try {
|
|
71
|
+
const users = [];
|
|
72
|
+
try {
|
|
73
|
+
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
|
+
const user = _c.value;
|
|
75
|
+
users.push(user);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
79
|
+
finally {
|
|
80
|
+
try {
|
|
81
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
82
|
+
}
|
|
83
|
+
finally { if (e_2) throw e_2.error; }
|
|
84
|
+
}
|
|
85
|
+
return users;
|
|
86
|
+
}
|
|
87
|
+
catch (err) {
|
|
88
|
+
return err;
|
|
89
|
+
}
|
|
90
|
+
});
|
|
91
|
+
}
|
|
58
92
|
listByPage(options) {
|
|
59
93
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
60
94
|
}
|
package/dist/cjs/version.js
CHANGED
|
@@ -2,12 +2,12 @@ export interface ApiAvailabilityPeriod {
|
|
|
2
2
|
start_time: string;
|
|
3
3
|
end_time: string;
|
|
4
4
|
}
|
|
5
|
-
export interface
|
|
5
|
+
export interface ApiAvailabilityDate {
|
|
6
6
|
date: string;
|
|
7
7
|
available: ApiAvailabilityPeriod[];
|
|
8
8
|
unavailable: ApiAvailabilityPeriod[];
|
|
9
9
|
}
|
|
10
10
|
export interface ApiAvailability {
|
|
11
11
|
user: number;
|
|
12
|
-
dates:
|
|
12
|
+
dates: ApiAvailabilityDate[];
|
|
13
13
|
}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
export interface AvailabilityQueryParams {
|
|
2
|
+
/** Start of date range for fetching availability (ISO date format `YYYY-MM-DD`) */
|
|
2
3
|
start?: string;
|
|
4
|
+
/** End of date range for fetching availability (inclusive) (ISO date format `YYYY-MM-DD`) */
|
|
3
5
|
end?: string;
|
|
6
|
+
/**
|
|
7
|
+
* List of user IDs to get availability for
|
|
8
|
+
*
|
|
9
|
+
* If undefined, all users on the account will be selected
|
|
10
|
+
*/
|
|
4
11
|
users?: number[];
|
|
5
12
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ApiAvailability,
|
|
1
|
+
import { ApiAvailability, ApiAvailabilityDate } from '../interfaces/index.js';
|
|
2
2
|
export declare class Availability {
|
|
3
3
|
user: number;
|
|
4
|
-
dates:
|
|
4
|
+
dates: ApiAvailabilityDate[];
|
|
5
5
|
constructor(availability: ApiAvailability);
|
|
6
6
|
}
|
|
@@ -25,9 +25,39 @@ export interface TeamProperties {
|
|
|
25
25
|
}
|
|
26
26
|
export declare class User {
|
|
27
27
|
id: number;
|
|
28
|
+
created_at: number;
|
|
29
|
+
created_by: number;
|
|
30
|
+
deleted: boolean;
|
|
31
|
+
deleted_at: number | null;
|
|
32
|
+
deleted_by: number | null;
|
|
33
|
+
level: string;
|
|
28
34
|
first_name: string;
|
|
35
|
+
middle_name: string | null;
|
|
29
36
|
last_name: string;
|
|
30
|
-
photo: string | null;
|
|
31
37
|
preferred_name: string | null;
|
|
38
|
+
photo: string | null;
|
|
39
|
+
two_factor_enabled: boolean;
|
|
40
|
+
email: string;
|
|
41
|
+
has_account: boolean;
|
|
42
|
+
invite_sent: boolean;
|
|
43
|
+
group: number | null;
|
|
44
|
+
locations: number[];
|
|
45
|
+
roles: number[];
|
|
46
|
+
default_role: number | null;
|
|
47
|
+
dob: string | null;
|
|
48
|
+
start_date: string | null;
|
|
49
|
+
final_working_date: string | null;
|
|
50
|
+
weekly_hours: number | null;
|
|
51
|
+
holiday_allowance: number;
|
|
52
|
+
holiday_allowance_unit: string;
|
|
53
|
+
payroll_id: string | null;
|
|
54
|
+
salary: number;
|
|
55
|
+
salary_type: string;
|
|
56
|
+
overtime_rate: number;
|
|
57
|
+
role_rates: LeaveRates;
|
|
58
|
+
leave_rates: RoleRates;
|
|
59
|
+
leave_rates_unit: string;
|
|
60
|
+
leave_rates_type: string;
|
|
61
|
+
notes: string | null;
|
|
32
62
|
constructor(user: ApiUser);
|
|
33
63
|
}
|
|
@@ -2,9 +2,39 @@
|
|
|
2
2
|
export class User {
|
|
3
3
|
constructor(user) {
|
|
4
4
|
this.id = user.id;
|
|
5
|
+
this.created_at = user.created_at;
|
|
6
|
+
this.created_by = user.created_by;
|
|
7
|
+
this.deleted = user.deleted;
|
|
8
|
+
this.deleted_at = user.deleted_at;
|
|
9
|
+
this.deleted_by = user.deleted_by;
|
|
10
|
+
this.level = user.level;
|
|
5
11
|
this.first_name = user.first_name;
|
|
12
|
+
this.middle_name = user.middle_name;
|
|
6
13
|
this.last_name = user.last_name;
|
|
7
|
-
this.photo = user.photo;
|
|
8
14
|
this.preferred_name = user.preferred_name;
|
|
15
|
+
this.photo = user.photo;
|
|
16
|
+
this.two_factor_enabled = user.two_factor_enabled;
|
|
17
|
+
this.email = user.email;
|
|
18
|
+
this.has_account = user.has_account;
|
|
19
|
+
this.invite_sent = user.invite_sent;
|
|
20
|
+
this.group = user.group;
|
|
21
|
+
this.locations = user.locations;
|
|
22
|
+
this.roles = user.roles;
|
|
23
|
+
this.default_role = user.default_role;
|
|
24
|
+
this.dob = user.dob;
|
|
25
|
+
this.start_date = user.start_date;
|
|
26
|
+
this.final_working_date = user.final_working_date;
|
|
27
|
+
this.weekly_hours = user.weekly_hours;
|
|
28
|
+
this.holiday_allowance = user.holiday_allowance;
|
|
29
|
+
this.holiday_allowance_unit = user.holiday_allowance_unit;
|
|
30
|
+
this.payroll_id = user.payroll_id;
|
|
31
|
+
this.salary = user.salary;
|
|
32
|
+
this.salary_type = user.salary_type;
|
|
33
|
+
this.overtime_rate = user.overtime_rate;
|
|
34
|
+
this.role_rates = user.role_rates;
|
|
35
|
+
this.leave_rates = user.leave_rates;
|
|
36
|
+
this.leave_rates_unit = user.leave_rates_unit;
|
|
37
|
+
this.leave_rates_type = user.leave_rates_type;
|
|
38
|
+
this.notes = user.notes;
|
|
9
39
|
}
|
|
10
40
|
}
|
package/dist/mjs/rotacloud.d.ts
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
2
2
|
import { SDKConfig } from './interfaces/index.js';
|
|
3
3
|
export declare class RotaCloud {
|
|
4
4
|
static config: SDKConfig;
|
|
5
5
|
defaultAPIURI: string;
|
|
6
6
|
accounts: AccountsService;
|
|
7
7
|
attendance: AttendanceService;
|
|
8
|
+
availability: AvailabilityService;
|
|
8
9
|
daysOff: DaysOffService;
|
|
9
10
|
group: GroupsService;
|
|
10
11
|
leaveEmbargoes: LeaveEmbargoesService;
|
package/dist/mjs/rotacloud.js
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
2
2
|
export class RotaCloud {
|
|
3
3
|
constructor(config) {
|
|
4
4
|
this.defaultAPIURI = 'https://api.rotacloud.com/v1';
|
|
5
5
|
this.accounts = new AccountsService();
|
|
6
6
|
this.attendance = new AttendanceService();
|
|
7
|
+
this.availability = new AvailabilityService();
|
|
7
8
|
this.daysOff = new DaysOffService();
|
|
8
9
|
this.group = new GroupsService();
|
|
9
10
|
this.leaveEmbargoes = new LeaveEmbargoesService();
|
|
@@ -5,6 +5,7 @@ import { InternalQueryParams } from '../interfaces/query-params/internal-query-p
|
|
|
5
5
|
declare class AccountsService extends Service {
|
|
6
6
|
private apiPath;
|
|
7
7
|
list(options?: Options<InternalQueryParams>): AsyncGenerator<Account, void, unknown>;
|
|
8
|
+
listAll(): Promise<Account[]>;
|
|
8
9
|
listByPage(options?: Options<InternalQueryParams>): AsyncGenerator<import("axios").AxiosResponse<ApiAccount[], any>, any, unknown>;
|
|
9
10
|
}
|
|
10
11
|
export { AccountsService };
|
|
@@ -10,6 +10,18 @@ class AccountsService extends Service {
|
|
|
10
10
|
yield new Account(res);
|
|
11
11
|
}
|
|
12
12
|
}
|
|
13
|
+
async listAll() {
|
|
14
|
+
try {
|
|
15
|
+
const accounts = [];
|
|
16
|
+
for await (const account of this.list()) {
|
|
17
|
+
accounts.push(account);
|
|
18
|
+
}
|
|
19
|
+
return accounts;
|
|
20
|
+
}
|
|
21
|
+
catch (err) {
|
|
22
|
+
return err;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
13
25
|
listByPage(options) {
|
|
14
26
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
15
27
|
}
|
|
@@ -20,6 +20,7 @@ declare class AttendanceService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<ApiAttendance>;
|
|
22
22
|
list(options?: Options<AttendanceQueryParams & InternalQueryParams>): AsyncGenerator<Attendance, void, unknown>;
|
|
23
|
+
listAll(): Promise<Attendance[]>;
|
|
23
24
|
listByPage(options?: Options<AttendanceQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiAttendance>): Promise<Attendance>;
|
|
25
26
|
update(id: number, data: Partial<ApiAttendance>, options: {
|
|
@@ -17,6 +17,18 @@ class AttendanceService extends Service {
|
|
|
17
17
|
yield new Attendance(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
async listAll() {
|
|
21
|
+
try {
|
|
22
|
+
const attendance = [];
|
|
23
|
+
for await (const atten of this.list()) {
|
|
24
|
+
attendance.push(atten);
|
|
25
|
+
}
|
|
26
|
+
return attendance;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return err;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
listByPage(options) {
|
|
21
33
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
22
34
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { Service, Options, RequirementsOf } from './index.js';
|
|
2
|
+
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.inteface.js';
|
|
3
|
+
import { AvailabilityQueryParams } from '../interfaces/query-params/availability-query-params.interface.js';
|
|
4
|
+
import { Availability } from '../models/availability.model.js';
|
|
5
|
+
import { ApiAvailability } from '../interfaces/availability.interface.js';
|
|
6
|
+
declare type RequiredProps = 'start' | 'end';
|
|
7
|
+
declare type RequiredOptions<T> = RequirementsOf<Options<T>, 'params'>;
|
|
8
|
+
export declare class AvailabilityService extends Service {
|
|
9
|
+
private apiPath;
|
|
10
|
+
list(options: RequiredOptions<RequirementsOf<AvailabilityQueryParams, RequiredProps> & InternalQueryParams>): AsyncGenerator<Availability, void, unknown>;
|
|
11
|
+
listByPage(options: RequiredOptions<RequirementsOf<AvailabilityQueryParams, RequiredProps> & InternalQueryParams>): AsyncGenerator<import("axios").AxiosResponse<ApiAvailability[], any>, any, unknown>;
|
|
12
|
+
}
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { Availability } from '../models/availability.model.js';
|
|
3
|
+
export class AvailabilityService extends Service {
|
|
4
|
+
constructor() {
|
|
5
|
+
super(...arguments);
|
|
6
|
+
this.apiPath = '/availability';
|
|
7
|
+
}
|
|
8
|
+
async *list(options) {
|
|
9
|
+
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
10
|
+
yield new Availability(res);
|
|
11
|
+
}
|
|
12
|
+
}
|
|
13
|
+
listByPage(options) {
|
|
14
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -13,6 +13,7 @@ declare class DaysOffService extends Service<ApiDaysOff> {
|
|
|
13
13
|
}): Promise<AxiosResponse<ApiDaysOff, any>>;
|
|
14
14
|
create(dates: string[], users: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
15
15
|
list(options?: Options<DaysOffQueryParams & InternalQueryParams>): AsyncGenerator<DaysOff, void, unknown>;
|
|
16
|
+
listAll(): Promise<DaysOff[]>;
|
|
16
17
|
listByPage(options?: Options<DaysOffQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiDaysOff[], any>, any, unknown>;
|
|
17
18
|
delete(dates: string[], users: number[]): Promise<number>;
|
|
18
19
|
delete(dates: string[], users: number[], options: {
|
|
@@ -23,6 +23,18 @@ class DaysOffService extends Service {
|
|
|
23
23
|
yield new DaysOff(res);
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
|
+
async listAll() {
|
|
27
|
+
try {
|
|
28
|
+
const daysOff = [];
|
|
29
|
+
for await (const dayOff of this.list()) {
|
|
30
|
+
daysOff.push(dayOff);
|
|
31
|
+
}
|
|
32
|
+
return daysOff;
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
return err;
|
|
36
|
+
}
|
|
37
|
+
}
|
|
26
38
|
listByPage(options) {
|
|
27
39
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
28
40
|
}
|
|
@@ -20,6 +20,7 @@ declare class GroupsService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiGroup, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<Group>;
|
|
22
22
|
list(options?: Options<GroupsQueryParams & InternalQueryParams>): AsyncGenerator<Group, void, unknown>;
|
|
23
|
+
listAll(): Promise<Group[]>;
|
|
23
24
|
listByPage(options?: Options<GroupsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiGroup[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiGroup>): Promise<Group>;
|
|
25
26
|
update(id: number, data: Partial<ApiGroup>, options: {
|
|
@@ -17,6 +17,18 @@ class GroupsService extends Service {
|
|
|
17
17
|
yield new Group(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
async listAll() {
|
|
21
|
+
try {
|
|
22
|
+
const groups = [];
|
|
23
|
+
for await (const group of this.list()) {
|
|
24
|
+
groups.push(group);
|
|
25
|
+
}
|
|
26
|
+
return groups;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return err;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
listByPage(options) {
|
|
21
33
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
22
34
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './service.js';
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
|
+
export * from './availability.service.js';
|
|
4
5
|
export * from './days-off.service.js';
|
|
5
6
|
export * from './groups.service.js';
|
|
6
7
|
export * from './leave-request.service.js';
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export * from './service.js';
|
|
2
2
|
export * from './accounts.service.js';
|
|
3
3
|
export * from './attendance.service.js';
|
|
4
|
+
export * from './availability.service.js';
|
|
4
5
|
export * from './days-off.service.js';
|
|
5
6
|
export * from './groups.service.js';
|
|
6
7
|
export * from './leave-request.service.js';
|
|
@@ -20,6 +20,7 @@ declare class LeaveEmbargoesService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiLeaveEmbargo, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<LeaveEmbargo>;
|
|
22
22
|
list(options?: Options<UsersQueryParams & InternalQueryParams>): AsyncGenerator<LeaveEmbargo, void, unknown>;
|
|
23
|
+
listAll(): Promise<LeaveEmbargo[]>;
|
|
23
24
|
listByPage(options?: Options<UsersQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiLeaveEmbargo[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiLeaveEmbargo>): Promise<LeaveEmbargo>;
|
|
25
26
|
update(id: number, data: Partial<ApiLeaveEmbargo>, options: {
|
|
@@ -17,6 +17,18 @@ class LeaveEmbargoesService extends Service {
|
|
|
17
17
|
yield new LeaveEmbargo(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
async listAll() {
|
|
21
|
+
try {
|
|
22
|
+
const leave = [];
|
|
23
|
+
for await (const leaveEmbargoRecord of this.list()) {
|
|
24
|
+
leave.push(leaveEmbargoRecord);
|
|
25
|
+
}
|
|
26
|
+
return leave;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return err;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
listByPage(options) {
|
|
21
33
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
22
34
|
}
|
|
@@ -20,6 +20,7 @@ declare class LeaveRequestService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiLeaveRequest, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<LeaveRequest>;
|
|
22
22
|
list(options?: Options<LeaveQueryParams & InternalQueryParams>): AsyncGenerator<LeaveRequest, void, unknown>;
|
|
23
|
+
listAll(): Promise<LeaveRequest[]>;
|
|
23
24
|
listByPage(options?: Options<LeaveQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiLeaveRequest[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiLeaveRequest>): Promise<LeaveRequest>;
|
|
25
26
|
update(id: number, data: Partial<ApiLeaveRequest>, options: {
|
|
@@ -17,6 +17,18 @@ class LeaveRequestService extends Service {
|
|
|
17
17
|
yield new LeaveRequest(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
async listAll() {
|
|
21
|
+
try {
|
|
22
|
+
const leave = [];
|
|
23
|
+
for await (const leaveRequestRecord of this.list()) {
|
|
24
|
+
leave.push(leaveRequestRecord);
|
|
25
|
+
}
|
|
26
|
+
return leave;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return err;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
listByPage(options) {
|
|
21
33
|
return super.iterator({ url: `${this.apiPath}` }, options).byPage();
|
|
22
34
|
}
|
|
@@ -21,6 +21,7 @@ declare class LeaveService extends Service {
|
|
|
21
21
|
}): Promise<AxiosResponse<ApiLeave, any>>;
|
|
22
22
|
get(id: number, options: Options<InternalQueryParams>): Promise<Leave>;
|
|
23
23
|
list(options?: Options<LeaveQueryParams & InternalQueryParams>): AsyncGenerator<Leave, void, unknown>;
|
|
24
|
+
listAll(): Promise<Leave[]>;
|
|
24
25
|
listLeaveTypes(options?: Options<InternalQueryParams>): AsyncGenerator<LeaveType, void, unknown>;
|
|
25
26
|
listByPage(options?: Options<LeaveQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiLeave[], any>, any, unknown>;
|
|
26
27
|
update(id: number, data: Partial<ApiLeave>): Promise<Leave>;
|
|
@@ -18,6 +18,18 @@ class LeaveService extends Service {
|
|
|
18
18
|
yield new Leave(res);
|
|
19
19
|
}
|
|
20
20
|
}
|
|
21
|
+
async listAll() {
|
|
22
|
+
try {
|
|
23
|
+
const leave = [];
|
|
24
|
+
for await (const leaveRecord of this.list()) {
|
|
25
|
+
leave.push(leaveRecord);
|
|
26
|
+
}
|
|
27
|
+
return leave;
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
return err;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
21
33
|
async *listLeaveTypes(options) {
|
|
22
34
|
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
23
35
|
yield new LeaveType(res);
|
|
@@ -20,6 +20,7 @@ declare class LocationsService extends Service {
|
|
|
20
20
|
}): Promise<AxiosResponse<ApiLocation, any>>;
|
|
21
21
|
get(id: number, options: Options<InternalQueryParams>): Promise<ApiLocation>;
|
|
22
22
|
list(options?: Options<LocationsQueryParams & InternalQueryParams>): AsyncGenerator<Location, void, unknown>;
|
|
23
|
+
listAll(): Promise<Location[]>;
|
|
23
24
|
listByPage(options?: Options<LocationsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiLocation[], any>, any, unknown>;
|
|
24
25
|
update(id: number, data: Partial<ApiLocation>): Promise<Location>;
|
|
25
26
|
update(id: number, data: Partial<ApiLocation>, options: {
|
|
@@ -17,6 +17,18 @@ class LocationsService extends Service {
|
|
|
17
17
|
yield new Location(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
+
async listAll() {
|
|
21
|
+
try {
|
|
22
|
+
const locations = [];
|
|
23
|
+
for await (const location of this.list()) {
|
|
24
|
+
locations.push(location);
|
|
25
|
+
}
|
|
26
|
+
return locations;
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
return err;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
20
32
|
listByPage(options) {
|
|
21
33
|
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
22
34
|
}
|