@eminuckan/spine 0.2.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/CHANGELOG.md +47 -0
- package/LICENSE +21 -0
- package/README.md +425 -0
- package/dist/api-client/index.d.ts +3 -0
- package/dist/api-client/index.js +4 -0
- package/dist/api-client/server.d.ts +4 -0
- package/dist/api-client/server.js +5 -0
- package/dist/api-client-Ftxqm3Ep.js +212 -0
- package/dist/api-client-Ftxqm3Ep.js.map +1 -0
- package/dist/auth/index.d.ts +2 -0
- package/dist/auth/index.js +0 -0
- package/dist/auth/server.d.ts +3 -0
- package/dist/auth/server.js +6 -0
- package/dist/auth.server-C979TR6W.js +724 -0
- package/dist/auth.server-C979TR6W.js.map +1 -0
- package/dist/auth.server-DU-x2LPA.js +5 -0
- package/dist/identity/index.d.ts +4 -0
- package/dist/identity/index.js +3 -0
- package/dist/identity/server.d.ts +4 -0
- package/dist/identity/server.js +4 -0
- package/dist/identity-CFa1txoj.js +235 -0
- package/dist/identity-CFa1txoj.js.map +1 -0
- package/dist/index-BIJOC8Fb.d.ts +272 -0
- package/dist/index-BIJOC8Fb.d.ts.map +1 -0
- package/dist/index-Bt9XE6gj.d.ts +104 -0
- package/dist/index-Bt9XE6gj.d.ts.map +1 -0
- package/dist/index-C2hGpzGr.d.ts +74 -0
- package/dist/index-C2hGpzGr.d.ts.map +1 -0
- package/dist/index-CfQsb3l_.d.ts +170 -0
- package/dist/index-CfQsb3l_.d.ts.map +1 -0
- package/dist/index-D6RK_5vm.d.ts +199 -0
- package/dist/index-D6RK_5vm.d.ts.map +1 -0
- package/dist/index-DrttYPAj.d.ts +30 -0
- package/dist/index-DrttYPAj.d.ts.map +1 -0
- package/dist/index-geY2ynnN.d.ts +141 -0
- package/dist/index-geY2ynnN.d.ts.map +1 -0
- package/dist/index-kr8Wk7v5.d.ts +1 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +10 -0
- package/dist/logging/index.d.ts +3 -0
- package/dist/logging/index.js +3 -0
- package/dist/logging-_h2mi3L9.js +118 -0
- package/dist/logging-_h2mi3L9.js.map +1 -0
- package/dist/permissions/index.d.ts +2 -0
- package/dist/permissions/index.js +3 -0
- package/dist/permissions-D5ScGGnd.js +281 -0
- package/dist/permissions-D5ScGGnd.js.map +1 -0
- package/dist/query-client/index.d.ts +2 -0
- package/dist/query-client/index.js +3 -0
- package/dist/query-client-DRPQIKHX.js +174 -0
- package/dist/query-client-DRPQIKHX.js.map +1 -0
- package/dist/react-router/index.d.ts +12 -0
- package/dist/react-router/index.js +10 -0
- package/dist/react-router/server.d.ts +18 -0
- package/dist/react-router/server.js +17 -0
- package/dist/redis-session-storage.server-DhufyPjd.js +250 -0
- package/dist/redis-session-storage.server-DhufyPjd.js.map +1 -0
- package/dist/server-BoeUiXSh.d.ts +40 -0
- package/dist/server-BoeUiXSh.d.ts.map +1 -0
- package/dist/server-C-DiVP9e.js +185 -0
- package/dist/server-C-DiVP9e.js.map +1 -0
- package/dist/server-CLbksnvg.d.ts +144 -0
- package/dist/server-CLbksnvg.d.ts.map +1 -0
- package/dist/server-CNp6gjFE.js +78 -0
- package/dist/server-CNp6gjFE.js.map +1 -0
- package/dist/server-CXGaRaiS.d.ts +256 -0
- package/dist/server-CXGaRaiS.d.ts.map +1 -0
- package/dist/server-CiSbg-9C.js +352 -0
- package/dist/server-CiSbg-9C.js.map +1 -0
- package/dist/server-DLgH3FRR.js +312 -0
- package/dist/server-DLgH3FRR.js.map +1 -0
- package/dist/server-DazqdM63.d.ts +93 -0
- package/dist/server-DazqdM63.d.ts.map +1 -0
- package/dist/server-iWm3oeCM.js +145 -0
- package/dist/server-iWm3oeCM.js.map +1 -0
- package/dist/server-zEKMDpP7.d.ts +80 -0
- package/dist/server-zEKMDpP7.d.ts.map +1 -0
- package/dist/server.d.ts +18 -0
- package/dist/server.js +17 -0
- package/dist/signalr/index.d.ts +4 -0
- package/dist/signalr/index.js +3 -0
- package/dist/signalr-BJGcXc0m.js +274 -0
- package/dist/signalr-BJGcXc0m.js.map +1 -0
- package/dist/src-D7mh9MKA.js +0 -0
- package/dist/tenant/index.d.ts +3 -0
- package/dist/tenant/index.js +3 -0
- package/dist/tenant/server.d.ts +3 -0
- package/dist/tenant/server.js +5 -0
- package/dist/tenant-C6KPaSCX.js +256 -0
- package/dist/tenant-C6KPaSCX.js.map +1 -0
- package/dist/types-BTjFzIhv.d.ts +31 -0
- package/dist/types-BTjFzIhv.d.ts.map +1 -0
- package/dist/types-DoIfDhl6.d.ts +55 -0
- package/dist/types-DoIfDhl6.d.ts.map +1 -0
- package/dist/types-DufLRY7A.d.ts +164 -0
- package/dist/types-DufLRY7A.d.ts.map +1 -0
- package/dist/types-uDrDMkCq.d.ts +93 -0
- package/dist/types-uDrDMkCq.d.ts.map +1 -0
- package/package.json +147 -0
|
@@ -0,0 +1,199 @@
|
|
|
1
|
+
//#region src/api-client/types.d.ts
|
|
2
|
+
|
|
3
|
+
interface APIConfig {
|
|
4
|
+
basePath: string;
|
|
5
|
+
accessToken?: string;
|
|
6
|
+
headers: Record<string, string>;
|
|
7
|
+
tenantId: string;
|
|
8
|
+
baseOptions?: {
|
|
9
|
+
timeout?: number;
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
interface CreateAPIConfigOptions {
|
|
13
|
+
requireTenant?: boolean;
|
|
14
|
+
includeAuth?: boolean;
|
|
15
|
+
tenantId?: string;
|
|
16
|
+
customHeaders?: Record<string, string>;
|
|
17
|
+
}
|
|
18
|
+
interface ProblemDetails {
|
|
19
|
+
type: string;
|
|
20
|
+
title: string;
|
|
21
|
+
status: number;
|
|
22
|
+
detail: string;
|
|
23
|
+
traceId: string;
|
|
24
|
+
requestId?: string;
|
|
25
|
+
instance?: string;
|
|
26
|
+
meta?: {
|
|
27
|
+
errors?: ValidationError[];
|
|
28
|
+
[key: string]: unknown;
|
|
29
|
+
};
|
|
30
|
+
}
|
|
31
|
+
interface ValidationError {
|
|
32
|
+
field: string;
|
|
33
|
+
message: string;
|
|
34
|
+
code?: string;
|
|
35
|
+
}
|
|
36
|
+
interface RetryConfig {
|
|
37
|
+
maxRetries?: number;
|
|
38
|
+
baseDelay?: number;
|
|
39
|
+
maxDelay?: number;
|
|
40
|
+
retryCondition?: (error: unknown) => boolean;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* API Logger interface for dependency injection (simplified)
|
|
44
|
+
*/
|
|
45
|
+
interface APILogger {
|
|
46
|
+
debug?: (message: string, context?: Record<string, unknown>) => void;
|
|
47
|
+
info?: (message: string, context?: Record<string, unknown>) => void;
|
|
48
|
+
warn?: (message: string, error?: Error, context?: Record<string, unknown>) => void;
|
|
49
|
+
error?: (message: string, error?: Error, context?: Record<string, unknown>) => void;
|
|
50
|
+
}
|
|
51
|
+
/**
|
|
52
|
+
* Function type for getting access token from request
|
|
53
|
+
*/
|
|
54
|
+
type GetAccessTokenFn = (request: Request) => Promise<string | null>;
|
|
55
|
+
/**
|
|
56
|
+
* Function type for getting current tenant from request
|
|
57
|
+
*/
|
|
58
|
+
type GetCurrentTenantFn = (request: Request) => Promise<string | null>;
|
|
59
|
+
/**
|
|
60
|
+
* Token refresh result
|
|
61
|
+
*/
|
|
62
|
+
interface TokenRefreshResult {
|
|
63
|
+
success: boolean;
|
|
64
|
+
newAccessToken?: string;
|
|
65
|
+
shouldLogout?: boolean;
|
|
66
|
+
error?: string;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Function type for attempting token refresh
|
|
70
|
+
*/
|
|
71
|
+
type TokenRefreshFn = (request: Request) => Promise<TokenRefreshResult>; //#endregion
|
|
72
|
+
//#region src/api-client/error-codes.d.ts
|
|
73
|
+
|
|
74
|
+
//# sourceMappingURL=types.d.ts.map
|
|
75
|
+
/**
|
|
76
|
+
* Error Codes
|
|
77
|
+
*
|
|
78
|
+
* Standard error codes from backend.
|
|
79
|
+
*/
|
|
80
|
+
declare const ErrorCodes: {
|
|
81
|
+
readonly Validation: {
|
|
82
|
+
readonly Failed: "ValidationFailed";
|
|
83
|
+
};
|
|
84
|
+
readonly Identity: {
|
|
85
|
+
readonly InvalidCredentials: "InvalidCredentials";
|
|
86
|
+
readonly UserInactive: "UserInactive";
|
|
87
|
+
readonly TenantContextMissing: "TenantContextMissing";
|
|
88
|
+
readonly InvalidCurrentPassword: "InvalidCurrentPassword";
|
|
89
|
+
readonly OwnerCannotDisableMembership: "OwnerCannotDisableMembership";
|
|
90
|
+
readonly CurrentUserMissing: "CurrentUserMissing";
|
|
91
|
+
readonly UserNotFound: "UserNotFound";
|
|
92
|
+
readonly EmailAlreadyExists: "EmailAlreadyExists";
|
|
93
|
+
};
|
|
94
|
+
readonly Accounting: {
|
|
95
|
+
readonly OpeningBalanceLockedReconciliation: "OpeningBalanceLockedReconciliation";
|
|
96
|
+
readonly OpeningBalanceLockedJournal: "OpeningBalanceLockedJournal";
|
|
97
|
+
readonly SystemLocked: "SystemLocked";
|
|
98
|
+
readonly AccountsDuplicate: "AccountsDuplicate";
|
|
99
|
+
readonly AccountNotFound: "AccountNotFound";
|
|
100
|
+
};
|
|
101
|
+
readonly Subscription: {
|
|
102
|
+
readonly SubscriptionRequired: "SubscriptionRequired";
|
|
103
|
+
readonly SubscriptionExpired: "SubscriptionExpired";
|
|
104
|
+
readonly FeatureNotAvailable: "FeatureNotAvailable";
|
|
105
|
+
};
|
|
106
|
+
readonly PropertyManagement: {
|
|
107
|
+
readonly PropertyNotFound: "PropertyNotFound";
|
|
108
|
+
readonly UnitNotFound: "UnitNotFound";
|
|
109
|
+
readonly DuplicateProperty: "DuplicateProperty";
|
|
110
|
+
readonly DuplicateUnit: "DuplicateUnit";
|
|
111
|
+
};
|
|
112
|
+
readonly Leasing: {
|
|
113
|
+
readonly LeaseNotFound: "LeaseNotFound";
|
|
114
|
+
readonly LeaseConflict: "LeaseConflict";
|
|
115
|
+
readonly TenantNotFound: "TenantNotFound";
|
|
116
|
+
readonly LateFeeValidationError: "LateFeeValidationError";
|
|
117
|
+
};
|
|
118
|
+
readonly NotFound: "NotFound";
|
|
119
|
+
readonly Unauthorized: "Unauthorized";
|
|
120
|
+
readonly Forbidden: "Forbidden";
|
|
121
|
+
readonly InternalError: "InternalError";
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
//#endregion
|
|
125
|
+
//#region src/api-client/error-handler.d.ts
|
|
126
|
+
/**
|
|
127
|
+
* Check if error code is from PropertyManagement module
|
|
128
|
+
*/
|
|
129
|
+
/**
|
|
130
|
+
* API Error Class
|
|
131
|
+
*/
|
|
132
|
+
declare class ApiError extends Error {
|
|
133
|
+
problemDetails: ProblemDetails;
|
|
134
|
+
response: Response;
|
|
135
|
+
constructor(problemDetails: ProblemDetails, response: Response);
|
|
136
|
+
get code(): string;
|
|
137
|
+
get status(): number;
|
|
138
|
+
get isValidationError(): boolean;
|
|
139
|
+
get validationErrors(): ValidationError[];
|
|
140
|
+
get traceId(): string;
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Parse API error response
|
|
144
|
+
*/
|
|
145
|
+
declare function handleApiError(response: Response): Promise<never>;
|
|
146
|
+
/**
|
|
147
|
+
* Error Handler Configuration
|
|
148
|
+
*/
|
|
149
|
+
interface ErrorHandlerConfig {
|
|
150
|
+
handlers?: Partial<Record<string, (error: ApiError) => void>>;
|
|
151
|
+
showToast?: boolean;
|
|
152
|
+
toastMessages?: Partial<Record<string, string>>;
|
|
153
|
+
onError?: (error: ApiError) => void;
|
|
154
|
+
toast?: (message: string, type: 'error' | 'success' | 'info') => void;
|
|
155
|
+
}
|
|
156
|
+
/**
|
|
157
|
+
* Error Handler Class
|
|
158
|
+
*/
|
|
159
|
+
declare class ErrorHandler {
|
|
160
|
+
private config;
|
|
161
|
+
constructor(config?: ErrorHandlerConfig);
|
|
162
|
+
handle(error: ApiError): void;
|
|
163
|
+
private showToast;
|
|
164
|
+
private showDefaultToast;
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
//#endregion
|
|
168
|
+
//#region src/api-client/retry-handler.d.ts
|
|
169
|
+
/**
|
|
170
|
+
* Create global error handler
|
|
171
|
+
*/
|
|
172
|
+
/**
|
|
173
|
+
* Calculate backoff delay
|
|
174
|
+
*/
|
|
175
|
+
declare function calculateBackoffDelay(attempt: number, baseDelay: number, maxDelay: number): number;
|
|
176
|
+
/**
|
|
177
|
+
* Check if error is retryable
|
|
178
|
+
*/
|
|
179
|
+
declare function isRetryableError(error: unknown): boolean;
|
|
180
|
+
/**
|
|
181
|
+
* Execute function with retry logic
|
|
182
|
+
*/
|
|
183
|
+
declare function withRetry<T>(fn: () => Promise<T>, config?: RetryConfig): Promise<T>;
|
|
184
|
+
/**
|
|
185
|
+
* Fetch with timeout
|
|
186
|
+
*/
|
|
187
|
+
declare function fetchWithTimeout(input: RequestInfo | URL, init?: RequestInit & {
|
|
188
|
+
timeout?: number;
|
|
189
|
+
}): Promise<Response>;
|
|
190
|
+
/**
|
|
191
|
+
* Create fetch function with retry
|
|
192
|
+
*/
|
|
193
|
+
declare function createRetryFetch(config?: RetryConfig): (input: RequestInfo | URL, init?: RequestInit) => Promise<Response>;
|
|
194
|
+
|
|
195
|
+
//#endregion
|
|
196
|
+
//# sourceMappingURL=retry-handler.d.ts.map
|
|
197
|
+
|
|
198
|
+
export { APIConfig, APILogger, ApiError as ApiError$1, CreateAPIConfigOptions, ErrorCodes as ErrorCodes$1, ErrorHandler as ErrorHandler$1, GetAccessTokenFn, GetCurrentTenantFn, ProblemDetails, RetryConfig, TokenRefreshFn, TokenRefreshResult, ValidationError, calculateBackoffDelay as calculateBackoffDelay$1, createRetryFetch as createRetryFetch$1, fetchWithTimeout as fetchWithTimeout$1, handleApiError as handleApiError$1, isRetryableError as isRetryableError$1, withRetry as withRetry$1 };
|
|
199
|
+
//# sourceMappingURL=index-D6RK_5vm.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-D6RK_5vm.d.ts","names":[],"sources":["../src/api-client/types.ts","../src/api-client/error-codes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|
+
private config;
|
|
7
|
+
constructor(config?: Partial<LoggerConfig>);
|
|
8
|
+
debug(message: string, context?: LogContext): void;
|
|
9
|
+
info(message: string, context?: LogContext): void;
|
|
10
|
+
warn(message: string, context?: LogContext): void;
|
|
11
|
+
error(message: string, error?: Error, context?: LogContext): void;
|
|
12
|
+
private log;
|
|
13
|
+
private shouldLog;
|
|
14
|
+
private logToConsole;
|
|
15
|
+
private formatEntry;
|
|
16
|
+
private sendToRemote;
|
|
17
|
+
}
|
|
18
|
+
declare const logger: Logger;
|
|
19
|
+
declare function createLogger(config?: Partial<LoggerConfig>): Logger;
|
|
20
|
+
//#endregion
|
|
21
|
+
//#region src/logging/config.d.ts
|
|
22
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
23
|
+
declare const LOG_LEVEL_PRIORITY: Record<LogLevel, number>;
|
|
24
|
+
declare const defaultLoggerConfig: LoggerConfig;
|
|
25
|
+
|
|
26
|
+
//#endregion
|
|
27
|
+
//# sourceMappingURL=config.d.ts.map
|
|
28
|
+
|
|
29
|
+
export { LOG_LEVEL_PRIORITY as LOG_LEVEL_PRIORITY$1, Logger as Logger$1, createLogger as createLogger$1, defaultLoggerConfig as defaultLoggerConfig$1, logger as logger$1 };
|
|
30
|
+
//# sourceMappingURL=index-DrttYPAj.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-DrttYPAj.d.ts","names":[],"sources":["../src/logging/logger.ts","../src/logging/config.ts"],"sourcesContent":null,"mappings":";;;;AAYuB,cAHV,MAAA,CAGU;EAAO,QAOK,MAAA;EAAU,WAIX,CAAA,MAAA,CAAA,EAXX,OAWW,CAXH,YAWG,CAAA;EAAU,KAIV,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EARC,UAQD,CAAA,EAAA,IAAA;EAAU,IAIX,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EARC,UAQD,CAAA,EAAA,IAAA;EAAK,IAAY,CAAA,OAAA,EAAA,MAAA,EAAA,OAAA,CAAA,EAJhB,UAIgB,CAAA,EAAA,IAAA;EAAU,KAAA,CAAA,OAAA,EAAA,MAAA,EAAA,KAAA,CAAA,EAA3B,KAA2B,EAAA,OAAA,CAAA,EAAV,UAAU,CAAA,EAAA,IAAA;EA+F/C,QAAA,GAAqB;EAGlB,QAAA,SAAY;EAAA,QAAA,YAAA;EAAA,QAAkB,WAAA;EAAY,QAApB,YAAA;;AAA8B,cAHvD,MAGuD,EAHjD,MAGiD;iBAApD,YAAA,UAAsB,QAAQ,gBAAgB;;;;AAxH3C,cCHN,kBDGM,ECHc,MDGd,CCHqB,QDGrB,EAAA,MAAA,CAAA;AAGY,cCClB,mBDDkB,ECCG,YDDH"}
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import { IdentityContextChangeHandler } from "./types-uDrDMkCq.js";
|
|
2
|
+
|
|
3
|
+
//#region src/signalr/types.d.ts
|
|
4
|
+
/**
|
|
5
|
+
* Generic SignalR event handler
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Generic SignalR event handler
|
|
10
|
+
*/
|
|
11
|
+
type SignalREventHandler<T = unknown> = (event: T) => void;
|
|
12
|
+
/**
|
|
13
|
+
* SignalR connection state
|
|
14
|
+
*/
|
|
15
|
+
type SignalRConnectionState = 'Connecting' | 'Connected' | 'Reconnecting' | 'Disconnected';
|
|
16
|
+
/**
|
|
17
|
+
* SignalR client configuration
|
|
18
|
+
*/
|
|
19
|
+
interface SignalRClientConfig {
|
|
20
|
+
/**
|
|
21
|
+
* Base URL for SignalR hub (defaults to API base URL)
|
|
22
|
+
*/
|
|
23
|
+
baseUrl?: string;
|
|
24
|
+
/**
|
|
25
|
+
* Hub path (e.g., '/hubs/identity')
|
|
26
|
+
*/
|
|
27
|
+
hubPath: string;
|
|
28
|
+
/**
|
|
29
|
+
* Maximum reconnect attempts
|
|
30
|
+
*/
|
|
31
|
+
maxReconnectAttempts?: number;
|
|
32
|
+
/**
|
|
33
|
+
* Initial reconnect delay in ms
|
|
34
|
+
*/
|
|
35
|
+
reconnectDelay?: number;
|
|
36
|
+
/**
|
|
37
|
+
* Whether to enable verbose logging
|
|
38
|
+
*/
|
|
39
|
+
verbose?: boolean;
|
|
40
|
+
/**
|
|
41
|
+
* Whether to auto-reconnect on page visibility change
|
|
42
|
+
*/
|
|
43
|
+
autoReconnectOnVisibility?: boolean;
|
|
44
|
+
} //#endregion
|
|
45
|
+
//#region src/signalr/signalr-client.d.ts
|
|
46
|
+
|
|
47
|
+
//# sourceMappingURL=types.d.ts.map
|
|
48
|
+
/**
|
|
49
|
+
* SignalR Client Class
|
|
50
|
+
*
|
|
51
|
+
* Generic SignalR client that can be used for any hub connection.
|
|
52
|
+
*/
|
|
53
|
+
declare class SignalRClient {
|
|
54
|
+
private connection;
|
|
55
|
+
private accessToken;
|
|
56
|
+
private isConnecting;
|
|
57
|
+
private reconnectAttempts;
|
|
58
|
+
private config;
|
|
59
|
+
private eventHandlers;
|
|
60
|
+
private visibilityHandler;
|
|
61
|
+
constructor(config: SignalRClientConfig);
|
|
62
|
+
/**
|
|
63
|
+
* Connect to SignalR hub
|
|
64
|
+
*/
|
|
65
|
+
connect(accessToken: string | null): Promise<void>;
|
|
66
|
+
/**
|
|
67
|
+
* Build hub URL
|
|
68
|
+
*/
|
|
69
|
+
private buildHubUrl;
|
|
70
|
+
/**
|
|
71
|
+
* Setup connection lifecycle handlers
|
|
72
|
+
*/
|
|
73
|
+
private setupConnectionHandlers;
|
|
74
|
+
/**
|
|
75
|
+
* Disconnect from SignalR hub
|
|
76
|
+
*/
|
|
77
|
+
disconnect(): Promise<void>;
|
|
78
|
+
/**
|
|
79
|
+
* Register event handler
|
|
80
|
+
*/
|
|
81
|
+
on<T = unknown>(eventName: string, handler: SignalREventHandler<T>): () => void;
|
|
82
|
+
/**
|
|
83
|
+
* Invoke hub method
|
|
84
|
+
*/
|
|
85
|
+
invoke<T = void>(methodName: string, ...args: unknown[]): Promise<T>;
|
|
86
|
+
/**
|
|
87
|
+
* Get current connection state
|
|
88
|
+
*/
|
|
89
|
+
get connectionState(): SignalRConnectionState;
|
|
90
|
+
/**
|
|
91
|
+
* Check if connected
|
|
92
|
+
*/
|
|
93
|
+
get isConnected(): boolean;
|
|
94
|
+
/**
|
|
95
|
+
* Get connection ID
|
|
96
|
+
*/
|
|
97
|
+
get connectionId(): string | null;
|
|
98
|
+
/**
|
|
99
|
+
* Cleanup resources
|
|
100
|
+
*/
|
|
101
|
+
dispose(): void;
|
|
102
|
+
/**
|
|
103
|
+
* Log message
|
|
104
|
+
*/
|
|
105
|
+
private log;
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Create Identity SignalR Client
|
|
109
|
+
*
|
|
110
|
+
* Factory function to create a SignalR client for identity hub.
|
|
111
|
+
*/
|
|
112
|
+
declare function createIdentitySignalRClient(options?: Omit<SignalRClientConfig, 'hubPath'>): SignalRClient;
|
|
113
|
+
/**
|
|
114
|
+
* Identity SignalR Client
|
|
115
|
+
*
|
|
116
|
+
* Specialized client for identity context changes.
|
|
117
|
+
*/
|
|
118
|
+
declare class IdentitySignalRClient extends SignalRClient {
|
|
119
|
+
private identityHandlers;
|
|
120
|
+
constructor(options?: Omit<SignalRClientConfig, 'hubPath'>);
|
|
121
|
+
/**
|
|
122
|
+
* Add handler for identity context changes
|
|
123
|
+
*/
|
|
124
|
+
onIdentityContextChanged(handler: IdentityContextChangeHandler): () => void;
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Get or create singleton identity SignalR client
|
|
128
|
+
*/
|
|
129
|
+
declare function getIdentitySignalRClient(options?: Omit<SignalRClientConfig, 'hubPath'>): IdentitySignalRClient;
|
|
130
|
+
/**
|
|
131
|
+
* Initialize SignalR with access token
|
|
132
|
+
*/
|
|
133
|
+
declare function initializeSignalR(accessToken: string | null, options?: Omit<SignalRClientConfig, 'hubPath'>): Promise<IdentitySignalRClient>;
|
|
134
|
+
/**
|
|
135
|
+
* Cleanup SignalR connection
|
|
136
|
+
*/
|
|
137
|
+
declare function cleanupSignalR(): Promise<void>; //#endregion
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=signalr-client.d.ts.map
|
|
140
|
+
export { IdentitySignalRClient as IdentitySignalRClient$1, SignalRClient as SignalRClient$1, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, cleanupSignalR as cleanupSignalR$1, createIdentitySignalRClient as createIdentitySignalRClient$1, getIdentitySignalRClient as getIdentitySignalRClient$1, initializeSignalR as initializeSignalR$1 };
|
|
141
|
+
//# sourceMappingURL=index-geY2ynnN.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index-geY2ynnN.d.ts","names":[],"sources":["../src/signalr/types.ts","../src/signalr/signalr-client.ts"],"sourcesContent":null,"mappings":";;;;;;;;;AAaA;KAAY,2CAA2C;;;AAKvD;KAAY,sBAAA;;;AASZ;UAAiB,mBAAA;;;;;;;;ECIJ,OAAA,EAAA,MAAA;EAAa;;;EA8B0B,oBAsI9B,CAAA,EAAA,MAAA;EAAO;;;EAmC8C,cAAT,CAAA,EAAA,MAAA;EAAO;AAU1B;;;;;;EAsD/B,yBAAA,CAAA,EAAA,OAA2B;CAAA;;;;;;;ADpR3C;;cCaa,aAAA;;EDJI,QAAA,WAAA;;;;;;sBCaK;;;AATtB;EAA0B,OAAA,CAAA,WAAA,EAAA,MAAA,GAAA,IAAA,CAAA,EA8BmB,OA9BnB,CAAA,IAAA,CAAA;EAAA;;;EAoKG,QAaqC,WAAA;EAAC;;;EAsBM,QAUhD,uBAAA;EAAsB;;;gBA7CzB;;;AAmGtB;EAA2C,EAAA,CAAA,IAAA,OAAA,CAAA,CAAA,SAAA,EAAA,MAAA,EAAA,OAAA,EAtFG,mBAsFH,CAtFuB,CAsFvB,CAAA,CAAA,EAAA,GAAA,GAAA,IAAA;EAAA;;;EAE3B,MAAA,CAAA,IAAA,IAAA,CAAA,CAAA,UAAA,EAAA,MAAA,EAAA,GAAA,IAAA,EAAA,OAAA,EAAA,CAAA,EAlEkD,OAkElD,CAlE0D,CAkE1D,CAAA;;;;yBAxDS;;AAoEzB;;EAAmC,IAGP,WAAA,CAAA,CAAA,EAAA,OAAA;EAAmB;;;EAHS,IAAA,YAAA,CAAA,CAAA,EAAA,MAAA,GAAA,IAAA;;;;EA4CxC,OAAA,CAAA,CAAA,EAAA,IAAA;EAAwB;;;EACzB,QACZ,GAAA;AAAqB;;;;AAUxB;;AAEgB,iBAxEA,2BAAA,CAwEA,OAAA,CAAA,EAvEL,IAuEK,CAvEA,mBAuEA,EAAA,SAAA,CAAA,CAAA,EAtEb,aAsEa;;;;AACN;;cA3DG,qBAAA,SAA8B,aAAA;;EAwErB,WAAA,CAAA,OAAyB,CAAX,EArEb,IAqEa,CArER,mBAqEmB,EAAA,SAAA,CAAA;;;;oCAhDX;;;;;iBAoBpB,wBAAA,WACL,KAAK,kCACb;;;;iBAUmB,iBAAA,uCAEX,KAAK,kCACb,QAAQ;;;;iBAaW,cAAA,CAAA,GAAkB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { LogContext, LogEntry, LogLevel$1 as LogLevel, LoggerConfig } from "./types-BTjFzIhv.js";
|
|
2
|
+
import { APIConfig, APILogger, ApiError$1 as ApiError, CreateAPIConfigOptions, ErrorCodes$1 as ErrorCodes, ErrorHandler$1 as ErrorHandler, GetAccessTokenFn, GetCurrentTenantFn, ProblemDetails, RetryConfig, TokenRefreshFn, TokenRefreshResult, ValidationError, calculateBackoffDelay$1 as calculateBackoffDelay, createRetryFetch$1 as createRetryFetch, fetchWithTimeout$1 as fetchWithTimeout, handleApiError$1 as handleApiError, isRetryableError$1 as isRetryableError, withRetry$1 as withRetry } from "./index-D6RK_5vm.js";
|
|
3
|
+
import { OrganizationBranding, OrganizationData, TenantContextType, TenantInfo, TenantMembership } from "./types-DoIfDhl6.js";
|
|
4
|
+
import { AddressData, IdentityContextChangeHandler, IdentityContextChangedEvent, IdentityContextData } from "./types-uDrDMkCq.js";
|
|
5
|
+
import { IdentityContextProvider$1 as IdentityContextProvider, IdentityStoreConfig, IdentityUnauthorizedDetails, configureIdentityEndpoints$1 as configureIdentityEndpoints, configureIdentityStore$1 as configureIdentityStore, resetIdentityStoreConfig$1 as resetIdentityStoreConfig, useHasSubscription$1 as useHasSubscription, useIdentityContext$1 as useIdentityContext, useIdentityStore$1 as useIdentityStore, useIsOnboarded$1 as useIsOnboarded, useUserPermissions$1 as useUserPermissions, useUserTenants$1 as useUserTenants } from "./index-C2hGpzGr.js";
|
|
6
|
+
import { LOG_LEVEL_PRIORITY$1 as LOG_LEVEL_PRIORITY, Logger$1 as Logger, createLogger$1 as createLogger, defaultLoggerConfig$1 as defaultLoggerConfig, logger$1 as logger } from "./index-DrttYPAj.js";
|
|
7
|
+
import { FieldPermissionResult, PERMISSION_MODULES$1 as PERMISSION_MODULES, PermissionCheckOptions, PermissionCheckResult, PermissionChecker$1 as PermissionChecker, PermissionCode, PermissionInitializer$1 as PermissionInitializer, PermissionModule, ProtectedAction$1 as ProtectedAction, ProtectedButton$1 as ProtectedButton, ProtectedLink$1 as ProtectedLink, ProtectedSection$1 as ProtectedSection, getPermissionChecker$1 as getPermissionChecker, getPermissions$1 as getPermissions, initializePermissions$1 as initializePermissions, useAllPermissions$1 as useAllPermissions, useHasModulePermission$1 as useHasModulePermission, useHasPermission$1 as useHasPermission, useHasPermissions$1 as useHasPermissions, useModulePermission$1 as useModulePermission, usePermission$1 as usePermission, usePermissionChecker$1 as usePermissionChecker, usePermissionStore$1 as usePermissionStore, usePermissions$1 as usePermissions } from "./index-BIJOC8Fb.js";
|
|
8
|
+
import { TenantProvider$1 as TenantProvider, configureTenantEndpoints$1 as configureTenantEndpoints, initializeTenantStore$1 as initializeTenantStore, useCurrentOrganization$1 as useCurrentOrganization, useCurrentTenant$1 as useCurrentTenant, useOrganization$1 as useOrganization, useTenant$1 as useTenant, useTenantStore$1 as useTenantStore, useTenantSwitcher$1 as useTenantSwitcher } from "./index-Bt9XE6gj.js";
|
|
9
|
+
import { IdentitySignalRClient$1 as IdentitySignalRClient, SignalRClient$1 as SignalRClient, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, cleanupSignalR$1 as cleanupSignalR, createIdentitySignalRClient$1 as createIdentitySignalRClient, getIdentitySignalRClient$1 as getIdentitySignalRClient, initializeSignalR$1 as initializeSignalR } from "./index-geY2ynnN.js";
|
|
10
|
+
import { CachePreset, CachePresets, InvalidationHelpers, LogoutHandler, QueryClientConfig, QueryLogger, cachePresets$1 as cachePresets, createQueryClient$1 as createQueryClient, createQueryKeyFactory$1 as createQueryKeyFactory, invalidationHelpers$1 as invalidationHelpers } from "./index-CfQsb3l_.js";
|
|
11
|
+
import "./index-kr8Wk7v5.js";
|
|
12
|
+
export { APIConfig, APILogger, AddressData, ApiError, CachePreset, CachePresets, CreateAPIConfigOptions, ErrorCodes, ErrorHandler, FieldPermissionResult, GetAccessTokenFn, GetCurrentTenantFn, IdentityContextChangeHandler, IdentityContextChangedEvent, IdentityContextData, IdentityContextProvider, IdentitySignalRClient, IdentityStoreConfig, IdentityUnauthorizedDetails, InvalidationHelpers, LOG_LEVEL_PRIORITY, LogContext, LogEntry, LogLevel, Logger, LoggerConfig, LogoutHandler, OrganizationBranding, OrganizationData, PERMISSION_MODULES, PermissionCheckOptions, PermissionCheckResult, PermissionChecker, PermissionCode, PermissionInitializer, PermissionModule, ProblemDetails, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, QueryClientConfig, QueryLogger, RetryConfig, SignalRClient, SignalRClientConfig, SignalRConnectionState, SignalREventHandler, TenantContextType, TenantInfo, TenantMembership, TenantProvider, TokenRefreshFn, TokenRefreshResult, ValidationError, cachePresets, calculateBackoffDelay, cleanupSignalR, configureIdentityEndpoints, configureIdentityStore, configureTenantEndpoints, createIdentitySignalRClient, createLogger, createQueryClient, createQueryKeyFactory, createRetryFetch, defaultLoggerConfig, fetchWithTimeout, getIdentitySignalRClient, getPermissionChecker, getPermissions, handleApiError, initializePermissions, initializeSignalR, initializeTenantStore, invalidationHelpers, isRetryableError, logger, resetIdentityStoreConfig, useAllPermissions, useCurrentOrganization, useCurrentTenant, useHasModulePermission, useHasPermission, useHasPermissions, useHasSubscription, useIdentityContext, useIdentityStore, useIsOnboarded, useModulePermission, useOrganization, usePermission, usePermissionChecker, usePermissionStore, usePermissions, useTenant, useTenantStore, useTenantSwitcher, useUserPermissions, useUserTenants, withRetry };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LOG_LEVEL_PRIORITY, LogLevel, Logger, createLogger, defaultLoggerConfig, logger } from "./logging-_h2mi3L9.js";
|
|
2
|
+
import { PERMISSION_MODULES, PermissionChecker, PermissionInitializer, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, getPermissionChecker, getPermissions, initializePermissions, useAllPermissions, useHasModulePermission, useHasPermission, useHasPermissions, useModulePermission, usePermission, usePermissionChecker, usePermissionStore, usePermissions } from "./permissions-D5ScGGnd.js";
|
|
3
|
+
import { TenantProvider, configureTenantEndpoints, initializeTenantStore, useCurrentOrganization, useCurrentTenant, useOrganization, useTenant, useTenantStore, useTenantSwitcher } from "./tenant-C6KPaSCX.js";
|
|
4
|
+
import { IdentityContextProvider, configureIdentityEndpoints, configureIdentityStore, resetIdentityStoreConfig, useHasSubscription, useIdentityContext, useIdentityStore, useIsOnboarded, useUserPermissions, useUserTenants } from "./identity-CFa1txoj.js";
|
|
5
|
+
import { ApiError, ErrorCodes, ErrorHandler, calculateBackoffDelay, createRetryFetch, fetchWithTimeout, handleApiError, isRetryableError, withRetry } from "./api-client-Ftxqm3Ep.js";
|
|
6
|
+
import { IdentitySignalRClient, SignalRClient, cleanupSignalR, createIdentitySignalRClient, getIdentitySignalRClient, initializeSignalR } from "./signalr-BJGcXc0m.js";
|
|
7
|
+
import { cachePresets, createQueryClient, createQueryKeyFactory, invalidationHelpers } from "./query-client-DRPQIKHX.js";
|
|
8
|
+
import "./src-D7mh9MKA.js";
|
|
9
|
+
|
|
10
|
+
export { ApiError, ErrorCodes, ErrorHandler, IdentityContextProvider, IdentitySignalRClient, LOG_LEVEL_PRIORITY, LogLevel, Logger, PERMISSION_MODULES, PermissionChecker, PermissionInitializer, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, SignalRClient, TenantProvider, cachePresets, calculateBackoffDelay, cleanupSignalR, configureIdentityEndpoints, configureIdentityStore, configureTenantEndpoints, createIdentitySignalRClient, createLogger, createQueryClient, createQueryKeyFactory, createRetryFetch, defaultLoggerConfig, fetchWithTimeout, getIdentitySignalRClient, getPermissionChecker, getPermissions, handleApiError, initializePermissions, initializeSignalR, initializeTenantStore, invalidationHelpers, isRetryableError, logger, resetIdentityStoreConfig, useAllPermissions, useCurrentOrganization, useCurrentTenant, useHasModulePermission, useHasPermission, useHasPermissions, useHasSubscription, useIdentityContext, useIdentityStore, useIsOnboarded, useModulePermission, useOrganization, usePermission, usePermissionChecker, usePermissionStore, usePermissions, useTenant, useTenantStore, useTenantSwitcher, useUserPermissions, useUserTenants, withRetry };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { LogContext, LogEntry, LogLevel$1 as LogLevel, LoggerConfig } from "../types-BTjFzIhv.js";
|
|
2
|
+
import { LOG_LEVEL_PRIORITY$1 as LOG_LEVEL_PRIORITY, Logger$1 as Logger, createLogger$1 as createLogger, defaultLoggerConfig$1 as defaultLoggerConfig, logger$1 as logger } from "../index-DrttYPAj.js";
|
|
3
|
+
export { LOG_LEVEL_PRIORITY, LogContext, LogEntry, LogLevel, Logger, LoggerConfig, createLogger, defaultLoggerConfig, logger };
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
//#region src/logging/types.ts
|
|
2
|
+
/**
|
|
3
|
+
* Logging Types
|
|
4
|
+
*/
|
|
5
|
+
let LogLevel = /* @__PURE__ */ function(LogLevel$1) {
|
|
6
|
+
LogLevel$1["DEBUG"] = "debug";
|
|
7
|
+
LogLevel$1["INFO"] = "info";
|
|
8
|
+
LogLevel$1["WARN"] = "warn";
|
|
9
|
+
LogLevel$1["ERROR"] = "error";
|
|
10
|
+
return LogLevel$1;
|
|
11
|
+
}({});
|
|
12
|
+
|
|
13
|
+
//#endregion
|
|
14
|
+
//#region src/logging/config.ts
|
|
15
|
+
const LOG_LEVEL_PRIORITY = {
|
|
16
|
+
[LogLevel.DEBUG]: 0,
|
|
17
|
+
[LogLevel.INFO]: 1,
|
|
18
|
+
[LogLevel.WARN]: 2,
|
|
19
|
+
[LogLevel.ERROR]: 3
|
|
20
|
+
};
|
|
21
|
+
const defaultLoggerConfig = {
|
|
22
|
+
minLevel: process.env.NODE_ENV === "production" ? LogLevel.INFO : LogLevel.DEBUG,
|
|
23
|
+
enableConsole: true,
|
|
24
|
+
enableRemote: false,
|
|
25
|
+
serviceName: "mimir"
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
//#endregion
|
|
29
|
+
//#region src/logging/logger.ts
|
|
30
|
+
var Logger = class {
|
|
31
|
+
config;
|
|
32
|
+
constructor(config) {
|
|
33
|
+
this.config = {
|
|
34
|
+
...defaultLoggerConfig,
|
|
35
|
+
...config
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
debug(message, context) {
|
|
39
|
+
this.log(LogLevel.DEBUG, message, context);
|
|
40
|
+
}
|
|
41
|
+
info(message, context) {
|
|
42
|
+
this.log(LogLevel.INFO, message, context);
|
|
43
|
+
}
|
|
44
|
+
warn(message, context) {
|
|
45
|
+
this.log(LogLevel.WARN, message, context);
|
|
46
|
+
}
|
|
47
|
+
error(message, error, context) {
|
|
48
|
+
this.log(LogLevel.ERROR, message, context, error);
|
|
49
|
+
}
|
|
50
|
+
log(level, message, context, error) {
|
|
51
|
+
if (!this.shouldLog(level)) return;
|
|
52
|
+
const entry = {
|
|
53
|
+
timestamp: new Date().toISOString(),
|
|
54
|
+
level,
|
|
55
|
+
message,
|
|
56
|
+
context,
|
|
57
|
+
error
|
|
58
|
+
};
|
|
59
|
+
if (this.config.enableConsole) this.logToConsole(entry);
|
|
60
|
+
if (this.config.enableRemote && this.config.remoteEndpoint) this.sendToRemote(entry).catch((err) => {
|
|
61
|
+
console.error("Failed to send log to remote endpoint:", err);
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
shouldLog(level) {
|
|
65
|
+
return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.config.minLevel];
|
|
66
|
+
}
|
|
67
|
+
logToConsole(entry) {
|
|
68
|
+
const formatted = this.formatEntry(entry);
|
|
69
|
+
switch (entry.level) {
|
|
70
|
+
case LogLevel.DEBUG:
|
|
71
|
+
console.debug(formatted);
|
|
72
|
+
break;
|
|
73
|
+
case LogLevel.INFO:
|
|
74
|
+
console.info(formatted);
|
|
75
|
+
break;
|
|
76
|
+
case LogLevel.WARN:
|
|
77
|
+
console.warn(formatted);
|
|
78
|
+
break;
|
|
79
|
+
case LogLevel.ERROR:
|
|
80
|
+
console.error(formatted);
|
|
81
|
+
if (entry.error) console.error(entry.error);
|
|
82
|
+
break;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
formatEntry(entry) {
|
|
86
|
+
const parts = [
|
|
87
|
+
`[${entry.timestamp}]`,
|
|
88
|
+
`[${entry.level.toUpperCase()}]`,
|
|
89
|
+
entry.message
|
|
90
|
+
];
|
|
91
|
+
if (entry.context && Object.keys(entry.context).length > 0) parts.push(JSON.stringify(entry.context));
|
|
92
|
+
return parts.join(" ");
|
|
93
|
+
}
|
|
94
|
+
async sendToRemote(entry) {
|
|
95
|
+
if (!this.config.remoteEndpoint) return;
|
|
96
|
+
await fetch(this.config.remoteEndpoint, {
|
|
97
|
+
method: "POST",
|
|
98
|
+
headers: { "Content-Type": "application/json" },
|
|
99
|
+
body: JSON.stringify({
|
|
100
|
+
...entry,
|
|
101
|
+
serviceName: this.config.serviceName,
|
|
102
|
+
error: entry.error ? {
|
|
103
|
+
name: entry.error.name,
|
|
104
|
+
message: entry.error.message,
|
|
105
|
+
stack: entry.error.stack
|
|
106
|
+
} : void 0
|
|
107
|
+
})
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
};
|
|
111
|
+
const logger = new Logger();
|
|
112
|
+
function createLogger(config) {
|
|
113
|
+
return new Logger(config);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
//#endregion
|
|
117
|
+
export { LOG_LEVEL_PRIORITY, LogLevel, Logger, createLogger, defaultLoggerConfig, logger };
|
|
118
|
+
//# sourceMappingURL=logging-_h2mi3L9.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logging-_h2mi3L9.js","names":["LOG_LEVEL_PRIORITY: Record<LogLevel, number>","defaultLoggerConfig: LoggerConfig","config?: Partial<LoggerConfig>","message: string","context?: LogContext","error?: Error","level: LogLevel","entry: LogEntry"],"sources":["../src/logging/types.ts","../src/logging/config.ts","../src/logging/logger.ts"],"sourcesContent":["/**\n * Logging Types\n */\n\nexport enum LogLevel {\n DEBUG = 'debug',\n INFO = 'info',\n WARN = 'warn',\n ERROR = 'error',\n}\n\nexport interface LogContext {\n [key: string]: unknown;\n}\n\nexport interface LogEntry {\n timestamp: string;\n level: LogLevel;\n message: string;\n context?: LogContext;\n error?: Error;\n}\n\nexport interface LoggerConfig {\n minLevel: LogLevel;\n enableConsole: boolean;\n enableRemote: boolean;\n remoteEndpoint?: string;\n serviceName?: string;\n}\n","/**\n * Logger Configuration\n */\n\nimport { LogLevel, type LoggerConfig } from './types';\n\nexport const LOG_LEVEL_PRIORITY: Record<LogLevel, number> = {\n [LogLevel.DEBUG]: 0,\n [LogLevel.INFO]: 1,\n [LogLevel.WARN]: 2,\n [LogLevel.ERROR]: 3,\n};\n\nexport const defaultLoggerConfig: LoggerConfig = {\n minLevel: process.env.NODE_ENV === 'production' ? LogLevel.INFO : LogLevel.DEBUG,\n enableConsole: true,\n enableRemote: false,\n serviceName: 'mimir',\n};\n","/**\n * Logger Service\n * \n * Centralized logging implementation with structured logging format.\n */\n\nimport { LogLevel, type LogContext, type LogEntry, type LoggerConfig } from './types';\nimport { defaultLoggerConfig, LOG_LEVEL_PRIORITY } from './config';\n\nexport class Logger {\n private config: LoggerConfig;\n\n constructor(config?: Partial<LoggerConfig>) {\n this.config = {\n ...defaultLoggerConfig,\n ...config,\n };\n }\n\n debug(message: string, context?: LogContext): void {\n this.log(LogLevel.DEBUG, message, context);\n }\n\n info(message: string, context?: LogContext): void {\n this.log(LogLevel.INFO, message, context);\n }\n\n warn(message: string, context?: LogContext): void {\n this.log(LogLevel.WARN, message, context);\n }\n\n error(message: string, error?: Error, context?: LogContext): void {\n this.log(LogLevel.ERROR, message, context, error);\n }\n\n private log(\n level: LogLevel,\n message: string,\n context?: LogContext,\n error?: Error\n ): void {\n if (!this.shouldLog(level)) {\n return;\n }\n\n const entry: LogEntry = {\n timestamp: new Date().toISOString(),\n level,\n message,\n context,\n error,\n };\n\n if (this.config.enableConsole) {\n this.logToConsole(entry);\n }\n\n if (this.config.enableRemote && this.config.remoteEndpoint) {\n this.sendToRemote(entry).catch((err) => {\n console.error('Failed to send log to remote endpoint:', err);\n });\n }\n }\n\n private shouldLog(level: LogLevel): boolean {\n return LOG_LEVEL_PRIORITY[level] >= LOG_LEVEL_PRIORITY[this.config.minLevel];\n }\n\n private logToConsole(entry: LogEntry): void {\n const formatted = this.formatEntry(entry);\n\n switch (entry.level) {\n case LogLevel.DEBUG:\n console.debug(formatted);\n break;\n case LogLevel.INFO:\n console.info(formatted);\n break;\n case LogLevel.WARN:\n console.warn(formatted);\n break;\n case LogLevel.ERROR:\n console.error(formatted);\n if (entry.error) {\n console.error(entry.error);\n }\n break;\n }\n }\n\n private formatEntry(entry: LogEntry): string {\n const parts = [\n `[${entry.timestamp}]`,\n `[${entry.level.toUpperCase()}]`,\n entry.message,\n ];\n\n if (entry.context && Object.keys(entry.context).length > 0) {\n parts.push(JSON.stringify(entry.context));\n }\n\n return parts.join(' ');\n }\n\n private async sendToRemote(entry: LogEntry): Promise<void> {\n if (!this.config.remoteEndpoint) return;\n\n await fetch(this.config.remoteEndpoint, {\n method: 'POST',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify({\n ...entry,\n serviceName: this.config.serviceName,\n error: entry.error\n ? {\n name: entry.error.name,\n message: entry.error.message,\n stack: entry.error.stack,\n }\n : undefined,\n }),\n });\n }\n}\n\n// Default logger instance\nexport const logger = new Logger();\n\n// Create logger with custom config\nexport function createLogger(config?: Partial<LoggerConfig>): Logger {\n return new Logger(config);\n}\n"],"mappings":";;;;AAIA,IAAY,gDAAL;AACL;AACA;AACA;AACA;;AACD;;;;ACHD,MAAaA,qBAA+C;EACzD,SAAS,QAAQ;EACjB,SAAS,OAAO;EAChB,SAAS,OAAO;EAChB,SAAS,QAAQ;AACnB;AAED,MAAaC,sBAAoC;CAC/C,UAAU,QAAQ,IAAI,aAAa,eAAe,SAAS,OAAO,SAAS;CAC3E,eAAe;CACf,cAAc;CACd,aAAa;AACd;;;;ACTD,IAAa,SAAb,MAAoB;CAClB,AAAQ;CAER,YAAYC,QAAgC;AAC1C,OAAK,SAAS;GACZ,GAAG;GACH,GAAG;EACJ;CACF;CAED,MAAMC,SAAiBC,SAA4B;AACjD,OAAK,IAAI,SAAS,OAAO,SAAS,QAAQ;CAC3C;CAED,KAAKD,SAAiBC,SAA4B;AAChD,OAAK,IAAI,SAAS,MAAM,SAAS,QAAQ;CAC1C;CAED,KAAKD,SAAiBC,SAA4B;AAChD,OAAK,IAAI,SAAS,MAAM,SAAS,QAAQ;CAC1C;CAED,MAAMD,SAAiBE,OAAeD,SAA4B;AAChE,OAAK,IAAI,SAAS,OAAO,SAAS,SAAS,MAAM;CAClD;CAED,AAAQ,IACNE,OACAH,SACAC,SACAC,OACM;AACN,OAAK,KAAK,UAAU,MAAM,CACxB;EAGF,MAAME,QAAkB;GACtB,WAAW,IAAI,OAAO,aAAa;GACnC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C;CACH;AACF;AAGD,MAAa,SAAS,IAAI;AAG1B,SAAgB,aAAaL,QAAwC;AACnE,QAAO,IAAI,OAAO;AACnB"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { FieldPermissionResult, PERMISSION_MODULES$1 as PERMISSION_MODULES, PermissionCheckOptions, PermissionCheckResult, PermissionChecker$1 as PermissionChecker, PermissionCode, PermissionInitializer$1 as PermissionInitializer, PermissionModule, ProtectedAction$1 as ProtectedAction, ProtectedButton$1 as ProtectedButton, ProtectedLink$1 as ProtectedLink, ProtectedSection$1 as ProtectedSection, getPermissionChecker$1 as getPermissionChecker, getPermissions$1 as getPermissions, initializePermissions$1 as initializePermissions, useAllPermissions$1 as useAllPermissions, useHasModulePermission$1 as useHasModulePermission, useHasPermission$1 as useHasPermission, useHasPermissions$1 as useHasPermissions, useModulePermission$1 as useModulePermission, usePermission$1 as usePermission, usePermissionChecker$1 as usePermissionChecker, usePermissionStore$1 as usePermissionStore, usePermissions$1 as usePermissions } from "../index-BIJOC8Fb.js";
|
|
2
|
+
export { FieldPermissionResult, PERMISSION_MODULES, PermissionCheckOptions, PermissionCheckResult, PermissionChecker, PermissionCode, PermissionInitializer, PermissionModule, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, getPermissionChecker, getPermissions, initializePermissions, useAllPermissions, useHasModulePermission, useHasPermission, useHasPermissions, useModulePermission, usePermission, usePermissionChecker, usePermissionStore, usePermissions };
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { PERMISSION_MODULES, PermissionChecker, PermissionInitializer, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, getPermissionChecker, getPermissions, initializePermissions, useAllPermissions, useHasModulePermission, useHasPermission, useHasPermissions, useModulePermission, usePermission, usePermissionChecker, usePermissionStore, usePermissions } from "../permissions-D5ScGGnd.js";
|
|
2
|
+
|
|
3
|
+
export { PERMISSION_MODULES, PermissionChecker, PermissionInitializer, ProtectedAction, ProtectedButton, ProtectedLink, ProtectedSection, getPermissionChecker, getPermissions, initializePermissions, useAllPermissions, useHasModulePermission, useHasPermission, useHasPermissions, useModulePermission, usePermission, usePermissionChecker, usePermissionStore, usePermissions };
|