@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 ADDED
@@ -0,0 +1,17 @@
1
+ PROPRIETARY LICENSE
2
+
3
+ Copyright (c) 2026 SmartSides Development Team
4
+
5
+ All rights reserved.
6
+
7
+ This software and associated documentation files (the "Software") are the proprietary
8
+ property of SmartSides Development Team. The Software is confidential and may not be
9
+ copied, distributed, or disclosed to third parties without express written permission
10
+ from SmartSides Development Team.
11
+
12
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
13
+ INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
14
+ PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
15
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
16
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
17
+ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,314 @@
1
+ # @smartsides/oracle-ebs-sdk
2
+
3
+ TypeScript SDK for Oracle EBS API - Optimized for Next.js 15+
4
+
5
+ ## Features
6
+
7
+ - ✅ **Full TypeScript Support** - Complete type safety with autocomplete
8
+ - ✅ **All API Endpoints** - 9 modules covering all Oracle EBS functionality
9
+ - ✅ **Error Handling** - Typed errors with automatic retry logic
10
+ - ✅ **React Query Integration** - Built-in hooks for Next.js
11
+ - ✅ **Server Components** - Optimized for Next.js App Router
12
+ - ✅ **Logging & Monitoring** - Configurable logging system
13
+ - ✅ **Caching** - Built-in request caching
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ npm install @smartsides/oracle-ebs-sdk
19
+ # or
20
+ yarn add @smartsides/oracle-ebs-sdk
21
+ # or
22
+ pnpm add @smartsides/oracle-ebs-sdk
23
+ ```
24
+
25
+ ## Quick Start
26
+
27
+ ### Basic Usage
28
+
29
+ ```typescript
30
+ import { OracleEBSClient } from '@smartsides/oracle-ebs-sdk';
31
+
32
+ const client = new OracleEBSClient({
33
+ baseUrl: 'http://localhost:3000/api/v1',
34
+ logging: { enabled: true },
35
+ });
36
+
37
+ // Login
38
+ const { access_token } = await client.auth.login({
39
+ username: 'your-username',
40
+ password: 'your-password',
41
+ });
42
+
43
+ // Get leave types
44
+ const types = await client.leaves.getRestrictedTypes();
45
+
46
+ // Create leave request
47
+ const request = await client.leaves.createRequest({
48
+ absenceTypeId: '71',
49
+ startDate: '2026-01-20',
50
+ endDate: '2026-01-22',
51
+ days: 3,
52
+ comments: 'Family vacation',
53
+ });
54
+ ```
55
+
56
+ ### Next.js App Router (Client Component)
57
+
58
+ ```typescript
59
+ 'use client';
60
+
61
+ import { OracleEBSClient } from '@smartsides/oracle-ebs-sdk';
62
+ import { useLeaveTypes } from '@smartsides/oracle-ebs-sdk/hooks';
63
+ import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
64
+
65
+ const client = new OracleEBSClient({
66
+ baseUrl: process.env.NEXT_PUBLIC_API_URL!,
67
+ });
68
+
69
+ const queryClient = new QueryClient();
70
+
71
+ export default function LeavesPage() {
72
+ return (
73
+ <QueryClientProvider client={queryClient}>
74
+ <LeavesList />
75
+ </QueryClientProvider>
76
+ );
77
+ }
78
+
79
+ function LeavesList() {
80
+ const { data, isLoading, error } = useLeaveTypes(client);
81
+
82
+ if (isLoading) return <div>Loading...</div>;
83
+ if (error) return <div>Error: {error.message}</div>;
84
+
85
+ return (
86
+ <ul>
87
+ {data?.absenceTypes.map((type) => (
88
+ <li key={type.absenceAttendanceTypeId}>{type.name}</li>
89
+ ))}
90
+ </ul>
91
+ );
92
+ }
93
+ ```
94
+
95
+ ### Next.js Server Components
96
+
97
+ ```typescript
98
+ import { createServerClient } from '@smartsides/oracle-ebs-sdk/server';
99
+
100
+ export default async function Page() {
101
+ const client = createServerClient({
102
+ baseUrl: process.env.API_URL!,
103
+ token: process.env.API_TOKEN,
104
+ });
105
+
106
+ const leaves = await client.leaves.getHistory();
107
+
108
+ return (
109
+ <div>
110
+ <h1>Leave History</h1>
111
+ {leaves.leaveHistory.map((leave) => (
112
+ <div key={leave.transactionId}>
113
+ {leave.leaveTypeName}: {leave.startDate} - {leave.endDate}
114
+ </div>
115
+ ))}
116
+ </div>
117
+ );
118
+ }
119
+ ```
120
+
121
+ ## API Modules
122
+
123
+ ### Authentication
124
+
125
+ ```typescript
126
+ // Login
127
+ await client.auth.login({ username, password });
128
+
129
+ // Get user context
130
+ const user = await client.auth.getUserContext();
131
+
132
+ // Logout
133
+ await client.auth.logout();
134
+ ```
135
+
136
+ ### Leaves & Absences
137
+
138
+ ```typescript
139
+ // Get absence types
140
+ const types = await client.leaves.getRestrictedTypes();
141
+
142
+ // Get leave history
143
+ const history = await client.leaves.getHistory();
144
+
145
+ // Create leave request
146
+ const request = await client.leaves.createRequest({
147
+ absenceTypeId: '71',
148
+ startDate: '2026-01-20',
149
+ endDate: '2026-01-22',
150
+ days: 3,
151
+ });
152
+ ```
153
+
154
+ ### SIT Requests
155
+
156
+ ```typescript
157
+ // Get segments
158
+ const segments = await client.sitRequests.getSegments({ idFlexNum: '50496' });
159
+
160
+ // Save and preview
161
+ const preview = await client.sitRequests.saveAndPreview(data);
162
+
163
+ // Submit
164
+ const result = await client.sitRequests.submit(data);
165
+ ```
166
+
167
+ ### Notifications
168
+
169
+ ```typescript
170
+ // Get notifications
171
+ const notifications = await client.notifications.getList();
172
+
173
+ // Get details
174
+ const details = await client.notifications.getDetails({ notificationId: '123' });
175
+
176
+ // Process approval
177
+ await client.notifications.processApproval({
178
+ notificationId: '123',
179
+ action: 'APPROVE',
180
+ });
181
+ ```
182
+
183
+ ### Payslip
184
+
185
+ ```typescript
186
+ // Get header
187
+ const header = await client.payslip.getHeader({ periodName: '6 2025' });
188
+
189
+ // Get details
190
+ const details = await client.payslip.getDetails({ periodName: '6 2025' });
191
+ ```
192
+
193
+ ### Employee
194
+
195
+ ```typescript
196
+ // Get personal info
197
+ const info = await client.employee.getPersonalInfo();
198
+
199
+ // Get hierarchy
200
+ const hierarchy = await client.employee.getHierarchy();
201
+ ```
202
+
203
+ ### Forms
204
+
205
+ ```typescript
206
+ // Get table columns
207
+ const columns = await client.forms.getTableColumns({ tableName: 'HR_EMPLOYEES' });
208
+
209
+ // Get DFF segments
210
+ const segments = await client.forms.getDffSegments({
211
+ applicationId: '800',
212
+ flexfieldName: 'PER_PEOPLE_EXTRA_INFO',
213
+ });
214
+ ```
215
+
216
+ ### Health
217
+
218
+ ```typescript
219
+ // Check health
220
+ const health = await client.health.check();
221
+
222
+ // Ping
223
+ const message = await client.health.ping();
224
+ ```
225
+
226
+ ## Error Handling
227
+
228
+ ```typescript
229
+ import {
230
+ ValidationError,
231
+ UnauthorizedError,
232
+ NetworkError,
233
+ } from '@smartsides/oracle-ebs-sdk';
234
+
235
+ try {
236
+ await client.leaves.createRequest(data);
237
+ } catch (error) {
238
+ if (error instanceof ValidationError) {
239
+ console.error('Validation failed:', error.fields);
240
+ } else if (error instanceof UnauthorizedError) {
241
+ // Redirect to login
242
+ router.push('/login');
243
+ } else if (error instanceof NetworkError) {
244
+ // Show retry button
245
+ console.error('Network error:', error.message);
246
+ }
247
+ }
248
+ ```
249
+
250
+ ## Configuration
251
+
252
+ ```typescript
253
+ const client = new OracleEBSClient({
254
+ baseUrl: 'http://localhost:3000/api/v1',
255
+ token: 'your-jwt-token', // Optional
256
+ timeout: 30000, // 30 seconds
257
+ retries: 3,
258
+ retryDelay: 1000,
259
+ cache: {
260
+ enabled: true,
261
+ ttl: 300, // 5 minutes
262
+ },
263
+ logging: {
264
+ enabled: true,
265
+ level: 'info',
266
+ },
267
+ onError: (error) => {
268
+ console.error('API Error:', error);
269
+ },
270
+ });
271
+ ```
272
+
273
+ ## React Query Hooks
274
+
275
+ All hooks are available from `@smartsides/oracle-ebs-sdk/hooks`:
276
+
277
+ - `useLogin(client, options)`
278
+ - `useUserContext(client, options)`
279
+ - `useLeaveTypes(client, params, options)`
280
+ - `useLeaveHistory(client, options)`
281
+ - `useCreateLeaveRequest(client, options)`
282
+ - `useSitSegments(client, params, options)`
283
+ - `useNotifications(client, options)`
284
+ - `usePayslipHeader(client, params, options)`
285
+ - `usePersonalInfo(client, options)`
286
+ - `useHealthCheck(client, options)`
287
+ - And more...
288
+
289
+ ## Server Helpers
290
+
291
+ ```typescript
292
+ import {
293
+ createServerClient,
294
+ createServerClientFromCookies,
295
+ createServerClientFromHeaders,
296
+ } from '@smartsides/oracle-ebs-sdk/server';
297
+
298
+ // Basic server client
299
+ const client = createServerClient({ baseUrl, token });
300
+
301
+ // From cookies
302
+ const client = createServerClientFromCookies(cookies());
303
+
304
+ // From headers
305
+ const client = createServerClientFromHeaders(headers());
306
+ ```
307
+
308
+ ## License
309
+
310
+ PROPRIETARY - SmartSides Development Team
311
+
312
+ ## Support
313
+
314
+ For support, please contact the development team.