rotacloud 1.0.23 → 1.0.27

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 (97) hide show
  1. package/.github/workflows/publish.yml +1 -1
  2. package/README.md +1 -2
  3. package/dist/cjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
  4. package/dist/cjs/models/daily-budgets.model.js +2 -0
  5. package/dist/cjs/rotacloud.d.ts +3 -1
  6. package/dist/cjs/rotacloud.js +2 -0
  7. package/dist/cjs/services/accounts.service.d.ts +3 -4
  8. package/dist/cjs/services/accounts.service.js +2 -2
  9. package/dist/cjs/services/attendance.service.d.ts +13 -18
  10. package/dist/cjs/services/attendance.service.js +6 -6
  11. package/dist/cjs/services/availability.service.d.ts +9 -16
  12. package/dist/cjs/services/availability.service.js +4 -4
  13. package/dist/cjs/services/daily-budgets.service.d.ts +16 -0
  14. package/dist/cjs/services/daily-budgets.service.js +99 -0
  15. package/dist/cjs/services/daily-revenue.service.d.ts +16 -0
  16. package/dist/cjs/services/daily-revenue.service.js +99 -0
  17. package/dist/cjs/services/days-off.service.d.ts +8 -12
  18. package/dist/cjs/services/days-off.service.js +6 -6
  19. package/dist/cjs/services/groups.service.d.ts +13 -18
  20. package/dist/cjs/services/groups.service.js +6 -6
  21. package/dist/cjs/services/index.d.ts +2 -0
  22. package/dist/cjs/services/index.js +2 -0
  23. package/dist/cjs/services/leave-embargoes.service.d.ts +13 -18
  24. package/dist/cjs/services/leave-embargoes.service.js +6 -6
  25. package/dist/cjs/services/leave-request.service.d.ts +12 -17
  26. package/dist/cjs/services/leave-request.service.js +4 -4
  27. package/dist/cjs/services/leave.service.d.ts +13 -18
  28. package/dist/cjs/services/leave.service.js +9 -9
  29. package/dist/cjs/services/locations.service.d.ts +13 -18
  30. package/dist/cjs/services/locations.service.js +6 -6
  31. package/dist/cjs/services/roles.service.d.ts +13 -18
  32. package/dist/cjs/services/roles.service.js +6 -6
  33. package/dist/cjs/services/service.d.ts +6 -4
  34. package/dist/cjs/services/service.js +2 -2
  35. package/dist/cjs/services/shifts.service.d.ts +19 -27
  36. package/dist/cjs/services/shifts.service.js +6 -6
  37. package/dist/cjs/services/users.service.d.ts +11 -16
  38. package/dist/cjs/services/users.service.js +6 -6
  39. package/dist/cjs/version.js +1 -1
  40. package/dist/mjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
  41. package/dist/mjs/models/daily-budgets.model.js +2 -0
  42. package/dist/mjs/rotacloud.d.ts +3 -1
  43. package/dist/mjs/rotacloud.js +3 -1
  44. package/dist/mjs/services/accounts.service.d.ts +3 -4
  45. package/dist/mjs/services/accounts.service.js +2 -2
  46. package/dist/mjs/services/attendance.service.d.ts +13 -18
  47. package/dist/mjs/services/attendance.service.js +7 -8
  48. package/dist/mjs/services/availability.service.d.ts +9 -16
  49. package/dist/mjs/services/availability.service.js +4 -4
  50. package/dist/mjs/services/daily-budgets.service.d.ts +16 -0
  51. package/dist/mjs/services/daily-budgets.service.js +38 -0
  52. package/dist/mjs/services/daily-revenue.service.d.ts +16 -0
  53. package/dist/mjs/services/daily-revenue.service.js +38 -0
  54. package/dist/mjs/services/days-off.service.d.ts +8 -12
  55. package/dist/mjs/services/days-off.service.js +7 -8
  56. package/dist/mjs/services/groups.service.d.ts +13 -18
  57. package/dist/mjs/services/groups.service.js +7 -8
  58. package/dist/mjs/services/index.d.ts +2 -0
  59. package/dist/mjs/services/index.js +2 -0
  60. package/dist/mjs/services/leave-embargoes.service.d.ts +13 -18
  61. package/dist/mjs/services/leave-embargoes.service.js +7 -8
  62. package/dist/mjs/services/leave-request.service.d.ts +12 -17
  63. package/dist/mjs/services/leave-request.service.js +5 -6
  64. package/dist/mjs/services/leave.service.d.ts +13 -18
  65. package/dist/mjs/services/leave.service.js +10 -11
  66. package/dist/mjs/services/locations.service.d.ts +13 -18
  67. package/dist/mjs/services/locations.service.js +7 -8
  68. package/dist/mjs/services/roles.service.d.ts +13 -18
  69. package/dist/mjs/services/roles.service.js +7 -8
  70. package/dist/mjs/services/service.d.ts +6 -4
  71. package/dist/mjs/services/service.js +7 -2
  72. package/dist/mjs/services/shifts.service.d.ts +19 -27
  73. package/dist/mjs/services/shifts.service.js +7 -8
  74. package/dist/mjs/services/users.service.d.ts +11 -16
  75. package/dist/mjs/services/users.service.js +6 -6
  76. package/dist/mjs/version.js +1 -1
  77. package/package.json +1 -3
  78. package/src/interfaces/query-params/daily-budgets-query-params.interface.ts +2 -2
  79. package/src/models/daily-budgets.model.ts +2 -0
  80. package/src/rotacloud.ts +4 -0
  81. package/src/services/accounts.service.ts +5 -6
  82. package/src/services/attendance.service.ts +20 -32
  83. package/src/services/availability.service.ts +14 -34
  84. package/src/services/daily-budgets.service.ts +53 -0
  85. package/src/services/daily-revenue.service.ts +53 -0
  86. package/src/services/days-off.service.ts +15 -21
  87. package/src/services/groups.service.ts +21 -23
  88. package/src/services/index.ts +2 -0
  89. package/src/services/leave-embargoes.service.ts +21 -30
  90. package/src/services/leave-request.service.ts +20 -31
  91. package/src/services/leave.service.ts +24 -29
  92. package/src/services/locations.service.ts +20 -26
  93. package/src/services/roles.service.ts +20 -24
  94. package/src/services/service.ts +18 -8
  95. package/src/services/shifts.service.ts +29 -41
  96. package/src/services/users.service.ts +19 -20
  97. package/src/version.ts +1 -1
@@ -27,7 +27,7 @@ jobs:
27
27
  registry-url: https://registry.npmjs.org/
28
28
  - name: Add version number to package
29
29
  run: |
30
- version="$(npm show . version)"
30
+ version=$(node -pe "require('./package.json').version")
31
31
  echo "Version is $version"
32
32
  echo "export const Version = { version: '$version' };" > ./src/version.ts
33
33
  - name: Run CI
package/README.md CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  ## Contributing
4
4
 
5
- Please ensure you perform the ```npm run version:all``` command before commiting and pushing your changes to the remote branch.
6
-
5
+ Please ensure you perform the `npm run version:bump` command before commiting and pushing your changes to the remote branch.
7
6
 
8
7
  ## Configuration
9
8
 
@@ -1,5 +1,5 @@
1
1
  export interface DailyBudgetsQueryParams {
2
- start?: string;
3
- end?: string;
2
+ start: string;
3
+ end: string;
4
4
  locations?: number[];
5
5
  }
@@ -5,6 +5,8 @@ class DailyBudgets {
5
5
  constructor(dailyBudgets) {
6
6
  this.date = dailyBudgets.date;
7
7
  this.location = dailyBudgets.location;
8
+ this.hours_budget = dailyBudgets.hours_budget;
9
+ this.salary_budget = dailyBudgets.salary_budget;
8
10
  }
9
11
  }
10
12
  exports.DailyBudgets = DailyBudgets;
@@ -1,4 +1,4 @@
1
- import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
1
+ import { AccountsService, AttendanceService, AvailabilityService, DailyBudgetsService, DailyRevenueService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
2
2
  import { SDKConfig } from './interfaces/index.js';
3
3
  export declare class RotaCloud {
4
4
  static config: SDKConfig;
@@ -6,6 +6,8 @@ export declare class RotaCloud {
6
6
  accounts: AccountsService;
7
7
  attendance: AttendanceService;
8
8
  availability: AvailabilityService;
9
+ dailyBudgets: DailyBudgetsService;
10
+ dailyRevenue: DailyRevenueService;
9
11
  daysOff: DaysOffService;
10
12
  group: GroupsService;
11
13
  leaveEmbargoes: LeaveEmbargoesService;
@@ -18,6 +18,8 @@ class RotaCloud {
18
18
  this.accounts = new index_js_1.AccountsService();
19
19
  this.attendance = new index_js_1.AttendanceService();
20
20
  this.availability = new index_js_1.AvailabilityService();
21
+ this.dailyBudgets = new index_js_1.DailyBudgetsService();
22
+ this.dailyRevenue = new index_js_1.DailyRevenueService();
21
23
  this.daysOff = new index_js_1.DaysOffService();
22
24
  this.group = new index_js_1.GroupsService();
23
25
  this.leaveEmbargoes = new index_js_1.LeaveEmbargoesService();
@@ -1,11 +1,10 @@
1
1
  import { Account } from '../models/account.model.js';
2
2
  import { Service, Options } from './index.js';
3
3
  import { ApiAccount } from '../interfaces/index.js';
4
- import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
5
4
  declare class AccountsService extends Service {
6
5
  private apiPath;
7
- list(options?: Options<InternalQueryParams>): AsyncGenerator<Account, void, unknown>;
8
- listAll(): Promise<Account[]>;
9
- listByPage(options?: Options<InternalQueryParams>): AsyncGenerator<import("axios").AxiosResponse<ApiAccount[], any>, any, unknown>;
6
+ list(options?: Options): AsyncGenerator<Account, void, unknown>;
7
+ listAll(options?: Options): Promise<Account[]>;
8
+ listByPage(options?: Options): AsyncGenerator<import("axios").AxiosResponse<ApiAccount[], any>, any, unknown>;
10
9
  }
11
10
  export { AccountsService };
@@ -57,13 +57,13 @@ class AccountsService extends index_js_1.Service {
57
57
  }
58
58
  });
59
59
  }
60
- listAll() {
60
+ listAll(options) {
61
61
  var e_2, _a;
62
62
  return __awaiter(this, void 0, void 0, function* () {
63
63
  try {
64
64
  const accounts = [];
65
65
  try {
66
- for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
66
+ for (var _b = __asyncValues(this.list(options)), _c; _c = yield _b.next(), !_c.done;) {
67
67
  const account = _c.value;
68
68
  accounts.push(account);
69
69
  }
@@ -3,36 +3,31 @@ import { ApiAttendance } from '../interfaces/index.js';
3
3
  import { Service, Options, RequirementsOf } from './index.js';
4
4
  import { Attendance } from '../models/attendance.model.js';
5
5
  import { AttendanceQueryParams } from '../interfaces/query-params/attendance-query-params.interface.js';
6
- import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
7
6
  declare type RequiredProps = 'user' | 'in_time';
8
- declare class AttendanceService extends Service {
7
+ export declare class AttendanceService extends Service {
9
8
  private apiPath;
10
9
  create(data: RequirementsOf<ApiAttendance, RequiredProps>): Promise<Attendance>;
11
10
  create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: {
12
11
  rawResponse: true;
13
- params?: InternalQueryParams;
14
- }): Promise<AxiosResponse<ApiAttendance, any>>;
15
- create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options<InternalQueryParams>): Promise<ApiAttendance>;
12
+ } & Options): Promise<AxiosResponse<ApiAttendance, any>>;
13
+ create(data: RequirementsOf<ApiAttendance, RequiredProps>, options: Options): Promise<ApiAttendance>;
16
14
  get(id: number): Promise<Attendance>;
17
15
  get(id: number, options: {
18
16
  rawResponse: true;
19
- params?: InternalQueryParams;
20
- }): Promise<AxiosResponse<ApiAttendance, any>>;
21
- get(id: number, options: Options<InternalQueryParams>): Promise<ApiAttendance>;
22
- list(options?: Options<AttendanceQueryParams & InternalQueryParams>): AsyncGenerator<Attendance, void, unknown>;
23
- listAll(): Promise<Attendance[]>;
24
- listByPage(options?: Options<AttendanceQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
17
+ } & Options): Promise<AxiosResponse<ApiAttendance, any>>;
18
+ get(id: number, options: Options): Promise<Attendance>;
19
+ list(query: AttendanceQueryParams, options?: Options): AsyncGenerator<Attendance, void, unknown>;
20
+ listAll(query: AttendanceQueryParams, options?: Options): Promise<Attendance[]>;
21
+ listByPage(query: AttendanceQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiAttendance[], any>, any, unknown>;
25
22
  update(id: number, data: Partial<ApiAttendance>): Promise<Attendance>;
26
23
  update(id: number, data: Partial<ApiAttendance>, options: {
27
24
  rawResponse: true;
28
- params?: InternalQueryParams;
29
- }): Promise<AxiosResponse<ApiAttendance, any>>;
30
- update(id: number, data: Partial<ApiAttendance>, options: Options<InternalQueryParams>): Promise<Attendance>;
25
+ } & Options): Promise<AxiosResponse<ApiAttendance, any>>;
26
+ update(id: number, data: Partial<ApiAttendance>, options: Options): Promise<Attendance>;
31
27
  delete(id: number): Promise<number>;
32
28
  delete(id: number, options: {
33
29
  rawResponse: true;
34
- params?: InternalQueryParams;
35
- }): Promise<AxiosResponse<ApiAttendance, any>>;
36
- delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
30
+ } & Options): Promise<AxiosResponse<ApiAttendance, any>>;
31
+ delete(id: number, options: Options): Promise<number>;
37
32
  }
38
- export { AttendanceService };
33
+ export {};
@@ -43,14 +43,14 @@ class AttendanceService extends index_js_1.Service {
43
43
  get(id, options) {
44
44
  return super.fetch({ url: `${this.apiPath}/${id}` }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new attendance_model_js_1.Attendance(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
45
45
  }
46
- list(options) {
46
+ list(query, options) {
47
47
  const _super = Object.create(null, {
48
48
  iterator: { get: () => super.iterator }
49
49
  });
50
50
  return __asyncGenerator(this, arguments, function* list_1() {
51
51
  var e_1, _a;
52
52
  try {
53
- for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
53
+ for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
54
54
  const res = _c.value;
55
55
  yield yield __await(new attendance_model_js_1.Attendance(res));
56
56
  }
@@ -64,13 +64,13 @@ class AttendanceService extends index_js_1.Service {
64
64
  }
65
65
  });
66
66
  }
67
- listAll() {
67
+ listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
70
  try {
71
71
  const attendance = [];
72
72
  try {
73
- for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
73
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
74
  const atten = _c.value;
75
75
  attendance.push(atten);
76
76
  }
@@ -89,8 +89,8 @@ class AttendanceService extends index_js_1.Service {
89
89
  }
90
90
  });
91
91
  }
92
- listByPage(options) {
93
- return super.iterator({ url: this.apiPath }, options).byPage();
92
+ listByPage(query, options) {
93
+ return super.iterator({ url: this.apiPath, params: query }, options).byPage();
94
94
  }
95
95
  update(id, data, options) {
96
96
  return super
@@ -1,33 +1,26 @@
1
1
  import { AxiosResponse } from 'axios';
2
- import { Service, Options, RequirementsOf } from './index.js';
3
- import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
2
+ import { Service, Options } from './index.js';
4
3
  import { AvailabilityQueryParams } from '../interfaces/query-params/availability-query-params.interface.js';
5
4
  import { Availability } from '../models/availability.model.js';
6
5
  import { ApiAvailability } from '../interfaces/availability.interface.js';
7
- declare type RequiredProps = 'start' | 'end';
8
- declare type RequiredOptions<T> = RequirementsOf<Options<T>, 'params'>;
9
6
  export declare class AvailabilityService extends Service {
10
7
  private apiPath;
11
8
  update(data: ApiAvailability): Promise<Availability>;
12
9
  update(data: ApiAvailability, options: {
13
10
  rawResponse: true;
14
- params?: InternalQueryParams;
15
- }): Promise<AxiosResponse<ApiAvailability>>;
16
- update(data: ApiAvailability, options?: Options<InternalQueryParams>): Promise<Availability | AxiosResponse<ApiAvailability>>;
11
+ } & Options): Promise<AxiosResponse<ApiAvailability>>;
12
+ update(data: ApiAvailability, options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
17
13
  /** Alias of {@link AvailabilityService["update"]} */
18
14
  create(data: ApiAvailability): Promise<Availability>;
19
15
  create(data: ApiAvailability, options: {
20
16
  rawResponse: true;
21
- params?: InternalQueryParams;
22
- }): Promise<AxiosResponse<ApiAvailability>>;
23
- create(data: ApiAvailability, options?: Options<InternalQueryParams>): Promise<Availability | AxiosResponse<ApiAvailability>>;
17
+ } & Options): Promise<AxiosResponse<ApiAvailability>>;
18
+ create(data: ApiAvailability, options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
24
19
  delete(user: number, dates: string[]): Promise<Availability>;
25
20
  delete(user: number, dates: string[], options: {
26
21
  rawResponse: true;
27
- params?: InternalQueryParams;
28
- }): Promise<AxiosResponse<ApiAvailability>>;
29
- delete(user: number, dates: string[], options?: Options<InternalQueryParams>): Promise<Availability | AxiosResponse<ApiAvailability>>;
30
- list(options: RequiredOptions<RequirementsOf<AvailabilityQueryParams, RequiredProps> & InternalQueryParams>): AsyncGenerator<Availability, void, unknown>;
31
- listByPage(options: RequiredOptions<RequirementsOf<AvailabilityQueryParams, RequiredProps> & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiAvailability[], any>, any, unknown>;
22
+ } & Options): Promise<AxiosResponse<ApiAvailability>>;
23
+ delete(user: number, dates: string[], options?: Options): Promise<Availability | AxiosResponse<ApiAvailability>>;
24
+ list(query: AvailabilityQueryParams, options?: Options): AsyncGenerator<Availability, void, unknown>;
25
+ listByPage(query: AvailabilityQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiAvailability[], any>, any, unknown>;
32
26
  }
33
- export {};
@@ -52,14 +52,14 @@ class AvailabilityService extends index_js_1.Service {
52
52
  }),
53
53
  }, options);
54
54
  }
55
- list(options) {
55
+ list(query, options) {
56
56
  const _super = Object.create(null, {
57
57
  iterator: { get: () => super.iterator }
58
58
  });
59
59
  return __asyncGenerator(this, arguments, function* list_1() {
60
60
  var e_1, _a;
61
61
  try {
62
- for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
62
+ for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
63
63
  const res = _c.value;
64
64
  yield yield __await(new availability_model_js_1.Availability(res));
65
65
  }
@@ -73,8 +73,8 @@ class AvailabilityService extends index_js_1.Service {
73
73
  }
74
74
  });
75
75
  }
76
- listByPage(options) {
77
- return super.iterator({ url: this.apiPath }, options).byPage();
76
+ listByPage(query, options) {
77
+ return super.iterator({ url: this.apiPath, params: query }, options).byPage();
78
78
  }
79
79
  }
80
80
  exports.AvailabilityService = AvailabilityService;
@@ -0,0 +1,16 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApiDailyBudgets } from '../interfaces/daily-budgets.interface.js';
3
+ import { Service, Options } from './index.js';
4
+ import { DailyBudgets } from '../models/daily-budgets.model.js';
5
+ import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
6
+ export declare class DailyBudgetsService extends Service {
7
+ private apiPath;
8
+ list(query: DailyBudgetsQueryParams, options?: Options): AsyncGenerator<DailyBudgets, void, unknown>;
9
+ listAll(query: DailyBudgetsQueryParams, options?: Options): Promise<DailyBudgets[]>;
10
+ listByPage(query: DailyBudgetsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiDailyBudgets[], any>, any, unknown>;
11
+ update(data: Partial<ApiDailyBudgets>[]): Promise<number>;
12
+ update(data: Partial<ApiDailyBudgets>[], options: {
13
+ rawResponse: true;
14
+ } & Options): Promise<AxiosResponse<ApiDailyBudgets, any>>;
15
+ update(data: Partial<ApiDailyBudgets>[], options: Options): Promise<number>;
16
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
12
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
+ var m = o[Symbol.asyncIterator], i;
14
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
+ };
18
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
22
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
23
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
24
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
25
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
26
+ function fulfill(value) { resume("next", value); }
27
+ function reject(value) { resume("throw", value); }
28
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.DailyBudgetsService = void 0;
32
+ const index_js_1 = require("./index.js");
33
+ const daily_budgets_model_js_1 = require("../models/daily-budgets.model.js");
34
+ const error_response_model_js_1 = require("../models/error-response.model.js");
35
+ class DailyBudgetsService extends index_js_1.Service {
36
+ constructor() {
37
+ super(...arguments);
38
+ this.apiPath = '/daily_budgets';
39
+ }
40
+ list(query, options) {
41
+ const _super = Object.create(null, {
42
+ iterator: { get: () => super.iterator }
43
+ });
44
+ return __asyncGenerator(this, arguments, function* list_1() {
45
+ var e_1, _a;
46
+ try {
47
+ for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
48
+ const res = _c.value;
49
+ yield yield __await(new daily_budgets_model_js_1.DailyBudgets(res));
50
+ }
51
+ }
52
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
+ finally {
54
+ try {
55
+ if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
56
+ }
57
+ finally { if (e_1) throw e_1.error; }
58
+ }
59
+ });
60
+ }
61
+ listAll(query, options) {
62
+ var e_2, _a;
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ try {
65
+ const attendance = [];
66
+ try {
67
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
68
+ const atten = _c.value;
69
+ attendance.push(atten);
70
+ }
71
+ }
72
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
73
+ finally {
74
+ try {
75
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
76
+ }
77
+ finally { if (e_2) throw e_2.error; }
78
+ }
79
+ return attendance;
80
+ }
81
+ catch (err) {
82
+ return err;
83
+ }
84
+ });
85
+ }
86
+ listByPage(query, options) {
87
+ return super.iterator({ url: this.apiPath, params: query }, options).byPage();
88
+ }
89
+ update(data, options) {
90
+ return super
91
+ .fetch({
92
+ url: `${this.apiPath}`,
93
+ data,
94
+ method: 'POST',
95
+ })
96
+ .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
97
+ }
98
+ }
99
+ exports.DailyBudgetsService = DailyBudgetsService;
@@ -0,0 +1,16 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApiDailyRevenue } from '../interfaces/daily-revenue.interface.js';
3
+ import { Service, Options } from './index.js';
4
+ import { DailyRevenue } from '../models/daily-revenue.model.js';
5
+ import { DailyRevenueQueryParams } from '../interfaces/query-params/daily-revenue-query-params.interface.js';
6
+ export declare class DailyRevenueService extends Service {
7
+ private apiPath;
8
+ list(query: DailyRevenueQueryParams, options?: Options): AsyncGenerator<DailyRevenue, void, unknown>;
9
+ listAll(query: DailyRevenueQueryParams, options?: Options): Promise<DailyRevenue[]>;
10
+ listByPage(query: DailyRevenueQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiDailyRevenue[], any>, any, unknown>;
11
+ update(data: Partial<ApiDailyRevenue>[]): Promise<number>;
12
+ update(data: Partial<ApiDailyRevenue>[], options: {
13
+ rawResponse: true;
14
+ } & Options): Promise<AxiosResponse<ApiDailyRevenue, any>>;
15
+ update(data: Partial<ApiDailyRevenue>[], options: Options): Promise<number>;
16
+ }
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __asyncValues = (this && this.__asyncValues) || function (o) {
12
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
13
+ var m = o[Symbol.asyncIterator], i;
14
+ return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
15
+ function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
16
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
17
+ };
18
+ var __await = (this && this.__await) || function (v) { return this instanceof __await ? (this.v = v, this) : new __await(v); }
19
+ var __asyncGenerator = (this && this.__asyncGenerator) || function (thisArg, _arguments, generator) {
20
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
21
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
22
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
23
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
24
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
25
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
26
+ function fulfill(value) { resume("next", value); }
27
+ function reject(value) { resume("throw", value); }
28
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
29
+ };
30
+ Object.defineProperty(exports, "__esModule", { value: true });
31
+ exports.DailyRevenueService = void 0;
32
+ const index_js_1 = require("./index.js");
33
+ const daily_revenue_model_js_1 = require("../models/daily-revenue.model.js");
34
+ const error_response_model_js_1 = require("../models/error-response.model.js");
35
+ class DailyRevenueService extends index_js_1.Service {
36
+ constructor() {
37
+ super(...arguments);
38
+ this.apiPath = '/daily_revenue';
39
+ }
40
+ list(query, options) {
41
+ const _super = Object.create(null, {
42
+ iterator: { get: () => super.iterator }
43
+ });
44
+ return __asyncGenerator(this, arguments, function* list_1() {
45
+ var e_1, _a;
46
+ try {
47
+ for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
48
+ const res = _c.value;
49
+ yield yield __await(new daily_revenue_model_js_1.DailyRevenue(res));
50
+ }
51
+ }
52
+ catch (e_1_1) { e_1 = { error: e_1_1 }; }
53
+ finally {
54
+ try {
55
+ if (_c && !_c.done && (_a = _b.return)) yield __await(_a.call(_b));
56
+ }
57
+ finally { if (e_1) throw e_1.error; }
58
+ }
59
+ });
60
+ }
61
+ listAll(query, options) {
62
+ var e_2, _a;
63
+ return __awaiter(this, void 0, void 0, function* () {
64
+ try {
65
+ const attendance = [];
66
+ try {
67
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
68
+ const atten = _c.value;
69
+ attendance.push(atten);
70
+ }
71
+ }
72
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
73
+ finally {
74
+ try {
75
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
76
+ }
77
+ finally { if (e_2) throw e_2.error; }
78
+ }
79
+ return attendance;
80
+ }
81
+ catch (err) {
82
+ return err;
83
+ }
84
+ });
85
+ }
86
+ listByPage(query, options) {
87
+ return super.iterator({ url: this.apiPath, params: query }, options).byPage();
88
+ }
89
+ update(data, options) {
90
+ return super
91
+ .fetch({
92
+ url: `${this.apiPath}`,
93
+ data,
94
+ method: 'POST',
95
+ })
96
+ .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
97
+ }
98
+ }
99
+ exports.DailyRevenueService = DailyRevenueService;
@@ -1,25 +1,21 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { ApiDaysOff } from '../interfaces/index.js';
3
3
  import { Service, Options } from './index.js';
4
- import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
5
4
  import { DaysOff } from '../models/days-off.model.js';
6
5
  import { DaysOffQueryParams } from '../interfaces/query-params/days-off-query-params.interface.js';
7
- declare class DaysOffService extends Service<ApiDaysOff> {
6
+ export declare class DaysOffService extends Service<ApiDaysOff> {
8
7
  private apiPath;
9
8
  create(dates: string[], users: number[]): Promise<number>;
10
9
  create(dates: string[], users: number[], options: {
11
10
  rawResponse: true;
12
- params?: InternalQueryParams;
13
- }): Promise<AxiosResponse<ApiDaysOff, any>>;
14
- create(dates: string[], users: number[], options: Options<InternalQueryParams>): Promise<number>;
15
- list(options?: Options<DaysOffQueryParams & InternalQueryParams>): AsyncGenerator<DaysOff, void, unknown>;
16
- listAll(): Promise<DaysOff[]>;
17
- listByPage(options?: Options<DaysOffQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiDaysOff[], any>, any, unknown>;
11
+ } & Options): Promise<AxiosResponse<ApiDaysOff, any>>;
12
+ create(dates: string[], users: number[], options: Options): Promise<number>;
13
+ list(query: DaysOffQueryParams, options?: Options): AsyncGenerator<DaysOff, void, unknown>;
14
+ listAll(query: DaysOffQueryParams, options?: Options): Promise<DaysOff[]>;
15
+ listByPage(query: DaysOffQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiDaysOff[], any>, any, unknown>;
18
16
  delete(dates: string[], users: number[]): Promise<number>;
19
17
  delete(dates: string[], users: number[], options: {
20
18
  rawResponse: true;
21
- params?: InternalQueryParams;
22
- }): Promise<AxiosResponse<any, any>>;
23
- delete(dates: string[], users: number[], options: Options<InternalQueryParams>): Promise<number>;
19
+ } & Options): Promise<AxiosResponse<any, any>>;
20
+ delete(dates: string[], users: number[], options: Options): Promise<number>;
24
21
  }
25
- export { DaysOffService };
@@ -49,14 +49,14 @@ class DaysOffService extends index_js_1.Service {
49
49
  })
50
50
  .then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : res.status), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
51
51
  }
52
- list(options) {
52
+ list(query, options) {
53
53
  const _super = Object.create(null, {
54
54
  iterator: { get: () => super.iterator }
55
55
  });
56
56
  return __asyncGenerator(this, arguments, function* list_1() {
57
57
  var e_1, _a;
58
58
  try {
59
- for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
59
+ for (var _b = __asyncValues(_super.iterator.call(this, { url: this.apiPath, params: query }, options)), _c; _c = yield __await(_b.next()), !_c.done;) {
60
60
  const res = _c.value;
61
61
  yield yield __await(new days_off_model_js_1.DaysOff(res));
62
62
  }
@@ -70,13 +70,13 @@ class DaysOffService extends index_js_1.Service {
70
70
  }
71
71
  });
72
72
  }
73
- listAll() {
73
+ listAll(query, options) {
74
74
  var e_2, _a;
75
75
  return __awaiter(this, void 0, void 0, function* () {
76
76
  try {
77
77
  const daysOff = [];
78
78
  try {
79
- for (var _b = __asyncValues(this.list()), _c; _c = yield _b.next(), !_c.done;) {
79
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
80
80
  const dayOff = _c.value;
81
81
  daysOff.push(dayOff);
82
82
  }
@@ -95,8 +95,8 @@ class DaysOffService extends index_js_1.Service {
95
95
  }
96
96
  });
97
97
  }
98
- listByPage(options) {
99
- return super.iterator({ url: this.apiPath }, options).byPage();
98
+ listByPage(query, options) {
99
+ return super.iterator({ url: this.apiPath, params: query }, options).byPage();
100
100
  }
101
101
  delete(dates, users, options) {
102
102
  return super
@@ -1,38 +1,33 @@
1
1
  import { AxiosResponse } from 'axios';
2
2
  import { ApiGroup } from '../interfaces/index.js';
3
3
  import { Service, Options, RequirementsOf } from './index.js';
4
- import { InternalQueryParams } from '../interfaces/query-params/internal-query-params.interface.js';
5
4
  import { Group } from '../models/group.model.js';
6
5
  import { GroupsQueryParams } from '../interfaces/query-params/groups-query-params.interface.js';
7
6
  declare type RequiredProps = 'name';
8
- declare class GroupsService extends Service {
7
+ export declare class GroupsService extends Service {
9
8
  private apiPath;
10
9
  create(data: RequirementsOf<ApiGroup, RequiredProps>): Promise<Group>;
11
10
  create(data: RequirementsOf<ApiGroup, RequiredProps>, options: {
12
11
  rawResponse: true;
13
- params?: InternalQueryParams;
14
- }): Promise<AxiosResponse<ApiGroup, any>>;
15
- create(data: RequirementsOf<ApiGroup, RequiredProps>, options: Options<InternalQueryParams>): Promise<Group>;
12
+ } & Options): Promise<AxiosResponse<ApiGroup, any>>;
13
+ create(data: RequirementsOf<ApiGroup, RequiredProps>, options: Options): Promise<Group>;
16
14
  get(id: number): Promise<Group>;
17
15
  get(id: number, options: {
18
16
  rawResponse: true;
19
- params?: InternalQueryParams;
20
- }): Promise<AxiosResponse<ApiGroup, any>>;
21
- get(id: number, options: Options<InternalQueryParams>): Promise<Group>;
22
- list(options?: Options<GroupsQueryParams & InternalQueryParams>): AsyncGenerator<Group, void, unknown>;
23
- listAll(): Promise<Group[]>;
24
- listByPage(options?: Options<GroupsQueryParams & InternalQueryParams>): AsyncGenerator<AxiosResponse<ApiGroup[], any>, any, unknown>;
17
+ } & Options): Promise<AxiosResponse<ApiGroup, any>>;
18
+ get(id: number, options: Options): Promise<Group>;
19
+ list(query: GroupsQueryParams, options?: Options): AsyncGenerator<Group, void, unknown>;
20
+ listAll(query: GroupsQueryParams, options?: Options): Promise<Group[]>;
21
+ listByPage(query: GroupsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiGroup[], any>, any, unknown>;
25
22
  update(id: number, data: Partial<ApiGroup>): Promise<Group>;
26
23
  update(id: number, data: Partial<ApiGroup>, options: {
27
24
  rawResponse: true;
28
- params?: InternalQueryParams;
29
- }): Promise<AxiosResponse<ApiGroup, any>>;
30
- update(id: number, data: Partial<ApiGroup>, options: Options<InternalQueryParams>): Promise<Group>;
25
+ } & Options): Promise<AxiosResponse<ApiGroup, any>>;
26
+ update(id: number, data: Partial<ApiGroup>, options: Options): Promise<Group>;
31
27
  delete(id: number): Promise<number>;
32
28
  delete(id: number, options: {
33
29
  rawResponse: true;
34
- params?: InternalQueryParams;
35
- }): Promise<AxiosResponse<any, any>>;
36
- delete(id: number, options: Options<InternalQueryParams>): Promise<number>;
30
+ } & Options): Promise<AxiosResponse<any, any>>;
31
+ delete(id: number, options: Options): Promise<number>;
37
32
  }
38
- export { GroupsService };
33
+ export {};