@atomic-ehr/codegen 0.0.1-canary.20251006070905.fb6ed98 → 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 -94
- package/dist/typeschema/core/transformer.d.ts +0 -11
- package/dist/typeschema/core/transformer.js +0 -235
- package/dist/typeschema/generator.d.ts +0 -43
- package/dist/typeschema/generator.js +0 -264
- 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 -262
- 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
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized error handling and reporting system
|
|
3
|
-
*
|
|
4
|
-
* This module provides a comprehensive error handling solution that:
|
|
5
|
-
* - Handles both generator-specific and unknown errors gracefully
|
|
6
|
-
* - Provides rich, context-aware error reporting
|
|
7
|
-
* - Supports multiple output formats (console, JSON, structured)
|
|
8
|
-
* - Includes batch error handling for multiple failures
|
|
9
|
-
* - Offers smart error recovery suggestions
|
|
10
|
-
*/
|
|
11
|
-
import type { TypeSchema } from "@typeschema/types";
|
|
12
|
-
import type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
13
|
-
export interface ErrorHandlerOptions {
|
|
14
|
-
logger: CodegenLogger;
|
|
15
|
-
verbose?: boolean;
|
|
16
|
-
beginnerMode?: boolean;
|
|
17
|
-
outputFormat?: "console" | "json" | "structured";
|
|
18
|
-
}
|
|
19
|
-
/**
|
|
20
|
-
* Centralized error handler with smart reporting
|
|
21
|
-
*/
|
|
22
|
-
export declare class ErrorHandler {
|
|
23
|
-
private options;
|
|
24
|
-
constructor(options: ErrorHandlerOptions);
|
|
25
|
-
/**
|
|
26
|
-
* Handle a single error with appropriate reporting
|
|
27
|
-
*/
|
|
28
|
-
handleError(error: Error, context?: {
|
|
29
|
-
schema?: TypeSchema;
|
|
30
|
-
filename?: string;
|
|
31
|
-
}): void;
|
|
32
|
-
/**
|
|
33
|
-
* Handle multiple errors in batch
|
|
34
|
-
*/
|
|
35
|
-
handleBatchErrors(errors: Error[]): void;
|
|
36
|
-
/**
|
|
37
|
-
* Handle generator-specific errors with rich context
|
|
38
|
-
*/
|
|
39
|
-
private handleGeneratorError;
|
|
40
|
-
/**
|
|
41
|
-
* Handle unknown errors gracefully
|
|
42
|
-
*/
|
|
43
|
-
private handleUnknownError;
|
|
44
|
-
/**
|
|
45
|
-
* Report error to console with formatting
|
|
46
|
-
*/
|
|
47
|
-
private reportErrorToConsole;
|
|
48
|
-
/**
|
|
49
|
-
* Report error as JSON for programmatic consumption
|
|
50
|
-
*/
|
|
51
|
-
private reportErrorAsJson;
|
|
52
|
-
/**
|
|
53
|
-
* Report error in structured format
|
|
54
|
-
*/
|
|
55
|
-
private reportErrorStructured;
|
|
56
|
-
/**
|
|
57
|
-
* Report multiple errors efficiently
|
|
58
|
-
*/
|
|
59
|
-
private reportBatchErrors;
|
|
60
|
-
/**
|
|
61
|
-
* Get common suggestions across similar errors
|
|
62
|
-
*/
|
|
63
|
-
private getCommonSuggestions;
|
|
64
|
-
/**
|
|
65
|
-
* Get recovery actions for an error
|
|
66
|
-
*/
|
|
67
|
-
private getRecoveryActions;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Error boundary for catching and handling all generator errors
|
|
71
|
-
*/
|
|
72
|
-
export declare class GeneratorErrorBoundary {
|
|
73
|
-
private errorHandler;
|
|
74
|
-
constructor(errorHandler: ErrorHandler);
|
|
75
|
-
/**
|
|
76
|
-
* Wrap an async operation with error boundary
|
|
77
|
-
*/
|
|
78
|
-
withErrorBoundary<T>(operation: () => Promise<T>, context?: {
|
|
79
|
-
schema?: TypeSchema;
|
|
80
|
-
filename?: string;
|
|
81
|
-
operationName?: string;
|
|
82
|
-
}): Promise<T>;
|
|
83
|
-
/**
|
|
84
|
-
* Wrap a batch operation with error boundary
|
|
85
|
-
*/
|
|
86
|
-
withBatchErrorBoundary<T>(operations: Array<() => Promise<T>>, _context?: {
|
|
87
|
-
operationName?: string;
|
|
88
|
-
}): Promise<T[]>;
|
|
89
|
-
}
|
|
@@ -1,243 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Centralized error handling and reporting system
|
|
3
|
-
*
|
|
4
|
-
* This module provides a comprehensive error handling solution that:
|
|
5
|
-
* - Handles both generator-specific and unknown errors gracefully
|
|
6
|
-
* - Provides rich, context-aware error reporting
|
|
7
|
-
* - Supports multiple output formats (console, JSON, structured)
|
|
8
|
-
* - Includes batch error handling for multiple failures
|
|
9
|
-
* - Offers smart error recovery suggestions
|
|
10
|
-
*/
|
|
11
|
-
import { BatchOperationError, GeneratorError } from "./errors";
|
|
12
|
-
/**
|
|
13
|
-
* Centralized error handler with smart reporting
|
|
14
|
-
*/
|
|
15
|
-
export class ErrorHandler {
|
|
16
|
-
options;
|
|
17
|
-
constructor(options) {
|
|
18
|
-
this.options = options;
|
|
19
|
-
}
|
|
20
|
-
/**
|
|
21
|
-
* Handle a single error with appropriate reporting
|
|
22
|
-
*/
|
|
23
|
-
handleError(error, context) {
|
|
24
|
-
if (error instanceof GeneratorError) {
|
|
25
|
-
this.handleGeneratorError(error, context);
|
|
26
|
-
}
|
|
27
|
-
else {
|
|
28
|
-
this.handleUnknownError(error, context);
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Handle multiple errors in batch
|
|
33
|
-
*/
|
|
34
|
-
handleBatchErrors(errors) {
|
|
35
|
-
const generatorErrors = errors.filter((e) => e instanceof GeneratorError);
|
|
36
|
-
const unknownErrors = errors.filter((e) => !(e instanceof GeneratorError));
|
|
37
|
-
if (generatorErrors.length > 0) {
|
|
38
|
-
this.reportBatchErrors(generatorErrors);
|
|
39
|
-
}
|
|
40
|
-
unknownErrors.forEach((error) => {
|
|
41
|
-
this.handleUnknownError(error);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Handle generator-specific errors with rich context
|
|
46
|
-
*/
|
|
47
|
-
handleGeneratorError(error, _context) {
|
|
48
|
-
switch (this.options.outputFormat) {
|
|
49
|
-
case "json":
|
|
50
|
-
this.reportErrorAsJson(error);
|
|
51
|
-
break;
|
|
52
|
-
case "structured":
|
|
53
|
-
this.reportErrorStructured(error);
|
|
54
|
-
break;
|
|
55
|
-
default:
|
|
56
|
-
this.reportErrorToConsole(error);
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
/**
|
|
60
|
-
* Handle unknown errors gracefully
|
|
61
|
-
*/
|
|
62
|
-
handleUnknownError(error, context) {
|
|
63
|
-
this.options.logger.error("Unexpected error occurred:", error);
|
|
64
|
-
if (this.options.verbose) {
|
|
65
|
-
console.error("\n🚨 Unexpected Error Details:");
|
|
66
|
-
console.error(` Type: ${error.constructor.name}`);
|
|
67
|
-
console.error(` Message: ${error.message}`);
|
|
68
|
-
if (error.stack) {
|
|
69
|
-
console.error(` Stack: ${error.stack}`);
|
|
70
|
-
}
|
|
71
|
-
if (context?.schema) {
|
|
72
|
-
console.error(` Schema: ${context.schema.identifier.name}`);
|
|
73
|
-
}
|
|
74
|
-
if (context?.filename) {
|
|
75
|
-
console.error(` File: ${context.filename}`);
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
console.error("\n💡 General troubleshooting suggestions:");
|
|
79
|
-
console.error(" • Run with --verbose flag for more details");
|
|
80
|
-
console.error(" • Check your input files for corruption");
|
|
81
|
-
console.error(" • Update to the latest version of atomic-codegen");
|
|
82
|
-
console.error(" • Report this issue at: https://github.com/atomic-ehr/codegen/issues");
|
|
83
|
-
}
|
|
84
|
-
/**
|
|
85
|
-
* Report error to console with formatting
|
|
86
|
-
*/
|
|
87
|
-
reportErrorToConsole(error) {
|
|
88
|
-
if ("getFormattedMessage" in error) {
|
|
89
|
-
console.error(error.getFormattedMessage());
|
|
90
|
-
}
|
|
91
|
-
else {
|
|
92
|
-
console.error(`\n❌ ${error.constructor.name}: ${error.message}`);
|
|
93
|
-
const suggestions = error.getSuggestions();
|
|
94
|
-
if (suggestions.length > 0) {
|
|
95
|
-
console.error("\n💡 Suggestions:");
|
|
96
|
-
suggestions.forEach((suggestion) => {
|
|
97
|
-
console.error(` • ${suggestion}`);
|
|
98
|
-
});
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (this.options.verbose && error.context) {
|
|
102
|
-
console.error("\n🔍 Debug Information:");
|
|
103
|
-
console.error(JSON.stringify(error.context, null, 2));
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
/**
|
|
107
|
-
* Report error as JSON for programmatic consumption
|
|
108
|
-
*/
|
|
109
|
-
reportErrorAsJson(error) {
|
|
110
|
-
const errorData = {
|
|
111
|
-
type: error.constructor.name,
|
|
112
|
-
message: error.message,
|
|
113
|
-
phase: error.phase,
|
|
114
|
-
context: error.context,
|
|
115
|
-
suggestions: error.getSuggestions(),
|
|
116
|
-
timestamp: new Date().toISOString(),
|
|
117
|
-
};
|
|
118
|
-
console.error(JSON.stringify(errorData, null, 2));
|
|
119
|
-
}
|
|
120
|
-
/**
|
|
121
|
-
* Report error in structured format
|
|
122
|
-
*/
|
|
123
|
-
reportErrorStructured(error) {
|
|
124
|
-
const structure = {
|
|
125
|
-
error: {
|
|
126
|
-
type: error.constructor.name,
|
|
127
|
-
message: error.message,
|
|
128
|
-
phase: error.phase,
|
|
129
|
-
},
|
|
130
|
-
context: error.context,
|
|
131
|
-
suggestions: error.getSuggestions(),
|
|
132
|
-
actions: this.getRecoveryActions(error),
|
|
133
|
-
};
|
|
134
|
-
console.error("---");
|
|
135
|
-
console.error("Error Report:");
|
|
136
|
-
console.error(JSON.stringify(structure, null, 2));
|
|
137
|
-
console.error("---");
|
|
138
|
-
}
|
|
139
|
-
/**
|
|
140
|
-
* Report multiple errors efficiently
|
|
141
|
-
*/
|
|
142
|
-
reportBatchErrors(errors) {
|
|
143
|
-
console.error(`\n❌ ${errors.length} errors occurred during generation:`);
|
|
144
|
-
// Group errors by type
|
|
145
|
-
const errorGroups = new Map();
|
|
146
|
-
errors.forEach((error) => {
|
|
147
|
-
const type = error.constructor.name;
|
|
148
|
-
if (!errorGroups.has(type)) {
|
|
149
|
-
errorGroups.set(type, []);
|
|
150
|
-
}
|
|
151
|
-
errorGroups.get(type)?.push(error);
|
|
152
|
-
});
|
|
153
|
-
// Report each group
|
|
154
|
-
for (const [type, groupErrors] of errorGroups) {
|
|
155
|
-
console.error(`\n📋 ${type} (${groupErrors.length} occurrences):`);
|
|
156
|
-
groupErrors.forEach((error, index) => {
|
|
157
|
-
console.error(` ${index + 1}. ${error.message}`);
|
|
158
|
-
if (error.context?.schemaName) {
|
|
159
|
-
console.error(` Schema: ${error.context.schemaName}`);
|
|
160
|
-
}
|
|
161
|
-
});
|
|
162
|
-
// Show common suggestions for this error type
|
|
163
|
-
const commonSuggestions = this.getCommonSuggestions(groupErrors);
|
|
164
|
-
if (commonSuggestions.length > 0) {
|
|
165
|
-
console.error("\n 💡 Common suggestions:");
|
|
166
|
-
commonSuggestions.forEach((suggestion) => {
|
|
167
|
-
console.error(` • ${suggestion}`);
|
|
168
|
-
});
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
/**
|
|
173
|
-
* Get common suggestions across similar errors
|
|
174
|
-
*/
|
|
175
|
-
getCommonSuggestions(errors) {
|
|
176
|
-
const allSuggestions = errors.flatMap((e) => e.getSuggestions());
|
|
177
|
-
const suggestionCounts = new Map();
|
|
178
|
-
allSuggestions.forEach((suggestion) => {
|
|
179
|
-
suggestionCounts.set(suggestion, (suggestionCounts.get(suggestion) || 0) + 1);
|
|
180
|
-
});
|
|
181
|
-
// Return suggestions that appear in at least half the errors
|
|
182
|
-
const threshold = Math.ceil(errors.length / 2);
|
|
183
|
-
return Array.from(suggestionCounts.entries())
|
|
184
|
-
.filter(([_, count]) => count >= threshold)
|
|
185
|
-
.map(([suggestion, _]) => suggestion)
|
|
186
|
-
.slice(0, 5); // Limit to 5 most common
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Get recovery actions for an error
|
|
190
|
-
*/
|
|
191
|
-
getRecoveryActions(error) {
|
|
192
|
-
if ("getRecoveryActions" in error) {
|
|
193
|
-
return error.getRecoveryActions();
|
|
194
|
-
}
|
|
195
|
-
return [
|
|
196
|
-
{ action: "Review error message and suggestions above" },
|
|
197
|
-
{ action: "Check input files and configuration" },
|
|
198
|
-
{ action: "Try with --verbose flag for more information" },
|
|
199
|
-
];
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
/**
|
|
203
|
-
* Error boundary for catching and handling all generator errors
|
|
204
|
-
*/
|
|
205
|
-
export class GeneratorErrorBoundary {
|
|
206
|
-
errorHandler;
|
|
207
|
-
constructor(errorHandler) {
|
|
208
|
-
this.errorHandler = errorHandler;
|
|
209
|
-
}
|
|
210
|
-
/**
|
|
211
|
-
* Wrap an async operation with error boundary
|
|
212
|
-
*/
|
|
213
|
-
async withErrorBoundary(operation, context) {
|
|
214
|
-
try {
|
|
215
|
-
return await operation();
|
|
216
|
-
}
|
|
217
|
-
catch (error) {
|
|
218
|
-
this.errorHandler.handleError(error instanceof Error ? error : new Error(String(error)), context);
|
|
219
|
-
throw error; // Re-throw after handling
|
|
220
|
-
}
|
|
221
|
-
}
|
|
222
|
-
/**
|
|
223
|
-
* Wrap a batch operation with error boundary
|
|
224
|
-
*/
|
|
225
|
-
async withBatchErrorBoundary(operations, _context) {
|
|
226
|
-
const results = [];
|
|
227
|
-
const errors = [];
|
|
228
|
-
for (const operation of operations) {
|
|
229
|
-
try {
|
|
230
|
-
const result = await operation();
|
|
231
|
-
results.push(result);
|
|
232
|
-
}
|
|
233
|
-
catch (error) {
|
|
234
|
-
errors.push(error instanceof Error ? error : new Error(String(error)));
|
|
235
|
-
}
|
|
236
|
-
}
|
|
237
|
-
if (errors.length > 0) {
|
|
238
|
-
this.errorHandler.handleBatchErrors(errors);
|
|
239
|
-
throw new BatchOperationError(`${errors.length} operations failed`, errors.filter((e) => e instanceof GeneratorError));
|
|
240
|
-
}
|
|
241
|
-
return results;
|
|
242
|
-
}
|
|
243
|
-
}
|
|
@@ -1,251 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Comprehensive error handling system for the base generator
|
|
3
|
-
*
|
|
4
|
-
* This module provides rich, contextual error classes that help developers
|
|
5
|
-
* at all skill levels understand and resolve issues quickly.
|
|
6
|
-
*/
|
|
7
|
-
import type { TypeSchema } from "@typeschema/index";
|
|
8
|
-
import type { FileContext } from "./types";
|
|
9
|
-
/**
|
|
10
|
-
* Base error class for all generator-related errors
|
|
11
|
-
*
|
|
12
|
-
* Provides common functionality like context tracking, suggestions,
|
|
13
|
-
* and detailed error reporting that makes debugging easier.
|
|
14
|
-
*/
|
|
15
|
-
export declare abstract class GeneratorError extends Error {
|
|
16
|
-
/** Phase of generation where error occurred */
|
|
17
|
-
readonly phase: "validation" | "generation" | "writing" | "initialization";
|
|
18
|
-
/** Additional context about the error */
|
|
19
|
-
readonly context?: Record<string, unknown> | undefined;
|
|
20
|
-
/** When this error occurred */
|
|
21
|
-
readonly timestamp: Date;
|
|
22
|
-
/** Unique error ID for tracking */
|
|
23
|
-
readonly errorId: string;
|
|
24
|
-
constructor(message: string,
|
|
25
|
-
/** Phase of generation where error occurred */
|
|
26
|
-
phase: "validation" | "generation" | "writing" | "initialization",
|
|
27
|
-
/** Additional context about the error */
|
|
28
|
-
context?: Record<string, unknown> | undefined);
|
|
29
|
-
/**
|
|
30
|
-
* Generate a unique error ID for tracking
|
|
31
|
-
*/
|
|
32
|
-
private generateErrorId;
|
|
33
|
-
/**
|
|
34
|
-
* Get formatted error message with full context
|
|
35
|
-
* This provides a comprehensive view of what went wrong
|
|
36
|
-
*/
|
|
37
|
-
getDetailedMessage(): string;
|
|
38
|
-
/**
|
|
39
|
-
* Format context values for display
|
|
40
|
-
*/
|
|
41
|
-
private formatContextValue;
|
|
42
|
-
/**
|
|
43
|
-
* Get actionable suggestions for fixing the error
|
|
44
|
-
* Each error type should provide specific, helpful suggestions
|
|
45
|
-
*/
|
|
46
|
-
abstract getSuggestions(): string[];
|
|
47
|
-
/**
|
|
48
|
-
* Get error severity level
|
|
49
|
-
*/
|
|
50
|
-
getSeverity(): "error" | "warning" | "info";
|
|
51
|
-
/**
|
|
52
|
-
* Check if this error is recoverable
|
|
53
|
-
*/
|
|
54
|
-
isRecoverable(): boolean;
|
|
55
|
-
/**
|
|
56
|
-
* Get related documentation links
|
|
57
|
-
*/
|
|
58
|
-
getDocumentationLinks(): string[];
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Schema validation errors with intelligent suggestions
|
|
62
|
-
*/
|
|
63
|
-
export declare class SchemaValidationError extends GeneratorError {
|
|
64
|
-
/** The schema that failed validation */
|
|
65
|
-
readonly schema: TypeSchema;
|
|
66
|
-
/** Specific validation errors */
|
|
67
|
-
readonly validationErrors: string[];
|
|
68
|
-
/** Additional user context for better suggestions */
|
|
69
|
-
readonly userContext?: {
|
|
70
|
-
isBeginnerMode?: boolean;
|
|
71
|
-
previousSuccessfulSchemas?: string[];
|
|
72
|
-
commonPatterns?: string[];
|
|
73
|
-
} | undefined;
|
|
74
|
-
constructor(message: string,
|
|
75
|
-
/** The schema that failed validation */
|
|
76
|
-
schema: TypeSchema,
|
|
77
|
-
/** Specific validation errors */
|
|
78
|
-
validationErrors: string[],
|
|
79
|
-
/** Additional user context for better suggestions */
|
|
80
|
-
userContext?: {
|
|
81
|
-
isBeginnerMode?: boolean;
|
|
82
|
-
previousSuccessfulSchemas?: string[];
|
|
83
|
-
commonPatterns?: string[];
|
|
84
|
-
} | undefined);
|
|
85
|
-
getSuggestions(): string[];
|
|
86
|
-
isRecoverable(): boolean;
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Template processing errors with debugging information
|
|
90
|
-
*/
|
|
91
|
-
export declare class TemplateError extends GeneratorError {
|
|
92
|
-
/** Name of the template that failed */
|
|
93
|
-
readonly templateName: string;
|
|
94
|
-
/** Context data passed to the template */
|
|
95
|
-
readonly templateContext: Record<string, unknown>;
|
|
96
|
-
/** Additional debugging information */
|
|
97
|
-
readonly debugInfo?: {
|
|
98
|
-
availableTemplates?: string[];
|
|
99
|
-
missingVariables?: string[];
|
|
100
|
-
templateSource?: string;
|
|
101
|
-
lineNumber?: number;
|
|
102
|
-
columnNumber?: number;
|
|
103
|
-
} | undefined;
|
|
104
|
-
constructor(message: string,
|
|
105
|
-
/** Name of the template that failed */
|
|
106
|
-
templateName: string,
|
|
107
|
-
/** Context data passed to the template */
|
|
108
|
-
templateContext: Record<string, unknown>,
|
|
109
|
-
/** Additional debugging information */
|
|
110
|
-
debugInfo?: {
|
|
111
|
-
availableTemplates?: string[];
|
|
112
|
-
missingVariables?: string[];
|
|
113
|
-
templateSource?: string;
|
|
114
|
-
lineNumber?: number;
|
|
115
|
-
columnNumber?: number;
|
|
116
|
-
} | undefined);
|
|
117
|
-
getSuggestions(): string[];
|
|
118
|
-
/**
|
|
119
|
-
* Find templates with similar names using Levenshtein distance
|
|
120
|
-
*/
|
|
121
|
-
private findSimilarTemplates;
|
|
122
|
-
/**
|
|
123
|
-
* Calculate Levenshtein distance between two strings
|
|
124
|
-
*/
|
|
125
|
-
private levenshteinDistance;
|
|
126
|
-
isRecoverable(): boolean;
|
|
127
|
-
}
|
|
128
|
-
/**
|
|
129
|
-
* File operation errors with recovery suggestions
|
|
130
|
-
*/
|
|
131
|
-
export declare class FileOperationError extends GeneratorError {
|
|
132
|
-
/** Type of file operation that failed */
|
|
133
|
-
readonly operation: "create" | "write" | "read" | "delete" | "copy" | "move";
|
|
134
|
-
/** Path of the file that caused the error */
|
|
135
|
-
readonly filePath: string;
|
|
136
|
-
/** Original system error if available */
|
|
137
|
-
readonly originalError?: Error | undefined;
|
|
138
|
-
/** Recovery options and suggestions */
|
|
139
|
-
readonly recoveryOptions?: {
|
|
140
|
-
canRetry?: boolean;
|
|
141
|
-
alternativePaths?: string[];
|
|
142
|
-
permissionFix?: string;
|
|
143
|
-
diskSpaceRequired?: number;
|
|
144
|
-
} | undefined;
|
|
145
|
-
constructor(message: string,
|
|
146
|
-
/** Type of file operation that failed */
|
|
147
|
-
operation: "create" | "write" | "read" | "delete" | "copy" | "move",
|
|
148
|
-
/** Path of the file that caused the error */
|
|
149
|
-
filePath: string,
|
|
150
|
-
/** Original system error if available */
|
|
151
|
-
originalError?: Error | undefined,
|
|
152
|
-
/** Recovery options and suggestions */
|
|
153
|
-
recoveryOptions?: {
|
|
154
|
-
canRetry?: boolean;
|
|
155
|
-
alternativePaths?: string[];
|
|
156
|
-
permissionFix?: string;
|
|
157
|
-
diskSpaceRequired?: number;
|
|
158
|
-
} | undefined);
|
|
159
|
-
getSuggestions(): string[];
|
|
160
|
-
isRecoverable(): boolean;
|
|
161
|
-
/**
|
|
162
|
-
* Get specific recovery actions that can be taken
|
|
163
|
-
*/
|
|
164
|
-
getRecoveryActions(): Array<{
|
|
165
|
-
action: string;
|
|
166
|
-
command?: string;
|
|
167
|
-
automatic?: boolean;
|
|
168
|
-
riskLevel?: "low" | "medium" | "high";
|
|
169
|
-
}>;
|
|
170
|
-
}
|
|
171
|
-
/**
|
|
172
|
-
* Type mapping errors for language-specific type conversion issues
|
|
173
|
-
*/
|
|
174
|
-
export declare class TypeMappingError extends GeneratorError {
|
|
175
|
-
/** FHIR type that couldn't be mapped */
|
|
176
|
-
readonly fhirType: string;
|
|
177
|
-
/** Target language name */
|
|
178
|
-
readonly targetLanguage: string;
|
|
179
|
-
/** Additional mapping context */
|
|
180
|
-
readonly mappingContext?: {
|
|
181
|
-
availableMappings?: string[];
|
|
182
|
-
suggestedMappings?: Record<string, string>;
|
|
183
|
-
schema?: TypeSchema;
|
|
184
|
-
} | undefined;
|
|
185
|
-
constructor(message: string,
|
|
186
|
-
/** FHIR type that couldn't be mapped */
|
|
187
|
-
fhirType: string,
|
|
188
|
-
/** Target language name */
|
|
189
|
-
targetLanguage: string,
|
|
190
|
-
/** Additional mapping context */
|
|
191
|
-
mappingContext?: {
|
|
192
|
-
availableMappings?: string[];
|
|
193
|
-
suggestedMappings?: Record<string, string>;
|
|
194
|
-
schema?: TypeSchema;
|
|
195
|
-
} | undefined);
|
|
196
|
-
getSuggestions(): string[];
|
|
197
|
-
isRecoverable(): boolean;
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* Configuration errors with validation details
|
|
201
|
-
*/
|
|
202
|
-
export declare class ConfigurationError extends GeneratorError {
|
|
203
|
-
/** Configuration key that has an issue */
|
|
204
|
-
readonly configKey: string;
|
|
205
|
-
/** The invalid value that was provided */
|
|
206
|
-
readonly providedValue: unknown;
|
|
207
|
-
/** Expected value type or format */
|
|
208
|
-
readonly expectedValue?: string | undefined;
|
|
209
|
-
/** Valid options if applicable */
|
|
210
|
-
readonly validOptions?: unknown[] | undefined;
|
|
211
|
-
constructor(message: string,
|
|
212
|
-
/** Configuration key that has an issue */
|
|
213
|
-
configKey: string,
|
|
214
|
-
/** The invalid value that was provided */
|
|
215
|
-
providedValue: unknown,
|
|
216
|
-
/** Expected value type or format */
|
|
217
|
-
expectedValue?: string | undefined,
|
|
218
|
-
/** Valid options if applicable */
|
|
219
|
-
validOptions?: unknown[] | undefined);
|
|
220
|
-
getSuggestions(): string[];
|
|
221
|
-
isRecoverable(): boolean;
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* Batch operation error for multiple failures
|
|
225
|
-
*/
|
|
226
|
-
export declare class BatchOperationError extends GeneratorError {
|
|
227
|
-
/** Individual errors that occurred */
|
|
228
|
-
readonly errors: GeneratorError[];
|
|
229
|
-
constructor(message: string,
|
|
230
|
-
/** Individual errors that occurred */
|
|
231
|
-
errors: GeneratorError[]);
|
|
232
|
-
getSuggestions(): string[];
|
|
233
|
-
/**
|
|
234
|
-
* Get detailed breakdown of all errors
|
|
235
|
-
*/
|
|
236
|
-
getErrorBreakdown(): string;
|
|
237
|
-
isRecoverable(): boolean;
|
|
238
|
-
/**
|
|
239
|
-
* Get errors that are recoverable
|
|
240
|
-
*/
|
|
241
|
-
getRecoverableErrors(): GeneratorError[];
|
|
242
|
-
/**
|
|
243
|
-
* Get errors that are not recoverable
|
|
244
|
-
*/
|
|
245
|
-
getNonRecoverableErrors(): GeneratorError[];
|
|
246
|
-
}
|
|
247
|
-
/**
|
|
248
|
-
* Utility function to create context-aware errors
|
|
249
|
-
* Helps maintain consistent error creation patterns
|
|
250
|
-
*/
|
|
251
|
-
export declare function createErrorWithContext<T extends GeneratorError>(ErrorClass: new (...args: any[]) => T, message: string, context: FileContext, additionalContext?: Record<string, unknown>): T;
|