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
@@ -2,7 +2,7 @@ import { AxiosResponse } from 'axios';
2
2
  import { Service, Options } from './index.js';
3
3
  import { Settings } from '../interfaces/index.js';
4
4
  import { SettingsQueryParams } from '../rotacloud.js';
5
- export declare class SettingsService extends Service {
5
+ export declare class SettingsService extends Service<Settings> {
6
6
  private apiPath;
7
7
  get(query: SettingsQueryParams): Promise<Settings>;
8
8
  get(query: SettingsQueryParams, options: {
@@ -10,7 +10,7 @@ class SettingsService extends index_js_1.Service {
10
10
  get(query, options) {
11
11
  return super
12
12
  .fetch({ url: `${this.apiPath}`, params: query }, options)
13
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
13
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
14
14
  }
15
15
  }
16
16
  exports.SettingsService = SettingsService;
@@ -1,9 +1,9 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { Shift } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  import { ShiftsQueryParams } from '../interfaces/query-params/shifts-query-params.interface.js';
5
5
  type RequiredProps = 'end_time' | 'start_time' | 'location';
6
- export declare class ShiftsService extends Service {
6
+ export declare class ShiftsService extends Service<Shift> {
7
7
  private apiPath;
8
8
  create(data: RequirementsOf<Shift, RequiredProps>): Promise<Shift>;
9
9
  create(data: RequirementsOf<Shift, RequiredProps>, options: {
@@ -11,13 +11,32 @@ export declare class ShiftsService extends Service {
11
11
  } & Options): Promise<AxiosResponse<Shift, any>>;
12
12
  create(data: RequirementsOf<Shift, RequiredProps>, options: Options): Promise<Shift>;
13
13
  get(id: number): Promise<Shift>;
14
+ get<F extends keyof Shift>(id: number, options: {
15
+ fields: F[];
16
+ rawResponse: true;
17
+ } & OptionsExtended<Shift>): Promise<AxiosResponse<Pick<Shift, F>>>;
18
+ get<F extends keyof Shift>(id: number, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<Shift>): Promise<Pick<Shift, F>>;
14
21
  get(id: number, options: {
15
22
  rawResponse: true;
16
- } & Options): Promise<AxiosResponse<Shift, any>>;
17
- get(id: number, options: Options): Promise<Shift>;
18
- list(query: ShiftsQueryParams, options?: Options): AsyncGenerator<Shift, void, unknown>;
19
- listAll(query: ShiftsQueryParams, options?: Options): Promise<Shift[]>;
20
- listByPage(query: ShiftsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<Shift[], any>, any, unknown>;
23
+ } & Options): Promise<AxiosResponse<Shift>>;
24
+ get(id: number, options?: OptionsExtended<Shift>): Promise<Shift>;
25
+ list(query: ShiftsQueryParams): AsyncGenerator<Shift>;
26
+ list<F extends keyof Shift>(query: ShiftsQueryParams, options: {
27
+ fields: F[];
28
+ } & OptionsExtended<Shift>): AsyncGenerator<Pick<Shift, F>>;
29
+ list(query: ShiftsQueryParams, options?: OptionsExtended<Shift>): AsyncGenerator<Shift>;
30
+ listAll(query: ShiftsQueryParams): Promise<Shift[]>;
31
+ listAll<F extends keyof Shift>(query: ShiftsQueryParams, options: {
32
+ fields: F[];
33
+ } & OptionsExtended<Shift>): Promise<Pick<Shift, F>[]>;
34
+ listAll(query: ShiftsQueryParams, options?: OptionsExtended<Shift>): Promise<Shift[]>;
35
+ listByPage(query: ShiftsQueryParams): AsyncGenerator<AxiosResponse<Shift[]>>;
36
+ listByPage<F extends keyof Shift>(query: ShiftsQueryParams, options: {
37
+ fields: F[];
38
+ } & OptionsExtended<Shift>): AsyncGenerator<AxiosResponse<Pick<Shift, F>[]>>;
39
+ listByPage(query: ShiftsQueryParams, options?: OptionsExtended<Shift>): AsyncGenerator<AxiosResponse<Shift[]>>;
21
40
  update(shift: RequirementsOf<Shift, 'id'>): Promise<Shift>;
22
41
  update(shift: RequirementsOf<Shift, 'id'>, options: {
23
42
  rawResponse: true;
@@ -48,12 +67,12 @@ export declare class ShiftsService extends Service {
48
67
  delete(ids: number | number[]): Promise<number>;
49
68
  delete(ids: number | number[], options: {
50
69
  rawResponse: true;
51
- } & Options): Promise<AxiosResponse<any, any>>;
70
+ } & Options): Promise<AxiosResponse<void>>;
52
71
  delete(ids: number | number[], options: Options): Promise<number>;
53
72
  acknowledge(data: number[]): Promise<number>;
54
73
  acknowledge(data: number[], options: {
55
74
  rawResponse: true;
56
- } & Options): Promise<AxiosResponse<any, any>>;
75
+ } & Options): Promise<AxiosResponse<any>>;
57
76
  acknowledge(data: number[], options: Options): Promise<number>;
58
77
  publish(data: {
59
78
  shifts: number[];
@@ -62,7 +81,7 @@ export declare class ShiftsService extends Service {
62
81
  shifts: number[];
63
82
  }, options: {
64
83
  rawResponse: true;
65
- } & Options): Promise<AxiosResponse<any, any>>;
84
+ } & Options): Promise<AxiosResponse<any>>;
66
85
  publish(data: {
67
86
  shifts: number[];
68
87
  }, options: Options): Promise<number>;
@@ -73,7 +92,7 @@ export declare class ShiftsService extends Service {
73
92
  shifts: number[];
74
93
  }, options: {
75
94
  rawResponse: true;
76
- } & Options): Promise<AxiosResponse<any, any>>;
95
+ } & Options): Promise<AxiosResponse<any>>;
77
96
  unpublish(data: {
78
97
  shifts: number[];
79
98
  }, options: Options): Promise<number>;
@@ -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 ShiftsService 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 shifts = [];
75
65
  try {
@@ -80,12 +70,12 @@ class ShiftsService extends index_js_1.Service {
80
70
  shifts.push(shift);
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 shifts;
91
81
  });
@@ -100,7 +90,7 @@ class ShiftsService extends index_js_1.Service {
100
90
  url: `${this.apiPath}/${shifts.id}`,
101
91
  data: shifts,
102
92
  method: 'POST',
103
- })
93
+ }, options)
104
94
  .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
105
95
  }
106
96
  return super
@@ -108,7 +98,7 @@ class ShiftsService extends index_js_1.Service {
108
98
  url: this.apiPath,
109
99
  data: shifts,
110
100
  method: 'POST',
111
- })
101
+ }, options)
112
102
  .then((res) => {
113
103
  if (options === null || options === void 0 ? void 0 : options.rawResponse)
114
104
  return res;
@@ -128,22 +118,22 @@ class ShiftsService extends index_js_1.Service {
128
118
  const params = Array.isArray(ids)
129
119
  ? { url: this.apiPath, data: { ids }, method: 'DELETE' }
130
120
  : { url: `${this.apiPath}/${ids}`, method: 'DELETE' };
131
- return super.fetch(params).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
121
+ return super.fetch(params, options).then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
132
122
  }
133
123
  acknowledge(data, options) {
134
124
  return super
135
- .fetch({ url: '/shifts_acknowledged', data, method: 'POST' })
136
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
125
+ .fetch({ url: '/shifts_acknowledged', data, method: 'POST' }, options)
126
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
137
127
  }
138
128
  publish(data, options) {
139
129
  return super
140
- .fetch({ url: '/shifts_published', data, method: 'POST' })
141
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
130
+ .fetch({ url: '/shifts_published', data, method: 'POST' }, options)
131
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
142
132
  }
143
133
  unpublish(data, options) {
144
134
  return super
145
- .fetch({ url: '/shifts_published', data, method: 'DELETE' })
146
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
135
+ .fetch({ url: '/shifts_published', data, method: 'DELETE' }, options)
136
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
147
137
  }
148
138
  }
149
139
  exports.ShiftsService = ShiftsService;
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { Terminal, TerminalLocation } from '../interfaces/index.js';
3
- import { Service, Options } from './index.js';
3
+ import { Service, Options, OptionsExtended } from './index.js';
4
4
  interface LaunchTerminal {
5
5
  terminal: number;
6
6
  device: string;
@@ -10,25 +10,37 @@ interface PingTerminal {
10
10
  action: string;
11
11
  device: string;
12
12
  }
13
- export declare class TerminalsActiveService extends Service {
13
+ export declare class TerminalsActiveService extends Service<Terminal> {
14
14
  private apiPath;
15
15
  launchTerminal(data: LaunchTerminal): Promise<Terminal>;
16
16
  launchTerminal(data: LaunchTerminal, options: {
17
17
  rawResponse: true;
18
- } & Options): Promise<AxiosResponse<any, any>>;
18
+ } & Options): Promise<AxiosResponse<Terminal>>;
19
19
  launchTerminal(data: LaunchTerminal, options: Options): Promise<Terminal>;
20
20
  pingTerminal(id: number, data: PingTerminal): Promise<number>;
21
21
  pingTerminal(id: number, data: PingTerminal, options: {
22
22
  rawResponse: true;
23
- } & Options): Promise<AxiosResponse<any, any>>;
23
+ } & Options): Promise<AxiosResponse<number>>;
24
24
  pingTerminal(id: number, data: PingTerminal, options: Options): Promise<number>;
25
- list(options?: Options): AsyncGenerator<Terminal, void, unknown>;
26
- listAll(options?: Options): Promise<Terminal[]>;
27
- listByPage(options?: Options): AsyncGenerator<AxiosResponse<Terminal[], any>, any, unknown>;
25
+ list(): AsyncGenerator<Terminal>;
26
+ list<F extends keyof Terminal>(options: {
27
+ fields: F[];
28
+ } & OptionsExtended<Terminal>): AsyncGenerator<Pick<Terminal, F>>;
29
+ list(options?: OptionsExtended<Terminal>): AsyncGenerator<Terminal>;
30
+ listAll(): Promise<Terminal[]>;
31
+ listAll<F extends keyof Terminal>(options: {
32
+ fields: F[];
33
+ } & OptionsExtended<Terminal>): Promise<Pick<Terminal, F>[]>;
34
+ listAll(options?: OptionsExtended<Terminal>): Promise<Terminal[]>;
35
+ listByPage(): AsyncGenerator<AxiosResponse<Terminal[]>>;
36
+ listByPage<F extends keyof Terminal>(options: {
37
+ fields: F[];
38
+ } & OptionsExtended<Terminal>): AsyncGenerator<AxiosResponse<Pick<Terminal, F>[]>>;
39
+ listByPage(options?: OptionsExtended<Terminal>): AsyncGenerator<AxiosResponse<Terminal[]>>;
28
40
  closeTerminal(id: number): Promise<number>;
29
41
  closeTerminal(id: number, options: {
30
42
  rawResponse: true;
31
- } & Options): Promise<AxiosResponse<any, any>>;
43
+ } & Options): Promise<AxiosResponse<void>>;
32
44
  closeTerminal(id: number, options: Options): Promise<number>;
33
45
  }
34
46
  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 = [];
@@ -38,42 +43,27 @@ class TerminalsActiveService extends index_js_1.Service {
38
43
  launchTerminal(data, options) {
39
44
  return super
40
45
  .fetch({
41
- url: `${this.apiPath}`,
46
+ url: this.apiPath,
42
47
  data,
43
48
  method: 'POST',
44
- })
45
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
49
+ }, options)
50
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
46
51
  }
47
52
  pingTerminal(id, data, options) {
48
53
  return super
49
- .fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' })
50
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
54
+ .fetch({ url: `${this.apiPath}/${id}`, data, method: 'POST' }, options)
55
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
51
56
  }
52
57
  list(options) {
53
58
  const _super = Object.create(null, {
54
59
  iterator: { get: () => super.iterator }
55
60
  });
56
61
  return __asyncGenerator(this, arguments, function* list_1() {
57
- var _a, e_1, _b, _c;
58
- try {
59
- for (var _d = true, _e = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
60
- _c = _f.value;
61
- _d = false;
62
- const res = _c;
63
- yield yield __await(res);
64
- }
65
- }
66
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
67
- finally {
68
- try {
69
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
70
- }
71
- finally { if (e_1) throw e_1.error; }
72
- }
62
+ yield __await(yield* __asyncDelegator(__asyncValues(_super.iterator.call(this, { url: this.apiPath }, options))));
73
63
  });
74
64
  }
75
65
  listAll(options) {
76
- var _a, e_2, _b, _c;
66
+ var _a, e_1, _b, _c;
77
67
  return __awaiter(this, void 0, void 0, function* () {
78
68
  const users = [];
79
69
  try {
@@ -84,12 +74,12 @@ class TerminalsActiveService extends index_js_1.Service {
84
74
  users.push(user);
85
75
  }
86
76
  }
87
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
77
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
88
78
  finally {
89
79
  try {
90
80
  if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
91
81
  }
92
- finally { if (e_2) throw e_2.error; }
82
+ finally { if (e_1) throw e_1.error; }
93
83
  }
94
84
  return users;
95
85
  });
@@ -99,8 +89,8 @@ class TerminalsActiveService extends index_js_1.Service {
99
89
  }
100
90
  closeTerminal(id, options) {
101
91
  return super
102
- .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
103
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
92
+ .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' }, options)
93
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
104
94
  }
105
95
  }
106
96
  exports.TerminalsActiveService = TerminalsActiveService;
@@ -1,8 +1,8 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { Terminal } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  type RequiredProps = 'name' | 'timezone';
5
- export declare class TerminalsService extends Service {
5
+ export declare class TerminalsService extends Service<Terminal> {
6
6
  private apiPath;
7
7
  create(data: RequirementsOf<Terminal, RequiredProps>): Promise<Terminal>;
8
8
  create(data: RequirementsOf<Terminal, RequiredProps>, options: {
@@ -10,10 +10,17 @@ export declare class TerminalsService extends Service {
10
10
  } & Options): Promise<AxiosResponse<Terminal, any>>;
11
11
  create(data: RequirementsOf<Terminal, RequiredProps>, options: Options): Promise<Terminal>;
12
12
  get(id: number): Promise<Terminal>;
13
+ get<F extends keyof Terminal>(id: number, options: {
14
+ fields: F[];
15
+ rawResponse: true;
16
+ } & OptionsExtended<Terminal>): Promise<AxiosResponse<Pick<Terminal, F>>>;
17
+ get<F extends keyof Terminal>(id: number, options: {
18
+ fields: F[];
19
+ } & OptionsExtended<Terminal>): Promise<Pick<Terminal, F>>;
13
20
  get(id: number, options: {
14
21
  rawResponse: true;
15
- } & Options): Promise<AxiosResponse<Terminal, any>>;
16
- get(id: number, options: Options): Promise<Terminal>;
22
+ } & Options): Promise<AxiosResponse<Terminal>>;
23
+ get(id: number, options?: OptionsExtended<Terminal>): Promise<Terminal>;
17
24
  update(id: number, data: Partial<Terminal>): Promise<Terminal>;
18
25
  update(id: number, data: Partial<Terminal>, options: {
19
26
  rawResponse: true;
@@ -22,10 +29,22 @@ export declare class TerminalsService extends Service {
22
29
  closeTerminal(id: number): Promise<number>;
23
30
  closeTerminal(id: number, options: {
24
31
  rawResponse: true;
25
- } & Options): Promise<AxiosResponse<number, any>>;
32
+ } & Options): Promise<AxiosResponse<void>>;
26
33
  closeTerminal(id: number, options: Options): Promise<number>;
27
- list(options?: Options): AsyncGenerator<Terminal, void, unknown>;
28
- listAll(options?: Options): Promise<Terminal[]>;
29
- listByPage(options?: Options): AsyncGenerator<AxiosResponse<Terminal[], any>, any, unknown>;
34
+ list(): AsyncGenerator<Terminal>;
35
+ list<F extends keyof Terminal>(options: {
36
+ fields: F[];
37
+ } & OptionsExtended<Terminal>): AsyncGenerator<Pick<Terminal, F>>;
38
+ list(options?: OptionsExtended<Terminal>): AsyncGenerator<Terminal>;
39
+ listAll(): Promise<Terminal[]>;
40
+ listAll<F extends keyof Terminal>(options: {
41
+ fields: F[];
42
+ } & OptionsExtended<Terminal>): Promise<Pick<Terminal, F>[]>;
43
+ listAll(options?: OptionsExtended<Terminal>): Promise<Terminal[]>;
44
+ listByPage(): AsyncGenerator<AxiosResponse<Terminal[]>>;
45
+ listByPage<F extends keyof Terminal>(options: {
46
+ fields: F[];
47
+ } & OptionsExtended<Terminal>): AsyncGenerator<AxiosResponse<Pick<Terminal, F>[]>>;
48
+ listByPage(options?: OptionsExtended<Terminal>): AsyncGenerator<AxiosResponse<Terminal[]>>;
30
49
  }
31
50
  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 = [];
@@ -38,12 +43,12 @@ class TerminalsService extends index_js_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
  update(id, data, options) {
49
54
  return super
@@ -52,38 +57,23 @@ class TerminalsService extends index_js_1.Service {
52
57
  data,
53
58
  method: 'POST',
54
59
  })
55
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
60
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
56
61
  }
57
62
  closeTerminal(id, options) {
58
63
  return super
59
64
  .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
60
- .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
65
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status));
61
66
  }
62
67
  list(options) {
63
68
  const _super = Object.create(null, {
64
69
  iterator: { get: () => super.iterator }
65
70
  });
66
71
  return __asyncGenerator(this, arguments, function* list_1() {
67
- var _a, e_1, _b, _c;
68
- try {
69
- for (var _d = true, _e = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _f; _f = yield __await(_e.next()), _a = _f.done, !_a; _d = true) {
70
- _c = _f.value;
71
- _d = false;
72
- const res = _c;
73
- yield yield __await(res);
74
- }
75
- }
76
- catch (e_1_1) { e_1 = { error: e_1_1 }; }
77
- finally {
78
- try {
79
- if (!_d && !_a && (_b = _e.return)) yield __await(_b.call(_e));
80
- }
81
- finally { if (e_1) throw e_1.error; }
82
- }
72
+ yield __await(yield* __asyncDelegator(__asyncValues(_super.iterator.call(this, { url: this.apiPath }, options))));
83
73
  });
84
74
  }
85
75
  listAll(options) {
86
- var _a, e_2, _b, _c;
76
+ var _a, e_1, _b, _c;
87
77
  return __awaiter(this, void 0, void 0, function* () {
88
78
  const users = [];
89
79
  try {
@@ -94,12 +84,12 @@ class TerminalsService extends index_js_1.Service {
94
84
  users.push(user);
95
85
  }
96
86
  }
97
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
87
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
98
88
  finally {
99
89
  try {
100
90
  if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
101
91
  }
102
- finally { if (e_2) throw e_2.error; }
92
+ finally { if (e_1) throw e_1.error; }
103
93
  }
104
94
  return users;
105
95
  });
@@ -0,0 +1,14 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { Service, Options } from './index.js';
3
+ import { TimeZone } from '../interfaces/index.js';
4
+ export declare class TimeZoneService extends Service<TimeZone> {
5
+ private apiPath;
6
+ get(id: number): Promise<TimeZone>;
7
+ get(id: number, options: {
8
+ rawResponse: true;
9
+ } & Options): Promise<AxiosResponse<TimeZone, any>>;
10
+ get(id: number, options: Options): Promise<TimeZone>;
11
+ list(options?: Options): AsyncGenerator<TimeZone, void, undefined>;
12
+ listAll(options?: Options): Promise<TimeZone[]>;
13
+ listByPage(options?: Options): AsyncGenerator<AxiosResponse<TimeZone[], any>, any, unknown>;
14
+ }
@@ -0,0 +1,82 @@
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 __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
+ };
24
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
25
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
26
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
27
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
28
+ 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); }); }; }
29
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
30
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
31
+ function fulfill(value) { resume("next", value); }
32
+ function reject(value) { resume("throw", value); }
33
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
34
+ };
35
+ Object.defineProperty(exports, "__esModule", { value: true });
36
+ exports.TimeZoneService = void 0;
37
+ const index_js_1 = require("./index.js");
38
+ class TimeZoneService extends index_js_1.Service {
39
+ constructor() {
40
+ super(...arguments);
41
+ this.apiPath = '/timezones';
42
+ }
43
+ get(id, options) {
44
+ return super
45
+ .fetch({ url: `${this.apiPath}/${id}` }, options)
46
+ .then((res) => ((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.data));
47
+ }
48
+ list(options) {
49
+ const _super = Object.create(null, {
50
+ iterator: { get: () => super.iterator }
51
+ });
52
+ return __asyncGenerator(this, arguments, function* list_1() {
53
+ yield __await(yield* __asyncDelegator(__asyncValues(_super.iterator.call(this, { url: this.apiPath }, options))));
54
+ });
55
+ }
56
+ listAll(options) {
57
+ var _a, e_1, _b, _c;
58
+ return __awaiter(this, void 0, void 0, function* () {
59
+ const timezones = [];
60
+ try {
61
+ for (var _d = true, _e = __asyncValues(this.list(options)), _f; _f = yield _e.next(), _a = _f.done, !_a; _d = true) {
62
+ _c = _f.value;
63
+ _d = false;
64
+ const timezone = _c;
65
+ timezones.push(timezone);
66
+ }
67
+ }
68
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
69
+ finally {
70
+ try {
71
+ if (!_d && !_a && (_b = _e.return)) yield _b.call(_e);
72
+ }
73
+ finally { if (e_1) throw e_1.error; }
74
+ }
75
+ return timezones;
76
+ });
77
+ }
78
+ listByPage(options) {
79
+ return super.iterator({ url: this.apiPath }, options).byPage();
80
+ }
81
+ }
82
+ exports.TimeZoneService = TimeZoneService;
@@ -15,13 +15,13 @@ export declare class ToilAccrualsService extends Service {
15
15
  rawResponse: true;
16
16
  } & Options): Promise<AxiosResponse<ToilAccrual, any>>;
17
17
  get(id: number, options: Options): Promise<ToilAccrual>;
18
- list(query: ToilAccrualsQueryParams, options?: Options): AsyncGenerator<ToilAccrual, void, unknown>;
19
- listAll(query: ToilAccrualsQueryParams, options?: Options): Promise<ToilAccrual[]>;
20
- listByPage(query: ToilAccrualsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ToilAccrual[], any>, any, unknown>;
18
+ list(query?: ToilAccrualsQueryParams, options?: Options): AsyncGenerator<ToilAccrual, void, undefined>;
19
+ listAll(query?: ToilAccrualsQueryParams, options?: Options): Promise<ToilAccrual[]>;
20
+ listByPage(query?: ToilAccrualsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ToilAccrual[], any>, any, unknown>;
21
21
  delete(id: number): Promise<number>;
22
22
  delete(id: number, options: {
23
23
  rawResponse: true;
24
- } & Options): Promise<AxiosResponse<any, any>>;
24
+ } & Options): Promise<AxiosResponse<void>>;
25
25
  delete(id: number, options: Options): Promise<number>;
26
26
  }
27
27
  export {};