@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.
@@ -0,0 +1,420 @@
1
+ import { KyInstance, Options } from 'ky';
2
+
3
+ interface OracleEBSConfig {
4
+ baseUrl: string;
5
+ token?: string;
6
+ timeout?: number;
7
+ retries?: number;
8
+ retryDelay?: number;
9
+ cache?: {
10
+ enabled?: boolean;
11
+ ttl?: number;
12
+ };
13
+ logging?: {
14
+ enabled?: boolean;
15
+ level?: 'debug' | 'info' | 'warn' | 'error';
16
+ };
17
+ onError?: (error: Error) => void;
18
+ onRequest?: (request: Request) => Request | Promise<Request>;
19
+ onResponse?: (response: Response) => Response | Promise<Response>;
20
+ }
21
+
22
+ interface APIResponse<T = any> {
23
+ success: boolean;
24
+ data?: T;
25
+ error?: {
26
+ code: string;
27
+ message: string;
28
+ details?: any;
29
+ };
30
+ meta?: {
31
+ timestamp: string;
32
+ requestId: string;
33
+ version: string;
34
+ };
35
+ }
36
+ interface CacheOptions {
37
+ enabled?: boolean;
38
+ ttl?: number;
39
+ key?: string;
40
+ }
41
+ interface RetryOptions {
42
+ enabled?: boolean;
43
+ maxRetries?: number;
44
+ retryDelay?: number;
45
+ retryOn?: number[];
46
+ }
47
+
48
+ declare class BaseClient {
49
+ protected client: KyInstance;
50
+ protected config: OracleEBSConfig;
51
+ protected token?: string;
52
+ constructor(config: OracleEBSConfig);
53
+ setToken(token: string): void;
54
+ clearToken(): void;
55
+ protected get<T>(url: string, options?: Options): Promise<APIResponse<T>>;
56
+ protected post<T>(url: string, data?: any, options?: Options): Promise<APIResponse<T>>;
57
+ protected put<T>(url: string, data?: any, options?: Options): Promise<APIResponse<T>>;
58
+ protected delete<T>(url: string, options?: Options): Promise<APIResponse<T>>;
59
+ protected handleError(error: any): Error;
60
+ protected log(level: 'debug' | 'info' | 'warn' | 'error', ...args: any[]): void;
61
+ }
62
+
63
+ interface LoginCredentials {
64
+ username: string;
65
+ password: string;
66
+ }
67
+ interface LoginResponse {
68
+ access_token: string;
69
+ token_type: string;
70
+ user: {
71
+ userName: string;
72
+ ebsVersion: string;
73
+ USER_ID?: string;
74
+ PERSON_ID?: string;
75
+ EMPLOYEE_NUMBER?: string;
76
+ responsibilities?: Responsibility[];
77
+ };
78
+ }
79
+ interface Responsibility {
80
+ responsibilityId: string;
81
+ responsibilityKey: string;
82
+ responsibilityName: string;
83
+ applicationShortName: string;
84
+ }
85
+ interface UserContext {
86
+ userId: string;
87
+ employeeNumber: string;
88
+ personId: string;
89
+ fullName: string;
90
+ assignmentId: string;
91
+ assignmentNumber: string;
92
+ }
93
+
94
+ declare class AuthModule extends BaseClient {
95
+ login(credentials: LoginCredentials): Promise<LoginResponse>;
96
+ logout(): Promise<void>;
97
+ getUserContext(): Promise<UserContext>;
98
+ }
99
+
100
+ interface AbsenceType {
101
+ absenceAttendanceTypeId: string;
102
+ name: string;
103
+ absenceCategory: string;
104
+ enabled?: boolean;
105
+ }
106
+ interface GetAbsenceTypesParams {
107
+ effectiveDate?: string;
108
+ }
109
+ interface GetAbsenceTypesResponse {
110
+ absenceTypes: AbsenceType[];
111
+ }
112
+ interface LeaveHistoryRecord {
113
+ sortKeyDate: string;
114
+ requestDate: string;
115
+ leaveTypeName: string;
116
+ startDate: string;
117
+ endDate: string;
118
+ days: number;
119
+ hours: number | null;
120
+ requestStatus: string;
121
+ currentApprover: string | null;
122
+ notificationSentDate: string | null;
123
+ transactionId: string | null;
124
+ }
125
+ interface GetLeaveHistoryResponse {
126
+ leaveHistory: LeaveHistoryRecord[];
127
+ employeeNumber: string;
128
+ }
129
+ interface CreateLeaveRequestInput {
130
+ absenceTypeId: string;
131
+ absenceReasonId?: string;
132
+ startDate: string;
133
+ endDate: string;
134
+ days: number;
135
+ comments?: string;
136
+ activityId?: string;
137
+ dffFields?: Record<string, string>;
138
+ }
139
+ interface CreateLeaveRequestResponse {
140
+ message: string;
141
+ transactionId: string;
142
+ itemKey: string;
143
+ }
144
+
145
+ declare class LeavesModule extends BaseClient {
146
+ getRestrictedTypes(params?: GetAbsenceTypesParams): Promise<GetAbsenceTypesResponse>;
147
+ getHistory(): Promise<GetLeaveHistoryResponse>;
148
+ createRequest(input: CreateLeaveRequestInput): Promise<CreateLeaveRequestResponse>;
149
+ }
150
+
151
+ interface SitSegment {
152
+ segmentName: string;
153
+ segmentValue: string;
154
+ displayValue?: string;
155
+ }
156
+ interface GetSitSegmentsParams {
157
+ idFlexNum: string;
158
+ }
159
+ interface GetSitSegmentsResponse {
160
+ segments: SitSegment[];
161
+ }
162
+ interface SaveAndPreviewSitRequestInput {
163
+ itemType: string;
164
+ responsibilityName: string;
165
+ calledFrom: string;
166
+ process: string;
167
+ sitName: string;
168
+ activityId: string;
169
+ ameTranType: string;
170
+ segments: Record<string, string>;
171
+ }
172
+ interface SaveAndPreviewSitRequestResponse {
173
+ status: string;
174
+ message: string;
175
+ activityId: string;
176
+ transactionId?: string;
177
+ itemKey?: string;
178
+ }
179
+ interface SubmitSitRequestInput {
180
+ itemType: string;
181
+ itemKey: string;
182
+ transactionId: string;
183
+ activityId: string;
184
+ nid?: string | null;
185
+ aname?: string | null;
186
+ }
187
+ interface SubmitSitRequestResponse {
188
+ status: string;
189
+ message: string;
190
+ transactionId: string;
191
+ itemKey: string;
192
+ }
193
+ interface GetSitHistoryParams {
194
+ startDate?: string;
195
+ endDate?: string;
196
+ }
197
+ interface SitHistoryRecord {
198
+ transactionId: string;
199
+ sitName: string;
200
+ requestDate: string;
201
+ status: string;
202
+ approver?: string;
203
+ }
204
+ interface GetSitHistoryResponse {
205
+ history: SitHistoryRecord[];
206
+ }
207
+
208
+ declare class SitRequestsModule extends BaseClient {
209
+ getSegments(params: GetSitSegmentsParams): Promise<GetSitSegmentsResponse>;
210
+ saveAndPreview(input: SaveAndPreviewSitRequestInput): Promise<SaveAndPreviewSitRequestResponse>;
211
+ submit(input: SubmitSitRequestInput): Promise<SubmitSitRequestResponse>;
212
+ getHistory(params?: GetSitHistoryParams): Promise<GetSitHistoryResponse>;
213
+ }
214
+
215
+ interface Notification {
216
+ notificationId: string;
217
+ subject: string;
218
+ status: string;
219
+ createdDate: string;
220
+ itemKey?: string;
221
+ analysisCriteriaId?: string;
222
+ }
223
+ interface GetNotificationsResponse {
224
+ notifications: Notification[];
225
+ }
226
+ interface NotificationDetails {
227
+ notificationId: string;
228
+ title: string;
229
+ description: string;
230
+ status: string;
231
+ createdDate: string;
232
+ dueDate?: string;
233
+ priority?: string;
234
+ }
235
+ interface GetNotificationDetailsParams {
236
+ notificationId: string;
237
+ }
238
+ interface ProcessApprovalInput {
239
+ notificationId: string;
240
+ action: 'APPROVE' | 'REJECT';
241
+ comments?: string;
242
+ }
243
+ interface ProcessApprovalResponse {
244
+ status: string;
245
+ message: string;
246
+ }
247
+ interface CloseFyiParams {
248
+ notificationId: string;
249
+ }
250
+ interface CloseFyiResponse {
251
+ status: string;
252
+ message: string;
253
+ }
254
+
255
+ declare class NotificationsModule extends BaseClient {
256
+ getList(): Promise<GetNotificationsResponse>;
257
+ getDetails(params: GetNotificationDetailsParams): Promise<NotificationDetails>;
258
+ processApproval(input: ProcessApprovalInput): Promise<ProcessApprovalResponse>;
259
+ closeFyi(params: CloseFyiParams): Promise<CloseFyiResponse>;
260
+ }
261
+
262
+ interface GetPayslipHeaderParams {
263
+ periodName: string;
264
+ }
265
+ interface PayslipHeader {
266
+ employeeNumber: string;
267
+ periodName: string;
268
+ employeeName: string;
269
+ jobName: string;
270
+ organizationName: string;
271
+ locationName: string;
272
+ periodStartDate: string;
273
+ periodEndDate: string;
274
+ payDate: string;
275
+ basicSalary: string;
276
+ allowances: string;
277
+ deductions: string;
278
+ netSalary: string;
279
+ currencyCode: string;
280
+ }
281
+ interface GetPayslipDetailsParams {
282
+ periodName: string;
283
+ }
284
+ interface PayslipDetail {
285
+ employeeNumber: string;
286
+ periodName: string;
287
+ elementName: string;
288
+ amount: string;
289
+ elementType: string;
290
+ currencyCode: string;
291
+ }
292
+ interface GetPayslipDetailsResponse {
293
+ details: PayslipDetail[];
294
+ }
295
+
296
+ declare class PayslipModule extends BaseClient {
297
+ getHeader(params: GetPayslipHeaderParams): Promise<PayslipHeader>;
298
+ getDetails(params: GetPayslipDetailsParams): Promise<GetPayslipDetailsResponse>;
299
+ }
300
+
301
+ interface PersonalInformation {
302
+ userId: string;
303
+ employeeNumber: string;
304
+ employeeName: string;
305
+ emailAddress: string;
306
+ jobName: string;
307
+ departmentName: string;
308
+ locationName: string;
309
+ }
310
+ interface EmployeeHierarchyNode {
311
+ personId: string;
312
+ employeeNumber: string;
313
+ fullName: string;
314
+ jobName: string;
315
+ level: number;
316
+ }
317
+ interface GetEmployeeHierarchyResponse {
318
+ hierarchy: EmployeeHierarchyNode[];
319
+ }
320
+
321
+ declare class EmployeeModule extends BaseClient {
322
+ getPersonalInfo(): Promise<PersonalInformation>;
323
+ getHierarchy(): Promise<GetEmployeeHierarchyResponse>;
324
+ }
325
+
326
+ interface AccrualBalance {
327
+ assignmentId: string;
328
+ calculationDate: string;
329
+ accrualPlanName: string;
330
+ balance: string;
331
+ unit: string;
332
+ asOfDate: string;
333
+ }
334
+ interface GetAccrualBalancesParams {
335
+ calculationDate: string;
336
+ }
337
+ interface GetAccrualBalancesResponse {
338
+ balances: AccrualBalance[];
339
+ }
340
+
341
+ declare class AccrualBalancesModule extends BaseClient {
342
+ getBalances(params: GetAccrualBalancesParams): Promise<GetAccrualBalancesResponse>;
343
+ }
344
+
345
+ interface TableColumn {
346
+ columnName: string;
347
+ dataType: string;
348
+ displayName: string;
349
+ required: boolean;
350
+ maxLength?: number;
351
+ }
352
+ interface GetTableColumnsParams {
353
+ tableName: string;
354
+ }
355
+ interface GetTableColumnsResponse {
356
+ columns: TableColumn[];
357
+ }
358
+ interface DffSegment {
359
+ segmentName: string;
360
+ displayName: string;
361
+ dataType: string;
362
+ required: boolean;
363
+ enabled: boolean;
364
+ valueSet?: string;
365
+ maxLength?: number;
366
+ }
367
+ interface GetDffSegmentsParams {
368
+ applicationId: string;
369
+ flexfieldName: string;
370
+ }
371
+ interface GetDffSegmentsResponse {
372
+ segments: DffSegment[];
373
+ }
374
+
375
+ declare class FormsModule extends BaseClient {
376
+ getTableColumns(params: GetTableColumnsParams): Promise<GetTableColumnsResponse>;
377
+ getDffSegments(params: GetDffSegmentsParams): Promise<GetDffSegmentsResponse>;
378
+ }
379
+
380
+ interface HealthCheckResponse {
381
+ status: 'healthy' | 'degraded' | 'unhealthy';
382
+ timestamp: string;
383
+ uptime: number;
384
+ version: string;
385
+ services: {
386
+ nestjs: {
387
+ status: 'up';
388
+ message: string;
389
+ };
390
+ oracleEbs: {
391
+ status: 'up' | 'down' | 'unreachable';
392
+ message: string;
393
+ url?: string;
394
+ responseTime?: number;
395
+ error?: string;
396
+ };
397
+ };
398
+ }
399
+
400
+ declare class HealthModule extends BaseClient {
401
+ check(): Promise<HealthCheckResponse>;
402
+ ping(): Promise<string>;
403
+ }
404
+
405
+ declare class OracleEBSClient {
406
+ readonly auth: AuthModule;
407
+ readonly leaves: LeavesModule;
408
+ readonly sitRequests: SitRequestsModule;
409
+ readonly notifications: NotificationsModule;
410
+ readonly payslip: PayslipModule;
411
+ readonly employee: EmployeeModule;
412
+ readonly accrualBalances: AccrualBalancesModule;
413
+ readonly forms: FormsModule;
414
+ readonly health: HealthModule;
415
+ constructor(config: OracleEBSConfig);
416
+ setToken(token: string): void;
417
+ clearToken(): void;
418
+ }
419
+
420
+ export { type APIResponse as A, type GetPayslipDetailsParams as B, type CacheOptions as C, type PayslipDetail as D, type GetPayslipDetailsResponse as E, type PersonalInformation as F, type GetAbsenceTypesParams as G, type EmployeeHierarchyNode as H, type GetEmployeeHierarchyResponse as I, type GetTableColumnsParams as J, type GetTableColumnsResponse as K, type LoginCredentials as L, type DffSegment as M, type Notification as N, OracleEBSClient as O, type ProcessApprovalInput as P, type GetDffSegmentsParams as Q, type RetryOptions as R, type SitSegment as S, type TableColumn as T, type UserContext as U, type GetDffSegmentsResponse as V, type HealthCheckResponse as W, type AccrualBalance as X, type GetAccrualBalancesParams as Y, type GetAccrualBalancesResponse as Z, type OracleEBSConfig as a, type LoginResponse as b, type Responsibility as c, type AbsenceType as d, type GetAbsenceTypesResponse as e, type LeaveHistoryRecord as f, type GetLeaveHistoryResponse as g, type CreateLeaveRequestInput as h, type CreateLeaveRequestResponse as i, type GetSitSegmentsParams as j, type GetSitSegmentsResponse as k, type SaveAndPreviewSitRequestInput as l, type SaveAndPreviewSitRequestResponse as m, type SubmitSitRequestInput as n, type SubmitSitRequestResponse as o, type GetSitHistoryParams as p, type SitHistoryRecord as q, type GetSitHistoryResponse as r, type GetNotificationsResponse as s, type NotificationDetails as t, type GetNotificationDetailsParams as u, type ProcessApprovalResponse as v, type CloseFyiParams as w, type CloseFyiResponse as x, type GetPayslipHeaderParams as y, type PayslipHeader as z };