rotacloud 1.0.25 → 1.0.30
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/auth.interface.d.ts +8 -0
- package/dist/cjs/interfaces/auth.interface.js +2 -0
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/models/attendance.model.d.ts +21 -1
- package/dist/cjs/models/attendance.model.js +20 -0
- package/dist/cjs/models/auth.model.d.ts +6 -0
- package/dist/cjs/models/auth.model.js +10 -0
- package/dist/cjs/rotacloud.d.ts +3 -1
- package/dist/cjs/rotacloud.js +2 -0
- package/dist/cjs/services/accounts.service.d.ts +9 -4
- package/dist/cjs/services/accounts.service.js +6 -2
- package/dist/cjs/services/attendance.service.d.ts +13 -18
- package/dist/cjs/services/attendance.service.js +6 -6
- package/dist/cjs/services/auth.service.d.ts +11 -0
- package/dist/cjs/services/auth.service.js +16 -0
- package/dist/cjs/services/availability.service.d.ts +9 -16
- package/dist/cjs/services/availability.service.js +4 -4
- package/dist/cjs/services/daily-budgets.service.d.ts +8 -11
- package/dist/cjs/services/daily-budgets.service.js +9 -9
- package/dist/cjs/services/daily-revenue.service.d.ts +16 -0
- package/dist/cjs/services/daily-revenue.service.js +99 -0
- package/dist/cjs/services/days-off.service.d.ts +8 -12
- package/dist/cjs/services/days-off.service.js +6 -6
- package/dist/cjs/services/groups.service.d.ts +13 -18
- package/dist/cjs/services/groups.service.js +6 -6
- package/dist/cjs/services/index.d.ts +2 -0
- package/dist/cjs/services/index.js +2 -0
- package/dist/cjs/services/leave-embargoes.service.d.ts +13 -18
- package/dist/cjs/services/leave-embargoes.service.js +6 -6
- package/dist/cjs/services/leave-request.service.d.ts +12 -17
- package/dist/cjs/services/leave-request.service.js +4 -4
- package/dist/cjs/services/leave.service.d.ts +13 -18
- package/dist/cjs/services/leave.service.js +9 -9
- package/dist/cjs/services/locations.service.d.ts +13 -18
- package/dist/cjs/services/locations.service.js +6 -6
- package/dist/cjs/services/roles.service.d.ts +13 -18
- package/dist/cjs/services/roles.service.js +6 -6
- package/dist/cjs/services/service.d.ts +6 -4
- package/dist/cjs/services/service.js +2 -2
- package/dist/cjs/services/shifts.service.d.ts +19 -27
- package/dist/cjs/services/shifts.service.js +6 -6
- package/dist/cjs/services/users.service.d.ts +11 -16
- package/dist/cjs/services/users.service.js +6 -6
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/auth.interface.d.ts +8 -0
- package/dist/mjs/interfaces/auth.interface.js +1 -0
- package/dist/mjs/interfaces/index.d.ts +1 -0
- package/dist/mjs/interfaces/index.js +1 -0
- package/dist/mjs/models/attendance.model.d.ts +21 -1
- package/dist/mjs/models/attendance.model.js +20 -0
- package/dist/mjs/models/auth.model.d.ts +6 -0
- package/dist/mjs/models/auth.model.js +6 -0
- package/dist/mjs/rotacloud.d.ts +3 -1
- package/dist/mjs/rotacloud.js +3 -1
- package/dist/mjs/services/accounts.service.d.ts +9 -4
- package/dist/mjs/services/accounts.service.js +6 -2
- package/dist/mjs/services/attendance.service.d.ts +13 -18
- package/dist/mjs/services/attendance.service.js +7 -8
- package/dist/mjs/services/auth.service.d.ts +11 -0
- package/dist/mjs/services/auth.service.js +12 -0
- package/dist/mjs/services/availability.service.d.ts +9 -16
- package/dist/mjs/services/availability.service.js +4 -4
- package/dist/mjs/services/daily-budgets.service.d.ts +8 -11
- package/dist/mjs/services/daily-budgets.service.js +10 -11
- package/dist/mjs/services/daily-revenue.service.d.ts +16 -0
- package/dist/mjs/services/daily-revenue.service.js +38 -0
- package/dist/mjs/services/days-off.service.d.ts +8 -12
- package/dist/mjs/services/days-off.service.js +7 -8
- package/dist/mjs/services/groups.service.d.ts +13 -18
- package/dist/mjs/services/groups.service.js +7 -8
- package/dist/mjs/services/index.d.ts +2 -0
- package/dist/mjs/services/index.js +2 -0
- package/dist/mjs/services/leave-embargoes.service.d.ts +13 -18
- package/dist/mjs/services/leave-embargoes.service.js +7 -8
- package/dist/mjs/services/leave-request.service.d.ts +12 -17
- package/dist/mjs/services/leave-request.service.js +5 -6
- package/dist/mjs/services/leave.service.d.ts +13 -18
- package/dist/mjs/services/leave.service.js +10 -11
- package/dist/mjs/services/locations.service.d.ts +13 -18
- package/dist/mjs/services/locations.service.js +7 -8
- package/dist/mjs/services/roles.service.d.ts +13 -18
- package/dist/mjs/services/roles.service.js +7 -8
- package/dist/mjs/services/service.d.ts +6 -4
- package/dist/mjs/services/service.js +7 -2
- package/dist/mjs/services/shifts.service.d.ts +19 -27
- package/dist/mjs/services/shifts.service.js +7 -8
- package/dist/mjs/services/users.service.d.ts +11 -16
- package/dist/mjs/services/users.service.js +6 -6
- package/dist/mjs/version.js +1 -1
- package/package.json +1 -1
- package/src/interfaces/auth.interface.ts +9 -0
- package/src/interfaces/index.ts +1 -0
- package/src/models/attendance.model.ts +41 -1
- package/src/models/auth.model.ts +11 -0
- package/src/rotacloud.ts +4 -0
- package/src/services/accounts.service.ts +17 -6
- package/src/services/attendance.service.ts +20 -32
- package/src/services/auth.service.ts +19 -0
- package/src/services/availability.service.ts +14 -34
- package/src/services/daily-budgets.service.ts +15 -19
- package/src/services/daily-revenue.service.ts +53 -0
- package/src/services/days-off.service.ts +15 -21
- package/src/services/groups.service.ts +21 -23
- package/src/services/index.ts +2 -0
- package/src/services/leave-embargoes.service.ts +21 -30
- package/src/services/leave-request.service.ts +20 -31
- package/src/services/leave.service.ts +24 -29
- package/src/services/locations.service.ts +20 -26
- package/src/services/roles.service.ts +20 -24
- package/src/services/service.ts +18 -8
- package/src/services/shifts.service.ts +29 -41
- package/src/services/users.service.ts +19 -20
- package/src/version.ts +1 -1
|
@@ -43,14 +43,14 @@ class RolesService extends index_js_1.Service {
|
|
|
43
43
|
get(id, options) {
|
|
44
44
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new role_model_js_1.Role(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
|
|
45
45
|
}
|
|
46
|
-
list(options) {
|
|
46
|
+
list(query, options) {
|
|
47
47
|
const _super = Object.create(null, {
|
|
48
48
|
iterator: { get: () => super.iterator }
|
|
49
49
|
});
|
|
50
50
|
return __asyncGenerator(this, arguments, function* list_1() {
|
|
51
51
|
var e_1, _a;
|
|
52
52
|
try {
|
|
53
|
-
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
53
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
54
54
|
const res = _c.value;
|
|
55
55
|
yield yield __await(new role_model_js_1.Role(res));
|
|
56
56
|
}
|
|
@@ -64,13 +64,13 @@ class RolesService extends index_js_1.Service {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
listAll() {
|
|
67
|
+
listAll(query, options) {
|
|
68
68
|
var e_2, _a;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
try {
|
|
71
71
|
const roles = [];
|
|
72
72
|
try {
|
|
73
|
-
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
73
|
+
for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
74
|
const role = _c.value;
|
|
75
75
|
roles.push(role);
|
|
76
76
|
}
|
|
@@ -89,8 +89,8 @@ class RolesService extends index_js_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
listByPage(options) {
|
|
93
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
92
|
+
listByPage(query, options) {
|
|
93
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
94
94
|
}
|
|
95
95
|
update(id, data, options) {
|
|
96
96
|
return super
|
|
@@ -1,17 +1,19 @@
|
|
|
1
1
|
import { AxiosRequestConfig, AxiosResponse } from 'axios';
|
|
2
2
|
export declare type RequirementsOf<T, K extends keyof T> = Required<Pick<T, K>> & Partial<T>;
|
|
3
|
-
export interface Options
|
|
3
|
+
export interface Options {
|
|
4
4
|
rawResponse?: boolean;
|
|
5
|
-
|
|
5
|
+
expand?: string[];
|
|
6
|
+
fields?: string[];
|
|
7
|
+
limit?: number;
|
|
6
8
|
}
|
|
7
9
|
export declare abstract class Service<ApiResponse = any> {
|
|
8
10
|
isLeaveRequest(endpoint?: string): boolean;
|
|
9
11
|
private buildQueryStr;
|
|
10
12
|
private getPagingObject;
|
|
11
|
-
fetch<T = ApiResponse>(httpOptions: AxiosRequestConfig, options?:
|
|
13
|
+
fetch<T = ApiResponse>(httpOptions: AxiosRequestConfig, options?: Options): Promise<AxiosResponse<T>>;
|
|
12
14
|
private listFetch;
|
|
13
15
|
private listResponses;
|
|
14
|
-
iterator<T = ApiResponse>(reqObject: any, options?:
|
|
16
|
+
iterator<T = ApiResponse>(reqObject: any, options?: Options): {
|
|
15
17
|
[Symbol.asyncIterator](): {
|
|
16
18
|
next(): Promise<IteratorResult<T, void>>;
|
|
17
19
|
};
|
|
@@ -81,7 +81,7 @@ class Service {
|
|
|
81
81
|
// need to convert user field in payload to a header for creating leave_requests when using an API key
|
|
82
82
|
this.isLeaveRequest(httpOptions.url) ? (headers.User = `${httpOptions.data.user}`) : undefined;
|
|
83
83
|
}
|
|
84
|
-
const reqObject = Object.assign(Object.assign({}, httpOptions), { baseURL: rotacloud_js_1.RotaCloud.config.baseUri, headers, params: options === null || options === void 0 ? void 0 : options.params, paramsSerializer: (params) => {
|
|
84
|
+
const reqObject = Object.assign(Object.assign({}, httpOptions), { baseURL: rotacloud_js_1.RotaCloud.config.baseUri, headers, params: Object.assign({ expand: options === null || options === void 0 ? void 0 : options.expand, fields: options === null || options === void 0 ? void 0 : options.fields, limit: options === null || options === void 0 ? void 0 : options.limit }, httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.params), paramsSerializer: (params) => {
|
|
85
85
|
return params ? this.buildQueryStr(params) : '';
|
|
86
86
|
} });
|
|
87
87
|
const response = yield axios_1.default.request(reqObject);
|
|
@@ -105,7 +105,7 @@ class Service {
|
|
|
105
105
|
else {
|
|
106
106
|
running = false;
|
|
107
107
|
}
|
|
108
|
-
yield yield __await(
|
|
108
|
+
yield yield __await(res);
|
|
109
109
|
} while (running);
|
|
110
110
|
});
|
|
111
111
|
}
|
|
@@ -3,54 +3,46 @@ import { ApiShift } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Shift } from '../models/shift.model.js';
|
|
5
5
|
import { ShiftsQueryParams } from '../interfaces/query-params/shifts-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'end_time' | 'start_time' | 'location';
|
|
8
|
-
declare class ShiftsService extends Service {
|
|
7
|
+
export declare class ShiftsService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiShift, RequiredProps>): Promise<Shift>;
|
|
11
10
|
create(data: RequirementsOf<ApiShift, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiShift, RequiredProps>, options: Options<InternalQueryParams>): Promise<Shift>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiShift, RequiredProps>, options: Options): Promise<Shift>;
|
|
16
14
|
get(id: number): Promise<Shift>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<ShiftsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiShift[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Shift>;
|
|
19
|
+
list(query: ShiftsQueryParams, options?: Options): AsyncGenerator<Shift, void, unknown>;
|
|
20
|
+
listAll(query: ShiftsQueryParams, options?: Options): Promise<Shift[]>;
|
|
21
|
+
listByPage(query: ShiftsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiShift[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiShift>): Promise<Shift>;
|
|
26
23
|
update(id: number, data: Partial<ApiShift>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiShift>, options: Options<InternalQueryParams>): Promise<Shift>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiShift>, options: Options): Promise<Shift>;
|
|
31
27
|
delete(id: number): Promise<number>;
|
|
32
28
|
delete(id: number, options: {
|
|
33
29
|
rawResponse: true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
30
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
31
|
+
delete(id: number, options: Options): Promise<number>;
|
|
37
32
|
acknowledge(data: number[]): Promise<number>;
|
|
38
33
|
acknowledge(data: number[], options: {
|
|
39
34
|
rawResponse: true;
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
acknowledge(data: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
35
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
36
|
+
acknowledge(data: number[], options: Options): Promise<number>;
|
|
43
37
|
publish(data: number[]): Promise<number>;
|
|
44
38
|
publish(data: number[], options: {
|
|
45
39
|
rawResponse: true;
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
publish(data: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
40
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
41
|
+
publish(data: number[], options: Options): Promise<number>;
|
|
49
42
|
unpublish(data: number[]): Promise<number>;
|
|
50
43
|
unpublish(data: number[], options: {
|
|
51
44
|
rawResponse: true;
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
unpublish(data: number[], options: Options<InternalQueryParams>): Promise<number>;
|
|
45
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
46
|
+
unpublish(data: number[], options: Options): Promise<number>;
|
|
55
47
|
}
|
|
56
|
-
export {
|
|
48
|
+
export {};
|
|
@@ -43,14 +43,14 @@ class ShiftsService extends index_js_1.Service {
|
|
|
43
43
|
get(id, options) {
|
|
44
44
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new shift_model_js_1.Shift(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
|
|
45
45
|
}
|
|
46
|
-
list(options) {
|
|
46
|
+
list(query, options) {
|
|
47
47
|
const _super = Object.create(null, {
|
|
48
48
|
iterator: { get: () => super.iterator }
|
|
49
49
|
});
|
|
50
50
|
return __asyncGenerator(this, arguments, function* list_1() {
|
|
51
51
|
var e_1, _a;
|
|
52
52
|
try {
|
|
53
|
-
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
53
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
54
54
|
const res = _c.value;
|
|
55
55
|
yield yield __await(new shift_model_js_1.Shift(res));
|
|
56
56
|
}
|
|
@@ -64,13 +64,13 @@ class ShiftsService extends index_js_1.Service {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
listAll() {
|
|
67
|
+
listAll(query, options) {
|
|
68
68
|
var e_2, _a;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
try {
|
|
71
71
|
const shifts = [];
|
|
72
72
|
try {
|
|
73
|
-
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
73
|
+
for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
74
|
const shift = _c.value;
|
|
75
75
|
shifts.push(shift);
|
|
76
76
|
}
|
|
@@ -89,8 +89,8 @@ class ShiftsService extends index_js_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
listByPage(options) {
|
|
93
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
92
|
+
listByPage(query, options) {
|
|
93
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
94
94
|
}
|
|
95
95
|
update(id, data, options) {
|
|
96
96
|
return super
|
|
@@ -3,36 +3,31 @@ import { ApiUser } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { User } from '../models/user.model.js';
|
|
5
5
|
import { UsersQueryParams } from '../interfaces/query-params/users-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'first_name' | 'last_name';
|
|
8
7
|
declare class UsersService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiUser, RequiredProps>): Promise<User>;
|
|
11
10
|
create(data: RequirementsOf<ApiUser, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiUser, RequiredProps>, options: Options<InternalQueryParams>): Promise<User>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiUser, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiUser, RequiredProps>, options: Options): Promise<User>;
|
|
16
14
|
get(id: number): Promise<User>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<UsersQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiUser[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiUser, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<User>;
|
|
19
|
+
list(query: UsersQueryParams, options?: Options): AsyncGenerator<User, void, unknown>;
|
|
20
|
+
listAll(query: UsersQueryParams, options?: Options): Promise<User[]>;
|
|
21
|
+
listByPage(query: UsersQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiUser[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiUser>): Promise<User>;
|
|
26
23
|
update(id: number, data: Partial<ApiUser>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiUser>, options: Options<InternalQueryParams>): Promise<User>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiUser, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiUser>, options: Options): Promise<User>;
|
|
31
27
|
delete(id: number): Promise<number>;
|
|
32
28
|
delete(id: number, options: {
|
|
33
29
|
rawResponse: true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
30
|
+
} & Options): Promise<AxiosResponse<any, any>>;
|
|
31
|
+
delete(id: number, options: Options): Promise<number>;
|
|
37
32
|
}
|
|
38
33
|
export { UsersService };
|
|
@@ -43,14 +43,14 @@ class UsersService extends index_js_1.Service {
|
|
|
43
43
|
get(id, options) {
|
|
44
44
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new user_model_js_1.User(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
|
|
45
45
|
}
|
|
46
|
-
list(options) {
|
|
46
|
+
list(query, options) {
|
|
47
47
|
const _super = Object.create(null, {
|
|
48
48
|
iterator: { get: () => super.iterator }
|
|
49
49
|
});
|
|
50
50
|
return __asyncGenerator(this, arguments, function* list_1() {
|
|
51
51
|
var e_1, _a;
|
|
52
52
|
try {
|
|
53
|
-
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
53
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
54
54
|
const res = _c.value;
|
|
55
55
|
yield yield __await(new user_model_js_1.User(res));
|
|
56
56
|
}
|
|
@@ -64,13 +64,13 @@ class UsersService extends index_js_1.Service {
|
|
|
64
64
|
}
|
|
65
65
|
});
|
|
66
66
|
}
|
|
67
|
-
listAll() {
|
|
67
|
+
listAll(query, options) {
|
|
68
68
|
var e_2, _a;
|
|
69
69
|
return __awaiter(this, void 0, void 0, function* () {
|
|
70
70
|
try {
|
|
71
71
|
const users = [];
|
|
72
72
|
try {
|
|
73
|
-
for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
|
|
73
|
+
for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
74
74
|
const user = _c.value;
|
|
75
75
|
users.push(user);
|
|
76
76
|
}
|
|
@@ -89,8 +89,8 @@ class UsersService extends index_js_1.Service {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}
|
|
92
|
-
listByPage(options) {
|
|
93
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
92
|
+
listByPage(query, options) {
|
|
93
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
94
94
|
}
|
|
95
95
|
update(id, data, options) {
|
|
96
96
|
return super
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -2,6 +2,7 @@ export * from './account-service.interface.js';
|
|
|
2
2
|
export * from './account-services.interface.js';
|
|
3
3
|
export * from './account.interface.js';
|
|
4
4
|
export * from './attendance.interface.js';
|
|
5
|
+
export * from './auth.interface.js';
|
|
5
6
|
export * from './availability-pattern.interface.js';
|
|
6
7
|
export * from './availability.interface.js';
|
|
7
8
|
export * from './daily-budgets.interface.js';
|
|
@@ -2,6 +2,7 @@ export * from './account-service.interface.js';
|
|
|
2
2
|
export * from './account-services.interface.js';
|
|
3
3
|
export * from './account.interface.js';
|
|
4
4
|
export * from './attendance.interface.js';
|
|
5
|
+
export * from './auth.interface.js';
|
|
5
6
|
export * from './availability-pattern.interface.js';
|
|
6
7
|
export * from './availability.interface.js';
|
|
7
8
|
export * from './daily-budgets.interface.js';
|
|
@@ -1,7 +1,27 @@
|
|
|
1
|
-
import { ApiAttendance } from '../interfaces/index.js';
|
|
1
|
+
import { ApiAttendance, ApiAttendanceLocation, ApiShift } from '../interfaces/index.js';
|
|
2
2
|
export declare class Attendance {
|
|
3
3
|
id: number;
|
|
4
|
+
deleted: boolean;
|
|
4
5
|
approved: boolean;
|
|
6
|
+
in_time: number;
|
|
7
|
+
out_time: number;
|
|
8
|
+
minutes_break: number;
|
|
9
|
+
user: number;
|
|
5
10
|
location: number;
|
|
11
|
+
role: number;
|
|
12
|
+
minutes_late: number;
|
|
13
|
+
hours: number;
|
|
14
|
+
hours_auto: number;
|
|
15
|
+
hours_is_auto: boolean;
|
|
16
|
+
notes: string | null;
|
|
17
|
+
shift: ApiShift | null;
|
|
18
|
+
in_method: string;
|
|
19
|
+
out_method: string;
|
|
20
|
+
in_location: ApiAttendanceLocation;
|
|
21
|
+
out_location: ApiAttendanceLocation;
|
|
22
|
+
in_device: number;
|
|
23
|
+
out_device: number;
|
|
24
|
+
in_terminal: null;
|
|
25
|
+
out_terminal: null;
|
|
6
26
|
constructor(attendance: ApiAttendance);
|
|
7
27
|
}
|
|
@@ -1,7 +1,27 @@
|
|
|
1
1
|
export class Attendance {
|
|
2
2
|
constructor(attendance) {
|
|
3
3
|
this.id = attendance.id;
|
|
4
|
+
this.deleted = attendance.deleted;
|
|
4
5
|
this.approved = attendance.approved;
|
|
6
|
+
this.in_time = attendance.in_time;
|
|
7
|
+
this.out_time = attendance.out_time;
|
|
8
|
+
this.minutes_break = attendance.minutes_break;
|
|
9
|
+
this.user = attendance.user;
|
|
5
10
|
this.location = attendance.location;
|
|
11
|
+
this.role = attendance.role;
|
|
12
|
+
this.minutes_late = attendance.minutes_late;
|
|
13
|
+
this.hours = attendance.hours;
|
|
14
|
+
this.hours_auto = attendance.hours_auto;
|
|
15
|
+
this.hours_is_auto = attendance.hours_is_auto;
|
|
16
|
+
this.notes = attendance.notes;
|
|
17
|
+
this.shift = attendance.shift;
|
|
18
|
+
this.in_method = attendance.in_method;
|
|
19
|
+
this.out_method = attendance.out_method;
|
|
20
|
+
this.in_location = attendance.in_location;
|
|
21
|
+
this.out_location = attendance.out_location;
|
|
22
|
+
this.in_device = attendance.in_device;
|
|
23
|
+
this.out_device = attendance.out_device;
|
|
24
|
+
this.in_terminal = attendance.in_terminal;
|
|
25
|
+
this.out_terminal = attendance.out_terminal;
|
|
6
26
|
}
|
|
7
27
|
}
|
package/dist/mjs/rotacloud.d.ts
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, 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
|
+
auth: AuthService;
|
|
8
9
|
availability: AvailabilityService;
|
|
9
10
|
dailyBudgets: DailyBudgetsService;
|
|
11
|
+
dailyRevenue: DailyRevenueService;
|
|
10
12
|
daysOff: DaysOffService;
|
|
11
13
|
group: GroupsService;
|
|
12
14
|
leaveEmbargoes: LeaveEmbargoesService;
|
package/dist/mjs/rotacloud.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
|
-
import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService, } from './services/index.js';
|
|
1
|
+
import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, 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.auth = new AuthService();
|
|
7
8
|
this.availability = new AvailabilityService();
|
|
8
9
|
this.dailyBudgets = new DailyBudgetsService();
|
|
10
|
+
this.dailyRevenue = new DailyRevenueService();
|
|
9
11
|
this.daysOff = new DaysOffService();
|
|
10
12
|
this.group = new GroupsService();
|
|
11
13
|
this.leaveEmbargoes = new LeaveEmbargoesService();
|
|
@@ -1,11 +1,16 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
1
2
|
import { Account } from '../models/account.model.js';
|
|
2
3
|
import { Service, Options } from './index.js';
|
|
3
4
|
import { ApiAccount } from '../interfaces/index.js';
|
|
4
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
5
5
|
declare class AccountsService extends Service {
|
|
6
6
|
private apiPath;
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
7
|
+
get(id: number): Promise<Account>;
|
|
8
|
+
get(id: number, options: {
|
|
9
|
+
rawResponse: true;
|
|
10
|
+
} & Options): Promise<AxiosResponse<ApiAccount, any>>;
|
|
11
|
+
get(id: number, options: Options): Promise<Account>;
|
|
12
|
+
list(options?: Options): AsyncGenerator<Account, void, unknown>;
|
|
13
|
+
listAll(options?: Options): Promise<Account[]>;
|
|
14
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiAccount[], any>, any, unknown>;
|
|
10
15
|
}
|
|
11
16
|
export { AccountsService };
|
|
@@ -1,19 +1,23 @@
|
|
|
1
1
|
import { Account } from '../models/account.model.js';
|
|
2
2
|
import { Service } from './index.js';
|
|
3
|
+
import { ErrorResponse } from '../models/error-response.model.js';
|
|
3
4
|
class AccountsService extends Service {
|
|
4
5
|
constructor() {
|
|
5
6
|
super(...arguments);
|
|
6
7
|
this.apiPath = '/accounts';
|
|
7
8
|
}
|
|
9
|
+
get(id, options) {
|
|
10
|
+
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve(options?.rawResponse ? res : new Account(res.data)), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
11
|
+
}
|
|
8
12
|
async *list(options) {
|
|
9
13
|
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
10
14
|
yield new Account(res);
|
|
11
15
|
}
|
|
12
16
|
}
|
|
13
|
-
async listAll() {
|
|
17
|
+
async listAll(options) {
|
|
14
18
|
try {
|
|
15
19
|
const accounts = [];
|
|
16
|
-
for await (const account of this.list()) {
|
|
20
|
+
for await (const account of this.list(options)) {
|
|
17
21
|
accounts.push(account);
|
|
18
22
|
}
|
|
19
23
|
return accounts;
|
|
@@ -3,36 +3,31 @@ import { ApiAttendance } from '../interfaces/index.js';
|
|
|
3
3
|
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
4
|
import { Attendance } from '../models/attendance.model.js';
|
|
5
5
|
import { AttendanceQueryParams } from '../interfaces/query-params/attendance-query-params.interface.js';
|
|
6
|
-
import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
|
|
7
6
|
declare type RequiredProps = 'user' | 'in_time';
|
|
8
|
-
declare class AttendanceService extends Service {
|
|
7
|
+
export declare class AttendanceService extends Service {
|
|
9
8
|
private apiPath;
|
|
10
9
|
create(data: RequirementsOf<ApiAttendance, RequiredProps>): Promise<Attendance>;
|
|
11
10
|
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: {
|
|
12
11
|
rawResponse: true;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options<InternalQueryParams>): Promise<ApiAttendance>;
|
|
12
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
13
|
+
create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options): Promise<ApiAttendance>;
|
|
16
14
|
get(id: number): Promise<Attendance>;
|
|
17
15
|
get(id: number, options: {
|
|
18
16
|
rawResponse: true;
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
listByPage(options?: Options<AttendanceQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
|
|
17
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
18
|
+
get(id: number, options: Options): Promise<Attendance>;
|
|
19
|
+
list(query: AttendanceQueryParams, options?: Options): AsyncGenerator<Attendance, void, unknown>;
|
|
20
|
+
listAll(query: AttendanceQueryParams, options?: Options): Promise<Attendance[]>;
|
|
21
|
+
listByPage(query: AttendanceQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
|
|
25
22
|
update(id: number, data: Partial<ApiAttendance>): Promise<Attendance>;
|
|
26
23
|
update(id: number, data: Partial<ApiAttendance>, options: {
|
|
27
24
|
rawResponse: true;
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
update(id: number, data: Partial<ApiAttendance>, options: Options<InternalQueryParams>): Promise<Attendance>;
|
|
25
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
26
|
+
update(id: number, data: Partial<ApiAttendance>, options: Options): Promise<Attendance>;
|
|
31
27
|
delete(id: number): Promise<number>;
|
|
32
28
|
delete(id: number, options: {
|
|
33
29
|
rawResponse: true;
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
|
|
30
|
+
} & Options): Promise<AxiosResponse<ApiAttendance, any>>;
|
|
31
|
+
delete(id: number, options: Options): Promise<number>;
|
|
37
32
|
}
|
|
38
|
-
export {
|
|
33
|
+
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Attendance } from '../models/attendance.model.js';
|
|
3
3
|
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
-
class AttendanceService extends Service {
|
|
4
|
+
export class AttendanceService extends Service {
|
|
5
5
|
constructor() {
|
|
6
6
|
super(...arguments);
|
|
7
7
|
this.apiPath = '/attendance';
|
|
@@ -12,15 +12,15 @@ class AttendanceService extends Service {
|
|
|
12
12
|
get(id, options) {
|
|
13
13
|
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data)), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
14
14
|
}
|
|
15
|
-
async *list(options) {
|
|
16
|
-
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
15
|
+
async *list(query, options) {
|
|
16
|
+
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
17
17
|
yield new Attendance(res);
|
|
18
18
|
}
|
|
19
19
|
}
|
|
20
|
-
async listAll() {
|
|
20
|
+
async listAll(query, options) {
|
|
21
21
|
try {
|
|
22
22
|
const attendance = [];
|
|
23
|
-
for await (const atten of this.list()) {
|
|
23
|
+
for await (const atten of this.list(query, options)) {
|
|
24
24
|
attendance.push(atten);
|
|
25
25
|
}
|
|
26
26
|
return attendance;
|
|
@@ -29,8 +29,8 @@ class AttendanceService extends Service {
|
|
|
29
29
|
return err;
|
|
30
30
|
}
|
|
31
31
|
}
|
|
32
|
-
listByPage(options) {
|
|
33
|
-
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
32
|
+
listByPage(query, options) {
|
|
33
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
34
34
|
}
|
|
35
35
|
update(id, data, options) {
|
|
36
36
|
return super
|
|
@@ -45,4 +45,3 @@ class AttendanceService extends Service {
|
|
|
45
45
|
return super.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' }).then((res) => Promise.resolve(options?.rawResponse ? res : res.status), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
46
46
|
}
|
|
47
47
|
}
|
|
48
|
-
export { AttendanceService };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiAuth } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options } from './index.js';
|
|
4
|
+
import { Auth } from '../models/auth.model.js';
|
|
5
|
+
export declare class AuthService extends Service {
|
|
6
|
+
private apiPath;
|
|
7
|
+
get(options?: {
|
|
8
|
+
rawResponse: true;
|
|
9
|
+
} & Options): Promise<AxiosResponse<ApiAuth, any>>;
|
|
10
|
+
get(options?: Options): Promise<Auth>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Service } from './index.js';
|
|
2
|
+
import { Auth } from '../models/auth.model.js';
|
|
3
|
+
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
|
+
export class AuthService extends Service {
|
|
5
|
+
constructor() {
|
|
6
|
+
super(...arguments);
|
|
7
|
+
this.apiPath = '/auth';
|
|
8
|
+
}
|
|
9
|
+
get(options) {
|
|
10
|
+
return super.fetch({ url: this.apiPath }, options).then((res) => Promise.resolve(options?.rawResponse ? res : new Auth(res.data)), (err) => Promise.reject(options?.rawResponse ? err : new ErrorResponse(err)));
|
|
11
|
+
}
|
|
12
|
+
}
|