@atomic-ehr/codegen 0.0.1-canary.20250811235950.67a72a5 → 0.0.1-canary.20250819094151.a48e310
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/api/builder.d.ts.map +1 -1
- package/dist/api/generators/base/BaseGenerator.d.ts +186 -0
- package/dist/api/generators/base/BaseGenerator.d.ts.map +1 -0
- package/dist/api/generators/base/FileManager.d.ts +90 -0
- package/dist/api/generators/base/FileManager.d.ts.map +1 -0
- package/dist/api/generators/base/HandlebarsTemplateEngine.d.ts +60 -0
- package/dist/api/generators/base/HandlebarsTemplateEngine.d.ts.map +1 -0
- package/dist/api/generators/base/PythonTypeMapper.d.ts +17 -0
- package/dist/api/generators/base/PythonTypeMapper.d.ts.map +1 -0
- package/dist/api/generators/base/TemplateEngine.d.ts +127 -0
- package/dist/api/generators/base/TemplateEngine.d.ts.map +1 -0
- package/dist/api/generators/base/TypeMapper.d.ts +130 -0
- package/dist/api/generators/base/TypeMapper.d.ts.map +1 -0
- package/dist/api/generators/base/TypeScriptTypeMapper.d.ts +52 -0
- package/dist/api/generators/base/TypeScriptTypeMapper.d.ts.map +1 -0
- package/dist/api/generators/base/builders/DirectoryBuilder.d.ts +100 -0
- package/dist/api/generators/base/builders/DirectoryBuilder.d.ts.map +1 -0
- package/dist/api/generators/base/builders/FileBuilder.d.ts +161 -0
- package/dist/api/generators/base/builders/FileBuilder.d.ts.map +1 -0
- package/dist/api/generators/base/builders/IndexBuilder.d.ts +127 -0
- package/dist/api/generators/base/builders/IndexBuilder.d.ts.map +1 -0
- package/dist/api/generators/base/enhanced-errors.d.ts +85 -0
- package/dist/api/generators/base/enhanced-errors.d.ts.map +1 -0
- package/dist/api/generators/base/error-handler.d.ts +90 -0
- package/dist/api/generators/base/error-handler.d.ts.map +1 -0
- package/dist/api/generators/base/errors.d.ts +252 -0
- package/dist/api/generators/base/errors.d.ts.map +1 -0
- package/dist/api/generators/base/index.d.ts +104 -0
- package/dist/api/generators/base/index.d.ts.map +1 -0
- package/dist/api/generators/base/types.d.ts +434 -0
- package/dist/api/generators/base/types.d.ts.map +1 -0
- package/dist/api/generators/typescript.d.ts +81 -135
- package/dist/api/generators/typescript.d.ts.map +1 -1
- package/dist/api/index.d.ts +3 -2
- package/dist/api/index.d.ts.map +1 -1
- package/dist/cli/index.js +1 -1
- package/dist/index-vysn9shw.js +14370 -0
- package/dist/index.js +3 -3
- package/package.json +13 -4
- package/dist/index-m60p8fkc.js +0 -6709
|
@@ -0,0 +1,252 @@
|
|
|
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";
|
|
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;
|
|
252
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../../../src/api/generators/base/errors.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACtD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAE3C;;;;;GAKG;AACH,8BAAsB,cAAe,SAAQ,KAAK;IAShD,+CAA+C;aAC/B,KAAK,EAClB,YAAY,GACZ,YAAY,GACZ,SAAS,GACT,gBAAgB;IACnB,yCAAyC;aACzB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC;IAflD,+BAA+B;IAC/B,SAAgB,SAAS,EAAE,IAAI,CAAC;IAEhC,mCAAmC;IACnC,SAAgB,OAAO,EAAE,MAAM,CAAC;gBAG/B,OAAO,EAAE,MAAM;IACf,+CAA+C;IAC/B,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AAC,MAAM,EAAE,OAAO,CAAC,GACzC,CAAC,CAYH"}
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base Generator Public API
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the base generator system.
|
|
5
|
+
* Import from here to access all base generator functionality with
|
|
6
|
+
* clean, well-organized exports.
|
|
7
|
+
*/
|
|
8
|
+
export { BaseGenerator } from "./BaseGenerator";
|
|
9
|
+
export { PythonTypeMapper } from "./PythonTypeMapper";
|
|
10
|
+
export type { TypeMapperOptions } from "./TypeMapper";
|
|
11
|
+
export { TypeMapper } from "./TypeMapper";
|
|
12
|
+
export type { TypeScriptTypeMapperOptions } from "./TypeScriptTypeMapper";
|
|
13
|
+
export { TypeScriptTypeMapper } from "./TypeScriptTypeMapper";
|
|
14
|
+
export type { ConfigValidationResult, GeneratorCapabilities, LanguageType, TemplateContext, } from "./types";
|
|
15
|
+
export type { BaseGeneratorOptions, FileBuilderOptions, } from "./types";
|
|
16
|
+
export type { DirectoryBuilderConfig } from "./builders/DirectoryBuilder";
|
|
17
|
+
export { DirectoryBuilder } from "./builders/DirectoryBuilder";
|
|
18
|
+
export type { FileBuilderConfig } from "./builders/FileBuilder";
|
|
19
|
+
export { FileBuilder } from "./builders/FileBuilder";
|
|
20
|
+
export type { IndexBuilderConfig } from "./builders/IndexBuilder";
|
|
21
|
+
export { IndexBuilder } from "./builders/IndexBuilder";
|
|
22
|
+
export type { FileManagerOptions, WriteFileResult } from "./FileManager";
|
|
23
|
+
export { FileManager } from "./FileManager";
|
|
24
|
+
export type { HandlebarsTemplateEngineOptions } from "./HandlebarsTemplateEngine";
|
|
25
|
+
export { HandlebarsTemplateEngine } from "./HandlebarsTemplateEngine";
|
|
26
|
+
export type { TemplateInfo, TemplateOptions, } from "./TemplateEngine";
|
|
27
|
+
export { TemplateEngine } from "./TemplateEngine";
|
|
28
|
+
export { BatchOperationError, ConfigurationError, createErrorWithContext, FileOperationError, GeneratorError, SchemaValidationError, TemplateError, TypeMappingError, } from "./errors";
|
|
29
|
+
export type { AfterSaveHook, BatchResult, BeforeSaveHook, ErrorHook, FileContext, FileStats, GeneratedFile, ProgressCallback, } from "./types";
|
|
30
|
+
export type { TypeSchema, TypeSchemaIdentifier, } from "../../../typeschema";
|
|
31
|
+
export type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
32
|
+
/**
|
|
33
|
+
* Helper type for creating generator options with language-specific extensions
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```typescript
|
|
37
|
+
* interface TypeScriptOptions extends GeneratorOptions<{
|
|
38
|
+
* moduleFormat: 'esm' | 'cjs';
|
|
39
|
+
* generateIndex: boolean;
|
|
40
|
+
* }> {}
|
|
41
|
+
* ```
|
|
42
|
+
*/
|
|
43
|
+
export type GeneratorOptions<TExtensions = {}> = import("./types").BaseGeneratorOptions & TExtensions;
|
|
44
|
+
/**
|
|
45
|
+
* Helper type for generator result arrays
|
|
46
|
+
* Useful for typing the return value of generate() methods
|
|
47
|
+
*/
|
|
48
|
+
export type GeneratorResult = import("./types").GeneratedFile[];
|
|
49
|
+
/**
|
|
50
|
+
* Helper type for async generator functions
|
|
51
|
+
*/
|
|
52
|
+
export type AsyncGenerator<TOptions extends import("./types").BaseGeneratorOptions, TResult extends import("./types").GeneratedFile[]> = (options: TOptions) => Promise<TResult>;
|
|
53
|
+
/**
|
|
54
|
+
* Type guard to check if an object is a GeneratedFile
|
|
55
|
+
*/
|
|
56
|
+
export declare function isGeneratedFile(obj: unknown): obj is import("./types").GeneratedFile;
|
|
57
|
+
/**
|
|
58
|
+
* Type guard to check if an error is a GeneratorError
|
|
59
|
+
*/
|
|
60
|
+
export declare function isGeneratorError(error: unknown): error is import("./errors").GeneratorError;
|
|
61
|
+
/**
|
|
62
|
+
* Base generator system version
|
|
63
|
+
* Updated automatically during build process
|
|
64
|
+
*/
|
|
65
|
+
export declare const VERSION = "1.0.0";
|
|
66
|
+
/**
|
|
67
|
+
* Supported TypeSchema version
|
|
68
|
+
*/
|
|
69
|
+
export declare const SUPPORTED_TYPESCHEMA_VERSION = "1.0.0";
|
|
70
|
+
/**
|
|
71
|
+
* Create a development logger for testing
|
|
72
|
+
* @param prefix - Logger prefix
|
|
73
|
+
* @param verbose - Enable verbose logging
|
|
74
|
+
*/
|
|
75
|
+
export declare function createDevLogger(prefix?: string, verbose?: boolean): any;
|
|
76
|
+
/**
|
|
77
|
+
* Validate generator options before instantiation
|
|
78
|
+
* @param options - Options to validate
|
|
79
|
+
* @returns Validation result with errors and suggestions
|
|
80
|
+
*/
|
|
81
|
+
export declare function validateGeneratorOptions(options: import("./types").BaseGeneratorOptions): import("./types").ConfigValidationResult;
|
|
82
|
+
/**
|
|
83
|
+
* Default generator options
|
|
84
|
+
*/
|
|
85
|
+
export declare const DEFAULT_GENERATOR_OPTIONS: Partial<import("./types").BaseGeneratorOptions>;
|
|
86
|
+
/**
|
|
87
|
+
* Maximum recommended batch size for schema processing
|
|
88
|
+
*/
|
|
89
|
+
export declare const MAX_BATCH_SIZE = 50;
|
|
90
|
+
/**
|
|
91
|
+
* Default file builder options
|
|
92
|
+
*/
|
|
93
|
+
export declare const DEFAULT_FILE_BUILDER_OPTIONS: Partial<import("./types").FileBuilderOptions>;
|
|
94
|
+
/**
|
|
95
|
+
* @deprecated Use BaseGenerator instead
|
|
96
|
+
* Provided for backwards compatibility only
|
|
97
|
+
*/
|
|
98
|
+
export { BaseGenerator as Generator } from "./BaseGenerator";
|
|
99
|
+
/**
|
|
100
|
+
* @deprecated Use GeneratorError instead
|
|
101
|
+
* Provided for backwards compatibility only
|
|
102
|
+
*/
|
|
103
|
+
export { GeneratorError as BaseError } from "./errors";
|
|
104
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/api/generators/base/index.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAOH,OAAO,EAAE,aAAa,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