@atomic-ehr/codegen 0.0.1-canary.20250808231821.ab61009
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/README.md +446 -0
- package/dist/api/builder.d.ts +147 -0
- package/dist/api/builder.d.ts.map +1 -0
- package/dist/api/generators/typescript.d.ts +129 -0
- package/dist/api/generators/typescript.d.ts.map +1 -0
- package/dist/api/index.d.ts +51 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/cli/commands/generate/typescript.d.ts +11 -0
- package/dist/cli/commands/generate/typescript.d.ts.map +1 -0
- package/dist/cli/commands/generate.d.ts +23 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/index.d.ts +40 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/typeschema/generate.d.ts +18 -0
- package/dist/cli/commands/typeschema/generate.d.ts.map +1 -0
- package/dist/cli/commands/typeschema.d.ts +11 -0
- package/dist/cli/commands/typeschema.d.ts.map +1 -0
- package/dist/cli/index.d.ts +11 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/utils/prompts.d.ts +57 -0
- package/dist/cli/utils/prompts.d.ts.map +1 -0
- package/dist/cli/utils/spinner.d.ts +111 -0
- package/dist/cli/utils/spinner.d.ts.map +1 -0
- package/dist/config.d.ts +171 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/index.d.ts +83 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +4008 -0
- package/dist/logger.d.ts +158 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/types/base.d.ts +66 -0
- package/dist/types/base.d.ts.map +1 -0
- package/dist/typeschema/cache.d.ts +105 -0
- package/dist/typeschema/cache.d.ts.map +1 -0
- package/dist/typeschema/core/binding.d.ts +29 -0
- package/dist/typeschema/core/binding.d.ts.map +1 -0
- package/dist/typeschema/core/field-builder.d.ts +45 -0
- package/dist/typeschema/core/field-builder.d.ts.map +1 -0
- package/dist/typeschema/core/identifier.d.ts +28 -0
- package/dist/typeschema/core/identifier.d.ts.map +1 -0
- package/dist/typeschema/core/nested-types.d.ts +25 -0
- package/dist/typeschema/core/nested-types.d.ts.map +1 -0
- package/dist/typeschema/core/transformer.d.ts +18 -0
- package/dist/typeschema/core/transformer.d.ts.map +1 -0
- package/dist/typeschema/generator.d.ts +57 -0
- package/dist/typeschema/generator.d.ts.map +1 -0
- package/dist/typeschema/index.d.ts +66 -0
- package/dist/typeschema/index.d.ts.map +1 -0
- package/dist/typeschema/parser.d.ts +92 -0
- package/dist/typeschema/parser.d.ts.map +1 -0
- package/dist/typeschema/profile/processor.d.ts +14 -0
- package/dist/typeschema/profile/processor.d.ts.map +1 -0
- package/dist/typeschema/schema.d.ts +486 -0
- package/dist/typeschema/schema.d.ts.map +1 -0
- package/dist/typeschema/types.d.ts +326 -0
- package/dist/typeschema/types.d.ts.map +1 -0
- package/dist/typeschema/utils.d.ts +7 -0
- package/dist/typeschema/utils.d.ts.map +1 -0
- package/dist/typeschema/value-set/processor.d.ts +20 -0
- package/dist/typeschema/value-set/processor.d.ts.map +1 -0
- package/dist/utils.d.ts +23 -0
- package/dist/utils.d.ts.map +1 -0
- package/package.json +60 -0
- package/src/index.ts +86 -0
package/dist/logger.d.ts
ADDED
|
@@ -0,0 +1,158 @@
|
|
|
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;
|
|
158
|
+
//# sourceMappingURL=logger.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,oBAAY,QAAQ;IACnB,KAAK,IAAI;IACT,IAAI,IAAI;IACR,IAAI,IAAI;IACR,KAAK,IAAI;IACT,MAAM,IAAI;CACV;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACxB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,QAAQ,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAClC,KAAK,CAAC,EAAE;QACP,IAAI,EAAE,MAAM,CAAC;QACb,OAAO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,SAAS,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAWhB;;OAEG;IACG,IAAI,CACT,OAAO,EAAE,MAAM,EACf,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAWhB;;OAEG;IACG,KAAK,CACV,OAAO,EAAE,MAAM,EACf,KAAK,CAAC,EAAE,KAAK,EACb,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACjC,SAAS,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,IAAI,CAAC;IAWhB;;OAEG;IACH,KAAK,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM;CAiDnE;AAED;;GAEG;AACH,eAAO,MAAM,MAAM,QAAe,CAAC;AAEnC;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,OAAO,CAAC,YAAY,CAAC,GAAG,IAAI,CAEnE;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CAAC,MAAM,CAAC,EAAE;IAC/C,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,CAAC;CACnB,GAAG,MAAM,CA6BT"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Base FHIR Types
|
|
3
|
+
*
|
|
4
|
+
* Basic type definitions used throughout the FHIR client and search builder.
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* Union type of all FHIR resource types
|
|
8
|
+
*/
|
|
9
|
+
export type ResourceType = "Patient" | "Observation" | "Organization" | "Practitioner" | "Encounter" | "Procedure" | "Condition" | "DiagnosticReport" | "MedicationRequest" | "Location" | "Device" | "Specimen";
|
|
10
|
+
/**
|
|
11
|
+
* Generic FHIR resource base interface
|
|
12
|
+
*/
|
|
13
|
+
export interface AnyResource {
|
|
14
|
+
resourceType: ResourceType;
|
|
15
|
+
id?: string;
|
|
16
|
+
meta?: {
|
|
17
|
+
versionId?: string;
|
|
18
|
+
lastUpdated?: string;
|
|
19
|
+
source?: string;
|
|
20
|
+
profile?: string[];
|
|
21
|
+
security?: any[];
|
|
22
|
+
tag?: any[];
|
|
23
|
+
};
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* FHIR Bundle resource
|
|
27
|
+
*/
|
|
28
|
+
export interface Bundle<T extends AnyResource = AnyResource> {
|
|
29
|
+
resourceType: "Bundle";
|
|
30
|
+
id?: string;
|
|
31
|
+
meta?: AnyResource["meta"];
|
|
32
|
+
type: "searchset" | "collection" | "transaction" | "batch" | "history" | "document" | "message";
|
|
33
|
+
total?: number;
|
|
34
|
+
entry?: BundleEntry<T>[];
|
|
35
|
+
link?: BundleLink[];
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Bundle entry
|
|
39
|
+
*/
|
|
40
|
+
export interface BundleEntry<T extends AnyResource = AnyResource> {
|
|
41
|
+
resource?: T;
|
|
42
|
+
fullUrl?: string;
|
|
43
|
+
search?: {
|
|
44
|
+
mode?: "match" | "include";
|
|
45
|
+
score?: number;
|
|
46
|
+
};
|
|
47
|
+
request?: {
|
|
48
|
+
method: "GET" | "POST" | "PUT" | "DELETE" | "PATCH";
|
|
49
|
+
url: string;
|
|
50
|
+
};
|
|
51
|
+
response?: {
|
|
52
|
+
status: string;
|
|
53
|
+
location?: string;
|
|
54
|
+
etag?: string;
|
|
55
|
+
lastModified?: string;
|
|
56
|
+
outcome?: AnyResource;
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
/**
|
|
60
|
+
* Bundle link
|
|
61
|
+
*/
|
|
62
|
+
export interface BundleLink {
|
|
63
|
+
relation: "self" | "first" | "previous" | "next" | "last";
|
|
64
|
+
url: string;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=base.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base.d.ts","sourceRoot":"","sources":["../../src/types/base.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;GAEG;AACH,MAAM,MAAM,YAAY,GACrB,SAAS,GACT,aAAa,GACb,cAAc,GACd,cAAc,GACd,WAAW,GACX,WAAW,GACX,WAAW,GACX,kBAAkB,GAClB,mBAAmB,GACnB,UAAU,GACV,QAAQ,GACR,UAAU,CAAC;AAGd;;GAEG;AACH,MAAM,WAAW,WAAW;IAC3B,YAAY,EAAE,YAAY,CAAC;IAC3B,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE;QACN,SAAS,CAAC,EAAE,MAAM,CAAC;QACnB,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,MAAM,CAAC,EAAE,MAAM,CAAC;QAChB,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,QAAQ,CAAC,EAAE,GAAG,EAAE,CAAC;QACjB,GAAG,CAAC,EAAE,GAAG,EAAE,CAAC;KACZ,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,MAAM,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC1D,YAAY,EAAE,QAAQ,CAAC;IACvB,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ,IAAI,CAAC,EAAE,WAAW,CAAC,MAAM,CAAC,CAAC;IAC3B,IAAI,EACD,WAAW,GACX,YAAY,GACZ,aAAa,GACb,OAAO,GACP,SAAS,GACT,UAAU,GACV,SAAS,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,KAAK,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,EAAE,CAAC;IACzB,IAAI,CAAC,EAAE,UAAU,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,CAAC,SAAS,WAAW,GAAG,WAAW;IAC/D,QAAQ,CAAC,EAAE,CAAC,CAAC;IACb,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE;QACR,IAAI,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;QAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;KACf,CAAC;IACF,OAAO,CAAC,EAAE;QACT,MAAM,EAAE,KAAK,GAAG,MAAM,GAAG,KAAK,GAAG,QAAQ,GAAG,OAAO,CAAC;QACpD,GAAG,EAAE,MAAM,CAAC;KACZ,CAAC;IACF,QAAQ,CAAC,EAAE;QACV,MAAM,EAAE,MAAM,CAAC;QACf,QAAQ,CAAC,EAAE,MAAM,CAAC;QAClB,IAAI,CAAC,EAAE,MAAM,CAAC;QACd,YAAY,CAAC,EAAE,MAAM,CAAC;QACtB,OAAO,CAAC,EAAE,WAAW,CAAC;KACtB,CAAC;CACF;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,QAAQ,EAAE,MAAM,GAAG,OAAO,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAC1D,GAAG,EAAE,MAAM,CAAC;CACZ"}
|
|
@@ -0,0 +1,105 @@
|
|
|
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 "../config";
|
|
7
|
+
import type { TypeSchema, TypeSchemaIdentifier } from "./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: TypeSchemaIdentifier): 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: TypeSchemaIdentifier): 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: TypeSchemaIdentifier): 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
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Get the global cache instance
|
|
83
|
+
*/
|
|
84
|
+
export declare function getGlobalCache(config?: TypeSchemaConfig): TypeSchemaCache;
|
|
85
|
+
/**
|
|
86
|
+
* Initialize global cache with configuration
|
|
87
|
+
*/
|
|
88
|
+
export declare function initializeGlobalCache(config?: TypeSchemaConfig): Promise<TypeSchemaCache>;
|
|
89
|
+
/**
|
|
90
|
+
* Clear the global cache
|
|
91
|
+
*/
|
|
92
|
+
export declare function clearGlobalCache(): void;
|
|
93
|
+
/**
|
|
94
|
+
* Cache a schema using global cache
|
|
95
|
+
*/
|
|
96
|
+
export declare function cacheSchema(schema: TypeSchema): void;
|
|
97
|
+
/**
|
|
98
|
+
* Get cached schema using global cache
|
|
99
|
+
*/
|
|
100
|
+
export declare function getCachedSchema(identifier: TypeSchemaIdentifier): TypeSchema | null;
|
|
101
|
+
/**
|
|
102
|
+
* Check if schema is cached using global cache
|
|
103
|
+
*/
|
|
104
|
+
export declare function isCached(identifier: TypeSchemaIdentifier): boolean;
|
|
105
|
+
//# sourceMappingURL=cache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"cache.d.ts","sourceRoot":"","sources":["../../src/typeschema/cache.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAKH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAClD,OAAO,KAAK,EAAE,UAAU,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAWhE;;GAEG;AACH,qBAAa,eAAe;IAC3B,OAAO,CAAC,KAAK,CAAiC;IAC9C,OAAO,CAAC,MAAM,CAAmB;IAC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vC;AAED;;GAEG;AACH,wBAAgB,WAAW,CAAC,MAAM,EAAE,UAAU,GAAG,IAAI,CAEpD;AAED;;GAEG;AACH,wBAAgB,eAAe,CAC9B,UAAU,EAAE,oBAAoB,GAC9B,UAAU,GAAG,IAAI,CAEnB;AAED;;GAEG;AACH,wBAAgB,QAAQ,CAAC,UAAU,EAAE,oBAAoB,GAAG,OAAO,CAElE"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Binding and Enum Handling
|
|
3
|
+
*
|
|
4
|
+
* Functions for processing value set bindings and generating enums
|
|
5
|
+
*/
|
|
6
|
+
import type { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
7
|
+
import type { FHIRSchema, FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
8
|
+
import type { PackageInfo, TypeSchemaForBinding } from "../types";
|
|
9
|
+
/**
|
|
10
|
+
* Extract concepts from a ValueSet
|
|
11
|
+
*/
|
|
12
|
+
export declare function extractValueSetConcepts(valueSetUrl: string, manager: ReturnType<typeof CanonicalManager>): Promise<Array<{
|
|
13
|
+
system: string;
|
|
14
|
+
code: string;
|
|
15
|
+
display?: string;
|
|
16
|
+
}> | undefined>;
|
|
17
|
+
/**
|
|
18
|
+
* Build enum values from binding if applicable
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildEnum(element: FHIRSchemaElement, manager: ReturnType<typeof CanonicalManager>): Promise<string[] | undefined>;
|
|
21
|
+
/**
|
|
22
|
+
* Generate a binding TypeSchema
|
|
23
|
+
*/
|
|
24
|
+
export declare function generateBindingSchema(fhirSchema: FHIRSchema, path: string[], element: FHIRSchemaElement, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<TypeSchemaForBinding | undefined>;
|
|
25
|
+
/**
|
|
26
|
+
* Collect all binding schemas from a FHIRSchema
|
|
27
|
+
*/
|
|
28
|
+
export declare function collectBindingSchemas(fhirSchema: FHIRSchema, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<TypeSchemaForBinding[]>;
|
|
29
|
+
//# sourceMappingURL=binding.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"binding.d.ts","sourceRoot":"","sources":["../../../src/typeschema/core/binding.ts"],"names":[],"mappings":"AACA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,UAAU,CAAC;AAQlE;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,WAAW,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC1C,OAAO,CACT,KAAK,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAC;IAAC,OAAO,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,GAAG,SAAS,CACrE,CA8DA;AAED;;GAEG;AACH,wBAAsB,SAAS,CAC9B,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC1C,OAAO,CAAC,MAAM,EAAE,GAAG,SAAS,CAAC,CA4C/B;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,iBAAiB,EAC1B,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,oBAAoB,GAAG,SAAS,CAAC,CA8C3C;AAED;;GAEG;AACH,wBAAsB,qBAAqB,CAC1C,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,oBAAoB,EAAE,CAAC,CA0DjC"}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Field Building Utilities
|
|
3
|
+
*
|
|
4
|
+
* Functions for transforming FHIRSchema elements into TypeSchema fields
|
|
5
|
+
*/
|
|
6
|
+
import type { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
7
|
+
import type { FHIRSchema, FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
8
|
+
import type { PackageInfo, TypeSchemaField, TypeSchemaIdentifier } from "../types";
|
|
9
|
+
/**
|
|
10
|
+
* Get the full element hierarchy for a given path
|
|
11
|
+
*/
|
|
12
|
+
export declare function getElementHierarchy(fhirSchema: FHIRSchema, path: string[], _manager: ReturnType<typeof CanonicalManager>): FHIRSchemaElement[];
|
|
13
|
+
/**
|
|
14
|
+
* Merge element hierarchy into a snapshot
|
|
15
|
+
*/
|
|
16
|
+
export declare function mergeElementHierarchy(hierarchy: FHIRSchemaElement[]): FHIRSchemaElement;
|
|
17
|
+
/**
|
|
18
|
+
* Check if a field is required based on parent required arrays
|
|
19
|
+
*/
|
|
20
|
+
export declare function isRequired(fhirSchema: FHIRSchema, path: string[], _manager: ReturnType<typeof CanonicalManager>): boolean;
|
|
21
|
+
/**
|
|
22
|
+
* Check if a field is excluded
|
|
23
|
+
*/
|
|
24
|
+
export declare function isExcluded(fhirSchema: FHIRSchema, path: string[], _manager: ReturnType<typeof CanonicalManager>): boolean;
|
|
25
|
+
/**
|
|
26
|
+
* Build reference array from element refers
|
|
27
|
+
*/
|
|
28
|
+
export declare function buildReferences(element: FHIRSchemaElement, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<TypeSchemaIdentifier[] | undefined>;
|
|
29
|
+
/**
|
|
30
|
+
* Build field type identifier
|
|
31
|
+
*/
|
|
32
|
+
export declare function buildFieldType(fhirSchema: FHIRSchema, _path: string[], element: FHIRSchemaElement, _manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): TypeSchemaIdentifier | undefined;
|
|
33
|
+
/**
|
|
34
|
+
* Build a TypeSchema field from a FHIRSchema element
|
|
35
|
+
*/
|
|
36
|
+
export declare function buildField(fhirSchema: FHIRSchema, path: string[], element: FHIRSchemaElement, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<TypeSchemaField>;
|
|
37
|
+
/**
|
|
38
|
+
* Check if an element represents a nested type (BackboneElement)
|
|
39
|
+
*/
|
|
40
|
+
export declare function isNestedElement(element: FHIRSchemaElement): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* Build a field reference to a nested type
|
|
43
|
+
*/
|
|
44
|
+
export declare function buildNestedField(fhirSchema: FHIRSchema, path: string[], element: FHIRSchemaElement, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): TypeSchemaField;
|
|
45
|
+
//# sourceMappingURL=field-builder.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"field-builder.d.ts","sourceRoot":"","sources":["../../../src/typeschema/core/field-builder.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,MAAM,UAAU,CAAC;AAQlB;;GAEG;AACH,wBAAgB,mBAAmB,CAClC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,GAC3C,iBAAiB,EAAE,CAkBrB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,SAAS,EAAE,iBAAiB,EAAE,GAC5B,iBAAiB,CAoDnB;AAED;;GAEG;AACH,wBAAgB,UAAU,CACzB,UAAU,EAA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@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Identifier Building Utilities
|
|
3
|
+
*
|
|
4
|
+
* Functions for creating TypeSchema identifiers from FHIRSchema entities
|
|
5
|
+
*/
|
|
6
|
+
import type { FHIRSchema } from "@atomic-ehr/fhirschema";
|
|
7
|
+
import type { PackageInfo, TypeSchemaForValueSet, TypeSchemaIdentifier } from "../types";
|
|
8
|
+
/**
|
|
9
|
+
* Drop version suffix from canonical URL (e.g., "http://example.com|1.0.0" -> "http://example.com")
|
|
10
|
+
*/
|
|
11
|
+
export declare function dropVersionFromUrl(url: string | undefined): string | undefined;
|
|
12
|
+
/**
|
|
13
|
+
* Build identifier for primitive-type, complex-type, resource, or constraint
|
|
14
|
+
*/
|
|
15
|
+
export declare function buildSchemaIdentifier(fhirSchema: FHIRSchema, packageInfo?: PackageInfo): TypeSchemaIdentifier;
|
|
16
|
+
/**
|
|
17
|
+
* Build nested type identifier for BackboneElements
|
|
18
|
+
*/
|
|
19
|
+
export declare function buildNestedIdentifier(fhirSchema: FHIRSchema, path: string[], packageInfo?: PackageInfo): TypeSchemaIdentifier;
|
|
20
|
+
/**
|
|
21
|
+
* Build value set identifier
|
|
22
|
+
*/
|
|
23
|
+
export declare function buildValueSetIdentifier(valueSetUrl: string, valueSet?: any, packageInfo?: PackageInfo): TypeSchemaForValueSet["identifier"];
|
|
24
|
+
/**
|
|
25
|
+
* Build binding identifier for an element with value set binding
|
|
26
|
+
*/
|
|
27
|
+
export declare function buildBindingIdentifier(fhirSchema: FHIRSchema, path: string[], bindingName?: string, packageInfo?: PackageInfo): TypeSchemaIdentifier;
|
|
28
|
+
//# sourceMappingURL=identifier.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identifier.d.ts","sourceRoot":"","sources":["../../../src/typeschema/core/identifier.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,KAAK,EACX,WAAW,EACX,qBAAqB,EACrB,oBAAoB,EACpB,MAAM,UAAU,CAAC;AAElB;;GAEG;AACH,wBAAgB,kBAAkB,CACjC,GAAG,EAAE,MAAM,GAAG,SAAS,GACrB,MAAM,GAAG,SAAS,CAGpB;AAqCD;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,UAAU,EACtB,WAAW,CAAC,EAAE,WAAW,GACvB,oBAAoB,CAUtB;AAED;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,CAAC,EAAE,WAAW,GACvB,oBAAoB,CAUtB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACtC,WAAW,EAAE,MAAM,EACnB,QAAQ,CAAC,EAAE,GAAG,EACd,WAAW,CAAC,EAAE,WAAW,GACvB,qBAAqB,CAAC,YAAY,CAAC,CAmCrC;AAED;;GAEG;AACH,wBAAgB,sBAAsB,CACrC,UAAU,EAAE,UAAU,EACtB,IAAI,EAAE,MAAM,EAAE,EACd,WAAW,CAAC,EAAE,MAAM,EACpB,WAAW,CAAC,EAAE,WAAW,GACvB,oBAAoB,CAatB"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Nested Types (BackboneElement) Handling
|
|
3
|
+
*
|
|
4
|
+
* Functions for extracting and transforming nested types from FHIRSchema
|
|
5
|
+
*/
|
|
6
|
+
import type { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
7
|
+
import type { FHIRSchema, FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
8
|
+
import type { PackageInfo, TypeSchemaField, TypeSchemaIdentifier } from "../types";
|
|
9
|
+
/**
|
|
10
|
+
* Collect all nested elements from a FHIRSchema
|
|
11
|
+
*/
|
|
12
|
+
export declare function collectNestedElements(fhirSchema: FHIRSchema, parentPath: string[], elements: Record<string, FHIRSchemaElement>): Array<[string[], FHIRSchemaElement]>;
|
|
13
|
+
/**
|
|
14
|
+
* Transform elements into fields for a nested type
|
|
15
|
+
*/
|
|
16
|
+
export declare function transformNestedElements(fhirSchema: FHIRSchema, parentPath: string[], elements: Record<string, FHIRSchemaElement>, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<Record<string, TypeSchemaField>>;
|
|
17
|
+
/**
|
|
18
|
+
* Build TypeSchema for all nested types in a FHIRSchema
|
|
19
|
+
*/
|
|
20
|
+
export declare function buildNestedTypes(fhirSchema: FHIRSchema, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<any[]>;
|
|
21
|
+
/**
|
|
22
|
+
* Extract dependencies from nested types
|
|
23
|
+
*/
|
|
24
|
+
export declare function extractNestedDependencies(nestedTypes: TypeSchemaNestedType[]): TypeSchemaIdentifier[];
|
|
25
|
+
//# sourceMappingURL=nested-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nested-types.d.ts","sourceRoot":"","sources":["../../../src/typeschema/core/nested-types.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAC5E,OAAO,KAAK,EACX,WAAW,EACX,eAAe,EACf,oBAAoB,EACpB,MAAM,UAAU,CAAC;AAIlB;;GAEG;AACH,wBAAgB,qBAAqB,CACpC,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,GACzC,KAAK,CAAC,CAAC,MAAM,EAAE,EAAE,iBAAiB,CAAC,CAAC,CAkBtC;AAED;;GAEG;AACH,wBAAsB,uBAAuB,CAC5C,UAAU,EAAE,UAAU,EACtB,UAAU,EAAE,MAAM,EAAE,EACpB,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,iBAAiB,CAAC,EAC3C,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,eAAe,CAAC,CAAC,CA4B1C;AAED;;GAEG;AACH,wBAAsB,gBAAgB,CACrC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,GAAG,EAAE,CAAC,CAgEhB;AAED;;GAEG;AACH,wBAAgB,yBAAyB,CACxC,WAAW,EAAE,oBAAoB,EAAE,GACjC,oBAAoB,EAAE,CAwBxB"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Main FHIRSchema to TypeSchema Transformer
|
|
3
|
+
*
|
|
4
|
+
* Core transformation logic for converting FHIRSchema to TypeSchema format
|
|
5
|
+
*/
|
|
6
|
+
import type { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
7
|
+
import type { FHIRSchema } from "@atomic-ehr/fhirschema";
|
|
8
|
+
import type { PackageInfo, TypeSchema } from "../types";
|
|
9
|
+
/**
|
|
10
|
+
* Transform a single FHIRSchema to TypeSchema(s) with enhanced categorization
|
|
11
|
+
* Returns the main schema plus any binding schemas
|
|
12
|
+
*/
|
|
13
|
+
export declare function transformFHIRSchema(fhirSchema: FHIRSchema, manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<TypeSchema[]>;
|
|
14
|
+
/**
|
|
15
|
+
* Transform multiple FHIRSchemas
|
|
16
|
+
*/
|
|
17
|
+
export declare function transformFHIRSchemas(fhirSchemas: FHIRSchema[], manager: ReturnType<typeof CanonicalManager>, packageInfo?: PackageInfo): Promise<TypeSchema[]>;
|
|
18
|
+
//# sourceMappingURL=transformer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transformer.d.ts","sourceRoot":"","sources":["../../../src/typeschema/core/transformer.ts"],"names":[],"mappings":"AAEA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,KAAK,EAAE,UAAU,EAAqB,MAAM,wBAAwB,CAAC;AAE5E,OAAO,KAAK,EACX,WAAW,EACX,UAAU,EAIV,MAAM,UAAU,CAAC;AA2RlB;;;GAGG;AACH,wBAAsB,mBAAmB,CACxC,UAAU,EAAE,UAAU,EACtB,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,EAAE,CAAC,CAmMvB;AAED;;GAEG;AACH,wBAAsB,oBAAoB,CACzC,WAAW,EAAE,UAAU,EAAE,EACzB,OAAO,EAAE,UAAU,CAAC,OAAO,gBAAgB,CAAC,EAC5C,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,EAAE,CAAC,CASvB"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeSchema Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates TypeSchema documents from FHIR packages using fhrischema.
|
|
5
|
+
* Provides high-level API for converting FHIR Structure Definitions to TypeSchema format.
|
|
6
|
+
*/
|
|
7
|
+
import { type FHIRSchema } from "@atomic-ehr/fhirschema";
|
|
8
|
+
import type { TypeSchemaConfig } from "../config";
|
|
9
|
+
import type { PackageInfo, TypeSchema, TypeschemaGeneratorOptions } from "./types";
|
|
10
|
+
/**
|
|
11
|
+
* TypeSchema Generator class
|
|
12
|
+
*
|
|
13
|
+
* Main class for generating TypeSchema documents from FHIR packages.
|
|
14
|
+
* Leverages fhrischema for FHIR parsing and canonical manager for dependency resolution.
|
|
15
|
+
*/
|
|
16
|
+
export declare class TypeSchemaGenerator {
|
|
17
|
+
private manager;
|
|
18
|
+
private options;
|
|
19
|
+
private cache;
|
|
20
|
+
private cacheConfig?;
|
|
21
|
+
private logger;
|
|
22
|
+
constructor(options?: TypeschemaGeneratorOptions, cacheConfig?: TypeSchemaConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Initialize the cache if configured
|
|
25
|
+
*/
|
|
26
|
+
private initializeCache;
|
|
27
|
+
/**
|
|
28
|
+
* Generate TypeSchema from a FHIR package name
|
|
29
|
+
*/
|
|
30
|
+
generateFromPackage(packageName: string, packageVersion?: string): Promise<TypeSchema[]>;
|
|
31
|
+
/**
|
|
32
|
+
* Generate TypeSchema from individual FHIR schema
|
|
33
|
+
*/
|
|
34
|
+
generateFromSchema(fhirSchema: FHIRSchema, packageInfo?: PackageInfo): Promise<TypeSchema[]>;
|
|
35
|
+
/**
|
|
36
|
+
* Generate TypeSchema from multiple FHIR schemas with FHIR-specific enhancements
|
|
37
|
+
*/
|
|
38
|
+
generateFromSchemas(fhirSchemas: FHIRSchema[], packageInfo?: PackageInfo): Promise<TypeSchema[]>;
|
|
39
|
+
private groupTypeSchemas;
|
|
40
|
+
private enhanceProfiles;
|
|
41
|
+
private enhanceExtensions;
|
|
42
|
+
private enhanceValueSets;
|
|
43
|
+
private enhanceCodeSystems;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Convenience function to generate TypeSchema from a package
|
|
47
|
+
*/
|
|
48
|
+
export declare function generateTypeSchemaFromPackage(packageName: string, options?: TypeschemaGeneratorOptions): Promise<TypeSchema[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Convenience function to generate TypeSchema from FHIR schemas
|
|
51
|
+
*/
|
|
52
|
+
export declare function generateTypeSchemaFromSchemas(fhirSchemas: FHIRSchema[], packageInfo?: PackageInfo, options?: TypeschemaGeneratorOptions): Promise<TypeSchema[]>;
|
|
53
|
+
/**
|
|
54
|
+
* Convenience function to generate TypeSchema from a single FHIR schema
|
|
55
|
+
*/
|
|
56
|
+
export declare function generateTypeSchemaFromSchema(fhirSchema: FHIRSchema, packageInfo?: PackageInfo, options?: TypeschemaGeneratorOptions): Promise<TypeSchema[]>;
|
|
57
|
+
//# sourceMappingURL=generator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generator.d.ts","sourceRoot":"","sources":["../../src/typeschema/generator.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,EACN,KAAK,UAAU,EAGf,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAIlD,OAAO,KAAK,EACX,WAAW,EACX,UAAU,EACV,0BAA0B,EAC1B,MAAM,SAAS,CAAC;AAEjB;;;;;GAKG;AACH,qBAAa,mBAAmB;IAC/B,OAAO,CAAC,OAAO,CAAsC;IACrD,OAAO,CAAC,OAAO,CAA6B;IAC5C,OAAO,CAAC,KAAK,CAAgC;IAC7C,OAAO,CAAC,WAAW,CAAC,CAAmB;IACvC,OAAO,CAAC,MAAM,CAAS;gBAGtB,OAAO,GAAE,0BAA+B,EACxC,WAAW,CAAC,EAAE,gBAAgB;IAgB/B;;OAEG;YACW,eAAe;IAO7B;;OAEG;IACG,mBAAmB,CACxB,WAAW,EAAE,MAAM,EACnB,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,UAAU,EAAE,CAAC;IAkIxB;;OAEG;IACG,kBAAkB,CACvB,UAAU,EAAE,UAAU,EACtB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,EAAE,CAAC;IAcxB;;OAEG;IACG,mBAAmB,CACxB,WAAW,EAAE,UAAU,EAAE,EACzB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,UAAU,EAAE,CAAC;IA0FxB,OAAO,CAAC,gBAAgB;YAuDV,eAAe;YAMf,iBAAiB;YAQjB,gBAAgB;YAMhB,kBAAkB;CAOhC;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CAClD,WAAW,EAAE,MAAM,EACnB,OAAO,GAAE,0BAA+B,GACtC,OAAO,CAAC,UAAU,EAAE,CAAC,CAGvB;AAED;;GAEG;AACH,wBAAsB,6BAA6B,CAClD,WAAW,EAAE,UAAU,EAAE,EACzB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,GAAE,0BAA+B,GACtC,OAAO,CAAC,UAAU,EAAE,CAAC,CAGvB;AAED;;GAEG;AACH,wBAAsB,4BAA4B,CACjD,UAAU,EAAE,UAAU,EACtB,WAAW,CAAC,EAAE,WAAW,EACzB,OAAO,GAAE,0BAA+B,GACtC,OAAO,CAAC,UAAU,EAAE,CAAC,CAGvB"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* TypeSchema Core Module
|
|
3
|
+
*
|
|
4
|
+
* Main entry point for the TypeSchema library providing core functions
|
|
5
|
+
* for FHIR-to-TypeSchema generation, parsing, and validation.
|
|
6
|
+
*
|
|
7
|
+
* This module focuses on:
|
|
8
|
+
* - Converting FHIR to TypeSchema format
|
|
9
|
+
* - Reading TypeSchema documents
|
|
10
|
+
* - Validating TypeSchema documents
|
|
11
|
+
*/
|
|
12
|
+
import type { TypeSchema, TypeschemaParserOptions } from "./types.ts";
|
|
13
|
+
export { CanonicalManager } from "@atomic-ehr/fhir-canonical-manager";
|
|
14
|
+
export type { FHIRSchema, FHIRSchemaElement } from "@atomic-ehr/fhirschema";
|
|
15
|
+
export { cacheSchema, clearGlobalCache, getCachedSchema, getGlobalCache, initializeGlobalCache, isCached, TypeSchemaCache, } from "./cache";
|
|
16
|
+
export { buildEnum, collectBindingSchemas, extractValueSetConcepts, generateBindingSchema, } from "./core/binding";
|
|
17
|
+
export { buildField, buildNestedField, getElementHierarchy, isExcluded, isNestedElement, isRequired, mergeElementHierarchy, } from "./core/field-builder";
|
|
18
|
+
export { buildBindingIdentifier, buildNestedIdentifier, buildSchemaIdentifier, buildValueSetIdentifier, dropVersionFromUrl, } from "./core/identifier";
|
|
19
|
+
export { buildNestedTypes, collectNestedElements, extractNestedDependencies, } from "./core/nested-types";
|
|
20
|
+
export { transformFHIRSchema, transformFHIRSchemas, } from "./core/transformer";
|
|
21
|
+
export { generateTypeSchemaFromPackage, generateTypeSchemaFromSchema, generateTypeSchemaFromSchemas, TypeSchemaGenerator, } from "./generator";
|
|
22
|
+
export { parseTypeSchemaFromFile, parseTypeSchemaFromFiles, parseTypeSchemaFromString, TypeSchemaParser, } from "./parser";
|
|
23
|
+
export { transformProfile } from "./profile/processor";
|
|
24
|
+
export * from "./types";
|
|
25
|
+
export * from "./utils";
|
|
26
|
+
export { transformValueSet } from "./value-set/processor";
|
|
27
|
+
/**
|
|
28
|
+
* TypeSchema Core API class
|
|
29
|
+
*
|
|
30
|
+
* Provides core TypeSchema functionality: convert, read, and validate.
|
|
31
|
+
* Does NOT include target-specific generation (like TypeScript generation).
|
|
32
|
+
* Use target generators in src/api/generators/ for output generation.
|
|
33
|
+
*/
|
|
34
|
+
export declare class TypeSchemaAPI {
|
|
35
|
+
private generator;
|
|
36
|
+
private parser;
|
|
37
|
+
private cache;
|
|
38
|
+
constructor(options?: {
|
|
39
|
+
generator?: any;
|
|
40
|
+
parser?: TypeschemaParserOptions;
|
|
41
|
+
validator?: {
|
|
42
|
+
strict?: boolean;
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
/**
|
|
46
|
+
* Convert FHIR package to TypeSchema
|
|
47
|
+
*/
|
|
48
|
+
generateFromPackage(packageName: string, packageVersion?: string): Promise<TypeSchema[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Parse TypeSchema from files
|
|
51
|
+
*/
|
|
52
|
+
parseFromFiles(inputFiles: string[]): Promise<TypeSchema[]>;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Create a new TypeSchema API instance
|
|
56
|
+
*/
|
|
57
|
+
export declare function createTypeSchemaAPI(options?: ConstructorParameters<typeof TypeSchemaAPI>[0]): TypeSchemaAPI;
|
|
58
|
+
/**
|
|
59
|
+
* Convenience function to convert FHIR package to TypeSchema
|
|
60
|
+
*/
|
|
61
|
+
export declare function generateTypeSchemaFromPackageCore(packageName: string, packageVersion?: string): Promise<TypeSchema[]>;
|
|
62
|
+
/**
|
|
63
|
+
* Convenience function to parse TypeSchema from files
|
|
64
|
+
*/
|
|
65
|
+
export declare function parseTypeSchemaFromFilesCore(inputFiles: string[]): Promise<TypeSchema[]>;
|
|
66
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/typeschema/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAKH,OAAO,KAAK,EAAE,UAAU,EAAE,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAGtE,OAAO,EAAE,gBAAgB,EAAE,MAAM,oCAAoC,CAAC;AACtE,YAAY,EAAE,UAAU,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAG5E,OAAO,EACN,WAAW,EACX,gBAAgB,EAChB,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,QAAQ,EACR,eAAe,GACf,MAAM,SAAS,CAAC;AAGjB,OAAO,EACN,SAAS,EACT,qBAAqB,EACrB,uBAAuB,EACvB,qBAAqB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACN,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,UAAU,EACV,eAAe,EACf,UAAU,EACV,qBAAqB,GACrB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACN,sBAAsB,EACtB,qBAAqB,EACrB,qBAAqB,EACrB,uBAAuB,EACvB,kBAAkB,GAClB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACN,gBAAgB,EAChB,qBAAqB,EACrB,yBAAyB,GACzB,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACN,mBAAmB,EACnB,oBAAoB,GACpB,MAAM,oBAAoB,CAAC;AAG5B,OAAO,EACN,6BAA6B,EAC7B,4BAA4B,EAC5B,6BAA6B,EAC7B,mB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