rotacloud 1.1.2 → 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 (137) hide show
  1. package/dist/cjs/interfaces/query-params/index.d.ts +0 -1
  2. package/dist/cjs/interfaces/query-params/index.js +0 -1
  3. package/dist/cjs/services/accounts.service.d.ts +26 -7
  4. package/dist/cjs/services/accounts.service.js +10 -20
  5. package/dist/cjs/services/attendance.service.d.ts +30 -11
  6. package/dist/cjs/services/attendance.service.js +16 -26
  7. package/dist/cjs/services/auth.service.js +1 -3
  8. package/dist/cjs/services/availability.service.d.ts +3 -3
  9. package/dist/cjs/services/availability.service.js +8 -18
  10. package/dist/cjs/services/daily-budgets.service.d.ts +19 -7
  11. package/dist/cjs/services/daily-budgets.service.js +12 -22
  12. package/dist/cjs/services/daily-revenue.service.d.ts +18 -6
  13. package/dist/cjs/services/daily-revenue.service.js +11 -21
  14. package/dist/cjs/services/day-notes.service.d.ts +27 -8
  15. package/dist/cjs/services/day-notes.service.js +15 -25
  16. package/dist/cjs/services/days-off.service.d.ts +17 -5
  17. package/dist/cjs/services/days-off.service.js +13 -23
  18. package/dist/cjs/services/groups.service.d.ts +27 -8
  19. package/dist/cjs/services/groups.service.js +12 -22
  20. package/dist/cjs/services/leave-embargoes.service.d.ts +27 -8
  21. package/dist/cjs/services/leave-embargoes.service.js +16 -26
  22. package/dist/cjs/services/leave-request.service.d.ts +27 -8
  23. package/dist/cjs/services/leave-request.service.js +15 -25
  24. package/dist/cjs/services/leave.service.d.ts +28 -10
  25. package/dist/cjs/services/leave.service.js +13 -46
  26. package/dist/cjs/services/locations.service.d.ts +27 -8
  27. package/dist/cjs/services/locations.service.js +16 -26
  28. package/dist/cjs/services/pins.service.d.ts +12 -5
  29. package/dist/cjs/services/pins.service.js +1 -1
  30. package/dist/cjs/services/roles.service.d.ts +27 -8
  31. package/dist/cjs/services/roles.service.js +16 -26
  32. package/dist/cjs/services/service.d.ts +12 -3
  33. package/dist/cjs/services/service.js +1 -2
  34. package/dist/cjs/services/settings.service.d.ts +1 -1
  35. package/dist/cjs/services/settings.service.js +1 -1
  36. package/dist/cjs/services/shifts.service.d.ts +30 -11
  37. package/dist/cjs/services/shifts.service.js +21 -31
  38. package/dist/cjs/services/terminals-active.service.d.ts +20 -8
  39. package/dist/cjs/services/terminals-active.service.js +16 -26
  40. package/dist/cjs/services/terminals.service.d.ts +27 -8
  41. package/dist/cjs/services/terminals.service.js +13 -23
  42. package/dist/cjs/services/time-zone.service.d.ts +2 -2
  43. package/dist/cjs/services/time-zone.service.js +10 -20
  44. package/dist/cjs/services/toil-accruals.service.d.ts +4 -4
  45. package/dist/cjs/services/toil-accruals.service.js +12 -22
  46. package/dist/cjs/services/toil-allowance.service.d.ts +3 -3
  47. package/dist/cjs/services/toil-allowance.service.js +9 -19
  48. package/dist/cjs/services/users-clock-in.service.d.ts +22 -10
  49. package/dist/cjs/services/users-clock-in.service.js +5 -5
  50. package/dist/cjs/services/users.service.d.ts +28 -9
  51. package/dist/cjs/services/users.service.js +16 -26
  52. package/dist/cjs/version.js +1 -1
  53. package/dist/mjs/interfaces/query-params/index.d.ts +0 -1
  54. package/dist/mjs/interfaces/query-params/index.js +0 -1
  55. package/dist/mjs/services/accounts.service.d.ts +26 -7
  56. package/dist/mjs/services/accounts.service.js +2 -4
  57. package/dist/mjs/services/attendance.service.d.ts +30 -11
  58. package/dist/mjs/services/attendance.service.js +8 -10
  59. package/dist/mjs/services/auth.service.js +1 -3
  60. package/dist/mjs/services/availability.service.d.ts +3 -3
  61. package/dist/mjs/services/availability.service.js +3 -5
  62. package/dist/mjs/services/daily-budgets.service.d.ts +19 -7
  63. package/dist/mjs/services/daily-budgets.service.js +4 -6
  64. package/dist/mjs/services/daily-revenue.service.d.ts +18 -6
  65. package/dist/mjs/services/daily-revenue.service.js +3 -5
  66. package/dist/mjs/services/day-notes.service.d.ts +27 -8
  67. package/dist/mjs/services/day-notes.service.js +7 -9
  68. package/dist/mjs/services/days-off.service.d.ts +17 -5
  69. package/dist/mjs/services/days-off.service.js +5 -7
  70. package/dist/mjs/services/groups.service.d.ts +27 -8
  71. package/dist/mjs/services/groups.service.js +4 -6
  72. package/dist/mjs/services/leave-embargoes.service.d.ts +27 -8
  73. package/dist/mjs/services/leave-embargoes.service.js +8 -10
  74. package/dist/mjs/services/leave-request.service.d.ts +27 -8
  75. package/dist/mjs/services/leave-request.service.js +7 -9
  76. package/dist/mjs/services/leave.service.d.ts +28 -10
  77. package/dist/mjs/services/leave.service.js +5 -12
  78. package/dist/mjs/services/locations.service.d.ts +27 -8
  79. package/dist/mjs/services/locations.service.js +8 -10
  80. package/dist/mjs/services/pins.service.d.ts +12 -5
  81. package/dist/mjs/services/pins.service.js +1 -1
  82. package/dist/mjs/services/roles.service.d.ts +27 -8
  83. package/dist/mjs/services/roles.service.js +8 -10
  84. package/dist/mjs/services/service.d.ts +12 -3
  85. package/dist/mjs/services/service.js +0 -2
  86. package/dist/mjs/services/settings.service.d.ts +1 -1
  87. package/dist/mjs/services/settings.service.js +1 -1
  88. package/dist/mjs/services/shifts.service.d.ts +30 -11
  89. package/dist/mjs/services/shifts.service.js +13 -15
  90. package/dist/mjs/services/terminals-active.service.d.ts +20 -8
  91. package/dist/mjs/services/terminals-active.service.js +8 -10
  92. package/dist/mjs/services/terminals.service.d.ts +27 -8
  93. package/dist/mjs/services/terminals.service.js +5 -7
  94. package/dist/mjs/services/time-zone.service.d.ts +2 -2
  95. package/dist/mjs/services/time-zone.service.js +2 -4
  96. package/dist/mjs/services/toil-accruals.service.d.ts +4 -4
  97. package/dist/mjs/services/toil-accruals.service.js +4 -6
  98. package/dist/mjs/services/toil-allowance.service.d.ts +3 -3
  99. package/dist/mjs/services/toil-allowance.service.js +1 -3
  100. package/dist/mjs/services/users-clock-in.service.d.ts +22 -10
  101. package/dist/mjs/services/users-clock-in.service.js +5 -5
  102. package/dist/mjs/services/users.service.d.ts +28 -9
  103. package/dist/mjs/services/users.service.js +8 -10
  104. package/dist/mjs/version.js +1 -1
  105. package/package.json +1 -1
  106. package/src/interfaces/query-params/index.ts +0 -1
  107. package/src/services/accounts.service.ts +30 -14
  108. package/src/services/attendance.service.ts +57 -28
  109. package/src/services/auth.service.ts +1 -3
  110. package/src/services/availability.service.ts +14 -13
  111. package/src/services/daily-budgets.service.ts +41 -20
  112. package/src/services/daily-revenue.service.ts +37 -19
  113. package/src/services/day-notes.service.ts +51 -25
  114. package/src/services/days-off.service.ts +46 -25
  115. package/src/services/groups.service.ts +40 -20
  116. package/src/services/leave-embargoes.service.ts +54 -25
  117. package/src/services/leave-request.service.ts +53 -24
  118. package/src/services/leave.service.ts +41 -27
  119. package/src/services/locations.service.ts +54 -25
  120. package/src/services/pins.service.ts +11 -6
  121. package/src/services/roles.service.ts +49 -25
  122. package/src/services/service.ts +35 -9
  123. package/src/services/settings.service.ts +2 -2
  124. package/src/services/shifts.service.ts +62 -36
  125. package/src/services/terminals-active.service.ts +36 -23
  126. package/src/services/terminals.service.ts +36 -18
  127. package/src/services/time-zone.service.ts +4 -6
  128. package/src/services/toil-accruals.service.ts +9 -11
  129. package/src/services/toil-allowance.service.ts +3 -5
  130. package/src/services/users-clock-in.service.ts +30 -16
  131. package/src/services/users.service.ts +49 -26
  132. package/src/version.ts +1 -1
  133. package/dist/cjs/interfaces/query-params/internal-query-params.interface.d.ts +0 -5
  134. package/dist/cjs/interfaces/query-params/internal-query-params.interface.js +0 -2
  135. package/dist/mjs/interfaces/query-params/internal-query-params.interface.d.ts +0 -5
  136. package/dist/mjs/interfaces/query-params/internal-query-params.interface.js +0 -1
  137. package/src/interfaces/query-params/internal-query-params.interface.ts +0 -5
@@ -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.2' };
4
+ exports.Version = { version: '1.2.0' };
@@ -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';
@@ -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 {};
@@ -6,18 +6,16 @@ export class AttendanceService extends Service {
6
6
  }
7
7
  create(data, options) {
8
8
  return super
9
- .fetch({ url: this.apiPath, data, method: 'POST' })
10
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
9
+ .fetch({ url: this.apiPath, data, method: 'POST' }, options)
10
+ .then((res) => (options?.rawResponse ? res : res.data));
11
11
  }
12
12
  get(id, options) {
13
13
  return super
14
14
  .fetch({ url: `${this.apiPath}/${id}` }, options)
15
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
15
+ .then((res) => (options?.rawResponse ? res : res.data));
16
16
  }
17
17
  async *list(query, options) {
18
- for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
19
- yield res;
20
- }
18
+ yield* super.iterator({ url: this.apiPath, params: query }, options);
21
19
  }
22
20
  async listAll(query, options) {
23
21
  const attendance = [];
@@ -35,12 +33,12 @@ export class AttendanceService extends Service {
35
33
  url: `${this.apiPath}/${id}`,
36
34
  data,
37
35
  method: 'POST',
38
- })
39
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
36
+ }, options)
37
+ .then((res) => (options?.rawResponse ? res : res.data));
40
38
  }
41
39
  delete(id, options) {
42
40
  return super
43
- .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
44
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
41
+ .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' }, options)
42
+ .then((res) => (options?.rawResponse ? res : res.status));
45
43
  }
46
44
  }
@@ -5,8 +5,6 @@ export class AuthService extends Service {
5
5
  this.apiPath = '/auth';
6
6
  }
7
7
  get(options) {
8
- return super
9
- .fetch({ url: this.apiPath }, options)
10
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
8
+ return super.fetch({ url: this.apiPath }, options).then((res) => (options?.rawResponse ? res : res.data));
11
9
  }
12
10
  }
@@ -2,7 +2,7 @@ import { AxiosResponse } from 'axios';
2
2
  import { Service, Options } from './index.js';
3
3
  import { AvailabilityQueryParams } from '../interfaces/query-params/availability-query-params.interface.js';
4
4
  import { Availability } from '../interfaces/availability.interface.js';
5
- export declare class AvailabilityService extends Service {
5
+ export declare class AvailabilityService extends Service<Availability> {
6
6
  private apiPath;
7
7
  update(data: Availability): Promise<Availability>;
8
8
  update(data: Availability, options: {
@@ -20,6 +20,6 @@ export declare class AvailabilityService extends Service {
20
20
  rawResponse: true;
21
21
  } & Options): Promise<AxiosResponse<Availability>>;
22
22
  delete(user: number, dates: string[], options?: Options): Promise<Availability | AxiosResponse<Availability>>;
23
- list(query: AvailabilityQueryParams, options?: Options): AsyncGenerator<Availability, void, unknown>;
24
- listByPage(query: AvailabilityQueryParams, options?: Options): AsyncGenerator<AxiosResponse<Availability[], any>, any, unknown>;
23
+ list(query?: AvailabilityQueryParams, options?: Options): AsyncGenerator<Availability, void, undefined>;
24
+ listByPage(query?: AvailabilityQueryParams, options?: Options): AsyncGenerator<AxiosResponse<Availability[], any>, any, unknown>;
25
25
  }