rotacloud 1.0.48 → 1.0.51
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/interfaces/index.d.ts +4 -0
- package/dist/cjs/interfaces/index.js +4 -0
- package/dist/cjs/interfaces/logbook-category.interface.d.ts +1 -0
- package/dist/cjs/interfaces/pin.interface.d.ts +3 -0
- package/dist/cjs/interfaces/pin.interface.js +2 -0
- package/dist/cjs/interfaces/terminal.interface.d.ts +20 -0
- package/dist/cjs/interfaces/terminal.interface.js +2 -0
- package/dist/cjs/interfaces/user.interface.d.ts +8 -1
- package/dist/cjs/interfaces/users-clocked-in.interface.d.ts +13 -0
- package/dist/cjs/interfaces/users-clocked-in.interface.js +2 -0
- package/dist/cjs/interfaces/users-clocked-out.interface.d.ts +26 -0
- package/dist/cjs/interfaces/users-clocked-out.interface.js +2 -0
- package/dist/cjs/models/attendance.model.d.ts +5 -5
- package/dist/cjs/models/availability-pattern.model.js +12 -0
- package/dist/cjs/models/daily-revenue.model.js +3 -0
- package/dist/cjs/models/index.d.ts +2 -0
- package/dist/cjs/models/index.js +2 -0
- package/dist/cjs/models/logbook-category.model.d.ts +1 -1
- package/dist/cjs/models/logbook-category.model.js +2 -0
- package/dist/cjs/models/terminal.model.d.ts +7 -6
- package/dist/cjs/models/terminal.model.js +14 -0
- package/dist/cjs/models/users-clocked-in.model.d.ts +14 -0
- package/dist/cjs/models/users-clocked-in.model.js +19 -0
- package/dist/cjs/models/users-clocked-out.model.d.ts +27 -0
- package/dist/cjs/models/users-clocked-out.model.js +31 -0
- package/dist/cjs/rotacloud.d.ts +7 -4
- package/dist/cjs/rotacloud.js +7 -4
- package/dist/cjs/services/index.d.ts +6 -1
- package/dist/cjs/services/index.js +6 -1
- package/dist/cjs/services/pins.service.d.ts +11 -0
- package/dist/cjs/services/pins.service.js +16 -0
- package/dist/cjs/services/terminals-active.service.d.ts +35 -0
- package/dist/cjs/services/terminals-active.service.js +103 -0
- package/dist/cjs/services/terminals.service.d.ts +32 -0
- package/dist/cjs/services/terminals.service.js +108 -0
- package/dist/cjs/services/users-clock-in.service.d.ts +62 -0
- package/dist/cjs/services/users-clock-in.service.js +118 -0
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/index.d.ts +4 -0
- package/dist/mjs/interfaces/index.js +4 -0
- package/dist/mjs/interfaces/logbook-category.interface.d.ts +1 -0
- package/dist/mjs/interfaces/pin.interface.d.ts +3 -0
- package/dist/mjs/interfaces/pin.interface.js +1 -0
- package/dist/mjs/interfaces/terminal.interface.d.ts +20 -0
- package/dist/mjs/interfaces/terminal.interface.js +1 -0
- package/dist/mjs/interfaces/user.interface.d.ts +8 -1
- package/dist/mjs/interfaces/users-clocked-in.interface.d.ts +13 -0
- package/dist/mjs/interfaces/users-clocked-in.interface.js +1 -0
- package/dist/mjs/interfaces/users-clocked-out.interface.d.ts +26 -0
- package/dist/mjs/interfaces/users-clocked-out.interface.js +1 -0
- package/dist/mjs/models/attendance.model.d.ts +5 -5
- package/dist/mjs/models/availability-pattern.model.js +12 -0
- package/dist/mjs/models/daily-revenue.model.js +3 -0
- package/dist/mjs/models/index.d.ts +2 -0
- package/dist/mjs/models/index.js +2 -0
- package/dist/mjs/models/logbook-category.model.d.ts +1 -1
- package/dist/mjs/models/logbook-category.model.js +1 -0
- package/dist/mjs/models/terminal.model.d.ts +7 -6
- package/dist/mjs/models/terminal.model.js +14 -0
- package/dist/mjs/models/users-clocked-in.model.d.ts +14 -0
- package/dist/mjs/models/users-clocked-in.model.js +14 -0
- package/dist/mjs/models/users-clocked-out.model.d.ts +27 -0
- package/dist/mjs/models/users-clocked-out.model.js +26 -0
- package/dist/mjs/rotacloud.d.ts +7 -4
- package/dist/mjs/rotacloud.js +7 -4
- package/dist/mjs/services/index.d.ts +6 -1
- package/dist/mjs/services/index.js +6 -1
- package/dist/mjs/services/pins.service.d.ts +11 -0
- package/dist/mjs/services/pins.service.js +12 -0
- package/dist/mjs/services/terminals-active.service.d.ts +35 -0
- package/dist/mjs/services/terminals-active.service.js +43 -0
- package/dist/mjs/services/terminals.service.d.ts +32 -0
- package/dist/mjs/services/terminals.service.js +48 -0
- package/dist/mjs/services/users-clock-in.service.d.ts +62 -0
- package/dist/mjs/services/users-clock-in.service.js +57 -0
- package/dist/mjs/version.js +1 -1
- package/package.json +2 -2
- package/src/interfaces/index.ts +4 -0
- package/src/interfaces/logbook-category.interface.ts +1 -0
- package/src/interfaces/pin.interface.ts +16 -0
- package/src/interfaces/terminal.interface.ts +21 -0
- package/src/interfaces/user.interface.ts +9 -1
- package/src/interfaces/users-clocked-in.interface.ts +14 -0
- package/src/interfaces/users-clocked-out.interface.ts +27 -0
- package/src/models/attendance.model.ts +5 -5
- package/src/models/availability-pattern.model.ts +12 -0
- package/src/models/daily-revenue.model.ts +3 -0
- package/src/models/days-off.model.ts +1 -0
- package/src/models/index.ts +2 -0
- package/src/models/logbook-category.model.ts +2 -1
- package/src/models/terminal.model.ts +21 -6
- package/src/models/toil-accrual.model.ts +1 -0
- package/src/models/toil-allowance.model.ts +1 -0
- package/src/models/users-clocked-in.model.ts +27 -0
- package/src/models/users-clocked-out.model.ts +52 -0
- package/src/rotacloud.ts +11 -3
- package/src/services/index.ts +6 -1
- package/src/services/pins.service.ts +16 -0
- package/src/services/terminals-active.service.ts +75 -0
- package/src/services/terminals.service.ts +78 -0
- package/src/services/users-clock-in.service.ts +125 -0
- package/src/version.ts +1 -1
|
@@ -0,0 +1,103 @@
|
|
|
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
|
+
};
|
|
11
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
+
var m = o[Symbol.asyncIterator], i;
|
|
14
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
+
};
|
|
18
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
19
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
20
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
21
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
22
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
23
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
24
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
25
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
26
|
+
function fulfill(value) { resume("next", value); }
|
|
27
|
+
function reject(value) { resume("throw", value); }
|
|
28
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.TerminalsActiveService = void 0;
|
|
32
|
+
const index_js_1 = require("./index.js");
|
|
33
|
+
const terminal_model_js_1 = require("../models/terminal.model.js");
|
|
34
|
+
class TerminalsActiveService extends index_js_1.Service {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.apiPath = '/terminals_active';
|
|
38
|
+
}
|
|
39
|
+
launchTerminal(data, options) {
|
|
40
|
+
return super
|
|
41
|
+
.fetch({
|
|
42
|
+
url: `${this.apiPath}`,
|
|
43
|
+
data,
|
|
44
|
+
method: 'POST',
|
|
45
|
+
})
|
|
46
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new terminal_model_js_1.Terminal(res.data)));
|
|
47
|
+
}
|
|
48
|
+
pingTerminal(id, data, options) {
|
|
49
|
+
return super
|
|
50
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
|
|
51
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
|
|
52
|
+
}
|
|
53
|
+
list(options) {
|
|
54
|
+
const _super = Object.create(null, {
|
|
55
|
+
iterator: { get: () => super.iterator }
|
|
56
|
+
});
|
|
57
|
+
return __asyncGenerator(this, arguments, function* list_1() {
|
|
58
|
+
var e_1, _a;
|
|
59
|
+
try {
|
|
60
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
61
|
+
const res = _c.value;
|
|
62
|
+
yield yield __await(new terminal_model_js_1.Terminal(res));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
66
|
+
finally {
|
|
67
|
+
try {
|
|
68
|
+
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
69
|
+
}
|
|
70
|
+
finally { if (e_1) throw e_1.error; }
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
listAll(options) {
|
|
75
|
+
var e_2, _a;
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const users = [];
|
|
78
|
+
try {
|
|
79
|
+
for (var _b = __asyncValues(this.list(options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
80
|
+
const user = _c.value;
|
|
81
|
+
users.push(user);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
85
|
+
finally {
|
|
86
|
+
try {
|
|
87
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
88
|
+
}
|
|
89
|
+
finally { if (e_2) throw e_2.error; }
|
|
90
|
+
}
|
|
91
|
+
return users;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
listByPage(options) {
|
|
95
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
96
|
+
}
|
|
97
|
+
closeTerminal(id, options) {
|
|
98
|
+
return super
|
|
99
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
100
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
exports.TerminalsActiveService = TerminalsActiveService;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiTerminal } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
|
+
import { Terminal } from '../models/terminal.model.js';
|
|
5
|
+
declare type RequiredProps = 'name' | 'timezone';
|
|
6
|
+
declare class TerminalsService extends Service {
|
|
7
|
+
private apiPath;
|
|
8
|
+
create(data: RequirementsOf<ApiTerminal, RequiredProps>): Promise<Terminal>;
|
|
9
|
+
create(data: RequirementsOf<ApiTerminal, RequiredProps>, options: {
|
|
10
|
+
rawResponse: true;
|
|
11
|
+
} & Options): Promise<AxiosResponse<ApiTerminal, any>>;
|
|
12
|
+
create(data: RequirementsOf<ApiTerminal, RequiredProps>, options: Options): Promise<Terminal>;
|
|
13
|
+
get(id: number): Promise<Terminal>;
|
|
14
|
+
get(id: number, options: {
|
|
15
|
+
rawResponse: true;
|
|
16
|
+
} & Options): Promise<AxiosResponse<ApiTerminal, any>>;
|
|
17
|
+
get(id: number, options: Options): Promise<Terminal>;
|
|
18
|
+
update(id: number, data: Partial<ApiTerminal>): Promise<Terminal>;
|
|
19
|
+
update(id: number, data: Partial<ApiTerminal>, options: {
|
|
20
|
+
rawResponse: true;
|
|
21
|
+
} & Options): Promise<AxiosResponse<ApiTerminal, any>>;
|
|
22
|
+
update(id: number, data: Partial<ApiTerminal>, options: Options): Promise<Terminal>;
|
|
23
|
+
closeTerminal(id: number): Promise<number>;
|
|
24
|
+
closeTerminal(id: number, options: {
|
|
25
|
+
rawResponse: true;
|
|
26
|
+
} & Options): Promise<AxiosResponse<number, any>>;
|
|
27
|
+
closeTerminal(id: number, options: Options): Promise<number>;
|
|
28
|
+
list(options?: Options): AsyncGenerator<Terminal, void, unknown>;
|
|
29
|
+
listAll(options?: Options): Promise<Terminal[]>;
|
|
30
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiTerminal[], any>, any, unknown>;
|
|
31
|
+
}
|
|
32
|
+
export { TerminalsService };
|
|
@@ -0,0 +1,108 @@
|
|
|
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
|
+
};
|
|
11
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
+
var m = o[Symbol.asyncIterator], i;
|
|
14
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
+
};
|
|
18
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
19
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
20
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
21
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
22
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
23
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
24
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
25
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
26
|
+
function fulfill(value) { resume("next", value); }
|
|
27
|
+
function reject(value) { resume("throw", value); }
|
|
28
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.TerminalsService = void 0;
|
|
32
|
+
const index_js_1 = require("./index.js");
|
|
33
|
+
const terminal_model_js_1 = require("../models/terminal.model.js");
|
|
34
|
+
class TerminalsService extends index_js_1.Service {
|
|
35
|
+
constructor() {
|
|
36
|
+
super(...arguments);
|
|
37
|
+
this.apiPath = '/terminals';
|
|
38
|
+
}
|
|
39
|
+
create(data, options) {
|
|
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 terminal_model_js_1.Terminal(res.data)));
|
|
43
|
+
}
|
|
44
|
+
get(id, options) {
|
|
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 terminal_model_js_1.Terminal(res.data)));
|
|
48
|
+
}
|
|
49
|
+
update(id, data, options) {
|
|
50
|
+
return super
|
|
51
|
+
.fetch({
|
|
52
|
+
url: `${this.apiPath}/${id}`,
|
|
53
|
+
data,
|
|
54
|
+
method: 'POST',
|
|
55
|
+
})
|
|
56
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new terminal_model_js_1.Terminal(res.data)));
|
|
57
|
+
}
|
|
58
|
+
closeTerminal(id, options) {
|
|
59
|
+
return super
|
|
60
|
+
.fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
|
|
61
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
|
|
62
|
+
}
|
|
63
|
+
list(options) {
|
|
64
|
+
const _super = Object.create(null, {
|
|
65
|
+
iterator: { get: () => super.iterator }
|
|
66
|
+
});
|
|
67
|
+
return __asyncGenerator(this, arguments, function* list_1() {
|
|
68
|
+
var e_1, _a;
|
|
69
|
+
try {
|
|
70
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
71
|
+
const res = _c.value;
|
|
72
|
+
yield yield __await(new terminal_model_js_1.Terminal(res));
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
76
|
+
finally {
|
|
77
|
+
try {
|
|
78
|
+
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
79
|
+
}
|
|
80
|
+
finally { if (e_1) throw e_1.error; }
|
|
81
|
+
}
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
listAll(options) {
|
|
85
|
+
var e_2, _a;
|
|
86
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
87
|
+
const users = [];
|
|
88
|
+
try {
|
|
89
|
+
for (var _b = __asyncValues(this.list(options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
90
|
+
const user = _c.value;
|
|
91
|
+
users.push(user);
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
95
|
+
finally {
|
|
96
|
+
try {
|
|
97
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
98
|
+
}
|
|
99
|
+
finally { if (e_2) throw e_2.error; }
|
|
100
|
+
}
|
|
101
|
+
return users;
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
listByPage(options) {
|
|
105
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
exports.TerminalsService = TerminalsService;
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { AxiosResponse } from 'axios';
|
|
2
|
+
import { ApiUserBreak, ApiUserClockedIn, ApiUserClockedOut, ApiTerminalLocation } from '../interfaces/index.js';
|
|
3
|
+
import { Service, Options, RequirementsOf } from './index.js';
|
|
4
|
+
import { UserClockedIn, UserClockedOut } from '../models/index.js';
|
|
5
|
+
interface UserClockIn {
|
|
6
|
+
method: string;
|
|
7
|
+
shift: number;
|
|
8
|
+
terminal: number;
|
|
9
|
+
user: number;
|
|
10
|
+
photo?: string;
|
|
11
|
+
location: ApiTerminalLocation;
|
|
12
|
+
}
|
|
13
|
+
interface UserClockOut extends Omit<UserClockIn, 'user' | 'shift'> {
|
|
14
|
+
}
|
|
15
|
+
interface UserBreak {
|
|
16
|
+
method: string;
|
|
17
|
+
action: string;
|
|
18
|
+
terminal: number;
|
|
19
|
+
photo?: string;
|
|
20
|
+
location: ApiTerminalLocation;
|
|
21
|
+
}
|
|
22
|
+
declare class UserBreak {
|
|
23
|
+
start_time: number;
|
|
24
|
+
start_location: ApiTerminalLocation;
|
|
25
|
+
end_time: number | null;
|
|
26
|
+
end_location: ApiTerminalLocation | null;
|
|
27
|
+
constructor(apiUserBreak: ApiUserBreak);
|
|
28
|
+
}
|
|
29
|
+
declare type RequiredPropsClockIn = 'method';
|
|
30
|
+
declare type RequiredPropsBreak = 'method' | 'action';
|
|
31
|
+
declare class UsersClockInService extends Service {
|
|
32
|
+
private apiPath;
|
|
33
|
+
getClockedInUser(id: number): Promise<UserClockedIn>;
|
|
34
|
+
getClockedInUser(id: number, options: {
|
|
35
|
+
rawResponse: true;
|
|
36
|
+
} & Options): Promise<AxiosResponse<ApiUserClockedIn, any>>;
|
|
37
|
+
getClockedInUser(id: number, options: Options): Promise<UserClockedIn>;
|
|
38
|
+
list(options?: Options): AsyncGenerator<UserClockedIn, void, unknown>;
|
|
39
|
+
listAll(options?: Options): Promise<UserClockedIn[]>;
|
|
40
|
+
listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiUserClockedIn[], any>, any, unknown>;
|
|
41
|
+
clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>): Promise<UserClockedIn>;
|
|
42
|
+
clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>, options: {
|
|
43
|
+
rawResponse: true;
|
|
44
|
+
} & Options): Promise<AxiosResponse<ApiUserClockedIn, any>>;
|
|
45
|
+
clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>, options: Options): Promise<UserClockedIn>;
|
|
46
|
+
clockOut(id: number, data: UserClockOut): Promise<UserClockedOut>;
|
|
47
|
+
clockOut(id: number, data: UserClockOut, options: {
|
|
48
|
+
rawResponse: true;
|
|
49
|
+
} & Options): Promise<AxiosResponse<ApiUserClockedOut, any>>;
|
|
50
|
+
clockOut(id: number, data: UserClockOut, options: Options): Promise<UserClockedOut>;
|
|
51
|
+
startBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>): Promise<UserBreak>;
|
|
52
|
+
startBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: {
|
|
53
|
+
rawResponse: true;
|
|
54
|
+
} & Options): Promise<AxiosResponse<ApiUserBreak, any>>;
|
|
55
|
+
startBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: Options): Promise<UserBreak>;
|
|
56
|
+
endBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>): Promise<UserBreak>;
|
|
57
|
+
endBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: {
|
|
58
|
+
rawResponse: true;
|
|
59
|
+
} & Options): Promise<AxiosResponse<ApiUserBreak, any>>;
|
|
60
|
+
endBreak(id: number, data: RequirementsOf<UserBreak, RequiredPropsBreak>, options: Options): Promise<UserBreak>;
|
|
61
|
+
}
|
|
62
|
+
export { UsersClockInService };
|
|
@@ -0,0 +1,118 @@
|
|
|
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
|
+
};
|
|
11
|
+
var __asyncValues = (this && this.__asyncValues) || function (o) {
|
|
12
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
13
|
+
var m = o[Symbol.asyncIterator], i;
|
|
14
|
+
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
15
|
+
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
16
|
+
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
17
|
+
};
|
|
18
|
+
var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
|
|
19
|
+
var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
|
|
20
|
+
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
21
|
+
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
22
|
+
return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
23
|
+
function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
|
|
24
|
+
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
25
|
+
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
26
|
+
function fulfill(value) { resume("next", value); }
|
|
27
|
+
function reject(value) { resume("throw", value); }
|
|
28
|
+
function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
+
exports.UsersClockInService = void 0;
|
|
32
|
+
const index_js_1 = require("./index.js");
|
|
33
|
+
const index_js_2 = require("../models/index.js");
|
|
34
|
+
class UserBreak {
|
|
35
|
+
constructor(apiUserBreak) {
|
|
36
|
+
var _a, _b;
|
|
37
|
+
this.start_time = apiUserBreak.start_time;
|
|
38
|
+
this.start_location = apiUserBreak.start_location;
|
|
39
|
+
this.end_time = (_a = apiUserBreak.end_time) !== null && _a !== void 0 ? _a : null;
|
|
40
|
+
this.end_location = (_b = apiUserBreak.end_location) !== null && _b !== void 0 ? _b : null;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
class UsersClockInService extends index_js_1.Service {
|
|
44
|
+
constructor() {
|
|
45
|
+
super(...arguments);
|
|
46
|
+
this.apiPath = '/users_clocked_in';
|
|
47
|
+
}
|
|
48
|
+
getClockedInUser(id, options) {
|
|
49
|
+
return super
|
|
50
|
+
.fetch({ url: `${this.apiPath}/${id}` }, options)
|
|
51
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new index_js_2.UserClockedIn(res.data)));
|
|
52
|
+
}
|
|
53
|
+
list(options) {
|
|
54
|
+
const _super = Object.create(null, {
|
|
55
|
+
iterator: { get: () => super.iterator }
|
|
56
|
+
});
|
|
57
|
+
return __asyncGenerator(this, arguments, function* list_1() {
|
|
58
|
+
var e_1, _a;
|
|
59
|
+
try {
|
|
60
|
+
for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
|
|
61
|
+
const res = _c.value;
|
|
62
|
+
yield yield __await(new index_js_2.UserClockedIn(res));
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
|
66
|
+
finally {
|
|
67
|
+
try {
|
|
68
|
+
if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
|
|
69
|
+
}
|
|
70
|
+
finally { if (e_1) throw e_1.error; }
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
listAll(options) {
|
|
75
|
+
var e_2, _a;
|
|
76
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
77
|
+
const users = [];
|
|
78
|
+
try {
|
|
79
|
+
for (var _b = __asyncValues(this.list(options)), _c; _c = yield _b.next(), !_c.done;) {
|
|
80
|
+
const user = _c.value;
|
|
81
|
+
users.push(user);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
catch (e_2_1) { e_2 = { error: e_2_1 }; }
|
|
85
|
+
finally {
|
|
86
|
+
try {
|
|
87
|
+
if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
|
|
88
|
+
}
|
|
89
|
+
finally { if (e_2) throw e_2.error; }
|
|
90
|
+
}
|
|
91
|
+
return users;
|
|
92
|
+
});
|
|
93
|
+
}
|
|
94
|
+
listByPage(options) {
|
|
95
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
96
|
+
}
|
|
97
|
+
clockIn(data, options) {
|
|
98
|
+
return super
|
|
99
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
100
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new index_js_2.UserClockedIn(res.data)));
|
|
101
|
+
}
|
|
102
|
+
clockOut(id, data, options) {
|
|
103
|
+
return super
|
|
104
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'DELETE' })
|
|
105
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new index_js_2.UserClockedOut(res.data)));
|
|
106
|
+
}
|
|
107
|
+
startBreak(id, data, options) {
|
|
108
|
+
return super
|
|
109
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
|
|
110
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new UserBreak(res.data)));
|
|
111
|
+
}
|
|
112
|
+
endBreak(id, data, options) {
|
|
113
|
+
return super
|
|
114
|
+
.fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
|
|
115
|
+
.then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new UserBreak(res.data)));
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
exports.UsersClockInService = UsersClockInService;
|
package/dist/cjs/version.js
CHANGED
|
@@ -23,11 +23,15 @@ export * from './location.interface.js';
|
|
|
23
23
|
export * from './logbook-category.interface.js';
|
|
24
24
|
export * from './logbook-event.interface.js';
|
|
25
25
|
export * from './pay-period.interface.js';
|
|
26
|
+
export * from './pin.interface.js';
|
|
26
27
|
export * from './role-rate.interface.js';
|
|
27
28
|
export * from './role.interface.js';
|
|
28
29
|
export * from './sdk-config.interface.js';
|
|
29
30
|
export * from './settings.interface.js';
|
|
30
31
|
export * from './shift.interface.js';
|
|
32
|
+
export * from './terminal.interface.js';
|
|
31
33
|
export * from './toil-accrual.interface.js';
|
|
32
34
|
export * from './toil-allowance.interface.js';
|
|
33
35
|
export * from './user.interface.js';
|
|
36
|
+
export * from './users-clocked-in.interface.js';
|
|
37
|
+
export * from './users-clocked-out.interface.js';
|
|
@@ -23,11 +23,15 @@ export * from './location.interface.js';
|
|
|
23
23
|
export * from './logbook-category.interface.js';
|
|
24
24
|
export * from './logbook-event.interface.js';
|
|
25
25
|
export * from './pay-period.interface.js';
|
|
26
|
+
export * from './pin.interface.js';
|
|
26
27
|
export * from './role-rate.interface.js';
|
|
27
28
|
export * from './role.interface.js';
|
|
28
29
|
export * from './sdk-config.interface.js';
|
|
29
30
|
export * from './settings.interface.js';
|
|
30
31
|
export * from './shift.interface.js';
|
|
32
|
+
export * from './terminal.interface.js';
|
|
31
33
|
export * from './toil-accrual.interface.js';
|
|
32
34
|
export * from './toil-allowance.interface.js';
|
|
33
35
|
export * from './user.interface.js';
|
|
36
|
+
export * from './users-clocked-in.interface.js';
|
|
37
|
+
export * from './users-clocked-out.interface.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export interface ApiTerminal {
|
|
2
|
+
id: number;
|
|
3
|
+
deleted: boolean;
|
|
4
|
+
name: string;
|
|
5
|
+
active: boolean;
|
|
6
|
+
platform: string | null;
|
|
7
|
+
device: string | null;
|
|
8
|
+
version: string | null;
|
|
9
|
+
ip: string | null;
|
|
10
|
+
location: any | null;
|
|
11
|
+
timezone: number;
|
|
12
|
+
require_photo: boolean;
|
|
13
|
+
require_photo_breaks: boolean;
|
|
14
|
+
debug: boolean;
|
|
15
|
+
}
|
|
16
|
+
export interface ApiTerminalLocation {
|
|
17
|
+
lat: number;
|
|
18
|
+
lng: number;
|
|
19
|
+
accuracy: number;
|
|
20
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiLeaveRate, ApiRoleRate } from './index.js';
|
|
1
|
+
import { ApiLeaveRate, ApiRoleRate, ApiTerminalLocation } from './index.js';
|
|
2
2
|
export interface ApiUser {
|
|
3
3
|
id: number;
|
|
4
4
|
created_at: number;
|
|
@@ -35,4 +35,11 @@ export interface ApiUser {
|
|
|
35
35
|
leave_rates_unit: string;
|
|
36
36
|
leave_rates_type: string;
|
|
37
37
|
notes: string | null;
|
|
38
|
+
pin: string | null;
|
|
39
|
+
}
|
|
40
|
+
export interface ApiUserBreak {
|
|
41
|
+
start_time: number;
|
|
42
|
+
start_location: ApiTerminalLocation;
|
|
43
|
+
end_time?: number;
|
|
44
|
+
end_location?: ApiTerminalLocation;
|
|
38
45
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ApiShift, ApiTerminalLocation } from '../interfaces/index.js';
|
|
2
|
+
export interface ApiUserClockedIn {
|
|
3
|
+
user: number;
|
|
4
|
+
location: number;
|
|
5
|
+
role: number;
|
|
6
|
+
in_time: number;
|
|
7
|
+
minutes_late: number;
|
|
8
|
+
shift: Pick<ApiShift, 'id' | 'start_time' | 'end_time' | 'minutes_break' | 'location' | 'role'>;
|
|
9
|
+
in_method: string;
|
|
10
|
+
in_location: ApiTerminalLocation;
|
|
11
|
+
in_device: string | null;
|
|
12
|
+
in_terminal: number | null;
|
|
13
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ApiShift, ApiTerminalLocation } from './index.js';
|
|
2
|
+
export interface ApiUserClockedOut {
|
|
3
|
+
id: number;
|
|
4
|
+
deleted: boolean;
|
|
5
|
+
approved: boolean;
|
|
6
|
+
user: number;
|
|
7
|
+
location: number;
|
|
8
|
+
role: number;
|
|
9
|
+
in_time: number;
|
|
10
|
+
out_time: number;
|
|
11
|
+
minutes_break: number;
|
|
12
|
+
minutes_late: number;
|
|
13
|
+
hours: number;
|
|
14
|
+
hours_auto: number;
|
|
15
|
+
hours_is_auto: boolean;
|
|
16
|
+
notes: string | null;
|
|
17
|
+
shift: Pick<ApiShift, 'id' | 'start_time' | 'end_time' | 'minutes_break' | 'location' | 'role'>;
|
|
18
|
+
in_method: string;
|
|
19
|
+
in_location: ApiTerminalLocation;
|
|
20
|
+
in_device: string | null;
|
|
21
|
+
in_terminal: number | null;
|
|
22
|
+
out_method: string;
|
|
23
|
+
out_location: ApiTerminalLocation;
|
|
24
|
+
out_device: string | null;
|
|
25
|
+
out_terminal: number | null;
|
|
26
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ApiAttendance,
|
|
1
|
+
import { ApiAttendance, ApiTerminalLocation, ApiShift } from '../interfaces/index.js';
|
|
2
2
|
export declare class Attendance {
|
|
3
3
|
id: number;
|
|
4
4
|
deleted: boolean;
|
|
@@ -17,11 +17,11 @@ export declare class Attendance {
|
|
|
17
17
|
shift: ApiShift | null;
|
|
18
18
|
in_method: string;
|
|
19
19
|
out_method: string;
|
|
20
|
-
in_location:
|
|
21
|
-
out_location:
|
|
20
|
+
in_location: ApiTerminalLocation;
|
|
21
|
+
out_location: ApiTerminalLocation;
|
|
22
22
|
in_device: number;
|
|
23
23
|
out_device: number;
|
|
24
|
-
in_terminal: null;
|
|
25
|
-
out_terminal: null;
|
|
24
|
+
in_terminal: number | null;
|
|
25
|
+
out_terminal: number | null;
|
|
26
26
|
constructor(attendance: ApiAttendance);
|
|
27
27
|
}
|
|
@@ -1,5 +1,17 @@
|
|
|
1
1
|
export class AvailabilityPattern {
|
|
2
2
|
constructor(apiAvailabilityPatterns) {
|
|
3
3
|
this.id = apiAvailabilityPatterns.id;
|
|
4
|
+
this.user = apiAvailabilityPatterns.user;
|
|
5
|
+
this.name = apiAvailabilityPatterns.name;
|
|
6
|
+
this.start_date = apiAvailabilityPatterns.start_date;
|
|
7
|
+
this.end_date = apiAvailabilityPatterns.end_date;
|
|
8
|
+
this.repeat_weeks = apiAvailabilityPatterns.repeat_weeks;
|
|
9
|
+
this.mon = apiAvailabilityPatterns.mon;
|
|
10
|
+
this.tue = apiAvailabilityPatterns.tue;
|
|
11
|
+
this.wed = apiAvailabilityPatterns.wed;
|
|
12
|
+
this.thu = apiAvailabilityPatterns.thu;
|
|
13
|
+
this.fri = apiAvailabilityPatterns.fri;
|
|
14
|
+
this.sat = apiAvailabilityPatterns.sat;
|
|
15
|
+
this.sun = apiAvailabilityPatterns.sun;
|
|
4
16
|
}
|
|
5
17
|
}
|
|
@@ -2,5 +2,8 @@ export class DailyRevenue {
|
|
|
2
2
|
constructor(dailyRevenue) {
|
|
3
3
|
this.date = dailyRevenue.date;
|
|
4
4
|
this.location = dailyRevenue.location;
|
|
5
|
+
this.labour_percentage = dailyRevenue.labour_percentage;
|
|
6
|
+
this.revenue_target = dailyRevenue.revenue_target;
|
|
7
|
+
this.revenue_actual = dailyRevenue.revenue_actual;
|
|
5
8
|
}
|
|
6
9
|
}
|
package/dist/mjs/models/index.js
CHANGED