@atomic-ehr/codegen 0.0.1-canary.20250924120719.44f2f7c → 0.0.1-canary.20250927094522.7f26cfe
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 +7 -5
- package/dist/api/builder.js +8 -6
- package/dist/api/generators/base/BaseGenerator.d.ts +5 -5
- package/dist/api/generators/base/BaseGenerator.js +4 -4
- package/dist/api/generators/base/FileManager.d.ts +2 -2
- package/dist/api/generators/base/FileManager.js +1 -1
- package/dist/api/generators/base/PythonTypeMapper.d.ts +3 -3
- package/dist/api/generators/base/PythonTypeMapper.js +1 -1
- package/dist/api/generators/base/TemplateEngine.d.ts +1 -1
- package/dist/api/generators/base/TemplateEngine.js +1 -1
- package/dist/api/generators/base/TypeMapper.d.ts +2 -2
- package/dist/api/generators/base/TypeScriptTypeMapper.d.ts +3 -3
- package/dist/api/generators/base/TypeScriptTypeMapper.js +1 -1
- package/dist/api/generators/base/builders/DirectoryBuilder.d.ts +4 -4
- package/dist/api/generators/base/builders/FileBuilder.d.ts +2 -2
- package/dist/api/generators/base/builders/IndexBuilder.d.ts +2 -2
- package/dist/api/generators/base/enhanced-errors.d.ts +2 -2
- package/dist/api/generators/base/enhanced-errors.js +1 -1
- package/dist/api/generators/base/error-handler.d.ts +2 -2
- package/dist/api/generators/base/error-handler.js +1 -1
- package/dist/api/generators/base/errors.d.ts +2 -2
- package/dist/api/generators/base/index.d.ts +22 -22
- package/dist/api/generators/base/index.js +11 -11
- package/dist/api/generators/base/types.d.ts +4 -4
- package/dist/api/generators/typescript.d.ts +6 -6
- package/dist/api/generators/typescript.js +54 -46
- package/dist/api/index.d.ts +8 -8
- package/dist/api/index.js +3 -3
- package/dist/cli/commands/generate/typescript.d.ts +1 -1
- package/dist/cli/commands/generate/typescript.js +2 -2
- package/dist/cli/commands/generate.d.ts +1 -1
- package/dist/cli/commands/generate.js +4 -4
- package/dist/cli/commands/index.js +3 -3
- package/dist/cli/commands/typeschema/generate.js +3 -3
- package/dist/cli/commands/typeschema.js +2 -2
- package/dist/cli/index.js +55 -55
- package/dist/cli/utils/log.d.ts +2 -2
- package/dist/cli/utils/log.js +2 -2
- package/dist/config.d.ts +2 -2
- package/dist/config.js +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/typeschema/cache.d.ts +7 -7
- package/dist/typeschema/core/binding.d.ts +1 -1
- package/dist/typeschema/core/binding.js +6 -4
- package/dist/typeschema/core/field-builder.d.ts +3 -3
- package/dist/typeschema/core/field-builder.js +3 -3
- package/dist/typeschema/core/identifier.d.ts +5 -17
- package/dist/typeschema/core/identifier.js +15 -47
- package/dist/typeschema/core/nested-types.d.ts +2 -2
- package/dist/typeschema/core/nested-types.js +2 -2
- package/dist/typeschema/core/transformer.d.ts +3 -3
- package/dist/typeschema/core/transformer.js +20 -28
- package/dist/typeschema/generator.d.ts +3 -4
- package/dist/typeschema/generator.js +12 -14
- package/dist/typeschema/index.d.ts +4 -5
- package/dist/typeschema/index.js +4 -4
- package/dist/typeschema/parser.d.ts +5 -5
- package/dist/typeschema/profile/processor.d.ts +2 -3
- package/dist/typeschema/profile/processor.js +12 -10
- package/dist/typeschema/types.d.ts +66 -375
- package/dist/typeschema/types.js +14 -2
- package/dist/typeschema/value-set/processor.d.ts +1 -1
- package/dist/typeschema/value-set/processor.js +1 -1
- package/package.json +2 -2
- package/dist/typeschema/schema.d.ts +0 -485
- package/dist/typeschema/schema.js +0 -456
- package/dist/typeschema/type-schema.types.d.ts +0 -186
- package/dist/typeschema/type-schema.types.js +0 -39
- package/dist/typeschema/utils.d.ts +0 -6
- package/dist/typeschema/utils.js +0 -13
package/dist/api/builder.d.ts
CHANGED
|
@@ -4,9 +4,10 @@
|
|
|
4
4
|
* Provides a fluent, chainable API for common codegen use cases with pre-built generators.
|
|
5
5
|
* This builder pattern allows users to configure generation in a declarative way.
|
|
6
6
|
*/
|
|
7
|
-
import type { Config, TypeSchemaConfig } from "../config
|
|
8
|
-
import type { TypeSchema } from "
|
|
9
|
-
import type { CodegenLogger } from "../utils/codegen-logger
|
|
7
|
+
import type { Config, TypeSchemaConfig } from "../config";
|
|
8
|
+
import type { TypeSchema } from "@typeschema/types";
|
|
9
|
+
import type { CodegenLogger } from "../utils/codegen-logger";
|
|
10
|
+
import type { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
10
11
|
/**
|
|
11
12
|
* Configuration options for the API builder
|
|
12
13
|
*/
|
|
@@ -18,6 +19,7 @@ export interface APIBuilderOptions {
|
|
|
18
19
|
cache?: boolean;
|
|
19
20
|
typeSchemaConfig?: TypeSchemaConfig;
|
|
20
21
|
logger?: CodegenLogger;
|
|
22
|
+
manager?: ReturnType<typeof CanonicalManager> | null;
|
|
21
23
|
}
|
|
22
24
|
/**
|
|
23
25
|
* Progress callback for long-running operations
|
|
@@ -75,8 +77,8 @@ export declare class APIBuilder {
|
|
|
75
77
|
includeProfiles?: boolean;
|
|
76
78
|
generateValueSets?: boolean;
|
|
77
79
|
includeValueSetHelpers?: boolean;
|
|
78
|
-
valueSetStrengths?: (
|
|
79
|
-
valueSetMode?:
|
|
80
|
+
valueSetStrengths?: ("required" | "preferred" | "extensible" | "example")[];
|
|
81
|
+
valueSetMode?: "all" | "required-only" | "custom";
|
|
80
82
|
valueSetDirectory?: string;
|
|
81
83
|
}): APIBuilder;
|
|
82
84
|
/**
|
package/dist/api/builder.js
CHANGED
|
@@ -4,9 +4,9 @@
|
|
|
4
4
|
* Provides a fluent, chainable API for common codegen use cases with pre-built generators.
|
|
5
5
|
* This builder pattern allows users to configure generation in a declarative way.
|
|
6
6
|
*/
|
|
7
|
-
import { TypeSchemaCache, TypeSchemaGenerator, TypeSchemaParser, } from "
|
|
8
|
-
import { createLogger } from "../utils/codegen-logger
|
|
9
|
-
import { TypeScriptGenerator } from "./generators/typescript
|
|
7
|
+
import { TypeSchemaCache, TypeSchemaGenerator, TypeSchemaParser, } from "@typeschema/index";
|
|
8
|
+
import { createLogger } from "../utils/codegen-logger";
|
|
9
|
+
import { TypeScriptGenerator } from "./generators/typescript";
|
|
10
10
|
/**
|
|
11
11
|
* High-Level API Builder class
|
|
12
12
|
*
|
|
@@ -31,6 +31,7 @@ export class APIBuilder {
|
|
|
31
31
|
validate: options.validate ?? true,
|
|
32
32
|
cache: options.cache ?? true,
|
|
33
33
|
typeSchemaConfig: options.typeSchemaConfig,
|
|
34
|
+
manager: options.manager || null,
|
|
34
35
|
};
|
|
35
36
|
this.typeSchemaConfig = options.typeSchemaConfig;
|
|
36
37
|
// Use provided logger or create a default one
|
|
@@ -86,10 +87,10 @@ export class APIBuilder {
|
|
|
86
87
|
includeProfiles: options.includeProfiles ?? false,
|
|
87
88
|
generateValueSets: options.generateValueSets ?? false,
|
|
88
89
|
includeValueSetHelpers: options.includeValueSetHelpers ?? false,
|
|
89
|
-
valueSetStrengths: options.valueSetStrengths ?? [
|
|
90
|
+
valueSetStrengths: options.valueSetStrengths ?? ["required"],
|
|
90
91
|
logger: this.logger.child("TS"),
|
|
91
|
-
valueSetMode: options.valueSetMode ??
|
|
92
|
-
valueSetDirectory: options.valueSetDirectory ??
|
|
92
|
+
valueSetMode: options.valueSetMode ?? "required-only",
|
|
93
|
+
valueSetDirectory: options.valueSetDirectory ?? "valuesets",
|
|
93
94
|
verbose: this.options.verbose,
|
|
94
95
|
validate: true, // Enable validation for debugging
|
|
95
96
|
overwrite: this.options.overwrite,
|
|
@@ -217,6 +218,7 @@ export class APIBuilder {
|
|
|
217
218
|
verbose: this.options.verbose,
|
|
218
219
|
logger: this.logger.child("Schema"),
|
|
219
220
|
treeshake: this.typeSchemaConfig?.treeshake,
|
|
221
|
+
manager: this.options.manager,
|
|
220
222
|
}, this.typeSchemaConfig);
|
|
221
223
|
this.typeSchemaGenerator = generator;
|
|
222
224
|
const schemas = await generator.generateFromPackage(packageName, version);
|
|
@@ -5,11 +5,11 @@
|
|
|
5
5
|
* extend this class to inherit common functionality while implementing their own
|
|
6
6
|
* specific logic for type mapping, content generation, and validation.
|
|
7
7
|
*/
|
|
8
|
-
import type { TypeSchema } from "
|
|
9
|
-
import type { CodegenLogger } from "../../../utils/codegen-logger
|
|
10
|
-
import { ErrorHandler, GeneratorErrorBoundary } from "./error-handler
|
|
11
|
-
import { FileManager } from "./FileManager
|
|
12
|
-
import type { BaseGeneratorOptions, GeneratedFile, GeneratorCapabilities, ProgressCallback, TemplateContext, TemplateEngine, TypeMapper } from "./types
|
|
8
|
+
import type { TypeSchema } from "@typeschema/types";
|
|
9
|
+
import type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
10
|
+
import { ErrorHandler, GeneratorErrorBoundary } from "./error-handler";
|
|
11
|
+
import { FileManager } from "./FileManager";
|
|
12
|
+
import type { BaseGeneratorOptions, GeneratedFile, GeneratorCapabilities, ProgressCallback, TemplateContext, TemplateEngine, TypeMapper } from "./types";
|
|
13
13
|
/**
|
|
14
14
|
* Abstract base generator class with comprehensive functionality
|
|
15
15
|
*
|
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
* extend this class to inherit common functionality while implementing their own
|
|
6
6
|
* specific logic for type mapping, content generation, and validation.
|
|
7
7
|
*/
|
|
8
|
-
import { createLogger } from "../../../utils/codegen-logger
|
|
9
|
-
import { ErrorHandler, GeneratorErrorBoundary } from "./error-handler
|
|
10
|
-
import { ConfigurationError, SchemaValidationError } from "./errors
|
|
11
|
-
import { FileManager } from "./FileManager
|
|
8
|
+
import { createLogger } from "../../../utils/codegen-logger";
|
|
9
|
+
import { ErrorHandler, GeneratorErrorBoundary } from "./error-handler";
|
|
10
|
+
import { ConfigurationError, SchemaValidationError } from "./errors";
|
|
11
|
+
import { FileManager } from "./FileManager";
|
|
12
12
|
/**
|
|
13
13
|
* Abstract base generator class with comprehensive functionality
|
|
14
14
|
*
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This replaces scattered writeFile calls with a comprehensive file management
|
|
5
5
|
* system that provides better error handling, performance, and maintainability.
|
|
6
6
|
*/
|
|
7
|
-
import type { CodegenLogger } from "../../../utils/codegen-logger
|
|
8
|
-
import type { FileStats } from "./types
|
|
7
|
+
import type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
8
|
+
import type { FileStats } from "./types";
|
|
9
9
|
export interface FileManagerOptions {
|
|
10
10
|
outputDir: string;
|
|
11
11
|
logger: CodegenLogger;
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { access, mkdir, rm, stat, writeFile } from "node:fs/promises";
|
|
8
8
|
import { dirname, join, relative } from "node:path";
|
|
9
|
-
import { FileOperationError } from "./errors
|
|
9
|
+
import { FileOperationError } from "./errors";
|
|
10
10
|
/**
|
|
11
11
|
* High-performance file manager with batching and error recovery
|
|
12
12
|
*
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Python type mapper implementation (basic version)
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import { type LanguageType, TypeMapper } from "./TypeMapper
|
|
4
|
+
import type { Identifier } from "@typeschema/index";
|
|
5
|
+
import { type LanguageType, TypeMapper } from "./TypeMapper";
|
|
6
6
|
export declare class PythonTypeMapper extends TypeMapper {
|
|
7
7
|
getLanguageName(): string;
|
|
8
8
|
mapPrimitive(fhirType: string): LanguageType;
|
|
9
|
-
mapReference(_targets:
|
|
9
|
+
mapReference(_targets: Identifier[]): LanguageType;
|
|
10
10
|
mapArray(elementType: LanguageType): LanguageType;
|
|
11
11
|
mapOptional(type: LanguageType, required: boolean): LanguageType;
|
|
12
12
|
mapEnum(_values: string[], name?: string): LanguageType;
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
* - Function templates (TypeScript functions)
|
|
8
8
|
* - Inline templates (template literals)
|
|
9
9
|
*/
|
|
10
|
-
import type { CodegenLogger } from "../../../utils/codegen-logger
|
|
10
|
+
import type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
11
11
|
/**
|
|
12
12
|
* Template context passed to templates
|
|
13
13
|
*/
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* This provides the interface that all language generators must implement
|
|
5
5
|
* to convert FHIR TypeSchema types into their target language types.
|
|
6
6
|
*/
|
|
7
|
-
import type {
|
|
7
|
+
import type { Identifier } from "@typeschema/types";
|
|
8
8
|
/**
|
|
9
9
|
* Represents a type in the target language
|
|
10
10
|
*/
|
|
@@ -58,7 +58,7 @@ export declare abstract class TypeMapper {
|
|
|
58
58
|
* Map a reference type to target language
|
|
59
59
|
* @param targets Array of possible reference targets
|
|
60
60
|
*/
|
|
61
|
-
abstract mapReference(targets:
|
|
61
|
+
abstract mapReference(targets: Identifier[]): LanguageType;
|
|
62
62
|
/**
|
|
63
63
|
* Map an array type to target language
|
|
64
64
|
* @param elementType The type of array elements
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* TypeScript-specific type mapper implementation
|
|
3
3
|
*/
|
|
4
|
-
import type {
|
|
5
|
-
import { type LanguageType, TypeMapper, type TypeMapperOptions } from "./TypeMapper
|
|
4
|
+
import type { Identifier } from "@typeschema/types";
|
|
5
|
+
import { type LanguageType, TypeMapper, type TypeMapperOptions } from "./TypeMapper";
|
|
6
6
|
/**
|
|
7
7
|
* TypeScript-specific options
|
|
8
8
|
*/
|
|
@@ -24,7 +24,7 @@ export declare class TypeScriptTypeMapper extends TypeMapper {
|
|
|
24
24
|
constructor(options?: TypeScriptTypeMapperOptions);
|
|
25
25
|
getLanguageName(): string;
|
|
26
26
|
mapPrimitive(fhirType: string): LanguageType;
|
|
27
|
-
mapReference(targets:
|
|
27
|
+
mapReference(targets: Identifier[]): LanguageType;
|
|
28
28
|
mapArray(elementType: LanguageType): LanguageType;
|
|
29
29
|
mapOptional(type: LanguageType, required: boolean): LanguageType;
|
|
30
30
|
mapEnum(values: string[], name?: string): LanguageType;
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* Provides a fluent API for managing entire directories of files,
|
|
5
5
|
* including subdirectories, index files, and batch operations.
|
|
6
6
|
*/
|
|
7
|
-
import type { CodegenLogger } from "../../../../utils/codegen-logger
|
|
8
|
-
import type { FileManager } from "../FileManager
|
|
9
|
-
import type { FileBuilder } from "./FileBuilder
|
|
10
|
-
import type { IndexBuilder } from "./IndexBuilder
|
|
7
|
+
import type { CodegenLogger } from "../../../../utils/codegen-logger";
|
|
8
|
+
import type { FileManager } from "../FileManager";
|
|
9
|
+
import type { FileBuilder } from "./FileBuilder";
|
|
10
|
+
import type { IndexBuilder } from "./IndexBuilder";
|
|
11
11
|
export interface DirectoryBuilderConfig {
|
|
12
12
|
path: string;
|
|
13
13
|
fileManager: FileManager;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This provides a clean, chainable API for building files with imports,
|
|
5
5
|
* exports, content generation, and lifecycle hooks for customization.
|
|
6
6
|
*/
|
|
7
|
-
import type { CodegenLogger } from "../../../../utils/codegen-logger
|
|
8
|
-
import type { FileManager } from "../FileManager
|
|
7
|
+
import type { CodegenLogger } from "../../../../utils/codegen-logger";
|
|
8
|
+
import type { FileManager } from "../FileManager";
|
|
9
9
|
import type { AfterSaveHook, BeforeSaveHook, ErrorHook, FileBuilderOptions, FileContext, TemplateEngine, TypeMapper } from "../types";
|
|
10
10
|
export interface FileBuilderConfig {
|
|
11
11
|
filename: string;
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* Automatically generates index files that export all types and functions
|
|
5
5
|
* from a directory, with support for grouping and namespaces.
|
|
6
6
|
*/
|
|
7
|
-
import type { CodegenLogger } from "../../../../utils/codegen-logger
|
|
8
|
-
import type { FileManager } from "../FileManager
|
|
7
|
+
import type { CodegenLogger } from "../../../../utils/codegen-logger";
|
|
8
|
+
import type { FileManager } from "../FileManager";
|
|
9
9
|
import type { TemplateEngine } from "../types";
|
|
10
10
|
export interface IndexBuilderConfig {
|
|
11
11
|
directory: string;
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
* even more detailed error context, smarter suggestions, and better
|
|
6
6
|
* user experience for developers at all skill levels.
|
|
7
7
|
*/
|
|
8
|
-
import type { TypeSchema } from "
|
|
9
|
-
import { GeneratorError } from "./errors
|
|
8
|
+
import type { TypeSchema } from "@typeschema/index";
|
|
9
|
+
import { GeneratorError } from "./errors";
|
|
10
10
|
/**
|
|
11
11
|
* Enhanced schema validation error with smart suggestions
|
|
12
12
|
*/
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* even more detailed error context, smarter suggestions, and better
|
|
6
6
|
* user experience for developers at all skill levels.
|
|
7
7
|
*/
|
|
8
|
-
import { GeneratorError } from "./errors
|
|
8
|
+
import { GeneratorError } from "./errors";
|
|
9
9
|
/**
|
|
10
10
|
* Enhanced schema validation error with smart suggestions
|
|
11
11
|
*/
|
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* - Includes batch error handling for multiple failures
|
|
9
9
|
* - Offers smart error recovery suggestions
|
|
10
10
|
*/
|
|
11
|
-
import type { TypeSchema } from "
|
|
12
|
-
import type { CodegenLogger } from "../../../utils/codegen-logger
|
|
11
|
+
import type { TypeSchema } from "@typeschema/types";
|
|
12
|
+
import type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
13
13
|
export interface ErrorHandlerOptions {
|
|
14
14
|
logger: CodegenLogger;
|
|
15
15
|
verbose?: boolean;
|
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* - Includes batch error handling for multiple failures
|
|
9
9
|
* - Offers smart error recovery suggestions
|
|
10
10
|
*/
|
|
11
|
-
import { BatchOperationError, GeneratorError } from "./errors
|
|
11
|
+
import { BatchOperationError, GeneratorError } from "./errors";
|
|
12
12
|
/**
|
|
13
13
|
* Centralized error handler with smart reporting
|
|
14
14
|
*/
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This module provides rich, contextual error classes that help developers
|
|
5
5
|
* at all skill levels understand and resolve issues quickly.
|
|
6
6
|
*/
|
|
7
|
-
import type { TypeSchema } from "
|
|
8
|
-
import type { FileContext } from "./types
|
|
7
|
+
import type { TypeSchema } from "@typeschema/index";
|
|
8
|
+
import type { FileContext } from "./types";
|
|
9
9
|
/**
|
|
10
10
|
* Base error class for all generator-related errors
|
|
11
11
|
*
|
|
@@ -5,26 +5,26 @@
|
|
|
5
5
|
* Import from here to access all base generator functionality with
|
|
6
6
|
* clean, well-organized exports.
|
|
7
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
|
|
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 { BatchOperationError, ConfigurationError, createErrorWithContext, FileOperationError, GeneratorError, SchemaValidationError, TemplateError, TypeMappingError, } from "./errors
|
|
25
|
-
export type { AfterSaveHook, BatchResult, BeforeSaveHook, ErrorHook, FileContext, FileStats, GeneratedFile, ProgressCallback, } from "./types
|
|
26
|
-
export type { TypeSchema,
|
|
27
|
-
export type { CodegenLogger } from "../../../utils/codegen-logger
|
|
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 { BatchOperationError, ConfigurationError, createErrorWithContext, FileOperationError, GeneratorError, SchemaValidationError, TemplateError, TypeMappingError, } from "./errors";
|
|
25
|
+
export type { AfterSaveHook, BatchResult, BeforeSaveHook, ErrorHook, FileContext, FileStats, GeneratedFile, ProgressCallback, } from "./types";
|
|
26
|
+
export type { TypeSchema, Identifier } from "@typeschema/index";
|
|
27
|
+
export type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
28
28
|
/**
|
|
29
29
|
* Helper type for creating generator options with language-specific extensions
|
|
30
30
|
*
|
|
@@ -91,9 +91,9 @@ export declare const DEFAULT_FILE_BUILDER_OPTIONS: Partial<import("./types").Fil
|
|
|
91
91
|
* @deprecated Use BaseGenerator instead
|
|
92
92
|
* Provided for backwards compatibility only
|
|
93
93
|
*/
|
|
94
|
-
export { BaseGenerator as Generator } from "./BaseGenerator
|
|
94
|
+
export { BaseGenerator as Generator } from "./BaseGenerator";
|
|
95
95
|
/**
|
|
96
96
|
* @deprecated Use GeneratorError instead
|
|
97
97
|
* Provided for backwards compatibility only
|
|
98
98
|
*/
|
|
99
|
-
export { GeneratorError as BaseError } from "./errors
|
|
99
|
+
export { GeneratorError as BaseError } from "./errors";
|
|
@@ -9,22 +9,22 @@
|
|
|
9
9
|
// Core Base Generator System
|
|
10
10
|
// ==========================================
|
|
11
11
|
// Main base generator class
|
|
12
|
-
export { BaseGenerator } from "./BaseGenerator
|
|
13
|
-
export { PythonTypeMapper } from "./PythonTypeMapper
|
|
12
|
+
export { BaseGenerator } from "./BaseGenerator";
|
|
13
|
+
export { PythonTypeMapper } from "./PythonTypeMapper";
|
|
14
14
|
// Type system and mapping
|
|
15
|
-
export { TypeMapper } from "./TypeMapper
|
|
16
|
-
export { TypeScriptTypeMapper } from "./TypeScriptTypeMapper
|
|
17
|
-
export { DirectoryBuilder } from "./builders/DirectoryBuilder
|
|
15
|
+
export { TypeMapper } from "./TypeMapper";
|
|
16
|
+
export { TypeScriptTypeMapper } from "./TypeScriptTypeMapper";
|
|
17
|
+
export { DirectoryBuilder } from "./builders/DirectoryBuilder";
|
|
18
18
|
// Fluent builders
|
|
19
|
-
export { FileBuilder } from "./builders/FileBuilder
|
|
20
|
-
export { IndexBuilder } from "./builders/IndexBuilder
|
|
19
|
+
export { FileBuilder } from "./builders/FileBuilder";
|
|
20
|
+
export { IndexBuilder } from "./builders/IndexBuilder";
|
|
21
21
|
// Core file management
|
|
22
|
-
export { FileManager } from "./FileManager
|
|
22
|
+
export { FileManager } from "./FileManager";
|
|
23
23
|
// ==========================================
|
|
24
24
|
// Error Handling System
|
|
25
25
|
// ==========================================
|
|
26
26
|
// All error classes for comprehensive error handling
|
|
27
|
-
export { BatchOperationError, ConfigurationError, createErrorWithContext, FileOperationError, GeneratorError, SchemaValidationError, TemplateError, TypeMappingError, } from "./errors
|
|
27
|
+
export { BatchOperationError, ConfigurationError, createErrorWithContext, FileOperationError, GeneratorError, SchemaValidationError, TemplateError, TypeMappingError, } from "./errors";
|
|
28
28
|
/**
|
|
29
29
|
* Type guard to check if an object is a GeneratedFile
|
|
30
30
|
*/
|
|
@@ -153,9 +153,9 @@ export const DEFAULT_FILE_BUILDER_OPTIONS = {
|
|
|
153
153
|
* @deprecated Use BaseGenerator instead
|
|
154
154
|
* Provided for backwards compatibility only
|
|
155
155
|
*/
|
|
156
|
-
export { BaseGenerator as Generator } from "./BaseGenerator
|
|
156
|
+
export { BaseGenerator as Generator } from "./BaseGenerator";
|
|
157
157
|
/**
|
|
158
158
|
* @deprecated Use GeneratorError instead
|
|
159
159
|
* Provided for backwards compatibility only
|
|
160
160
|
*/
|
|
161
|
-
export { GeneratorError as BaseError } from "./errors
|
|
161
|
+
export { GeneratorError as BaseError } from "./errors";
|
|
@@ -4,8 +4,8 @@
|
|
|
4
4
|
* This module provides the foundational type definitions that all generators
|
|
5
5
|
* build upon, ensuring consistency and type safety across the system.
|
|
6
6
|
*/
|
|
7
|
-
import type { TypeSchema,
|
|
8
|
-
import type { CodegenLogger } from "../../../utils/codegen-logger
|
|
7
|
+
import type { TypeSchema, Identifier } from "@typeschema/index";
|
|
8
|
+
import type { CodegenLogger } from "../../../utils/codegen-logger";
|
|
9
9
|
/**
|
|
10
10
|
* Base configuration options that all generators must support
|
|
11
11
|
* These options provide the minimum required configuration for any generator
|
|
@@ -197,7 +197,7 @@ export declare abstract class TypeMapper {
|
|
|
197
197
|
* @param targets - Array of possible reference targets
|
|
198
198
|
* @returns Language-specific reference type
|
|
199
199
|
*/
|
|
200
|
-
abstract mapReference(targets:
|
|
200
|
+
abstract mapReference(targets: Identifier[]): LanguageType;
|
|
201
201
|
/**
|
|
202
202
|
* Map an array type in the target language
|
|
203
203
|
* @param elementType - The element type name
|
|
@@ -241,7 +241,7 @@ export declare abstract class TypeMapper {
|
|
|
241
241
|
* @param identifier - FHIR type identifier
|
|
242
242
|
* @returns Language-specific type representation
|
|
243
243
|
*/
|
|
244
|
-
abstract mapType(identifier:
|
|
244
|
+
abstract mapType(identifier: Identifier): LanguageType;
|
|
245
245
|
/**
|
|
246
246
|
* Get import statement format for the target language
|
|
247
247
|
* @param symbols - Symbols to import
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
* This is the new, clean implementation that replaces the monolithic typescript.ts generator.
|
|
5
5
|
* Built using the BaseGenerator architecture with TypeMapper, TemplateEngine, and FileManager.
|
|
6
6
|
*/
|
|
7
|
-
import type { TypeSchema } from "
|
|
8
|
-
import { BaseGenerator } from "./base/BaseGenerator
|
|
9
|
-
import { type TypeScriptTypeMapperOptions } from "./base/TypeScriptTypeMapper
|
|
10
|
-
import type { BaseGeneratorOptions, GeneratedFile, TemplateContext, TypeMapper } from "./base/types
|
|
7
|
+
import type { TypeSchema } from "@typeschema/types";
|
|
8
|
+
import { BaseGenerator } from "./base/BaseGenerator";
|
|
9
|
+
import { type TypeScriptTypeMapperOptions } from "./base/TypeScriptTypeMapper";
|
|
10
|
+
import type { BaseGeneratorOptions, GeneratedFile, TemplateContext, TypeMapper } from "./base/types";
|
|
11
11
|
/**
|
|
12
12
|
* TypeScript-specific generator options
|
|
13
13
|
*/
|
|
@@ -33,7 +33,7 @@ export interface TypeScriptGeneratorOptions extends BaseGeneratorOptions {
|
|
|
33
33
|
* Only used when valueSetMode is 'custom'
|
|
34
34
|
* @default ['required']
|
|
35
35
|
*/
|
|
36
|
-
valueSetStrengths?: (
|
|
36
|
+
valueSetStrengths?: ("required" | "preferred" | "extensible" | "example")[];
|
|
37
37
|
/**
|
|
38
38
|
* Directory name for value set files (relative to outputDir)
|
|
39
39
|
* @default 'valuesets'
|
|
@@ -46,7 +46,7 @@ export interface TypeScriptGeneratorOptions extends BaseGeneratorOptions {
|
|
|
46
46
|
* - 'custom': Use valueSetStrengths array to control
|
|
47
47
|
* @default 'required-only'
|
|
48
48
|
*/
|
|
49
|
-
valueSetMode?:
|
|
49
|
+
valueSetMode?: "all" | "required-only" | "custom";
|
|
50
50
|
/** Type mapper options */
|
|
51
51
|
typeMapperOptions?: TypeScriptTypeMapperOptions;
|
|
52
52
|
}
|