@atomic-ehr/codegen 0.0.1-canary.20250830224431.6d211a5 → 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.
@@ -35,7 +35,6 @@ export async function promptInitConfig() {
35
35
  choices: [
36
36
  { name: "TypeScript", value: "typescript", checked: true },
37
37
  { name: "Python", value: "python" },
38
- { name: "REST Client", value: "rest-client" },
39
38
  ],
40
39
  });
41
40
  const packageManager = (await select({
@@ -154,27 +153,6 @@ export async function promptGeneratorConfig(generatorId) {
154
153
  default: true,
155
154
  });
156
155
  break;
157
- case "rest-client":
158
- config.httpClient = await select({
159
- message: "HTTP client library:",
160
- choices: [
161
- { name: "Fetch (native)", value: "fetch" },
162
- { name: "Axios", value: "axios" },
163
- { name: "Node fetch", value: "node-fetch" },
164
- ],
165
- default: "fetch",
166
- });
167
- config.authentication = await select({
168
- message: "Authentication type:",
169
- choices: [
170
- { name: "None", value: "none" },
171
- { name: "Bearer token", value: "bearer" },
172
- { name: "Basic auth", value: "basic" },
173
- { name: "OAuth2", value: "oauth2" },
174
- ],
175
- default: "none",
176
- });
177
- break;
178
156
  }
179
157
  return config;
180
158
  }
package/dist/config.d.ts CHANGED
@@ -4,43 +4,6 @@
4
4
  * Simple configuration system compatible ONLY with the new high-level APIBuilder.
5
5
  * All legacy config functionality has been removed.
6
6
  */
7
- /**
8
- * REST Client generator configuration options
9
- */
10
- export interface RestClientConfig {
11
- /** Name of the generated client class */
12
- clientName?: string;
13
- /** Include client-side resource validation */
14
- includeValidation?: boolean;
15
- /** Include enhanced error handling */
16
- includeErrorHandling?: boolean;
17
- /** Include request interceptors */
18
- includeRequestInterceptors?: boolean;
19
- /** Override base URL in client (for testing) */
20
- baseUrlOverride?: string;
21
- /** Generate enhanced search parameter types */
22
- enhancedSearch?: boolean;
23
- /** Enable chained search builder generation with fluent API */
24
- chainedSearchBuilder?: boolean;
25
- /** Enable IDE autocomplete for search params via string literal unions */
26
- searchAutocomplete?: boolean;
27
- /** Generate enums (string literal unions) from bound ValueSets when possible */
28
- generateValueSetEnums?: boolean;
29
- /** Generate utility methods */
30
- includeUtilities?: boolean;
31
- /** Generate resource validators */
32
- generateValidators?: boolean;
33
- /** Use FHIR canonical manager for search parameters */
34
- useCanonicalManager?: boolean;
35
- /** Timeout for HTTP requests */
36
- defaultTimeout?: number;
37
- /** Default retry count */
38
- defaultRetries?: number;
39
- /** Include documentation in generated client */
40
- includeDocumentation?: boolean;
41
- /** Generate examples and usage patterns */
42
- generateExamples?: boolean;
43
- }
44
7
  /**
45
8
  * TypeScript generator configuration options
46
9
  */
@@ -152,7 +115,6 @@ export interface Config {
152
115
  validate?: boolean;
153
116
  cache?: boolean;
154
117
  typescript?: TypeScriptGeneratorConfig;
155
- restClient?: RestClientConfig;
156
118
  typeSchema?: TypeSchemaConfig;
157
119
  packages?: string[];
158
120
  files?: string[];
@@ -193,7 +155,6 @@ export declare class ConfigValidator {
193
155
  validate(config: unknown): ConfigValidationResult;
194
156
  private validateTypeScriptConfig;
195
157
  private validateValidatorOptions;
196
- private validateRestClientConfig;
197
158
  private validateGuardOptions;
198
159
  private validateProfileOptions;
199
160
  private validateTypeSchemaConfig;
package/dist/config.js CHANGED
@@ -16,24 +16,6 @@ export const DEFAULT_CONFIG = {
16
16
  overwrite: true,
17
17
  validate: true,
18
18
  cache: true,
19
- restClient: {
20
- clientName: "FHIRClient",
21
- includeValidation: false,
22
- includeErrorHandling: true,
23
- includeRequestInterceptors: false,
24
- baseUrlOverride: "",
25
- enhancedSearch: false,
26
- chainedSearchBuilder: false,
27
- searchAutocomplete: true,
28
- generateValueSetEnums: true,
29
- includeUtilities: true,
30
- generateValidators: false,
31
- useCanonicalManager: true,
32
- defaultTimeout: 30000,
33
- defaultRetries: 0,
34
- includeDocumentation: true,
35
- generateExamples: false,
36
- },
37
19
  typescript: {
38
20
  moduleFormat: "esm",
39
21
  generateIndex: true,
@@ -185,11 +167,6 @@ export class ConfigValidator {
185
167
  const tsErrors = this.validateTypeSchemaConfig(cfg.typeSchema);
186
168
  result.errors.push(...tsErrors);
187
169
  }
188
- // Validate restClient config
189
- if (cfg.restClient !== undefined) {
190
- const rcErrors = this.validateRestClientConfig(cfg.restClient);
191
- result.errors.push(...rcErrors);
192
- }
193
170
  // Validate packages array
194
171
  if (cfg.packages !== undefined) {
195
172
  if (!Array.isArray(cfg.packages)) {
@@ -345,80 +322,6 @@ export class ConfigValidator {
345
322
  }
346
323
  return errors;
347
324
  }
348
- validateRestClientConfig(config) {
349
- const errors = [];
350
- if (typeof config !== "object" || config === null) {
351
- errors.push({
352
- path: "restClient",
353
- message: "restClient config must be an object",
354
- value: config,
355
- });
356
- return errors;
357
- }
358
- const cfg = config;
359
- // Validate clientName
360
- if (cfg.clientName !== undefined && typeof cfg.clientName !== "string") {
361
- errors.push({
362
- path: "restClient.clientName",
363
- message: "clientName must be a string",
364
- value: cfg.clientName,
365
- });
366
- }
367
- // Validate baseUrlOverride
368
- if (cfg.baseUrlOverride !== undefined &&
369
- typeof cfg.baseUrlOverride !== "string") {
370
- errors.push({
371
- path: "restClient.baseUrlOverride",
372
- message: "baseUrlOverride must be a string",
373
- value: cfg.baseUrlOverride,
374
- });
375
- }
376
- // Validate timeout
377
- if (cfg.defaultTimeout !== undefined) {
378
- if (typeof cfg.defaultTimeout !== "number" || cfg.defaultTimeout <= 0) {
379
- errors.push({
380
- path: "restClient.defaultTimeout",
381
- message: "defaultTimeout must be a positive number",
382
- value: cfg.defaultTimeout,
383
- });
384
- }
385
- }
386
- // Validate retries
387
- if (cfg.defaultRetries !== undefined) {
388
- if (typeof cfg.defaultRetries !== "number" || cfg.defaultRetries < 0) {
389
- errors.push({
390
- path: "restClient.defaultRetries",
391
- message: "defaultRetries must be a non-negative number",
392
- value: cfg.defaultRetries,
393
- });
394
- }
395
- }
396
- // Validate boolean fields
397
- const booleanFields = [
398
- "includeValidation",
399
- "includeErrorHandling",
400
- "includeRequestInterceptors",
401
- "enhancedSearch",
402
- "chainedSearchBuilder",
403
- "searchAutocomplete",
404
- "generateValueSetEnums",
405
- "includeUtilities",
406
- "generateValidators",
407
- "useCanonicalManager",
408
- "includeDocumentation",
409
- "generateExamples",
410
- ];
411
- for (const field of booleanFields) {
412
- if (cfg[field] !== undefined && typeof cfg[field] !== "boolean") {
413
- errors.push({
414
- path: `restClient.${field}`,
415
- message: `${field} must be a boolean`,
416
- value: cfg[field],
417
- });
418
- }
419
- }
420
- return errors;
421
- }
422
325
  validateGuardOptions(config) {
423
326
  const errors = [];
424
327
  if (typeof config !== "object" || config === null) {
@@ -653,17 +556,6 @@ export class ConfigLoader {
653
556
  ...userConfig.typescript,
654
557
  },
655
558
  };
656
- // Only include restClient if it was explicitly defined in user config
657
- if (userConfig.restClient !== undefined) {
658
- merged.restClient = {
659
- ...DEFAULT_CONFIG.restClient,
660
- ...userConfig.restClient,
661
- };
662
- }
663
- else {
664
- // Remove restClient from merged config if not defined in user config
665
- delete merged.restClient;
666
- }
667
559
  return merged;
668
560
  }
669
561
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@atomic-ehr/codegen",
3
- "version": "0.0.1-canary.20250830224431.6d211a5",
3
+ "version": "0.0.1-canary.20250831211734.bb1536b",
4
4
  "description": "Code generation tools for FHIR resources and TypeSchema definitions",
5
5
  "keywords": [
6
6
  "fhir",
@@ -1,117 +0,0 @@
1
- /**
2
- * REST Client Generator
3
- *
4
- * Generates a fetch-based FHIR REST client with TypeScript autocompletion
5
- * and type safety for all FHIR resources.
6
- */
7
- import type { RestClientConfig } from "../../config.js";
8
- import type { TypeSchema } from "../../typeschema/type-schema.types";
9
- import type { CodegenLogger } from "../../utils/codegen-logger.js";
10
- /**
11
- * Options for the REST Client generator
12
- * Extends RestClientConfig with outputDir
13
- */
14
- export interface RestClientOptions extends RestClientConfig {
15
- outputDir: string;
16
- logger?: CodegenLogger;
17
- }
18
- /**
19
- * Generated file result
20
- */
21
- export interface GeneratedRestClient {
22
- path: string;
23
- filename: string;
24
- content: string;
25
- exports: string[];
26
- }
27
- /**
28
- * REST Client Generator
29
- *
30
- * Generates a type-safe FHIR REST client with autocompletion for all
31
- * available resource types.
32
- */
33
- export declare class RestClientGenerator {
34
- private options;
35
- private resourceTypes;
36
- private searchParameterEnhancer;
37
- private validationGenerator;
38
- private logger;
39
- constructor(options: RestClientOptions);
40
- /**
41
- * Collect resource types from schemas
42
- */
43
- private collectResourceTypes;
44
- /**
45
- * Generate the REST client from TypeSchema documents
46
- */
47
- generate(schemas: TypeSchema[]): Promise<GeneratedRestClient[]>;
48
- /**
49
- * Generate the main client file
50
- */
51
- private generateClientFile;
52
- /**
53
- * Generate the types file
54
- */
55
- private generateTypesFile;
56
- /**
57
- * Generate error handling code
58
- */
59
- private generateErrorHandling;
60
- /**
61
- * Generate error handling methods
62
- */
63
- private generateErrorHandlingMethods;
64
- /**
65
- * Set output directory
66
- */
67
- setOutputDir(directory: string): void;
68
- /**
69
- * Update generator options
70
- */
71
- setOptions(options: Partial<RestClientOptions>): void;
72
- /**
73
- * Get current options
74
- */
75
- getOptions(): RestClientOptions;
76
- /**
77
- * Generate enhanced search parameters file
78
- */
79
- private generateEnhancedSearchParamsFile;
80
- /**
81
- * Generate validation configuration fields
82
- */
83
- private generateValidationConfigFields;
84
- /**
85
- * Generate validation types file
86
- */
87
- private generateValidationTypesFile;
88
- /**
89
- * Generate resource validators file
90
- */
91
- private generateValidatorsFile;
92
- /**
93
- * Generate CRUD methods with conditional validation support
94
- */
95
- private generateCRUDMethods;
96
- /**
97
- * Generate validation code for CRUD operations
98
- */
99
- private generateValidationCode;
100
- /**
101
- * Generate the search method with conditional enhanced search support
102
- */
103
- private generateSearchMethod;
104
- /**
105
- * Generate validation methods for the client
106
- */
107
- private generateValidationMethods;
108
- /**
109
- * Generate search parameter handling code based on configuration
110
- */
111
- private generateSearchParameterHandlingCode;
112
- /**
113
- * Generate utility file with ResourceTypeMap
114
- */
115
- private generateUtilityFile;
116
- private ensureDirectoryExists;
117
- }