rotacloud 1.0.30 → 1.0.32

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 (124) hide show
  1. package/README.md +27 -1
  2. package/dist/cjs/interfaces/{day-notes.interface.d.ts → day-note.interface.d.ts} +1 -1
  3. package/dist/cjs/interfaces/{day-notes.interface.js → day-note.interface.js} +0 -0
  4. package/dist/cjs/interfaces/index.d.ts +3 -2
  5. package/dist/cjs/interfaces/index.js +3 -2
  6. package/dist/cjs/interfaces/query-params/day-notes-query-params.interface.d.ts +2 -2
  7. package/dist/cjs/interfaces/query-params/index.d.ts +1 -0
  8. package/dist/cjs/interfaces/query-params/index.js +1 -0
  9. package/dist/cjs/interfaces/query-params/settings-query-params.interface.d.ts +3 -0
  10. package/dist/cjs/interfaces/query-params/settings-query-params.interface.js +2 -0
  11. package/dist/cjs/interfaces/query-params/shifts-query-params.interface.d.ts +2 -2
  12. package/dist/cjs/interfaces/sdk-config.interface.d.ts +2 -0
  13. package/dist/cjs/interfaces/settings.interface.d.ts +64 -0
  14. package/dist/cjs/interfaces/settings.interface.js +2 -0
  15. package/dist/cjs/models/{day-notes.model.d.ts → day-note.model.d.ts} +3 -3
  16. package/dist/cjs/models/day-note.model.js +14 -0
  17. package/dist/cjs/models/settings.model.d.ts +2 -6
  18. package/dist/cjs/models/settings.model.js +3 -0
  19. package/dist/cjs/rotacloud.d.ts +6 -2
  20. package/dist/cjs/rotacloud.js +12 -6
  21. package/dist/cjs/services/accounts.service.js +11 -16
  22. package/dist/cjs/services/attendance.service.js +11 -16
  23. package/dist/cjs/services/daily-budgets.service.js +11 -16
  24. package/dist/cjs/services/daily-revenue.service.js +11 -16
  25. package/dist/cjs/services/day-notes.service.d.ts +31 -0
  26. package/dist/cjs/services/day-notes.service.js +103 -0
  27. package/dist/cjs/services/days-off.service.js +11 -16
  28. package/dist/cjs/services/groups.service.d.ts +3 -3
  29. package/dist/cjs/services/groups.service.js +11 -16
  30. package/dist/cjs/services/index.d.ts +1 -0
  31. package/dist/cjs/services/index.js +1 -0
  32. package/dist/cjs/services/leave-embargoes.service.js +11 -16
  33. package/dist/cjs/services/leave-request.service.d.ts +3 -3
  34. package/dist/cjs/services/leave-request.service.js +13 -18
  35. package/dist/cjs/services/leave.service.js +11 -16
  36. package/dist/cjs/services/locations.service.d.ts +3 -3
  37. package/dist/cjs/services/locations.service.js +11 -16
  38. package/dist/cjs/services/roles.service.d.ts +3 -3
  39. package/dist/cjs/services/roles.service.js +11 -16
  40. package/dist/cjs/services/service.d.ts +19 -1
  41. package/dist/cjs/services/service.js +38 -3
  42. package/dist/cjs/services/settings.service.d.ts +14 -0
  43. package/dist/cjs/services/settings.service.js +16 -0
  44. package/dist/cjs/services/shifts.service.js +11 -16
  45. package/dist/cjs/services/users.service.js +11 -16
  46. package/dist/cjs/version.js +1 -1
  47. package/dist/mjs/interfaces/{day-notes.interface.d.ts → day-note.interface.d.ts} +1 -1
  48. package/dist/mjs/interfaces/{day-notes.interface.js → day-note.interface.js} +0 -0
  49. package/dist/mjs/interfaces/index.d.ts +3 -2
  50. package/dist/mjs/interfaces/index.js +3 -2
  51. package/dist/mjs/interfaces/query-params/day-notes-query-params.interface.d.ts +2 -2
  52. package/dist/mjs/interfaces/query-params/index.d.ts +1 -0
  53. package/dist/mjs/interfaces/query-params/index.js +1 -0
  54. package/dist/mjs/interfaces/query-params/settings-query-params.interface.d.ts +3 -0
  55. package/dist/mjs/interfaces/query-params/settings-query-params.interface.js +1 -0
  56. package/dist/mjs/interfaces/query-params/shifts-query-params.interface.d.ts +2 -2
  57. package/dist/mjs/interfaces/sdk-config.interface.d.ts +2 -0
  58. package/dist/mjs/interfaces/settings.interface.d.ts +64 -0
  59. package/dist/mjs/interfaces/settings.interface.js +1 -0
  60. package/dist/mjs/models/{day-notes.model.d.ts → day-note.model.d.ts} +3 -3
  61. package/dist/mjs/models/day-note.model.js +10 -0
  62. package/dist/mjs/models/settings.model.d.ts +2 -6
  63. package/dist/mjs/models/settings.model.js +3 -0
  64. package/dist/mjs/rotacloud.d.ts +6 -2
  65. package/dist/mjs/rotacloud.js +14 -6
  66. package/dist/mjs/services/accounts.service.js +4 -9
  67. package/dist/mjs/services/attendance.service.js +4 -9
  68. package/dist/mjs/services/daily-budgets.service.js +4 -9
  69. package/dist/mjs/services/daily-revenue.service.js +4 -9
  70. package/dist/mjs/services/day-notes.service.d.ts +31 -0
  71. package/dist/mjs/services/day-notes.service.js +42 -0
  72. package/dist/mjs/services/days-off.service.js +4 -9
  73. package/dist/mjs/services/groups.service.d.ts +3 -3
  74. package/dist/mjs/services/groups.service.js +4 -9
  75. package/dist/mjs/services/index.d.ts +1 -0
  76. package/dist/mjs/services/index.js +1 -0
  77. package/dist/mjs/services/leave-embargoes.service.js +4 -9
  78. package/dist/mjs/services/leave-request.service.d.ts +3 -3
  79. package/dist/mjs/services/leave-request.service.js +6 -11
  80. package/dist/mjs/services/leave.service.js +4 -9
  81. package/dist/mjs/services/locations.service.d.ts +3 -3
  82. package/dist/mjs/services/locations.service.js +4 -9
  83. package/dist/mjs/services/roles.service.d.ts +3 -3
  84. package/dist/mjs/services/roles.service.js +4 -9
  85. package/dist/mjs/services/service.d.ts +19 -1
  86. package/dist/mjs/services/service.js +37 -2
  87. package/dist/mjs/services/settings.service.d.ts +14 -0
  88. package/dist/mjs/services/settings.service.js +13 -0
  89. package/dist/mjs/services/shifts.service.js +4 -9
  90. package/dist/mjs/services/users.service.js +4 -9
  91. package/dist/mjs/version.js +1 -1
  92. package/package.json +2 -1
  93. package/src/interfaces/{day-notes.interface.ts → day-note.interface.ts} +1 -1
  94. package/src/interfaces/index.ts +3 -2
  95. package/src/interfaces/query-params/day-notes-query-params.interface.ts +2 -2
  96. package/src/interfaces/query-params/index.ts +1 -0
  97. package/src/interfaces/query-params/settings-query-params.interface.ts +3 -0
  98. package/src/interfaces/query-params/shifts-query-params.interface.ts +2 -2
  99. package/src/interfaces/sdk-config.interface.ts +3 -0
  100. package/src/interfaces/settings.interface.ts +63 -0
  101. package/src/models/day-note.model.ts +19 -0
  102. package/src/models/settings.model.ts +5 -3
  103. package/src/rotacloud.ts +16 -5
  104. package/src/services/accounts.service.ts +4 -8
  105. package/src/services/attendance.service.ts +4 -8
  106. package/src/services/daily-budgets.service.ts +4 -8
  107. package/src/services/daily-revenue.service.ts +4 -8
  108. package/src/services/day-notes.service.ts +81 -0
  109. package/src/services/days-off.service.ts +4 -8
  110. package/src/services/groups.service.ts +7 -11
  111. package/src/services/index.ts +1 -0
  112. package/src/services/leave-embargoes.service.ts +4 -8
  113. package/src/services/leave-request.service.ts +8 -12
  114. package/src/services/leave.service.ts +4 -8
  115. package/src/services/locations.service.ts +7 -11
  116. package/src/services/roles.service.ts +7 -11
  117. package/src/services/service.ts +57 -3
  118. package/src/services/settings.service.ts +23 -0
  119. package/src/services/shifts.service.ts +4 -8
  120. package/src/services/users.service.ts +4 -8
  121. package/src/version.ts +1 -1
  122. package/dist/cjs/models/day-notes.model.js +0 -9
  123. package/dist/mjs/models/day-notes.model.js +0 -5
  124. package/src/models/day-notes.model.ts +0 -14
@@ -73,26 +73,21 @@ class DaysOffService extends index_js_1.Service {
73
73
  listAll(query, options) {
74
74
  var e_2, _a;
75
75
  return __awaiter(this, void 0, void 0, function* () {
76
+ const daysOff = [];
76
77
  try {
77
- const daysOff = [];
78
- try {
79
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
80
- const dayOff = _c.value;
81
- daysOff.push(dayOff);
82
- }
83
- }
84
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
85
- finally {
86
- try {
87
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
88
- }
89
- finally { if (e_2) throw e_2.error; }
78
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
79
+ const dayOff = _c.value;
80
+ daysOff.push(dayOff);
90
81
  }
91
- return daysOff;
92
82
  }
93
- catch (err) {
94
- return err;
83
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
84
+ finally {
85
+ try {
86
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
87
+ }
88
+ finally { if (e_2) throw e_2.error; }
95
89
  }
90
+ return daysOff;
96
91
  });
97
92
  }
98
93
  listByPage(query, options) {
@@ -16,9 +16,9 @@ export declare class GroupsService extends Service {
16
16
  rawResponse: true;
17
17
  } & Options): Promise<AxiosResponse<ApiGroup, any>>;
18
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>;
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>;
22
22
  update(id: number, data: Partial<ApiGroup>): Promise<Group>;
23
23
  update(id: number, data: Partial<ApiGroup>, options: {
24
24
  rawResponse: true;
@@ -67,26 +67,21 @@ class GroupsService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const groups = [];
70
71
  try {
71
- const groups = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const group = _c.value;
75
- groups.push(group);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const group = _c.value;
74
+ groups.push(group);
84
75
  }
85
- return groups;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return groups;
90
85
  });
91
86
  }
92
87
  listByPage(query, options) {
@@ -12,5 +12,6 @@ export * from './leave-embargoes.service.js';
12
12
  export * from './leave.service.js';
13
13
  export * from './locations.service.js';
14
14
  export * from './roles.service.js';
15
+ export * from './settings.service.js';
15
16
  export * from './shifts.service.js';
16
17
  export * from './users.service.js';
@@ -24,5 +24,6 @@ __exportStar(require("./leave-embargoes.service.js"), exports);
24
24
  __exportStar(require("./leave.service.js"), exports);
25
25
  __exportStar(require("./locations.service.js"), exports);
26
26
  __exportStar(require("./roles.service.js"), exports);
27
+ __exportStar(require("./settings.service.js"), exports);
27
28
  __exportStar(require("./shifts.service.js"), exports);
28
29
  __exportStar(require("./users.service.js"), exports);
@@ -67,26 +67,21 @@ class LeaveEmbargoesService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const leave = [];
70
71
  try {
71
- const leave = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const leaveEmbargoRecord = _c.value;
75
- leave.push(leaveEmbargoRecord);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const leaveEmbargoRecord = _c.value;
74
+ leave.push(leaveEmbargoRecord);
84
75
  }
85
- return leave;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return leave;
90
85
  });
91
86
  }
92
87
  listByPage(query, options) {
@@ -16,9 +16,9 @@ export declare class LeaveRequestService extends Service {
16
16
  rawResponse: true;
17
17
  }): Promise<AxiosResponse<ApiLeaveRequest, any>>;
18
18
  get(id: number, options: Options): Promise<LeaveRequest>;
19
- list(query: LeaveQueryParams, options?: Options): AsyncGenerator<LeaveRequest, void, unknown>;
20
- listAll(query: LeaveQueryParams, options?: Options): Promise<LeaveRequest[]>;
21
- listByPage(options?: Options): AsyncGenerator<AxiosResponse<ApiLeaveRequest[], any>, any, unknown>;
19
+ list(query?: LeaveQueryParams, options?: Options): AsyncGenerator<LeaveRequest, void, unknown>;
20
+ listAll(query?: LeaveQueryParams, options?: Options): Promise<LeaveRequest[]>;
21
+ listByPage(query?: LeaveQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiLeaveRequest[], any>, any, unknown>;
22
22
  update(id: number, data: Partial<ApiLeaveRequest>): Promise<LeaveRequest>;
23
23
  update(id: number, data: Partial<ApiLeaveRequest>, options: {
24
24
  rawResponse: true;
@@ -67,30 +67,25 @@ class LeaveRequestService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const leave = [];
70
71
  try {
71
- const leave = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const leaveRequestRecord = _c.value;
75
- leave.push(leaveRequestRecord);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const leaveRequestRecord = _c.value;
74
+ leave.push(leaveRequestRecord);
84
75
  }
85
- return leave;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return leave;
90
85
  });
91
86
  }
92
- listByPage(options) {
93
- return super.iterator({ url: `${this.apiPath}` }, options).byPage();
87
+ listByPage(query, options) {
88
+ return super.iterator({ url: `${this.apiPath}`, params: query }, options).byPage();
94
89
  }
95
90
  update(id, data, options) {
96
91
  return super
@@ -68,26 +68,21 @@ class LeaveService extends index_js_1.Service {
68
68
  listAll(query, options) {
69
69
  var e_2, _a;
70
70
  return __awaiter(this, void 0, void 0, function* () {
71
+ const leave = [];
71
72
  try {
72
- const leave = [];
73
- try {
74
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
75
- const leaveRecord = _c.value;
76
- leave.push(leaveRecord);
77
- }
78
- }
79
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
80
- finally {
81
- try {
82
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
83
- }
84
- finally { if (e_2) throw e_2.error; }
73
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
+ const leaveRecord = _c.value;
75
+ leave.push(leaveRecord);
85
76
  }
86
- return leave;
87
77
  }
88
- catch (err) {
89
- return err;
78
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
+ finally {
80
+ try {
81
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
+ }
83
+ finally { if (e_2) throw e_2.error; }
90
84
  }
85
+ return leave;
91
86
  });
92
87
  }
93
88
  listLeaveTypes(query, options) {
@@ -16,9 +16,9 @@ export declare class LocationsService extends Service {
16
16
  rawResponse: true;
17
17
  } & Options): Promise<AxiosResponse<ApiLocation, any>>;
18
18
  get(id: number, options: Options): Promise<Location>;
19
- list(query: LocationsQueryParams, options?: Options): AsyncGenerator<Location, void, unknown>;
20
- listAll(query: LocationsQueryParams, options?: Options): Promise<Location[]>;
21
- listByPage(query: LocationsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiLocation[], any>, any, unknown>;
19
+ list(query?: LocationsQueryParams, options?: Options): AsyncGenerator<Location, void, unknown>;
20
+ listAll(query?: LocationsQueryParams, options?: Options): Promise<Location[]>;
21
+ listByPage(query?: LocationsQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiLocation[], any>, any, unknown>;
22
22
  update(id: number, data: Partial<ApiLocation>): Promise<Location>;
23
23
  update(id: number, data: Partial<ApiLocation>, options: {
24
24
  rawResponse: true;
@@ -67,26 +67,21 @@ class LocationsService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const locations = [];
70
71
  try {
71
- const locations = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const location = _c.value;
75
- locations.push(location);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const location = _c.value;
74
+ locations.push(location);
84
75
  }
85
- return locations;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return locations;
90
85
  });
91
86
  }
92
87
  listByPage(query, options) {
@@ -16,9 +16,9 @@ export declare class RolesService extends Service {
16
16
  rawResponse: true;
17
17
  } & Options): Promise<AxiosResponse<ApiRole, any>>;
18
18
  get(id: number, options: Options): Promise<Role>;
19
- list(query: RolesQueryParams, options?: Options): AsyncGenerator<Role, void, unknown>;
20
- listAll(query: RolesQueryParams, options?: Options): Promise<Role[]>;
21
- listByPage(query: RolesQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiRole[], any>, any, unknown>;
19
+ list(query?: RolesQueryParams, options?: Options): AsyncGenerator<Role, void, unknown>;
20
+ listAll(query?: RolesQueryParams, options?: Options): Promise<Role[]>;
21
+ listByPage(query?: RolesQueryParams, options?: Options): AsyncGenerator<AxiosResponse<ApiRole[], any>, any, unknown>;
22
22
  update(id: number, data: Partial<ApiRole>): Promise<Role>;
23
23
  update(id: number, data: Partial<ApiRole>, options: {
24
24
  rawResponse: true;
@@ -67,26 +67,21 @@ class RolesService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const roles = [];
70
71
  try {
71
- const roles = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const role = _c.value;
75
- roles.push(role);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const role = _c.value;
74
+ roles.push(role);
84
75
  }
85
- return roles;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return roles;
90
85
  });
91
86
  }
92
87
  listByPage(query, options) {
@@ -1,5 +1,22 @@
1
- import { AxiosRequestConfig, AxiosResponse } from 'axios';
1
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
2
2
  export declare type RequirementsOf<T, K extends keyof T> = Required<Pick<T, K>> & Partial<T>;
3
+ export declare enum RetryStrategy {
4
+ Exponential = "expo",
5
+ Static = "static"
6
+ }
7
+ export declare type RetryOptions = {
8
+ /** Use exponential back-off */
9
+ exponential?: false;
10
+ /** The maximum number of retries before erroring */
11
+ maxRetries: number;
12
+ /** Delay in milliseconds between retry attempts - not used in exponential back-off */
13
+ delay: number;
14
+ } | {
15
+ /** Use exponential back-off */
16
+ exponential: true;
17
+ /** The maximum number of retries before erroring */
18
+ maxRetries: number;
19
+ };
3
20
  export interface Options {
4
21
  rawResponse?: boolean;
5
22
  expand?: string[];
@@ -7,6 +24,7 @@ export interface Options {
7
24
  limit?: number;
8
25
  }
9
26
  export declare abstract class Service<ApiResponse = any> {
27
+ protected client: AxiosInstance;
10
28
  isLeaveRequest(endpoint?: string): boolean;
11
29
  private buildQueryStr;
12
30
  private getPagingObject;
@@ -36,12 +36,33 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
36
36
  return (mod && mod.__esModule) ? mod : { "default": mod };
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.Service = void 0;
39
+ exports.Service = exports.RetryStrategy = void 0;
40
40
  const axios_1 = __importDefault(require("axios"));
41
+ const axios_retry_1 = __importDefault(require("axios-retry"));
41
42
  const rotacloud_js_1 = require("../rotacloud.js");
42
43
  const version_js_1 = require("../version.js");
44
+ var RetryStrategy;
45
+ (function (RetryStrategy) {
46
+ RetryStrategy["Exponential"] = "expo";
47
+ RetryStrategy["Static"] = "static";
48
+ })(RetryStrategy = exports.RetryStrategy || (exports.RetryStrategy = {}));
49
+ const DEFAULT_RETRIES = 3;
50
+ const DEFAULT_RETRY_DELAY = 2000;
51
+ const DEFAULT_RETRY_STRATEGY_OPTIONS = {
52
+ [RetryStrategy.Exponential]: {
53
+ exponential: true,
54
+ maxRetries: DEFAULT_RETRIES,
55
+ },
56
+ [RetryStrategy.Static]: {
57
+ exponential: false,
58
+ maxRetries: DEFAULT_RETRIES,
59
+ delay: DEFAULT_RETRY_DELAY,
60
+ },
61
+ };
43
62
  class Service {
44
- // rate limit tracking could be implemented here statically
63
+ constructor() {
64
+ this.client = axios_1.default.create();
65
+ }
45
66
  isLeaveRequest(endpoint) {
46
67
  return endpoint === '/leave_requests';
47
68
  }
@@ -84,7 +105,21 @@ class Service {
84
105
  const reqObject = Object.assign(Object.assign({}, httpOptions), { baseURL: rotacloud_js_1.RotaCloud.config.baseUri, headers, params: Object.assign({ expand: options === null || options === void 0 ? void 0 : options.expand, fields: options === null || options === void 0 ? void 0 : options.fields, limit: options === null || options === void 0 ? void 0 : options.limit }, httpOptions === null || httpOptions === void 0 ? void 0 : httpOptions.params), paramsSerializer: (params) => {
85
106
  return params ? this.buildQueryStr(params) : '';
86
107
  } });
87
- const response = yield axios_1.default.request(reqObject);
108
+ if (rotacloud_js_1.RotaCloud.config.retry) {
109
+ const retryConfig = typeof rotacloud_js_1.RotaCloud.config.retry === 'string'
110
+ ? DEFAULT_RETRY_STRATEGY_OPTIONS[rotacloud_js_1.RotaCloud.config.retry]
111
+ : rotacloud_js_1.RotaCloud.config.retry;
112
+ (0, axios_retry_1.default)(this.client, {
113
+ retries: retryConfig.maxRetries,
114
+ retryDelay: (retryCount) => {
115
+ if (retryConfig.exponential) {
116
+ return axios_retry_1.default.exponentialDelay(retryCount);
117
+ }
118
+ return retryConfig.delay;
119
+ },
120
+ });
121
+ }
122
+ const response = yield this.client.request(reqObject);
88
123
  return response;
89
124
  });
90
125
  }
@@ -0,0 +1,14 @@
1
+ import { AxiosResponse } from 'axios';
2
+ import { Settings } from '../models/settings.model.js';
3
+ import { Service, Options } from './index.js';
4
+ import { ApiSettings } from '../interfaces/index.js';
5
+ import { SettingsQueryParams } from '../rotacloud.js';
6
+ declare class SettingsService extends Service {
7
+ private apiPath;
8
+ get(query: SettingsQueryParams): Promise<Settings>;
9
+ get(query: SettingsQueryParams, options: {
10
+ rawResponse: true;
11
+ } & Options): Promise<AxiosResponse<ApiSettings, any>>;
12
+ get(query: SettingsQueryParams, options: Options): Promise<Settings>;
13
+ }
14
+ export { SettingsService };
@@ -0,0 +1,16 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsService = void 0;
4
+ const settings_model_js_1 = require("../models/settings.model.js");
5
+ const index_js_1 = require("./index.js");
6
+ const error_response_model_js_1 = require("../models/error-response.model.js");
7
+ class SettingsService extends index_js_1.Service {
8
+ constructor() {
9
+ super(...arguments);
10
+ this.apiPath = '/settings';
11
+ }
12
+ get(query, options) {
13
+ return super.fetch({ url: `${this.apiPath}`, params: query }, options).then((res) => Promise.resolve((options === null || options === void 0 ? void 0 : options.rawResponse) ? res : new settings_model_js_1.Settings(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.SettingsService = SettingsService;
@@ -67,26 +67,21 @@ class ShiftsService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const shifts = [];
70
71
  try {
71
- const shifts = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const shift = _c.value;
75
- shifts.push(shift);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const shift = _c.value;
74
+ shifts.push(shift);
84
75
  }
85
- return shifts;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return shifts;
90
85
  });
91
86
  }
92
87
  listByPage(query, options) {
@@ -67,26 +67,21 @@ class UsersService extends index_js_1.Service {
67
67
  listAll(query, options) {
68
68
  var e_2, _a;
69
69
  return __awaiter(this, void 0, void 0, function* () {
70
+ const users = [];
70
71
  try {
71
- const users = [];
72
- try {
73
- for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
74
- const user = _c.value;
75
- users.push(user);
76
- }
77
- }
78
- catch (e_2_1) { e_2 = { error: e_2_1 }; }
79
- finally {
80
- try {
81
- if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
82
- }
83
- finally { if (e_2) throw e_2.error; }
72
+ for (var _b = __asyncValues(this.list(query, options)), _c; _c = yield _b.next(), !_c.done;) {
73
+ const user = _c.value;
74
+ users.push(user);
84
75
  }
85
- return users;
86
76
  }
87
- catch (err) {
88
- return err;
77
+ catch (e_2_1) { e_2 = { error: e_2_1 }; }
78
+ finally {
79
+ try {
80
+ if (_c && !_c.done && (_a = _b.return)) yield _a.call(_b);
81
+ }
82
+ finally { if (e_2) throw e_2.error; }
89
83
  }
84
+ return users;
90
85
  });
91
86
  }
92
87
  listByPage(query, options) {
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.Version = void 0;
4
- exports.Version = { version: '1.0.30' };
4
+ exports.Version = { version: '1.0.32' };
@@ -1,4 +1,4 @@
1
- export interface ApiDayNotes {
1
+ export interface ApiDayNote {
2
2
  id: number;
3
3
  start_date: string;
4
4
  end_date: string;
@@ -9,7 +9,7 @@ export * from './daily-budgets.interface.js';
9
9
  export * from './daily-revenue.interface.js';
10
10
  export * from './days-off.interface.js';
11
11
  export * from './days-off-pattern.interface.js';
12
- export * from './day-notes.interface.js';
12
+ export * from './day-note.interface.js';
13
13
  export * from './group.interface.js';
14
14
  export * from './holiday_allowance.interface.js';
15
15
  export * from './leave-date.interface.js';
@@ -26,5 +26,6 @@ export * from './pay-period.interface.js';
26
26
  export * from './role-rate.interface.js';
27
27
  export * from './role.interface.js';
28
28
  export * from './sdk-config.interface.js';
29
- export * from './user.interface.js';
29
+ export * from './settings.interface.js';
30
30
  export * from './shift.interface.js';
31
+ export * from './user.interface.js';
@@ -9,7 +9,7 @@ export * from './daily-budgets.interface.js';
9
9
  export * from './daily-revenue.interface.js';
10
10
  export * from './days-off.interface.js';
11
11
  export * from './days-off-pattern.interface.js';
12
- export * from './day-notes.interface.js';
12
+ export * from './day-note.interface.js';
13
13
  export * from './group.interface.js';
14
14
  export * from './holiday_allowance.interface.js';
15
15
  export * from './leave-date.interface.js';
@@ -26,5 +26,6 @@ export * from './pay-period.interface.js';
26
26
  export * from './role-rate.interface.js';
27
27
  export * from './role.interface.js';
28
28
  export * from './sdk-config.interface.js';
29
- export * from './user.interface.js';
29
+ export * from './settings.interface.js';
30
30
  export * from './shift.interface.js';
31
+ export * from './user.interface.js';
@@ -1,5 +1,5 @@
1
1
  export interface DayNotesQueryParams {
2
- start?: string;
3
- end?: string;
2
+ start: string;
3
+ end: string;
4
4
  locations?: number[];
5
5
  }
@@ -17,6 +17,7 @@ export * from './locations-query-params.interface.js';
17
17
  export * from './logbook-events-query-params.interface.js';
18
18
  export * from './pay-periods-query-params.interface.js';
19
19
  export * from './roles-query-params.interface.js';
20
+ export * from './settings-query-params.interface.js';
20
21
  export * from './shifts-query-params.interface.js';
21
22
  export * from './swap-requests-query-params.interface.js';
22
23
  export * from './terminals-query-params.interface.js';
@@ -17,6 +17,7 @@ export * from './locations-query-params.interface.js';
17
17
  export * from './logbook-events-query-params.interface.js';
18
18
  export * from './pay-periods-query-params.interface.js';
19
19
  export * from './roles-query-params.interface.js';
20
+ export * from './settings-query-params.interface.js';
20
21
  export * from './shifts-query-params.interface.js';
21
22
  export * from './swap-requests-query-params.interface.js';
22
23
  export * from './terminals-query-params.interface.js';
@@ -0,0 +1,3 @@
1
+ export interface SettingsQueryParams {
2
+ only_values?: boolean;
3
+ }