rotacloud 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/interfaces/index.d.ts +1 -0
- package/dist/cjs/interfaces/index.js +1 -0
- package/dist/cjs/interfaces/query-params/index.d.ts +0 -1
- package/dist/cjs/interfaces/query-params/index.js +0 -1
- package/dist/cjs/interfaces/terminal.interface.d.ts +1 -0
- package/dist/cjs/interfaces/time-zone.interface.d.ts +7 -0
- package/dist/cjs/rotacloud.d.ts +2 -1
- package/dist/cjs/rotacloud.js +1 -0
- package/dist/cjs/services/accounts.service.d.ts +26 -7
- package/dist/cjs/services/accounts.service.js +10 -20
- package/dist/cjs/services/attendance.service.d.ts +30 -11
- package/dist/cjs/services/attendance.service.js +16 -26
- package/dist/cjs/services/auth.service.js +1 -3
- package/dist/cjs/services/availability.service.d.ts +3 -3
- package/dist/cjs/services/availability.service.js +8 -18
- package/dist/cjs/services/daily-budgets.service.d.ts +19 -7
- package/dist/cjs/services/daily-budgets.service.js +12 -22
- package/dist/cjs/services/daily-revenue.service.d.ts +18 -6
- package/dist/cjs/services/daily-revenue.service.js +11 -21
- package/dist/cjs/services/day-notes.service.d.ts +27 -8
- package/dist/cjs/services/day-notes.service.js +15 -25
- package/dist/cjs/services/days-off.service.d.ts +17 -5
- package/dist/cjs/services/days-off.service.js +13 -23
- package/dist/cjs/services/groups.service.d.ts +27 -8
- package/dist/cjs/services/groups.service.js +12 -22
- package/dist/cjs/services/index.d.ts +1 -0
- package/dist/cjs/services/index.js +1 -0
- package/dist/cjs/services/leave-embargoes.service.d.ts +27 -8
- package/dist/cjs/services/leave-embargoes.service.js +16 -26
- package/dist/cjs/services/leave-request.service.d.ts +27 -8
- package/dist/cjs/services/leave-request.service.js +15 -25
- package/dist/cjs/services/leave.service.d.ts +28 -10
- package/dist/cjs/services/leave.service.js +13 -46
- package/dist/cjs/services/locations.service.d.ts +27 -8
- package/dist/cjs/services/locations.service.js +16 -26
- package/dist/cjs/services/pins.service.d.ts +12 -5
- package/dist/cjs/services/pins.service.js +1 -1
- package/dist/cjs/services/roles.service.d.ts +27 -8
- package/dist/cjs/services/roles.service.js +16 -26
- package/dist/cjs/services/service.d.ts +12 -3
- package/dist/cjs/services/service.js +1 -2
- package/dist/cjs/services/settings.service.d.ts +1 -1
- package/dist/cjs/services/settings.service.js +1 -1
- package/dist/cjs/services/shifts.service.d.ts +30 -11
- package/dist/cjs/services/shifts.service.js +21 -31
- package/dist/cjs/services/terminals-active.service.d.ts +20 -8
- package/dist/cjs/services/terminals-active.service.js +16 -26
- package/dist/cjs/services/terminals.service.d.ts +27 -8
- package/dist/cjs/services/terminals.service.js +13 -23
- package/dist/cjs/services/time-zone.service.d.ts +14 -0
- package/dist/cjs/services/time-zone.service.js +82 -0
- package/dist/cjs/services/toil-accruals.service.d.ts +4 -4
- package/dist/cjs/services/toil-accruals.service.js +12 -22
- package/dist/cjs/services/toil-allowance.service.d.ts +3 -3
- package/dist/cjs/services/toil-allowance.service.js +9 -19
- package/dist/cjs/services/users-clock-in.service.d.ts +22 -10
- package/dist/cjs/services/users-clock-in.service.js +5 -5
- package/dist/cjs/services/users.service.d.ts +28 -9
- package/dist/cjs/services/users.service.js +16 -26
- package/dist/cjs/version.js +1 -1
- package/dist/mjs/interfaces/index.d.ts +1 -0
- package/dist/mjs/interfaces/index.js +1 -0
- package/dist/mjs/interfaces/query-params/index.d.ts +0 -1
- package/dist/mjs/interfaces/query-params/index.js +0 -1
- package/dist/mjs/interfaces/terminal.interface.d.ts +1 -0
- package/dist/mjs/interfaces/time-zone.interface.d.ts +7 -0
- package/dist/mjs/rotacloud.d.ts +2 -1
- package/dist/mjs/rotacloud.js +2 -1
- package/dist/mjs/services/accounts.service.d.ts +26 -7
- package/dist/mjs/services/accounts.service.js +2 -4
- package/dist/mjs/services/attendance.service.d.ts +30 -11
- package/dist/mjs/services/attendance.service.js +8 -10
- package/dist/mjs/services/auth.service.js +1 -3
- package/dist/mjs/services/availability.service.d.ts +3 -3
- package/dist/mjs/services/availability.service.js +3 -5
- package/dist/mjs/services/daily-budgets.service.d.ts +19 -7
- package/dist/mjs/services/daily-budgets.service.js +4 -6
- package/dist/mjs/services/daily-revenue.service.d.ts +18 -6
- package/dist/mjs/services/daily-revenue.service.js +3 -5
- package/dist/mjs/services/day-notes.service.d.ts +27 -8
- package/dist/mjs/services/day-notes.service.js +7 -9
- package/dist/mjs/services/days-off.service.d.ts +17 -5
- package/dist/mjs/services/days-off.service.js +5 -7
- package/dist/mjs/services/groups.service.d.ts +27 -8
- package/dist/mjs/services/groups.service.js +4 -6
- package/dist/mjs/services/index.d.ts +1 -0
- package/dist/mjs/services/index.js +1 -0
- package/dist/mjs/services/leave-embargoes.service.d.ts +27 -8
- package/dist/mjs/services/leave-embargoes.service.js +8 -10
- package/dist/mjs/services/leave-request.service.d.ts +27 -8
- package/dist/mjs/services/leave-request.service.js +7 -9
- package/dist/mjs/services/leave.service.d.ts +28 -10
- package/dist/mjs/services/leave.service.js +5 -12
- package/dist/mjs/services/locations.service.d.ts +27 -8
- package/dist/mjs/services/locations.service.js +8 -10
- package/dist/mjs/services/pins.service.d.ts +12 -5
- package/dist/mjs/services/pins.service.js +1 -1
- package/dist/mjs/services/roles.service.d.ts +27 -8
- package/dist/mjs/services/roles.service.js +8 -10
- package/dist/mjs/services/service.d.ts +12 -3
- package/dist/mjs/services/service.js +0 -2
- package/dist/mjs/services/settings.service.d.ts +1 -1
- package/dist/mjs/services/settings.service.js +1 -1
- package/dist/mjs/services/shifts.service.d.ts +30 -11
- package/dist/mjs/services/shifts.service.js +13 -15
- package/dist/mjs/services/terminals-active.service.d.ts +20 -8
- package/dist/mjs/services/terminals-active.service.js +8 -10
- package/dist/mjs/services/terminals.service.d.ts +27 -8
- package/dist/mjs/services/terminals.service.js +5 -7
- package/dist/mjs/services/time-zone.service.d.ts +14 -0
- package/dist/mjs/services/time-zone.service.js +25 -0
- package/dist/mjs/services/toil-accruals.service.d.ts +4 -4
- package/dist/mjs/services/toil-accruals.service.js +4 -6
- package/dist/mjs/services/toil-allowance.service.d.ts +3 -3
- package/dist/mjs/services/toil-allowance.service.js +1 -3
- package/dist/mjs/services/users-clock-in.service.d.ts +22 -10
- package/dist/mjs/services/users-clock-in.service.js +5 -5
- package/dist/mjs/services/users.service.d.ts +28 -9
- package/dist/mjs/services/users.service.js +8 -10
- package/dist/mjs/version.js +1 -1
- package/package.json +1 -1
- package/src/interfaces/index.ts +1 -0
- package/src/interfaces/query-params/index.ts +0 -1
- package/src/interfaces/terminal.interface.ts +1 -0
- package/src/interfaces/time-zone.interface.ts +7 -0
- package/src/rotacloud.ts +2 -0
- package/src/services/accounts.service.ts +30 -14
- package/src/services/attendance.service.ts +57 -28
- package/src/services/auth.service.ts +1 -3
- package/src/services/availability.service.ts +14 -13
- package/src/services/daily-budgets.service.ts +41 -20
- package/src/services/daily-revenue.service.ts +37 -19
- package/src/services/day-notes.service.ts +51 -25
- package/src/services/days-off.service.ts +46 -25
- package/src/services/groups.service.ts +40 -20
- package/src/services/index.ts +1 -0
- package/src/services/leave-embargoes.service.ts +54 -25
- package/src/services/leave-request.service.ts +53 -24
- package/src/services/leave.service.ts +41 -27
- package/src/services/locations.service.ts +54 -25
- package/src/services/pins.service.ts +11 -6
- package/src/services/roles.service.ts +49 -25
- package/src/services/service.ts +35 -9
- package/src/services/settings.service.ts +2 -2
- package/src/services/shifts.service.ts +62 -36
- package/src/services/terminals-active.service.ts +36 -23
- package/src/services/terminals.service.ts +36 -18
- package/src/services/time-zone.service.ts +34 -0
- package/src/services/toil-accruals.service.ts +9 -11
- package/src/services/toil-allowance.service.ts +3 -5
- package/src/services/users-clock-in.service.ts +30 -16
- package/src/services/users.service.ts +49 -26
- package/src/version.ts +1 -1
- package/dist/cjs/interfaces/query-params/internal-query-params.interface.d.ts +0 -5
- package/dist/mjs/interfaces/query-params/internal-query-params.interface.d.ts +0 -5
- package/src/interfaces/query-params/internal-query-params.interface.ts +0 -5
- /package/dist/cjs/interfaces/{query-params/internal-query-params.interface.js → time-zone.interface.js} +0 -0
- /package/dist/mjs/interfaces/{query-params/internal-query-params.interface.js → time-zone.interface.js} +0 -0
|
@@ -1,28 +1,39 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
|
-
import { Service, Options } from './index.js';
|
|
2
|
+
import { Service, Options, OptionsExtended } from './index.js';
|
|
3
3
|
|
|
4
4
|
import { Account } from '../interfaces/index.js';
|
|
5
5
|
|
|
6
|
-
export class AccountsService extends Service {
|
|
6
|
+
export class AccountsService extends Service<Account> {
|
|
7
7
|
private apiPath = '/accounts';
|
|
8
8
|
|
|
9
9
|
get(id: number): Promise<Account>;
|
|
10
|
-
get
|
|
11
|
-
|
|
12
|
-
|
|
10
|
+
get<F extends keyof Account>(
|
|
11
|
+
id: number,
|
|
12
|
+
options: { fields: F[]; rawResponse: true } & OptionsExtended<Account>,
|
|
13
|
+
): Promise<AxiosResponse<Pick<Account, F>>>;
|
|
14
|
+
get<F extends keyof Account>(
|
|
15
|
+
id: number,
|
|
16
|
+
options: { fields: F[] } & OptionsExtended<Account>,
|
|
17
|
+
): Promise<Pick<Account, F>>;
|
|
18
|
+
get(id: number, options: { rawResponse: true } & OptionsExtended<Account>): Promise<AxiosResponse<Account>>;
|
|
19
|
+
get(id: number, options?: OptionsExtended<Account>): Promise<Account>;
|
|
20
|
+
get(id: number, options?: OptionsExtended<Account>) {
|
|
13
21
|
return super
|
|
14
22
|
.fetch<Account>({ url: `${this.apiPath}/${id}` }, options)
|
|
15
|
-
.then((res) =>
|
|
23
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
16
24
|
}
|
|
17
25
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
list(): AsyncGenerator<Account>;
|
|
27
|
+
list<F extends keyof Account>(options: { fields: F[] } & OptionsExtended<Account>): AsyncGenerator<Pick<Account, F>>;
|
|
28
|
+
list(options?: OptionsExtended<Account>): AsyncGenerator<Account>;
|
|
29
|
+
async *list(options?: OptionsExtended<Account>) {
|
|
30
|
+
yield* super.iterator({ url: this.apiPath }, options);
|
|
22
31
|
}
|
|
23
32
|
|
|
24
|
-
listAll(
|
|
25
|
-
|
|
33
|
+
listAll(): Promise<Account[]>;
|
|
34
|
+
listAll<F extends keyof Account>(options: { fields: F[] } & OptionsExtended<Account>): Promise<Pick<Account, F>[]>;
|
|
35
|
+
listAll(options?: OptionsExtended<Account>): Promise<Account[]>;
|
|
36
|
+
async listAll(options?: OptionsExtended<Account>) {
|
|
26
37
|
const accounts = [] as Account[];
|
|
27
38
|
for await (const account of this.list(options)) {
|
|
28
39
|
accounts.push(account);
|
|
@@ -30,7 +41,12 @@ export class AccountsService extends Service {
|
|
|
30
41
|
return accounts;
|
|
31
42
|
}
|
|
32
43
|
|
|
33
|
-
listByPage(
|
|
34
|
-
|
|
44
|
+
listByPage(): AsyncGenerator<AxiosResponse<Account[]>>;
|
|
45
|
+
listByPage<F extends keyof Account>(
|
|
46
|
+
options: { fields: F[] } & OptionsExtended<Account>,
|
|
47
|
+
): AsyncGenerator<AxiosResponse<Pick<Account, F>[]>>;
|
|
48
|
+
listByPage(options: OptionsExtended<Account>): AsyncGenerator<AxiosResponse<Account[]>>;
|
|
49
|
+
listByPage(options?: OptionsExtended<Account>) {
|
|
50
|
+
return super.iterator({ url: this.apiPath }, options).byPage();
|
|
35
51
|
}
|
|
36
52
|
}
|
|
@@ -1,43 +1,60 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { Attendance } from '../interfaces/index.js';
|
|
3
|
-
import { Service, Options, RequirementsOf } from './index.js';
|
|
3
|
+
import { Service, Options, RequirementsOf, OptionsExtended } from './index.js';
|
|
4
4
|
|
|
5
5
|
import { AttendanceQueryParams } from '../interfaces/query-params/attendance-query-params.interface.js';
|
|
6
6
|
|
|
7
7
|
type RequiredProps = 'user' | 'in_time';
|
|
8
8
|
|
|
9
|
-
export class AttendanceService extends Service {
|
|
9
|
+
export class AttendanceService extends Service<Attendance> {
|
|
10
10
|
private apiPath = '/attendance';
|
|
11
11
|
|
|
12
12
|
create(data: RequirementsOf<Attendance, RequiredProps>): Promise<Attendance>;
|
|
13
13
|
create(
|
|
14
14
|
data: RequirementsOf<Attendance, RequiredProps>,
|
|
15
15
|
options: { rawResponse: true } & Options,
|
|
16
|
-
): Promise<AxiosResponse<Attendance
|
|
16
|
+
): Promise<AxiosResponse<Attendance>>;
|
|
17
17
|
create(data: RequirementsOf<Attendance, RequiredProps>, options: Options): Promise<Attendance>;
|
|
18
18
|
create(data: RequirementsOf<Attendance, RequiredProps>, options?: Options) {
|
|
19
19
|
return super
|
|
20
|
-
.fetch<Attendance>({ url: this.apiPath, data, method: 'POST' })
|
|
21
|
-
.then((res) =>
|
|
20
|
+
.fetch<Attendance>({ url: this.apiPath, data, method: 'POST' }, options)
|
|
21
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
get(id: number): Promise<Attendance>;
|
|
25
|
-
get
|
|
26
|
-
|
|
27
|
-
|
|
25
|
+
get<F extends keyof Attendance>(
|
|
26
|
+
id: number,
|
|
27
|
+
options: { fields: F[]; rawResponse: true } & OptionsExtended<Attendance>,
|
|
28
|
+
): Promise<AxiosResponse<Pick<Attendance, F>>>;
|
|
29
|
+
get<F extends keyof Attendance>(
|
|
30
|
+
id: number,
|
|
31
|
+
options: { fields: F[] } & OptionsExtended<Attendance>,
|
|
32
|
+
): Promise<Pick<Attendance, F>>;
|
|
33
|
+
get(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<Attendance>>;
|
|
34
|
+
get(id: number, options?: OptionsExtended<Attendance>): Promise<Attendance>;
|
|
35
|
+
get(id: number, options?: OptionsExtended<Attendance>) {
|
|
28
36
|
return super
|
|
29
37
|
.fetch<Attendance>({ url: `${this.apiPath}/${id}` }, options)
|
|
30
|
-
.then((res) =>
|
|
38
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
31
39
|
}
|
|
32
40
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
41
|
+
list(query: AttendanceQueryParams): AsyncGenerator<Attendance>;
|
|
42
|
+
list<F extends keyof Attendance>(
|
|
43
|
+
query: AttendanceQueryParams,
|
|
44
|
+
options: { fields: F[] } & OptionsExtended<Attendance>,
|
|
45
|
+
): AsyncGenerator<Pick<Attendance, F>>;
|
|
46
|
+
list(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>): AsyncGenerator<Attendance>;
|
|
47
|
+
async *list(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>) {
|
|
48
|
+
yield* super.iterator({ url: this.apiPath, params: query }, options);
|
|
37
49
|
}
|
|
38
50
|
|
|
39
|
-
listAll(query: AttendanceQueryParams
|
|
40
|
-
|
|
51
|
+
listAll(query: AttendanceQueryParams): Promise<Attendance[]>;
|
|
52
|
+
listAll<F extends keyof Attendance>(
|
|
53
|
+
query: AttendanceQueryParams,
|
|
54
|
+
options: { fields: F[] } & OptionsExtended<Attendance>,
|
|
55
|
+
): Promise<Pick<Attendance, F>[]>;
|
|
56
|
+
listAll(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>): Promise<Attendance[]>;
|
|
57
|
+
async listAll(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>) {
|
|
41
58
|
const attendance = [] as Attendance[];
|
|
42
59
|
for await (const atten of this.list(query, options)) {
|
|
43
60
|
attendance.push(atten);
|
|
@@ -45,8 +62,17 @@ export class AttendanceService extends Service {
|
|
|
45
62
|
return attendance;
|
|
46
63
|
}
|
|
47
64
|
|
|
48
|
-
listByPage(query: AttendanceQueryParams
|
|
49
|
-
|
|
65
|
+
listByPage(query: AttendanceQueryParams): AsyncGenerator<AxiosResponse<Attendance[]>>;
|
|
66
|
+
listByPage<F extends keyof Attendance>(
|
|
67
|
+
query: AttendanceQueryParams,
|
|
68
|
+
options: { fields: F[] } & OptionsExtended<Attendance>,
|
|
69
|
+
): AsyncGenerator<AxiosResponse<Pick<Attendance, F>[]>>;
|
|
70
|
+
listByPage(
|
|
71
|
+
query: AttendanceQueryParams,
|
|
72
|
+
options?: OptionsExtended<Attendance>,
|
|
73
|
+
): AsyncGenerator<AxiosResponse<Attendance[]>>;
|
|
74
|
+
listByPage(query: AttendanceQueryParams, options?: OptionsExtended<Attendance>) {
|
|
75
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
50
76
|
}
|
|
51
77
|
|
|
52
78
|
update(id: number, data: Partial<Attendance>): Promise<Attendance>;
|
|
@@ -54,24 +80,27 @@ export class AttendanceService extends Service {
|
|
|
54
80
|
id: number,
|
|
55
81
|
data: Partial<Attendance>,
|
|
56
82
|
options: { rawResponse: true } & Options,
|
|
57
|
-
): Promise<AxiosResponse<Attendance
|
|
83
|
+
): Promise<AxiosResponse<Attendance>>;
|
|
58
84
|
update(id: number, data: Partial<Attendance>, options: Options): Promise<Attendance>;
|
|
59
85
|
update(id: number, data: Partial<Attendance>, options?: Options) {
|
|
60
86
|
return super
|
|
61
|
-
.fetch<Attendance>(
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
87
|
+
.fetch<Attendance>(
|
|
88
|
+
{
|
|
89
|
+
url: `${this.apiPath}/${id}`,
|
|
90
|
+
data,
|
|
91
|
+
method: 'POST',
|
|
92
|
+
},
|
|
93
|
+
options,
|
|
94
|
+
)
|
|
95
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
67
96
|
}
|
|
68
97
|
|
|
69
98
|
delete(id: number): Promise<number>;
|
|
70
|
-
delete(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<
|
|
71
|
-
delete(id: number, options
|
|
99
|
+
delete(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<void>>;
|
|
100
|
+
delete(id: number, options?: Options): Promise<number>;
|
|
72
101
|
delete(id: number, options?: Options) {
|
|
73
102
|
return super
|
|
74
|
-
.fetch<
|
|
75
|
-
.then((res) =>
|
|
103
|
+
.fetch<void>({ url: `${this.apiPath}/${id}`, method: 'DELETE' }, options)
|
|
104
|
+
.then((res) => (options?.rawResponse ? res : res.status));
|
|
76
105
|
}
|
|
77
106
|
}
|
|
@@ -8,8 +8,6 @@ export class AuthService extends Service {
|
|
|
8
8
|
get(options?: { rawResponse: true } & Options): Promise<AxiosResponse<Auth, any>>;
|
|
9
9
|
get(options?: Options): Promise<Auth>;
|
|
10
10
|
get(options?: Options) {
|
|
11
|
-
return super
|
|
12
|
-
.fetch<Auth>({ url: this.apiPath }, options)
|
|
13
|
-
.then((res) => Promise.resolve(options?.rawResponse ? res : res.data));
|
|
11
|
+
return super.fetch<Auth>({ url: this.apiPath }, options).then((res) => (options?.rawResponse ? res : res.data));
|
|
14
12
|
}
|
|
15
13
|
}
|
|
@@ -4,7 +4,7 @@ import { Service, Options } from './index.js';
|
|
|
4
4
|
import { AvailabilityQueryParams } from '../interfaces/query-params/availability-query-params.interface.js';
|
|
5
5
|
import { Availability } from '../interfaces/availability.interface.js';
|
|
6
6
|
|
|
7
|
-
export class AvailabilityService extends Service {
|
|
7
|
+
export class AvailabilityService extends Service<Availability> {
|
|
8
8
|
private apiPath = '/availability';
|
|
9
9
|
|
|
10
10
|
update(data: Availability): Promise<Availability>;
|
|
@@ -12,12 +12,15 @@ export class AvailabilityService extends Service {
|
|
|
12
12
|
update(data: Availability, options?: Options): Promise<Availability | AxiosResponse<Availability>>;
|
|
13
13
|
update(data: Availability, options?: Options) {
|
|
14
14
|
return super
|
|
15
|
-
.fetch<Availability>(
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
15
|
+
.fetch<Availability>(
|
|
16
|
+
{
|
|
17
|
+
url: this.apiPath,
|
|
18
|
+
data,
|
|
19
|
+
method: 'POST',
|
|
20
|
+
},
|
|
21
|
+
options,
|
|
22
|
+
)
|
|
23
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
21
24
|
}
|
|
22
25
|
|
|
23
26
|
/** Alias of {@link AvailabilityService["update"]} */
|
|
@@ -45,13 +48,11 @@ export class AvailabilityService extends Service {
|
|
|
45
48
|
);
|
|
46
49
|
}
|
|
47
50
|
|
|
48
|
-
async *list(query
|
|
49
|
-
|
|
50
|
-
yield res;
|
|
51
|
-
}
|
|
51
|
+
async *list(query?: AvailabilityQueryParams, options?: Options) {
|
|
52
|
+
yield* super.iterator({ url: this.apiPath, params: query }, options);
|
|
52
53
|
}
|
|
53
54
|
|
|
54
|
-
listByPage(query
|
|
55
|
-
return super.iterator
|
|
55
|
+
listByPage(query?: AvailabilityQueryParams, options?: Options) {
|
|
56
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
56
57
|
}
|
|
57
58
|
}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { DailyBudgets } from '../interfaces/daily-budgets.interface.js';
|
|
3
|
-
import { Service,
|
|
3
|
+
import { Service, OptionsExtended } from './index.js';
|
|
4
4
|
|
|
5
5
|
import { DailyBudgetsQueryParams } from '../interfaces/query-params/daily-budgets-query-params.interface.js';
|
|
6
6
|
|
|
7
|
-
export class DailyBudgetsService extends Service {
|
|
7
|
+
export class DailyBudgetsService extends Service<DailyBudgets> {
|
|
8
8
|
private apiPath = '/daily_budgets';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
10
|
+
list(query: DailyBudgetsQueryParams): AsyncGenerator<DailyBudgets>;
|
|
11
|
+
list<F extends keyof DailyBudgets>(
|
|
12
|
+
query: DailyBudgetsQueryParams,
|
|
13
|
+
options: { fields: F[] } & OptionsExtended<DailyBudgets>,
|
|
14
|
+
): AsyncGenerator<Pick<DailyBudgets, F>>;
|
|
15
|
+
list(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>): AsyncGenerator<DailyBudgets>;
|
|
16
|
+
async *list(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>) {
|
|
17
|
+
yield* super.iterator({ url: this.apiPath, params: query }, options);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
listAll(query: DailyBudgetsQueryParams
|
|
17
|
-
|
|
20
|
+
listAll(query: DailyBudgetsQueryParams): Promise<DailyBudgets[]>;
|
|
21
|
+
listAll<F extends keyof DailyBudgets>(
|
|
22
|
+
query: DailyBudgetsQueryParams,
|
|
23
|
+
options: { fields: F[] } & OptionsExtended<DailyBudgets>,
|
|
24
|
+
): Promise<Pick<DailyBudgets, F>[]>;
|
|
25
|
+
listAll(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>): Promise<DailyBudgets[]>;
|
|
26
|
+
async listAll(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>) {
|
|
18
27
|
const attendance = [] as DailyBudgets[];
|
|
19
28
|
for await (const atten of this.list(query, options)) {
|
|
20
29
|
attendance.push(atten);
|
|
@@ -22,23 +31,35 @@ export class DailyBudgetsService extends Service {
|
|
|
22
31
|
return attendance;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
listByPage(query: DailyBudgetsQueryParams
|
|
26
|
-
|
|
34
|
+
listByPage(query: DailyBudgetsQueryParams): AsyncGenerator<AxiosResponse<DailyBudgets[]>>;
|
|
35
|
+
listByPage<F extends keyof DailyBudgets>(
|
|
36
|
+
query: DailyBudgetsQueryParams,
|
|
37
|
+
options: { fields: F[] } & OptionsExtended<DailyBudgets>,
|
|
38
|
+
): AsyncGenerator<AxiosResponse<Pick<DailyBudgets, F>[]>>;
|
|
39
|
+
listByPage(
|
|
40
|
+
query: DailyBudgetsQueryParams,
|
|
41
|
+
options?: OptionsExtended<DailyBudgets>,
|
|
42
|
+
): AsyncGenerator<AxiosResponse<DailyBudgets[]>>;
|
|
43
|
+
listByPage(query: DailyBudgetsQueryParams, options?: OptionsExtended<DailyBudgets>) {
|
|
44
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
update(data: Partial<DailyBudgets>[]): Promise<number>;
|
|
30
48
|
update(
|
|
31
49
|
data: Partial<DailyBudgets>[],
|
|
32
|
-
options: { rawResponse: true } &
|
|
33
|
-
): Promise<AxiosResponse<
|
|
34
|
-
update(data: Partial<DailyBudgets>[], options
|
|
35
|
-
update(data: Partial<DailyBudgets>[], options?:
|
|
50
|
+
options: { rawResponse: true } & OptionsExtended<DailyBudgets>,
|
|
51
|
+
): Promise<AxiosResponse<void>>;
|
|
52
|
+
update(data: Partial<DailyBudgets>[], options?: OptionsExtended<DailyBudgets>): Promise<number>;
|
|
53
|
+
update(data: Partial<DailyBudgets>[], options?: OptionsExtended<DailyBudgets>) {
|
|
36
54
|
return super
|
|
37
|
-
.fetch<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
55
|
+
.fetch<void>(
|
|
56
|
+
{
|
|
57
|
+
url: this.apiPath,
|
|
58
|
+
data,
|
|
59
|
+
method: 'POST',
|
|
60
|
+
},
|
|
61
|
+
options,
|
|
62
|
+
)
|
|
63
|
+
.then((res) => (options?.rawResponse ? res : res.status));
|
|
43
64
|
}
|
|
44
65
|
}
|
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { DailyRevenue } from '../interfaces/daily-revenue.interface.js';
|
|
3
|
-
import { Service, Options } from './index.js';
|
|
3
|
+
import { Service, Options, OptionsExtended } from './index.js';
|
|
4
4
|
|
|
5
5
|
import { DailyRevenueQueryParams } from '../interfaces/query-params/daily-revenue-query-params.interface.js';
|
|
6
6
|
|
|
7
|
-
export class DailyRevenueService extends Service {
|
|
7
|
+
export class DailyRevenueService extends Service<DailyRevenue> {
|
|
8
8
|
private apiPath = '/daily_revenue';
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
}
|
|
10
|
+
list(query?: DailyRevenueQueryParams): AsyncGenerator<DailyRevenue>;
|
|
11
|
+
list<F extends keyof DailyRevenue>(
|
|
12
|
+
query: DailyRevenueQueryParams,
|
|
13
|
+
options: { fields: F[] } & OptionsExtended<DailyRevenue>,
|
|
14
|
+
): AsyncGenerator<Pick<DailyRevenue, F>>;
|
|
15
|
+
list(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>): AsyncGenerator<DailyRevenue>;
|
|
16
|
+
async *list(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>) {
|
|
17
|
+
yield* super.iterator<DailyRevenue>({ url: this.apiPath, params: query }, options);
|
|
14
18
|
}
|
|
15
19
|
|
|
16
|
-
listAll(query
|
|
17
|
-
|
|
20
|
+
listAll(query?: DailyRevenueQueryParams): Promise<DailyRevenue[]>;
|
|
21
|
+
listAll<F extends keyof DailyRevenue>(
|
|
22
|
+
query: DailyRevenueQueryParams,
|
|
23
|
+
options: { fields: F[] } & OptionsExtended<DailyRevenue>,
|
|
24
|
+
): Promise<Pick<DailyRevenue, F>[]>;
|
|
25
|
+
listAll(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>): Promise<DailyRevenue[]>;
|
|
26
|
+
async listAll(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>) {
|
|
18
27
|
const attendance = [] as DailyRevenue[];
|
|
19
28
|
for await (const atten of this.list(query, options)) {
|
|
20
29
|
attendance.push(atten);
|
|
@@ -22,23 +31,32 @@ export class DailyRevenueService extends Service {
|
|
|
22
31
|
return attendance;
|
|
23
32
|
}
|
|
24
33
|
|
|
25
|
-
listByPage(query
|
|
34
|
+
listByPage(query?: DailyRevenueQueryParams): AsyncGenerator<AxiosResponse<DailyRevenue[]>>;
|
|
35
|
+
listByPage<F extends keyof DailyRevenue>(
|
|
36
|
+
query: DailyRevenueQueryParams,
|
|
37
|
+
options: { fields: F[] } & OptionsExtended<DailyRevenue>,
|
|
38
|
+
): AsyncGenerator<AxiosResponse<Pick<DailyRevenue, F>[]>>;
|
|
39
|
+
listByPage(
|
|
40
|
+
query: DailyRevenueQueryParams,
|
|
41
|
+
options?: OptionsExtended<DailyRevenue>,
|
|
42
|
+
): AsyncGenerator<AxiosResponse<DailyRevenue[]>>;
|
|
43
|
+
listByPage(query?: DailyRevenueQueryParams, options?: OptionsExtended<DailyRevenue>) {
|
|
26
44
|
return super.iterator<DailyRevenue>({ url: this.apiPath, params: query }, options).byPage();
|
|
27
45
|
}
|
|
28
46
|
|
|
29
47
|
update(data: Partial<DailyRevenue>[]): Promise<number>;
|
|
30
|
-
update(
|
|
31
|
-
data: Partial<DailyRevenue>[],
|
|
32
|
-
options: { rawResponse: true } & Options,
|
|
33
|
-
): Promise<AxiosResponse<DailyRevenue, any>>;
|
|
48
|
+
update(data: Partial<DailyRevenue>[], options: { rawResponse: true } & Options): Promise<AxiosResponse<void>>;
|
|
34
49
|
update(data: Partial<DailyRevenue>[], options: Options): Promise<number>;
|
|
35
50
|
update(data: Partial<DailyRevenue>[], options?: Options) {
|
|
36
51
|
return super
|
|
37
|
-
.fetch<
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
52
|
+
.fetch<void>(
|
|
53
|
+
{
|
|
54
|
+
url: `${this.apiPath}`,
|
|
55
|
+
data,
|
|
56
|
+
method: 'POST',
|
|
57
|
+
},
|
|
58
|
+
options,
|
|
59
|
+
)
|
|
60
|
+
.then((res) => (options?.rawResponse ? res : res.status));
|
|
43
61
|
}
|
|
44
62
|
}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AxiosResponse } from 'axios';
|
|
2
2
|
import { DayNote } from '../interfaces/index.js';
|
|
3
|
-
import { Service, Options } from './index.js';
|
|
3
|
+
import { Service, Options, OptionsExtended } from './index.js';
|
|
4
4
|
|
|
5
5
|
import { DayNotesQueryParams } from '../interfaces/query-params/day-notes-query-params.interface';
|
|
6
6
|
|
|
7
|
-
export class DayNotesService extends Service {
|
|
7
|
+
export class DayNotesService extends Service<DayNote> {
|
|
8
8
|
private apiPath = '/day_notes';
|
|
9
9
|
|
|
10
10
|
create(data: DayNote): Promise<DayNote>;
|
|
@@ -12,27 +12,44 @@ export class DayNotesService extends Service {
|
|
|
12
12
|
create(data: DayNote, options: Options): Promise<DayNote>;
|
|
13
13
|
create(data: DayNote, options?: Options) {
|
|
14
14
|
return super
|
|
15
|
-
.fetch
|
|
16
|
-
.then((res) =>
|
|
15
|
+
.fetch({ url: this.apiPath, data, method: 'POST' })
|
|
16
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
17
17
|
}
|
|
18
18
|
|
|
19
19
|
get(id: number): Promise<DayNote>;
|
|
20
|
-
get
|
|
21
|
-
|
|
22
|
-
|
|
20
|
+
get<F extends keyof DayNote>(
|
|
21
|
+
id: number,
|
|
22
|
+
options: { fields: F[]; rawResponse: true } & OptionsExtended<DayNote>,
|
|
23
|
+
): Promise<AxiosResponse<Pick<DayNote, F>>>;
|
|
24
|
+
get<F extends keyof DayNote>(
|
|
25
|
+
id: number,
|
|
26
|
+
options: { fields: F[] } & OptionsExtended<DayNote>,
|
|
27
|
+
): Promise<Pick<DayNote, F>>;
|
|
28
|
+
get(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<DayNote>>;
|
|
29
|
+
get(id: number, options?: OptionsExtended<DayNote>): Promise<DayNote>;
|
|
30
|
+
get(id: number, options?: OptionsExtended<DayNote>) {
|
|
23
31
|
return super
|
|
24
32
|
.fetch<DayNote>({ url: `${this.apiPath}/${id}` }, options)
|
|
25
|
-
.then((res) =>
|
|
33
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
26
34
|
}
|
|
27
35
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
}
|
|
36
|
+
list(query: DayNotesQueryParams): AsyncGenerator<DayNote>;
|
|
37
|
+
list<F extends keyof DayNote>(
|
|
38
|
+
query: DayNotesQueryParams,
|
|
39
|
+
options: { fields: F[] } & OptionsExtended<DayNote>,
|
|
40
|
+
): AsyncGenerator<Pick<DayNote, F>>;
|
|
41
|
+
list(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>): AsyncGenerator<DayNote>;
|
|
42
|
+
async *list(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>) {
|
|
43
|
+
yield* super.iterator({ url: this.apiPath, params: query }, options);
|
|
32
44
|
}
|
|
33
45
|
|
|
34
|
-
listAll(query: DayNotesQueryParams
|
|
35
|
-
|
|
46
|
+
listAll(query: DayNotesQueryParams): Promise<DayNote[]>;
|
|
47
|
+
listAll<F extends keyof DayNote>(
|
|
48
|
+
query: DayNotesQueryParams,
|
|
49
|
+
options: { fields: F[] } & OptionsExtended<DayNote>,
|
|
50
|
+
): Promise<Pick<DayNote, F>[]>;
|
|
51
|
+
listAll(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>): Promise<DayNote[]>;
|
|
52
|
+
async listAll(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>) {
|
|
36
53
|
const dayNotes: DayNote[] = [];
|
|
37
54
|
for await (const dayNote of this.list(query, options)) {
|
|
38
55
|
dayNotes.push(dayNote);
|
|
@@ -40,8 +57,14 @@ export class DayNotesService extends Service {
|
|
|
40
57
|
return dayNotes;
|
|
41
58
|
}
|
|
42
59
|
|
|
43
|
-
listByPage(query: DayNotesQueryParams
|
|
44
|
-
|
|
60
|
+
listByPage(query: DayNotesQueryParams): AsyncGenerator<AxiosResponse<DayNote[]>>;
|
|
61
|
+
listByPage<F extends keyof DayNote>(
|
|
62
|
+
query: DayNotesQueryParams,
|
|
63
|
+
options: { fields: F[] } & OptionsExtended<DayNote>,
|
|
64
|
+
): AsyncGenerator<AxiosResponse<Pick<DayNote, F>[]>>;
|
|
65
|
+
listByPage(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>): AsyncGenerator<AxiosResponse<DayNote[]>>;
|
|
66
|
+
listByPage(query: DayNotesQueryParams, options?: OptionsExtended<DayNote>) {
|
|
67
|
+
return super.iterator({ url: this.apiPath, params: query }, options).byPage();
|
|
45
68
|
}
|
|
46
69
|
|
|
47
70
|
update(id: number, data: Partial<DayNote>): Promise<DayNote>;
|
|
@@ -53,20 +76,23 @@ export class DayNotesService extends Service {
|
|
|
53
76
|
update(id: number, data: Partial<DayNote>, options: Options): Promise<DayNote>;
|
|
54
77
|
update(id: number, data: Partial<DayNote>, options?: Options) {
|
|
55
78
|
return super
|
|
56
|
-
.fetch<DayNote>(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
79
|
+
.fetch<DayNote>(
|
|
80
|
+
{
|
|
81
|
+
url: `${this.apiPath}/${id}`,
|
|
82
|
+
data,
|
|
83
|
+
method: 'POST',
|
|
84
|
+
},
|
|
85
|
+
options,
|
|
86
|
+
)
|
|
87
|
+
.then((res) => (options?.rawResponse ? res : res.data));
|
|
62
88
|
}
|
|
63
89
|
|
|
64
90
|
delete(id: number): Promise<number>;
|
|
65
|
-
delete(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<
|
|
91
|
+
delete(id: number, options: { rawResponse: true } & Options): Promise<AxiosResponse<void>>;
|
|
66
92
|
delete(id: number, options: Options): Promise<number>;
|
|
67
93
|
delete(id: number, options?: Options) {
|
|
68
94
|
return super
|
|
69
|
-
.fetch<
|
|
70
|
-
.then((res) =>
|
|
95
|
+
.fetch<void>({ url: `${this.apiPath}/${id}`, method: 'DELETE' }, options)
|
|
96
|
+
.then((res) => (options?.rawResponse ? res : res.status));
|
|
71
97
|
}
|
|
72
98
|
}
|