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
@@ -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
  }
@@ -10,8 +10,8 @@ export class AvailabilityService extends Service {
10
10
  url: this.apiPath,
11
11
  data,
12
12
  method: 'POST',
13
- })
14
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
13
+ }, options)
14
+ .then((res) => (options?.rawResponse ? res : res.data));
15
15
  }
16
16
  create(data, options) {
17
17
  return this.update(data, options);
@@ -27,9 +27,7 @@ export class AvailabilityService extends Service {
27
27
  }, options);
28
28
  }
29
29
  async *list(query, options) {
30
- for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
31
- yield res;
32
- }
30
+ yield* super.iterator({ url: this.apiPath, params: query }, options);
33
31
  }
34
32
  listByPage(query, options) {
35
33
  return super.iterator({ url: this.apiPath, params: query }, options).byPage();
@@ -1,15 +1,27 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { DailyBudgets } from '../interfaces/daily-budgets.interface.js';
3
- import { Service, Options } from './index.js';
3
+ import { Service, OptionsExtended } from './index.js';
4
4
  import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
5
- export declare class DailyBudgetsService extends Service {
5
+ export declare class DailyBudgetsService extends Service<DailyBudgets> {
6
6
  private apiPath;
7
- list(query: DailyBudgetsQueryParams, options?: Options): AsyncGenerator<DailyBudgets, void, unknown>;
8
- listAll(query: DailyBudgetsQueryParams, options?: Options): Promise<DailyBudgets[]>;
9
- listByPage(query: DailyBudgetsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<DailyBudgets[], any>, any, unknown>;
7
+ list(query: DailyBudgetsQueryParams): AsyncGenerator<DailyBudgets>;
8
+ list<F extends keyof DailyBudgets>(query: DailyBudgetsQueryParams, options: {
9
+ fields: F[];
10
+ } & OptionsExtended<DailyBudgets>): AsyncGenerator<Pick<DailyBudgets, F>>;
11
+ list(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>): AsyncGenerator<DailyBudgets>;
12
+ listAll(query: DailyBudgetsQueryParams): Promise<DailyBudgets[]>;
13
+ listAll<F extends keyof DailyBudgets>(query: DailyBudgetsQueryParams, options: {
14
+ fields: F[];
15
+ } & OptionsExtended<DailyBudgets>): Promise<Pick<DailyBudgets, F>[]>;
16
+ listAll(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>): Promise<DailyBudgets[]>;
17
+ listByPage(query: DailyBudgetsQueryParams): AsyncGenerator<AxiosResponse<DailyBudgets[]>>;
18
+ listByPage<F extends keyof DailyBudgets>(query: DailyBudgetsQueryParams, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<DailyBudgets>): AsyncGenerator<AxiosResponse<Pick<DailyBudgets, F>[]>>;
21
+ listByPage(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>): AsyncGenerator<AxiosResponse<DailyBudgets[]>>;
10
22
  update(data: Partial<DailyBudgets>[]): Promise<number>;
11
23
  update(data: Partial<DailyBudgets>[], options: {
12
24
  rawResponse: true;
13
- } & Options): Promise<AxiosResponse<DailyBudgets, any>>;
14
- update(data: Partial<DailyBudgets>[], options: Options): Promise<number>;
25
+ } & OptionsExtended<DailyBudgets>): Promise<AxiosResponse<void>>;
26
+ update(data: Partial<DailyBudgets>[], options?: OptionsExtended<DailyBudgets>): Promise<number>;
15
27
  }
@@ -5,9 +5,7 @@ export class DailyBudgetsService extends Service {
5
5
  this.apiPath = '/daily_budgets';
6
6
  }
7
7
  async *list(query, options) {
8
- for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
9
- yield res;
10
- }
8
+ yield* super.iterator({ url: this.apiPath, params: query }, options);
11
9
  }
12
10
  async listAll(query, options) {
13
11
  const attendance = [];
@@ -22,10 +20,10 @@ export class DailyBudgetsService extends Service {
22
20
  update(data, options) {
23
21
  return super
24
22
  .fetch({
25
- url: `${this.apiPath}`,
23
+ url: this.apiPath,
26
24
  data,
27
25
  method: 'POST',
28
- })
29
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
26
+ }, options)
27
+ .then((res) => (options?.rawResponse ? res : res.status));
30
28
  }
31
29
  }
@@ -1,15 +1,27 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { DailyRevenue } from '../interfaces/daily-revenue.interface.js';
3
- import { Service, Options } from './index.js';
3
+ import { Service, Options, OptionsExtended } from './index.js';
4
4
  import { DailyRevenueQueryParams } from '../interfaces/query-params/daily-revenue-query-params.interface.js';
5
- export declare class DailyRevenueService extends Service {
5
+ export declare class DailyRevenueService extends Service<DailyRevenue> {
6
6
  private apiPath;
7
- list(query: DailyRevenueQueryParams, options?: Options): AsyncGenerator<DailyRevenue, void, unknown>;
8
- listAll(query: DailyRevenueQueryParams, options?: Options): Promise<DailyRevenue[]>;
9
- listByPage(query: DailyRevenueQueryParams, options?: Options): AsyncGenerator<AxiosResponse<DailyRevenue[], any>, any, unknown>;
7
+ list(query?: DailyRevenueQueryParams): AsyncGenerator<DailyRevenue>;
8
+ list<F extends keyof DailyRevenue>(query: DailyRevenueQueryParams, options: {
9
+ fields: F[];
10
+ } & OptionsExtended<DailyRevenue>): AsyncGenerator<Pick<DailyRevenue, F>>;
11
+ list(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>): AsyncGenerator<DailyRevenue>;
12
+ listAll(query?: DailyRevenueQueryParams): Promise<DailyRevenue[]>;
13
+ listAll<F extends keyof DailyRevenue>(query: DailyRevenueQueryParams, options: {
14
+ fields: F[];
15
+ } & OptionsExtended<DailyRevenue>): Promise<Pick<DailyRevenue, F>[]>;
16
+ listAll(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>): Promise<DailyRevenue[]>;
17
+ listByPage(query?: DailyRevenueQueryParams): AsyncGenerator<AxiosResponse<DailyRevenue[]>>;
18
+ listByPage<F extends keyof DailyRevenue>(query: DailyRevenueQueryParams, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<DailyRevenue>): AsyncGenerator<AxiosResponse<Pick<DailyRevenue, F>[]>>;
21
+ listByPage(query: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>): AsyncGenerator<AxiosResponse<DailyRevenue[]>>;
10
22
  update(data: Partial<DailyRevenue>[]): Promise<number>;
11
23
  update(data: Partial<DailyRevenue>[], options: {
12
24
  rawResponse: true;
13
- } & Options): Promise<AxiosResponse<DailyRevenue, any>>;
25
+ } & Options): Promise<AxiosResponse<void>>;
14
26
  update(data: Partial<DailyRevenue>[], options: Options): Promise<number>;
15
27
  }
@@ -5,9 +5,7 @@ export class DailyRevenueService extends Service {
5
5
  this.apiPath = '/daily_revenue';
6
6
  }
7
7
  async *list(query, options) {
8
- for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
9
- yield res;
10
- }
8
+ yield* super.iterator({ url: this.apiPath, params: query }, options);
11
9
  }
12
10
  async listAll(query, options) {
13
11
  const attendance = [];
@@ -25,7 +23,7 @@ export class DailyRevenueService extends Service {
25
23
  url: `${this.apiPath}`,
26
24
  data,
27
25
  method: 'POST',
28
- })
29
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
26
+ }, options)
27
+ .then((res) => (options?.rawResponse ? res : res.status));
30
28
  }
31
29
  }
@@ -1,8 +1,8 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { DayNote } from '../interfaces/index.js';
3
- import { Service, Options } from './index.js';
3
+ import { Service, Options, OptionsExtended } from './index.js';
4
4
  import { DayNotesQueryParams } from '../interfaces/query-params/day-notes-query-params.interface';
5
- export declare class DayNotesService extends Service {
5
+ export declare class DayNotesService extends Service<DayNote> {
6
6
  private apiPath;
7
7
  create(data: DayNote): Promise<DayNote>;
8
8
  create(data: DayNote, options: {
@@ -10,13 +10,32 @@ export declare class DayNotesService extends Service {
10
10
  } & Options): Promise<AxiosResponse<DayNote, any>>;
11
11
  create(data: DayNote, options: Options): Promise<DayNote>;
12
12
  get(id: number): Promise<DayNote>;
13
+ get<F extends keyof DayNote>(id: number, options: {
14
+ fields: F[];
15
+ rawResponse: true;
16
+ } & OptionsExtended<DayNote>): Promise<AxiosResponse<Pick<DayNote, F>>>;
17
+ get<F extends keyof DayNote>(id: number, options: {
18
+ fields: F[];
19
+ } & OptionsExtended<DayNote>): Promise<Pick<DayNote, F>>;
13
20
  get(id: number, options: {
14
21
  rawResponse: true;
15
- } & Options): Promise<AxiosResponse<DayNote, any>>;
16
- get(id: number, options: Options): Promise<DayNote>;
17
- list(query: DayNotesQueryParams, options?: Options): AsyncGenerator<DayNote, void, unknown>;
18
- listAll(query: DayNotesQueryParams, options?: Options): Promise<DayNote[]>;
19
- listByPage(query: DayNotesQueryParams, options?: Options): AsyncGenerator<AxiosResponse<DayNote[], any>, any, unknown>;
22
+ } & Options): Promise<AxiosResponse<DayNote>>;
23
+ get(id: number, options?: OptionsExtended<DayNote>): Promise<DayNote>;
24
+ list(query: DayNotesQueryParams): AsyncGenerator<DayNote>;
25
+ list<F extends keyof DayNote>(query: DayNotesQueryParams, options: {
26
+ fields: F[];
27
+ } & OptionsExtended<DayNote>): AsyncGenerator<Pick<DayNote, F>>;
28
+ list(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>): AsyncGenerator<DayNote>;
29
+ listAll(query: DayNotesQueryParams): Promise<DayNote[]>;
30
+ listAll<F extends keyof DayNote>(query: DayNotesQueryParams, options: {
31
+ fields: F[];
32
+ } & OptionsExtended<DayNote>): Promise<Pick<DayNote, F>[]>;
33
+ listAll(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>): Promise<DayNote[]>;
34
+ listByPage(query: DayNotesQueryParams): AsyncGenerator<AxiosResponse<DayNote[]>>;
35
+ listByPage<F extends keyof DayNote>(query: DayNotesQueryParams, options: {
36
+ fields: F[];
37
+ } & OptionsExtended<DayNote>): AsyncGenerator<AxiosResponse<Pick<DayNote, F>[]>>;
38
+ listByPage(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>): AsyncGenerator<AxiosResponse<DayNote[]>>;
20
39
  update(id: number, data: Partial<DayNote>): Promise<DayNote>;
21
40
  update(id: number, data: Partial<DayNote>, options: {
22
41
  rawResponse: true;
@@ -25,6 +44,6 @@ export declare class DayNotesService extends Service {
25
44
  delete(id: number): Promise<number>;
26
45
  delete(id: number, options: {
27
46
  rawResponse: true;
28
- } & Options): Promise<AxiosResponse<any, any>>;
47
+ } & Options): Promise<AxiosResponse<void>>;
29
48
  delete(id: number, options: Options): Promise<number>;
30
49
  }
@@ -7,17 +7,15 @@ export class DayNotesService extends Service {
7
7
  create(data, options) {
8
8
  return super
9
9
  .fetch({ url: this.apiPath, data, method: 'POST' })
10
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
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 dayNotes = [];
@@ -35,12 +33,12 @@ export class DayNotesService 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
  }
@@ -1,6 +1,6 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { DaysOff } from '../interfaces/index.js';
3
- import { Service, Options } from './index.js';
3
+ import { Service, Options, OptionsExtended } from './index.js';
4
4
  import { DaysOffQueryParams } from '../interfaces/query-params/days-off-query-params.interface.js';
5
5
  export declare class DaysOffService extends Service<DaysOff> {
6
6
  private apiPath;
@@ -9,12 +9,24 @@ export declare class DaysOffService extends Service<DaysOff> {
9
9
  rawResponse: true;
10
10
  } & Options): Promise<AxiosResponse<DaysOff, any>>;
11
11
  create(dates: string[], users: number[], options: Options): Promise<number>;
12
- list(query: DaysOffQueryParams, options?: Options): AsyncGenerator<DaysOff, void, unknown>;
13
- listAll(query: DaysOffQueryParams, options?: Options): Promise<DaysOff[]>;
14
- listByPage(query: DaysOffQueryParams, options?: Options): AsyncGenerator<AxiosResponse<DaysOff[], any>, any, unknown>;
12
+ list(query?: DaysOffQueryParams): AsyncGenerator<DaysOff>;
13
+ list<F extends keyof DaysOff>(query: DaysOffQueryParams, options: {
14
+ fields: F[];
15
+ } & OptionsExtended<DaysOff>): AsyncGenerator<Pick<DaysOff, F>>;
16
+ list(query?: DaysOffQueryParams, options?: OptionsExtended<DaysOff>): AsyncGenerator<DaysOff>;
17
+ listAll(query?: DaysOffQueryParams): Promise<DaysOff[]>;
18
+ listAll<F extends keyof DaysOff>(query: DaysOffQueryParams, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<DaysOff>): Promise<Pick<DaysOff, F>[]>;
21
+ listAll(query?: DaysOffQueryParams, options?: OptionsExtended<DaysOff>): Promise<DaysOff[]>;
22
+ listByPage(query?: DaysOffQueryParams): AsyncGenerator<AxiosResponse<DaysOff[]>>;
23
+ listByPage<F extends keyof DaysOff>(query: DaysOffQueryParams, options: {
24
+ fields: F[];
25
+ } & OptionsExtended<DaysOff>): AsyncGenerator<AxiosResponse<Pick<DaysOff, F>[]>>;
26
+ listByPage(query?: DaysOffQueryParams, options?: OptionsExtended<DaysOff>): AsyncGenerator<AxiosResponse<DaysOff[]>>;
15
27
  delete(dates: string[], users: number[]): Promise<number>;
16
28
  delete(dates: string[], users: number[], options: {
17
29
  rawResponse: true;
18
- } & Options): Promise<AxiosResponse<any, any>>;
30
+ } & Options): Promise<AxiosResponse<void>>;
19
31
  delete(dates: string[], users: number[], options: Options): Promise<number>;
20
32
  }
@@ -13,13 +13,11 @@ export class DaysOffService extends Service {
13
13
  users,
14
14
  },
15
15
  method: 'POST',
16
- })
17
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
16
+ }, options)
17
+ .then((res) => (options?.rawResponse ? res : res.status));
18
18
  }
19
19
  async *list(query, options) {
20
- for await (const res of super.iterator({ url: this.apiPath, params: query }, options)) {
21
- yield res;
22
- }
20
+ yield* super.iterator({ url: this.apiPath, params: query }, options);
23
21
  }
24
22
  async listAll(query, options) {
25
23
  const daysOff = [];
@@ -40,7 +38,7 @@ export class DaysOffService extends Service {
40
38
  dates,
41
39
  users,
42
40
  },
43
- })
44
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
41
+ }, options)
42
+ .then((res) => (options?.rawResponse ? res : res.status));
45
43
  }
46
44
  }
@@ -1,9 +1,9 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { Group } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  import { GroupsQueryParams } from '../interfaces/query-params/groups-query-params.interface.js';
5
5
  type RequiredProps = 'name';
6
- export declare class GroupsService extends Service {
6
+ export declare class GroupsService extends Service<Group> {
7
7
  private apiPath;
8
8
  create(data: RequirementsOf<Group, RequiredProps>): Promise<Group>;
9
9
  create(data: RequirementsOf<Group, RequiredProps>, options: {
@@ -11,13 +11,32 @@ export declare class GroupsService extends Service {
11
11
  } & Options): Promise<AxiosResponse<Group, any>>;
12
12
  create(data: RequirementsOf<Group, RequiredProps>, options: Options): Promise<Group>;
13
13
  get(id: number): Promise<Group>;
14
+ get<F extends keyof Group>(id: number, options: {
15
+ fields: F[];
16
+ rawResponse: true;
17
+ } & OptionsExtended<Group>): Promise<AxiosResponse<Pick<Group, F>>>;
18
+ get<F extends keyof Group>(id: number, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<Group>): Promise<Pick<Group, F>>;
14
21
  get(id: number, options: {
15
22
  rawResponse: true;
16
- } & Options): Promise<AxiosResponse<Group, any>>;
17
- get(id: number, options: Options): Promise<Group>;
18
- list(query?: GroupsQueryParams, options?: Options): AsyncGenerator<Group, void, unknown>;
19
- listAll(query?: GroupsQueryParams, options?: Options): Promise<Group[]>;
20
- listByPage(query?: GroupsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<Group[], any>, any, unknown>;
23
+ } & Options): Promise<AxiosResponse<Group>>;
24
+ get(id: number, options?: OptionsExtended<Group>): Promise<Group>;
25
+ list(query?: GroupsQueryParams): AsyncGenerator<Group>;
26
+ list<F extends keyof Group>(query: GroupsQueryParams, options: {
27
+ fields: F[];
28
+ } & OptionsExtended<Group>): AsyncGenerator<Pick<Group, F>>;
29
+ list(query?: GroupsQueryParams, options?: OptionsExtended<Group>): AsyncGenerator<Group>;
30
+ listAll(query?: GroupsQueryParams): Promise<Group[]>;
31
+ listAll<F extends keyof Group>(query: GroupsQueryParams, options: {
32
+ fields: F[];
33
+ } & OptionsExtended<Group>): Promise<Pick<Group, F>[]>;
34
+ listAll(query?: GroupsQueryParams, options?: OptionsExtended<Group>): Promise<Group[]>;
35
+ listByPage(query?: GroupsQueryParams): AsyncGenerator<AxiosResponse<Group[]>>;
36
+ listByPage<F extends keyof Group>(query: GroupsQueryParams, options: {
37
+ fields: F[];
38
+ } & OptionsExtended<Group>): AsyncGenerator<AxiosResponse<Pick<Group, F>[]>>;
39
+ listByPage(query?: GroupsQueryParams, options?: OptionsExtended<Group>): AsyncGenerator<AxiosResponse<Group[]>>;
21
40
  update(id: number, data: Partial<Group>): Promise<Group>;
22
41
  update(id: number, data: Partial<Group>, options: {
23
42
  rawResponse: true;
@@ -26,7 +45,7 @@ export declare class GroupsService 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 {};
@@ -12,12 +12,10 @@ export class GroupsService extends Service {
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 groups = [];
@@ -36,11 +34,11 @@ export class GroupsService extends Service {
36
34
  data,
37
35
  method: 'POST',
38
36
  })
39
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
37
+ .then((res) => (options?.rawResponse ? res : res.data));
40
38
  }
41
39
  delete(id, options) {
42
40
  return super
43
41
  .fetch({ url: `${this.apiPath}/${id}`, method: 'DELETE' })
44
- .then((res) => Promise.resolve(options?.rawResponse ? res : res.status));
42
+ .then((res) => (options?.rawResponse ? res : res.status));
45
43
  }
46
44
  }
@@ -18,6 +18,7 @@ export * from './settings.service.js';
18
18
  export * from './shifts.service.js';
19
19
  export * from './terminals.service.js';
20
20
  export * from './terminals-active.service.js';
21
+ export * from './time-zone.service.js';
21
22
  export * from './toil-accruals.service.js';
22
23
  export * from './toil-allowance.service.js';
23
24
  export * from './users-clock-in.service.js';
@@ -18,6 +18,7 @@ export * from './settings.service.js';
18
18
  export * from './shifts.service.js';
19
19
  export * from './terminals.service.js';
20
20
  export * from './terminals-active.service.js';
21
+ export * from './time-zone.service.js';
21
22
  export * from './toil-accruals.service.js';
22
23
  export * from './toil-allowance.service.js';
23
24
  export * from './users-clock-in.service.js';
@@ -1,9 +1,9 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { LeaveEmbargo } from '../interfaces/index.js';
3
- import { Service, Options, RequirementsOf } from './index.js';
3
+ import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
4
4
  import { LeaveEmbargoesQueryParams } from '../rotacloud.js';
5
5
  type RequiredProps = 'start_date' | 'end_date' | 'users';
6
- export declare class LeaveEmbargoesService extends Service {
6
+ export declare class LeaveEmbargoesService extends Service<LeaveEmbargo> {
7
7
  private apiPath;
8
8
  create(data: RequirementsOf<LeaveEmbargo, RequiredProps>): Promise<LeaveEmbargo>;
9
9
  create(data: RequirementsOf<LeaveEmbargo, RequiredProps>, options: {
@@ -11,13 +11,32 @@ export declare class LeaveEmbargoesService extends Service {
11
11
  } & Options): Promise<AxiosResponse<LeaveEmbargo, any>>;
12
12
  create(data: RequirementsOf<LeaveEmbargo, RequiredProps>, options: Options): Promise<LeaveEmbargo>;
13
13
  get(id: number): Promise<LeaveEmbargo>;
14
+ get<F extends keyof LeaveEmbargo>(id: number, options: {
15
+ fields: F[];
16
+ rawResponse: true;
17
+ } & OptionsExtended<LeaveEmbargo>): Promise<AxiosResponse<Pick<LeaveEmbargo, F>>>;
18
+ get<F extends keyof LeaveEmbargo>(id: number, options: {
19
+ fields: F[];
20
+ } & OptionsExtended<LeaveEmbargo>): Promise<Pick<LeaveEmbargo, F>>;
14
21
  get(id: number, options: {
15
22
  rawResponse: true;
16
- }): Promise<AxiosResponse<LeaveEmbargo, any>>;
17
- get(id: number, options: Options): Promise<LeaveEmbargo>;
18
- list(query: LeaveEmbargoesQueryParams, options?: Options): AsyncGenerator<LeaveEmbargo, void, unknown>;
19
- listAll(query: LeaveEmbargoesQueryParams, options?: Options): Promise<LeaveEmbargo[]>;
20
- listByPage(query: LeaveEmbargoesQueryParams, options?: Options): AsyncGenerator<AxiosResponse<LeaveEmbargo[], any>, any, unknown>;
23
+ } & Options): Promise<AxiosResponse<LeaveEmbargo>>;
24
+ get(id: number, options?: OptionsExtended<LeaveEmbargo>): Promise<LeaveEmbargo>;
25
+ list(query?: LeaveEmbargoesQueryParams): AsyncGenerator<LeaveEmbargo>;
26
+ list<F extends keyof LeaveEmbargo>(query: LeaveEmbargoesQueryParams, options: {
27
+ fields: F[];
28
+ } & OptionsExtended<LeaveEmbargo>): AsyncGenerator<Pick<LeaveEmbargo, F>>;
29
+ list(query?: LeaveEmbargoesQueryParams, options?: OptionsExtended<LeaveEmbargo>): AsyncGenerator<LeaveEmbargo>;
30
+ listAll(query?: LeaveEmbargoesQueryParams): Promise<LeaveEmbargo[]>;
31
+ listAll<F extends keyof LeaveEmbargo>(query: LeaveEmbargoesQueryParams, options: {
32
+ fields: F[];
33
+ } & OptionsExtended<LeaveEmbargo>): Promise<Pick<LeaveEmbargo, F>[]>;
34
+ listAll(query?: LeaveEmbargoesQueryParams, options?: OptionsExtended<LeaveEmbargo>): Promise<LeaveEmbargo[]>;
35
+ listByPage(query?: LeaveEmbargoesQueryParams): AsyncGenerator<AxiosResponse<LeaveEmbargo[]>>;
36
+ listByPage<F extends keyof LeaveEmbargo>(query: LeaveEmbargoesQueryParams, options: {
37
+ fields: F[];
38
+ } & OptionsExtended<LeaveEmbargo>): AsyncGenerator<AxiosResponse<Pick<LeaveEmbargo, F>[]>>;
39
+ listByPage(query: LeaveEmbargoesQueryParams, options?: OptionsExtended<LeaveEmbargo>): AsyncGenerator<AxiosResponse<LeaveEmbargo[]>>;
21
40
  update(id: number, data: Partial<LeaveEmbargo>): Promise<LeaveEmbargo>;
22
41
  update(id: number, data: Partial<LeaveEmbargo>, options: {
23
42
  rawResponse: true;
@@ -26,7 +45,7 @@ export declare class LeaveEmbargoesService 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 {};
@@ -6,18 +6,16 @@ export class LeaveEmbargoesService 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 leave = [];
@@ -35,12 +33,12 @@ export class LeaveEmbargoesService 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
  }