@smartsides/oracle-ebs-sdk 1.0.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/LICENSE +17 -0
- package/README.md +314 -0
- package/dist/OracleEBSClient-C7P6gYW3.d.mts +420 -0
- package/dist/OracleEBSClient-C7P6gYW3.d.ts +420 -0
- package/dist/hooks/index.d.mts +61 -0
- package/dist/hooks/index.d.ts +61 -0
- package/dist/hooks/index.js +191 -0
- package/dist/hooks/index.js.map +1 -0
- package/dist/hooks/index.mjs +170 -0
- package/dist/hooks/index.mjs.map +1 -0
- package/dist/index.d.mts +33 -0
- package/dist/index.d.ts +33 -0
- package/dist/index.js +540 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +526 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server/index.d.mts +8 -0
- package/dist/server/index.d.ts +8 -0
- package/dist/server/index.js +563 -0
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +555 -0
- package/dist/server/index.mjs.map +1 -0
- package/package.json +80 -0
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var reactQuery = require('@tanstack/react-query');
|
|
4
|
+
|
|
5
|
+
// src/hooks/index.ts
|
|
6
|
+
var queryKeys = {
|
|
7
|
+
auth: {
|
|
8
|
+
userContext: ["auth", "user-context"]
|
|
9
|
+
},
|
|
10
|
+
leaves: {
|
|
11
|
+
restrictedTypes: (params) => ["leaves", "restricted-types", params],
|
|
12
|
+
history: ["leaves", "history"]
|
|
13
|
+
},
|
|
14
|
+
sitRequests: {
|
|
15
|
+
segments: (params) => ["sit-requests", "segments", params],
|
|
16
|
+
history: ["sit-requests", "history"]
|
|
17
|
+
},
|
|
18
|
+
notifications: {
|
|
19
|
+
list: ["notifications", "list"],
|
|
20
|
+
details: (notificationId) => ["notifications", "details", notificationId]
|
|
21
|
+
},
|
|
22
|
+
payslip: {
|
|
23
|
+
header: (periodName) => ["payslip", "header", periodName],
|
|
24
|
+
details: (periodName) => ["payslip", "details", periodName]
|
|
25
|
+
},
|
|
26
|
+
employee: {
|
|
27
|
+
personalInfo: ["employee", "personal-info"],
|
|
28
|
+
hierarchy: ["employee", "hierarchy"]
|
|
29
|
+
},
|
|
30
|
+
accrualBalances: {
|
|
31
|
+
get: (calculationDate) => ["accrual-balances", calculationDate]
|
|
32
|
+
},
|
|
33
|
+
forms: {
|
|
34
|
+
tableColumns: (tableName) => ["forms", "table-columns", tableName],
|
|
35
|
+
dffSegments: (params) => ["forms", "dff-segments", params]
|
|
36
|
+
},
|
|
37
|
+
health: {
|
|
38
|
+
check: ["health", "check"]
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function useLogin(client, options) {
|
|
42
|
+
return reactQuery.useMutation({
|
|
43
|
+
mutationFn: (credentials) => client.auth.login(credentials),
|
|
44
|
+
...options
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
function useUserContext(client, options) {
|
|
48
|
+
return reactQuery.useQuery({
|
|
49
|
+
queryKey: queryKeys.auth.userContext,
|
|
50
|
+
queryFn: () => client.auth.getUserContext(),
|
|
51
|
+
...options
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function useLeaveTypes(client, params, options) {
|
|
55
|
+
return reactQuery.useQuery({
|
|
56
|
+
queryKey: queryKeys.leaves.restrictedTypes(params),
|
|
57
|
+
queryFn: () => client.leaves.getRestrictedTypes(params),
|
|
58
|
+
...options
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function useLeaveHistory(client, options) {
|
|
62
|
+
return reactQuery.useQuery({
|
|
63
|
+
queryKey: queryKeys.leaves.history,
|
|
64
|
+
queryFn: () => client.leaves.getHistory(),
|
|
65
|
+
...options
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function useCreateLeaveRequest(client, options) {
|
|
69
|
+
return reactQuery.useMutation({
|
|
70
|
+
mutationFn: (input) => client.leaves.createRequest(input),
|
|
71
|
+
...options
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
function useSitSegments(client, params, options) {
|
|
75
|
+
return reactQuery.useQuery({
|
|
76
|
+
queryKey: queryKeys.sitRequests.segments(params),
|
|
77
|
+
queryFn: () => client.sitRequests.getSegments(params),
|
|
78
|
+
...options
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
function useSaveAndPreviewSitRequest(client, options) {
|
|
82
|
+
return reactQuery.useMutation({
|
|
83
|
+
mutationFn: (input) => client.sitRequests.saveAndPreview(input),
|
|
84
|
+
...options
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
function useSubmitSitRequest(client, options) {
|
|
88
|
+
return reactQuery.useMutation({
|
|
89
|
+
mutationFn: (input) => client.sitRequests.submit(input),
|
|
90
|
+
...options
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
function useNotifications(client, options) {
|
|
94
|
+
return reactQuery.useQuery({
|
|
95
|
+
queryKey: queryKeys.notifications.list,
|
|
96
|
+
queryFn: () => client.notifications.getList(),
|
|
97
|
+
...options
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
function useNotificationDetails(client, params, options) {
|
|
101
|
+
return reactQuery.useQuery({
|
|
102
|
+
queryKey: queryKeys.notifications.details(params.notificationId),
|
|
103
|
+
queryFn: () => client.notifications.getDetails(params),
|
|
104
|
+
...options
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
function useProcessApproval(client, options) {
|
|
108
|
+
return reactQuery.useMutation({
|
|
109
|
+
mutationFn: (input) => client.notifications.processApproval(input),
|
|
110
|
+
...options
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
function usePayslipHeader(client, params, options) {
|
|
114
|
+
return reactQuery.useQuery({
|
|
115
|
+
queryKey: queryKeys.payslip.header(params.periodName),
|
|
116
|
+
queryFn: () => client.payslip.getHeader(params),
|
|
117
|
+
...options
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
function usePayslipDetails(client, params, options) {
|
|
121
|
+
return reactQuery.useQuery({
|
|
122
|
+
queryKey: queryKeys.payslip.details(params.periodName),
|
|
123
|
+
queryFn: () => client.payslip.getDetails(params),
|
|
124
|
+
...options
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
function usePersonalInfo(client, options) {
|
|
128
|
+
return reactQuery.useQuery({
|
|
129
|
+
queryKey: queryKeys.employee.personalInfo,
|
|
130
|
+
queryFn: () => client.employee.getPersonalInfo(),
|
|
131
|
+
...options
|
|
132
|
+
});
|
|
133
|
+
}
|
|
134
|
+
function useEmployeeHierarchy(client, options) {
|
|
135
|
+
return reactQuery.useQuery({
|
|
136
|
+
queryKey: queryKeys.employee.hierarchy,
|
|
137
|
+
queryFn: () => client.employee.getHierarchy(),
|
|
138
|
+
...options
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
function useAccrualBalances(client, params, options) {
|
|
142
|
+
return reactQuery.useQuery({
|
|
143
|
+
queryKey: queryKeys.accrualBalances.get(params.calculationDate),
|
|
144
|
+
queryFn: () => client.accrualBalances.getBalances(params),
|
|
145
|
+
...options
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
function useTableColumns(client, params, options) {
|
|
149
|
+
return reactQuery.useQuery({
|
|
150
|
+
queryKey: queryKeys.forms.tableColumns(params.tableName),
|
|
151
|
+
queryFn: () => client.forms.getTableColumns(params),
|
|
152
|
+
...options
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
function useDffSegments(client, params, options) {
|
|
156
|
+
return reactQuery.useQuery({
|
|
157
|
+
queryKey: queryKeys.forms.dffSegments(params),
|
|
158
|
+
queryFn: () => client.forms.getDffSegments(params),
|
|
159
|
+
...options
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
function useHealthCheck(client, options) {
|
|
163
|
+
return reactQuery.useQuery({
|
|
164
|
+
queryKey: queryKeys.health.check,
|
|
165
|
+
queryFn: () => client.health.check(),
|
|
166
|
+
...options
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
exports.queryKeys = queryKeys;
|
|
171
|
+
exports.useAccrualBalances = useAccrualBalances;
|
|
172
|
+
exports.useCreateLeaveRequest = useCreateLeaveRequest;
|
|
173
|
+
exports.useDffSegments = useDffSegments;
|
|
174
|
+
exports.useEmployeeHierarchy = useEmployeeHierarchy;
|
|
175
|
+
exports.useHealthCheck = useHealthCheck;
|
|
176
|
+
exports.useLeaveHistory = useLeaveHistory;
|
|
177
|
+
exports.useLeaveTypes = useLeaveTypes;
|
|
178
|
+
exports.useLogin = useLogin;
|
|
179
|
+
exports.useNotificationDetails = useNotificationDetails;
|
|
180
|
+
exports.useNotifications = useNotifications;
|
|
181
|
+
exports.usePayslipDetails = usePayslipDetails;
|
|
182
|
+
exports.usePayslipHeader = usePayslipHeader;
|
|
183
|
+
exports.usePersonalInfo = usePersonalInfo;
|
|
184
|
+
exports.useProcessApproval = useProcessApproval;
|
|
185
|
+
exports.useSaveAndPreviewSitRequest = useSaveAndPreviewSitRequest;
|
|
186
|
+
exports.useSitSegments = useSitSegments;
|
|
187
|
+
exports.useSubmitSitRequest = useSubmitSitRequest;
|
|
188
|
+
exports.useTableColumns = useTableColumns;
|
|
189
|
+
exports.useUserContext = useUserContext;
|
|
190
|
+
//# sourceMappingURL=index.js.map
|
|
191
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"names":["useMutation","useQuery"],"mappings":";;;;;AA6CO,IAAM,SAAA,GAAY;AAAA,EACrB,IAAA,EAAM;AAAA,IACF,WAAA,EAAa,CAAC,MAAA,EAAQ,cAAc;AAAA,GACxC;AAAA,EACA,MAAA,EAAQ;AAAA,IACJ,iBAAiB,CAAC,MAAA,KAAmC,CAAC,QAAA,EAAU,oBAAoB,MAAM,CAAA;AAAA,IAC1F,OAAA,EAAS,CAAC,QAAA,EAAU,SAAS;AAAA,GACjC;AAAA,EACA,WAAA,EA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AAS,MAAM,MAAA,CAAO,KAAA,CAAM,gBAAgB,MAAM,CAAA;AAAA,IAClD,GAAG;AAAA,GACN,CAAA;AACL;AAEO,SAAS,cAAA,CACZ,MAAA,EACA,MAAA,EACA,OAAA,EACF;AACE,EAAA,OAAOA,mBAAA,CAAS;AAAA,IACZ,QAAA,EAAU,SAAA,CAAU,KAAA,CAAM,WAAA,CAAY,MAAM,CAAA;AAAA,IAC5C,OAAA,EAAS,MAAM,MAAA,CAAO,KAAA,CAAM,eAAe,MAAM,CAAA;AAAA,IACjD,GAAG;AAAA,GACN,CAAA;AACL;AAGO,SAAS,cAAA,CACZ,QACA,OAAA,EACF;AACE,EAAA,OAAOA,mBAAA,CAAS;AAAA,IACZ,QAAA,EAAU,UAAU,MAAA,CAAO,KAAA;AAAA,IAC3B,OAAA,EAAS,MAAM,MAAA,CAAO,MAAA,CAAO,KAAA,EAAM;AAAA,IACnC,GAAG;AAAA,GACN,CAAA;AACL","file":"index.js","sourcesContent":["/**\n * React Query hooks for Oracle EBS SDK\n * \n * @requires @tanstack/react-query\n * @requires react\n */\n\nimport { useQuery, useMutation, type UseQueryOptions, type UseMutationOptions } from '@tanstack/react-query';\nimport type { OracleEBSClient } from '../client/OracleEBSClient';\nimport type {\n LoginCredentials,\n LoginResponse,\n UserContext,\n GetAbsenceTypesParams,\n GetAbsenceTypesResponse,\n GetLeaveHistoryResponse,\n CreateLeaveRequestInput,\n CreateLeaveRequestResponse,\n GetSitSegmentsParams,\n GetSitSegmentsResponse,\n SaveAndPreviewSitRequestInput,\n SaveAndPreviewSitRequestResponse,\n SubmitSitRequestInput,\n SubmitSitRequestResponse,\n GetNotificationsResponse,\n GetNotificationDetailsParams,\n NotificationDetails,\n ProcessApprovalInput,\n ProcessApprovalResponse,\n GetPayslipHeaderParams,\n PayslipHeader,\n GetPayslipDetailsParams,\n GetPayslipDetailsResponse,\n PersonalInformation,\n GetEmployeeHierarchyResponse,\n GetAccrualBalancesParams,\n GetAccrualBalancesResponse,\n GetTableColumnsParams,\n GetTableColumnsResponse,\n GetDffSegmentsParams,\n GetDffSegmentsResponse,\n HealthCheckResponse,\n} from '../index';\n\n// Query keys\nexport const queryKeys = {\n auth: {\n userContext: ['auth', 'user-context'] as const,\n },\n leaves: {\n restrictedTypes: (params?: GetAbsenceTypesParams) => ['leaves', 'restricted-types', params] as const,\n history: ['leaves', 'history'] as const,\n },\n sitRequests: {\n segments: (params: GetSitSegmentsParams) => ['sit-requests', 'segments', params] as const,\n history: ['sit-requests', 'history'] as const,\n },\n notifications: {\n list: ['notifications', 'list'] as const,\n details: (notificationId: string) => ['notifications', 'details', notificationId] as const,\n },\n payslip: {\n header: (periodName: string) => ['payslip', 'header', periodName] as const,\n details: (periodName: string) => ['payslip', 'details', periodName] as const,\n },\n employee: {\n personalInfo: ['employee', 'personal-info'] as const,\n hierarchy: ['employee', 'hierarchy'] as const,\n },\n accrualBalances: {\n get: (calculationDate: string) => ['accrual-balances', calculationDate] as const,\n },\n forms: {\n tableColumns: (tableName: string) => ['forms', 'table-columns', tableName] as const,\n dffSegments: (params: GetDffSegmentsParams) => ['forms', 'dff-segments', params] as const,\n },\n health: {\n check: ['health', 'check'] as const,\n },\n};\n\n// Auth hooks\nexport function useLogin(\n client: OracleEBSClient,\n options?: UseMutationOptions<LoginResponse, Error, LoginCredentials>\n) {\n return useMutation({\n mutationFn: (credentials) => client.auth.login(credentials),\n ...options,\n });\n}\n\nexport function useUserContext(\n client: OracleEBSClient,\n options?: UseQueryOptions<UserContext, Error>\n) {\n return useQuery({\n queryKey: queryKeys.auth.userContext,\n queryFn: () => client.auth.getUserContext(),\n ...options,\n });\n}\n\n// Leaves hooks\nexport function useLeaveTypes(\n client: OracleEBSClient,\n params?: GetAbsenceTypesParams,\n options?: UseQueryOptions<GetAbsenceTypesResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.leaves.restrictedTypes(params),\n queryFn: () => client.leaves.getRestrictedTypes(params),\n ...options,\n });\n}\n\nexport function useLeaveHistory(\n client: OracleEBSClient,\n options?: UseQueryOptions<GetLeaveHistoryResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.leaves.history,\n queryFn: () => client.leaves.getHistory(),\n ...options,\n });\n}\n\nexport function useCreateLeaveRequest(\n client: OracleEBSClient,\n options?: UseMutationOptions<CreateLeaveRequestResponse, Error, CreateLeaveRequestInput>\n) {\n return useMutation({\n mutationFn: (input) => client.leaves.createRequest(input),\n ...options,\n });\n}\n\n// SIT Requests hooks\nexport function useSitSegments(\n client: OracleEBSClient,\n params: GetSitSegmentsParams,\n options?: UseQueryOptions<GetSitSegmentsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.sitRequests.segments(params),\n queryFn: () => client.sitRequests.getSegments(params),\n ...options,\n });\n}\n\nexport function useSaveAndPreviewSitRequest(\n client: OracleEBSClient,\n options?: UseMutationOptions<SaveAndPreviewSitRequestResponse, Error, SaveAndPreviewSitRequestInput>\n) {\n return useMutation({\n mutationFn: (input) => client.sitRequests.saveAndPreview(input),\n ...options,\n });\n}\n\nexport function useSubmitSitRequest(\n client: OracleEBSClient,\n options?: UseMutationOptions<SubmitSitRequestResponse, Error, SubmitSitRequestInput>\n) {\n return useMutation({\n mutationFn: (input) => client.sitRequests.submit(input),\n ...options,\n });\n}\n\n// Notifications hooks\nexport function useNotifications(\n client: OracleEBSClient,\n options?: UseQueryOptions<GetNotificationsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.notifications.list,\n queryFn: () => client.notifications.getList(),\n ...options,\n });\n}\n\nexport function useNotificationDetails(\n client: OracleEBSClient,\n params: GetNotificationDetailsParams,\n options?: UseQueryOptions<NotificationDetails, Error>\n) {\n return useQuery({\n queryKey: queryKeys.notifications.details(params.notificationId),\n queryFn: () => client.notifications.getDetails(params),\n ...options,\n });\n}\n\nexport function useProcessApproval(\n client: OracleEBSClient,\n options?: UseMutationOptions<ProcessApprovalResponse, Error, ProcessApprovalInput>\n) {\n return useMutation({\n mutationFn: (input) => client.notifications.processApproval(input),\n ...options,\n });\n}\n\n// Payslip hooks\nexport function usePayslipHeader(\n client: OracleEBSClient,\n params: GetPayslipHeaderParams,\n options?: UseQueryOptions<PayslipHeader, Error>\n) {\n return useQuery({\n queryKey: queryKeys.payslip.header(params.periodName),\n queryFn: () => client.payslip.getHeader(params),\n ...options,\n });\n}\n\nexport function usePayslipDetails(\n client: OracleEBSClient,\n params: GetPayslipDetailsParams,\n options?: UseQueryOptions<GetPayslipDetailsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.payslip.details(params.periodName),\n queryFn: () => client.payslip.getDetails(params),\n ...options,\n });\n}\n\n// Employee hooks\nexport function usePersonalInfo(\n client: OracleEBSClient,\n options?: UseQueryOptions<PersonalInformation, Error>\n) {\n return useQuery({\n queryKey: queryKeys.employee.personalInfo,\n queryFn: () => client.employee.getPersonalInfo(),\n ...options,\n });\n}\n\nexport function useEmployeeHierarchy(\n client: OracleEBSClient,\n options?: UseQueryOptions<GetEmployeeHierarchyResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.employee.hierarchy,\n queryFn: () => client.employee.getHierarchy(),\n ...options,\n });\n}\n\n// Accrual Balances hooks\nexport function useAccrualBalances(\n client: OracleEBSClient,\n params: GetAccrualBalancesParams,\n options?: UseQueryOptions<GetAccrualBalancesResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.accrualBalances.get(params.calculationDate),\n queryFn: () => client.accrualBalances.getBalances(params),\n ...options,\n });\n}\n\n// Forms hooks\nexport function useTableColumns(\n client: OracleEBSClient,\n params: GetTableColumnsParams,\n options?: UseQueryOptions<GetTableColumnsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.forms.tableColumns(params.tableName),\n queryFn: () => client.forms.getTableColumns(params),\n ...options,\n });\n}\n\nexport function useDffSegments(\n client: OracleEBSClient,\n params: GetDffSegmentsParams,\n options?: UseQueryOptions<GetDffSegmentsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.forms.dffSegments(params),\n queryFn: () => client.forms.getDffSegments(params),\n ...options,\n });\n}\n\n// Health hooks\nexport function useHealthCheck(\n client: OracleEBSClient,\n options?: UseQueryOptions<HealthCheckResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.health.check,\n queryFn: () => client.health.check(),\n ...options,\n });\n}\n"]}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { useMutation, useQuery } from '@tanstack/react-query';
|
|
2
|
+
|
|
3
|
+
// src/hooks/index.ts
|
|
4
|
+
var queryKeys = {
|
|
5
|
+
auth: {
|
|
6
|
+
userContext: ["auth", "user-context"]
|
|
7
|
+
},
|
|
8
|
+
leaves: {
|
|
9
|
+
restrictedTypes: (params) => ["leaves", "restricted-types", params],
|
|
10
|
+
history: ["leaves", "history"]
|
|
11
|
+
},
|
|
12
|
+
sitRequests: {
|
|
13
|
+
segments: (params) => ["sit-requests", "segments", params],
|
|
14
|
+
history: ["sit-requests", "history"]
|
|
15
|
+
},
|
|
16
|
+
notifications: {
|
|
17
|
+
list: ["notifications", "list"],
|
|
18
|
+
details: (notificationId) => ["notifications", "details", notificationId]
|
|
19
|
+
},
|
|
20
|
+
payslip: {
|
|
21
|
+
header: (periodName) => ["payslip", "header", periodName],
|
|
22
|
+
details: (periodName) => ["payslip", "details", periodName]
|
|
23
|
+
},
|
|
24
|
+
employee: {
|
|
25
|
+
personalInfo: ["employee", "personal-info"],
|
|
26
|
+
hierarchy: ["employee", "hierarchy"]
|
|
27
|
+
},
|
|
28
|
+
accrualBalances: {
|
|
29
|
+
get: (calculationDate) => ["accrual-balances", calculationDate]
|
|
30
|
+
},
|
|
31
|
+
forms: {
|
|
32
|
+
tableColumns: (tableName) => ["forms", "table-columns", tableName],
|
|
33
|
+
dffSegments: (params) => ["forms", "dff-segments", params]
|
|
34
|
+
},
|
|
35
|
+
health: {
|
|
36
|
+
check: ["health", "check"]
|
|
37
|
+
}
|
|
38
|
+
};
|
|
39
|
+
function useLogin(client, options) {
|
|
40
|
+
return useMutation({
|
|
41
|
+
mutationFn: (credentials) => client.auth.login(credentials),
|
|
42
|
+
...options
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function useUserContext(client, options) {
|
|
46
|
+
return useQuery({
|
|
47
|
+
queryKey: queryKeys.auth.userContext,
|
|
48
|
+
queryFn: () => client.auth.getUserContext(),
|
|
49
|
+
...options
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
function useLeaveTypes(client, params, options) {
|
|
53
|
+
return useQuery({
|
|
54
|
+
queryKey: queryKeys.leaves.restrictedTypes(params),
|
|
55
|
+
queryFn: () => client.leaves.getRestrictedTypes(params),
|
|
56
|
+
...options
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
function useLeaveHistory(client, options) {
|
|
60
|
+
return useQuery({
|
|
61
|
+
queryKey: queryKeys.leaves.history,
|
|
62
|
+
queryFn: () => client.leaves.getHistory(),
|
|
63
|
+
...options
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
function useCreateLeaveRequest(client, options) {
|
|
67
|
+
return useMutation({
|
|
68
|
+
mutationFn: (input) => client.leaves.createRequest(input),
|
|
69
|
+
...options
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function useSitSegments(client, params, options) {
|
|
73
|
+
return useQuery({
|
|
74
|
+
queryKey: queryKeys.sitRequests.segments(params),
|
|
75
|
+
queryFn: () => client.sitRequests.getSegments(params),
|
|
76
|
+
...options
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
function useSaveAndPreviewSitRequest(client, options) {
|
|
80
|
+
return useMutation({
|
|
81
|
+
mutationFn: (input) => client.sitRequests.saveAndPreview(input),
|
|
82
|
+
...options
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
function useSubmitSitRequest(client, options) {
|
|
86
|
+
return useMutation({
|
|
87
|
+
mutationFn: (input) => client.sitRequests.submit(input),
|
|
88
|
+
...options
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
function useNotifications(client, options) {
|
|
92
|
+
return useQuery({
|
|
93
|
+
queryKey: queryKeys.notifications.list,
|
|
94
|
+
queryFn: () => client.notifications.getList(),
|
|
95
|
+
...options
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
function useNotificationDetails(client, params, options) {
|
|
99
|
+
return useQuery({
|
|
100
|
+
queryKey: queryKeys.notifications.details(params.notificationId),
|
|
101
|
+
queryFn: () => client.notifications.getDetails(params),
|
|
102
|
+
...options
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
function useProcessApproval(client, options) {
|
|
106
|
+
return useMutation({
|
|
107
|
+
mutationFn: (input) => client.notifications.processApproval(input),
|
|
108
|
+
...options
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
function usePayslipHeader(client, params, options) {
|
|
112
|
+
return useQuery({
|
|
113
|
+
queryKey: queryKeys.payslip.header(params.periodName),
|
|
114
|
+
queryFn: () => client.payslip.getHeader(params),
|
|
115
|
+
...options
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
function usePayslipDetails(client, params, options) {
|
|
119
|
+
return useQuery({
|
|
120
|
+
queryKey: queryKeys.payslip.details(params.periodName),
|
|
121
|
+
queryFn: () => client.payslip.getDetails(params),
|
|
122
|
+
...options
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
function usePersonalInfo(client, options) {
|
|
126
|
+
return useQuery({
|
|
127
|
+
queryKey: queryKeys.employee.personalInfo,
|
|
128
|
+
queryFn: () => client.employee.getPersonalInfo(),
|
|
129
|
+
...options
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function useEmployeeHierarchy(client, options) {
|
|
133
|
+
return useQuery({
|
|
134
|
+
queryKey: queryKeys.employee.hierarchy,
|
|
135
|
+
queryFn: () => client.employee.getHierarchy(),
|
|
136
|
+
...options
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
function useAccrualBalances(client, params, options) {
|
|
140
|
+
return useQuery({
|
|
141
|
+
queryKey: queryKeys.accrualBalances.get(params.calculationDate),
|
|
142
|
+
queryFn: () => client.accrualBalances.getBalances(params),
|
|
143
|
+
...options
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function useTableColumns(client, params, options) {
|
|
147
|
+
return useQuery({
|
|
148
|
+
queryKey: queryKeys.forms.tableColumns(params.tableName),
|
|
149
|
+
queryFn: () => client.forms.getTableColumns(params),
|
|
150
|
+
...options
|
|
151
|
+
});
|
|
152
|
+
}
|
|
153
|
+
function useDffSegments(client, params, options) {
|
|
154
|
+
return useQuery({
|
|
155
|
+
queryKey: queryKeys.forms.dffSegments(params),
|
|
156
|
+
queryFn: () => client.forms.getDffSegments(params),
|
|
157
|
+
...options
|
|
158
|
+
});
|
|
159
|
+
}
|
|
160
|
+
function useHealthCheck(client, options) {
|
|
161
|
+
return useQuery({
|
|
162
|
+
queryKey: queryKeys.health.check,
|
|
163
|
+
queryFn: () => client.health.check(),
|
|
164
|
+
...options
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
export { queryKeys, useAccrualBalances, useCreateLeaveRequest, useDffSegments, useEmployeeHierarchy, useHealthCheck, useLeaveHistory, useLeaveTypes, useLogin, useNotificationDetails, useNotifications, usePayslipDetails, usePayslipHeader, usePersonalInfo, useProcessApproval, useSaveAndPreviewSitRequest, useSitSegments, useSubmitSitRequest, useTableColumns, useUserContext };
|
|
169
|
+
//# sourceMappingURL=index.mjs.map
|
|
170
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/index.ts"],"names":[],"mappings":";;;AA6CO,IAAM,SAAA,GAAY;AAAA,EACrB,IAAA,EAAM;AAAA,IACF,WAAA,EAAa,CAAC,MAAA,EAAQ,cAAc;AAAA,GACxC;AAAA,EACA,MAAA,EAAQ;AAAA,IACJ,iBAAiB,CAAC,MAAA,KAAmC,CAAC,QAAA,EAAU,oBAAoB,MAAM,CAAA;AAAA,IAC1F,OAAA,EA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AAA,IACvD,OAAA,EAAS,MAAM,MAAA,CAAO,KAAA,CAAM,gBAAgB,MAAM,CAAA;AAAA,IAClD,GAAG;AAAA,GACN,CAAA;AACL;AAEO,SAAS,cAAA,CACZ,MAAA,EACA,MAAA,EACA,OAAA,EACF;AACE,EAAA,OAAO,QAAA,CAAS;AAAA,IACZ,QAAA,EAAU,SAAA,CAAU,KAAA,CAAM,WAAA,CAAY,MAAM,CAAA;AAAA,IAC5C,OAAA,EAAS,MAAM,MAAA,CAAO,KAAA,CAAM,eAAe,MAAM,CAAA;AAAA,IACjD,GAAG;AAAA,GACN,CAAA;AACL;AAGO,SAAS,cAAA,CACZ,QACA,OAAA,EACF;AACE,EAAA,OAAO,QAAA,CAAS;AAAA,IACZ,QAAA,EAAU,UAAU,MAAA,CAAO,KAAA;AAAA,IAC3B,OAAA,EAAS,MAAM,MAAA,CAAO,MAAA,CAAO,KAAA,EAAM;AAAA,IACnC,GAAG;AAAA,GACN,CAAA;AACL","file":"index.mjs","sourcesContent":["/**\n * React Query hooks for Oracle EBS SDK\n * \n * @requires @tanstack/react-query\n * @requires react\n */\n\nimport { useQuery, useMutation, type UseQueryOptions, type UseMutationOptions } from '@tanstack/react-query';\nimport type { OracleEBSClient } from '../client/OracleEBSClient';\nimport type {\n LoginCredentials,\n LoginResponse,\n UserContext,\n GetAbsenceTypesParams,\n GetAbsenceTypesResponse,\n GetLeaveHistoryResponse,\n CreateLeaveRequestInput,\n CreateLeaveRequestResponse,\n GetSitSegmentsParams,\n GetSitSegmentsResponse,\n SaveAndPreviewSitRequestInput,\n SaveAndPreviewSitRequestResponse,\n SubmitSitRequestInput,\n SubmitSitRequestResponse,\n GetNotificationsResponse,\n GetNotificationDetailsParams,\n NotificationDetails,\n ProcessApprovalInput,\n ProcessApprovalResponse,\n GetPayslipHeaderParams,\n PayslipHeader,\n GetPayslipDetailsParams,\n GetPayslipDetailsResponse,\n PersonalInformation,\n GetEmployeeHierarchyResponse,\n GetAccrualBalancesParams,\n GetAccrualBalancesResponse,\n GetTableColumnsParams,\n GetTableColumnsResponse,\n GetDffSegmentsParams,\n GetDffSegmentsResponse,\n HealthCheckResponse,\n} from '../index';\n\n// Query keys\nexport const queryKeys = {\n auth: {\n userContext: ['auth', 'user-context'] as const,\n },\n leaves: {\n restrictedTypes: (params?: GetAbsenceTypesParams) => ['leaves', 'restricted-types', params] as const,\n history: ['leaves', 'history'] as const,\n },\n sitRequests: {\n segments: (params: GetSitSegmentsParams) => ['sit-requests', 'segments', params] as const,\n history: ['sit-requests', 'history'] as const,\n },\n notifications: {\n list: ['notifications', 'list'] as const,\n details: (notificationId: string) => ['notifications', 'details', notificationId] as const,\n },\n payslip: {\n header: (periodName: string) => ['payslip', 'header', periodName] as const,\n details: (periodName: string) => ['payslip', 'details', periodName] as const,\n },\n employee: {\n personalInfo: ['employee', 'personal-info'] as const,\n hierarchy: ['employee', 'hierarchy'] as const,\n },\n accrualBalances: {\n get: (calculationDate: string) => ['accrual-balances', calculationDate] as const,\n },\n forms: {\n tableColumns: (tableName: string) => ['forms', 'table-columns', tableName] as const,\n dffSegments: (params: GetDffSegmentsParams) => ['forms', 'dff-segments', params] as const,\n },\n health: {\n check: ['health', 'check'] as const,\n },\n};\n\n// Auth hooks\nexport function useLogin(\n client: OracleEBSClient,\n options?: UseMutationOptions<LoginResponse, Error, LoginCredentials>\n) {\n return useMutation({\n mutationFn: (credentials) => client.auth.login(credentials),\n ...options,\n });\n}\n\nexport function useUserContext(\n client: OracleEBSClient,\n options?: UseQueryOptions<UserContext, Error>\n) {\n return useQuery({\n queryKey: queryKeys.auth.userContext,\n queryFn: () => client.auth.getUserContext(),\n ...options,\n });\n}\n\n// Leaves hooks\nexport function useLeaveTypes(\n client: OracleEBSClient,\n params?: GetAbsenceTypesParams,\n options?: UseQueryOptions<GetAbsenceTypesResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.leaves.restrictedTypes(params),\n queryFn: () => client.leaves.getRestrictedTypes(params),\n ...options,\n });\n}\n\nexport function useLeaveHistory(\n client: OracleEBSClient,\n options?: UseQueryOptions<GetLeaveHistoryResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.leaves.history,\n queryFn: () => client.leaves.getHistory(),\n ...options,\n });\n}\n\nexport function useCreateLeaveRequest(\n client: OracleEBSClient,\n options?: UseMutationOptions<CreateLeaveRequestResponse, Error, CreateLeaveRequestInput>\n) {\n return useMutation({\n mutationFn: (input) => client.leaves.createRequest(input),\n ...options,\n });\n}\n\n// SIT Requests hooks\nexport function useSitSegments(\n client: OracleEBSClient,\n params: GetSitSegmentsParams,\n options?: UseQueryOptions<GetSitSegmentsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.sitRequests.segments(params),\n queryFn: () => client.sitRequests.getSegments(params),\n ...options,\n });\n}\n\nexport function useSaveAndPreviewSitRequest(\n client: OracleEBSClient,\n options?: UseMutationOptions<SaveAndPreviewSitRequestResponse, Error, SaveAndPreviewSitRequestInput>\n) {\n return useMutation({\n mutationFn: (input) => client.sitRequests.saveAndPreview(input),\n ...options,\n });\n}\n\nexport function useSubmitSitRequest(\n client: OracleEBSClient,\n options?: UseMutationOptions<SubmitSitRequestResponse, Error, SubmitSitRequestInput>\n) {\n return useMutation({\n mutationFn: (input) => client.sitRequests.submit(input),\n ...options,\n });\n}\n\n// Notifications hooks\nexport function useNotifications(\n client: OracleEBSClient,\n options?: UseQueryOptions<GetNotificationsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.notifications.list,\n queryFn: () => client.notifications.getList(),\n ...options,\n });\n}\n\nexport function useNotificationDetails(\n client: OracleEBSClient,\n params: GetNotificationDetailsParams,\n options?: UseQueryOptions<NotificationDetails, Error>\n) {\n return useQuery({\n queryKey: queryKeys.notifications.details(params.notificationId),\n queryFn: () => client.notifications.getDetails(params),\n ...options,\n });\n}\n\nexport function useProcessApproval(\n client: OracleEBSClient,\n options?: UseMutationOptions<ProcessApprovalResponse, Error, ProcessApprovalInput>\n) {\n return useMutation({\n mutationFn: (input) => client.notifications.processApproval(input),\n ...options,\n });\n}\n\n// Payslip hooks\nexport function usePayslipHeader(\n client: OracleEBSClient,\n params: GetPayslipHeaderParams,\n options?: UseQueryOptions<PayslipHeader, Error>\n) {\n return useQuery({\n queryKey: queryKeys.payslip.header(params.periodName),\n queryFn: () => client.payslip.getHeader(params),\n ...options,\n });\n}\n\nexport function usePayslipDetails(\n client: OracleEBSClient,\n params: GetPayslipDetailsParams,\n options?: UseQueryOptions<GetPayslipDetailsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.payslip.details(params.periodName),\n queryFn: () => client.payslip.getDetails(params),\n ...options,\n });\n}\n\n// Employee hooks\nexport function usePersonalInfo(\n client: OracleEBSClient,\n options?: UseQueryOptions<PersonalInformation, Error>\n) {\n return useQuery({\n queryKey: queryKeys.employee.personalInfo,\n queryFn: () => client.employee.getPersonalInfo(),\n ...options,\n });\n}\n\nexport function useEmployeeHierarchy(\n client: OracleEBSClient,\n options?: UseQueryOptions<GetEmployeeHierarchyResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.employee.hierarchy,\n queryFn: () => client.employee.getHierarchy(),\n ...options,\n });\n}\n\n// Accrual Balances hooks\nexport function useAccrualBalances(\n client: OracleEBSClient,\n params: GetAccrualBalancesParams,\n options?: UseQueryOptions<GetAccrualBalancesResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.accrualBalances.get(params.calculationDate),\n queryFn: () => client.accrualBalances.getBalances(params),\n ...options,\n });\n}\n\n// Forms hooks\nexport function useTableColumns(\n client: OracleEBSClient,\n params: GetTableColumnsParams,\n options?: UseQueryOptions<GetTableColumnsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.forms.tableColumns(params.tableName),\n queryFn: () => client.forms.getTableColumns(params),\n ...options,\n });\n}\n\nexport function useDffSegments(\n client: OracleEBSClient,\n params: GetDffSegmentsParams,\n options?: UseQueryOptions<GetDffSegmentsResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.forms.dffSegments(params),\n queryFn: () => client.forms.getDffSegments(params),\n ...options,\n });\n}\n\n// Health hooks\nexport function useHealthCheck(\n client: OracleEBSClient,\n options?: UseQueryOptions<HealthCheckResponse, Error>\n) {\n return useQuery({\n queryKey: queryKeys.health.check,\n queryFn: () => client.health.check(),\n ...options,\n });\n}\n"]}
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { A as APIResponse, d as AbsenceType, X as AccrualBalance, C as CacheOptions, w as CloseFyiParams, x as CloseFyiResponse, h as CreateLeaveRequestInput, i as CreateLeaveRequestResponse, M as DffSegment, H as EmployeeHierarchyNode, G as GetAbsenceTypesParams, e as GetAbsenceTypesResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, Q as GetDffSegmentsParams, V as GetDffSegmentsResponse, I as GetEmployeeHierarchyResponse, g as GetLeaveHistoryResponse, u as GetNotificationDetailsParams, s as GetNotificationsResponse, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, y as GetPayslipHeaderParams, p as GetSitHistoryParams, r as GetSitHistoryResponse, j as GetSitSegmentsParams, k as GetSitSegmentsResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, W as HealthCheckResponse, f as LeaveHistoryRecord, L as LoginCredentials, b as LoginResponse, N as Notification, t as NotificationDetails, O as OracleEBSClient, a as OracleEBSConfig, D as PayslipDetail, z as PayslipHeader, F as PersonalInformation, P as ProcessApprovalInput, v as ProcessApprovalResponse, c as Responsibility, R as RetryOptions, l as SaveAndPreviewSitRequestInput, m as SaveAndPreviewSitRequestResponse, q as SitHistoryRecord, S as SitSegment, n as SubmitSitRequestInput, o as SubmitSitRequestResponse, T as TableColumn, U as UserContext } from './OracleEBSClient-C7P6gYW3.mjs';
|
|
2
|
+
import 'ky';
|
|
3
|
+
|
|
4
|
+
declare class APIError extends Error {
|
|
5
|
+
readonly statusCode: number;
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly details?: any;
|
|
8
|
+
constructor(message: string, statusCode: number, code: string, details?: any);
|
|
9
|
+
}
|
|
10
|
+
declare class ValidationError extends APIError {
|
|
11
|
+
readonly fields?: Record<string, string[]>;
|
|
12
|
+
constructor(message: string, fields?: Record<string, string[]>, details?: any);
|
|
13
|
+
}
|
|
14
|
+
declare class UnauthorizedError extends APIError {
|
|
15
|
+
constructor(message?: string, details?: any);
|
|
16
|
+
}
|
|
17
|
+
declare class ForbiddenError extends APIError {
|
|
18
|
+
constructor(message?: string, details?: any);
|
|
19
|
+
}
|
|
20
|
+
declare class NotFoundError extends APIError {
|
|
21
|
+
constructor(message?: string, details?: any);
|
|
22
|
+
}
|
|
23
|
+
declare class NetworkError extends APIError {
|
|
24
|
+
constructor(message?: string, details?: any);
|
|
25
|
+
}
|
|
26
|
+
declare class TimeoutError extends APIError {
|
|
27
|
+
constructor(message?: string, details?: any);
|
|
28
|
+
}
|
|
29
|
+
declare class ServerError extends APIError {
|
|
30
|
+
constructor(message?: string, statusCode?: number, details?: any);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { APIError, ForbiddenError, NetworkError, NotFoundError, ServerError, TimeoutError, UnauthorizedError, ValidationError };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
export { A as APIResponse, d as AbsenceType, X as AccrualBalance, C as CacheOptions, w as CloseFyiParams, x as CloseFyiResponse, h as CreateLeaveRequestInput, i as CreateLeaveRequestResponse, M as DffSegment, H as EmployeeHierarchyNode, G as GetAbsenceTypesParams, e as GetAbsenceTypesResponse, Y as GetAccrualBalancesParams, Z as GetAccrualBalancesResponse, Q as GetDffSegmentsParams, V as GetDffSegmentsResponse, I as GetEmployeeHierarchyResponse, g as GetLeaveHistoryResponse, u as GetNotificationDetailsParams, s as GetNotificationsResponse, B as GetPayslipDetailsParams, E as GetPayslipDetailsResponse, y as GetPayslipHeaderParams, p as GetSitHistoryParams, r as GetSitHistoryResponse, j as GetSitSegmentsParams, k as GetSitSegmentsResponse, J as GetTableColumnsParams, K as GetTableColumnsResponse, W as HealthCheckResponse, f as LeaveHistoryRecord, L as LoginCredentials, b as LoginResponse, N as Notification, t as NotificationDetails, O as OracleEBSClient, a as OracleEBSConfig, D as PayslipDetail, z as PayslipHeader, F as PersonalInformation, P as ProcessApprovalInput, v as ProcessApprovalResponse, c as Responsibility, R as RetryOptions, l as SaveAndPreviewSitRequestInput, m as SaveAndPreviewSitRequestResponse, q as SitHistoryRecord, S as SitSegment, n as SubmitSitRequestInput, o as SubmitSitRequestResponse, T as TableColumn, U as UserContext } from './OracleEBSClient-C7P6gYW3.js';
|
|
2
|
+
import 'ky';
|
|
3
|
+
|
|
4
|
+
declare class APIError extends Error {
|
|
5
|
+
readonly statusCode: number;
|
|
6
|
+
readonly code: string;
|
|
7
|
+
readonly details?: any;
|
|
8
|
+
constructor(message: string, statusCode: number, code: string, details?: any);
|
|
9
|
+
}
|
|
10
|
+
declare class ValidationError extends APIError {
|
|
11
|
+
readonly fields?: Record<string, string[]>;
|
|
12
|
+
constructor(message: string, fields?: Record<string, string[]>, details?: any);
|
|
13
|
+
}
|
|
14
|
+
declare class UnauthorizedError extends APIError {
|
|
15
|
+
constructor(message?: string, details?: any);
|
|
16
|
+
}
|
|
17
|
+
declare class ForbiddenError extends APIError {
|
|
18
|
+
constructor(message?: string, details?: any);
|
|
19
|
+
}
|
|
20
|
+
declare class NotFoundError extends APIError {
|
|
21
|
+
constructor(message?: string, details?: any);
|
|
22
|
+
}
|
|
23
|
+
declare class NetworkError extends APIError {
|
|
24
|
+
constructor(message?: string, details?: any);
|
|
25
|
+
}
|
|
26
|
+
declare class TimeoutError extends APIError {
|
|
27
|
+
constructor(message?: string, details?: any);
|
|
28
|
+
}
|
|
29
|
+
declare class ServerError extends APIError {
|
|
30
|
+
constructor(message?: string, statusCode?: number, details?: any);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
export { APIError, ForbiddenError, NetworkError, NotFoundError, ServerError, TimeoutError, UnauthorizedError, ValidationError };
|