@atomic-ehr/codegen 0.0.1-canary.20251007094146.5297616 → 0.0.1-canary.20251007123452.75482df
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 +39 -26
- package/dist/index.d.ts +27 -4
- package/dist/index.js +563 -115
- package/dist/index.js.map +1 -1
- package/package.json +2 -1
package/dist/index.js
CHANGED
|
@@ -1414,7 +1414,7 @@ function isBindingSchema(schema) {
|
|
|
1414
1414
|
}
|
|
1415
1415
|
|
|
1416
1416
|
// src/typeschema/register.ts
|
|
1417
|
-
var registerFromManager = async (manager,
|
|
1417
|
+
var registerFromManager = async (manager, logger2) => {
|
|
1418
1418
|
const packages = await manager.packages();
|
|
1419
1419
|
const flatRawIndex = {};
|
|
1420
1420
|
const indexByPackages = [];
|
|
@@ -1450,7 +1450,7 @@ var registerFromManager = async (manager, logger) => {
|
|
|
1450
1450
|
nameToCanonical[rfs.name] = rfs.url;
|
|
1451
1451
|
fsSuccess++;
|
|
1452
1452
|
} catch (error) {
|
|
1453
|
-
|
|
1453
|
+
logger2?.warn(
|
|
1454
1454
|
`Failed to convert StructureDefinition ${sd.name || sd.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
1455
1455
|
);
|
|
1456
1456
|
fsFailed++;
|
|
@@ -1463,7 +1463,7 @@ var registerFromManager = async (manager, logger) => {
|
|
|
1463
1463
|
vsIndex[resource.url] = resource;
|
|
1464
1464
|
}
|
|
1465
1465
|
}
|
|
1466
|
-
|
|
1466
|
+
logger2?.success(
|
|
1467
1467
|
`FHIR Schema conversion for '${packageMetaToFhir(packageMeta)}' completed: ${fsSuccess} successful, ${fsFailed} failed`
|
|
1468
1468
|
);
|
|
1469
1469
|
}
|
|
@@ -1596,7 +1596,7 @@ function mkBindingIdentifier(fhirSchema, path, bindingName) {
|
|
|
1596
1596
|
}
|
|
1597
1597
|
|
|
1598
1598
|
// src/typeschema/profile/processor.ts
|
|
1599
|
-
async function transformProfile(register, fhirSchema) {
|
|
1599
|
+
async function transformProfile(register, fhirSchema, logger2) {
|
|
1600
1600
|
const identifier = mkIdentifier(fhirSchema);
|
|
1601
1601
|
if (identifier.kind !== "profile") {
|
|
1602
1602
|
throw new Error(`Expected profile, got ${identifier.kind} for ${fhirSchema.name}`);
|
|
@@ -1628,7 +1628,7 @@ async function transformProfile(register, fhirSchema) {
|
|
|
1628
1628
|
profileSchema.metadata = metadata;
|
|
1629
1629
|
}
|
|
1630
1630
|
if (fhirSchema.elements) {
|
|
1631
|
-
const fields = await mkFields(register, fhirSchema, [], fhirSchema.elements);
|
|
1631
|
+
const fields = await mkFields(register, fhirSchema, [], fhirSchema.elements, logger2);
|
|
1632
1632
|
if (fields && Object.keys(fields).length > 0) {
|
|
1633
1633
|
profileSchema.fields = fields;
|
|
1634
1634
|
}
|
|
@@ -1825,13 +1825,13 @@ function buildFieldType(register, fhirSchema, element) {
|
|
|
1825
1825
|
}
|
|
1826
1826
|
return void 0;
|
|
1827
1827
|
}
|
|
1828
|
-
var mkField = (register, fhirSchema, path, element) => {
|
|
1828
|
+
var mkField = (register, fhirSchema, path, element, logger2) => {
|
|
1829
1829
|
let binding;
|
|
1830
1830
|
let enumValues;
|
|
1831
1831
|
if (element.binding) {
|
|
1832
1832
|
binding = mkBindingIdentifier(fhirSchema, path, element.binding.bindingName);
|
|
1833
1833
|
if (element.binding.strength === "required" && element.type === "code") {
|
|
1834
|
-
enumValues = buildEnum(register, element);
|
|
1834
|
+
enumValues = buildEnum(register, element, logger2);
|
|
1835
1835
|
}
|
|
1836
1836
|
}
|
|
1837
1837
|
return {
|
|
@@ -1864,13 +1864,13 @@ function mkNestedField(register, fhirSchema, path, element) {
|
|
|
1864
1864
|
}
|
|
1865
1865
|
|
|
1866
1866
|
// src/typeschema/core/binding.ts
|
|
1867
|
-
function extractValueSetConceptsByUrl(register, valueSetUrl) {
|
|
1867
|
+
function extractValueSetConceptsByUrl(register, valueSetUrl, logger2) {
|
|
1868
1868
|
const cleanUrl = dropVersionFromUrl(valueSetUrl) || valueSetUrl;
|
|
1869
1869
|
const valueSet = register.resolveVs(cleanUrl);
|
|
1870
1870
|
if (!valueSet) return void 0;
|
|
1871
1871
|
return extractValueSetConcepts(register, valueSet);
|
|
1872
1872
|
}
|
|
1873
|
-
function extractValueSetConcepts(register, valueSet) {
|
|
1873
|
+
function extractValueSetConcepts(register, valueSet, _logger) {
|
|
1874
1874
|
if (valueSet.expansion?.contains) return valueSet.expansion.contains;
|
|
1875
1875
|
const concepts = [];
|
|
1876
1876
|
if (valueSet.compose?.include) {
|
|
@@ -1909,7 +1909,7 @@ function extractValueSetConcepts(register, valueSet) {
|
|
|
1909
1909
|
return concepts.length > 0 ? concepts : void 0;
|
|
1910
1910
|
}
|
|
1911
1911
|
var MAX_ENUM_LENGTH = 100;
|
|
1912
|
-
function buildEnum(register, element) {
|
|
1912
|
+
function buildEnum(register, element, logger2) {
|
|
1913
1913
|
if (!element.binding) return void 0;
|
|
1914
1914
|
const strength = element.binding.strength;
|
|
1915
1915
|
const valueSetUrl = element.binding.valueSet;
|
|
@@ -1920,14 +1920,14 @@ function buildEnum(register, element) {
|
|
|
1920
1920
|
if (!concepts || concepts.length === 0) return void 0;
|
|
1921
1921
|
const codes = concepts.map((c) => c.code).filter((code) => code && typeof code === "string" && code.trim().length > 0);
|
|
1922
1922
|
if (codes.length > MAX_ENUM_LENGTH) {
|
|
1923
|
-
|
|
1923
|
+
logger2?.dry_warn(
|
|
1924
1924
|
`Value set ${valueSetUrl} has ${codes.length} which is more than ${MAX_ENUM_LENGTH} codes, which may cause issues with code generation.`
|
|
1925
1925
|
);
|
|
1926
1926
|
return void 0;
|
|
1927
1927
|
}
|
|
1928
1928
|
return codes.length > 0 ? codes : void 0;
|
|
1929
1929
|
}
|
|
1930
|
-
function generateBindingSchema(register, fhirSchema, path, element) {
|
|
1930
|
+
function generateBindingSchema(register, fhirSchema, path, element, logger2) {
|
|
1931
1931
|
if (!element.binding?.valueSet) return void 0;
|
|
1932
1932
|
const identifier = mkBindingIdentifier(fhirSchema, path, element.binding.bindingName);
|
|
1933
1933
|
const fieldType = buildFieldType(register, fhirSchema, element);
|
|
@@ -1937,7 +1937,7 @@ function generateBindingSchema(register, fhirSchema, path, element) {
|
|
|
1937
1937
|
dependencies.push(fieldType);
|
|
1938
1938
|
}
|
|
1939
1939
|
dependencies.push(valueSetIdentifier);
|
|
1940
|
-
const enumValues = buildEnum(register, element);
|
|
1940
|
+
const enumValues = buildEnum(register, element, logger2);
|
|
1941
1941
|
return {
|
|
1942
1942
|
identifier,
|
|
1943
1943
|
type: fieldType,
|
|
@@ -1947,7 +1947,7 @@ function generateBindingSchema(register, fhirSchema, path, element) {
|
|
|
1947
1947
|
dependencies
|
|
1948
1948
|
};
|
|
1949
1949
|
}
|
|
1950
|
-
function collectBindingSchemas(register, fhirSchema) {
|
|
1950
|
+
function collectBindingSchemas(register, fhirSchema, logger2) {
|
|
1951
1951
|
const processedPaths = /* @__PURE__ */ new Set();
|
|
1952
1952
|
if (!fhirSchema.elements) return [];
|
|
1953
1953
|
const bindings = [];
|
|
@@ -1958,7 +1958,7 @@ function collectBindingSchemas(register, fhirSchema) {
|
|
|
1958
1958
|
if (processedPaths.has(pathKey)) continue;
|
|
1959
1959
|
processedPaths.add(pathKey);
|
|
1960
1960
|
if (element.binding) {
|
|
1961
|
-
const binding = generateBindingSchema(register, fhirSchema, path, element);
|
|
1961
|
+
const binding = generateBindingSchema(register, fhirSchema, path, element, logger2);
|
|
1962
1962
|
if (binding) {
|
|
1963
1963
|
bindings.push(binding);
|
|
1964
1964
|
}
|
|
@@ -1995,19 +1995,19 @@ function collectNestedElements(fhirSchema, parentPath, elements) {
|
|
|
1995
1995
|
}
|
|
1996
1996
|
return nested;
|
|
1997
1997
|
}
|
|
1998
|
-
function transformNestedElements(fhirSchema, parentPath, elements, register) {
|
|
1998
|
+
function transformNestedElements(fhirSchema, parentPath, elements, register, logger2) {
|
|
1999
1999
|
const fields = {};
|
|
2000
2000
|
for (const [key, element] of Object.entries(elements)) {
|
|
2001
2001
|
const path = [...parentPath, key];
|
|
2002
2002
|
if (isNestedElement(element)) {
|
|
2003
2003
|
fields[key] = mkNestedField(register, fhirSchema, path, element);
|
|
2004
2004
|
} else {
|
|
2005
|
-
fields[key] = mkField(register, fhirSchema, path, element);
|
|
2005
|
+
fields[key] = mkField(register, fhirSchema, path, element, logger2);
|
|
2006
2006
|
}
|
|
2007
2007
|
}
|
|
2008
2008
|
return fields;
|
|
2009
2009
|
}
|
|
2010
|
-
function mkNestedTypes(register, fhirSchema) {
|
|
2010
|
+
function mkNestedTypes(register, fhirSchema, logger2) {
|
|
2011
2011
|
if (!fhirSchema.elements) return void 0;
|
|
2012
2012
|
const nestedElements = collectNestedElements(fhirSchema, [], fhirSchema.elements);
|
|
2013
2013
|
const actualNested = nestedElements.filter(
|
|
@@ -2034,7 +2034,7 @@ function mkNestedTypes(register, fhirSchema) {
|
|
|
2034
2034
|
url: `http://hl7.org/fhir/StructureDefinition/${element.type}`
|
|
2035
2035
|
};
|
|
2036
2036
|
}
|
|
2037
|
-
const fields = transformNestedElements(fhirSchema, path, element.elements, register);
|
|
2037
|
+
const fields = transformNestedElements(fhirSchema, path, element.elements, register, logger2);
|
|
2038
2038
|
const nestedType = {
|
|
2039
2039
|
identifier,
|
|
2040
2040
|
base,
|
|
@@ -2064,7 +2064,7 @@ function extractNestedDependencies(nestedTypes) {
|
|
|
2064
2064
|
}
|
|
2065
2065
|
|
|
2066
2066
|
// src/typeschema/core/transformer.ts
|
|
2067
|
-
function mkFields(register, fhirSchema, parentPath, elements) {
|
|
2067
|
+
function mkFields(register, fhirSchema, parentPath, elements, logger2) {
|
|
2068
2068
|
if (!elements) return void 0;
|
|
2069
2069
|
const geneology = register.resolveFsGenealogy(fhirSchema.url);
|
|
2070
2070
|
const elems = {};
|
|
@@ -2089,7 +2089,7 @@ function mkFields(register, fhirSchema, parentPath, elements) {
|
|
|
2089
2089
|
if (isNestedElement(elemSnapshot)) {
|
|
2090
2090
|
fields[key] = mkNestedField(register, fhirSchema, path, elemSnapshot);
|
|
2091
2091
|
} else {
|
|
2092
|
-
fields[key] = mkField(register, fhirSchema, path, elemSnapshot);
|
|
2092
|
+
fields[key] = mkField(register, fhirSchema, path, elemSnapshot, logger2);
|
|
2093
2093
|
}
|
|
2094
2094
|
}
|
|
2095
2095
|
return fields;
|
|
@@ -2134,7 +2134,7 @@ function isExtensionSchema(fhirSchema, _identifier) {
|
|
|
2134
2134
|
}
|
|
2135
2135
|
return false;
|
|
2136
2136
|
}
|
|
2137
|
-
async function transformValueSet(register, valueSet) {
|
|
2137
|
+
async function transformValueSet(register, valueSet, logger2) {
|
|
2138
2138
|
if (!valueSet.url) throw new Error("ValueSet URL is required");
|
|
2139
2139
|
const identifier = mkValueSetIdentifierByUrl(register, valueSet.url);
|
|
2140
2140
|
const concept = extractValueSetConceptsByUrl(register, valueSet.url);
|
|
@@ -2145,7 +2145,7 @@ async function transformValueSet(register, valueSet) {
|
|
|
2145
2145
|
compose: !concept ? valueSet.compose : void 0
|
|
2146
2146
|
};
|
|
2147
2147
|
}
|
|
2148
|
-
async function transformExtension(fhirSchema, register,
|
|
2148
|
+
async function transformExtension(fhirSchema, register, logger2) {
|
|
2149
2149
|
try {
|
|
2150
2150
|
const identifier = mkIdentifier(fhirSchema);
|
|
2151
2151
|
let base;
|
|
@@ -2182,13 +2182,13 @@ async function transformExtension(fhirSchema, register, _packageInfo) {
|
|
|
2182
2182
|
extensionSchema.dependencies.push(base);
|
|
2183
2183
|
}
|
|
2184
2184
|
if (fhirSchema.elements) {
|
|
2185
|
-
const fields = mkFields(register, fhirSchema, [], fhirSchema.elements);
|
|
2185
|
+
const fields = mkFields(register, fhirSchema, [], fhirSchema.elements, logger2);
|
|
2186
2186
|
if (fields && Object.keys(fields).length > 0) {
|
|
2187
2187
|
extensionSchema.fields = fields;
|
|
2188
2188
|
extensionSchema.dependencies.push(...extractFieldDependencies(fields));
|
|
2189
2189
|
}
|
|
2190
2190
|
}
|
|
2191
|
-
const nestedTypes = mkNestedTypes(register, fhirSchema);
|
|
2191
|
+
const nestedTypes = mkNestedTypes(register, fhirSchema, logger2);
|
|
2192
2192
|
if (nestedTypes && nestedTypes.length > 0) {
|
|
2193
2193
|
extensionSchema.nested = nestedTypes;
|
|
2194
2194
|
extensionSchema.dependencies.push(...extractNestedDependencies(nestedTypes));
|
|
@@ -2215,7 +2215,7 @@ function extractDependencies(identifier, base, fields, nestedTypes) {
|
|
|
2215
2215
|
const result = Object.values(uniqDeps).filter((e) => !(e.kind === "nested" && localNestedTypeUrls.has(e.url))).sort((a, b) => a.url.localeCompare(b.url));
|
|
2216
2216
|
return result.length > 0 ? result : void 0;
|
|
2217
2217
|
}
|
|
2218
|
-
function transformFhirSchemaResource(register, fhirSchema) {
|
|
2218
|
+
function transformFhirSchemaResource(register, fhirSchema, logger2) {
|
|
2219
2219
|
const identifier = mkIdentifier(fhirSchema);
|
|
2220
2220
|
let base;
|
|
2221
2221
|
if (fhirSchema.base && fhirSchema.type !== "Element") {
|
|
@@ -2225,8 +2225,8 @@ function transformFhirSchemaResource(register, fhirSchema) {
|
|
|
2225
2225
|
}
|
|
2226
2226
|
base = mkIdentifier(baseFs);
|
|
2227
2227
|
}
|
|
2228
|
-
const fields = mkFields(register, fhirSchema, [], fhirSchema.elements);
|
|
2229
|
-
const nested = mkNestedTypes(register, fhirSchema);
|
|
2228
|
+
const fields = mkFields(register, fhirSchema, [], fhirSchema.elements, logger2);
|
|
2229
|
+
const nested = mkNestedTypes(register, fhirSchema, logger2);
|
|
2230
2230
|
const dependencies = extractDependencies(identifier, base, fields, nested);
|
|
2231
2231
|
const typeSchema = {
|
|
2232
2232
|
identifier,
|
|
@@ -2236,27 +2236,27 @@ function transformFhirSchemaResource(register, fhirSchema) {
|
|
|
2236
2236
|
description: fhirSchema.description,
|
|
2237
2237
|
dependencies
|
|
2238
2238
|
};
|
|
2239
|
-
const bindingSchemas = collectBindingSchemas(register, fhirSchema);
|
|
2239
|
+
const bindingSchemas = collectBindingSchemas(register, fhirSchema, logger2);
|
|
2240
2240
|
return [typeSchema, ...bindingSchemas];
|
|
2241
2241
|
}
|
|
2242
|
-
async function transformFhirSchema(register, fhirSchema) {
|
|
2242
|
+
async function transformFhirSchema(register, fhirSchema, logger2) {
|
|
2243
2243
|
const results = [];
|
|
2244
2244
|
const identifier = mkIdentifier(fhirSchema);
|
|
2245
2245
|
if (identifier.kind === "profile") {
|
|
2246
|
-
const profileSchema = await transformProfile(register, fhirSchema);
|
|
2246
|
+
const profileSchema = await transformProfile(register, fhirSchema, logger2);
|
|
2247
2247
|
results.push(profileSchema);
|
|
2248
|
-
const bindingSchemas = collectBindingSchemas(register, fhirSchema);
|
|
2248
|
+
const bindingSchemas = collectBindingSchemas(register, fhirSchema, logger2);
|
|
2249
2249
|
results.push(...bindingSchemas);
|
|
2250
2250
|
return results;
|
|
2251
2251
|
}
|
|
2252
2252
|
if (isExtensionSchema(fhirSchema)) {
|
|
2253
|
-
const extensionSchema = await transformExtension(fhirSchema, register,
|
|
2253
|
+
const extensionSchema = await transformExtension(fhirSchema, register, logger2);
|
|
2254
2254
|
if (extensionSchema) {
|
|
2255
2255
|
results.push(extensionSchema);
|
|
2256
2256
|
}
|
|
2257
2257
|
return results;
|
|
2258
2258
|
}
|
|
2259
|
-
return transformFhirSchemaResource(register, fhirSchema);
|
|
2259
|
+
return transformFhirSchemaResource(register, fhirSchema, logger2);
|
|
2260
2260
|
}
|
|
2261
2261
|
var TypeSchemaCache = class {
|
|
2262
2262
|
cache = /* @__PURE__ */ new Map();
|
|
@@ -2476,8 +2476,227 @@ var TypeSchemaCache = class {
|
|
|
2476
2476
|
}
|
|
2477
2477
|
}
|
|
2478
2478
|
};
|
|
2479
|
+
|
|
2480
|
+
// src/logger.ts
|
|
2481
|
+
var LogLevel = /* @__PURE__ */ ((LogLevel2) => {
|
|
2482
|
+
LogLevel2[LogLevel2["DEBUG"] = 0] = "DEBUG";
|
|
2483
|
+
LogLevel2[LogLevel2["INFO"] = 1] = "INFO";
|
|
2484
|
+
LogLevel2[LogLevel2["WARN"] = 2] = "WARN";
|
|
2485
|
+
LogLevel2[LogLevel2["ERROR"] = 3] = "ERROR";
|
|
2486
|
+
LogLevel2[LogLevel2["SILENT"] = 4] = "SILENT";
|
|
2487
|
+
return LogLevel2;
|
|
2488
|
+
})(LogLevel || {});
|
|
2489
|
+
var ConsoleOutput = class {
|
|
2490
|
+
constructor(useStderr = false) {
|
|
2491
|
+
this.useStderr = useStderr;
|
|
2492
|
+
}
|
|
2493
|
+
write(entry, formatted) {
|
|
2494
|
+
const output = this.useStderr || entry.level >= 2 /* WARN */ ? console.error : console.log;
|
|
2495
|
+
output(formatted);
|
|
2496
|
+
}
|
|
2497
|
+
};
|
|
2498
|
+
var Logger = class _Logger {
|
|
2499
|
+
config;
|
|
2500
|
+
constructor(config = {}) {
|
|
2501
|
+
this.config = {
|
|
2502
|
+
level: 1 /* INFO */,
|
|
2503
|
+
format: "pretty",
|
|
2504
|
+
includeTimestamp: true,
|
|
2505
|
+
includeContext: true,
|
|
2506
|
+
colorize: true,
|
|
2507
|
+
outputs: [new ConsoleOutput()],
|
|
2508
|
+
...config
|
|
2509
|
+
};
|
|
2510
|
+
}
|
|
2511
|
+
/**
|
|
2512
|
+
* Update logger configuration
|
|
2513
|
+
*/
|
|
2514
|
+
configure(config) {
|
|
2515
|
+
this.config = { ...this.config, ...config };
|
|
2516
|
+
}
|
|
2517
|
+
/**
|
|
2518
|
+
* Check if a log level should be output
|
|
2519
|
+
*/
|
|
2520
|
+
shouldLog(level) {
|
|
2521
|
+
return level >= this.config.level;
|
|
2522
|
+
}
|
|
2523
|
+
/**
|
|
2524
|
+
* Create a log entry
|
|
2525
|
+
*/
|
|
2526
|
+
createEntry(level, message, context, error, operation) {
|
|
2527
|
+
const entry = {
|
|
2528
|
+
timestamp: (/* @__PURE__ */ new Date()).toISOString(),
|
|
2529
|
+
level,
|
|
2530
|
+
levelName: LogLevel[level],
|
|
2531
|
+
message,
|
|
2532
|
+
component: this.config.component
|
|
2533
|
+
};
|
|
2534
|
+
if (context && this.config.includeContext) {
|
|
2535
|
+
entry.context = context;
|
|
2536
|
+
}
|
|
2537
|
+
if (operation) {
|
|
2538
|
+
entry.operation = operation;
|
|
2539
|
+
}
|
|
2540
|
+
if (error) {
|
|
2541
|
+
entry.error = {
|
|
2542
|
+
name: error.name,
|
|
2543
|
+
message: error.message,
|
|
2544
|
+
stack: error.stack
|
|
2545
|
+
};
|
|
2546
|
+
}
|
|
2547
|
+
return entry;
|
|
2548
|
+
}
|
|
2549
|
+
/**
|
|
2550
|
+
* Format log entry for output
|
|
2551
|
+
*/
|
|
2552
|
+
formatEntry(entry) {
|
|
2553
|
+
switch (this.config.format) {
|
|
2554
|
+
case "json":
|
|
2555
|
+
return JSON.stringify(entry);
|
|
2556
|
+
case "compact":
|
|
2557
|
+
return this.formatCompact(entry);
|
|
2558
|
+
default:
|
|
2559
|
+
return this.formatPretty(entry);
|
|
2560
|
+
}
|
|
2561
|
+
}
|
|
2562
|
+
/**
|
|
2563
|
+
* Format entry in compact format
|
|
2564
|
+
*/
|
|
2565
|
+
formatCompact(entry) {
|
|
2566
|
+
const timestamp = this.config.includeTimestamp ? `${entry.timestamp} ` : "";
|
|
2567
|
+
const component = entry.component ? `[${entry.component}] ` : "";
|
|
2568
|
+
const operation = entry.operation ? `(${entry.operation}) ` : "";
|
|
2569
|
+
const level = this.colorizeLevel(entry.levelName, entry.level);
|
|
2570
|
+
return `${timestamp}${level} ${component}${operation}${entry.message}`;
|
|
2571
|
+
}
|
|
2572
|
+
/**
|
|
2573
|
+
* Format entry in pretty format
|
|
2574
|
+
*/
|
|
2575
|
+
formatPretty(entry) {
|
|
2576
|
+
let formatted = "";
|
|
2577
|
+
const timestamp = this.config.includeTimestamp ? `${entry.timestamp} ` : "";
|
|
2578
|
+
const component = entry.component ? `[${entry.component}] ` : "";
|
|
2579
|
+
const operation = entry.operation ? `(${entry.operation}) ` : "";
|
|
2580
|
+
const level = this.colorizeLevel(entry.levelName.padEnd(5), entry.level);
|
|
2581
|
+
formatted += `${timestamp}${level} ${component}${operation}${entry.message}`;
|
|
2582
|
+
if (entry.context && Object.keys(entry.context).length > 0) {
|
|
2583
|
+
formatted += `
|
|
2584
|
+
Context: ${JSON.stringify(entry.context, null, 2).split("\n").join("\n ")}`;
|
|
2585
|
+
}
|
|
2586
|
+
if (entry.error) {
|
|
2587
|
+
formatted += `
|
|
2588
|
+
Error: [${entry.error.code || entry.error.name}] ${entry.error.message}`;
|
|
2589
|
+
if (entry.error.context && Object.keys(entry.error.context).length > 0) {
|
|
2590
|
+
formatted += `
|
|
2591
|
+
Error Context: ${JSON.stringify(entry.error.context, null, 2).split("\n").join("\n ")}`;
|
|
2592
|
+
}
|
|
2593
|
+
if (entry.error.suggestions && entry.error.suggestions.length > 0) {
|
|
2594
|
+
formatted += `
|
|
2595
|
+
Suggestions:
|
|
2596
|
+
${entry.error.suggestions.map((s) => ` \u2022 ${s}`).join("\n")}`;
|
|
2597
|
+
}
|
|
2598
|
+
if (entry.level === 0 /* DEBUG */ && entry.error.stack) {
|
|
2599
|
+
formatted += `
|
|
2600
|
+
Stack: ${entry.error.stack.split("\n").join("\n ")}`;
|
|
2601
|
+
}
|
|
2602
|
+
}
|
|
2603
|
+
return formatted;
|
|
2604
|
+
}
|
|
2605
|
+
/**
|
|
2606
|
+
* Colorize log level if enabled
|
|
2607
|
+
*/
|
|
2608
|
+
colorizeLevel(levelName, level) {
|
|
2609
|
+
if (!this.config.colorize) {
|
|
2610
|
+
return levelName;
|
|
2611
|
+
}
|
|
2612
|
+
const colors = {
|
|
2613
|
+
[0 /* DEBUG */]: "\x1B[36m",
|
|
2614
|
+
// Cyan
|
|
2615
|
+
[1 /* INFO */]: "\x1B[32m",
|
|
2616
|
+
// Green
|
|
2617
|
+
[2 /* WARN */]: "\x1B[33m",
|
|
2618
|
+
// Yellow
|
|
2619
|
+
[3 /* ERROR */]: "\x1B[31m"
|
|
2620
|
+
// Red
|
|
2621
|
+
};
|
|
2622
|
+
const reset = "\x1B[0m";
|
|
2623
|
+
const color = colors[level] || "";
|
|
2624
|
+
return `${color}${levelName}${reset}`;
|
|
2625
|
+
}
|
|
2626
|
+
/**
|
|
2627
|
+
* Write log entry to all outputs
|
|
2628
|
+
*/
|
|
2629
|
+
async writeEntry(entry) {
|
|
2630
|
+
if (!this.shouldLog(entry.level)) {
|
|
2631
|
+
return;
|
|
2632
|
+
}
|
|
2633
|
+
const formatted = this.formatEntry(entry);
|
|
2634
|
+
for (const output of this.config.outputs) {
|
|
2635
|
+
try {
|
|
2636
|
+
await output.write(entry, formatted);
|
|
2637
|
+
} catch (error) {
|
|
2638
|
+
console.error("Logger output failed:", error);
|
|
2639
|
+
console.error(formatted);
|
|
2640
|
+
}
|
|
2641
|
+
}
|
|
2642
|
+
}
|
|
2643
|
+
/**
|
|
2644
|
+
* Log debug message
|
|
2645
|
+
*/
|
|
2646
|
+
async debug(message, context, operation) {
|
|
2647
|
+
const entry = this.createEntry(0 /* DEBUG */, message, context, void 0, operation);
|
|
2648
|
+
await this.writeEntry(entry);
|
|
2649
|
+
}
|
|
2650
|
+
/**
|
|
2651
|
+
* Log info message
|
|
2652
|
+
*/
|
|
2653
|
+
async info(message, context, operation) {
|
|
2654
|
+
const entry = this.createEntry(1 /* INFO */, message, context, void 0, operation);
|
|
2655
|
+
await this.writeEntry(entry);
|
|
2656
|
+
}
|
|
2657
|
+
/**
|
|
2658
|
+
* Log warning message
|
|
2659
|
+
*/
|
|
2660
|
+
async warn(message, context, operation) {
|
|
2661
|
+
const entry = this.createEntry(2 /* WARN */, message, context, void 0, operation);
|
|
2662
|
+
await this.writeEntry(entry);
|
|
2663
|
+
}
|
|
2664
|
+
/**
|
|
2665
|
+
* Log error message
|
|
2666
|
+
*/
|
|
2667
|
+
async error(message, error, context, operation) {
|
|
2668
|
+
const entry = this.createEntry(3 /* ERROR */, message, context, error, operation);
|
|
2669
|
+
await this.writeEntry(entry);
|
|
2670
|
+
}
|
|
2671
|
+
/**
|
|
2672
|
+
* Create a child logger with additional context
|
|
2673
|
+
*/
|
|
2674
|
+
child(component, context) {
|
|
2675
|
+
const childLogger = new _Logger({
|
|
2676
|
+
...this.config,
|
|
2677
|
+
component: this.config.component ? `${this.config.component}.${component}` : component
|
|
2678
|
+
});
|
|
2679
|
+
if (context) {
|
|
2680
|
+
const originalMethods = {
|
|
2681
|
+
debug: childLogger.debug.bind(childLogger),
|
|
2682
|
+
info: childLogger.info.bind(childLogger),
|
|
2683
|
+
warn: childLogger.warn.bind(childLogger),
|
|
2684
|
+
error: childLogger.error.bind(childLogger)
|
|
2685
|
+
};
|
|
2686
|
+
childLogger.debug = (message, additionalContext, operation) => originalMethods.debug(message, { ...context, ...additionalContext }, operation);
|
|
2687
|
+
childLogger.info = (message, additionalContext, operation) => originalMethods.info(message, { ...context, ...additionalContext }, operation);
|
|
2688
|
+
childLogger.warn = (message, additionalContext, operation) => originalMethods.warn(message, { ...context, ...additionalContext }, operation);
|
|
2689
|
+
childLogger.error = (message, error, additionalContext, operation) => originalMethods.error(message, error, { ...context, ...additionalContext }, operation);
|
|
2690
|
+
}
|
|
2691
|
+
return childLogger;
|
|
2692
|
+
}
|
|
2693
|
+
};
|
|
2694
|
+
new Logger();
|
|
2695
|
+
|
|
2696
|
+
// src/utils/codegen-logger.ts
|
|
2479
2697
|
var CodegenLogger = class _CodegenLogger {
|
|
2480
2698
|
options;
|
|
2699
|
+
dryWarnSet = /* @__PURE__ */ new Set();
|
|
2481
2700
|
constructor(options = {}) {
|
|
2482
2701
|
this.options = {
|
|
2483
2702
|
timestamp: false,
|
|
@@ -2485,22 +2704,39 @@ var CodegenLogger = class _CodegenLogger {
|
|
|
2485
2704
|
...options
|
|
2486
2705
|
};
|
|
2487
2706
|
}
|
|
2707
|
+
static consoleLevelsMap = {
|
|
2708
|
+
[1 /* INFO */]: console.log,
|
|
2709
|
+
[2 /* WARN */]: console.warn,
|
|
2710
|
+
[3 /* ERROR */]: console.error,
|
|
2711
|
+
[0 /* DEBUG */]: console.log,
|
|
2712
|
+
[4 /* SILENT */]: () => {
|
|
2713
|
+
}
|
|
2714
|
+
};
|
|
2488
2715
|
formatMessage(level, message, color) {
|
|
2489
2716
|
const timestamp = this.options.timestamp ? `${pc.gray((/* @__PURE__ */ new Date()).toLocaleTimeString())} ` : "";
|
|
2490
2717
|
const prefix = this.options.prefix ? `${pc.cyan(`[${this.options.prefix}]`)} ` : "";
|
|
2491
2718
|
return `${timestamp}${color(level)} ${prefix}${message}`;
|
|
2492
2719
|
}
|
|
2720
|
+
isSuppressed(level) {
|
|
2721
|
+
return this.options.suppressLoggingLevel === "all" || this.options.suppressLoggingLevel?.includes(level) || false;
|
|
2722
|
+
}
|
|
2723
|
+
tryWriteToConsole(level, formattedMessage) {
|
|
2724
|
+
if (this.isSuppressed(level)) return;
|
|
2725
|
+
const logFn = _CodegenLogger.consoleLevelsMap[level] || console.log;
|
|
2726
|
+
logFn(formattedMessage);
|
|
2727
|
+
}
|
|
2493
2728
|
/**
|
|
2494
2729
|
* Success message with checkmark
|
|
2495
2730
|
*/
|
|
2496
2731
|
success(message) {
|
|
2497
|
-
|
|
2732
|
+
this.tryWriteToConsole(1 /* INFO */, this.formatMessage("", message, pc.green));
|
|
2498
2733
|
}
|
|
2499
2734
|
/**
|
|
2500
2735
|
* Error message with X mark
|
|
2501
2736
|
*/
|
|
2502
2737
|
error(message, error) {
|
|
2503
|
-
|
|
2738
|
+
if (this.isSuppressed(3 /* ERROR */)) return;
|
|
2739
|
+
console.error(this.formatMessage("", message, pc.red));
|
|
2504
2740
|
if (error && this.options.verbose) {
|
|
2505
2741
|
console.error(pc.red(` ${error.message}`));
|
|
2506
2742
|
if (error.stack) {
|
|
@@ -2512,33 +2748,39 @@ var CodegenLogger = class _CodegenLogger {
|
|
|
2512
2748
|
* Warning message with warning sign
|
|
2513
2749
|
*/
|
|
2514
2750
|
warn(message) {
|
|
2515
|
-
|
|
2751
|
+
this.tryWriteToConsole(2 /* WARN */, this.formatMessage("!", message, pc.yellow));
|
|
2752
|
+
}
|
|
2753
|
+
dry_warn(message) {
|
|
2754
|
+
if (!this.dryWarnSet.has(message)) {
|
|
2755
|
+
this.warn(message);
|
|
2756
|
+
this.dryWarnSet.add(message);
|
|
2757
|
+
}
|
|
2516
2758
|
}
|
|
2517
2759
|
/**
|
|
2518
2760
|
* Info message with info icon
|
|
2519
2761
|
*/
|
|
2520
2762
|
info(message) {
|
|
2521
|
-
|
|
2763
|
+
this.tryWriteToConsole(1 /* INFO */, this.formatMessage("i", message, pc.blue));
|
|
2522
2764
|
}
|
|
2523
2765
|
/**
|
|
2524
2766
|
* Debug message (only shows in verbose mode)
|
|
2525
2767
|
*/
|
|
2526
2768
|
debug(message) {
|
|
2527
2769
|
if (this.options.verbose) {
|
|
2528
|
-
|
|
2770
|
+
this.tryWriteToConsole(0 /* DEBUG */, this.formatMessage("\u{1F41B}", message, pc.magenta));
|
|
2529
2771
|
}
|
|
2530
2772
|
}
|
|
2531
2773
|
/**
|
|
2532
2774
|
* Step message with rocket
|
|
2533
2775
|
*/
|
|
2534
2776
|
step(message) {
|
|
2535
|
-
|
|
2777
|
+
this.tryWriteToConsole(1 /* INFO */, this.formatMessage("\u{1F680}", message, pc.cyan));
|
|
2536
2778
|
}
|
|
2537
2779
|
/**
|
|
2538
2780
|
* Progress message with clock
|
|
2539
2781
|
*/
|
|
2540
2782
|
progress(message) {
|
|
2541
|
-
|
|
2783
|
+
this.tryWriteToConsole(1 /* INFO */, this.formatMessage("\u23F3", message, pc.blue));
|
|
2542
2784
|
}
|
|
2543
2785
|
/**
|
|
2544
2786
|
* Plain message (no icon, just colored text)
|
|
@@ -2546,7 +2788,7 @@ var CodegenLogger = class _CodegenLogger {
|
|
|
2546
2788
|
plain(message, color = (s) => s) {
|
|
2547
2789
|
const timestamp = this.options.timestamp ? `${pc.gray((/* @__PURE__ */ new Date()).toLocaleTimeString())} ` : "";
|
|
2548
2790
|
const prefix = this.options.prefix ? `${pc.cyan(`[${this.options.prefix}]`)} ` : "";
|
|
2549
|
-
|
|
2791
|
+
this.tryWriteToConsole(1 /* INFO */, `${timestamp}${prefix}${color(message)}`);
|
|
2550
2792
|
}
|
|
2551
2793
|
/**
|
|
2552
2794
|
* Dimmed/gray text for less important info
|
|
@@ -2599,12 +2841,12 @@ var TypeSchemaGenerator = class {
|
|
|
2599
2841
|
}
|
|
2600
2842
|
async registerFromPackageMetas(packageMetas) {
|
|
2601
2843
|
const packageNames = packageMetas.map((meta) => `${meta.name}${meta.version}`);
|
|
2602
|
-
this.logger
|
|
2844
|
+
this.logger?.step(`Loading FHIR packages: ${packageNames.join(", ")}`);
|
|
2603
2845
|
await this.manager.init();
|
|
2604
2846
|
return registerFromManager(this.manager);
|
|
2605
2847
|
}
|
|
2606
2848
|
generateFhirSchemas(structureDefinitions) {
|
|
2607
|
-
this.logger
|
|
2849
|
+
this.logger?.progress(`Converting ${structureDefinitions.length} StructureDefinitions to FHIRSchemas`);
|
|
2608
2850
|
const filteredStructureDefinitions = this.applyStructureDefinitionTreeshaking(structureDefinitions);
|
|
2609
2851
|
const fhirSchemas = [];
|
|
2610
2852
|
let convertedCount = 0;
|
|
@@ -2614,56 +2856,56 @@ var TypeSchemaGenerator = class {
|
|
|
2614
2856
|
const fhirSchema = fhirschema.translate(sd);
|
|
2615
2857
|
fhirSchemas.push(fhirSchema);
|
|
2616
2858
|
convertedCount++;
|
|
2617
|
-
this.logger
|
|
2859
|
+
this.logger?.debug(`Converted StructureDefinition: ${sd.name || sd.id} (${sd.resourceType})`);
|
|
2618
2860
|
} catch (error) {
|
|
2619
2861
|
failedCount++;
|
|
2620
|
-
this.logger
|
|
2862
|
+
this.logger?.warn(
|
|
2621
2863
|
`Failed to convert StructureDefinition ${sd.name || sd.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
2622
2864
|
);
|
|
2623
2865
|
}
|
|
2624
2866
|
}
|
|
2625
|
-
this.logger
|
|
2867
|
+
this.logger?.success(
|
|
2626
2868
|
`FHIR Schema conversion completed: ${convertedCount}/${filteredStructureDefinitions.length} successful, ${failedCount} failed`
|
|
2627
2869
|
);
|
|
2628
2870
|
return fhirSchemas;
|
|
2629
2871
|
}
|
|
2630
|
-
async generateValueSetSchemas(valueSets) {
|
|
2872
|
+
async generateValueSetSchemas(valueSets, logger2) {
|
|
2631
2873
|
if (valueSets.length > 0) {
|
|
2632
|
-
this.logger
|
|
2874
|
+
this.logger?.debug(`${valueSets.length} ValueSets available for enum extraction`);
|
|
2633
2875
|
}
|
|
2634
|
-
const register = await registerFromManager(this.manager);
|
|
2876
|
+
const register = await registerFromManager(this.manager, logger2);
|
|
2635
2877
|
const valueSetSchemas = [];
|
|
2636
2878
|
if (valueSets.length > 0) {
|
|
2637
|
-
this.logger
|
|
2879
|
+
this.logger?.progress(`Converting ${valueSets.length} ValueSets to TypeSchema`);
|
|
2638
2880
|
let valueSetConvertedCount = 0;
|
|
2639
2881
|
let valueSetFailedCount = 0;
|
|
2640
2882
|
for (const vs of valueSets) {
|
|
2641
2883
|
try {
|
|
2642
|
-
const valueSetSchema = await transformValueSet(register, vs);
|
|
2884
|
+
const valueSetSchema = await transformValueSet(register, vs, logger2);
|
|
2643
2885
|
if (valueSetSchema) {
|
|
2644
2886
|
valueSetSchemas.push(valueSetSchema);
|
|
2645
2887
|
valueSetConvertedCount++;
|
|
2646
|
-
this.logger
|
|
2888
|
+
this.logger?.debug(`Converted ValueSet: ${vs.name || vs.id}`);
|
|
2647
2889
|
}
|
|
2648
2890
|
} catch (error) {
|
|
2649
2891
|
valueSetFailedCount++;
|
|
2650
|
-
this.logger
|
|
2892
|
+
this.logger?.warn(
|
|
2651
2893
|
`Failed to convert ValueSet ${vs.name || vs.id}: ${error instanceof Error ? error.message : String(error)}`
|
|
2652
2894
|
);
|
|
2653
2895
|
}
|
|
2654
2896
|
}
|
|
2655
|
-
this.logger
|
|
2897
|
+
this.logger?.success(
|
|
2656
2898
|
`ValueSet conversion completed: ${valueSetConvertedCount}/${valueSets.length} successful, ${valueSetFailedCount} failed`
|
|
2657
2899
|
);
|
|
2658
2900
|
}
|
|
2659
2901
|
return valueSetSchemas;
|
|
2660
2902
|
}
|
|
2661
|
-
async generateFromPackage(packageName, packageVersion) {
|
|
2903
|
+
async generateFromPackage(packageName, packageVersion, logger2) {
|
|
2662
2904
|
await this.initializeCache();
|
|
2663
2905
|
if (this.cache && !(this.cacheConfig?.forceRegenerate ?? false)) {
|
|
2664
2906
|
const cachedSchemas = this.cache.getByPackage(packageName);
|
|
2665
2907
|
if (cachedSchemas.length > 0) {
|
|
2666
|
-
this.logger
|
|
2908
|
+
this.logger?.info(
|
|
2667
2909
|
`Using cached TypeSchemas for package: ${packageName} (${cachedSchemas.length} schemas)`
|
|
2668
2910
|
);
|
|
2669
2911
|
return cachedSchemas;
|
|
@@ -2674,10 +2916,9 @@ var TypeSchemaGenerator = class {
|
|
|
2674
2916
|
version: packageVersion || "latest"
|
|
2675
2917
|
};
|
|
2676
2918
|
const register = await this.registerFromPackageMetas([packageInfo]);
|
|
2677
|
-
const valueSets = await this.generateValueSetSchemas(register.allVs());
|
|
2678
|
-
const fhirSchemas = (await Promise.all(register.allFs().map(async (fs2) => await transformFhirSchema(register, fs2)))).flat();
|
|
2919
|
+
const valueSets = await this.generateValueSetSchemas(register.allVs(), logger2);
|
|
2920
|
+
const fhirSchemas = (await Promise.all(register.allFs().map(async (fs2) => await transformFhirSchema(register, fs2, logger2)))).flat();
|
|
2679
2921
|
const allSchemas = [...fhirSchemas, ...valueSets];
|
|
2680
|
-
console.debug(111);
|
|
2681
2922
|
if (this.cache) {
|
|
2682
2923
|
for (const schema of allSchemas) {
|
|
2683
2924
|
await this.cache.set(schema);
|
|
@@ -2694,7 +2935,7 @@ var TypeSchemaGenerator = class {
|
|
|
2694
2935
|
if (!treeshakeList || treeshakeList.length === 0) {
|
|
2695
2936
|
return structureDefinitions;
|
|
2696
2937
|
}
|
|
2697
|
-
this.logger
|
|
2938
|
+
this.logger?.info(`Applying treeshaking filter for ResourceTypes: ${treeshakeList.join(", ")}`);
|
|
2698
2939
|
const allStructureDefinitions = /* @__PURE__ */ new Map();
|
|
2699
2940
|
const realDependencies = /* @__PURE__ */ new Map();
|
|
2700
2941
|
const referenceTargets = /* @__PURE__ */ new Map();
|
|
@@ -2718,7 +2959,7 @@ var TypeSchemaGenerator = class {
|
|
|
2718
2959
|
if (allStructureDefinitions.has(resourceType)) {
|
|
2719
2960
|
structureDefinitionsToKeep.add(resourceType);
|
|
2720
2961
|
} else {
|
|
2721
|
-
this.logger
|
|
2962
|
+
this.logger?.warn(`ResourceType '${resourceType}' not found in structure definitions`);
|
|
2722
2963
|
}
|
|
2723
2964
|
}
|
|
2724
2965
|
const addRealDependenciesRecursively = (name, visited = /* @__PURE__ */ new Set()) => {
|
|
@@ -2754,9 +2995,9 @@ var TypeSchemaGenerator = class {
|
|
|
2754
2995
|
}
|
|
2755
2996
|
}
|
|
2756
2997
|
if (excludedReferenceTargets.size > 0) {
|
|
2757
|
-
this.logger
|
|
2998
|
+
this.logger?.info(`Excluded reference-only targets: ${Array.from(excludedReferenceTargets).join(", ")}`);
|
|
2758
2999
|
}
|
|
2759
|
-
this.logger
|
|
3000
|
+
this.logger?.success(
|
|
2760
3001
|
`Treeshaking completed: kept ${filteredStructureDefinitions.length}/${structureDefinitions.length} structure definitions`
|
|
2761
3002
|
);
|
|
2762
3003
|
return filteredStructureDefinitions;
|
|
@@ -3045,10 +3286,10 @@ var TypeSchemaParser = class {
|
|
|
3045
3286
|
};
|
|
3046
3287
|
|
|
3047
3288
|
// src/typeschema/index.ts
|
|
3048
|
-
var generateTypeSchemas = async (register) => {
|
|
3289
|
+
var generateTypeSchemas = async (register, logger2) => {
|
|
3049
3290
|
const fhirSchemas = [];
|
|
3050
3291
|
for (const fhirSchema of register.allFs()) {
|
|
3051
|
-
fhirSchemas.push(...await transformFhirSchema(register, fhirSchema));
|
|
3292
|
+
fhirSchemas.push(...await transformFhirSchema(register, fhirSchema, logger2));
|
|
3052
3293
|
}
|
|
3053
3294
|
for (const vsSchema of register.allVs()) {
|
|
3054
3295
|
fhirSchemas.push(await transformValueSet(register, vsSchema));
|
|
@@ -3106,45 +3347,45 @@ var ErrorHandler = class {
|
|
|
3106
3347
|
handleUnknownError(error, context) {
|
|
3107
3348
|
this.options.logger.error("Unexpected error occurred:", error);
|
|
3108
3349
|
if (this.options.verbose) {
|
|
3109
|
-
|
|
3110
|
-
|
|
3111
|
-
|
|
3350
|
+
this.options.logger.error("\n\u{1F6A8} Unexpected Error Details:");
|
|
3351
|
+
this.options.logger.error(` Type: ${error.constructor.name}`);
|
|
3352
|
+
this.options.logger.error(` Message: ${error.message}`);
|
|
3112
3353
|
if (error.stack) {
|
|
3113
|
-
|
|
3354
|
+
this.options.logger.error(` Stack: ${error.stack}`);
|
|
3114
3355
|
}
|
|
3115
3356
|
if (context?.schema) {
|
|
3116
|
-
|
|
3357
|
+
this.options.logger.error(` Schema: ${context.schema.identifier.name}`);
|
|
3117
3358
|
}
|
|
3118
3359
|
if (context?.filename) {
|
|
3119
|
-
|
|
3360
|
+
this.options.logger.error(` File: ${context.filename}`);
|
|
3120
3361
|
}
|
|
3121
3362
|
}
|
|
3122
|
-
|
|
3123
|
-
|
|
3124
|
-
|
|
3125
|
-
|
|
3126
|
-
|
|
3363
|
+
this.options.logger.error("\n\u{1F4A1} General troubleshooting suggestions:");
|
|
3364
|
+
this.options.logger.error(" \u2022 Run with --verbose flag for more details");
|
|
3365
|
+
this.options.logger.error(" \u2022 Check your input files for corruption");
|
|
3366
|
+
this.options.logger.error(" \u2022 Update to the latest version of atomic-codegen");
|
|
3367
|
+
this.options.logger.error(" \u2022 Report this issue at: https://github.com/atomic-ehr/codegen/issues");
|
|
3127
3368
|
}
|
|
3128
3369
|
/**
|
|
3129
3370
|
* Report error to console with formatting
|
|
3130
3371
|
*/
|
|
3131
3372
|
reportErrorToConsole(error) {
|
|
3132
3373
|
if ("getFormattedMessage" in error) {
|
|
3133
|
-
|
|
3374
|
+
this.options.logger.error(error.getFormattedMessage());
|
|
3134
3375
|
} else {
|
|
3135
|
-
|
|
3376
|
+
this.options.logger.error(`
|
|
3136
3377
|
\u274C ${error.constructor.name}: ${error.message}`);
|
|
3137
3378
|
const suggestions = error.getSuggestions();
|
|
3138
3379
|
if (suggestions.length > 0) {
|
|
3139
|
-
|
|
3380
|
+
this.options.logger.error("\n\u{1F4A1} Suggestions:");
|
|
3140
3381
|
suggestions.forEach((suggestion) => {
|
|
3141
|
-
|
|
3382
|
+
this.options.logger.error(` \u2022 ${suggestion}`);
|
|
3142
3383
|
});
|
|
3143
3384
|
}
|
|
3144
3385
|
}
|
|
3145
3386
|
if (this.options.verbose && error.context) {
|
|
3146
|
-
|
|
3147
|
-
|
|
3387
|
+
this.options.logger.error("\n\u{1F50D} Debug Information:");
|
|
3388
|
+
this.options.logger.error(JSON.stringify(error.context, null, 2));
|
|
3148
3389
|
}
|
|
3149
3390
|
}
|
|
3150
3391
|
/**
|
|
@@ -3159,7 +3400,7 @@ var ErrorHandler = class {
|
|
|
3159
3400
|
suggestions: error.getSuggestions(),
|
|
3160
3401
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
3161
3402
|
};
|
|
3162
|
-
|
|
3403
|
+
this.options.logger.error(JSON.stringify(errorData, null, 2));
|
|
3163
3404
|
}
|
|
3164
3405
|
/**
|
|
3165
3406
|
* Report error in structured format
|
|
@@ -3175,16 +3416,16 @@ var ErrorHandler = class {
|
|
|
3175
3416
|
suggestions: error.getSuggestions(),
|
|
3176
3417
|
actions: this.getRecoveryActions(error)
|
|
3177
3418
|
};
|
|
3178
|
-
|
|
3179
|
-
|
|
3180
|
-
|
|
3181
|
-
|
|
3419
|
+
this.options.logger.error("---");
|
|
3420
|
+
this.options.logger.error("Error Report:");
|
|
3421
|
+
this.options.logger.error(JSON.stringify(structure, null, 2));
|
|
3422
|
+
this.options.logger.error("---");
|
|
3182
3423
|
}
|
|
3183
3424
|
/**
|
|
3184
3425
|
* Report multiple errors efficiently
|
|
3185
3426
|
*/
|
|
3186
3427
|
reportBatchErrors(errors) {
|
|
3187
|
-
|
|
3428
|
+
this.options.logger.error(`
|
|
3188
3429
|
\u274C ${errors.length} errors occurred during generation:`);
|
|
3189
3430
|
const errorGroups = /* @__PURE__ */ new Map();
|
|
3190
3431
|
errors.forEach((error) => {
|
|
@@ -3195,19 +3436,19 @@ var ErrorHandler = class {
|
|
|
3195
3436
|
errorGroups.get(type)?.push(error);
|
|
3196
3437
|
});
|
|
3197
3438
|
for (const [type, groupErrors] of errorGroups) {
|
|
3198
|
-
|
|
3439
|
+
this.options.logger.error(`
|
|
3199
3440
|
\u{1F4CB} ${type} (${groupErrors.length} occurrences):`);
|
|
3200
3441
|
groupErrors.forEach((error, index) => {
|
|
3201
|
-
|
|
3442
|
+
this.options.logger.error(` ${index + 1}. ${error.message}`);
|
|
3202
3443
|
if (error.context?.schemaName) {
|
|
3203
|
-
|
|
3444
|
+
this.options.logger.error(` Schema: ${error.context.schemaName}`);
|
|
3204
3445
|
}
|
|
3205
3446
|
});
|
|
3206
3447
|
const commonSuggestions = this.getCommonSuggestions(groupErrors);
|
|
3207
3448
|
if (commonSuggestions.length > 0) {
|
|
3208
|
-
|
|
3449
|
+
this.options.logger.error("\n \u{1F4A1} Common suggestions:");
|
|
3209
3450
|
commonSuggestions.forEach((suggestion) => {
|
|
3210
|
-
|
|
3451
|
+
this.options.logger.error(` \u2022 ${suggestion}`);
|
|
3211
3452
|
});
|
|
3212
3453
|
}
|
|
3213
3454
|
}
|
|
@@ -3517,7 +3758,7 @@ var BaseGenerator = class {
|
|
|
3517
3758
|
logger: this.logger,
|
|
3518
3759
|
verbose: this.options.verbose || false,
|
|
3519
3760
|
beginnerMode: this.options.beginnerMode || false,
|
|
3520
|
-
outputFormat: this.options.
|
|
3761
|
+
outputFormat: "this.options.logger"
|
|
3521
3762
|
});
|
|
3522
3763
|
this.errorBoundary = new GeneratorErrorBoundary(this.errorHandler);
|
|
3523
3764
|
this.logger.debug(`${this.getLanguageName()} generator initialized`);
|
|
@@ -5094,6 +5335,13 @@ var capitalCase = (s) => {
|
|
|
5094
5335
|
var pascalCase = (s) => {
|
|
5095
5336
|
return words(s).map(capitalCase).join("");
|
|
5096
5337
|
};
|
|
5338
|
+
var uppercaseFirstLetter = (str) => {
|
|
5339
|
+
if (!str || str.length === 0) return str;
|
|
5340
|
+
return str.charAt(0).toUpperCase() + str.slice(1);
|
|
5341
|
+
};
|
|
5342
|
+
var uppercaseFirstLetterOfEach = (strings) => {
|
|
5343
|
+
return strings.map((str) => uppercaseFirstLetter(str));
|
|
5344
|
+
};
|
|
5097
5345
|
var FileSystemWriter = class {
|
|
5098
5346
|
opts;
|
|
5099
5347
|
currentDir;
|
|
@@ -5119,7 +5367,7 @@ var FileSystemWriter = class {
|
|
|
5119
5367
|
if (fn.includes("/")) throw new Error(`Change file path separatly: ${fn}`);
|
|
5120
5368
|
const fullFn = `${this.currentDir}/${fn}`;
|
|
5121
5369
|
try {
|
|
5122
|
-
this.currentFileDescriptor = fs.openSync(
|
|
5370
|
+
this.currentFileDescriptor = fs.openSync(fullFn, "w");
|
|
5123
5371
|
this.writtenFilesSet.add(fn);
|
|
5124
5372
|
this.logger()?.debug(`cat > '${fullFn}'`);
|
|
5125
5373
|
gen();
|
|
@@ -5180,6 +5428,17 @@ var Writer = class extends FileSystemWriter {
|
|
|
5180
5428
|
this.comment(...tokens);
|
|
5181
5429
|
}
|
|
5182
5430
|
}
|
|
5431
|
+
disclaimer() {
|
|
5432
|
+
return [
|
|
5433
|
+
"WARNING: This file is autogenerated by FHIR Schema Codegen.",
|
|
5434
|
+
"https://github.com/fhir-schema/fhir-schema-codegen",
|
|
5435
|
+
"Any manual changes made to this file may be overwritten."
|
|
5436
|
+
];
|
|
5437
|
+
}
|
|
5438
|
+
generateDisclaimer() {
|
|
5439
|
+
this.disclaimer().forEach((e) => this.comment(e));
|
|
5440
|
+
this.line();
|
|
5441
|
+
}
|
|
5183
5442
|
curlyBlock(tokens, gencontent, endTokens) {
|
|
5184
5443
|
this.line(`${tokens.filter(Boolean).join(" ")} {`);
|
|
5185
5444
|
this.indent();
|
|
@@ -5196,9 +5455,7 @@ var Writer = class extends FileSystemWriter {
|
|
|
5196
5455
|
}
|
|
5197
5456
|
};
|
|
5198
5457
|
|
|
5199
|
-
// src/
|
|
5200
|
-
var collectComplexTypes = (tss) => tss.filter((t) => t.identifier.kind === "complex-type");
|
|
5201
|
-
var collectResources = (tss) => tss.filter((t) => t.identifier.kind === "resource");
|
|
5458
|
+
// src/typeschema/utils.ts
|
|
5202
5459
|
var groupByPackages = (typeSchemas) => {
|
|
5203
5460
|
const grouped = {};
|
|
5204
5461
|
for (const ts of typeSchemas) {
|
|
@@ -5213,9 +5470,85 @@ var groupByPackages = (typeSchemas) => {
|
|
|
5213
5470
|
}
|
|
5214
5471
|
return grouped;
|
|
5215
5472
|
};
|
|
5216
|
-
var
|
|
5473
|
+
var collectComplexTypes = (tss) => tss.filter((t) => t.identifier.kind === "complex-type");
|
|
5474
|
+
var collectResources = (tss) => tss.filter((t) => t.identifier.kind === "resource");
|
|
5475
|
+
var notChoiceDeclaration = (field) => {
|
|
5476
|
+
if (field.choices) return void 0;
|
|
5477
|
+
if (field.choiceOf) return field;
|
|
5478
|
+
return field;
|
|
5479
|
+
};
|
|
5480
|
+
var resourceRelatives = (schemas) => {
|
|
5481
|
+
const regularSchemas = collectResources(schemas);
|
|
5482
|
+
const directPairs = [];
|
|
5483
|
+
for (const schema of regularSchemas) {
|
|
5484
|
+
if (schema.base) {
|
|
5485
|
+
directPairs.push({ parent: schema.base, child: schema.identifier });
|
|
5486
|
+
}
|
|
5487
|
+
}
|
|
5488
|
+
const allPairs = [...directPairs];
|
|
5489
|
+
const findTransitiveRelatives = (parentRef) => {
|
|
5490
|
+
const directChildren = directPairs.filter((pair) => pair.parent.name === parentRef.name).map((pair) => pair.child);
|
|
5491
|
+
const transitiveChildren = [];
|
|
5492
|
+
for (const child of directChildren) {
|
|
5493
|
+
transitiveChildren.push(...findTransitiveRelatives(child));
|
|
5494
|
+
}
|
|
5495
|
+
return [...directChildren, ...transitiveChildren];
|
|
5496
|
+
};
|
|
5497
|
+
for (const pair of directPairs) {
|
|
5498
|
+
const transitiveChildren = findTransitiveRelatives(pair.child);
|
|
5499
|
+
for (const transitiveChild of transitiveChildren) {
|
|
5500
|
+
if (!directPairs.some((dp) => dp.parent.name === pair.parent.name && dp.child.name === transitiveChild.name)) {
|
|
5501
|
+
allPairs.push({ parent: pair.parent, child: transitiveChild });
|
|
5502
|
+
}
|
|
5503
|
+
}
|
|
5504
|
+
}
|
|
5505
|
+
return allPairs;
|
|
5506
|
+
};
|
|
5507
|
+
var resourceChildren = (relatives, id) => {
|
|
5508
|
+
return relatives.filter((relative2) => relative2.parent.name === id.name).map((relative2) => relative2.child);
|
|
5509
|
+
};
|
|
5510
|
+
|
|
5511
|
+
// src/api/writer-generator/typescript.ts
|
|
5512
|
+
var primitiveType2tsType = {
|
|
5513
|
+
boolean: "boolean",
|
|
5514
|
+
instant: "string",
|
|
5515
|
+
time: "string",
|
|
5516
|
+
date: "string",
|
|
5517
|
+
dateTime: "string",
|
|
5518
|
+
decimal: "number",
|
|
5519
|
+
integer: "number",
|
|
5520
|
+
unsignedInt: "number",
|
|
5521
|
+
positiveInt: "number",
|
|
5522
|
+
integer64: "number",
|
|
5523
|
+
base64Binary: "string",
|
|
5524
|
+
uri: "string",
|
|
5525
|
+
url: "string",
|
|
5526
|
+
canonical: "string",
|
|
5527
|
+
oid: "string",
|
|
5528
|
+
uuid: "string",
|
|
5529
|
+
string: "string",
|
|
5530
|
+
code: "string",
|
|
5531
|
+
markdown: "string",
|
|
5532
|
+
id: "string",
|
|
5533
|
+
xhtml: "string"
|
|
5534
|
+
};
|
|
5535
|
+
var canonicalToName = (canonical, dropFragment = true) => {
|
|
5536
|
+
if (!canonical) return void 0;
|
|
5537
|
+
let localName = canonical.split("/").pop();
|
|
5538
|
+
if (dropFragment && localName?.includes("#")) {
|
|
5539
|
+
localName = localName.split("#")[0];
|
|
5540
|
+
}
|
|
5541
|
+
if (/^\d/.test(localName ?? "")) {
|
|
5542
|
+
localName = `number_${localName}`;
|
|
5543
|
+
}
|
|
5544
|
+
return localName?.replace(/[- ]/g, "_");
|
|
5545
|
+
};
|
|
5546
|
+
var tsBaseFileName = (id) => {
|
|
5217
5547
|
return pascalCase(id.name);
|
|
5218
5548
|
};
|
|
5549
|
+
var tsFileName = (id) => {
|
|
5550
|
+
return `${tsBaseFileName(id)}.ts`;
|
|
5551
|
+
};
|
|
5219
5552
|
var normalizeName = (n) => {
|
|
5220
5553
|
if (n === "extends") {
|
|
5221
5554
|
return "extends_";
|
|
@@ -5225,43 +5558,155 @@ var normalizeName = (n) => {
|
|
|
5225
5558
|
var resourceName = (id) => {
|
|
5226
5559
|
return normalizeName(id.name);
|
|
5227
5560
|
};
|
|
5561
|
+
var deriveNestedSchemaName = (url) => {
|
|
5562
|
+
const path = canonicalToName(url, false);
|
|
5563
|
+
if (!path) {
|
|
5564
|
+
return "";
|
|
5565
|
+
}
|
|
5566
|
+
const [resourceName2, fragment] = path.split("#");
|
|
5567
|
+
const name = uppercaseFirstLetterOfEach((fragment ?? "").split(".")).join("");
|
|
5568
|
+
return [resourceName2, name].join("");
|
|
5569
|
+
};
|
|
5228
5570
|
var TypeScript = class extends Writer {
|
|
5229
|
-
|
|
5230
|
-
|
|
5571
|
+
resourceRelatives = [];
|
|
5572
|
+
tsImport(tsPackageName, ...entities) {
|
|
5573
|
+
this.lineSM(`import { ${entities.join(", ")} } from '${tsPackageName}'`);
|
|
5231
5574
|
}
|
|
5232
|
-
|
|
5575
|
+
generateFhirPackageIndexFile(schemas) {
|
|
5233
5576
|
this.cat("index.ts", () => {
|
|
5234
5577
|
let exports = schemas.map((schema) => ({
|
|
5235
5578
|
identifier: schema.identifier,
|
|
5236
|
-
|
|
5237
|
-
|
|
5238
|
-
})).sort((a, b) => a.
|
|
5239
|
-
exports = Array.from(new Map(exports.map((exp) => [exp.
|
|
5240
|
-
(a, b) => a.
|
|
5579
|
+
tsPackageName: tsBaseFileName(schema.identifier),
|
|
5580
|
+
resourceName: resourceName(schema.identifier)
|
|
5581
|
+
})).sort((a, b) => a.resourceName.localeCompare(b.resourceName));
|
|
5582
|
+
exports = Array.from(new Map(exports.map((exp) => [exp.resourceName.toLowerCase(), exp])).values()).sort(
|
|
5583
|
+
(a, b) => a.resourceName.localeCompare(b.resourceName)
|
|
5241
5584
|
);
|
|
5242
5585
|
for (const exp of exports) {
|
|
5243
5586
|
this.debugComment(exp.identifier);
|
|
5244
|
-
this.
|
|
5587
|
+
this.tsImport(`./${exp.tsPackageName}`, exp.resourceName);
|
|
5245
5588
|
}
|
|
5246
|
-
this.lineSM(`export { ${exports.map((e) => e.
|
|
5589
|
+
this.lineSM(`export { ${exports.map((e) => e.resourceName).join(", ")} }`);
|
|
5247
5590
|
this.line("");
|
|
5248
5591
|
this.curlyBlock(["export type ResourceTypeMap = "], () => {
|
|
5249
5592
|
this.lineSM("User: Record<string, any>");
|
|
5250
5593
|
exports.forEach((exp) => {
|
|
5251
5594
|
this.debugComment(exp.identifier);
|
|
5252
|
-
this.lineSM(`${exp.
|
|
5595
|
+
this.lineSM(`${exp.resourceName}: ${exp.resourceName}`);
|
|
5253
5596
|
});
|
|
5254
5597
|
});
|
|
5255
5598
|
this.lineSM("export type ResourceType = keyof ResourceTypeMap");
|
|
5256
5599
|
this.squareBlock(["export const resourceList: readonly ResourceType[] = "], () => {
|
|
5257
5600
|
exports.forEach((exp) => {
|
|
5258
5601
|
this.debugComment(exp.identifier);
|
|
5259
|
-
this.line(`'${exp.
|
|
5602
|
+
this.line(`'${exp.resourceName}', `);
|
|
5260
5603
|
});
|
|
5261
5604
|
});
|
|
5262
5605
|
});
|
|
5263
5606
|
}
|
|
5607
|
+
generateDependenciesImports(schema) {
|
|
5608
|
+
if (schema.dependencies) {
|
|
5609
|
+
const deps = [
|
|
5610
|
+
...schema.dependencies.filter((dep) => ["complex-type", "resource", "logical"].includes(dep.kind)).map((dep) => ({
|
|
5611
|
+
tsPackage: `../${kebabCase(dep.package)}/${pascalCase(dep.name)}`,
|
|
5612
|
+
name: uppercaseFirstLetter(dep.name)
|
|
5613
|
+
})),
|
|
5614
|
+
...schema.dependencies.filter((dep) => ["nested"].includes(dep.kind)).map((dep) => ({
|
|
5615
|
+
tsPackage: `../${kebabCase(dep.package)}/${pascalCase(canonicalToName(dep.url) ?? "")}`,
|
|
5616
|
+
name: deriveNestedSchemaName(dep.url)
|
|
5617
|
+
}))
|
|
5618
|
+
].sort((a, b) => a.name.localeCompare(b.name));
|
|
5619
|
+
for (const dep of deps) {
|
|
5620
|
+
this.tsImport(dep.tsPackage, dep.name);
|
|
5621
|
+
}
|
|
5622
|
+
}
|
|
5623
|
+
}
|
|
5624
|
+
addFieldExtension(fieldName, field) {
|
|
5625
|
+
if (field.type.kind === "primitive-type") {
|
|
5626
|
+
this.lineSM(`_${normalizeName(fieldName)}?: Element`);
|
|
5627
|
+
}
|
|
5628
|
+
}
|
|
5629
|
+
generateType(schema) {
|
|
5630
|
+
var name;
|
|
5631
|
+
if (schema.identifier.name === "Reference") {
|
|
5632
|
+
name = "Reference<T extends string = string>";
|
|
5633
|
+
} else if (schema.identifier.kind === "nested") {
|
|
5634
|
+
name = normalizeName(deriveNestedSchemaName(schema.identifier.url));
|
|
5635
|
+
} else {
|
|
5636
|
+
name = normalizeName(schema.identifier.name);
|
|
5637
|
+
}
|
|
5638
|
+
const parent = canonicalToName(schema.base?.url);
|
|
5639
|
+
const extendsClause = parent && `extends ${parent}`;
|
|
5640
|
+
this.debugComment(schema.identifier);
|
|
5641
|
+
this.curlyBlock(["export", "interface", name, extendsClause], () => {
|
|
5642
|
+
if (!schema.fields) {
|
|
5643
|
+
return;
|
|
5644
|
+
}
|
|
5645
|
+
if (schema.identifier.kind === "resource") {
|
|
5646
|
+
const possibleResourceTypes = [schema.identifier];
|
|
5647
|
+
possibleResourceTypes.push(...resourceChildren(this.resourceRelatives, schema.identifier));
|
|
5648
|
+
this.lineSM(`resourceType: ${possibleResourceTypes.map((e) => `'${e.name}'`).join(" | ")}`);
|
|
5649
|
+
this.line();
|
|
5650
|
+
}
|
|
5651
|
+
const fields = Object.entries(schema.fields).sort((a, b) => a[0].localeCompare(b[0]));
|
|
5652
|
+
for (const [fieldName, anyField] of fields) {
|
|
5653
|
+
const field = notChoiceDeclaration(anyField);
|
|
5654
|
+
if (field === void 0) continue;
|
|
5655
|
+
this.debugComment(fieldName, ":", field);
|
|
5656
|
+
const fieldNameFixed = normalizeName(fieldName);
|
|
5657
|
+
const optionalSymbol = field.required ? "" : "?";
|
|
5658
|
+
const arraySymbol = field.array ? "[]" : "";
|
|
5659
|
+
if (field.type === void 0) {
|
|
5660
|
+
continue;
|
|
5661
|
+
}
|
|
5662
|
+
let type = field.type.name;
|
|
5663
|
+
if (field.type.kind === "nested") {
|
|
5664
|
+
type = deriveNestedSchemaName(field.type.url);
|
|
5665
|
+
}
|
|
5666
|
+
if (field.type.kind === "primitive-type") {
|
|
5667
|
+
type = primitiveType2tsType[field.type.name] ?? "string";
|
|
5668
|
+
}
|
|
5669
|
+
if (schema.identifier.name === "Reference" && fieldNameFixed === "reference") {
|
|
5670
|
+
type = "`${T}/${string}`";
|
|
5671
|
+
}
|
|
5672
|
+
if (field.reference?.length) {
|
|
5673
|
+
const references = field.reference.map((ref) => `'${ref.name}'`).join(" | ");
|
|
5674
|
+
type = `Reference<${references}>`;
|
|
5675
|
+
}
|
|
5676
|
+
if (field.enum) {
|
|
5677
|
+
type = field.enum.map((e) => `'${e}'`).join(" | ");
|
|
5678
|
+
}
|
|
5679
|
+
this.lineSM(`${fieldNameFixed}${optionalSymbol}:`, `${type}${arraySymbol}`);
|
|
5680
|
+
if (["resource", "complex-type"].includes(schema.identifier.kind)) {
|
|
5681
|
+
this.addFieldExtension(fieldName, field);
|
|
5682
|
+
}
|
|
5683
|
+
}
|
|
5684
|
+
});
|
|
5685
|
+
this.line();
|
|
5686
|
+
}
|
|
5687
|
+
generateNestedTypes(schema) {
|
|
5688
|
+
if (schema.nested) {
|
|
5689
|
+
this.line();
|
|
5690
|
+
for (const subtype of schema.nested) {
|
|
5691
|
+
this.generateType(subtype);
|
|
5692
|
+
}
|
|
5693
|
+
}
|
|
5694
|
+
}
|
|
5695
|
+
generateResourceModule(schema) {
|
|
5696
|
+
this.cat(`${tsFileName(schema.identifier)}`, () => {
|
|
5697
|
+
this.generateDisclaimer();
|
|
5698
|
+
if (["complex-type", "resource", "logical", "nested"].includes(schema.identifier.kind)) {
|
|
5699
|
+
this.generateDependenciesImports(schema);
|
|
5700
|
+
this.line();
|
|
5701
|
+
this.generateNestedTypes(schema);
|
|
5702
|
+
this.generateType(schema);
|
|
5703
|
+
} else {
|
|
5704
|
+
throw new Error(`Profile generation not implemented for kind: ${schema.identifier.kind}`);
|
|
5705
|
+
}
|
|
5706
|
+
});
|
|
5707
|
+
}
|
|
5264
5708
|
generate(schemas) {
|
|
5709
|
+
this.resourceRelatives = resourceRelatives(schemas);
|
|
5265
5710
|
const typesToGenerate = [
|
|
5266
5711
|
...collectComplexTypes(schemas),
|
|
5267
5712
|
...collectResources(schemas)
|
|
@@ -5273,7 +5718,10 @@ var TypeScript = class extends Writer {
|
|
|
5273
5718
|
for (const [packageName, packageSchemas] of Object.entries(grouped)) {
|
|
5274
5719
|
const tsPackageName = kebabCase(packageName);
|
|
5275
5720
|
this.cd(tsPackageName, () => {
|
|
5276
|
-
|
|
5721
|
+
for (const schema of packageSchemas) {
|
|
5722
|
+
this.generateResourceModule(schema);
|
|
5723
|
+
}
|
|
5724
|
+
this.generateFhirPackageIndexFile(packageSchemas);
|
|
5277
5725
|
});
|
|
5278
5726
|
}
|
|
5279
5727
|
});
|
|
@@ -5383,7 +5831,7 @@ var APIBuilder = class {
|
|
|
5383
5831
|
const writerOpts = {
|
|
5384
5832
|
outputDir: Path2.join(this.options.outputDir, "/types"),
|
|
5385
5833
|
tabSize: 2,
|
|
5386
|
-
withDebugComment:
|
|
5834
|
+
withDebugComment: false,
|
|
5387
5835
|
commentLinePrefix: "//"
|
|
5388
5836
|
};
|
|
5389
5837
|
const effectiveOpts = { logger: this.logger, ...writerOpts, ...opts };
|
|
@@ -5440,7 +5888,7 @@ var APIBuilder = class {
|
|
|
5440
5888
|
});
|
|
5441
5889
|
await manager.init();
|
|
5442
5890
|
const register = await registerFromManager(manager, this.logger);
|
|
5443
|
-
const typeSchemas = await generateTypeSchemas(register);
|
|
5891
|
+
const typeSchemas = await generateTypeSchemas(register, this.logger);
|
|
5444
5892
|
this.logger.debug(`Executing ${this.generators.size} generators`);
|
|
5445
5893
|
await this.executeGenerators(result, typeSchemas);
|
|
5446
5894
|
this.logger.info("Generation completed successfully");
|