@asgardeo/javascript 0.1.6 → 0.1.8
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/dist/AsgardeoJavaScriptClient.d.ts +2 -1
- package/dist/__legacy__/client.d.ts +1 -1
- package/dist/cjs/index.js +382 -78
- package/dist/cjs/index.js.map +4 -4
- package/dist/index.d.ts +2 -0
- package/dist/index.js +372 -78
- package/dist/index.js.map +4 -4
- package/dist/models/client.d.ts +3 -1
- package/dist/utils/logger.d.ts +142 -0
- package/package.json +1 -1
package/dist/models/client.d.ts
CHANGED
|
@@ -21,6 +21,7 @@ import { EmbeddedSignInFlowHandleRequestPayload } from './embedded-signin-flow';
|
|
|
21
21
|
import { Organization } from './organization';
|
|
22
22
|
import { User, UserProfile } from './user';
|
|
23
23
|
import { TokenResponse } from './token';
|
|
24
|
+
import { Storage } from './store';
|
|
24
25
|
export type SignInOptions = Record<string, unknown>;
|
|
25
26
|
export type SignOutOptions = Record<string, unknown>;
|
|
26
27
|
export type SignUpOptions = Record<string, unknown>;
|
|
@@ -72,9 +73,10 @@ export interface AsgardeoClient<T> {
|
|
|
72
73
|
* Initializes the authentication client with provided configuration.
|
|
73
74
|
*
|
|
74
75
|
* @param config - SDK Client instance configuration options.
|
|
76
|
+
* @param storage - Optional storage instance to persist data (e.g., session, user profile).
|
|
75
77
|
* @returns Promise resolving to boolean indicating success.
|
|
76
78
|
*/
|
|
77
|
-
initialize(config: T): Promise<boolean>;
|
|
79
|
+
initialize(config: T, storage?: Storage): Promise<boolean>;
|
|
78
80
|
/**
|
|
79
81
|
* Checks if the client is currently loading.
|
|
80
82
|
* This can be used to determine if the client is in the process of initializing or fetching user data.
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).
|
|
3
|
+
*
|
|
4
|
+
* WSO2 LLC. licenses this file to you under the Apache License,
|
|
5
|
+
* Version 2.0 (the "License"); you may not use this file except
|
|
6
|
+
* in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing,
|
|
12
|
+
* software distributed under the License is distributed on an
|
|
13
|
+
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
|
14
|
+
* KIND, either express or implied. See the License for the
|
|
15
|
+
* specific language governing permissions and limitations
|
|
16
|
+
* under the License.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* Log levels enum
|
|
20
|
+
*/
|
|
21
|
+
export type LogLevel = 'debug' | 'info' | 'warn' | 'error';
|
|
22
|
+
/**
|
|
23
|
+
* Logger configuration interface
|
|
24
|
+
*/
|
|
25
|
+
export interface LoggerConfig {
|
|
26
|
+
/** Minimum log level to output */
|
|
27
|
+
level: LogLevel;
|
|
28
|
+
/** Custom prefix for all log messages */
|
|
29
|
+
prefix?: string;
|
|
30
|
+
/** Whether to include timestamps */
|
|
31
|
+
timestamps?: boolean;
|
|
32
|
+
/** Whether to include log level in output */
|
|
33
|
+
showLevel?: boolean;
|
|
34
|
+
/** Custom log formatter function */
|
|
35
|
+
formatter?: (level: LogLevel, message: string, ...args: any[]) => void;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Universal logger class that works in both browser and Node.js environments
|
|
39
|
+
*/
|
|
40
|
+
declare class Logger {
|
|
41
|
+
private config;
|
|
42
|
+
constructor(config?: Partial<LoggerConfig>);
|
|
43
|
+
/**
|
|
44
|
+
* Update logger configuration
|
|
45
|
+
*/
|
|
46
|
+
configure(config: Partial<LoggerConfig>): void;
|
|
47
|
+
/**
|
|
48
|
+
* Get current configuration
|
|
49
|
+
*/
|
|
50
|
+
getConfig(): LoggerConfig;
|
|
51
|
+
/**
|
|
52
|
+
* Check if a log level should be output
|
|
53
|
+
*/
|
|
54
|
+
private shouldLog;
|
|
55
|
+
/**
|
|
56
|
+
* Get timestamp string
|
|
57
|
+
*/
|
|
58
|
+
private getTimestamp;
|
|
59
|
+
/**
|
|
60
|
+
* Get log level string
|
|
61
|
+
*/
|
|
62
|
+
private getLevelString;
|
|
63
|
+
/**
|
|
64
|
+
* Format message for Node.js terminal
|
|
65
|
+
*/
|
|
66
|
+
private formatForNode;
|
|
67
|
+
/**
|
|
68
|
+
* Log message using appropriate method
|
|
69
|
+
*/
|
|
70
|
+
private logMessage;
|
|
71
|
+
/**
|
|
72
|
+
* Log to browser console with styling
|
|
73
|
+
*/
|
|
74
|
+
private logToBrowser;
|
|
75
|
+
/**
|
|
76
|
+
* Log to Node.js console
|
|
77
|
+
*/
|
|
78
|
+
private logToNode;
|
|
79
|
+
/**
|
|
80
|
+
* Log debug message
|
|
81
|
+
*/
|
|
82
|
+
debug(message: string, ...args: any[]): void;
|
|
83
|
+
/**
|
|
84
|
+
* Log info message
|
|
85
|
+
*/
|
|
86
|
+
info(message: string, ...args: any[]): void;
|
|
87
|
+
/**
|
|
88
|
+
* Log warning message
|
|
89
|
+
*/
|
|
90
|
+
warn(message: string, ...args: any[]): void;
|
|
91
|
+
/**
|
|
92
|
+
* Log error message
|
|
93
|
+
*/
|
|
94
|
+
error(message: string, ...args: any[]): void;
|
|
95
|
+
/**
|
|
96
|
+
* Create a child logger with additional prefix
|
|
97
|
+
*/
|
|
98
|
+
child(prefix: string): Logger;
|
|
99
|
+
/**
|
|
100
|
+
* Set log level
|
|
101
|
+
*/
|
|
102
|
+
setLevel(level: LogLevel): void;
|
|
103
|
+
/**
|
|
104
|
+
* Get current log level
|
|
105
|
+
*/
|
|
106
|
+
getLevel(): LogLevel;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Default logger instance
|
|
110
|
+
*/
|
|
111
|
+
declare const logger: Logger;
|
|
112
|
+
/**
|
|
113
|
+
* Create a new logger instance with custom configuration
|
|
114
|
+
*/
|
|
115
|
+
export declare const createLogger: (config?: Partial<LoggerConfig>) => Logger;
|
|
116
|
+
/**
|
|
117
|
+
* Default export - global logger instance
|
|
118
|
+
*/
|
|
119
|
+
export default logger;
|
|
120
|
+
/**
|
|
121
|
+
* Named exports for convenience
|
|
122
|
+
*/
|
|
123
|
+
export declare const debug: (message: string, ...args: any[]) => void;
|
|
124
|
+
export declare const info: (message: string, ...args: any[]) => void;
|
|
125
|
+
export declare const warn: (message: string, ...args: any[]) => void;
|
|
126
|
+
export declare const error: (message: string, ...args: any[]) => void;
|
|
127
|
+
/**
|
|
128
|
+
* Configure the default logger
|
|
129
|
+
*/
|
|
130
|
+
export declare const configure: (config: Partial<LoggerConfig>) => void;
|
|
131
|
+
/**
|
|
132
|
+
* Create component-specific loggers
|
|
133
|
+
*/
|
|
134
|
+
export declare const createComponentLogger: (component: string) => Logger;
|
|
135
|
+
/**
|
|
136
|
+
* Create package-specific logger
|
|
137
|
+
*/
|
|
138
|
+
export declare const createPackageLogger: (packageName: string) => Logger;
|
|
139
|
+
/**
|
|
140
|
+
* Create package component logger (package + component)
|
|
141
|
+
*/
|
|
142
|
+
export declare const createPackageComponentLogger: (packageName: string, component: string) => Logger;
|