win-portal-auth-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.
Files changed (48) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +239 -0
  3. package/dist/client/api/auth.api.d.ts +34 -0
  4. package/dist/client/api/auth.api.d.ts.map +1 -0
  5. package/dist/client/api/auth.api.js +48 -0
  6. package/dist/client/api/event-log.api.d.ts +24 -0
  7. package/dist/client/api/event-log.api.d.ts.map +1 -0
  8. package/dist/client/api/event-log.api.js +29 -0
  9. package/dist/client/api/files.api.d.ts +59 -0
  10. package/dist/client/api/files.api.d.ts.map +1 -0
  11. package/dist/client/api/files.api.js +77 -0
  12. package/dist/client/api/health.api.d.ts +21 -0
  13. package/dist/client/api/health.api.d.ts.map +1 -0
  14. package/dist/client/api/health.api.js +35 -0
  15. package/dist/client/api/index.d.ts +11 -0
  16. package/dist/client/api/index.d.ts.map +1 -0
  17. package/dist/client/api/index.js +18 -0
  18. package/dist/client/api/system-config.api.d.ts +37 -0
  19. package/dist/client/api/system-config.api.d.ts.map +1 -0
  20. package/dist/client/api/system-config.api.js +45 -0
  21. package/dist/client/auth-client.d.ts +67 -0
  22. package/dist/client/auth-client.d.ts.map +1 -0
  23. package/dist/client/auth-client.js +133 -0
  24. package/dist/client/index.d.ts +5 -0
  25. package/dist/client/index.d.ts.map +1 -0
  26. package/dist/client/index.js +8 -0
  27. package/dist/index.d.ts +9 -0
  28. package/dist/index.d.ts.map +1 -0
  29. package/dist/index.js +26 -0
  30. package/dist/types/auth.types.d.ts +76 -0
  31. package/dist/types/auth.types.d.ts.map +1 -0
  32. package/dist/types/auth.types.js +7 -0
  33. package/dist/types/event-log.interfaces.d.ts +108 -0
  34. package/dist/types/event-log.interfaces.d.ts.map +1 -0
  35. package/dist/types/event-log.interfaces.js +7 -0
  36. package/dist/types/event-log.types.d.ts +64 -0
  37. package/dist/types/event-log.types.d.ts.map +1 -0
  38. package/dist/types/event-log.types.js +66 -0
  39. package/dist/types/file.types.d.ts +75 -0
  40. package/dist/types/file.types.d.ts.map +1 -0
  41. package/dist/types/file.types.js +7 -0
  42. package/dist/types/index.d.ts +71 -0
  43. package/dist/types/index.d.ts.map +1 -0
  44. package/dist/types/index.js +28 -0
  45. package/dist/types/system-config.types.d.ts +42 -0
  46. package/dist/types/system-config.types.d.ts.map +1 -0
  47. package/dist/types/system-config.types.js +7 -0
  48. package/package.json +49 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"system-config.api.d.ts","sourceRoot":"","sources":["../../../src/client/api/system-config.api.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAE,uBAAuB,EAAE,wBAAwB,EAAE,4BAA4B,EAAE,MAAM,aAAa,CAAC;AAE9G;;;;GAIG;AACH,qBAAa,eAAe;IACd,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,UAAU;IAEtC;;;OAGG;IACG,MAAM,CAAC,MAAM,CAAC,EAAE,wBAAwB,GAAG,OAAO,CAAC;QACvD,IAAI,EAAE,uBAAuB,EAAE,CAAC;QAChC,KAAK,EAAE,MAAM,CAAC;QACd,IAAI,EAAE,MAAM,CAAC;QACb,SAAS,EAAE,MAAM,CAAC;KACnB,CAAC;IAKF;;;OAGG;IACG,aAAa,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,4BAA4B,CAAC;IAK5E;;;OAGG;IACG,mBAAmB,CAAC,QAAQ,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,uBAAuB,CAAC;IAK1F;;;OAGG;IACG,QAAQ,IAAI,OAAO,CAAC,4BAA4B,CAAC;CAGxD"}
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SystemConfigAPI = void 0;
4
+ /**
5
+ * System Config API
6
+ * Methods for retrieving system configurations
7
+ * Based on: apps/api/src/modules/shared/core/controllers/system-config.controller.ts
8
+ */
9
+ class SystemConfigAPI {
10
+ constructor(client) {
11
+ this.client = client;
12
+ }
13
+ /**
14
+ * GET /system-configs
15
+ * ดึงรายการ system configs (with pagination)
16
+ */
17
+ async search(params) {
18
+ const response = await this.client.get('/system-configs', { params });
19
+ return response.data;
20
+ }
21
+ /**
22
+ * GET /system-configs/categories/:category
23
+ * ดึง configs ตาม category - ส่ง object ที่รวมทุก key เป็น { key1: value1, key2: value2 }
24
+ */
25
+ async getByCategory(category) {
26
+ const response = await this.client.get(`/system-configs/categories/${category}`);
27
+ return response.data;
28
+ }
29
+ /**
30
+ * GET /system-configs/categories/:category/:key
31
+ * ดึง config ตาม category และ key - ส่ง full metadata row
32
+ */
33
+ async getByCategoryAndKey(category, key) {
34
+ const response = await this.client.get(`/system-configs/categories/${category}/${key}`);
35
+ return response.data;
36
+ }
37
+ /**
38
+ * GET /system-configs/categories/security
39
+ * ดึง security configs ทั้งหมด (convenience method)
40
+ */
41
+ async security() {
42
+ return this.getByCategory('security');
43
+ }
44
+ }
45
+ exports.SystemConfigAPI = SystemConfigAPI;
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Frontend Auth Client
3
+ *
4
+ * HTTP client สำหรับ frontend applications (Next.js, React)
5
+ * - Automatically injects API key in headers
6
+ * - Built on top of axios for consistency
7
+ */
8
+ import { AxiosInstance, AxiosRequestConfig, AxiosResponse } from 'axios';
9
+ import { AuthSdkConfig } from '../types';
10
+ import { AuthAPI, HealthAPI, SystemConfigAPI, FilesAPI, EventLogApi } from './api';
11
+ export declare class AuthClient {
12
+ private client;
13
+ private apiKey;
14
+ private apiKeyHeader;
15
+ private token;
16
+ readonly auth: AuthAPI;
17
+ readonly health: HealthAPI;
18
+ readonly systemConfig: SystemConfigAPI;
19
+ readonly files: FilesAPI;
20
+ readonly eventLog: EventLogApi;
21
+ constructor(config: AuthSdkConfig);
22
+ /**
23
+ * GET request
24
+ */
25
+ get<T = any>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
26
+ /**
27
+ * POST request
28
+ */
29
+ post<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
30
+ /**
31
+ * PUT request
32
+ */
33
+ put<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
34
+ /**
35
+ * PATCH request
36
+ */
37
+ patch<T = any>(url: string, data?: any, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
38
+ /**
39
+ * DELETE request
40
+ */
41
+ delete<T = any>(url: string, config?: AxiosRequestConfig): Promise<AxiosResponse<T>>;
42
+ /**
43
+ * Update API key
44
+ */
45
+ setApiKey(apiKey: string): void;
46
+ /**
47
+ * Get current API key (masked)
48
+ */
49
+ getApiKeyMasked(): string;
50
+ /**
51
+ * Set JWT token for authenticated requests
52
+ */
53
+ setToken(token: string): void;
54
+ /**
55
+ * Get current token (masked)
56
+ */
57
+ getTokenMasked(): string;
58
+ /**
59
+ * Clear JWT token
60
+ */
61
+ clearToken(): void;
62
+ /**
63
+ * Get axios instance for advanced usage
64
+ */
65
+ getAxiosInstance(): AxiosInstance;
66
+ }
67
+ //# sourceMappingURL=auth-client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth-client.d.ts","sourceRoot":"","sources":["../../src/client/auth-client.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAc,EAAE,aAAa,EAAE,kBAAkB,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAChF,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,OAAO,CAAC;AAEnF,qBAAa,UAAU;IACrB,OAAO,CAAC,MAAM,CAAgB;IAC9B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,YAAY,CAAS;IAC7B,OAAO,CAAC,KAAK,CAAuB;IAGpC,SA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AI7B;;OAEG;IACH,cAAc,IAAI,MAAM;IAOxB;;OAEG;IACH,UAAU,IAAI,IAAI;IAIlB;;OAEG;IACH,gBAAgB,IAAI,aAAa;CAGlC"}
@@ -0,0 +1,133 @@
1
+ "use strict";
2
+ /**
3
+ * Frontend Auth Client
4
+ *
5
+ * HTTP client สำหรับ frontend applications (Next.js, React)
6
+ * - Automatically injects API key in headers
7
+ * - Built on top of axios for consistency
8
+ */
9
+ var __importDefault = (this && this.__importDefault) || function (mod) {
10
+ return (mod && mod.__esModule) ? mod : { "default": mod };
11
+ };
12
+ Object.defineProperty(exports, "__esModule", { value: true });
13
+ exports.AuthClient = void 0;
14
+ const axios_1 = __importDefault(require("axios"));
15
+ const api_1 = require("./api");
16
+ class AuthClient {
17
+ constructor(config) {
18
+ this.token = null;
19
+ this.apiKey = config.apiKey;
20
+ this.apiKeyHeader = config.apiKeyHeader || 'X-API-Key';
21
+ this.client = axios_1.default.create({
22
+ baseURL: config.baseURL,
23
+ timeout: config.timeout || 30000,
24
+ headers: {
25
+ 'Content-Type': 'application/json',
26
+ },
27
+ });
28
+ // Add request interceptor to inject API key
29
+ this.client.interceptors.request.use((requestConfig) => {
30
+ if (requestConfig.headers) {
31
+ requestConfig.headers[this.apiKeyHeader] = this.apiKey;
32
+ // Inject JWT token if available
33
+ if (this.token) {
34
+ requestConfig.headers['Authorization'] = `Bearer ${this.token}`;
35
+ }
36
+ }
37
+ return requestConfig;
38
+ }, (error) => {
39
+ return Promise.reject(error);
40
+ });
41
+ // Add response interceptor for error handling
42
+ this.client.interceptors.response.use((response) => response, (error) => {
43
+ if (error.response?.status === 401) {
44
+ console.error('[AuthClient] API Key authentication failed');
45
+ }
46
+ else if (error.response?.status === 429) {
47
+ console.error('[AuthClient] Rate limit exceeded');
48
+ }
49
+ return Promise.reject(error);
50
+ });
51
+ // Initialize namespaced APIs
52
+ this.auth = new api_1.AuthAPI(this);
53
+ this.health = new api_1.HealthAPI(this);
54
+ this.systemConfig = new api_1.SystemConfigAPI(this);
55
+ this.files = new api_1.FilesAPI(this);
56
+ this.eventLog = new api_1.EventLogApi(this);
57
+ }
58
+ /**
59
+ * GET request
60
+ */
61
+ async get(url, config) {
62
+ return this.client.get(url, config);
63
+ }
64
+ /**
65
+ * POST request
66
+ */
67
+ async post(url, data, config) {
68
+ return this.client.post(url, data, config);
69
+ }
70
+ /**
71
+ * PUT request
72
+ */
73
+ async put(url, data, config) {
74
+ return this.client.put(url, data, config);
75
+ }
76
+ /**
77
+ * PATCH request
78
+ */
79
+ async patch(url, data, config) {
80
+ return this.client.patch(url, data, config);
81
+ }
82
+ /**
83
+ * DELETE request
84
+ */
85
+ async delete(url, config) {
86
+ return this.client.delete(url, config);
87
+ }
88
+ /**
89
+ * Update API key
90
+ */
91
+ setApiKey(apiKey) {
92
+ this.apiKey = apiKey;
93
+ }
94
+ /**
95
+ * Get current API key (masked)
96
+ */
97
+ getApiKeyMasked() {
98
+ if (!this.apiKey)
99
+ return '';
100
+ const prefix = this.apiKey.substring(0, 10);
101
+ return `${prefix}...`;
102
+ }
103
+ /**
104
+ * Set JWT token for authenticated requests
105
+ */
106
+ setToken(token) {
107
+ this.token = token;
108
+ }
109
+ /**
110
+ * Get current token (masked)
111
+ */
112
+ getTokenMasked() {
113
+ if (!this.token)
114
+ return '';
115
+ const parts = this.token.split('.');
116
+ if (parts.length !== 3)
117
+ return 'Invalid token';
118
+ return `${parts[0].substring(0, 10)}...`;
119
+ }
120
+ /**
121
+ * Clear JWT token
122
+ */
123
+ clearToken() {
124
+ this.token = null;
125
+ }
126
+ /**
127
+ * Get axios instance for advanced usage
128
+ */
129
+ getAxiosInstance() {
130
+ return this.client;
131
+ }
132
+ }
133
+ exports.AuthClient = AuthClient;
@@ -0,0 +1,5 @@
1
+ /**
2
+ * Client exports for frontend applications
3
+ */
4
+ export { AuthClient } from './auth-client';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ /**
3
+ * Client exports for frontend applications
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.AuthClient = void 0;
7
+ var auth_client_1 = require("./auth-client");
8
+ Object.defineProperty(exports, "AuthClient", { enumerable: true, get: function () { return auth_client_1.AuthClient; } });
@@ -0,0 +1,9 @@
1
+ /**
2
+ * @win-portal/auth-sdk
3
+ *
4
+ * Authentication SDK for Win Portal applications
5
+ * Provides HTTP client with automatic API key injection
6
+ */
7
+ export * from './types';
8
+ export * from './client';
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,cAAc,SAAS,CAAC;AAGxB,cAAc,UAAU,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,26 @@
1
+ "use strict";
2
+ /**
3
+ * @win-portal/auth-sdk
4
+ *
5
+ * Authentication SDK for Win Portal applications
6
+ * Provides HTTP client with automatic API key injection
7
+ */
8
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
9
+ if (k2 === undefined) k2 = k;
10
+ var desc = Object.getOwnPropertyDescriptor(m, k);
11
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
12
+ desc = { enumerable: true, get: function() { return m[k]; } };
13
+ }
14
+ Object.defineProperty(o, k2, desc);
15
+ }) : (function(o, m, k, k2) {
16
+ if (k2 === undefined) k2 = k;
17
+ o[k2] = m[k];
18
+ }));
19
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
20
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
21
+ };
22
+ Object.defineProperty(exports, "__esModule", { value: true });
23
+ // Types
24
+ __exportStar(require("./types"), exports);
25
+ // Client (Frontend & Backend)
26
+ __exportStar(require("./client"), exports);
@@ -0,0 +1,76 @@
1
+ /**
2
+ * Auth DTOs
3
+ *
4
+ * Copied from @win-portal/shared for SDK independence
5
+ */
6
+ /**
7
+ * Login Request DTO
8
+ */
9
+ export interface LoginRequestDto {
10
+ username: string;
11
+ password: string;
12
+ totp_token?: string;
13
+ backup_code?: string;
14
+ }
15
+ /**
16
+ * Login Response DTO
17
+ */
18
+ export interface LoginResponseDto {
19
+ access_token: string;
20
+ refresh_token?: string;
21
+ expires_in?: number;
22
+ token_type?: string;
23
+ user: UserProfileResponseDto;
24
+ must_change_password?: boolean;
25
+ totp_required?: boolean;
26
+ message?: string;
27
+ }
28
+ /**
29
+ * User Profile Response DTO
30
+ */
31
+ export interface UserProfileResponseDto {
32
+ id: string;
33
+ email: string;
34
+ first_name: string;
35
+ last_name: string;
36
+ code: string;
37
+ avatar_file_id?: string;
38
+ avatar_url?: string;
39
+ phone_number?: string;
40
+ last_login_at?: string;
41
+ status: string;
42
+ permissions: string[];
43
+ roles: Array<{
44
+ id: string;
45
+ name: string;
46
+ }>;
47
+ positions?: Array<{
48
+ id: string;
49
+ name: string;
50
+ code: string;
51
+ type: string;
52
+ is_primary: boolean;
53
+ }>;
54
+ primary_position?: {
55
+ id: string;
56
+ name: string;
57
+ code: string;
58
+ type: string;
59
+ };
60
+ }
61
+ /**
62
+ * Token Refresh Request DTO
63
+ */
64
+ export interface TokenRefreshRequestDto {
65
+ refresh_token: string;
66
+ }
67
+ /**
68
+ * Token Refresh Response DTO
69
+ */
70
+ export interface TokenRefreshResponseDto {
71
+ access_token: string;
72
+ refresh_token?: string;
73
+ expires_in?: number;
74
+ token_type?: string;
75
+ }
76
+ //# sourceMappingURL=auth.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.types.d.ts","sourceRoot":"","sources":["../../src/types/auth.types.ts"],"names":[],"mappings":"AAAA;;;;G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;QACjB,EAAE,EAAE,MAAM,CAAC;QACX,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KACd,CAAC;CACH;AAED;;GAEG;AACH,MAAM,WAAW,sBAAsB;IACrC,aAAa,EAAE,MAAM,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,uBAAuB;IACtC,YAAY,EAAE,MAAM,CAAC;IACrB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Auth DTOs
4
+ *
5
+ * Copied from @win-portal/shared for SDK independence
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,108 @@
1
+ /**
2
+ * Event Log Interfaces
3
+ *
4
+ * Copied from @win-portal/shared for SDK independence
5
+ */
6
+ import { ActorType, EventSeverity, EventOutcome, EventCategory, EventRiskLevel } from './event-log.types';
7
+ /**
8
+ * Event Log Actor Information
9
+ */
10
+ export interface IEventLogActor {
11
+ type: ActorType;
12
+ id?: string;
13
+ name?: string;
14
+ session_id?: string;
15
+ ip_address?: string;
16
+ user_agent?: string;
17
+ }
18
+ /**
19
+ * Event Log Target Information
20
+ */
21
+ export interface IEventLogTarget {
22
+ type: string;
23
+ id?: string;
24
+ name?: string;
25
+ }
26
+ /**
27
+ * Event Log Error Information
28
+ */
29
+ export interface IEventLogError {
30
+ code?: string;
31
+ message?: string;
32
+ details?: any;
33
+ }
34
+ /**
35
+ * Create Event Log Request DTO
36
+ *
37
+ * Complete interface for creating event logs
38
+ */
39
+ export interface CreateEventLogRequestDto {
40
+ source: string;
41
+ event_type: string;
42
+ subject?: string;
43
+ event_time?: Date | string;
44
+ application_id?: string | null;
45
+ application_code?: string;
46
+ severity?: EventSeverity;
47
+ outcome?: EventOutcome;
48
+ category?: EventCategory;
49
+ risk_level?: EventRiskLevel;
50
+ actor?: IEventLogActor;
51
+ target?: IEventLogTarget;
52
+ action?: string;
53
+ message?: string;
54
+ before_state?: Record<string, any>;
55
+ after_state?: Record<string, any>;
56
+ changed_fields?: Record<string, any>;
57
+ metadata?: Record<string, any>;
58
+ tags?: string[];
59
+ error?: IEventLogError;
60
+ trace_id?: string;
61
+ span_id?: string;
62
+ parent_span_id?: string;
63
+ trace_flags?: string;
64
+ correlation_id?: string;
65
+ request_id?: string;
66
+ business_reason?: string;
67
+ application_version?: string;
68
+ service_version?: string;
69
+ performance?: {
70
+ duration_ms?: number;
71
+ resource_usage?: Record<string, any>;
72
+ };
73
+ requires_approval?: boolean;
74
+ approval?: {
75
+ required: boolean;
76
+ approved_by?: string;
77
+ approved_at?: Date;
78
+ rejected_by?: string;
79
+ rejected_at?: Date;
80
+ reason?: string;
81
+ };
82
+ review?: {
83
+ required: boolean;
84
+ reviewed_by?: string;
85
+ reviewed_at?: Date;
86
+ status?: 'pending' | 'approved' | 'rejected';
87
+ notes?: string;
88
+ };
89
+ retention_period?: string;
90
+ expires_at?: Date;
91
+ }
92
+ /**
93
+ * Event Log Response DTO
94
+ */
95
+ export interface EventLogResponseDto {
96
+ id: string;
97
+ source: string;
98
+ event_type: string;
99
+ subject?: string;
100
+ event_time: string;
101
+ severity: string;
102
+ outcome: string;
103
+ category?: string;
104
+ risk_level?: string;
105
+ created_at: string;
106
+ updated_at: string;
107
+ }
108
+ //# sourceMappingURL=event-log.interfaces.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-log.interfaces.d.ts","sourceRoot":"","sources":["../../src/types/event-log.interfaces.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,SAAS,EAAE,aAAa,EAAE,YAAY,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AAE1G;;GAEG;AACH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,SAAS,CAAC;IACh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;AAED;;GAEG;AACH,MAAM,WAAW,mBAAmB;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;CACpB"}
@@ -0,0 +1,7 @@
1
+ "use strict";
2
+ /**
3
+ * Event Log Interfaces
4
+ *
5
+ * Copied from @win-portal/shared for SDK independence
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,64 @@
1
+ /**
2
+ * Event Log Enums
3
+ *
4
+ * Copied from @win-portal/shared for SDK independence
5
+ */
6
+ /**
7
+ * Event severity levels
8
+ */
9
+ export declare enum EventSeverity {
10
+ DEBUG = "debug",
11
+ INFO = "info",
12
+ WARNING = "warning",
13
+ ERROR = "error",
14
+ CRITICAL = "critical"
15
+ }
16
+ /**
17
+ * Event outcome
18
+ */
19
+ export declare enum EventOutcome {
20
+ SUCCESS = "success",
21
+ FAILURE = "failure",
22
+ PARTIAL = "partial",
23
+ UNKNOWN = "unknown"
24
+ }
25
+ /**
26
+ * Event categories (ISO 27001 Compliant)
27
+ */
28
+ export declare enum EventCategory {
29
+ AUTHENTICATION = "authentication",
30
+ AUTHORIZATION = "authorization",
31
+ DATA_ACCESS = "data_access",
32
+ SECURITY = "security",
33
+ BUSINESS = "business",
34
+ TECHNICAL = "technical",
35
+ COMPLIANCE = "compliance",
36
+ ISO27001_AUDIT = "iso27001_audit"
37
+ }
38
+ /**
39
+ * Risk levels
40
+ */
41
+ export declare enum EventRiskLevel {
42
+ NONE = "none",
43
+ LOW = "low",
44
+ MEDIUM = "medium",
45
+ HIGH = "high",
46
+ CRITICAL = "critical"
47
+ }
48
+ /**
49
+ * Actor types
50
+ */
51
+ export declare enum ActorType {
52
+ USER = "user",
53
+ SYSTEM = "system",
54
+ SERVICE = "service",
55
+ API_CLIENT = "api_client",
56
+ SCHEDULER = "scheduler",
57
+ WEBHOOK = "webhook"
58
+ }
59
+ export type EventSeverityType = `${EventSeverity}`;
60
+ export type EventOutcomeType = `${EventOutcome}`;
61
+ export type EventCategoryType = `${EventCategory}`;
62
+ export type EventRiskLevelType = `${EventRiskLevel}`;
63
+ export type ActorTypeType = `${ActorType}`;
64
+ //# sourceMappingURL=event-log.types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"event-log.types.d.ts","sourceRoot":"","sources":["../../src/types/event-log.types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,oBAAY,aAAa;IACvB,KAAK,UAAU;IACf,IAAI,SAAS;IACb,OAAO,YAAY;IACnB,KAAK,UAAU;IACf,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;IACnB,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,aAAa;IACvB,cAAc,mBAAmB;IACjC,aAAa,kBAAkB;IAC/B,WAAW,gBAAgB;IAC3B,QAAQ,aAAa;IACrB,QAAQ,aAAa;IACrB,SAAS,cAAc;IACvB,UAAU,eAAe;IACzB,cAAc,mBAAmB;CAClC;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,IAAI,SAAS;IACb,GAAG,QAAQ;IACX,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,QAAQ,aAAa;CACtB;AAED;;GAEG;AACH,oBAAY,SAAS;IACnB,IAAI,SAAS;IACb,MAAM,WAAW;IACjB,OAAO,YAAY;IACnB,UAAU,eAAe;IACzB,SAAS,cAAc;IACvB,OAAO,YAAY;CACpB;AAGD,MAAM,MAAM,iBAAiB,GAAG,GAAG,aAAa,EAAE,CAAC;AACnD,MAAM,MAAM,gBAAgB,GAAG,GAAG,YAAY,EAAE,CAAC;AACjD,MAAM,MAAM,iBAAiB,GAAG,GAAG,aAAa,EAAE,CAAC;AACnD,MAAM,MAAM,kBAAkB,GAAG,GAAG,cAAc,EAAE,CAAC;AACrD,MAAM,MAAM,aAAa,GAAG,GAAG,SAAS,EAAE,CAAC"}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ /**
3
+ * Event Log Enums
4
+ *
5
+ * Copied from @win-portal/shared for SDK independence
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.ActorType = exports.EventRiskLevel = exports.EventCategory = exports.EventOutcome = exports.EventSeverity = void 0;
9
+ /**
10
+ * Event severity levels
11
+ */
12
+ var EventSeverity;
13
+ (function (EventSeverity) {
14
+ EventSeverity["DEBUG"] = "debug";
15
+ EventSeverity["INFO"] = "info";
16
+ EventSeverity["WARNING"] = "warning";
17
+ EventSeverity["ERROR"] = "error";
18
+ EventSeverity["CRITICAL"] = "critical";
19
+ })(EventSeverity || (exports.EventSeverity = EventSeverity = {}));
20
+ /**
21
+ * Event outcome
22
+ */
23
+ var EventOutcome;
24
+ (function (EventOutcome) {
25
+ EventOutcome["SUCCESS"] = "success";
26
+ EventOutcome["FAILURE"] = "failure";
27
+ EventOutcome["PARTIAL"] = "partial";
28
+ EventOutcome["UNKNOWN"] = "unknown";
29
+ })(EventOutcome || (exports.EventOutcome = EventOutcome = {}));
30
+ /**
31
+ * Event categories (ISO 27001 Compliant)
32
+ */
33
+ var EventCategory;
34
+ (function (EventCategory) {
35
+ EventCategory["AUTHENTICATION"] = "authentication";
36
+ EventCategory["AUTHORIZATION"] = "authorization";
37
+ EventCategory["DATA_ACCESS"] = "data_access";
38
+ EventCategory["SECURITY"] = "security";
39
+ EventCategory["BUSINESS"] = "business";
40
+ EventCategory["TECHNICAL"] = "technical";
41
+ EventCategory["COMPLIANCE"] = "compliance";
42
+ EventCategory["ISO27001_AUDIT"] = "iso27001_audit";
43
+ })(EventCategory || (exports.EventCategory = EventCategory = {}));
44
+ /**
45
+ * Risk levels
46
+ */
47
+ var EventRiskLevel;
48
+ (function (EventRiskLevel) {
49
+ EventRiskLevel["NONE"] = "none";
50
+ EventRiskLevel["LOW"] = "low";
51
+ EventRiskLevel["MEDIUM"] = "medium";
52
+ EventRiskLevel["HIGH"] = "high";
53
+ EventRiskLevel["CRITICAL"] = "critical";
54
+ })(EventRiskLevel || (exports.EventRiskLevel = EventRiskLevel = {}));
55
+ /**
56
+ * Actor types
57
+ */
58
+ var ActorType;
59
+ (function (ActorType) {
60
+ ActorType["USER"] = "user";
61
+ ActorType["SYSTEM"] = "system";
62
+ ActorType["SERVICE"] = "service";
63
+ ActorType["API_CLIENT"] = "api_client";
64
+ ActorType["SCHEDULER"] = "scheduler";
65
+ ActorType["WEBHOOK"] = "webhook";
66
+ })(ActorType || (exports.ActorType = ActorType = {}));