@aifabrix/miso-client 3.2.0 → 3.3.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.
Files changed (141) hide show
  1. package/README.md +57 -2
  2. package/dist/api/auth-cache.api.d.ts +52 -0
  3. package/dist/api/auth-cache.api.d.ts.map +1 -0
  4. package/dist/api/auth-cache.api.js +125 -0
  5. package/dist/api/auth-cache.api.js.map +1 -0
  6. package/dist/api/auth-login.api.d.ts +52 -0
  7. package/dist/api/auth-login.api.d.ts.map +1 -0
  8. package/dist/api/auth-login.api.js +102 -0
  9. package/dist/api/auth-login.api.js.map +1 -0
  10. package/dist/api/auth-token.api.d.ts +46 -0
  11. package/dist/api/auth-token.api.d.ts.map +1 -0
  12. package/dist/api/auth-token.api.js +90 -0
  13. package/dist/api/auth-token.api.js.map +1 -0
  14. package/dist/api/auth-user.api.d.ts +43 -0
  15. package/dist/api/auth-user.api.d.ts.map +1 -0
  16. package/dist/api/auth-user.api.js +87 -0
  17. package/dist/api/auth-user.api.js.map +1 -0
  18. package/dist/api/auth.api.d.ts +48 -0
  19. package/dist/api/auth.api.d.ts.map +1 -0
  20. package/dist/api/auth.api.js +152 -0
  21. package/dist/api/auth.api.js.map +1 -0
  22. package/dist/api/index.d.ts +39 -0
  23. package/dist/api/index.d.ts.map +1 -0
  24. package/dist/api/index.js +31 -0
  25. package/dist/api/index.js.map +1 -0
  26. package/dist/api/logs-create.api.d.ts +32 -0
  27. package/dist/api/logs-create.api.d.ts.map +1 -0
  28. package/dist/api/logs-create.api.js +63 -0
  29. package/dist/api/logs-create.api.js.map +1 -0
  30. package/dist/api/logs-export.api.d.ts +24 -0
  31. package/dist/api/logs-export.api.d.ts.map +1 -0
  32. package/dist/api/logs-export.api.js +43 -0
  33. package/dist/api/logs-export.api.js.map +1 -0
  34. package/dist/api/logs-list.api.d.ts +63 -0
  35. package/dist/api/logs-list.api.d.ts.map +1 -0
  36. package/dist/api/logs-list.api.js +155 -0
  37. package/dist/api/logs-list.api.js.map +1 -0
  38. package/dist/api/logs-stats.api.d.ts +48 -0
  39. package/dist/api/logs-stats.api.d.ts.map +1 -0
  40. package/dist/api/logs-stats.api.js +107 -0
  41. package/dist/api/logs-stats.api.js.map +1 -0
  42. package/dist/api/logs.api.d.ts +35 -0
  43. package/dist/api/logs.api.d.ts.map +1 -0
  44. package/dist/api/logs.api.js +71 -0
  45. package/dist/api/logs.api.js.map +1 -0
  46. package/dist/api/permissions.api.d.ts +31 -0
  47. package/dist/api/permissions.api.d.ts.map +1 -0
  48. package/dist/api/permissions.api.js +62 -0
  49. package/dist/api/permissions.api.js.map +1 -0
  50. package/dist/api/roles.api.d.ts +31 -0
  51. package/dist/api/roles.api.d.ts.map +1 -0
  52. package/dist/api/roles.api.js +62 -0
  53. package/dist/api/roles.api.js.map +1 -0
  54. package/dist/api/types/auth.types.d.ts +293 -0
  55. package/dist/api/types/auth.types.d.ts.map +1 -0
  56. package/dist/api/types/auth.types.js +7 -0
  57. package/dist/api/types/auth.types.js.map +1 -0
  58. package/dist/api/types/logs.types.d.ts +266 -0
  59. package/dist/api/types/logs.types.d.ts.map +1 -0
  60. package/dist/api/types/logs.types.js +7 -0
  61. package/dist/api/types/logs.types.js.map +1 -0
  62. package/dist/api/types/permissions.types.d.ts +32 -0
  63. package/dist/api/types/permissions.types.d.ts.map +1 -0
  64. package/dist/api/types/permissions.types.js +7 -0
  65. package/dist/api/types/permissions.types.js.map +1 -0
  66. package/dist/api/types/roles.types.d.ts +32 -0
  67. package/dist/api/types/roles.types.d.ts.map +1 -0
  68. package/dist/api/types/roles.types.js +7 -0
  69. package/dist/api/types/roles.types.js.map +1 -0
  70. package/dist/express/client-token-endpoint.d.ts.map +1 -1
  71. package/dist/express/client-token-endpoint.js +136 -13
  72. package/dist/express/client-token-endpoint.js.map +1 -1
  73. package/dist/index.d.ts +12 -0
  74. package/dist/index.d.ts.map +1 -1
  75. package/dist/index.js +24 -6
  76. package/dist/index.js.map +1 -1
  77. package/dist/services/auth.service.d.ts +28 -4
  78. package/dist/services/auth.service.d.ts.map +1 -1
  79. package/dist/services/auth.service.js +186 -16
  80. package/dist/services/auth.service.js.map +1 -1
  81. package/dist/services/browser-permission.service.d.ts +3 -1
  82. package/dist/services/browser-permission.service.d.ts.map +1 -1
  83. package/dist/services/browser-permission.service.js +32 -16
  84. package/dist/services/browser-permission.service.js.map +1 -1
  85. package/dist/services/browser-role.service.d.ts +3 -1
  86. package/dist/services/browser-role.service.d.ts.map +1 -1
  87. package/dist/services/browser-role.service.js +32 -16
  88. package/dist/services/browser-role.service.js.map +1 -1
  89. package/dist/services/logger.service.d.ts +102 -24
  90. package/dist/services/logger.service.d.ts.map +1 -1
  91. package/dist/services/logger.service.js +225 -51
  92. package/dist/services/logger.service.js.map +1 -1
  93. package/dist/services/permission.service.d.ts +3 -1
  94. package/dist/services/permission.service.d.ts.map +1 -1
  95. package/dist/services/permission.service.js +32 -16
  96. package/dist/services/permission.service.js.map +1 -1
  97. package/dist/services/redis.service.d.ts.map +1 -1
  98. package/dist/services/redis.service.js +3 -6
  99. package/dist/services/redis.service.js.map +1 -1
  100. package/dist/services/role.service.d.ts +3 -1
  101. package/dist/services/role.service.d.ts.map +1 -1
  102. package/dist/services/role.service.js +25 -13
  103. package/dist/services/role.service.js.map +1 -1
  104. package/dist/types/config.types.d.ts +22 -0
  105. package/dist/types/config.types.d.ts.map +1 -1
  106. package/dist/types/config.types.js.map +1 -1
  107. package/dist/types/data-client.types.d.ts +10 -0
  108. package/dist/types/data-client.types.d.ts.map +1 -1
  109. package/dist/types/data-client.types.js.map +1 -1
  110. package/dist/utils/audit-log-queue.d.ts +7 -0
  111. package/dist/utils/audit-log-queue.d.ts.map +1 -1
  112. package/dist/utils/audit-log-queue.js +29 -8
  113. package/dist/utils/audit-log-queue.js.map +1 -1
  114. package/dist/utils/data-client-auth.d.ts +17 -4
  115. package/dist/utils/data-client-auth.d.ts.map +1 -1
  116. package/dist/utils/data-client-auth.js +215 -131
  117. package/dist/utils/data-client-auth.js.map +1 -1
  118. package/dist/utils/data-client-auto-init.d.ts.map +1 -1
  119. package/dist/utils/data-client-auto-init.js +55 -11
  120. package/dist/utils/data-client-auto-init.js.map +1 -1
  121. package/dist/utils/data-client-redirect.d.ts +34 -4
  122. package/dist/utils/data-client-redirect.d.ts.map +1 -1
  123. package/dist/utils/data-client-redirect.js +142 -254
  124. package/dist/utils/data-client-redirect.js.map +1 -1
  125. package/dist/utils/data-client-request.d.ts +8 -1
  126. package/dist/utils/data-client-request.d.ts.map +1 -1
  127. package/dist/utils/data-client-request.js +25 -3
  128. package/dist/utils/data-client-request.js.map +1 -1
  129. package/dist/utils/data-client.d.ts +13 -0
  130. package/dist/utils/data-client.d.ts.map +1 -1
  131. package/dist/utils/data-client.js +86 -5
  132. package/dist/utils/data-client.js.map +1 -1
  133. package/dist/utils/logging-helpers.d.ts +51 -0
  134. package/dist/utils/logging-helpers.d.ts.map +1 -0
  135. package/dist/utils/logging-helpers.js +57 -0
  136. package/dist/utils/logging-helpers.js.map +1 -0
  137. package/dist/utils/request-context.d.ts +32 -0
  138. package/dist/utils/request-context.d.ts.map +1 -0
  139. package/dist/utils/request-context.js +81 -0
  140. package/dist/utils/request-context.js.map +1 -0
  141. package/package.json +1 -1
package/README.md CHANGED
@@ -190,6 +190,23 @@ const dataClient = new DataClient({
190
190
  // Make authenticated requests with automatic audit logging
191
191
  const users = await dataClient.get('/api/users');
192
192
  const newUser = await dataClient.post('/api/users', { name: 'John' });
193
+
194
+ // OAuth callback is automatically handled on initialization
195
+ // Token is extracted from URL hash fragment (#token=...) and stored securely
196
+ // Hash fragment is immediately removed from URL (< 100ms) for security
197
+
198
+ // Token refresh callback (automatic refresh on 401 errors)
199
+ const dataClientWithRefresh = new DataClient({
200
+ baseUrl: 'https://api.example.com',
201
+ misoConfig: { /* ... */ },
202
+ onTokenRefresh: async () => {
203
+ // Call your backend endpoint that handles refresh token securely
204
+ const response = await fetch('/api/refresh-token', {
205
+ credentials: 'include', // Include cookies for auth
206
+ });
207
+ return await response.json(); // { token: string, expiresIn: number }
208
+ },
209
+ });
193
210
  ```
194
211
 
195
212
  → [DataClient Documentation](docs/data-client.md) - Includes security guide and Client Token Pattern
@@ -256,7 +273,7 @@ if (token) {
256
273
 
257
274
  ### Step 4: Activate RBAC (Roles)
258
275
 
259
- **What happens:** Check user roles to control access. Roles are cached in Redis for performance.
276
+ **What happens:** Check user roles to control access. Roles are cached in Redis for performance. Token validation is also cached (15-minute TTL) to reduce API calls.
260
277
 
261
278
  ```typescript
262
279
  import { MisoClient, loadConfig } from '@aifabrix/miso-client';
@@ -288,6 +305,8 @@ if (isAdmin) {
288
305
 
289
306
  **What happens:** Application logs are sent to the Miso Controller with client token authentication.
290
307
 
308
+ **Basic Logging:**
309
+
291
310
  ```typescript
292
311
  import { MisoClient, loadConfig } from '@aifabrix/miso-client';
293
312
 
@@ -304,7 +323,42 @@ await client.log.error('Operation failed', { error: err.message });
304
323
  await client.log.warn('Unusual activity', { details: '...' });
305
324
  ```
306
325
 
307
- **What happens to logs?** They're sent to the Miso Controller for centralized monitoring and analysis. Client token is automatically included.
326
+ **Fluent API with Request Context (Express):**
327
+
328
+ ```typescript
329
+ import { Request } from 'express';
330
+
331
+ // Auto-extract context from Express Request
332
+ app.get('/api/users', async (req: Request, res) => {
333
+ await client.log
334
+ .withRequest(req)
335
+ .info('Users list accessed');
336
+ // Automatically includes: IP, method, path, userAgent, correlationId, userId
337
+ });
338
+ ```
339
+
340
+ **Indexed Context for Fast Queries:**
341
+
342
+ ```typescript
343
+ import { extractLoggingContext } from '@aifabrix/miso-client';
344
+
345
+ const logContext = extractLoggingContext({
346
+ source: {
347
+ key: 'datasource-1',
348
+ displayName: 'PostgreSQL DB',
349
+ externalSystem: { key: 'system-1', displayName: 'External API' }
350
+ },
351
+ record: { key: 'record-123', displayName: 'User Profile' }
352
+ });
353
+
354
+ await client.log
355
+ .withIndexedContext(logContext)
356
+ .addCorrelation(correlationId)
357
+ .addUser(userId)
358
+ .error('Sync failed');
359
+ ```
360
+
361
+ **What happens to logs?** They're sent to the Miso Controller for centralized monitoring and analysis. Client token is automatically included. Indexed context fields enable fast database queries for observability and compliance.
308
362
 
309
363
  **Event Emission Mode:** When embedding the SDK directly in your own application, enable `emitEvents = true` to receive logs as Node.js events instead of HTTP calls:
310
364
 
@@ -820,6 +874,7 @@ interface MisoClientConfig {
820
874
  cache?: {
821
875
  roleTTL?: number; // Role cache TTL (default: 900s)
822
876
  permissionTTL?: number; // Permission cache TTL (default: 900s)
877
+ tokenValidationTTL?: number; // Token validation cache TTL (default: 900s)
823
878
  };
824
879
  audit?: AuditConfig; // Optional: Audit logging configuration
825
880
  }
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Auth Cache API client
3
+ * Handles cache statistics and management
4
+ */
5
+ import { HttpClient } from '../utils/http-client';
6
+ import { AuthStrategy } from '../types/config.types';
7
+ import { CacheStatsResponse, CachePerformanceResponse, CacheEfficiencyResponse, ClearCacheResponse, InvalidateCacheRequest, InvalidateCacheResponse } from './types/auth.types';
8
+ /**
9
+ * Auth Cache API class
10
+ * Handles cache-related endpoints
11
+ */
12
+ export declare class AuthCacheApi {
13
+ private httpClient;
14
+ private static readonly CACHE_STATS_ENDPOINT;
15
+ private static readonly CACHE_PERFORMANCE_ENDPOINT;
16
+ private static readonly CACHE_EFFICIENCY_ENDPOINT;
17
+ private static readonly CACHE_CLEAR_ENDPOINT;
18
+ private static readonly CACHE_INVALIDATE_ENDPOINT;
19
+ constructor(httpClient: HttpClient);
20
+ /**
21
+ * Get cache statistics
22
+ * @param authStrategy - Optional authentication strategy override
23
+ * @returns Cache stats response with hits, misses, and size
24
+ */
25
+ getCacheStats(authStrategy?: AuthStrategy): Promise<CacheStatsResponse>;
26
+ /**
27
+ * Get cache performance metrics
28
+ * @param authStrategy - Optional authentication strategy override
29
+ * @returns Cache performance response with hitRate and avgResponseTime
30
+ */
31
+ getCachePerformance(authStrategy?: AuthStrategy): Promise<CachePerformanceResponse>;
32
+ /**
33
+ * Get cache efficiency metrics
34
+ * @param authStrategy - Optional authentication strategy override
35
+ * @returns Cache efficiency response with efficiency score
36
+ */
37
+ getCacheEfficiency(authStrategy?: AuthStrategy): Promise<CacheEfficiencyResponse>;
38
+ /**
39
+ * Clear authentication cache
40
+ * @param authStrategy - Optional authentication strategy override
41
+ * @returns Clear cache response with success message
42
+ */
43
+ clearCache(authStrategy?: AuthStrategy): Promise<ClearCacheResponse>;
44
+ /**
45
+ * Invalidate cache entries by pattern
46
+ * @param params - Invalidate cache request parameters
47
+ * @param authStrategy - Optional authentication strategy override
48
+ * @returns Invalidate cache response with number of invalidated entries
49
+ */
50
+ invalidateCache(params: InvalidateCacheRequest, authStrategy?: AuthStrategy): Promise<InvalidateCacheResponse>;
51
+ }
52
+ //# sourceMappingURL=auth-cache.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-cache.api.d.ts","sourceRoot":"","sources":["../../src/api/auth-cache.api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,kBAAkB,EAClB,wBAAwB,EACxB,uBAAuB,EACvB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACxB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,YAAY;IAQX,OAAO,CAAC,UAAU;IAN9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAoC;IACtF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAmC;IACpF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,oBAAoB,CAA8B;IAC1E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,yBAAyB,CAAmC;gBAEhE,UAAU,EAAE,UAAU;IAE1C;;;;OAIG;IACG,aAAa,CACjB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IA6B9B;;;;OAIG;IACG,mBAAmB,CACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,wBAAwB,CAAC;IA6BpC;;;;OAIG;IACG,kBAAkB,CACtB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,uBAAuB,CAAC;IA6BnC;;;;OAIG;IACG,UAAU,CACd,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IA6B9B;;;;;OAKG;IACG,eAAe,CACnB,MAAM,EAAE,sBAAsB,EAC9B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,uBAAuB,CAAC;CA8BpC"}
@@ -0,0 +1,125 @@
1
+ "use strict";
2
+ /**
3
+ * Auth Cache API client
4
+ * Handles cache statistics and management
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AuthCacheApi = void 0;
8
+ /**
9
+ * Auth Cache API class
10
+ * Handles cache-related endpoints
11
+ */
12
+ class AuthCacheApi {
13
+ constructor(httpClient) {
14
+ this.httpClient = httpClient;
15
+ }
16
+ /**
17
+ * Get cache statistics
18
+ * @param authStrategy - Optional authentication strategy override
19
+ * @returns Cache stats response with hits, misses, and size
20
+ */
21
+ async getCacheStats(authStrategy) {
22
+ try {
23
+ if (authStrategy?.bearerToken) {
24
+ return await this.httpClient.authenticatedRequest('GET', AuthCacheApi.CACHE_STATS_ENDPOINT, authStrategy.bearerToken, undefined, undefined, authStrategy);
25
+ }
26
+ if (authStrategy) {
27
+ return await this.httpClient.requestWithAuthStrategy('GET', AuthCacheApi.CACHE_STATS_ENDPOINT, authStrategy);
28
+ }
29
+ return await this.httpClient.request('GET', AuthCacheApi.CACHE_STATS_ENDPOINT);
30
+ }
31
+ catch (error) {
32
+ console.error('Get cache stats API call failed:', error);
33
+ throw error;
34
+ }
35
+ }
36
+ /**
37
+ * Get cache performance metrics
38
+ * @param authStrategy - Optional authentication strategy override
39
+ * @returns Cache performance response with hitRate and avgResponseTime
40
+ */
41
+ async getCachePerformance(authStrategy) {
42
+ try {
43
+ if (authStrategy?.bearerToken) {
44
+ return await this.httpClient.authenticatedRequest('GET', AuthCacheApi.CACHE_PERFORMANCE_ENDPOINT, authStrategy.bearerToken, undefined, undefined, authStrategy);
45
+ }
46
+ if (authStrategy) {
47
+ return await this.httpClient.requestWithAuthStrategy('GET', AuthCacheApi.CACHE_PERFORMANCE_ENDPOINT, authStrategy);
48
+ }
49
+ return await this.httpClient.request('GET', AuthCacheApi.CACHE_PERFORMANCE_ENDPOINT);
50
+ }
51
+ catch (error) {
52
+ console.error('Get cache performance API call failed:', error);
53
+ throw error;
54
+ }
55
+ }
56
+ /**
57
+ * Get cache efficiency metrics
58
+ * @param authStrategy - Optional authentication strategy override
59
+ * @returns Cache efficiency response with efficiency score
60
+ */
61
+ async getCacheEfficiency(authStrategy) {
62
+ try {
63
+ if (authStrategy?.bearerToken) {
64
+ return await this.httpClient.authenticatedRequest('GET', AuthCacheApi.CACHE_EFFICIENCY_ENDPOINT, authStrategy.bearerToken, undefined, undefined, authStrategy);
65
+ }
66
+ if (authStrategy) {
67
+ return await this.httpClient.requestWithAuthStrategy('GET', AuthCacheApi.CACHE_EFFICIENCY_ENDPOINT, authStrategy);
68
+ }
69
+ return await this.httpClient.request('GET', AuthCacheApi.CACHE_EFFICIENCY_ENDPOINT);
70
+ }
71
+ catch (error) {
72
+ console.error('Get cache efficiency API call failed:', error);
73
+ throw error;
74
+ }
75
+ }
76
+ /**
77
+ * Clear authentication cache
78
+ * @param authStrategy - Optional authentication strategy override
79
+ * @returns Clear cache response with success message
80
+ */
81
+ async clearCache(authStrategy) {
82
+ try {
83
+ if (authStrategy?.bearerToken) {
84
+ return await this.httpClient.authenticatedRequest('POST', AuthCacheApi.CACHE_CLEAR_ENDPOINT, authStrategy.bearerToken, undefined, undefined, authStrategy);
85
+ }
86
+ if (authStrategy) {
87
+ return await this.httpClient.requestWithAuthStrategy('POST', AuthCacheApi.CACHE_CLEAR_ENDPOINT, authStrategy);
88
+ }
89
+ return await this.httpClient.request('POST', AuthCacheApi.CACHE_CLEAR_ENDPOINT);
90
+ }
91
+ catch (error) {
92
+ console.error('Clear cache API call failed:', error);
93
+ throw error;
94
+ }
95
+ }
96
+ /**
97
+ * Invalidate cache entries by pattern
98
+ * @param params - Invalidate cache request parameters
99
+ * @param authStrategy - Optional authentication strategy override
100
+ * @returns Invalidate cache response with number of invalidated entries
101
+ */
102
+ async invalidateCache(params, authStrategy) {
103
+ try {
104
+ if (authStrategy?.bearerToken) {
105
+ return await this.httpClient.authenticatedRequest('POST', AuthCacheApi.CACHE_INVALIDATE_ENDPOINT, authStrategy.bearerToken, params, undefined, authStrategy);
106
+ }
107
+ if (authStrategy) {
108
+ return await this.httpClient.requestWithAuthStrategy('POST', AuthCacheApi.CACHE_INVALIDATE_ENDPOINT, authStrategy, params);
109
+ }
110
+ return await this.httpClient.request('POST', AuthCacheApi.CACHE_INVALIDATE_ENDPOINT, params);
111
+ }
112
+ catch (error) {
113
+ console.error('Invalidate cache API call failed:', error);
114
+ throw error;
115
+ }
116
+ }
117
+ }
118
+ exports.AuthCacheApi = AuthCacheApi;
119
+ // Centralize endpoint URLs as constants
120
+ AuthCacheApi.CACHE_STATS_ENDPOINT = '/api/v1/auth/cache/stats';
121
+ AuthCacheApi.CACHE_PERFORMANCE_ENDPOINT = '/api/v1/auth/cache/performance';
122
+ AuthCacheApi.CACHE_EFFICIENCY_ENDPOINT = '/api/v1/auth/cache/efficiency';
123
+ AuthCacheApi.CACHE_CLEAR_ENDPOINT = '/api/v1/auth/cache/clear';
124
+ AuthCacheApi.CACHE_INVALIDATE_ENDPOINT = '/api/v1/auth/cache/invalidate';
125
+ //# sourceMappingURL=auth-cache.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth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ClD,uCAA0B,GAAG,gCAAgC,CAAC;AAC9D,sCAAyB,GAAG,+BAA+B,CAAC;AAC5D,iCAAoB,GAAG,0BAA0B,CAAC;AAClD,sCAAyB,GAAG,+BAA+B,CAAC"}
@@ -0,0 +1,52 @@
1
+ /**
2
+ * Auth Login API client
3
+ * Handles login, device code flow, and diagnostics
4
+ */
5
+ import { HttpClient } from '../utils/http-client';
6
+ import { AuthStrategy } from '../types/config.types';
7
+ import { LoginRequest, LoginResponse, DeviceCodeRequest, DeviceCodeResponse, DeviceCodeTokenRequest, DeviceCodeTokenResponse, DeviceCodeRefreshRequest, DiagnosticsResponse } from './types/auth.types';
8
+ /**
9
+ * Auth Login API class
10
+ * Handles login-related endpoints
11
+ */
12
+ export declare class AuthLoginApi {
13
+ private httpClient;
14
+ private static readonly LOGIN_ENDPOINT;
15
+ private static readonly DEVICE_CODE_TOKEN_ENDPOINT;
16
+ private static readonly DEVICE_CODE_REFRESH_ENDPOINT;
17
+ private static readonly LOGIN_DIAGNOSTICS_ENDPOINT;
18
+ constructor(httpClient: HttpClient);
19
+ /**
20
+ * Login user and get login URL (OAuth2 redirect flow)
21
+ * @param params - Login request parameters
22
+ * @param authStrategy - Optional authentication strategy override
23
+ * @returns Login response with loginUrl and state
24
+ */
25
+ login(params: LoginRequest, authStrategy?: AuthStrategy): Promise<LoginResponse>;
26
+ /**
27
+ * Initiate device code flow
28
+ * @param params - Device code request parameters
29
+ * @param authStrategy - Optional authentication strategy override
30
+ * @returns Device code response with deviceCode, userCode, and verificationUri
31
+ */
32
+ initiateDeviceCode(params: DeviceCodeRequest, authStrategy?: AuthStrategy): Promise<DeviceCodeResponse>;
33
+ /**
34
+ * Poll for device code token
35
+ * @param params - Device code token request parameters
36
+ * @returns Device code token response with accessToken
37
+ */
38
+ pollDeviceCodeToken(params: DeviceCodeTokenRequest): Promise<DeviceCodeTokenResponse>;
39
+ /**
40
+ * Refresh device code token
41
+ * @param params - Device code refresh request parameters
42
+ * @returns Device code token response with accessToken
43
+ */
44
+ refreshDeviceCodeToken(params: DeviceCodeRefreshRequest): Promise<DeviceCodeTokenResponse>;
45
+ /**
46
+ * Get login diagnostics
47
+ * @param environment - Optional environment parameter
48
+ * @returns Diagnostics response with database, controller, environment, and keycloak info
49
+ */
50
+ getLoginDiagnostics(environment?: string): Promise<DiagnosticsResponse>;
51
+ }
52
+ //# sourceMappingURL=auth-login.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-login.api.d.ts","sourceRoot":"","sources":["../../src/api/auth-login.api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,YAAY,EACZ,aAAa,EACb,iBAAiB,EACjB,kBAAkB,EAClB,sBAAsB,EACtB,uBAAuB,EACvB,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,YAAY;IAOX,OAAO,CAAC,UAAU;IAL9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,cAAc,CAAwB;IAC9D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAqC;IACvF,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAuC;IAC3F,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,0BAA0B,CAAoC;gBAElE,UAAU,EAAE,UAAU;IAE1C;;;;;OAKG;IACG,KAAK,CACT,MAAM,EAAE,YAAY,EACpB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,aAAa,CAAC;IAuBzB;;;;;OAKG;IACG,kBAAkB,CACtB,MAAM,EAAE,iBAAiB,EACzB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,kBAAkB,CAAC;IAqB9B;;;;OAIG;IACG,mBAAmB,CACvB,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,uBAAuB,CAAC;IAanC;;;;OAIG;IACG,sBAAsB,CAC1B,MAAM,EAAE,wBAAwB,GAC/B,OAAO,CAAC,uBAAuB,CAAC;IAanC;;;;OAIG;IACG,mBAAmB,CACvB,WAAW,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,mBAAmB,CAAC;CAchC"}
@@ -0,0 +1,102 @@
1
+ "use strict";
2
+ /**
3
+ * Auth Login API client
4
+ * Handles login, device code flow, and diagnostics
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AuthLoginApi = void 0;
8
+ /**
9
+ * Auth Login API class
10
+ * Handles login-related endpoints
11
+ */
12
+ class AuthLoginApi {
13
+ constructor(httpClient) {
14
+ this.httpClient = httpClient;
15
+ }
16
+ /**
17
+ * Login user and get login URL (OAuth2 redirect flow)
18
+ * @param params - Login request parameters
19
+ * @param authStrategy - Optional authentication strategy override
20
+ * @returns Login response with loginUrl and state
21
+ */
22
+ async login(params, authStrategy) {
23
+ try {
24
+ if (authStrategy) {
25
+ return await this.httpClient.requestWithAuthStrategy('GET', AuthLoginApi.LOGIN_ENDPOINT, authStrategy, undefined, { params });
26
+ }
27
+ return await this.httpClient.request('GET', AuthLoginApi.LOGIN_ENDPOINT, undefined, { params });
28
+ }
29
+ catch (error) {
30
+ console.error('Login API call failed:', error);
31
+ throw error;
32
+ }
33
+ }
34
+ /**
35
+ * Initiate device code flow
36
+ * @param params - Device code request parameters
37
+ * @param authStrategy - Optional authentication strategy override
38
+ * @returns Device code response with deviceCode, userCode, and verificationUri
39
+ */
40
+ async initiateDeviceCode(params, authStrategy) {
41
+ try {
42
+ if (authStrategy) {
43
+ return await this.httpClient.requestWithAuthStrategy('POST', AuthLoginApi.LOGIN_ENDPOINT, authStrategy, params);
44
+ }
45
+ return await this.httpClient.request('POST', AuthLoginApi.LOGIN_ENDPOINT, params);
46
+ }
47
+ catch (error) {
48
+ console.error('Initiate device code API call failed:', error);
49
+ throw error;
50
+ }
51
+ }
52
+ /**
53
+ * Poll for device code token
54
+ * @param params - Device code token request parameters
55
+ * @returns Device code token response with accessToken
56
+ */
57
+ async pollDeviceCodeToken(params) {
58
+ try {
59
+ return await this.httpClient.request('POST', AuthLoginApi.DEVICE_CODE_TOKEN_ENDPOINT, params);
60
+ }
61
+ catch (error) {
62
+ console.error('Poll device code token API call failed:', error);
63
+ throw error;
64
+ }
65
+ }
66
+ /**
67
+ * Refresh device code token
68
+ * @param params - Device code refresh request parameters
69
+ * @returns Device code token response with accessToken
70
+ */
71
+ async refreshDeviceCodeToken(params) {
72
+ try {
73
+ return await this.httpClient.request('POST', AuthLoginApi.DEVICE_CODE_REFRESH_ENDPOINT, params);
74
+ }
75
+ catch (error) {
76
+ console.error('Refresh device code token API call failed:', error);
77
+ throw error;
78
+ }
79
+ }
80
+ /**
81
+ * Get login diagnostics
82
+ * @param environment - Optional environment parameter
83
+ * @returns Diagnostics response with database, controller, environment, and keycloak info
84
+ */
85
+ async getLoginDiagnostics(environment) {
86
+ try {
87
+ const params = environment ? { environment } : undefined;
88
+ return await this.httpClient.request('GET', AuthLoginApi.LOGIN_DIAGNOSTICS_ENDPOINT, undefined, { params });
89
+ }
90
+ catch (error) {
91
+ console.error('Get login diagnostics API call failed:', error);
92
+ throw error;
93
+ }
94
+ }
95
+ }
96
+ exports.AuthLoginApi = AuthLoginApi;
97
+ // Centralize endpoint URLs as constants
98
+ AuthLoginApi.LOGIN_ENDPOINT = '/api/v1/auth/login';
99
+ AuthLoginApi.DEVICE_CODE_TOKEN_ENDPOINT = '/api/v1/auth/login/device/token';
100
+ AuthLoginApi.DEVICE_CODE_REFRESH_ENDPOINT = '/api/v1/auth/login/device/refresh';
101
+ AuthLoginApi.LOGIN_DIAGNOSTICS_ENDPOINT = '/api/v1/auth/login/diagnostics';
102
+ //# sourceMappingURL=auth-login.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-login.api.js","sourceRoot":"","sources":["../../src/api/auth-login.api.ts"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}
@@ -0,0 +1,46 @@
1
+ /**
2
+ * Auth Token API client
3
+ * Handles client tokens, token validation, and token refresh
4
+ */
5
+ import { HttpClient } from '../utils/http-client';
6
+ import { AuthStrategy } from '../types/config.types';
7
+ import { ValidateTokenRequest, ValidateTokenResponse, RefreshTokenRequest, RefreshTokenResponse, ClientTokenResponse, ClientTokenLegacyResponse } from './types/auth.types';
8
+ /**
9
+ * Auth Token API class
10
+ * Handles token-related endpoints
11
+ */
12
+ export declare class AuthTokenApi {
13
+ private httpClient;
14
+ private static readonly CLIENT_TOKEN_ENDPOINT;
15
+ private static readonly CLIENT_TOKEN_LEGACY_ENDPOINT;
16
+ private static readonly VALIDATE_ENDPOINT;
17
+ private static readonly REFRESH_ENDPOINT;
18
+ constructor(httpClient: HttpClient);
19
+ /**
20
+ * Get client token (for frontend, origin validation)
21
+ * @param authStrategy - Optional authentication strategy override
22
+ * @returns Client token response with token and expiration
23
+ */
24
+ getClientToken(authStrategy?: AuthStrategy): Promise<ClientTokenResponse>;
25
+ /**
26
+ * Generate client token (legacy endpoint, uses x-client-id/x-client-secret)
27
+ * @param authStrategy - Optional authentication strategy override
28
+ * @returns Client token legacy response with token and expiration
29
+ */
30
+ generateClientToken(authStrategy?: AuthStrategy): Promise<ClientTokenLegacyResponse>;
31
+ /**
32
+ * Validate user token
33
+ * @param params - Validate token request parameters
34
+ * @param authStrategy - Optional authentication strategy override
35
+ * @returns Validation response with authenticated status and user info
36
+ */
37
+ validateToken(params: ValidateTokenRequest, authStrategy?: AuthStrategy): Promise<ValidateTokenResponse>;
38
+ /**
39
+ * Refresh user access token
40
+ * @param params - Refresh token request parameters
41
+ * @param authStrategy - Optional authentication strategy override
42
+ * @returns Refresh token response with new accessToken
43
+ */
44
+ refreshToken(params: RefreshTokenRequest, authStrategy?: AuthStrategy): Promise<RefreshTokenResponse>;
45
+ }
46
+ //# sourceMappingURL=auth-token.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-token.api.d.ts","sourceRoot":"","sources":["../../src/api/auth-token.api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,oBAAoB,EACpB,qBAAqB,EACrB,mBAAmB,EACnB,oBAAoB,EACpB,mBAAmB,EACnB,yBAAyB,EAC1B,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,YAAY;IAOX,OAAO,CAAC,UAAU;IAL9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,qBAAqB,CAA+B;IAC5E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,4BAA4B,CAAwB;IAC5E,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAA2B;IACpE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,gBAAgB,CAA0B;gBAE9C,UAAU,EAAE,UAAU;IAE1C;;;;OAIG;IACG,cAAc,CAClB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,mBAAmB,CAAC;IAmB/B;;;;OAIG;IACG,mBAAmB,CACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,yBAAyB,CAAC;IAmBrC;;;;;OAKG;IACG,aAAa,CACjB,MAAM,EAAE,oBAAoB,EAC5B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,qBAAqB,CAAC;IAgBjC;;;;;OAKG;IACG,YAAY,CAChB,MAAM,EAAE,mBAAmB,EAC3B,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,oBAAoB,CAAC;CAoBjC"}
@@ -0,0 +1,90 @@
1
+ "use strict";
2
+ /**
3
+ * Auth Token API client
4
+ * Handles client tokens, token validation, and token refresh
5
+ */
6
+ Object.defineProperty(exports, "__esModule", { value: true });
7
+ exports.AuthTokenApi = void 0;
8
+ /**
9
+ * Auth Token API class
10
+ * Handles token-related endpoints
11
+ */
12
+ class AuthTokenApi {
13
+ constructor(httpClient) {
14
+ this.httpClient = httpClient;
15
+ }
16
+ /**
17
+ * Get client token (for frontend, origin validation)
18
+ * @param authStrategy - Optional authentication strategy override
19
+ * @returns Client token response with token and expiration
20
+ */
21
+ async getClientToken(authStrategy) {
22
+ try {
23
+ if (authStrategy) {
24
+ return await this.httpClient.requestWithAuthStrategy('GET', AuthTokenApi.CLIENT_TOKEN_ENDPOINT, authStrategy);
25
+ }
26
+ return await this.httpClient.request('GET', AuthTokenApi.CLIENT_TOKEN_ENDPOINT);
27
+ }
28
+ catch (error) {
29
+ console.error('Get client token API call failed:', error);
30
+ throw error;
31
+ }
32
+ }
33
+ /**
34
+ * Generate client token (legacy endpoint, uses x-client-id/x-client-secret)
35
+ * @param authStrategy - Optional authentication strategy override
36
+ * @returns Client token legacy response with token and expiration
37
+ */
38
+ async generateClientToken(authStrategy) {
39
+ try {
40
+ if (authStrategy) {
41
+ return await this.httpClient.requestWithAuthStrategy('POST', AuthTokenApi.CLIENT_TOKEN_LEGACY_ENDPOINT, authStrategy);
42
+ }
43
+ return await this.httpClient.request('POST', AuthTokenApi.CLIENT_TOKEN_LEGACY_ENDPOINT);
44
+ }
45
+ catch (error) {
46
+ console.error('Generate client token API call failed:', error);
47
+ throw error;
48
+ }
49
+ }
50
+ /**
51
+ * Validate user token
52
+ * @param params - Validate token request parameters
53
+ * @param authStrategy - Optional authentication strategy override
54
+ * @returns Validation response with authenticated status and user info
55
+ */
56
+ async validateToken(params, authStrategy) {
57
+ try {
58
+ return await this.httpClient.authenticatedRequest('POST', AuthTokenApi.VALIDATE_ENDPOINT, params.token, params, undefined, authStrategy);
59
+ }
60
+ catch (error) {
61
+ console.error('Token validation API call failed:', error);
62
+ throw error;
63
+ }
64
+ }
65
+ /**
66
+ * Refresh user access token
67
+ * @param params - Refresh token request parameters
68
+ * @param authStrategy - Optional authentication strategy override
69
+ * @returns Refresh token response with new accessToken
70
+ */
71
+ async refreshToken(params, authStrategy) {
72
+ try {
73
+ if (authStrategy) {
74
+ return await this.httpClient.requestWithAuthStrategy('POST', AuthTokenApi.REFRESH_ENDPOINT, authStrategy, params);
75
+ }
76
+ return await this.httpClient.request('POST', AuthTokenApi.REFRESH_ENDPOINT, params);
77
+ }
78
+ catch (error) {
79
+ console.error('Refresh token API call failed:', error);
80
+ throw error;
81
+ }
82
+ }
83
+ }
84
+ exports.AuthTokenApi = AuthTokenApi;
85
+ // Centralize endpoint URLs as constants
86
+ AuthTokenApi.CLIENT_TOKEN_ENDPOINT = '/api/v1/auth/client-token';
87
+ AuthTokenApi.CLIENT_TOKEN_LEGACY_ENDPOINT = '/api/v1/auth/token';
88
+ AuthTokenApi.VALIDATE_ENDPOINT = '/api/v1/auth/validate';
89
+ AuthTokenApi.REFRESH_ENDPOINT = '/api/v1/auth/refresh';
90
+ //# sourceMappingURL=auth-token.api.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-token.api.js","sourceRoot":"","sources":["../../src/api/auth-token.api.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAaH;;;GAGG;AACH,MAAa,YAAY;IAOvB,YAAoB,UAAsB;QAAtB,eAAU,GAAV,UAAU,CAAY;IAAG,CAAC;IAE9C;;;;OAIG;IACH,KAAK,CAAC,cAAc,CAClB,YAA2B;QAE3B,IAAI,CAAC;YACH,IAAI,YAAY,EAAE,CAAC;gBACjB,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,uBAAuB,CAClD,KAAK,EACL,YAAY,CAAC,qBAAqB,EAClC,YAAY,CACb,CAAC;YACJ,CAAC;YACD,OAAO,MAAM,IAAI,CAAC,UAAU,CAAC,OAAO,CAClC,KAAK,EACL,YAAY,CAAC,qBAAqB,CACnC,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,mCAAmC,EAAE,KAAK,CAAC,CAAC;YAC1D,MAAM,KAAK,CAAC;QACd,CAAC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CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,OAAO,CAAC,KAAK,CAAC,gCAAgC,EAAE,KAAK,CAAC,CAAC;YACvD,MAAM,KAAK,CAAC;QACd,CAAC;IACH,CAAC;;AAlHH,oCAmHC;AAlHC,wCAAwC;AAChB,kCAAqB,GAAG,2BAA2B,CAAC;AACpD,yCAA4B,GAAG,oBAAoB,CAAC;AACpD,8BAAiB,GAAG,uBAAuB,CAAC;AAC5C,6BAAgB,GAAG,sBAAsB,CAAC"}
@@ -0,0 +1,43 @@
1
+ /**
2
+ * Auth User API client
3
+ * Handles user info, logout, and callback
4
+ */
5
+ import { HttpClient } from '../utils/http-client';
6
+ import { AuthStrategy } from '../types/config.types';
7
+ import { GetUserResponse, LogoutResponse, CallbackRequest, CallbackResponse } from './types/auth.types';
8
+ /**
9
+ * Auth User API class
10
+ * Handles user-related endpoints
11
+ */
12
+ export declare class AuthUserApi {
13
+ private httpClient;
14
+ private static readonly USER_ENDPOINT;
15
+ private static readonly LOGOUT_ENDPOINT;
16
+ private static readonly CALLBACK_ENDPOINT;
17
+ constructor(httpClient: HttpClient);
18
+ /**
19
+ * Get current user information
20
+ * @param authStrategy - Optional authentication strategy override
21
+ * @returns User response with user info and authenticated status
22
+ */
23
+ getUser(authStrategy?: AuthStrategy): Promise<GetUserResponse>;
24
+ /**
25
+ * Logout user
26
+ * @returns Logout response with success message
27
+ */
28
+ logout(): Promise<LogoutResponse>;
29
+ /**
30
+ * Logout user with token
31
+ * @param token - User access token to invalidate
32
+ * @returns Logout response with success message
33
+ */
34
+ logoutWithToken(token: string): Promise<LogoutResponse>;
35
+ /**
36
+ * Handle OAuth2 callback
37
+ * @param params - Callback request parameters (query params)
38
+ * @param authStrategy - Optional authentication strategy override
39
+ * @returns Callback response with success message
40
+ */
41
+ handleCallback(params: CallbackRequest, authStrategy?: AuthStrategy): Promise<CallbackResponse>;
42
+ }
43
+ //# sourceMappingURL=auth-user.api.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-user.api.d.ts","sourceRoot":"","sources":["../../src/api/auth-user.api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,sBAAsB,CAAC;AAClD,OAAO,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AACrD,OAAO,EACL,eAAe,EACf,cAAc,EACd,eAAe,EACf,gBAAgB,EACjB,MAAM,oBAAoB,CAAC;AAE5B;;;GAGG;AACH,qBAAa,WAAW;IAMV,OAAO,CAAC,UAAU;IAJ9B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAuB;IAC5D,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,eAAe,CAAyB;IAChE,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,iBAAiB,CAA2B;gBAEhD,UAAU,EAAE,UAAU;IAE1C;;;;OAIG;IACG,OAAO,CAAC,YAAY,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,eAAe,CAAC;IA0BpE;;;OAGG;IACG,MAAM,IAAI,OAAO,CAAC,cAAc,CAAC;IAYvC;;;;OAIG;IACG,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,cAAc,CAAC;IAa7D;;;;;OAKG;IACG,cAAc,CAClB,MAAM,EAAE,eAAe,EACvB,YAAY,CAAC,EAAE,YAAY,GAC1B,OAAO,CAAC,gBAAgB,CAAC;CAsB7B"}