rotacloud 1.0.24 → 1.0.28

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 (115) hide show
  1. package/dist/cjs/interfaces/auth.interface.d.ts +8 -0
  2. package/dist/cjs/interfaces/auth.interface.js +2 -0
  3. package/dist/cjs/interfaces/index.d.ts +1 -0
  4. package/dist/cjs/interfaces/index.js +1 -0
  5. package/dist/cjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
  6. package/dist/cjs/models/auth.model.d.ts +6 -0
  7. package/dist/cjs/models/auth.model.js +10 -0
  8. package/dist/cjs/models/daily-budgets.model.js +2 -0
  9. package/dist/cjs/rotacloud.d.ts +4 -1
  10. package/dist/cjs/rotacloud.js +3 -0
  11. package/dist/cjs/services/accounts.service.d.ts +3 -4
  12. package/dist/cjs/services/accounts.service.js +2 -2
  13. package/dist/cjs/services/attendance.service.d.ts +13 -18
  14. package/dist/cjs/services/attendance.service.js +6 -6
  15. package/dist/cjs/services/auth.service.d.ts +11 -0
  16. package/dist/cjs/services/auth.service.js +16 -0
  17. package/dist/cjs/services/availability.service.d.ts +9 -16
  18. package/dist/cjs/services/availability.service.js +4 -4
  19. package/dist/cjs/services/daily-budgets.service.d.ts +16 -0
  20. package/dist/cjs/services/daily-budgets.service.js +99 -0
  21. package/dist/cjs/services/daily-revenue.service.d.ts +16 -0
  22. package/dist/cjs/services/daily-revenue.service.js +99 -0
  23. package/dist/cjs/services/days-off.service.d.ts +8 -12
  24. package/dist/cjs/services/days-off.service.js +6 -6
  25. package/dist/cjs/services/groups.service.d.ts +13 -18
  26. package/dist/cjs/services/groups.service.js +6 -6
  27. package/dist/cjs/services/index.d.ts +3 -0
  28. package/dist/cjs/services/index.js +3 -0
  29. package/dist/cjs/services/leave-embargoes.service.d.ts +13 -18
  30. package/dist/cjs/services/leave-embargoes.service.js +6 -6
  31. package/dist/cjs/services/leave-request.service.d.ts +12 -17
  32. package/dist/cjs/services/leave-request.service.js +4 -4
  33. package/dist/cjs/services/leave.service.d.ts +13 -18
  34. package/dist/cjs/services/leave.service.js +9 -9
  35. package/dist/cjs/services/locations.service.d.ts +13 -18
  36. package/dist/cjs/services/locations.service.js +6 -6
  37. package/dist/cjs/services/roles.service.d.ts +13 -18
  38. package/dist/cjs/services/roles.service.js +6 -6
  39. package/dist/cjs/services/service.d.ts +6 -4
  40. package/dist/cjs/services/service.js +2 -2
  41. package/dist/cjs/services/shifts.service.d.ts +19 -27
  42. package/dist/cjs/services/shifts.service.js +6 -6
  43. package/dist/cjs/services/users.service.d.ts +11 -16
  44. package/dist/cjs/services/users.service.js +6 -6
  45. package/dist/cjs/version.js +1 -1
  46. package/dist/mjs/interfaces/auth.interface.d.ts +8 -0
  47. package/dist/mjs/interfaces/auth.interface.js +1 -0
  48. package/dist/mjs/interfaces/index.d.ts +1 -0
  49. package/dist/mjs/interfaces/index.js +1 -0
  50. package/dist/mjs/interfaces/query-params/daily-budgets-query-params.interface.d.ts +2 -2
  51. package/dist/mjs/models/auth.model.d.ts +6 -0
  52. package/dist/mjs/models/auth.model.js +6 -0
  53. package/dist/mjs/models/daily-budgets.model.js +2 -0
  54. package/dist/mjs/rotacloud.d.ts +4 -1
  55. package/dist/mjs/rotacloud.js +4 -1
  56. package/dist/mjs/services/accounts.service.d.ts +3 -4
  57. package/dist/mjs/services/accounts.service.js +2 -2
  58. package/dist/mjs/services/attendance.service.d.ts +13 -18
  59. package/dist/mjs/services/attendance.service.js +7 -8
  60. package/dist/mjs/services/auth.service.d.ts +11 -0
  61. package/dist/mjs/services/auth.service.js +12 -0
  62. package/dist/mjs/services/availability.service.d.ts +9 -16
  63. package/dist/mjs/services/availability.service.js +4 -4
  64. package/dist/mjs/services/daily-budgets.service.d.ts +16 -0
  65. package/dist/mjs/services/daily-budgets.service.js +38 -0
  66. package/dist/mjs/services/daily-revenue.service.d.ts +16 -0
  67. package/dist/mjs/services/daily-revenue.service.js +38 -0
  68. package/dist/mjs/services/days-off.service.d.ts +8 -12
  69. package/dist/mjs/services/days-off.service.js +7 -8
  70. package/dist/mjs/services/groups.service.d.ts +13 -18
  71. package/dist/mjs/services/groups.service.js +7 -8
  72. package/dist/mjs/services/index.d.ts +3 -0
  73. package/dist/mjs/services/index.js +3 -0
  74. package/dist/mjs/services/leave-embargoes.service.d.ts +13 -18
  75. package/dist/mjs/services/leave-embargoes.service.js +7 -8
  76. package/dist/mjs/services/leave-request.service.d.ts +12 -17
  77. package/dist/mjs/services/leave-request.service.js +5 -6
  78. package/dist/mjs/services/leave.service.d.ts +13 -18
  79. package/dist/mjs/services/leave.service.js +10 -11
  80. package/dist/mjs/services/locations.service.d.ts +13 -18
  81. package/dist/mjs/services/locations.service.js +7 -8
  82. package/dist/mjs/services/roles.service.d.ts +13 -18
  83. package/dist/mjs/services/roles.service.js +7 -8
  84. package/dist/mjs/services/service.d.ts +6 -4
  85. package/dist/mjs/services/service.js +7 -2
  86. package/dist/mjs/services/shifts.service.d.ts +19 -27
  87. package/dist/mjs/services/shifts.service.js +7 -8
  88. package/dist/mjs/services/users.service.d.ts +11 -16
  89. package/dist/mjs/services/users.service.js +6 -6
  90. package/dist/mjs/version.js +1 -1
  91. package/package.json +1 -1
  92. package/src/interfaces/auth.interface.ts +9 -0
  93. package/src/interfaces/index.ts +1 -0
  94. package/src/interfaces/query-params/daily-budgets-query-params.interface.ts +2 -2
  95. package/src/models/auth.model.ts +11 -0
  96. package/src/models/daily-budgets.model.ts +2 -0
  97. package/src/rotacloud.ts +6 -0
  98. package/src/services/accounts.service.ts +5 -6
  99. package/src/services/attendance.service.ts +20 -32
  100. package/src/services/auth.service.ts +19 -0
  101. package/src/services/availability.service.ts +14 -34
  102. package/src/services/daily-budgets.service.ts +53 -0
  103. package/src/services/daily-revenue.service.ts +53 -0
  104. package/src/services/days-off.service.ts +15 -21
  105. package/src/services/groups.service.ts +21 -23
  106. package/src/services/index.ts +3 -0
  107. package/src/services/leave-embargoes.service.ts +21 -30
  108. package/src/services/leave-request.service.ts +20 -31
  109. package/src/services/leave.service.ts +24 -29
  110. package/src/services/locations.service.ts +20 -26
  111. package/src/services/roles.service.ts +20 -24
  112. package/src/services/service.ts +18 -8
  113. package/src/services/shifts.service.ts +29 -41
  114. package/src/services/users.service.ts +19 -20
  115. package/src/version.ts +1 -1
@@ -0,0 +1,8 @@
1
+ export interface ApiAuthAccount {
2
+ id: number;
3
+ name: string;
4
+ }
5
+ export interface ApiAuth {
6
+ two_factor_enabled: boolean;
7
+ accounts: ApiAuthAccount[];
8
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -2,6 +2,7 @@ export * from './account-service.interface.js';
2
2
  export * from './account-services.interface.js';
3
3
  export * from './account.interface.js';
4
4
  export * from './attendance.interface.js';
5
+ export * from './auth.interface.js';
5
6
  export * from './availability-pattern.interface.js';
6
7
  export * from './availability.interface.js';
7
8
  export * from './daily-budgets.interface.js';
@@ -14,6 +14,7 @@ __exportStar(require("./account-service.interface.js"), exports);
14
14
  __exportStar(require("./account-services.interface.js"), exports);
15
15
  __exportStar(require("./account.interface.js"), exports);
16
16
  __exportStar(require("./attendance.interface.js"), exports);
17
+ __exportStar(require("./auth.interface.js"), exports);
17
18
  __exportStar(require("./availability-pattern.interface.js"), exports);
18
19
  __exportStar(require("./availability.interface.js"), exports);
19
20
  __exportStar(require("./daily-budgets.interface.js"), exports);
@@ -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
  }
@@ -0,0 +1,6 @@
1
+ import { ApiAuth, ApiAuthAccount } from '../interfaces/index.js';
2
+ export declare class Auth {
3
+ two_factor_enabled: boolean;
4
+ accounts: ApiAuthAccount[];
5
+ constructor(auth: ApiAuth);
6
+ }
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.Auth = void 0;
4
+ class Auth {
5
+ constructor(auth) {
6
+ this.two_factor_enabled = auth.two_factor_enabled;
7
+ this.accounts = auth.accounts;
8
+ }
9
+ }
10
+ exports.Auth = Auth;
@@ -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,11 +1,14 @@
1
- import { AccountsService, AttendanceService, AvailabilityService, DaysOffService, GroupsService, LeaveEmbargoesService, LeaveRequestService, LeaveService, LocationsService, RolesService, ShiftsService, UsersService } from './services/index.js';
1
+ import { AccountsService, AttendanceService, AuthService, 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;
5
5
  defaultAPIURI: string;
6
6
  accounts: AccountsService;
7
7
  attendance: AttendanceService;
8
+ auth: AuthService;
8
9
  availability: AvailabilityService;
10
+ dailyBudgets: DailyBudgetsService;
11
+ dailyRevenue: DailyRevenueService;
9
12
  daysOff: DaysOffService;
10
13
  group: GroupsService;
11
14
  leaveEmbargoes: LeaveEmbargoesService;
@@ -17,7 +17,10 @@ class RotaCloud {
17
17
  this.defaultAPIURI = 'https://api.rotacloud.com/v1';
18
18
  this.accounts = new index_js_1.AccountsService();
19
19
  this.attendance = new index_js_1.AttendanceService();
20
+ this.auth = new index_js_1.AuthService();
20
21
  this.availability = new index_js_1.AvailabilityService();
22
+ this.dailyBudgets = new index_js_1.DailyBudgetsService();
23
+ this.dailyRevenue = new index_js_1.DailyRevenueService();
21
24
  this.daysOff = new index_js_1.DaysOffService();
22
25
  this.group = new index_js_1.GroupsService();
23
26
  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
@@ -0,0 +1,11 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { ApiAuth } from '../interfaces/index.js';
3
+ import { Service, Options } from './index.js';
4
+ import { Auth } from '../models/auth.model.js';
5
+ export declare class AuthService extends Service {
6
+ private apiPath;
7
+ get(options?: {
8
+ rawResponse: true;
9
+ } & Options): Promise<AxiosResponse<ApiAuth, any>>;
10
+ get(options?: Options): Promise<Auth>;
11
+ }
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.AuthService = void 0;
4
+ const index_js_1 = require("./index.js");
5
+ const auth_model_js_1 = require("../models/auth.model.js");
6
+ const error_response_model_js_1 = require("../models/error-response.model.js");
7
+ class AuthService extends index_js_1.Service {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.apiPath = '/auth';
11
+ }
12
+ get(options) {
13
+ return super.fetch({ url: this.apiPath }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new auth_model_js_1.Auth(res.data)), (err) => Promise.reject((options === null || options === void 0 ? void 0 : options.rawResponse) ? err : new error_response_model_js_1.ErrorResponse(err)));
14
+ }
15
+ }
16
+ exports.AuthService = AuthService;
@@ -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 };