@asgardeo/javascript 0.1.6 → 0.1.7

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.
@@ -0,0 +1,148 @@
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 declare enum LogLevel {
22
+ DEBUG = 0,
23
+ INFO = 1,
24
+ WARN = 2,
25
+ ERROR = 3,
26
+ SILENT = 4
27
+ }
28
+ /**
29
+ * Logger configuration interface
30
+ */
31
+ export interface LoggerConfig {
32
+ /** Minimum log level to output */
33
+ level: LogLevel;
34
+ /** Custom prefix for all log messages */
35
+ prefix?: string;
36
+ /** Whether to include timestamps */
37
+ timestamps?: boolean;
38
+ /** Whether to include log level in output */
39
+ showLevel?: boolean;
40
+ /** Custom log formatter function */
41
+ formatter?: (level: LogLevel, message: string, ...args: any[]) => void;
42
+ }
43
+ /**
44
+ * Universal logger class that works in both browser and Node.js environments
45
+ */
46
+ declare class Logger {
47
+ private config;
48
+ constructor(config?: Partial<LoggerConfig>);
49
+ /**
50
+ * Update logger configuration
51
+ */
52
+ configure(config: Partial<LoggerConfig>): void;
53
+ /**
54
+ * Get current configuration
55
+ */
56
+ getConfig(): LoggerConfig;
57
+ /**
58
+ * Check if a log level should be output
59
+ */
60
+ private shouldLog;
61
+ /**
62
+ * Get timestamp string
63
+ */
64
+ private getTimestamp;
65
+ /**
66
+ * Get log level string
67
+ */
68
+ private getLevelString;
69
+ /**
70
+ * Format message for Node.js terminal
71
+ */
72
+ private formatForNode;
73
+ /**
74
+ * Log message using appropriate method
75
+ */
76
+ private logMessage;
77
+ /**
78
+ * Log to browser console with styling
79
+ */
80
+ private logToBrowser;
81
+ /**
82
+ * Log to Node.js console
83
+ */
84
+ private logToNode;
85
+ /**
86
+ * Log debug message
87
+ */
88
+ debug(message: string, ...args: any[]): void;
89
+ /**
90
+ * Log info message
91
+ */
92
+ info(message: string, ...args: any[]): void;
93
+ /**
94
+ * Log warning message
95
+ */
96
+ warn(message: string, ...args: any[]): void;
97
+ /**
98
+ * Log error message
99
+ */
100
+ error(message: string, ...args: any[]): void;
101
+ /**
102
+ * Create a child logger with additional prefix
103
+ */
104
+ child(prefix: string): Logger;
105
+ /**
106
+ * Set log level
107
+ */
108
+ setLevel(level: LogLevel): void;
109
+ /**
110
+ * Get current log level
111
+ */
112
+ getLevel(): LogLevel;
113
+ }
114
+ /**
115
+ * Default logger instance
116
+ */
117
+ declare const logger: Logger;
118
+ /**
119
+ * Create a new logger instance with custom configuration
120
+ */
121
+ export declare const createLogger: (config?: Partial<LoggerConfig>) => Logger;
122
+ /**
123
+ * Default export - global logger instance
124
+ */
125
+ export default logger;
126
+ /**
127
+ * Named exports for convenience
128
+ */
129
+ export declare const debug: (message: string, ...args: any[]) => void;
130
+ export declare const info: (message: string, ...args: any[]) => void;
131
+ export declare const warn: (message: string, ...args: any[]) => void;
132
+ export declare const error: (message: string, ...args: any[]) => void;
133
+ /**
134
+ * Configure the default logger
135
+ */
136
+ export declare const configure: (config: Partial<LoggerConfig>) => void;
137
+ /**
138
+ * Create component-specific loggers
139
+ */
140
+ export declare const createComponentLogger: (component: string) => Logger;
141
+ /**
142
+ * Create package-specific logger
143
+ */
144
+ export declare const createPackageLogger: (packageName: string) => Logger;
145
+ /**
146
+ * Create package component logger (package + component)
147
+ */
148
+ export declare const createPackageComponentLogger: (packageName: string, component: string) => Logger;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asgardeo/javascript",
3
- "version": "0.1.6",
3
+ "version": "0.1.7",
4
4
  "description": "Framework agnostic JavaScript SDK for Asgardeo.",
5
5
  "keywords": [
6
6
  "asgardeo",