rotacloud 1.1.1 → 1.2.0

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.
Files changed (158) hide show
  1. package/dist/cjs/interfaces/index.d.ts +1 -0
  2. package/dist/cjs/interfaces/index.js +1 -0
  3. package/dist/cjs/interfaces/query-params/index.d.ts +0 -1
  4. package/dist/cjs/interfaces/query-params/index.js +0 -1
  5. package/dist/cjs/interfaces/terminal.interface.d.ts +1 -0
  6. package/dist/cjs/interfaces/time-zone.interface.d.ts +7 -0
  7. package/dist/cjs/rotacloud.d.ts +2 -1
  8. package/dist/cjs/rotacloud.js +1 -0
  9. package/dist/cjs/services/accounts.service.d.ts +26 -7
  10. package/dist/cjs/services/accounts.service.js +10 -20
  11. package/dist/cjs/services/attendance.service.d.ts +30 -11
  12. package/dist/cjs/services/attendance.service.js +16 -26
  13. package/dist/cjs/services/auth.service.js +1 -3
  14. package/dist/cjs/services/availability.service.d.ts +3 -3
  15. package/dist/cjs/services/availability.service.js +8 -18
  16. package/dist/cjs/services/daily-budgets.service.d.ts +19 -7
  17. package/dist/cjs/services/daily-budgets.service.js +12 -22
  18. package/dist/cjs/services/daily-revenue.service.d.ts +18 -6
  19. package/dist/cjs/services/daily-revenue.service.js +11 -21
  20. package/dist/cjs/services/day-notes.service.d.ts +27 -8
  21. package/dist/cjs/services/day-notes.service.js +15 -25
  22. package/dist/cjs/services/days-off.service.d.ts +17 -5
  23. package/dist/cjs/services/days-off.service.js +13 -23
  24. package/dist/cjs/services/groups.service.d.ts +27 -8
  25. package/dist/cjs/services/groups.service.js +12 -22
  26. package/dist/cjs/services/index.d.ts +1 -0
  27. package/dist/cjs/services/index.js +1 -0
  28. package/dist/cjs/services/leave-embargoes.service.d.ts +27 -8
  29. package/dist/cjs/services/leave-embargoes.service.js +16 -26
  30. package/dist/cjs/services/leave-request.service.d.ts +27 -8
  31. package/dist/cjs/services/leave-request.service.js +15 -25
  32. package/dist/cjs/services/leave.service.d.ts +28 -10
  33. package/dist/cjs/services/leave.service.js +13 -46
  34. package/dist/cjs/services/locations.service.d.ts +27 -8
  35. package/dist/cjs/services/locations.service.js +16 -26
  36. package/dist/cjs/services/pins.service.d.ts +12 -5
  37. package/dist/cjs/services/pins.service.js +1 -1
  38. package/dist/cjs/services/roles.service.d.ts +27 -8
  39. package/dist/cjs/services/roles.service.js +16 -26
  40. package/dist/cjs/services/service.d.ts +12 -3
  41. package/dist/cjs/services/service.js +1 -2
  42. package/dist/cjs/services/settings.service.d.ts +1 -1
  43. package/dist/cjs/services/settings.service.js +1 -1
  44. package/dist/cjs/services/shifts.service.d.ts +30 -11
  45. package/dist/cjs/services/shifts.service.js +21 -31
  46. package/dist/cjs/services/terminals-active.service.d.ts +20 -8
  47. package/dist/cjs/services/terminals-active.service.js +16 -26
  48. package/dist/cjs/services/terminals.service.d.ts +27 -8
  49. package/dist/cjs/services/terminals.service.js +13 -23
  50. package/dist/cjs/services/time-zone.service.d.ts +14 -0
  51. package/dist/cjs/services/time-zone.service.js +82 -0
  52. package/dist/cjs/services/toil-accruals.service.d.ts +4 -4
  53. package/dist/cjs/services/toil-accruals.service.js +12 -22
  54. package/dist/cjs/services/toil-allowance.service.d.ts +3 -3
  55. package/dist/cjs/services/toil-allowance.service.js +9 -19
  56. package/dist/cjs/services/users-clock-in.service.d.ts +22 -10
  57. package/dist/cjs/services/users-clock-in.service.js +5 -5
  58. package/dist/cjs/services/users.service.d.ts +28 -9
  59. package/dist/cjs/services/users.service.js +16 -26
  60. package/dist/cjs/version.js +1 -1
  61. package/dist/mjs/interfaces/index.d.ts +1 -0
  62. package/dist/mjs/interfaces/index.js +1 -0
  63. package/dist/mjs/interfaces/query-params/index.d.ts +0 -1
  64. package/dist/mjs/interfaces/query-params/index.js +0 -1
  65. package/dist/mjs/interfaces/terminal.interface.d.ts +1 -0
  66. package/dist/mjs/interfaces/time-zone.interface.d.ts +7 -0
  67. package/dist/mjs/rotacloud.d.ts +2 -1
  68. package/dist/mjs/rotacloud.js +2 -1
  69. package/dist/mjs/services/accounts.service.d.ts +26 -7
  70. package/dist/mjs/services/accounts.service.js +2 -4
  71. package/dist/mjs/services/attendance.service.d.ts +30 -11
  72. package/dist/mjs/services/attendance.service.js +8 -10
  73. package/dist/mjs/services/auth.service.js +1 -3
  74. package/dist/mjs/services/availability.service.d.ts +3 -3
  75. package/dist/mjs/services/availability.service.js +3 -5
  76. package/dist/mjs/services/daily-budgets.service.d.ts +19 -7
  77. package/dist/mjs/services/daily-budgets.service.js +4 -6
  78. package/dist/mjs/services/daily-revenue.service.d.ts +18 -6
  79. package/dist/mjs/services/daily-revenue.service.js +3 -5
  80. package/dist/mjs/services/day-notes.service.d.ts +27 -8
  81. package/dist/mjs/services/day-notes.service.js +7 -9
  82. package/dist/mjs/services/days-off.service.d.ts +17 -5
  83. package/dist/mjs/services/days-off.service.js +5 -7
  84. package/dist/mjs/services/groups.service.d.ts +27 -8
  85. package/dist/mjs/services/groups.service.js +4 -6
  86. package/dist/mjs/services/index.d.ts +1 -0
  87. package/dist/mjs/services/index.js +1 -0
  88. package/dist/mjs/services/leave-embargoes.service.d.ts +27 -8
  89. package/dist/mjs/services/leave-embargoes.service.js +8 -10
  90. package/dist/mjs/services/leave-request.service.d.ts +27 -8
  91. package/dist/mjs/services/leave-request.service.js +7 -9
  92. package/dist/mjs/services/leave.service.d.ts +28 -10
  93. package/dist/mjs/services/leave.service.js +5 -12
  94. package/dist/mjs/services/locations.service.d.ts +27 -8
  95. package/dist/mjs/services/locations.service.js +8 -10
  96. package/dist/mjs/services/pins.service.d.ts +12 -5
  97. package/dist/mjs/services/pins.service.js +1 -1
  98. package/dist/mjs/services/roles.service.d.ts +27 -8
  99. package/dist/mjs/services/roles.service.js +8 -10
  100. package/dist/mjs/services/service.d.ts +12 -3
  101. package/dist/mjs/services/service.js +0 -2
  102. package/dist/mjs/services/settings.service.d.ts +1 -1
  103. package/dist/mjs/services/settings.service.js +1 -1
  104. package/dist/mjs/services/shifts.service.d.ts +30 -11
  105. package/dist/mjs/services/shifts.service.js +13 -15
  106. package/dist/mjs/services/terminals-active.service.d.ts +20 -8
  107. package/dist/mjs/services/terminals-active.service.js +8 -10
  108. package/dist/mjs/services/terminals.service.d.ts +27 -8
  109. package/dist/mjs/services/terminals.service.js +5 -7
  110. package/dist/mjs/services/time-zone.service.d.ts +14 -0
  111. package/dist/mjs/services/time-zone.service.js +25 -0
  112. package/dist/mjs/services/toil-accruals.service.d.ts +4 -4
  113. package/dist/mjs/services/toil-accruals.service.js +4 -6
  114. package/dist/mjs/services/toil-allowance.service.d.ts +3 -3
  115. package/dist/mjs/services/toil-allowance.service.js +1 -3
  116. package/dist/mjs/services/users-clock-in.service.d.ts +22 -10
  117. package/dist/mjs/services/users-clock-in.service.js +5 -5
  118. package/dist/mjs/services/users.service.d.ts +28 -9
  119. package/dist/mjs/services/users.service.js +8 -10
  120. package/dist/mjs/version.js +1 -1
  121. package/package.json +1 -1
  122. package/src/interfaces/index.ts +1 -0
  123. package/src/interfaces/query-params/index.ts +0 -1
  124. package/src/interfaces/terminal.interface.ts +1 -0
  125. package/src/interfaces/time-zone.interface.ts +7 -0
  126. package/src/rotacloud.ts +2 -0
  127. package/src/services/accounts.service.ts +30 -14
  128. package/src/services/attendance.service.ts +57 -28
  129. package/src/services/auth.service.ts +1 -3
  130. package/src/services/availability.service.ts +14 -13
  131. package/src/services/daily-budgets.service.ts +41 -20
  132. package/src/services/daily-revenue.service.ts +37 -19
  133. package/src/services/day-notes.service.ts +51 -25
  134. package/src/services/days-off.service.ts +46 -25
  135. package/src/services/groups.service.ts +40 -20
  136. package/src/services/index.ts +1 -0
  137. package/src/services/leave-embargoes.service.ts +54 -25
  138. package/src/services/leave-request.service.ts +53 -24
  139. package/src/services/leave.service.ts +41 -27
  140. package/src/services/locations.service.ts +54 -25
  141. package/src/services/pins.service.ts +11 -6
  142. package/src/services/roles.service.ts +49 -25
  143. package/src/services/service.ts +35 -9
  144. package/src/services/settings.service.ts +2 -2
  145. package/src/services/shifts.service.ts +62 -36
  146. package/src/services/terminals-active.service.ts +36 -23
  147. package/src/services/terminals.service.ts +36 -18
  148. package/src/services/time-zone.service.ts +34 -0
  149. package/src/services/toil-accruals.service.ts +9 -11
  150. package/src/services/toil-allowance.service.ts +3 -5
  151. package/src/services/users-clock-in.service.ts +30 -16
  152. package/src/services/users.service.ts +49 -26
  153. package/src/version.ts +1 -1
  154. package/dist/cjs/interfaces/query-params/internal-query-params.interface.d.ts +0 -5
  155. package/dist/mjs/interfaces/query-params/internal-query-params.interface.d.ts +0 -5
  156. package/src/interfaces/query-params/internal-query-params.interface.ts +0 -5
  157. /package/dist/cjs/interfaces/{query-params/internal-query-params.interface.js → time-zone.interface.js} +0 -0
  158. /package/dist/mjs/interfaces/{query-params/internal-query-params.interface.js → time-zone.interface.js} +0 -0
@@ -16,6 +16,11 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
16
16
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
17
  };
18
18
  var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
20
+ var i, p;
21
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
22
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
23
+ };
19
24
  var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
25
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
26
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
@@ -38,38 +43,23 @@ class ToilAccrualsService extends service_1.Service {
38
43
  create(data, options) {
39
44
  return super
40
45
  .fetch({ url: this.apiPath, data, method: 'POST' })
41
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
46
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
42
47
  }
43
48
  get(id, options) {
44
49
  return super
45
50
  .fetch({ url: `${this.apiPath}/${id}` }, options)
46
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
51
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
47
52
  }
48
53
  list(query, options) {
49
54
  const _super = Object.create(null, {
50
55
  iterator: { get: () => super.iterator }
51
56
  });
52
57
  return __asyncGenerator(this, arguments, function* list_1() {
53
- var _a, e_1, _b, _c;
54
- try {
55
- for (var _d = true, _e = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
56
- _c = _f.value;
57
- _d = false;
58
- const res = _c;
59
- yield yield __await(res);
60
- }
61
- }
62
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
63
- finally {
64
- try {
65
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
66
- }
67
- finally { if (e_1) throw e_1.error; }
68
- }
58
+ yield __await(yield* __asyncDelegator(__asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options))));
69
59
  });
70
60
  }
71
61
  listAll(query, options) {
72
- var _a, e_2, _b, _c;
62
+ var _a, e_1, _b, _c;
73
63
  return __awaiter(this, void 0, void 0, function* () {
74
64
  const toilAccruals = [];
75
65
  try {
@@ -80,12 +70,12 @@ class ToilAccrualsService extends service_1.Service {
80
70
  toilAccruals.push(accrual);
81
71
  }
82
72
  }
83
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
73
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
84
74
  finally {
85
75
  try {
86
76
  if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
87
77
  }
88
- finally { if (e_2) throw e_2.error; }
78
+ finally { if (e_1) throw e_1.error; }
89
79
  }
90
80
  return toilAccruals;
91
81
  });
@@ -96,7 +86,7 @@ class ToilAccrualsService extends service_1.Service {
96
86
  delete(id, options) {
97
87
  return super
98
88
  .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
99
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
89
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
100
90
  }
101
91
  }
102
92
  exports.ToilAccrualsService = ToilAccrualsService;
@@ -1,9 +1,9 @@
1
1
  import { Options, Service } from './service';
2
2
  import { ToilAllowanceQueryParams } from '../interfaces/query-params/toil-allowance-query-params.interface';
3
3
  import { ToilAllowance } from '../interfaces/toil-allowance.interface';
4
- export declare class ToilAllowanceService extends Service {
4
+ export declare class ToilAllowanceService extends Service<ToilAllowance> {
5
5
  private apiPath;
6
- list(year: number, query: ToilAllowanceQueryParams, options?: Options): AsyncGenerator<ToilAllowance, void, unknown>;
6
+ list(year: number, query: ToilAllowanceQueryParams, options?: Options): AsyncGenerator<ToilAllowance, void, undefined>;
7
7
  listAll(year: number, query: ToilAllowanceQueryParams, options?: Options): Promise<ToilAllowance[]>;
8
- listByPage(year: number, query: ToilAllowanceQueryParams, options?: Options): AsyncGenerator<import("axios").AxiosResponse<ToilAllowance[][], any>, any, unknown>;
8
+ listByPage(year: number, query: ToilAllowanceQueryParams, options?: Options): AsyncGenerator<import("axios").AxiosResponse<ToilAllowance[], any>, any, unknown>;
9
9
  }
@@ -16,6 +16,11 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
16
16
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
17
  };
18
18
  var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
20
+ var i, p;
21
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
22
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
23
+ };
19
24
  var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
25
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
26
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
@@ -40,26 +45,11 @@ class ToilAllowanceService extends service_1.Service {
40
45
  iterator: { get: () => super.iterator }
41
46
  });
42
47
  return __asyncGenerator(this, arguments, function* list_1() {
43
- var _a, e_1, _b, _c;
44
- try {
45
- for (var _d = true, _e = __asyncValues(_super.iterator.call(this, { url: `${this.apiPath}/${year}`, params: query }, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
46
- _c = _f.value;
47
- _d = false;
48
- const res = _c;
49
- yield yield __await(res);
50
- }
51
- }
52
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
- finally {
54
- try {
55
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
56
- }
57
- finally { if (e_1) throw e_1.error; }
58
- }
48
+ yield __await(yield* __asyncDelegator(__asyncValues(_super.iterator.call(this, { url: `${this.apiPath}/${year}`, params: query }, options))));
59
49
  });
60
50
  }
61
51
  listAll(year, query, options) {
62
- var _a, e_2, _b, _c;
52
+ var _a, e_1, _b, _c;
63
53
  return __awaiter(this, void 0, void 0, function* () {
64
54
  const toilAllowances = [];
65
55
  try {
@@ -70,12 +60,12 @@ class ToilAllowanceService extends service_1.Service {
70
60
  toilAllowances.push(allowance);
71
61
  }
72
62
  }
73
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
63
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
74
64
  finally {
75
65
  try {
76
66
  if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
77
67
  }
78
- finally { if (e_2) throw e_2.error; }
68
+ finally { if (e_1) throw e_1.error; }
79
69
  }
80
70
  return toilAllowances;
81
71
  });
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { UserBreak, UserClockedIn, UserClockedOut, TerminalLocation } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  interface UserClockIn {
5
5
  method: string;
6
6
  shift: number;
@@ -20,35 +20,47 @@ interface UserBreakRequest {
20
20
  }
21
21
  type RequiredPropsClockIn = 'method';
22
22
  type RequiredPropsBreak = 'method' | 'action';
23
- export declare class UsersClockInService extends Service {
23
+ export declare class UsersClockInService extends Service<UserClockedIn> {
24
24
  private apiPath;
25
25
  getClockedInUser(id: number): Promise<UserClockedIn>;
26
26
  getClockedInUser(id: number, options: {
27
27
  rawResponse: true;
28
- } & Options): Promise<AxiosResponse<UserClockedIn, any>>;
28
+ } & Options): Promise<AxiosResponse<UserClockedIn>>;
29
29
  getClockedInUser(id: number, options: Options): Promise<UserClockedIn>;
30
- list(options?: Options): AsyncGenerator<UserClockedIn, void, unknown>;
31
- listAll(options?: Options): Promise<UserClockedIn[]>;
32
- listByPage(options?: Options): AsyncGenerator<AxiosResponse<UserClockedIn[], any>, any, unknown>;
30
+ list(): AsyncGenerator<UserClockedIn>;
31
+ list<F extends keyof UserClockedIn>(options: {
32
+ fields: F[];
33
+ } & OptionsExtended<UserClockedIn>): AsyncGenerator<Pick<UserClockedIn, F>>;
34
+ list(options?: OptionsExtended<UserClockedIn>): AsyncGenerator<UserClockedIn>;
35
+ listAll(): Promise<UserClockedIn[]>;
36
+ listAll<F extends keyof UserClockedIn>(options: {
37
+ fields: F[];
38
+ } & OptionsExtended<UserClockedIn>): Promise<Pick<UserClockedIn, F>[]>;
39
+ listAll(options?: OptionsExtended<UserClockedIn>): Promise<UserClockedIn[]>;
40
+ listByPage(): AsyncGenerator<AxiosResponse<UserClockedIn[]>>;
41
+ listByPage<F extends keyof UserClockedIn>(options: {
42
+ fields: F[];
43
+ } & OptionsExtended<UserClockedIn>): AsyncGenerator<AxiosResponse<Pick<UserClockedIn, F>[]>>;
44
+ listByPage(options?: OptionsExtended<UserClockedIn>): AsyncGenerator<AxiosResponse<UserClockedIn[]>>;
33
45
  clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>): Promise<UserClockedIn>;
34
46
  clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>, options: {
35
47
  rawResponse: true;
36
- } & Options): Promise<AxiosResponse<UserClockedIn, any>>;
48
+ } & Options): Promise<AxiosResponse<UserClockedIn>>;
37
49
  clockIn(data: RequirementsOf<UserClockIn, RequiredPropsClockIn>, options: Options): Promise<UserClockedIn>;
38
50
  clockOut(id: number, data: UserClockOut): Promise<UserClockedOut>;
39
51
  clockOut(id: number, data: UserClockOut, options: {
40
52
  rawResponse: true;
41
- } & Options): Promise<AxiosResponse<UserClockedOut, any>>;
53
+ } & Options): Promise<AxiosResponse<UserClockedOut>>;
42
54
  clockOut(id: number, data: UserClockOut, options: Options): Promise<UserClockedOut>;
43
55
  startBreak(id: number, data: RequirementsOf<UserBreakRequest, RequiredPropsBreak>): Promise<UserBreak>;
44
56
  startBreak(id: number, data: RequirementsOf<UserBreakRequest, RequiredPropsBreak>, options: {
45
57
  rawResponse: true;
46
- } & Options): Promise<AxiosResponse<UserBreak, any>>;
58
+ } & Options): Promise<AxiosResponse<UserBreak>>;
47
59
  startBreak(id: number, data: RequirementsOf<UserBreakRequest, RequiredPropsBreak>, options: Options): Promise<UserBreak>;
48
60
  endBreak(id: number, data: RequirementsOf<UserBreakRequest, RequiredPropsBreak>): Promise<UserBreak>;
49
61
  endBreak(id: number, data: RequirementsOf<UserBreakRequest, RequiredPropsBreak>, options: {
50
62
  rawResponse: true;
51
- } & Options): Promise<AxiosResponse<UserBreak, any>>;
63
+ } & Options): Promise<AxiosResponse<UserBreak>>;
52
64
  endBreak(id: number, data: RequirementsOf<UserBreakRequest, RequiredPropsBreak>, options: Options): Promise<UserBreak>;
53
65
  }
54
66
  export {};
@@ -38,7 +38,7 @@ class UsersClockInService extends index_js_1.Service {
38
38
  getClockedInUser(id, options) {
39
39
  return super
40
40
  .fetch({ url: `${this.apiPath}/${id}` }, options)
41
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
41
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
42
42
  }
43
43
  list(options) {
44
44
  const _super = Object.create(null, {
@@ -91,22 +91,22 @@ class UsersClockInService extends index_js_1.Service {
91
91
  clockIn(data, options) {
92
92
  return super
93
93
  .fetch({ url: this.apiPath, data, method: 'POST' })
94
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
94
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
95
95
  }
96
96
  clockOut(id, data, options) {
97
97
  return super
98
98
  .fetch({ url: `${this.apiPath}/${id}`, data, method: 'DELETE' })
99
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
99
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
100
100
  }
101
101
  startBreak(id, data, options) {
102
102
  return super
103
103
  .fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
104
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
104
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
105
105
  }
106
106
  endBreak(id, data, options) {
107
107
  return super
108
108
  .fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
109
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
109
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
110
110
  }
111
111
  }
112
112
  exports.UsersClockInService = UsersClockInService;
@@ -1,23 +1,42 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { User } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  import { UsersQueryParams } from '../interfaces/query-params/users-query-params.interface.js';
5
5
  type RequiredProps = 'first_name' | 'last_name';
6
- export declare class UsersService extends Service {
6
+ export declare class UsersService extends Service<User> {
7
7
  private apiPath;
8
8
  create(data: RequirementsOf<User, RequiredProps>): Promise<User>;
9
9
  create(data: RequirementsOf<User, RequiredProps>, options: {
10
10
  rawResponse: true;
11
- } & Options): Promise<AxiosResponse<User, any>>;
11
+ } & Options): Promise<AxiosResponse<User>>;
12
12
  create(data: RequirementsOf<User, RequiredProps>, options: Options): Promise<User>;
13
13
  get(id: number): Promise<User>;
14
+ get<F extends keyof User>(id: number, options: {
15
+ fields: F[];
16
+ rawResponse: true;
17
+ } & OptionsExtended<User>): Promise<AxiosResponse<Pick<User, F>>>;
18
+ get<F extends keyof User>(id: number, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<User>): Promise<Pick<User, F>>;
14
21
  get(id: number, options: {
15
22
  rawResponse: true;
16
- } & Options): Promise<AxiosResponse<User, any>>;
17
- get(id: number, options: Options): Promise<User>;
18
- list(query: UsersQueryParams, options?: Options): AsyncGenerator<User, void, unknown>;
19
- listAll(query: UsersQueryParams, options?: Options): Promise<User[]>;
20
- listByPage(query: UsersQueryParams, options?: Options): AsyncGenerator<AxiosResponse<User[], any>, any, unknown>;
23
+ } & Options): Promise<AxiosResponse<User>>;
24
+ get(id: number, options?: OptionsExtended<User>): Promise<User>;
25
+ list(query?: UsersQueryParams): AsyncGenerator<User>;
26
+ list<F extends keyof User>(query: UsersQueryParams, options: {
27
+ fields: F[];
28
+ } & OptionsExtended<User>): AsyncGenerator<Pick<User, F>>;
29
+ list(query?: UsersQueryParams, options?: OptionsExtended<User>): AsyncGenerator<User>;
30
+ listAll(query?: UsersQueryParams): Promise<User[]>;
31
+ listAll<F extends keyof User>(query: UsersQueryParams, options: {
32
+ fields: F[];
33
+ } & OptionsExtended<User>): Promise<Pick<User, F>[]>;
34
+ listAll(query?: UsersQueryParams, options?: OptionsExtended<User>): Promise<User[]>;
35
+ listByPage(query?: UsersQueryParams): AsyncGenerator<AxiosResponse<User[]>>;
36
+ listByPage<F extends keyof User>(query: UsersQueryParams, options: {
37
+ fields: F[];
38
+ } & OptionsExtended<User>): AsyncGenerator<AxiosResponse<Pick<User, F>[]>>;
39
+ listByPage(query?: UsersQueryParams, options?: OptionsExtended<User>): AsyncGenerator<AxiosResponse<User[]>>;
21
40
  update(id: number, data: Partial<User>): Promise<User>;
22
41
  update(id: number, data: Partial<User>, options: {
23
42
  rawResponse: true;
@@ -26,7 +45,7 @@ export declare class UsersService extends Service {
26
45
  delete(id: number): Promise<number>;
27
46
  delete(id: number, options: {
28
47
  rawResponse: true;
29
- } & Options): Promise<AxiosResponse<any, any>>;
48
+ } & Options): Promise<AxiosResponse<void>>;
30
49
  delete(id: number, options: Options): Promise<number>;
31
50
  }
32
51
  export {};
@@ -16,6 +16,11 @@ var __asyncValues = (this && this.__asyncValues) || function (o) {
16
16
  function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
17
  };
18
18
  var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncDelegator = (this && this.__asyncDelegator) || function (o) {
20
+ var i, p;
21
+ return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
22
+ function verb(n, f) { i[n] = o[n] ? function (v) { return (p = !p) ? { value: __await(o[n](v)), done: false } : f ? f(v) : v; } : f; }
23
+ };
19
24
  var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
25
  if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
26
  var g = generator.apply(thisArg, _arguments || []), i, q = [];
@@ -37,39 +42,24 @@ class UsersService extends index_js_1.Service {
37
42
  }
38
43
  create(data, options) {
39
44
  return super
40
- .fetch({ url: this.apiPath, data, method: 'POST' })
41
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
45
+ .fetch({ url: this.apiPath, data, method: 'POST' }, options)
46
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
42
47
  }
43
48
  get(id, options) {
44
49
  return super
45
50
  .fetch({ url: `${this.apiPath}/${id}` }, options)
46
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
51
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
47
52
  }
48
53
  list(query, options) {
49
54
  const _super = Object.create(null, {
50
55
  iterator: { get: () => super.iterator }
51
56
  });
52
57
  return __asyncGenerator(this, arguments, function* list_1() {
53
- var _a, e_1, _b, _c;
54
- try {
55
- for (var _d = true, _e = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
56
- _c = _f.value;
57
- _d = false;
58
- const res = _c;
59
- yield yield __await(res);
60
- }
61
- }
62
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
63
- finally {
64
- try {
65
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
66
- }
67
- finally { if (e_1) throw e_1.error; }
68
- }
58
+ yield __await(yield* __asyncDelegator(__asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options))));
69
59
  });
70
60
  }
71
61
  listAll(query, options) {
72
- var _a, e_2, _b, _c;
62
+ var _a, e_1, _b, _c;
73
63
  return __awaiter(this, void 0, void 0, function* () {
74
64
  const users = [];
75
65
  try {
@@ -80,12 +70,12 @@ class UsersService extends index_js_1.Service {
80
70
  users.push(user);
81
71
  }
82
72
  }
83
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
73
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
84
74
  finally {
85
75
  try {
86
76
  if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
87
77
  }
88
- finally { if (e_2) throw e_2.error; }
78
+ finally { if (e_1) throw e_1.error; }
89
79
  }
90
80
  return users;
91
81
  });
@@ -99,13 +89,13 @@ class UsersService extends index_js_1.Service {
99
89
  url: `${this.apiPath}/${id}`,
100
90
  data,
101
91
  method: 'POST',
102
- })
103
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
92
+ }, options)
93
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
104
94
  }
105
95
  delete(id, options) {
106
96
  return super
107
- .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
108
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
97
+ .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' }, options)
98
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
109
99
  }
110
100
  }
111
101
  exports.UsersService = UsersService;
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Version = void 0;
4
- exports.Version = { version: '1.1.1' };
4
+ exports.Version = { version: '1.2.0' };
@@ -30,6 +30,7 @@ export * from './sdk-config.interface.js';
30
30
  export * from './settings.interface.js';
31
31
  export * from './shift.interface.js';
32
32
  export * from './terminal.interface.js';
33
+ export * from './time-zone.interface.js';
33
34
  export * from './toil-accrual.interface.js';
34
35
  export * from './toil-allowance.interface.js';
35
36
  export * from './user.interface.js';
@@ -30,6 +30,7 @@ export * from './sdk-config.interface.js';
30
30
  export * from './settings.interface.js';
31
31
  export * from './shift.interface.js';
32
32
  export * from './terminal.interface.js';
33
+ export * from './time-zone.interface.js';
33
34
  export * from './toil-accrual.interface.js';
34
35
  export * from './toil-allowance.interface.js';
35
36
  export * from './user.interface.js';
@@ -9,7 +9,6 @@ export * from './days-off-patterns-query-params.interface.js';
9
9
  export * from './days-off-query-params.interface.js';
10
10
  export * from './documents-query-params.interface.js';
11
11
  export * from './groups-query-params.interface.js';
12
- export * from './internal-query-params.interface.js';
13
12
  export * from './leave-embargoes-query-params.interface.js';
14
13
  export * from './leave-query-params.interface.js';
15
14
  export * from './leave-requests-query-params.interface.js';
@@ -9,7 +9,6 @@ export * from './days-off-patterns-query-params.interface.js';
9
9
  export * from './days-off-query-params.interface.js';
10
10
  export * from './documents-query-params.interface.js';
11
11
  export * from './groups-query-params.interface.js';
12
- export * from './internal-query-params.interface.js';
13
12
  export * from './leave-embargoes-query-params.interface.js';
14
13
  export * from './leave-query-params.interface.js';
15
14
  export * from './leave-requests-query-params.interface.js';
@@ -13,6 +13,7 @@ export interface Terminal {
13
13
  require_photo_breaks: boolean;
14
14
  debug: boolean;
15
15
  secret: string | null;
16
+ server_time?: number;
16
17
  }
17
18
  export interface TerminalLocation {
18
19
  lat: number;
@@ -0,0 +1,7 @@
1
+ export interface TimeZone {
2
+ id: number;
3
+ name: string;
4
+ continent: string;
5
+ city: string;
6
+ sub: string;
7
+ }
@@ -1,4 +1,4 @@
1
- import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DayNotesService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveTypesService, LeaveService, LocationsService, RolesService, SettingsService, ShiftsService, TerminalsService, TerminalsActiveService, ToilAccrualsService, ToilAllowanceService, UsersService, UsersClockInService } from './services/index.js';
1
+ import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DayNotesService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveTypesService, LeaveService, LocationsService, RolesService, SettingsService, ShiftsService, TerminalsService, TerminalsActiveService, TimeZoneService, ToilAccrualsService, ToilAllowanceService, UsersService, UsersClockInService } from './services/index.js';
2
2
  import { SDKConfig } from './interfaces/index.js';
3
3
  import { PinsService } from './services/pins.service.js';
4
4
  export declare class RotaCloud {
@@ -24,6 +24,7 @@ export declare class RotaCloud {
24
24
  shifts: ShiftsService;
25
25
  terminals: TerminalsService;
26
26
  terminalsActive: TerminalsActiveService;
27
+ timeZone: TimeZoneService;
27
28
  toilAccruals: ToilAccrualsService;
28
29
  toilAllowance: ToilAllowanceService;
29
30
  usersClockInService: UsersClockInService;
@@ -1,4 +1,4 @@
1
- import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DayNotesService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveTypesService, LeaveService, LocationsService, RetryStrategy, RolesService, SettingsService, ShiftsService, TerminalsService, TerminalsActiveService, ToilAccrualsService, ToilAllowanceService, UsersService, UsersClockInService, } from './services/index.js';
1
+ import { AccountsService, AttendanceService, AuthService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DayNotesService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveTypesService, LeaveService, LocationsService, RetryStrategy, RolesService, SettingsService, ShiftsService, TerminalsService, TerminalsActiveService, TimeZoneService, ToilAccrualsService, ToilAllowanceService, UsersService, UsersClockInService, } from './services/index.js';
2
2
  import { PinsService } from './services/pins.service.js';
3
3
  const DEFAULT_CONFIG = {
4
4
  baseUri: 'https://api.rotacloud.com/v1',
@@ -27,6 +27,7 @@ export class RotaCloud {
27
27
  this.shifts = new ShiftsService();
28
28
  this.terminals = new TerminalsService();
29
29
  this.terminalsActive = new TerminalsActiveService();
30
+ this.timeZone = new TimeZoneService();
30
31
  this.toilAccruals = new ToilAccrualsService();
31
32
  this.toilAllowance = new ToilAllowanceService();
32
33
  this.usersClockInService = new UsersClockInService();
@@ -1,14 +1,33 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { Service, Options } from './index.js';
2
+ import { Service, OptionsExtended } from './index.js';
3
3
  import { Account } from '../interfaces/index.js';
4
- export declare class AccountsService extends Service {
4
+ export declare class AccountsService extends Service<Account> {
5
5
  private apiPath;
6
6
  get(id: number): Promise<Account>;
7
+ get<F extends keyof Account>(id: number, options: {
8
+ fields: F[];
9
+ rawResponse: true;
10
+ } & OptionsExtended<Account>): Promise<AxiosResponse<Pick<Account, F>>>;
11
+ get<F extends keyof Account>(id: number, options: {
12
+ fields: F[];
13
+ } & OptionsExtended<Account>): Promise<Pick<Account, F>>;
7
14
  get(id: number, options: {
8
15
  rawResponse: true;
9
- } & Options): Promise<AxiosResponse<Account, any>>;
10
- get(id: number, options: Options): Promise<Account>;
11
- list(options?: Options): AsyncGenerator<Account, void, unknown>;
12
- listAll(options?: Options): Promise<Account[]>;
13
- listByPage(options?: Options): AsyncGenerator<AxiosResponse<Account[], any>, any, unknown>;
16
+ } & OptionsExtended<Account>): Promise<AxiosResponse<Account>>;
17
+ get(id: number, options?: OptionsExtended<Account>): Promise<Account>;
18
+ list(): AsyncGenerator<Account>;
19
+ list<F extends keyof Account>(options: {
20
+ fields: F[];
21
+ } & OptionsExtended<Account>): AsyncGenerator<Pick<Account, F>>;
22
+ list(options?: OptionsExtended<Account>): AsyncGenerator<Account>;
23
+ listAll(): Promise<Account[]>;
24
+ listAll<F extends keyof Account>(options: {
25
+ fields: F[];
26
+ } & OptionsExtended<Account>): Promise<Pick<Account, F>[]>;
27
+ listAll(options?: OptionsExtended<Account>): Promise<Account[]>;
28
+ listByPage(): AsyncGenerator<AxiosResponse<Account[]>>;
29
+ listByPage<F extends keyof Account>(options: {
30
+ fields: F[];
31
+ } & OptionsExtended<Account>): AsyncGenerator<AxiosResponse<Pick<Account, F>[]>>;
32
+ listByPage(options: OptionsExtended<Account>): AsyncGenerator<AxiosResponse<Account[]>>;
14
33
  }
@@ -7,12 +7,10 @@ export class AccountsService extends Service {
7
7
  get(id, options) {
8
8
  return super
9
9
  .fetch({ url: `${this.apiPath}/${id}` }, options)
10
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
10
+ .then((res) => (options?.rawResponse ? res : res.data));
11
11
  }
12
12
  async *list(options) {
13
- for await (const res of super.iterator({ url: this.apiPath }, options)) {
14
- yield res;
15
- }
13
+ yield* super.iterator({ url: this.apiPath }, options);
16
14
  }
17
15
  async listAll(options) {
18
16
  const accounts = [];
@@ -1,32 +1,51 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { Attendance } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  import { AttendanceQueryParams } from '../interfaces/query-params/attendance-query-params.interface.js';
5
5
  type RequiredProps = 'user' | 'in_time';
6
- export declare class AttendanceService extends Service {
6
+ export declare class AttendanceService extends Service<Attendance> {
7
7
  private apiPath;
8
8
  create(data: RequirementsOf<Attendance, RequiredProps>): Promise<Attendance>;
9
9
  create(data: RequirementsOf<Attendance, RequiredProps>, options: {
10
10
  rawResponse: true;
11
- } & Options): Promise<AxiosResponse<Attendance, any>>;
11
+ } & Options): Promise<AxiosResponse<Attendance>>;
12
12
  create(data: RequirementsOf<Attendance, RequiredProps>, options: Options): Promise<Attendance>;
13
13
  get(id: number): Promise<Attendance>;
14
+ get<F extends keyof Attendance>(id: number, options: {
15
+ fields: F[];
16
+ rawResponse: true;
17
+ } & OptionsExtended<Attendance>): Promise<AxiosResponse<Pick<Attendance, F>>>;
18
+ get<F extends keyof Attendance>(id: number, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<Attendance>): Promise<Pick<Attendance, F>>;
14
21
  get(id: number, options: {
15
22
  rawResponse: true;
16
- } & Options): Promise<AxiosResponse<Attendance, any>>;
17
- get(id: number, options: Options): Promise<Attendance>;
18
- list(query: AttendanceQueryParams, options?: Options): AsyncGenerator<Attendance, void, unknown>;
19
- listAll(query: AttendanceQueryParams, options?: Options): Promise<Attendance[]>;
20
- listByPage(query: AttendanceQueryParams, options?: Options): AsyncGenerator<AxiosResponse<Attendance[], any>, any, unknown>;
23
+ } & Options): Promise<AxiosResponse<Attendance>>;
24
+ get(id: number, options?: OptionsExtended<Attendance>): Promise<Attendance>;
25
+ list(query: AttendanceQueryParams): AsyncGenerator<Attendance>;
26
+ list<F extends keyof Attendance>(query: AttendanceQueryParams, options: {
27
+ fields: F[];
28
+ } & OptionsExtended<Attendance>): AsyncGenerator<Pick<Attendance, F>>;
29
+ list(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>): AsyncGenerator<Attendance>;
30
+ listAll(query: AttendanceQueryParams): Promise<Attendance[]>;
31
+ listAll<F extends keyof Attendance>(query: AttendanceQueryParams, options: {
32
+ fields: F[];
33
+ } & OptionsExtended<Attendance>): Promise<Pick<Attendance, F>[]>;
34
+ listAll(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>): Promise<Attendance[]>;
35
+ listByPage(query: AttendanceQueryParams): AsyncGenerator<AxiosResponse<Attendance[]>>;
36
+ listByPage<F extends keyof Attendance>(query: AttendanceQueryParams, options: {
37
+ fields: F[];
38
+ } & OptionsExtended<Attendance>): AsyncGenerator<AxiosResponse<Pick<Attendance, F>[]>>;
39
+ listByPage(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>): AsyncGenerator<AxiosResponse<Attendance[]>>;
21
40
  update(id: number, data: Partial<Attendance>): Promise<Attendance>;
22
41
  update(id: number, data: Partial<Attendance>, options: {
23
42
  rawResponse: true;
24
- } & Options): Promise<AxiosResponse<Attendance, any>>;
43
+ } & Options): Promise<AxiosResponse<Attendance>>;
25
44
  update(id: number, data: Partial<Attendance>, options: Options): Promise<Attendance>;
26
45
  delete(id: number): Promise<number>;
27
46
  delete(id: number, options: {
28
47
  rawResponse: true;
29
- } & Options): Promise<AxiosResponse<Attendance, any>>;
30
- delete(id: number, options: Options): Promise<number>;
48
+ } & Options): Promise<AxiosResponse<void>>;
49
+ delete(id: number, options?: Options): Promise<number>;
31
50
  }
32
51
  export {};