rotacloud 1.0.39 → 1.0.41
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/query-params/leave-requests-query-params.interface.d.ts +1 -2
- package/dist/cjs/interfaces/shift.interface.d.ts +1 -1
- package/dist/cjs/models/SDKError.model.d.ts +11 -0
- package/dist/cjs/models/SDKError.model.js +15 -0
- package/dist/cjs/models/index.d.ts +29 -0
- package/dist/cjs/models/index.js +41 -0
- package/dist/cjs/models/location.model.d.ts +2 -7
- package/dist/cjs/models/location.model.js +1 -4
- package/dist/cjs/models/shift.model.d.ts +1 -1
- package/dist/cjs/models/terminal.model.d.ts +2 -6
- package/dist/cjs/models/terminal.model.js +1 -4
- package/dist/cjs/rotacloud.d.ts +1 -0
- package/dist/cjs/rotacloud.js +1 -0
- package/dist/cjs/services/accounts.service.js +3 -2
- package/dist/cjs/services/attendance.service.js +10 -5
- package/dist/cjs/services/auth.service.js +3 -2
- package/dist/cjs/services/availability.service.js +1 -2
- package/dist/cjs/services/daily-budgets.service.js +1 -2
- package/dist/cjs/services/daily-revenue.service.js +1 -2
- package/dist/cjs/services/day-notes.service.js +10 -5
- package/dist/cjs/services/days-off.service.js +2 -3
- package/dist/cjs/services/groups.service.js +10 -5
- package/dist/cjs/services/leave-embargoes.service.js +10 -5
- package/dist/cjs/services/leave-request.service.d.ts +4 -4
- package/dist/cjs/services/leave-request.service.js +10 -5
- package/dist/cjs/services/leave.service.js +10 -5
- package/dist/cjs/services/locations.service.js +10 -5
- package/dist/cjs/services/roles.service.js +10 -5
- package/dist/cjs/services/service.d.ts +2 -0
- package/dist/cjs/services/service.js +23 -1
- package/dist/cjs/services/settings.service.js +3 -2
- package/dist/cjs/services/shifts.service.d.ts +3 -3
- package/dist/cjs/services/shifts.service.js +21 -9
- package/dist/cjs/services/users.service.js +10 -5
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/query-params/leave-requests-query-params.interface.d.ts +1 -2
- package/dist/mjs/interfaces/shift.interface.d.ts +1 -1
- package/dist/mjs/models/SDKError.model.d.ts +11 -0
- package/dist/mjs/models/SDKError.model.js +10 -0
- package/dist/mjs/models/index.d.ts +29 -0
- package/dist/mjs/models/index.js +29 -0
- package/dist/mjs/models/location.model.d.ts +2 -7
- package/dist/mjs/models/location.model.js +0 -2
- package/dist/mjs/models/shift.model.d.ts +1 -1
- package/dist/mjs/models/terminal.model.d.ts +2 -6
- package/dist/mjs/models/terminal.model.js +0 -2
- package/dist/mjs/rotacloud.d.ts +1 -0
- package/dist/mjs/rotacloud.js +1 -0
- package/dist/mjs/services/accounts.service.js +3 -2
- package/dist/mjs/services/attendance.service.js +10 -5
- package/dist/mjs/services/auth.service.js +3 -2
- package/dist/mjs/services/availability.service.js +1 -2
- package/dist/mjs/services/daily-budgets.service.js +1 -2
- package/dist/mjs/services/daily-revenue.service.js +1 -2
- package/dist/mjs/services/day-notes.service.js +10 -5
- package/dist/mjs/services/days-off.service.js +2 -3
- package/dist/mjs/services/groups.service.js +10 -5
- package/dist/mjs/services/leave-embargoes.service.js +10 -5
- package/dist/mjs/services/leave-request.service.d.ts +4 -4
- package/dist/mjs/services/leave-request.service.js +10 -5
- package/dist/mjs/services/leave.service.js +10 -5
- package/dist/mjs/services/locations.service.js +10 -5
- package/dist/mjs/services/roles.service.js +10 -5
- package/dist/mjs/services/service.d.ts +2 -0
- package/dist/mjs/services/service.js +22 -1
- package/dist/mjs/services/settings.service.js +3 -2
- package/dist/mjs/services/shifts.service.d.ts +3 -3
- package/dist/mjs/services/shifts.service.js +21 -9
- package/dist/mjs/services/users.service.js +10 -5
- package/dist/mjs/version.js +1 -1
- package/package.json +2 -3
- package/src/interfaces/query-params/leave-requests-query-params.interface.ts +1 -2
- package/src/interfaces/shift.interface.ts +1 -1
- package/src/models/SDKError.model.ts +20 -0
- package/src/models/index.ts +29 -0
- package/src/models/location.model.ts +2 -8
- package/src/models/shift.model.ts +1 -1
- package/src/models/terminal.model.ts +2 -6
- package/src/rotacloud.ts +1 -0
- package/src/services/accounts.service.ts +3 -5
- package/src/services/attendance.service.ts +10 -17
- package/src/services/auth.service.ts +3 -5
- package/src/services/availability.service.ts +1 -5
- package/src/services/daily-budgets.service.ts +1 -5
- package/src/services/daily-revenue.service.ts +1 -5
- package/src/services/day-notes.service.ts +10 -18
- package/src/services/days-off.service.ts +2 -10
- package/src/services/groups.service.ts +10 -18
- package/src/services/leave-embargoes.service.ts +10 -17
- package/src/services/leave-request.service.ts +15 -22
- package/src/services/leave.service.ts +11 -17
- package/src/services/locations.service.ts +11 -17
- package/src/services/roles.service.ts +11 -17
- package/src/services/service.ts +29 -2
- package/src/services/settings.service.ts +4 -5
- package/src/services/shifts.service.ts +28 -34
- package/src/services/users.service.ts +11 -17
- package/src/version.ts +1 -1
- package/dist/cjs/models/error-response.model.d.ts +0 -8
- package/dist/cjs/models/error-response.model.js +0 -13
- package/dist/mjs/models/error-response.model.d.ts +0 -8
- package/dist/mjs/models/error-response.model.js +0 -8
- package/src/models/error-response.model.ts +0 -14
|
@@ -31,17 +31,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.LocationsService = void 0;
|
|
32
32
|
const index_js_1 = require("./index.js");
|
|
33
33
|
const location_model_js_1 = require("../models/location.model.js");
|
|
34
|
-
const error_response_model_js_1 = require("../models/error-response.model.js");
|
|
35
34
|
class LocationsService extends index_js_1.Service {
|
|
36
35
|
constructor() {
|
|
37
36
|
super(...arguments);
|
|
38
37
|
this.apiPath = '/locations';
|
|
39
38
|
}
|
|
40
39
|
create(data, options) {
|
|
41
|
-
return super
|
|
40
|
+
return super
|
|
41
|
+
.fetch({ url: `${this.apiPath}`, data, method: 'POST' })
|
|
42
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new location_model_js_1.Location(res.data)));
|
|
42
43
|
}
|
|
43
44
|
get(id, options) {
|
|
44
|
-
return super
|
|
45
|
+
return super
|
|
46
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
47
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new location_model_js_1.Location(res.data)));
|
|
45
48
|
}
|
|
46
49
|
list(query, options) {
|
|
47
50
|
const _super = Object.create(null, {
|
|
@@ -94,10 +97,12 @@ class LocationsService extends index_js_1.Service {
|
|
|
94
97
|
data,
|
|
95
98
|
method: 'POST',
|
|
96
99
|
})
|
|
97
|
-
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new location_model_js_1.Location(res.data))
|
|
100
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new location_model_js_1.Location(res.data)));
|
|
98
101
|
}
|
|
99
102
|
delete(id, options) {
|
|
100
|
-
return super
|
|
103
|
+
return super
|
|
104
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
105
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
exports.LocationsService = LocationsService;
|
|
@@ -31,17 +31,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.RolesService = void 0;
|
|
32
32
|
const index_js_1 = require("./index.js");
|
|
33
33
|
const role_model_js_1 = require("../models/role.model.js");
|
|
34
|
-
const error_response_model_js_1 = require("../models/error-response.model.js");
|
|
35
34
|
class RolesService extends index_js_1.Service {
|
|
36
35
|
constructor() {
|
|
37
36
|
super(...arguments);
|
|
38
37
|
this.apiPath = '/roles';
|
|
39
38
|
}
|
|
40
39
|
create(data, options) {
|
|
41
|
-
return super
|
|
40
|
+
return super
|
|
41
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
42
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new role_model_js_1.Role(res.data)));
|
|
42
43
|
}
|
|
43
44
|
get(id, options) {
|
|
44
|
-
return super
|
|
45
|
+
return super
|
|
46
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
47
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new role_model_js_1.Role(res.data)));
|
|
45
48
|
}
|
|
46
49
|
list(query, options) {
|
|
47
50
|
const _super = Object.create(null, {
|
|
@@ -94,10 +97,12 @@ class RolesService extends index_js_1.Service {
|
|
|
94
97
|
data,
|
|
95
98
|
method: 'POST',
|
|
96
99
|
})
|
|
97
|
-
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new role_model_js_1.Role(res.data))
|
|
100
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new role_model_js_1.Role(res.data)));
|
|
98
101
|
}
|
|
99
102
|
delete(id, options) {
|
|
100
|
-
return super
|
|
103
|
+
return super
|
|
104
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
105
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
exports.RolesService = RolesService;
|
|
@@ -25,6 +25,8 @@ export interface Options {
|
|
|
25
25
|
}
|
|
26
26
|
export declare abstract class Service<ApiResponse = any> {
|
|
27
27
|
protected client: AxiosInstance;
|
|
28
|
+
private initialiseAxios;
|
|
29
|
+
private parseClientError;
|
|
28
30
|
isLeaveRequest(endpoint?: string): boolean;
|
|
29
31
|
private buildQueryStr;
|
|
30
32
|
private parsePageLinkHeader;
|
|
@@ -32,6 +32,7 @@ const axios_1 = __importDefault(require("axios"));
|
|
|
32
32
|
const axios_retry_1 = __importDefault(require("axios-retry"));
|
|
33
33
|
const rotacloud_js_1 = require("../rotacloud.js");
|
|
34
34
|
const version_js_1 = require("../version.js");
|
|
35
|
+
const SDKError_model_js_1 = require("../models/SDKError.model.js");
|
|
35
36
|
var RetryStrategy;
|
|
36
37
|
(function (RetryStrategy) {
|
|
37
38
|
RetryStrategy["Exponential"] = "expo";
|
|
@@ -52,7 +53,28 @@ const DEFAULT_RETRY_STRATEGY_OPTIONS = {
|
|
|
52
53
|
};
|
|
53
54
|
class Service {
|
|
54
55
|
constructor() {
|
|
55
|
-
this.client =
|
|
56
|
+
this.client = this.initialiseAxios();
|
|
57
|
+
}
|
|
58
|
+
initialiseAxios() {
|
|
59
|
+
const client = axios_1.default.create();
|
|
60
|
+
client.interceptors.response.use((response) => response, (error) => {
|
|
61
|
+
const parsedError = this.parseClientError(error);
|
|
62
|
+
return Promise.reject(parsedError);
|
|
63
|
+
});
|
|
64
|
+
return client;
|
|
65
|
+
}
|
|
66
|
+
parseClientError(error) {
|
|
67
|
+
var _a;
|
|
68
|
+
if (!axios_1.default.isAxiosError(error))
|
|
69
|
+
return error;
|
|
70
|
+
const axiosErrorLocation = error.response || error.request;
|
|
71
|
+
const apiErrorMessage = (_a = axiosErrorLocation.data) === null || _a === void 0 ? void 0 : _a.error;
|
|
72
|
+
const sdkErrorParams = {
|
|
73
|
+
code: axiosErrorLocation.status,
|
|
74
|
+
message: apiErrorMessage || error.message,
|
|
75
|
+
data: axiosErrorLocation.data,
|
|
76
|
+
};
|
|
77
|
+
return new SDKError_model_js_1.SDKError(sdkErrorParams);
|
|
56
78
|
}
|
|
57
79
|
isLeaveRequest(endpoint) {
|
|
58
80
|
return endpoint === '/leave_requests';
|
|
@@ -3,14 +3,15 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.SettingsService = void 0;
|
|
4
4
|
const settings_model_js_1 = require("../models/settings.model.js");
|
|
5
5
|
const index_js_1 = require("./index.js");
|
|
6
|
-
const error_response_model_js_1 = require("../models/error-response.model.js");
|
|
7
6
|
class SettingsService extends index_js_1.Service {
|
|
8
7
|
constructor() {
|
|
9
8
|
super(...arguments);
|
|
10
9
|
this.apiPath = '/settings';
|
|
11
10
|
}
|
|
12
11
|
get(query, options) {
|
|
13
|
-
return super
|
|
12
|
+
return super
|
|
13
|
+
.fetch({ url: `${this.apiPath}`, params: query }, options)
|
|
14
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new settings_model_js_1.Settings(res.data)));
|
|
14
15
|
}
|
|
15
16
|
}
|
|
16
17
|
exports.SettingsService = SettingsService;
|
|
@@ -24,11 +24,11 @@ export declare class ShiftsService extends Service {
|
|
|
24
24
|
rawResponse: true;
|
|
25
25
|
} & Options): Promise<AxiosResponse<ApiShift, any>>;
|
|
26
26
|
update(id: number, data: Partial<ApiShift>, options: Options): Promise<Shift>;
|
|
27
|
-
delete(
|
|
28
|
-
delete(
|
|
27
|
+
delete(ids: number | number[]): Promise<number>;
|
|
28
|
+
delete(ids: number | number[], options: {
|
|
29
29
|
rawResponse: true;
|
|
30
30
|
} & Options): Promise<AxiosResponse<any, any>>;
|
|
31
|
-
delete(
|
|
31
|
+
delete(ids: number | number[], options: Options): Promise<number>;
|
|
32
32
|
acknowledge(data: number[]): Promise<number>;
|
|
33
33
|
acknowledge(data: number[], options: {
|
|
34
34
|
rawResponse: true;
|
|
@@ -31,17 +31,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.ShiftsService = void 0;
|
|
32
32
|
const index_js_1 = require("./index.js");
|
|
33
33
|
const shift_model_js_1 = require("../models/shift.model.js");
|
|
34
|
-
const error_response_model_js_1 = require("../models/error-response.model.js");
|
|
35
34
|
class ShiftsService extends index_js_1.Service {
|
|
36
35
|
constructor() {
|
|
37
36
|
super(...arguments);
|
|
38
37
|
this.apiPath = '/shifts';
|
|
39
38
|
}
|
|
40
39
|
create(data, options) {
|
|
41
|
-
return super
|
|
40
|
+
return super
|
|
41
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
42
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new shift_model_js_1.Shift(res.data)));
|
|
42
43
|
}
|
|
43
44
|
get(id, options) {
|
|
44
|
-
return super
|
|
45
|
+
return super
|
|
46
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
47
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new shift_model_js_1.Shift(res.data)));
|
|
45
48
|
}
|
|
46
49
|
list(query, options) {
|
|
47
50
|
const _super = Object.create(null, {
|
|
@@ -94,19 +97,28 @@ class ShiftsService extends index_js_1.Service {
|
|
|
94
97
|
data,
|
|
95
98
|
method: 'POST',
|
|
96
99
|
})
|
|
97
|
-
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new shift_model_js_1.Shift(res.data))
|
|
100
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new shift_model_js_1.Shift(res.data)));
|
|
98
101
|
}
|
|
99
|
-
delete(
|
|
100
|
-
|
|
102
|
+
delete(ids, options) {
|
|
103
|
+
const params = typeof ids !== 'number'
|
|
104
|
+
? { url: this.apiPath, data: ids, method: 'DELETE' }
|
|
105
|
+
: { url: `${this.apiPath}/${ids}`, method: 'DELETE' };
|
|
106
|
+
return super.fetch(params).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
101
107
|
}
|
|
102
108
|
acknowledge(data, options) {
|
|
103
|
-
return super
|
|
109
|
+
return super
|
|
110
|
+
.fetch({ url: '/shifts_acknowledged', data, method: 'POST' })
|
|
111
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
104
112
|
}
|
|
105
113
|
publish(data, options) {
|
|
106
|
-
return super
|
|
114
|
+
return super
|
|
115
|
+
.fetch({ url: '/shifts_published', data, method: 'POST' })
|
|
116
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
107
117
|
}
|
|
108
118
|
unpublish(data, options) {
|
|
109
|
-
return super
|
|
119
|
+
return super
|
|
120
|
+
.fetch({ url: '/shifts_published', data, method: 'DELETE' })
|
|
121
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
110
122
|
}
|
|
111
123
|
}
|
|
112
124
|
exports.ShiftsService = ShiftsService;
|
|
@@ -31,17 +31,20 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
31
31
|
exports.UsersService = void 0;
|
|
32
32
|
const index_js_1 = require("./index.js");
|
|
33
33
|
const user_model_js_1 = require("../models/user.model.js");
|
|
34
|
-
const error_response_model_js_1 = require("../models/error-response.model.js");
|
|
35
34
|
class UsersService extends index_js_1.Service {
|
|
36
35
|
constructor() {
|
|
37
36
|
super(...arguments);
|
|
38
37
|
this.apiPath = '/users';
|
|
39
38
|
}
|
|
40
39
|
create(data, options) {
|
|
41
|
-
return super
|
|
40
|
+
return super
|
|
41
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
42
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new user_model_js_1.User(res.data)));
|
|
42
43
|
}
|
|
43
44
|
get(id, options) {
|
|
44
|
-
return super
|
|
45
|
+
return super
|
|
46
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
47
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new user_model_js_1.User(res.data)));
|
|
45
48
|
}
|
|
46
49
|
list(query, options) {
|
|
47
50
|
const _super = Object.create(null, {
|
|
@@ -94,10 +97,12 @@ class UsersService extends index_js_1.Service {
|
|
|
94
97
|
data,
|
|
95
98
|
method: 'POST',
|
|
96
99
|
})
|
|
97
|
-
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new user_model_js_1.User(res.data))
|
|
100
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new user_model_js_1.User(res.data)));
|
|
98
101
|
}
|
|
99
102
|
delete(id, options) {
|
|
100
|
-
return super
|
|
103
|
+
return super
|
|
104
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
105
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
101
106
|
}
|
|
102
107
|
}
|
|
103
108
|
exports.UsersService = UsersService;
|
package/dist/cjs/version.js
CHANGED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface SDKErrorConfig {
|
|
2
|
+
message?: string;
|
|
3
|
+
code?: number;
|
|
4
|
+
data?: unknown;
|
|
5
|
+
}
|
|
6
|
+
export declare class SDKError extends Error {
|
|
7
|
+
readonly code?: number;
|
|
8
|
+
readonly data?: unknown;
|
|
9
|
+
name: string;
|
|
10
|
+
constructor(errorConfig: SDKErrorConfig);
|
|
11
|
+
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export class SDKError extends Error {
|
|
2
|
+
constructor(errorConfig) {
|
|
3
|
+
super(errorConfig.message);
|
|
4
|
+
this.name = this.constructor.name;
|
|
5
|
+
Error.captureStackTrace?.(this, SDKError);
|
|
6
|
+
// optional chaining needed as is v8 specific https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error#static_methods
|
|
7
|
+
this.data = errorConfig.data;
|
|
8
|
+
this.code = errorConfig.code;
|
|
9
|
+
}
|
|
10
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './account.model.js';
|
|
2
|
+
export * from './attendance.model.js';
|
|
3
|
+
export * from './auth.model.js';
|
|
4
|
+
export * from './availability-pattern.model.js';
|
|
5
|
+
export * from './availability.model.js';
|
|
6
|
+
export * from './daily-budgets.model.js';
|
|
7
|
+
export * from './daily-revenue.model.js';
|
|
8
|
+
export * from './day-note.model.js';
|
|
9
|
+
export * from './days-off-pattern.model.js';
|
|
10
|
+
export * from './days-off.model.js';
|
|
11
|
+
export * from './document.model.js';
|
|
12
|
+
export * from './SDKError.model.js';
|
|
13
|
+
export * from './group.model.js';
|
|
14
|
+
export * from './holiday-allowance-custom.model.js';
|
|
15
|
+
export * from './holiday-allowance.model.js';
|
|
16
|
+
export * from './leave-embargo.model.js';
|
|
17
|
+
export * from './leave-request.model.js';
|
|
18
|
+
export * from './leave-type.model.js';
|
|
19
|
+
export * from './leave.model.js';
|
|
20
|
+
export * from './location.model.js';
|
|
21
|
+
export * from './logbook-category.model.js';
|
|
22
|
+
export * from './logbook-event.model.js';
|
|
23
|
+
export * from './memo.model.js';
|
|
24
|
+
export * from './pay-period.model.js';
|
|
25
|
+
export * from './role.model.js';
|
|
26
|
+
export * from './settings.model.js';
|
|
27
|
+
export * from './shift.model.js';
|
|
28
|
+
export * from './terminal.model.js';
|
|
29
|
+
export * from './user.model.js';
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export * from './account.model.js';
|
|
2
|
+
export * from './attendance.model.js';
|
|
3
|
+
export * from './auth.model.js';
|
|
4
|
+
export * from './availability-pattern.model.js';
|
|
5
|
+
export * from './availability.model.js';
|
|
6
|
+
export * from './daily-budgets.model.js';
|
|
7
|
+
export * from './daily-revenue.model.js';
|
|
8
|
+
export * from './day-note.model.js';
|
|
9
|
+
export * from './days-off-pattern.model.js';
|
|
10
|
+
export * from './days-off.model.js';
|
|
11
|
+
export * from './document.model.js';
|
|
12
|
+
export * from './SDKError.model.js';
|
|
13
|
+
export * from './group.model.js';
|
|
14
|
+
export * from './holiday-allowance-custom.model.js';
|
|
15
|
+
export * from './holiday-allowance.model.js';
|
|
16
|
+
export * from './leave-embargo.model.js';
|
|
17
|
+
export * from './leave-request.model.js';
|
|
18
|
+
export * from './leave-type.model.js';
|
|
19
|
+
export * from './leave.model.js';
|
|
20
|
+
export * from './location.model.js';
|
|
21
|
+
export * from './logbook-category.model.js';
|
|
22
|
+
export * from './logbook-event.model.js';
|
|
23
|
+
export * from './memo.model.js';
|
|
24
|
+
export * from './pay-period.model.js';
|
|
25
|
+
export * from './role.model.js';
|
|
26
|
+
export * from './settings.model.js';
|
|
27
|
+
export * from './shift.model.js';
|
|
28
|
+
export * from './terminal.model.js';
|
|
29
|
+
export * from './user.model.js';
|
|
@@ -1,15 +1,10 @@
|
|
|
1
|
-
import { ApiLocation } from '../interfaces/index.js';
|
|
2
|
-
export declare class LatLngObject {
|
|
3
|
-
lat: number;
|
|
4
|
-
lng: number;
|
|
5
|
-
radius: number;
|
|
6
|
-
}
|
|
1
|
+
import { ApiLocation, ApiLocationCoordinate } from '../interfaces/index.js';
|
|
7
2
|
export declare class Location {
|
|
8
3
|
id: number;
|
|
9
4
|
name: string;
|
|
10
5
|
deleted: boolean;
|
|
11
6
|
address: string;
|
|
12
|
-
location:
|
|
7
|
+
location: ApiLocationCoordinate;
|
|
13
8
|
timezone: number;
|
|
14
9
|
users: number[];
|
|
15
10
|
managers: number[];
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
lat: number;
|
|
3
|
-
lng: number;
|
|
4
|
-
radius: number;
|
|
5
|
-
}
|
|
1
|
+
import { ApiLocationCoordinate } from '../interfaces/index.js';
|
|
6
2
|
export declare class Terminal {
|
|
7
3
|
id: number;
|
|
8
4
|
deleted: boolean;
|
|
@@ -12,7 +8,7 @@ export declare class Terminal {
|
|
|
12
8
|
device: string;
|
|
13
9
|
version: string;
|
|
14
10
|
ip: string;
|
|
15
|
-
location:
|
|
11
|
+
location: ApiLocationCoordinate;
|
|
16
12
|
timezone: number;
|
|
17
13
|
require_photo: boolean;
|
|
18
14
|
require_photo_breaks: boolean;
|
package/dist/mjs/rotacloud.d.ts
CHANGED
package/dist/mjs/rotacloud.js
CHANGED
|
@@ -1,13 +1,14 @@
|
|
|
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';
|
|
4
3
|
class AccountsService extends Service {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
7
6
|
this.apiPath = '/accounts';
|
|
8
7
|
}
|
|
9
8
|
get(id, options) {
|
|
10
|
-
return super
|
|
9
|
+
return super
|
|
10
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
11
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Account(res.data)));
|
|
11
12
|
}
|
|
12
13
|
async *list(options) {
|
|
13
14
|
for await (const res of super.iterator({ url: this.apiPath }, options)) {
|
|
@@ -1,16 +1,19 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Attendance } from '../models/attendance.model.js';
|
|
3
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
3
|
export class AttendanceService extends Service {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
7
6
|
this.apiPath = '/attendance';
|
|
8
7
|
}
|
|
9
8
|
create(data, options) {
|
|
10
|
-
return super
|
|
9
|
+
return super
|
|
10
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
11
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data)));
|
|
11
12
|
}
|
|
12
13
|
get(id, options) {
|
|
13
|
-
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) =>
|
|
14
|
+
return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => {
|
|
15
|
+
return Promise.resolve(options?.rawResponse ? res : new Attendance(res.data));
|
|
16
|
+
});
|
|
14
17
|
}
|
|
15
18
|
async *list(query, options) {
|
|
16
19
|
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
@@ -34,9 +37,11 @@ export class AttendanceService extends Service {
|
|
|
34
37
|
data,
|
|
35
38
|
method: 'POST',
|
|
36
39
|
})
|
|
37
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data))
|
|
40
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Attendance(res.data)));
|
|
38
41
|
}
|
|
39
42
|
delete(id, options) {
|
|
40
|
-
return super
|
|
43
|
+
return super
|
|
44
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
45
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Auth } from '../models/auth.model.js';
|
|
3
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
3
|
export class AuthService extends Service {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
7
6
|
this.apiPath = '/auth';
|
|
8
7
|
}
|
|
9
8
|
get(options) {
|
|
10
|
-
return super
|
|
9
|
+
return super
|
|
10
|
+
.fetch({ url: this.apiPath }, options)
|
|
11
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Auth(res.data)));
|
|
11
12
|
}
|
|
12
13
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { Availability } from '../models/availability.model.js';
|
|
3
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
3
|
export class AvailabilityService extends Service {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
@@ -13,7 +12,7 @@ export class AvailabilityService extends Service {
|
|
|
13
12
|
data,
|
|
14
13
|
method: 'POST',
|
|
15
14
|
})
|
|
16
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : new Availability(res.data))
|
|
15
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new Availability(res.data)));
|
|
17
16
|
}
|
|
18
17
|
create(data, options) {
|
|
19
18
|
return this.update(data, options);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { DailyBudgets } from '../models/daily-budgets.model.js';
|
|
3
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
3
|
export class DailyBudgetsService extends Service {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
@@ -28,6 +27,6 @@ export class DailyBudgetsService extends Service {
|
|
|
28
27
|
data,
|
|
29
28
|
method: 'POST',
|
|
30
29
|
})
|
|
31
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status)
|
|
30
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
32
31
|
}
|
|
33
32
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
2
|
import { DailyRevenue } from '../models/daily-revenue.model.js';
|
|
3
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
4
3
|
export class DailyRevenueService extends Service {
|
|
5
4
|
constructor() {
|
|
6
5
|
super(...arguments);
|
|
@@ -28,6 +27,6 @@ export class DailyRevenueService extends Service {
|
|
|
28
27
|
data,
|
|
29
28
|
method: 'POST',
|
|
30
29
|
})
|
|
31
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status)
|
|
30
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
32
31
|
}
|
|
33
32
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
3
2
|
import { DayNote } from '../models/day-note.model.js';
|
|
4
3
|
export class DayNotesService extends Service {
|
|
5
4
|
constructor() {
|
|
@@ -7,10 +6,14 @@ export class DayNotesService extends Service {
|
|
|
7
6
|
this.apiPath = '/day_notes';
|
|
8
7
|
}
|
|
9
8
|
create(data, options) {
|
|
10
|
-
return super
|
|
9
|
+
return super
|
|
10
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
11
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new DayNote(res.data)));
|
|
11
12
|
}
|
|
12
13
|
get(id, options) {
|
|
13
|
-
return super
|
|
14
|
+
return super
|
|
15
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
16
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new DayNote(res.data)));
|
|
14
17
|
}
|
|
15
18
|
async *list(query, options) {
|
|
16
19
|
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
@@ -34,9 +37,11 @@ export class DayNotesService extends Service {
|
|
|
34
37
|
data,
|
|
35
38
|
method: 'POST',
|
|
36
39
|
})
|
|
37
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : new DayNote(res.data))
|
|
40
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : new DayNote(res.data)));
|
|
38
41
|
}
|
|
39
42
|
delete(id, options) {
|
|
40
|
-
return super
|
|
43
|
+
return super
|
|
44
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
45
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
41
46
|
}
|
|
42
47
|
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Service } from './index.js';
|
|
2
|
-
import { ErrorResponse } from '../models/error-response.model.js';
|
|
3
2
|
import { DaysOff } from '../models/days-off.model.js';
|
|
4
3
|
export class DaysOffService extends Service {
|
|
5
4
|
constructor() {
|
|
@@ -16,7 +15,7 @@ export class DaysOffService extends Service {
|
|
|
16
15
|
},
|
|
17
16
|
method: 'POST',
|
|
18
17
|
})
|
|
19
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status)
|
|
18
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
20
19
|
}
|
|
21
20
|
async *list(query, options) {
|
|
22
21
|
for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
|
|
@@ -43,6 +42,6 @@ export class DaysOffService extends Service {
|
|
|
43
42
|
users,
|
|
44
43
|
},
|
|
45
44
|
})
|
|
46
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status)
|
|
45
|
+
.then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
|
|
47
46
|
}
|
|
48
47
|
}
|