@atomic-ehr/codegen 0.0.1-canary.20250830233015.ec9aae7 → 0.0.1-canary.20250831211734.bb1536b
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/builder.d.ts +1 -9
- package/dist/api/builder.js +1 -41
- package/dist/api/index.d.ts +0 -2
- package/dist/api/index.js +0 -1
- package/dist/cli/commands/generate.js +2 -12
- package/dist/cli/index.js +57 -1217
- package/dist/cli/utils/prompts.js +0 -22
- package/dist/config.d.ts +0 -39
- package/dist/config.js +0 -108
- package/package.json +1 -1
- package/dist/api/generators/rest-client.d.ts +0 -117
- package/dist/api/generators/rest-client.js +0 -847
- package/dist/api/generators/search-parameter-enhancer.d.ts +0 -185
- package/dist/api/generators/search-parameter-enhancer.js +0 -801
- package/dist/api/generators/validation-generator.d.ts +0 -126
- package/dist/api/generators/validation-generator.js +0 -632
package/dist/api/builder.d.ts
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Provides a fluent, chainable API for common codegen use cases with pre-built generators.
|
|
5
5
|
* This builder pattern allows users to configure generation in a declarative way.
|
|
6
6
|
*/
|
|
7
|
-
import type { Config,
|
|
7
|
+
import type { Config, TypeSchemaConfig } from "../config.js";
|
|
8
8
|
import type { TypeSchema } from "../typeschema/type-schema.types.js";
|
|
9
9
|
import type { CodegenLogger } from "../utils/codegen-logger.js";
|
|
10
10
|
/**
|
|
@@ -79,10 +79,6 @@ export declare class APIBuilder {
|
|
|
79
79
|
valueSetMode?: 'all' | 'required-only' | 'custom';
|
|
80
80
|
valueSetDirectory?: string;
|
|
81
81
|
}): APIBuilder;
|
|
82
|
-
/**
|
|
83
|
-
* Configure REST client generation
|
|
84
|
-
*/
|
|
85
|
-
restClient(options?: RestClientConfig): APIBuilder;
|
|
86
82
|
/**
|
|
87
83
|
* Set a progress callback for monitoring generation
|
|
88
84
|
*/
|
|
@@ -99,10 +95,6 @@ export declare class APIBuilder {
|
|
|
99
95
|
* Enable/disable validation
|
|
100
96
|
*/
|
|
101
97
|
validate(enabled?: boolean): APIBuilder;
|
|
102
|
-
/**
|
|
103
|
-
* Ensure TypeScript generator is configured if REST client is configured
|
|
104
|
-
*/
|
|
105
|
-
private ensureTypeScriptForRestClient;
|
|
106
98
|
/**
|
|
107
99
|
* Execute the generation process
|
|
108
100
|
*/
|
package/dist/api/builder.js
CHANGED
|
@@ -6,7 +6,6 @@
|
|
|
6
6
|
*/
|
|
7
7
|
import { TypeSchemaCache, TypeSchemaGenerator, TypeSchemaParser, } from "../typeschema/index.js";
|
|
8
8
|
import { createLogger } from "../utils/codegen-logger.js";
|
|
9
|
-
import { RestClientGenerator } from "./generators/rest-client.js";
|
|
10
9
|
import { TypeScriptGenerator } from "./generators/typescript.js";
|
|
11
10
|
/**
|
|
12
11
|
* High-Level API Builder class
|
|
@@ -99,21 +98,6 @@ export class APIBuilder {
|
|
|
99
98
|
this.logger.debug(`Configured TypeScript generator (${options.moduleFormat || "esm"})`);
|
|
100
99
|
return this;
|
|
101
100
|
}
|
|
102
|
-
/**
|
|
103
|
-
* Configure REST client generation
|
|
104
|
-
*/
|
|
105
|
-
restClient(options = {}) {
|
|
106
|
-
// REST client goes in client subfolder
|
|
107
|
-
const clientOutputDir = `${this.options.outputDir}/client`;
|
|
108
|
-
const generator = new RestClientGenerator({
|
|
109
|
-
outputDir: clientOutputDir,
|
|
110
|
-
logger: this.logger.child("REST"),
|
|
111
|
-
...options, // Pass all RestClientConfig options
|
|
112
|
-
});
|
|
113
|
-
this.generators.set("restclient", generator);
|
|
114
|
-
this.logger.debug(`Configured REST client generator (${options.clientName || "FHIRClient"})`);
|
|
115
|
-
return this;
|
|
116
|
-
}
|
|
117
101
|
/**
|
|
118
102
|
* Set a progress callback for monitoring generation
|
|
119
103
|
*/
|
|
@@ -149,29 +133,10 @@ export class APIBuilder {
|
|
|
149
133
|
this.options.validate = enabled;
|
|
150
134
|
return this;
|
|
151
135
|
}
|
|
152
|
-
/**
|
|
153
|
-
* Ensure TypeScript generator is configured if REST client is configured
|
|
154
|
-
*/
|
|
155
|
-
ensureTypeScriptForRestClient() {
|
|
156
|
-
const hasRestClient = this.generators.has("restclient");
|
|
157
|
-
const hasTypeScript = this.generators.has("typescript");
|
|
158
|
-
if (hasRestClient && !hasTypeScript) {
|
|
159
|
-
this.logger.debug("Automatically adding TypeScript generator for REST client");
|
|
160
|
-
// Add TypeScript generator with minimal config
|
|
161
|
-
this.typescript({
|
|
162
|
-
moduleFormat: "esm",
|
|
163
|
-
generateIndex: true,
|
|
164
|
-
includeDocuments: false,
|
|
165
|
-
namingConvention: "PascalCase",
|
|
166
|
-
});
|
|
167
|
-
}
|
|
168
|
-
}
|
|
169
136
|
/**
|
|
170
137
|
* Execute the generation process
|
|
171
138
|
*/
|
|
172
139
|
async generate() {
|
|
173
|
-
// Ensure TypeScript is configured if REST client is configured
|
|
174
|
-
this.ensureTypeScriptForRestClient();
|
|
175
140
|
const startTime = performance.now();
|
|
176
141
|
const result = {
|
|
177
142
|
success: false,
|
|
@@ -253,7 +218,7 @@ export class APIBuilder {
|
|
|
253
218
|
logger: this.logger.child("Schema"),
|
|
254
219
|
treeshake: this.typeSchemaConfig?.treeshake,
|
|
255
220
|
}, this.typeSchemaConfig);
|
|
256
|
-
this.typeSchemaGenerator = generator;
|
|
221
|
+
this.typeSchemaGenerator = generator;
|
|
257
222
|
const schemas = await generator.generateFromPackage(packageName, version);
|
|
258
223
|
this.schemas = [...this.schemas, ...schemas];
|
|
259
224
|
if (this.cache) {
|
|
@@ -344,11 +309,6 @@ export function createAPIFromConfig(config) {
|
|
|
344
309
|
if (config.typescript) {
|
|
345
310
|
builder.typescript(config.typescript);
|
|
346
311
|
}
|
|
347
|
-
// Configure REST client generator if specified
|
|
348
|
-
if (config.restClient) {
|
|
349
|
-
console.log("fsdfdsfsdfdsf");
|
|
350
|
-
builder.restClient(config.restClient);
|
|
351
|
-
}
|
|
352
312
|
return builder;
|
|
353
313
|
}
|
|
354
314
|
/**
|
package/dist/api/index.d.ts
CHANGED
|
@@ -12,8 +12,6 @@ export type { PackageInfo } from "../typeschema/types.js";
|
|
|
12
12
|
export type { APIBuilderOptions, GenerationResult, ProgressCallback, } from "./builder.js";
|
|
13
13
|
export { APIBuilder, createAPI, createAPIFromConfig, generateTypesFromFiles, generateTypesFromPackage, } from "./builder.js";
|
|
14
14
|
export type { GeneratedFile } from "./generators/base/index.js";
|
|
15
|
-
export type { GeneratedRestClient, RestClientOptions, } from "./generators/rest-client.js";
|
|
16
|
-
export { RestClientGenerator } from "./generators/rest-client.js";
|
|
17
15
|
export type { TypeScriptGeneratorOptions } from "./generators/typescript.js";
|
|
18
16
|
export { TypeScriptGenerator } from "./generators/typescript.js";
|
|
19
17
|
/**
|
package/dist/api/index.js
CHANGED
|
@@ -10,7 +10,6 @@
|
|
|
10
10
|
export { TypeSchemaCache, TypeSchemaGenerator, TypeSchemaParser, } from "../typeschema/index.js";
|
|
11
11
|
// Export main API builder and utilities
|
|
12
12
|
export { APIBuilder, createAPI, createAPIFromConfig, generateTypesFromFiles, generateTypesFromPackage, } from "./builder.js";
|
|
13
|
-
export { RestClientGenerator } from "./generators/rest-client.js";
|
|
14
13
|
// Export generator classes for advanced usage
|
|
15
14
|
export { TypeScriptGenerator } from "./generators/typescript.js";
|
|
16
15
|
/**
|
|
@@ -67,7 +67,6 @@ export const generateCommand = {
|
|
|
67
67
|
logger.info(`Packages: ${config.packages?.length || 0}`);
|
|
68
68
|
logger.info(`Files: ${config.files?.length || 0}`);
|
|
69
69
|
logger.info(`TypeScript generation: ${config.typescript ? "enabled" : "disabled"}`);
|
|
70
|
-
logger.info(`REST Client generation: ${config.restClient ? "enabled" : "disabled"}`);
|
|
71
70
|
}
|
|
72
71
|
// Create API builder with config options
|
|
73
72
|
const builder = new APIBuilder({
|
|
@@ -109,18 +108,9 @@ export const generateCommand = {
|
|
|
109
108
|
}
|
|
110
109
|
builder.typescript(config.typescript);
|
|
111
110
|
}
|
|
112
|
-
if (config.restClient) {
|
|
113
|
-
if (verbose) {
|
|
114
|
-
logger.info("Configuring REST Client generation from config");
|
|
115
|
-
logger.debug(`Client name: ${config.restClient.clientName || "FHIRClient"}`);
|
|
116
|
-
logger.debug(`Include validation: ${config.restClient.includeValidation ?? false}`);
|
|
117
|
-
logger.debug(`Enhanced search: ${config.restClient.enhancedSearch ?? false}`);
|
|
118
|
-
}
|
|
119
|
-
builder.restClient(config.restClient);
|
|
120
|
-
}
|
|
121
111
|
// Check that at least one generator is configured
|
|
122
|
-
if (!config.typescript
|
|
123
|
-
throw new Error("No generators configured. Please enable 'typescript'
|
|
112
|
+
if (!config.typescript) {
|
|
113
|
+
throw new Error("No generators configured. Please enable 'typescript' in your config file.");
|
|
124
114
|
}
|
|
125
115
|
// Add progress callback if verbose
|
|
126
116
|
if (verbose) {
|