@atomic-ehr/codegen 0.0.1-canary.20251006092200.fdb4a88 → 0.0.1-canary.20251006094042.7f0be72
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/cli/index.js +45 -124
- package/dist/index.d.ts +2130 -62
- package/dist/index.js +5865 -84
- package/dist/index.js.map +1 -0
- package/package.json +3 -7
- package/dist/api/builder.d.ts +0 -154
- package/dist/api/builder.js +0 -341
- package/dist/api/generators/base/BaseGenerator.d.ts +0 -186
- package/dist/api/generators/base/BaseGenerator.js +0 -565
- package/dist/api/generators/base/FileManager.d.ts +0 -88
- package/dist/api/generators/base/FileManager.js +0 -202
- package/dist/api/generators/base/PythonTypeMapper.d.ts +0 -16
- package/dist/api/generators/base/PythonTypeMapper.js +0 -71
- package/dist/api/generators/base/TemplateEngine.d.ts +0 -126
- package/dist/api/generators/base/TemplateEngine.js +0 -133
- package/dist/api/generators/base/TypeMapper.d.ts +0 -129
- package/dist/api/generators/base/TypeMapper.js +0 -153
- package/dist/api/generators/base/TypeScriptTypeMapper.d.ts +0 -51
- package/dist/api/generators/base/TypeScriptTypeMapper.js +0 -232
- package/dist/api/generators/base/builders/DirectoryBuilder.d.ts +0 -99
- package/dist/api/generators/base/builders/DirectoryBuilder.js +0 -215
- package/dist/api/generators/base/builders/FileBuilder.d.ts +0 -160
- package/dist/api/generators/base/builders/FileBuilder.js +0 -406
- package/dist/api/generators/base/builders/IndexBuilder.d.ts +0 -126
- package/dist/api/generators/base/builders/IndexBuilder.js +0 -290
- package/dist/api/generators/base/enhanced-errors.d.ts +0 -84
- package/dist/api/generators/base/enhanced-errors.js +0 -259
- package/dist/api/generators/base/error-handler.d.ts +0 -89
- package/dist/api/generators/base/error-handler.js +0 -243
- package/dist/api/generators/base/errors.d.ts +0 -251
- package/dist/api/generators/base/errors.js +0 -692
- package/dist/api/generators/base/index.d.ts +0 -99
- package/dist/api/generators/base/index.js +0 -160
- package/dist/api/generators/base/types.d.ts +0 -433
- package/dist/api/generators/base/types.js +0 -12
- package/dist/api/generators/types.d.ts +0 -53
- package/dist/api/generators/types.js +0 -4
- package/dist/api/generators/typescript.d.ts +0 -190
- package/dist/api/generators/typescript.js +0 -819
- package/dist/api/index.d.ts +0 -51
- package/dist/api/index.js +0 -50
- package/dist/cli/commands/generate/typescript.d.ts +0 -10
- package/dist/cli/commands/generate/typescript.js +0 -52
- package/dist/cli/commands/generate.d.ts +0 -15
- package/dist/cli/commands/generate.js +0 -159
- package/dist/cli/commands/index.d.ts +0 -29
- package/dist/cli/commands/index.js +0 -100
- package/dist/cli/commands/typeschema/generate.d.ts +0 -19
- package/dist/cli/commands/typeschema/generate.js +0 -124
- package/dist/cli/commands/typeschema.d.ts +0 -10
- package/dist/cli/commands/typeschema.js +0 -47
- package/dist/cli/index.d.ts +0 -9
- package/dist/cli/utils/log.d.ts +0 -10
- package/dist/cli/utils/log.js +0 -23
- package/dist/cli/utils/prompts.d.ts +0 -56
- package/dist/cli/utils/prompts.js +0 -202
- package/dist/cli/utils/spinner.d.ts +0 -110
- package/dist/cli/utils/spinner.js +0 -266
- package/dist/config.d.ts +0 -217
- package/dist/config.js +0 -591
- package/dist/logger.d.ts +0 -157
- package/dist/logger.js +0 -281
- package/dist/typeschema/cache.d.ts +0 -80
- package/dist/typeschema/cache.js +0 -239
- package/dist/typeschema/core/binding.d.ts +0 -11
- package/dist/typeschema/core/binding.js +0 -143
- package/dist/typeschema/core/field-builder.d.ts +0 -12
- package/dist/typeschema/core/field-builder.js +0 -123
- package/dist/typeschema/core/identifier.d.ts +0 -13
- package/dist/typeschema/core/identifier.js +0 -94
- package/dist/typeschema/core/nested-types.d.ts +0 -9
- package/dist/typeschema/core/nested-types.js +0 -93
- package/dist/typeschema/core/transformer.d.ts +0 -11
- package/dist/typeschema/core/transformer.js +0 -235
- package/dist/typeschema/generator.d.ts +0 -36
- package/dist/typeschema/generator.js +0 -243
- package/dist/typeschema/index.d.ts +0 -15
- package/dist/typeschema/index.js +0 -15
- package/dist/typeschema/parser.d.ts +0 -79
- package/dist/typeschema/parser.js +0 -274
- package/dist/typeschema/profile/processor.d.ts +0 -14
- package/dist/typeschema/profile/processor.js +0 -261
- package/dist/typeschema/register.d.ts +0 -21
- package/dist/typeschema/register.js +0 -117
- package/dist/typeschema/types.d.ts +0 -240
- package/dist/typeschema/types.js +0 -19
- package/dist/utils/codegen-logger.d.ts +0 -102
- package/dist/utils/codegen-logger.js +0 -196
- package/dist/utils.d.ts +0 -22
- package/dist/utils.js +0 -42
package/dist/logger.d.ts
DELETED
|
@@ -1,157 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structured Logging System for Atomic Codegen
|
|
3
|
-
*
|
|
4
|
-
* Provides configurable logging with levels, structured output, and context
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Log levels in order of severity
|
|
8
|
-
*/
|
|
9
|
-
export declare enum LogLevel {
|
|
10
|
-
DEBUG = 0,
|
|
11
|
-
INFO = 1,
|
|
12
|
-
WARN = 2,
|
|
13
|
-
ERROR = 3,
|
|
14
|
-
SILENT = 4
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Log entry structure
|
|
18
|
-
*/
|
|
19
|
-
export interface LogEntry {
|
|
20
|
-
timestamp: string;
|
|
21
|
-
level: LogLevel;
|
|
22
|
-
levelName: string;
|
|
23
|
-
message: string;
|
|
24
|
-
context?: Record<string, unknown>;
|
|
25
|
-
error?: {
|
|
26
|
-
name: string;
|
|
27
|
-
message: string;
|
|
28
|
-
code?: string;
|
|
29
|
-
stack?: string;
|
|
30
|
-
context?: Record<string, unknown>;
|
|
31
|
-
suggestions?: string[];
|
|
32
|
-
};
|
|
33
|
-
component?: string;
|
|
34
|
-
operation?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Logger configuration options
|
|
38
|
-
*/
|
|
39
|
-
export interface LoggerConfig {
|
|
40
|
-
level: LogLevel;
|
|
41
|
-
format: "json" | "pretty" | "compact";
|
|
42
|
-
includeTimestamp: boolean;
|
|
43
|
-
includeContext: boolean;
|
|
44
|
-
colorize: boolean;
|
|
45
|
-
component?: string;
|
|
46
|
-
outputs: LogOutput[];
|
|
47
|
-
}
|
|
48
|
-
/**
|
|
49
|
-
* Log output interface
|
|
50
|
-
*/
|
|
51
|
-
export interface LogOutput {
|
|
52
|
-
write(entry: LogEntry, formatted: string): void | Promise<void>;
|
|
53
|
-
}
|
|
54
|
-
/**
|
|
55
|
-
* Logger interface for type safety
|
|
56
|
-
*/
|
|
57
|
-
export interface ILogger {
|
|
58
|
-
debug(message: string, context?: Record<string, unknown>): Promise<void>;
|
|
59
|
-
info(message: string, context?: Record<string, unknown>): Promise<void>;
|
|
60
|
-
warn(message: string, context?: Record<string, unknown>): Promise<void>;
|
|
61
|
-
error(message: string, error?: Error, context?: Record<string, unknown>): Promise<void>;
|
|
62
|
-
child(component: string): ILogger;
|
|
63
|
-
}
|
|
64
|
-
/**
|
|
65
|
-
* Console output implementation
|
|
66
|
-
*/
|
|
67
|
-
export declare class ConsoleOutput implements LogOutput {
|
|
68
|
-
private useStderr;
|
|
69
|
-
constructor(useStderr?: boolean);
|
|
70
|
-
write(entry: LogEntry, formatted: string): void;
|
|
71
|
-
}
|
|
72
|
-
/**
|
|
73
|
-
* File output implementation
|
|
74
|
-
*/
|
|
75
|
-
export declare class FileOutput implements LogOutput {
|
|
76
|
-
private filePath;
|
|
77
|
-
constructor(filePath: string);
|
|
78
|
-
write(_entry: LogEntry, formatted: string): Promise<void>;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Main logger class
|
|
82
|
-
*/
|
|
83
|
-
export declare class Logger {
|
|
84
|
-
private config;
|
|
85
|
-
constructor(config?: Partial<LoggerConfig>);
|
|
86
|
-
/**
|
|
87
|
-
* Update logger configuration
|
|
88
|
-
*/
|
|
89
|
-
configure(config: Partial<LoggerConfig>): void;
|
|
90
|
-
/**
|
|
91
|
-
* Check if a log level should be output
|
|
92
|
-
*/
|
|
93
|
-
private shouldLog;
|
|
94
|
-
/**
|
|
95
|
-
* Create a log entry
|
|
96
|
-
*/
|
|
97
|
-
private createEntry;
|
|
98
|
-
/**
|
|
99
|
-
* Format log entry for output
|
|
100
|
-
*/
|
|
101
|
-
private formatEntry;
|
|
102
|
-
/**
|
|
103
|
-
* Format entry in compact format
|
|
104
|
-
*/
|
|
105
|
-
private formatCompact;
|
|
106
|
-
/**
|
|
107
|
-
* Format entry in pretty format
|
|
108
|
-
*/
|
|
109
|
-
private formatPretty;
|
|
110
|
-
/**
|
|
111
|
-
* Colorize log level if enabled
|
|
112
|
-
*/
|
|
113
|
-
private colorizeLevel;
|
|
114
|
-
/**
|
|
115
|
-
* Write log entry to all outputs
|
|
116
|
-
*/
|
|
117
|
-
private writeEntry;
|
|
118
|
-
/**
|
|
119
|
-
* Log debug message
|
|
120
|
-
*/
|
|
121
|
-
debug(message: string, context?: Record<string, unknown>, operation?: string): Promise<void>;
|
|
122
|
-
/**
|
|
123
|
-
* Log info message
|
|
124
|
-
*/
|
|
125
|
-
info(message: string, context?: Record<string, unknown>, operation?: string): Promise<void>;
|
|
126
|
-
/**
|
|
127
|
-
* Log warning message
|
|
128
|
-
*/
|
|
129
|
-
warn(message: string, context?: Record<string, unknown>, operation?: string): Promise<void>;
|
|
130
|
-
/**
|
|
131
|
-
* Log error message
|
|
132
|
-
*/
|
|
133
|
-
error(message: string, error?: Error, context?: Record<string, unknown>, operation?: string): Promise<void>;
|
|
134
|
-
/**
|
|
135
|
-
* Create a child logger with additional context
|
|
136
|
-
*/
|
|
137
|
-
child(component: string, context?: Record<string, unknown>): Logger;
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Default logger instance
|
|
141
|
-
*/
|
|
142
|
-
export declare const logger: Logger;
|
|
143
|
-
/**
|
|
144
|
-
* Configure the default logger
|
|
145
|
-
*/
|
|
146
|
-
export declare function configureLogger(config: Partial<LoggerConfig>): void;
|
|
147
|
-
/**
|
|
148
|
-
* Create logger from environment variables and config
|
|
149
|
-
*/
|
|
150
|
-
export declare function createLoggerFromConfig(config?: {
|
|
151
|
-
verbose?: boolean;
|
|
152
|
-
debug?: boolean;
|
|
153
|
-
logLevel?: string;
|
|
154
|
-
logFormat?: string;
|
|
155
|
-
logFile?: string;
|
|
156
|
-
component?: string;
|
|
157
|
-
}): Logger;
|
package/dist/logger.js
DELETED
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Structured Logging System for Atomic Codegen
|
|
3
|
-
*
|
|
4
|
-
* Provides configurable logging with levels, structured output, and context
|
|
5
|
-
*/
|
|
6
|
-
/**
|
|
7
|
-
* Log levels in order of severity
|
|
8
|
-
*/
|
|
9
|
-
export var LogLevel;
|
|
10
|
-
(function (LogLevel) {
|
|
11
|
-
LogLevel[LogLevel["DEBUG"] = 0] = "DEBUG";
|
|
12
|
-
LogLevel[LogLevel["INFO"] = 1] = "INFO";
|
|
13
|
-
LogLevel[LogLevel["WARN"] = 2] = "WARN";
|
|
14
|
-
LogLevel[LogLevel["ERROR"] = 3] = "ERROR";
|
|
15
|
-
LogLevel[LogLevel["SILENT"] = 4] = "SILENT";
|
|
16
|
-
})(LogLevel || (LogLevel = {}));
|
|
17
|
-
/**
|
|
18
|
-
* Console output implementation
|
|
19
|
-
*/
|
|
20
|
-
export class ConsoleOutput {
|
|
21
|
-
useStderr;
|
|
22
|
-
constructor(useStderr = false) {
|
|
23
|
-
this.useStderr = useStderr;
|
|
24
|
-
}
|
|
25
|
-
write(entry, formatted) {
|
|
26
|
-
const output = this.useStderr || entry.level >= LogLevel.WARN ? console.error : console.log;
|
|
27
|
-
output(formatted);
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
/**
|
|
31
|
-
* File output implementation
|
|
32
|
-
*/
|
|
33
|
-
export class FileOutput {
|
|
34
|
-
filePath;
|
|
35
|
-
constructor(filePath) {
|
|
36
|
-
this.filePath = filePath;
|
|
37
|
-
}
|
|
38
|
-
async write(_entry, formatted) {
|
|
39
|
-
const _file = Bun.file(this.filePath);
|
|
40
|
-
const content = `${formatted}\n`;
|
|
41
|
-
try {
|
|
42
|
-
// Append to file
|
|
43
|
-
await Bun.write(this.filePath, content, { createPath: true });
|
|
44
|
-
}
|
|
45
|
-
catch (error) {
|
|
46
|
-
// Fallback to console if file write fails
|
|
47
|
-
console.error(`Failed to write to log file ${this.filePath}:`, error);
|
|
48
|
-
console.error(formatted);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Main logger class
|
|
54
|
-
*/
|
|
55
|
-
export class Logger {
|
|
56
|
-
config;
|
|
57
|
-
constructor(config = {}) {
|
|
58
|
-
this.config = {
|
|
59
|
-
level: LogLevel.INFO,
|
|
60
|
-
format: "pretty",
|
|
61
|
-
includeTimestamp: true,
|
|
62
|
-
includeContext: true,
|
|
63
|
-
colorize: true,
|
|
64
|
-
outputs: [new ConsoleOutput()],
|
|
65
|
-
...config,
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
/**
|
|
69
|
-
* Update logger configuration
|
|
70
|
-
*/
|
|
71
|
-
configure(config) {
|
|
72
|
-
this.config = { ...this.config, ...config };
|
|
73
|
-
}
|
|
74
|
-
/**
|
|
75
|
-
* Check if a log level should be output
|
|
76
|
-
*/
|
|
77
|
-
shouldLog(level) {
|
|
78
|
-
return level >= this.config.level;
|
|
79
|
-
}
|
|
80
|
-
/**
|
|
81
|
-
* Create a log entry
|
|
82
|
-
*/
|
|
83
|
-
createEntry(level, message, context, error, operation) {
|
|
84
|
-
const entry = {
|
|
85
|
-
timestamp: new Date().toISOString(),
|
|
86
|
-
level,
|
|
87
|
-
levelName: LogLevel[level],
|
|
88
|
-
message,
|
|
89
|
-
component: this.config.component,
|
|
90
|
-
};
|
|
91
|
-
if (context && this.config.includeContext) {
|
|
92
|
-
entry.context = context;
|
|
93
|
-
}
|
|
94
|
-
if (operation) {
|
|
95
|
-
entry.operation = operation;
|
|
96
|
-
}
|
|
97
|
-
if (error) {
|
|
98
|
-
entry.error = {
|
|
99
|
-
name: error.name,
|
|
100
|
-
message: error.message,
|
|
101
|
-
stack: error.stack,
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
return entry;
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Format log entry for output
|
|
108
|
-
*/
|
|
109
|
-
formatEntry(entry) {
|
|
110
|
-
switch (this.config.format) {
|
|
111
|
-
case "json":
|
|
112
|
-
return JSON.stringify(entry);
|
|
113
|
-
case "compact":
|
|
114
|
-
return this.formatCompact(entry);
|
|
115
|
-
default:
|
|
116
|
-
return this.formatPretty(entry);
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
/**
|
|
120
|
-
* Format entry in compact format
|
|
121
|
-
*/
|
|
122
|
-
formatCompact(entry) {
|
|
123
|
-
const timestamp = this.config.includeTimestamp ? `${entry.timestamp} ` : "";
|
|
124
|
-
const component = entry.component ? `[${entry.component}] ` : "";
|
|
125
|
-
const operation = entry.operation ? `(${entry.operation}) ` : "";
|
|
126
|
-
const level = this.colorizeLevel(entry.levelName, entry.level);
|
|
127
|
-
return `${timestamp}${level} ${component}${operation}${entry.message}`;
|
|
128
|
-
}
|
|
129
|
-
/**
|
|
130
|
-
* Format entry in pretty format
|
|
131
|
-
*/
|
|
132
|
-
formatPretty(entry) {
|
|
133
|
-
let formatted = "";
|
|
134
|
-
// Header line
|
|
135
|
-
const timestamp = this.config.includeTimestamp ? `${entry.timestamp} ` : "";
|
|
136
|
-
const component = entry.component ? `[${entry.component}] ` : "";
|
|
137
|
-
const operation = entry.operation ? `(${entry.operation}) ` : "";
|
|
138
|
-
const level = this.colorizeLevel(entry.levelName.padEnd(5), entry.level);
|
|
139
|
-
formatted += `${timestamp}${level} ${component}${operation}${entry.message}`;
|
|
140
|
-
// Context
|
|
141
|
-
if (entry.context && Object.keys(entry.context).length > 0) {
|
|
142
|
-
formatted += `\n Context: ${JSON.stringify(entry.context, null, 2).split("\n").join("\n ")}`;
|
|
143
|
-
}
|
|
144
|
-
// Error details
|
|
145
|
-
if (entry.error) {
|
|
146
|
-
formatted += `\n Error: [${entry.error.code || entry.error.name}] ${entry.error.message}`;
|
|
147
|
-
if (entry.error.context && Object.keys(entry.error.context).length > 0) {
|
|
148
|
-
formatted += `\n Error Context: ${JSON.stringify(entry.error.context, null, 2).split("\n").join("\n ")}`;
|
|
149
|
-
}
|
|
150
|
-
if (entry.error.suggestions && entry.error.suggestions.length > 0) {
|
|
151
|
-
formatted += `\n Suggestions:\n${entry.error.suggestions.map((s) => ` • ${s}`).join("\n")}`;
|
|
152
|
-
}
|
|
153
|
-
if (entry.level === LogLevel.DEBUG && entry.error.stack) {
|
|
154
|
-
formatted += `\n Stack: ${entry.error.stack.split("\n").join("\n ")}`;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
return formatted;
|
|
158
|
-
}
|
|
159
|
-
/**
|
|
160
|
-
* Colorize log level if enabled
|
|
161
|
-
*/
|
|
162
|
-
colorizeLevel(levelName, level) {
|
|
163
|
-
if (!this.config.colorize) {
|
|
164
|
-
return levelName;
|
|
165
|
-
}
|
|
166
|
-
const colors = {
|
|
167
|
-
[LogLevel.DEBUG]: "\x1b[36m", // Cyan
|
|
168
|
-
[LogLevel.INFO]: "\x1b[32m", // Green
|
|
169
|
-
[LogLevel.WARN]: "\x1b[33m", // Yellow
|
|
170
|
-
[LogLevel.ERROR]: "\x1b[31m", // Red
|
|
171
|
-
};
|
|
172
|
-
const reset = "\x1b[0m";
|
|
173
|
-
// @ts-ignore
|
|
174
|
-
const color = colors[level] || "";
|
|
175
|
-
return `${color}${levelName}${reset}`;
|
|
176
|
-
}
|
|
177
|
-
/**
|
|
178
|
-
* Write log entry to all outputs
|
|
179
|
-
*/
|
|
180
|
-
async writeEntry(entry) {
|
|
181
|
-
if (!this.shouldLog(entry.level)) {
|
|
182
|
-
return;
|
|
183
|
-
}
|
|
184
|
-
const formatted = this.formatEntry(entry);
|
|
185
|
-
for (const output of this.config.outputs) {
|
|
186
|
-
try {
|
|
187
|
-
await output.write(entry, formatted);
|
|
188
|
-
}
|
|
189
|
-
catch (error) {
|
|
190
|
-
// Fallback to console if output fails
|
|
191
|
-
console.error("Logger output failed:", error);
|
|
192
|
-
console.error(formatted);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
/**
|
|
197
|
-
* Log debug message
|
|
198
|
-
*/
|
|
199
|
-
async debug(message, context, operation) {
|
|
200
|
-
const entry = this.createEntry(LogLevel.DEBUG, message, context, undefined, operation);
|
|
201
|
-
await this.writeEntry(entry);
|
|
202
|
-
}
|
|
203
|
-
/**
|
|
204
|
-
* Log info message
|
|
205
|
-
*/
|
|
206
|
-
async info(message, context, operation) {
|
|
207
|
-
const entry = this.createEntry(LogLevel.INFO, message, context, undefined, operation);
|
|
208
|
-
await this.writeEntry(entry);
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Log warning message
|
|
212
|
-
*/
|
|
213
|
-
async warn(message, context, operation) {
|
|
214
|
-
const entry = this.createEntry(LogLevel.WARN, message, context, undefined, operation);
|
|
215
|
-
await this.writeEntry(entry);
|
|
216
|
-
}
|
|
217
|
-
/**
|
|
218
|
-
* Log error message
|
|
219
|
-
*/
|
|
220
|
-
async error(message, error, context, operation) {
|
|
221
|
-
const entry = this.createEntry(LogLevel.ERROR, message, context, error, operation);
|
|
222
|
-
await this.writeEntry(entry);
|
|
223
|
-
}
|
|
224
|
-
/**
|
|
225
|
-
* Create a child logger with additional context
|
|
226
|
-
*/
|
|
227
|
-
child(component, context) {
|
|
228
|
-
const childLogger = new Logger({
|
|
229
|
-
...this.config,
|
|
230
|
-
component: this.config.component ? `${this.config.component}.${component}` : component,
|
|
231
|
-
});
|
|
232
|
-
// If context is provided, wrap all logging methods to include it
|
|
233
|
-
if (context) {
|
|
234
|
-
const originalMethods = {
|
|
235
|
-
debug: childLogger.debug.bind(childLogger),
|
|
236
|
-
info: childLogger.info.bind(childLogger),
|
|
237
|
-
warn: childLogger.warn.bind(childLogger),
|
|
238
|
-
error: childLogger.error.bind(childLogger),
|
|
239
|
-
};
|
|
240
|
-
childLogger.debug = (message, additionalContext, operation) => originalMethods.debug(message, { ...context, ...additionalContext }, operation);
|
|
241
|
-
childLogger.info = (message, additionalContext, operation) => originalMethods.info(message, { ...context, ...additionalContext }, operation);
|
|
242
|
-
childLogger.warn = (message, additionalContext, operation) => originalMethods.warn(message, { ...context, ...additionalContext }, operation);
|
|
243
|
-
childLogger.error = (message, error, additionalContext, operation) => originalMethods.error(message, error, { ...context, ...additionalContext }, operation);
|
|
244
|
-
}
|
|
245
|
-
return childLogger;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
/**
|
|
249
|
-
* Default logger instance
|
|
250
|
-
*/
|
|
251
|
-
export const logger = new Logger();
|
|
252
|
-
/**
|
|
253
|
-
* Configure the default logger
|
|
254
|
-
*/
|
|
255
|
-
export function configureLogger(config) {
|
|
256
|
-
logger.configure(config);
|
|
257
|
-
}
|
|
258
|
-
/**
|
|
259
|
-
* Create logger from environment variables and config
|
|
260
|
-
*/
|
|
261
|
-
export function createLoggerFromConfig(config) {
|
|
262
|
-
const level = config?.debug
|
|
263
|
-
? LogLevel.DEBUG
|
|
264
|
-
: config?.verbose
|
|
265
|
-
? LogLevel.INFO
|
|
266
|
-
: config?.logLevel
|
|
267
|
-
? (LogLevel[config.logLevel.toUpperCase()] ?? LogLevel.INFO)
|
|
268
|
-
: LogLevel.INFO;
|
|
269
|
-
const format = config?.logFormat === "json" ? "json" : config?.logFormat === "compact" ? "compact" : "pretty";
|
|
270
|
-
const outputs = [new ConsoleOutput()];
|
|
271
|
-
if (config?.logFile) {
|
|
272
|
-
outputs.push(new FileOutput(config.logFile));
|
|
273
|
-
}
|
|
274
|
-
return new Logger({
|
|
275
|
-
level,
|
|
276
|
-
format,
|
|
277
|
-
component: config?.component,
|
|
278
|
-
outputs,
|
|
279
|
-
colorize: !config?.logFile, // Disable colors when logging to file
|
|
280
|
-
});
|
|
281
|
-
}
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeSchema Cache System
|
|
3
|
-
*
|
|
4
|
-
* Caching system for TypeSchema documents with both in-memory and persistent file-based storage.
|
|
5
|
-
*/
|
|
6
|
-
import type { TypeSchemaConfig } from "@root/config";
|
|
7
|
-
import type { Identifier, TypeSchema } from "@typeschema/types";
|
|
8
|
-
/**
|
|
9
|
-
* TypeSchema Cache with optional persistent storage
|
|
10
|
-
*/
|
|
11
|
-
export declare class TypeSchemaCache {
|
|
12
|
-
private cache;
|
|
13
|
-
private config;
|
|
14
|
-
private cacheDir?;
|
|
15
|
-
constructor(config?: TypeSchemaConfig);
|
|
16
|
-
/**
|
|
17
|
-
* Store a schema in the cache
|
|
18
|
-
*/
|
|
19
|
-
set(schema: TypeSchema): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Retrieve a schema by identifier
|
|
22
|
-
*/
|
|
23
|
-
get(identifier: Identifier): TypeSchema | null;
|
|
24
|
-
/**
|
|
25
|
-
* Retrieve a schema by URL
|
|
26
|
-
*/
|
|
27
|
-
getByUrl(url: string): TypeSchema | null;
|
|
28
|
-
/**
|
|
29
|
-
* Check if a schema exists in cache
|
|
30
|
-
*/
|
|
31
|
-
has(identifier: Identifier): boolean;
|
|
32
|
-
/**
|
|
33
|
-
* Check if a schema exists by URL
|
|
34
|
-
*/
|
|
35
|
-
hasByUrl(url: string): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Delete a schema from cache
|
|
38
|
-
*/
|
|
39
|
-
delete(identifier: Identifier): boolean;
|
|
40
|
-
/**
|
|
41
|
-
* Delete a schema by URL
|
|
42
|
-
*/
|
|
43
|
-
deleteByUrl(url: string): boolean;
|
|
44
|
-
/**
|
|
45
|
-
* Get schemas by package
|
|
46
|
-
*/
|
|
47
|
-
getByPackage(packageName: string): TypeSchema[];
|
|
48
|
-
/**
|
|
49
|
-
* Get schemas by kind
|
|
50
|
-
*/
|
|
51
|
-
getByKind(kind: string): TypeSchema[];
|
|
52
|
-
/**
|
|
53
|
-
* Store multiple schemas
|
|
54
|
-
*/
|
|
55
|
-
setMany(schemas: TypeSchema[]): void;
|
|
56
|
-
/**
|
|
57
|
-
* Clear all cached schemas
|
|
58
|
-
*/
|
|
59
|
-
clear(): void;
|
|
60
|
-
/**
|
|
61
|
-
* Generate cache key for identifier
|
|
62
|
-
*/
|
|
63
|
-
private generateKey;
|
|
64
|
-
/**
|
|
65
|
-
* Initialize cache directory if persistence is enabled
|
|
66
|
-
*/
|
|
67
|
-
initialize(): Promise<void>;
|
|
68
|
-
/**
|
|
69
|
-
* Load all cached schemas from disk
|
|
70
|
-
*/
|
|
71
|
-
private loadFromDisk;
|
|
72
|
-
/**
|
|
73
|
-
* Persist a schema to disk
|
|
74
|
-
*/
|
|
75
|
-
private persistSchema;
|
|
76
|
-
/**
|
|
77
|
-
* Clear cache directory
|
|
78
|
-
*/
|
|
79
|
-
clearDisk(): Promise<void>;
|
|
80
|
-
}
|