@honestjs/rpc-plugin 1.4.0 → 1.5.0

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/index.mjs CHANGED
@@ -32,46 +32,9 @@ var BUILTIN_UTILITY_TYPES = /* @__PURE__ */ new Set([
32
32
  var BUILTIN_TYPES = /* @__PURE__ */ new Set(["string", "number", "boolean", "any", "void", "unknown"]);
33
33
  var GENERIC_TYPES = /* @__PURE__ */ new Set(["Array", "Promise", "Partial"]);
34
34
 
35
- // src/utils/hash-utils.ts
36
- import { createHash } from "crypto";
37
- import { existsSync, readFileSync } from "fs";
38
- import { mkdir, writeFile } from "fs/promises";
39
- import path from "path";
40
- var CHECKSUM_FILENAME = ".rpc-checksum";
41
- function computeHash(filePaths) {
42
- const sorted = [...filePaths].sort();
43
- const hasher = createHash("sha256");
44
- hasher.update(`files:${sorted.length}
45
- `);
46
- for (const filePath of sorted) {
47
- hasher.update(readFileSync(filePath, "utf-8"));
48
- hasher.update("\0");
49
- }
50
- return hasher.digest("hex");
51
- }
52
- function readChecksum(outputDir) {
53
- const checksumPath = path.join(outputDir, CHECKSUM_FILENAME);
54
- if (!existsSync(checksumPath)) return null;
55
- try {
56
- const raw = readFileSync(checksumPath, "utf-8");
57
- const data = JSON.parse(raw);
58
- if (typeof data.hash !== "string" || !Array.isArray(data.files)) {
59
- return null;
60
- }
61
- return data;
62
- } catch {
63
- return null;
64
- }
65
- }
66
- async function writeChecksum(outputDir, data) {
67
- await mkdir(outputDir, { recursive: true });
68
- const checksumPath = path.join(outputDir, CHECKSUM_FILENAME);
69
- await writeFile(checksumPath, JSON.stringify(data, null, 2), "utf-8");
70
- }
71
-
72
- // src/services/client-generator.service.ts
35
+ // src/generators/typescript-client.generator.ts
73
36
  import fs from "fs/promises";
74
- import path2 from "path";
37
+ import path from "path";
75
38
 
76
39
  // src/utils/path-utils.ts
77
40
  function buildFullPath(basePath, parameters) {
@@ -121,33 +84,42 @@ function camelCase(str) {
121
84
  return str.charAt(0).toLowerCase() + str.slice(1);
122
85
  }
123
86
 
124
- // src/services/client-generator.service.ts
125
- var ClientGeneratorService = class {
87
+ // src/generators/typescript-client.generator.ts
88
+ var TypeScriptClientGenerator = class {
126
89
  constructor(outputDir) {
127
90
  this.outputDir = outputDir;
128
91
  }
92
+ name = "typescript-client";
93
+ /**
94
+ * Generates the TypeScript RPC client.
95
+ */
96
+ async generate(context) {
97
+ return this.generateClient(context.routes, context.schemas);
98
+ }
129
99
  /**
130
- * Generates the TypeScript RPC client
100
+ * Generates the TypeScript RPC client.
131
101
  */
132
102
  async generateClient(routes, schemas) {
133
103
  await fs.mkdir(this.outputDir, { recursive: true });
134
104
  await this.generateClientFile(routes, schemas);
135
105
  const generatedInfo = {
136
- clientFile: path2.join(this.outputDir, "client.ts"),
106
+ generator: this.name,
107
+ clientFile: path.join(this.outputDir, "client.ts"),
108
+ outputFiles: [path.join(this.outputDir, "client.ts")],
137
109
  generatedAt: (/* @__PURE__ */ new Date()).toISOString()
138
110
  };
139
111
  return generatedInfo;
140
112
  }
141
113
  /**
142
- * Generates the main client file with types included
114
+ * Generates the main client file with types included.
143
115
  */
144
116
  async generateClientFile(routes, schemas) {
145
117
  const clientContent = this.generateClientContent(routes, schemas);
146
- const clientPath = path2.join(this.outputDir, "client.ts");
118
+ const clientPath = path.join(this.outputDir, "client.ts");
147
119
  await fs.writeFile(clientPath, clientContent, "utf-8");
148
120
  }
149
121
  /**
150
- * Generates the client TypeScript content with types included
122
+ * Generates the client TypeScript content with types included.
151
123
  */
152
124
  generateClientContent(routes, schemas) {
153
125
  const controllerGroups = this.groupRoutesByController(routes);
@@ -331,7 +303,7 @@ ${this.generateControllerMethods(controllerGroups)}
331
303
  `;
332
304
  }
333
305
  /**
334
- * Generates controller methods for the client
306
+ * Generates controller methods for the client.
335
307
  */
336
308
  generateControllerMethods(controllerGroups) {
337
309
  let methods = "";
@@ -407,7 +379,7 @@ ${this.generateControllerMethods(controllerGroups)}
407
379
  return methods;
408
380
  }
409
381
  /**
410
- * Extracts the proper return type from route analysis
382
+ * Extracts the proper return type from route analysis.
411
383
  */
412
384
  extractReturnType(returns) {
413
385
  if (!returns) return "any";
@@ -418,7 +390,7 @@ ${this.generateControllerMethods(controllerGroups)}
418
390
  return returns;
419
391
  }
420
392
  /**
421
- * Generates schema types from integrated schema generation
393
+ * Generates schema types from integrated schema generation.
422
394
  */
423
395
  generateSchemaTypes(schemas) {
424
396
  if (schemas.length === 0) {
@@ -435,7 +407,7 @@ ${this.generateControllerMethods(controllerGroups)}
435
407
  return content;
436
408
  }
437
409
  /**
438
- * Groups routes by controller for better organization
410
+ * Groups routes by controller for better organization.
439
411
  */
440
412
  groupRoutesByController(routes) {
441
413
  const groups = /* @__PURE__ */ new Map();
@@ -449,7 +421,7 @@ ${this.generateControllerMethods(controllerGroups)}
449
421
  return groups;
450
422
  }
451
423
  /**
452
- * Analyzes route parameters to determine their types and usage
424
+ * Analyzes route parameters to determine their types and usage.
453
425
  */
454
426
  analyzeRouteParameters(route) {
455
427
  const parameters = route.parameters || [];
@@ -460,6 +432,43 @@ ${this.generateControllerMethods(controllerGroups)}
460
432
  }
461
433
  };
462
434
 
435
+ // src/utils/hash-utils.ts
436
+ import { createHash } from "crypto";
437
+ import { existsSync, readFileSync } from "fs";
438
+ import { mkdir, writeFile } from "fs/promises";
439
+ import path2 from "path";
440
+ var CHECKSUM_FILENAME = ".rpc-checksum";
441
+ function computeHash(filePaths) {
442
+ const sorted = [...filePaths].sort();
443
+ const hasher = createHash("sha256");
444
+ hasher.update(`files:${sorted.length}
445
+ `);
446
+ for (const filePath of sorted) {
447
+ hasher.update(readFileSync(filePath, "utf-8"));
448
+ hasher.update("\0");
449
+ }
450
+ return hasher.digest("hex");
451
+ }
452
+ function readChecksum(outputDir) {
453
+ const checksumPath = path2.join(outputDir, CHECKSUM_FILENAME);
454
+ if (!existsSync(checksumPath)) return null;
455
+ try {
456
+ const raw = readFileSync(checksumPath, "utf-8");
457
+ const data = JSON.parse(raw);
458
+ if (typeof data.hash !== "string" || !Array.isArray(data.files)) {
459
+ return null;
460
+ }
461
+ return data;
462
+ } catch {
463
+ return null;
464
+ }
465
+ }
466
+ async function writeChecksum(outputDir, data) {
467
+ await mkdir(outputDir, { recursive: true });
468
+ const checksumPath = path2.join(outputDir, CHECKSUM_FILENAME);
469
+ await writeFile(checksumPath, JSON.stringify(data, null, 2), "utf-8");
470
+ }
471
+
463
472
  // src/services/route-analyzer.service.ts
464
473
  import { RouteRegistry } from "honestjs";
465
474
  var RouteAnalyzerService = class {
@@ -536,7 +545,7 @@ var RouteAnalyzerService = class {
536
545
  version: route.version,
537
546
  route: route.route,
538
547
  path: route.path,
539
- fullPath: buildFullPath(route.path, route.parameters),
548
+ fullPath: buildFullApiPath(route),
540
549
  parameters,
541
550
  returns
542
551
  };
@@ -759,13 +768,13 @@ var RPCPlugin = class {
759
768
  // Services
760
769
  routeAnalyzer;
761
770
  schemaGenerator;
762
- clientGenerator;
771
+ generators;
763
772
  // Shared ts-morph project
764
773
  project = null;
765
774
  // Internal state
766
775
  analyzedRoutes = [];
767
776
  analyzedSchemas = [];
768
- generatedInfo = null;
777
+ generatedInfos = [];
769
778
  app = null;
770
779
  constructor(options = {}) {
771
780
  this.controllerPattern = options.controllerPattern ?? DEFAULT_OPTIONS.controllerPattern;
@@ -776,7 +785,7 @@ var RPCPlugin = class {
776
785
  this.contextArtifactKey = options.context?.keys?.artifact ?? DEFAULT_OPTIONS.context.keys.artifact;
777
786
  this.routeAnalyzer = new RouteAnalyzerService();
778
787
  this.schemaGenerator = new SchemaGeneratorService(this.controllerPattern, this.tsConfigPath);
779
- this.clientGenerator = new ClientGeneratorService(this.outputDir);
788
+ this.generators = options.generators ?? [new TypeScriptClientGenerator(this.outputDir)];
780
789
  this.validateConfiguration();
781
790
  }
782
791
  /**
@@ -803,6 +812,14 @@ var RPCPlugin = class {
803
812
  if (!this.contextArtifactKey?.trim()) {
804
813
  errors.push("Context artifact key cannot be empty");
805
814
  }
815
+ for (const generator of this.generators) {
816
+ if (!generator.name?.trim()) {
817
+ errors.push("Generator name cannot be empty");
818
+ }
819
+ if (typeof generator.generate !== "function") {
820
+ errors.push(`Generator "${generator.name || "unknown"}" must implement generate(context)`);
821
+ }
822
+ }
806
823
  if (errors.length > 0) {
807
824
  throw new Error(`Configuration validation failed: ${errors.join(", ")}`);
808
825
  }
@@ -844,10 +861,10 @@ var RPCPlugin = class {
844
861
  }
845
862
  this.analyzedRoutes = [];
846
863
  this.analyzedSchemas = [];
847
- this.generatedInfo = null;
864
+ this.generatedInfos = [];
848
865
  this.analyzedRoutes = await this.routeAnalyzer.analyzeControllerMethods(this.project);
849
866
  this.analyzedSchemas = await this.schemaGenerator.generateSchemas(this.project);
850
- this.generatedInfo = await this.clientGenerator.generateClient(this.analyzedRoutes, this.analyzedSchemas);
867
+ this.generatedInfos = await this.runGenerators();
851
868
  await writeChecksum(this.outputDir, { hash: computeHash(filePaths), files: filePaths });
852
869
  this.writeArtifactToDisk();
853
870
  this.log(
@@ -885,13 +902,25 @@ var RPCPlugin = class {
885
902
  * Get the generation info
886
903
  */
887
904
  getGenerationInfo() {
888
- return this.generatedInfo;
905
+ return this.generatedInfos[0] ?? null;
906
+ }
907
+ /**
908
+ * Get all generation infos
909
+ */
910
+ getGenerationInfos() {
911
+ return this.generatedInfos;
889
912
  }
890
913
  /**
891
914
  * Checks whether expected output files exist on disk
892
915
  */
893
916
  outputFilesExist() {
894
- return fs2.existsSync(path3.join(this.outputDir, "client.ts")) && fs2.existsSync(path3.join(this.outputDir, "rpc-artifact.json"));
917
+ if (!fs2.existsSync(path3.join(this.outputDir, "rpc-artifact.json"))) {
918
+ return false;
919
+ }
920
+ if (!this.hasTypeScriptGenerator()) {
921
+ return true;
922
+ }
923
+ return fs2.existsSync(path3.join(this.outputDir, "client.ts"));
895
924
  }
896
925
  getArtifactPath() {
897
926
  return path3.join(this.outputDir, "rpc-artifact.json");
@@ -913,12 +942,28 @@ var RPCPlugin = class {
913
942
  }
914
943
  this.analyzedRoutes = parsed.routes;
915
944
  this.analyzedSchemas = parsed.schemas;
916
- this.generatedInfo = null;
945
+ this.generatedInfos = [];
917
946
  return true;
918
947
  } catch {
919
948
  return false;
920
949
  }
921
950
  }
951
+ async runGenerators() {
952
+ const results = [];
953
+ for (const generator of this.generators) {
954
+ this.log(`Running generator: ${generator.name}`);
955
+ const result = await generator.generate({
956
+ outputDir: this.outputDir,
957
+ routes: this.analyzedRoutes,
958
+ schemas: this.analyzedSchemas
959
+ });
960
+ results.push(result);
961
+ }
962
+ return results;
963
+ }
964
+ hasTypeScriptGenerator() {
965
+ return this.generators.some((generator) => generator.name === "typescript-client");
966
+ }
922
967
  publishArtifact(app) {
923
968
  app.getContext().set(this.getArtifactContextKey(), {
924
969
  routes: this.analyzedRoutes,
@@ -956,13 +1001,13 @@ var RPCPlugin = class {
956
1001
  export {
957
1002
  BUILTIN_TYPES,
958
1003
  BUILTIN_UTILITY_TYPES,
959
- ClientGeneratorService,
960
1004
  DEFAULT_OPTIONS,
961
1005
  GENERIC_TYPES,
962
1006
  LOG_PREFIX,
963
1007
  RPCPlugin,
964
1008
  RouteAnalyzerService,
965
1009
  SchemaGeneratorService,
1010
+ TypeScriptClientGenerator,
966
1011
  buildFullApiPath,
967
1012
  buildFullPath,
968
1013
  camelCase,
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/rpc.plugin.ts","../src/constants/defaults.ts","../src/utils/hash-utils.ts","../src/services/client-generator.service.ts","../src/utils/path-utils.ts","../src/utils/string-utils.ts","../src/services/route-analyzer.service.ts","../src/services/schema-generator.service.ts","../src/utils/schema-utils.ts","../src/utils/type-utils.ts"],"sourcesContent":["import fs from 'fs'\nimport type { Application, IPlugin } from 'honestjs'\nimport type { Hono } from 'hono'\nimport path from 'path'\nimport { Project } from 'ts-morph'\n\nimport { DEFAULT_OPTIONS, LOG_PREFIX } from './constants/defaults'\nimport { computeHash, readChecksum, writeChecksum } from './utils/hash-utils'\nimport { ClientGeneratorService } from './services/client-generator.service'\nimport { RouteAnalyzerService } from './services/route-analyzer.service'\nimport { SchemaGeneratorService } from './services/schema-generator.service'\nimport type { ExtendedRouteInfo, GeneratedClientInfo, SchemaInfo } from './types'\n\n/**\n * Configuration options for the RPCPlugin\n */\nexport interface RPCPluginOptions {\n\treadonly controllerPattern?: string\n\treadonly tsConfigPath?: string\n\treadonly outputDir?: string\n\treadonly generateOnInit?: boolean\n\treadonly context?: {\n\t\treadonly namespace?: string\n\t\treadonly keys?: {\n\t\t\treadonly artifact?: string\n\t\t}\n\t}\n}\n\n/**\n * Comprehensive RPC plugin that combines route analysis, schema generation, and client generation\n */\nexport class RPCPlugin implements IPlugin {\n\tprivate readonly controllerPattern: string\n\tprivate readonly tsConfigPath: string\n\tprivate readonly outputDir: string\n\tprivate readonly generateOnInit: boolean\n\tprivate readonly contextNamespace: string\n\tprivate readonly contextArtifactKey: string\n\n\t// Services\n\tprivate readonly routeAnalyzer: RouteAnalyzerService\n\tprivate readonly schemaGenerator: SchemaGeneratorService\n\tprivate readonly clientGenerator: ClientGeneratorService\n\n\t// Shared ts-morph project\n\tprivate project: Project | null = null\n\n\t// Internal state\n\tprivate analyzedRoutes: ExtendedRouteInfo[] = []\n\tprivate analyzedSchemas: SchemaInfo[] = []\n\tprivate generatedInfo: GeneratedClientInfo | null = null\n\tprivate app: Application | null = null\n\n\tconstructor(options: RPCPluginOptions = {}) {\n\t\tthis.controllerPattern = options.controllerPattern ?? DEFAULT_OPTIONS.controllerPattern\n\t\tthis.tsConfigPath = options.tsConfigPath ?? path.resolve(process.cwd(), DEFAULT_OPTIONS.tsConfigPath)\n\t\tthis.outputDir = options.outputDir ?? path.resolve(process.cwd(), DEFAULT_OPTIONS.outputDir)\n\t\tthis.generateOnInit = options.generateOnInit ?? DEFAULT_OPTIONS.generateOnInit\n\t\tthis.contextNamespace = options.context?.namespace ?? DEFAULT_OPTIONS.context.namespace\n\t\tthis.contextArtifactKey = options.context?.keys?.artifact ?? DEFAULT_OPTIONS.context.keys.artifact\n\n\t\t// Initialize services\n\t\tthis.routeAnalyzer = new RouteAnalyzerService()\n\t\tthis.schemaGenerator = new SchemaGeneratorService(this.controllerPattern, this.tsConfigPath)\n\t\tthis.clientGenerator = new ClientGeneratorService(this.outputDir)\n\n\t\tthis.validateConfiguration()\n\t}\n\n\t/**\n\t * Validates the plugin configuration\n\t */\n\tprivate validateConfiguration(): void {\n\t\tconst errors: string[] = []\n\n\t\tif (!this.controllerPattern?.trim()) {\n\t\t\terrors.push('Controller pattern cannot be empty')\n\t\t}\n\n\t\tif (!this.tsConfigPath?.trim()) {\n\t\t\terrors.push('TypeScript config path cannot be empty')\n\t\t} else {\n\t\t\tif (!fs.existsSync(this.tsConfigPath)) {\n\t\t\t\terrors.push(`TypeScript config file not found at: ${this.tsConfigPath}`)\n\t\t\t}\n\t\t}\n\n\t\tif (!this.outputDir?.trim()) {\n\t\t\terrors.push('Output directory cannot be empty')\n\t\t}\n\t\tif (!this.contextNamespace?.trim()) {\n\t\t\terrors.push('Context namespace cannot be empty')\n\t\t}\n\t\tif (!this.contextArtifactKey?.trim()) {\n\t\t\terrors.push('Context artifact key cannot be empty')\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\tthrow new Error(`Configuration validation failed: ${errors.join(', ')}`)\n\t\t}\n\n\t\tthis.log(\n\t\t\t`Configuration validated: controllerPattern=${this.controllerPattern}, tsConfigPath=${this.tsConfigPath}, outputDir=${this.outputDir}`\n\t\t)\n\t}\n\n\t/**\n\t * Called after all modules are registered\n\t */\n\tafterModulesRegistered = async (app: Application, hono: Hono): Promise<void> => {\n\t\tthis.app = app\n\t\tif (this.generateOnInit) {\n\t\t\tawait this.analyzeEverything()\n\t\t\tthis.publishArtifact(app)\n\t\t}\n\t}\n\n\t/**\n\t * Main analysis method that coordinates all three components\n\t */\n\tprivate async analyzeEverything(force = false): Promise<void> {\n\t\ttry {\n\t\t\tthis.log('Starting comprehensive RPC analysis...')\n\n\t\t\t// Create a single shared ts-morph project for both services\n\t\t\tthis.dispose()\n\t\t\tthis.project = new Project({ tsConfigFilePath: this.tsConfigPath })\n\t\t\tthis.project.addSourceFilesAtPaths([this.controllerPattern])\n\n\t\t\t// Hash check: skip if controller files are unchanged since last generation\n\t\t\tconst filePaths = this.project.getSourceFiles().map((f) => f.getFilePath())\n\n\t\t\tif (!force) {\n\t\t\t\tconst currentHash = computeHash(filePaths)\n\t\t\t\tconst stored = readChecksum(this.outputDir)\n\n\t\t\t\tif (stored && stored.hash === currentHash && this.outputFilesExist()) {\n\t\t\t\t\tif (this.loadArtifactFromDisk()) {\n\t\t\t\t\t\tthis.log('Source files unchanged — skipping regeneration')\n\t\t\t\t\t\tthis.dispose()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthis.log('Source files unchanged but cached artifact missing/invalid — regenerating')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Clear previous analysis results to prevent stale state across runs\n\t\t\tthis.analyzedRoutes = []\n\t\t\tthis.analyzedSchemas = []\n\t\t\tthis.generatedInfo = null\n\n\t\t\t// Step 1: Analyze routes and extract type information\n\t\t\tthis.analyzedRoutes = await this.routeAnalyzer.analyzeControllerMethods(this.project)\n\n\t\t\t// Step 2: Generate schemas from the types we found\n\t\t\tthis.analyzedSchemas = await this.schemaGenerator.generateSchemas(this.project)\n\n\t\t\t// Step 3: Generate the RPC client\n\t\t\tthis.generatedInfo = await this.clientGenerator.generateClient(this.analyzedRoutes, this.analyzedSchemas)\n\n\t\t\t// Write checksum after successful generation\n\t\t\tawait writeChecksum(this.outputDir, { hash: computeHash(filePaths), files: filePaths })\n\t\t\tthis.writeArtifactToDisk()\n\n\t\t\tthis.log(\n\t\t\t\t`✅ RPC analysis complete: ${this.analyzedRoutes.length} routes, ${this.analyzedSchemas.length} schemas`\n\t\t\t)\n\t\t} catch (error) {\n\t\t\tthis.logError('Error during RPC analysis:', error)\n\t\t\tthis.dispose()\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Manually trigger analysis (useful for testing or re-generation).\n\t * Defaults to force=true to bypass cache; pass false to use caching.\n\t */\n\tasync analyze(force = true): Promise<void> {\n\t\tawait this.analyzeEverything(force)\n\t\tif (this.app) {\n\t\t\tthis.publishArtifact(this.app)\n\t\t}\n\t}\n\n\t/**\n\t * Get the analyzed routes\n\t */\n\tgetRoutes(): readonly ExtendedRouteInfo[] {\n\t\treturn this.analyzedRoutes\n\t}\n\n\t/**\n\t * Get the analyzed schemas\n\t */\n\tgetSchemas(): readonly SchemaInfo[] {\n\t\treturn this.analyzedSchemas\n\t}\n\n\t/**\n\t * Get the generation info\n\t */\n\tgetGenerationInfo(): GeneratedClientInfo | null {\n\t\treturn this.generatedInfo\n\t}\n\n\t/**\n\t * Checks whether expected output files exist on disk\n\t */\n\tprivate outputFilesExist(): boolean {\n\t\treturn (\n\t\t\tfs.existsSync(path.join(this.outputDir, 'client.ts')) &&\n\t\t\tfs.existsSync(path.join(this.outputDir, 'rpc-artifact.json'))\n\t\t)\n\t}\n\n\tprivate getArtifactPath(): string {\n\t\treturn path.join(this.outputDir, 'rpc-artifact.json')\n\t}\n\n\tprivate writeArtifactToDisk(): void {\n\t\tconst artifact = {\n\t\t\troutes: this.analyzedRoutes,\n\t\t\tschemas: this.analyzedSchemas\n\t\t}\n\t\tfs.mkdirSync(this.outputDir, { recursive: true })\n\t\tfs.writeFileSync(this.getArtifactPath(), JSON.stringify(artifact))\n\t}\n\n\tprivate loadArtifactFromDisk(): boolean {\n\t\ttry {\n\t\t\tconst raw = fs.readFileSync(this.getArtifactPath(), 'utf8')\n\t\t\tconst parsed = JSON.parse(raw) as {\n\t\t\t\troutes?: unknown\n\t\t\t\tschemas?: unknown\n\t\t\t}\n\t\t\tif (!Array.isArray(parsed.routes) || !Array.isArray(parsed.schemas)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tthis.analyzedRoutes = parsed.routes as ExtendedRouteInfo[]\n\t\t\tthis.analyzedSchemas = parsed.schemas as SchemaInfo[]\n\t\t\tthis.generatedInfo = null\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tprivate publishArtifact(app: Application): void {\n\t\tapp.getContext().set(this.getArtifactContextKey(), {\n\t\t\troutes: this.analyzedRoutes,\n\t\t\tschemas: this.analyzedSchemas\n\t\t})\n\t}\n\n\tprivate getArtifactContextKey(): string {\n\t\treturn `${this.contextNamespace}.${this.contextArtifactKey}`\n\t}\n\n\t/**\n\t * Cleanup resources to prevent memory leaks\n\t */\n\tdispose(): void {\n\t\tif (this.project) {\n\t\t\tthis.project.getSourceFiles().forEach((file) => this.project!.removeSourceFile(file))\n\t\t\tthis.project = null\n\t\t}\n\t}\n\n\t// ============================================================================\n\t// LOGGING UTILITIES\n\t// ============================================================================\n\n\t/**\n\t * Logs a message with the plugin prefix\n\t */\n\tprivate log(message: string): void {\n\t\tconsole.log(`${LOG_PREFIX} ${message}`)\n\t}\n\n\t/**\n\t * Logs an error with the plugin prefix\n\t */\n\tprivate logError(message: string, error?: unknown): void {\n\t\tconsole.error(`${LOG_PREFIX} ${message}`, error || '')\n\t}\n}\n","/**\n * Default configuration options for the RPCPlugin\n */\nexport const DEFAULT_OPTIONS = {\n\tcontrollerPattern: 'src/modules/*/*.controller.ts',\n\ttsConfigPath: 'tsconfig.json',\n\toutputDir: './generated/rpc',\n\tgenerateOnInit: true,\n\tcontext: {\n\t\tnamespace: 'rpc',\n\t\tkeys: {\n\t\t\tartifact: 'artifact'\n\t\t}\n\t}\n} as const\n\n/**\n * Log prefix for the RPC plugin\n */\nexport const LOG_PREFIX = '[ RPCPlugin ]'\n\n/**\n * Built-in TypeScript types that should not be imported\n */\nexport const BUILTIN_UTILITY_TYPES = new Set([\n\t'Partial',\n\t'Required',\n\t'Readonly',\n\t'Pick',\n\t'Omit',\n\t'Record',\n\t'Exclude',\n\t'Extract',\n\t'ReturnType',\n\t'InstanceType'\n])\n\n/**\n * Built-in TypeScript types that should be skipped\n */\nexport const BUILTIN_TYPES = new Set(['string', 'number', 'boolean', 'any', 'void', 'unknown'])\n\n/**\n * Generic type names that should be unwrapped\n */\nexport const GENERIC_TYPES = new Set(['Array', 'Promise', 'Partial'])\n","import { createHash } from 'crypto'\nimport { existsSync, readFileSync } from 'fs'\nimport { mkdir, writeFile } from 'fs/promises'\nimport path from 'path'\n\nconst CHECKSUM_FILENAME = '.rpc-checksum'\n\nexport interface ChecksumData {\n\thash: string\n\tfiles: string[]\n}\n\n/**\n * Computes a deterministic SHA-256 hash from file contents.\n * Sorts paths before reading to ensure consistent ordering.\n * Includes the file count in the hash so adding/removing files changes it.\n */\nexport function computeHash(filePaths: string[]): string {\n\tconst sorted = [...filePaths].sort()\n\tconst hasher = createHash('sha256')\n\n\thasher.update(`files:${sorted.length}\\n`)\n\n\tfor (const filePath of sorted) {\n\t\thasher.update(readFileSync(filePath, 'utf-8'))\n\t\thasher.update('\\0')\n\t}\n\n\treturn hasher.digest('hex')\n}\n\n/**\n * Reads the stored checksum from the output directory.\n * Returns null if the file is missing or corrupt.\n */\nexport function readChecksum(outputDir: string): ChecksumData | null {\n\tconst checksumPath = path.join(outputDir, CHECKSUM_FILENAME)\n\n\tif (!existsSync(checksumPath)) return null\n\n\ttry {\n\t\tconst raw = readFileSync(checksumPath, 'utf-8')\n\t\tconst data = JSON.parse(raw) as ChecksumData\n\n\t\tif (typeof data.hash !== 'string' || !Array.isArray(data.files)) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn data\n\t} catch {\n\t\treturn null\n\t}\n}\n\n/**\n * Writes the checksum data to the output directory.\n */\nexport async function writeChecksum(outputDir: string, data: ChecksumData): Promise<void> {\n\tawait mkdir(outputDir, { recursive: true })\n\tconst checksumPath = path.join(outputDir, CHECKSUM_FILENAME)\n\tawait writeFile(checksumPath, JSON.stringify(data, null, 2), 'utf-8')\n}\n","import fs from 'fs/promises'\nimport path from 'path'\nimport type { ControllerGroups, ExtendedRouteInfo, RouteParameter } from '../types/route.types'\nimport type { GeneratedClientInfo, SchemaInfo } from '../types/schema.types'\nimport { buildFullApiPath } from '../utils/path-utils'\nimport { camelCase, safeToString } from '../utils/string-utils'\n\n/**\n * Service for generating TypeScript RPC clients\n */\nexport class ClientGeneratorService {\n\tconstructor(private readonly outputDir: string) {}\n\n\t/**\n\t * Generates the TypeScript RPC client\n\t */\n\tasync generateClient(\n\t\troutes: readonly ExtendedRouteInfo[],\n\t\tschemas: readonly SchemaInfo[]\n\t): Promise<GeneratedClientInfo> {\n\t\tawait fs.mkdir(this.outputDir, { recursive: true })\n\n\t\tawait this.generateClientFile(routes, schemas)\n\n\t\tconst generatedInfo: GeneratedClientInfo = {\n\t\t\tclientFile: path.join(this.outputDir, 'client.ts'),\n\t\t\tgeneratedAt: new Date().toISOString()\n\t\t}\n\n\t\treturn generatedInfo\n\t}\n\n\t/**\n\t * Generates the main client file with types included\n\t */\n\tprivate async generateClientFile(\n\t\troutes: readonly ExtendedRouteInfo[],\n\t\tschemas: readonly SchemaInfo[]\n\t): Promise<void> {\n\t\tconst clientContent = this.generateClientContent(routes, schemas)\n\t\tconst clientPath = path.join(this.outputDir, 'client.ts')\n\t\tawait fs.writeFile(clientPath, clientContent, 'utf-8')\n\t}\n\n\t/**\n\t * Generates the client TypeScript content with types included\n\t */\n\tprivate generateClientContent(routes: readonly ExtendedRouteInfo[], schemas: readonly SchemaInfo[]): string {\n\t\tconst controllerGroups = this.groupRoutesByController(routes)\n\n\t\treturn `// ============================================================================\n// TYPES SECTION\n// ============================================================================\n\n/**\n * API Error class\n */\nexport class ApiError extends Error {\n\tconstructor(\n\t\tpublic statusCode: number,\n\t\tmessage: string\n\t) {\n\t\tsuper(message)\n\t\tthis.name = 'ApiError'\n\t}\n}\n\n/**\n * Clean separation of concerns for request options\n */\nexport type RequestOptions<\n\tTParams = undefined,\n\tTQuery = undefined,\n\tTBody = undefined,\n\tTHeaders = undefined\n> = (TParams extends undefined ? object : { params: TParams }) &\n\t(TQuery extends undefined ? object : { query: TQuery }) &\n\t(TBody extends undefined ? object : { body: TBody }) &\n\t(THeaders extends undefined ? object : { headers: THeaders })\n\n/**\n * Custom fetch function type that matches the standard fetch API\n */\nexport type FetchFunction = (\n\tinput: RequestInfo | URL,\n\tinit?: RequestInit\n) => Promise<Response>\n\n// Generated DTOs and types from integrated Schema Generation\n${this.generateSchemaTypes(schemas)}\n\n// ============================================================================\n// CLIENT SECTION\n// ============================================================================\n\n/**\n * Generated RPC Client\n * \n * This class provides a type-safe HTTP client for interacting with your API endpoints.\n * It's automatically generated by the RPCPlugin based on your controller definitions.\n * \n * @example\n * \\`\\`\\`typescript\n * const apiClient = new ApiClient('http://localhost:3000')\n * \n * // Make a request to get users\n * const response = await apiClient.users.getUsers()\n * \n * // Make a request with parameters\n * const user = await apiClient.users.getUser({ params: { id: '123' } })\n * \n * // Make a request with body data\n * const newUser = await apiClient.users.createUser({ \n * body: { name: 'John', email: 'john@example.com' } \n * })\n * \n * // Use with custom fetch function (e.g., for testing or custom logic)\n * const customFetch = (input: RequestInfo | URL, init?: RequestInit) => {\n * console.log('Making request to:', input)\n * return fetch(input, init)\n * }\n * \n * const apiClientWithCustomFetch = new ApiClient('http://localhost:3000', {\n * fetchFn: customFetch,\n * defaultHeaders: { 'X-Custom-Header': 'value' }\n * })\n * \\`\\`\\`\n * \n * @generated This class is auto-generated by RPCPlugin\n */\nexport class ApiClient {\n\tprivate baseUrl: string\n\tprivate defaultHeaders: Record<string, string>\n\tprivate fetchFn: FetchFunction\n\n\tconstructor(\n\t\tbaseUrl: string, \n\t\toptions: {\n\t\t\tdefaultHeaders?: Record<string, string>\n\t\t\tfetchFn?: FetchFunction\n\t\t} = {}\n\t) {\n\t\tthis.baseUrl = baseUrl.replace(/\\\\/$/, '')\n\t\tthis.defaultHeaders = {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t...options.defaultHeaders\n\t\t}\n\t\tthis.fetchFn = options.fetchFn || fetch\n\t}\n\n\t/**\n\t * Set default headers for all requests\n\t */\n\tsetDefaultHeaders(headers: Record<string, string>): this {\n\t\tthis.defaultHeaders = { ...this.defaultHeaders, ...headers }\n\t\treturn this\n\t}\n\n\n\t/**\n\t * Make an HTTP request with flexible options\n\t */\n\tprivate async request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions<any, any, any, any> = {}\n\t): Promise<T> {\n\t\tconst { params, query, body, headers = {} } = options as any\n\t\t\n\t\t// Build the final URL with path parameters\n\t\tlet finalPath = path\n\t\tif (params) {\n\t\t\tObject.entries(params).forEach(([key, value]) => {\n\t\t\t\tfinalPath = finalPath.replace(\\`:\\${key}\\`, String(value))\n\t\t\t})\n\t\t}\n\n\t\tconst url = new URL(finalPath, this.baseUrl)\n\t\t\n\t\t// Add query parameters\n\t\tif (query) {\n\t\t\tObject.entries(query).forEach(([key, value]) => {\n\t\t\t\tif (value !== undefined && value !== null) {\n\t\t\t\t\turl.searchParams.append(key, String(value))\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// Merge default headers with request-specific headers\n\t\tconst finalHeaders = { ...this.defaultHeaders, ...headers }\n\n\t\tconst requestOptions: RequestInit = {\n\t\t\tmethod,\n\t\t\theaders: finalHeaders,\n\t\t}\n\n\t\tif (body && method !== 'GET') {\n\t\t\trequestOptions.body = JSON.stringify(body)\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await this.fetchFn(url.toString(), requestOptions)\n\n\t\t\tif (response.status === 204 || response.headers.get('content-length') === '0') {\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new ApiError(response.status, 'Request failed')\n\t\t\t\t}\n\t\t\t\treturn undefined as T\n\t\t\t}\n\n\t\t\tconst responseData = await response.json()\n\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new ApiError(response.status, responseData.message || 'Request failed')\n\t\t\t}\n\n\t\t\treturn responseData\n\t\t} catch (error) {\n\t\t\tif (error instanceof ApiError) {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\tthrow new ApiError(0, error instanceof Error ? error.message : 'Network error')\n\t\t}\n\t}\n\n${this.generateControllerMethods(controllerGroups)}\n}\n`\n\t}\n\n\t/**\n\t * Generates controller methods for the client\n\t */\n\tprivate generateControllerMethods(controllerGroups: ControllerGroups): string {\n\t\tlet methods = ''\n\n\t\tfor (const [controllerName, routes] of controllerGroups) {\n\t\t\tconst className = controllerName.replace(/Controller$/, '')\n\t\t\tmethods += `\n\t// ${className} Controller\n`\n\t\t\tmethods += `\tget ${camelCase(className)}() {\n`\n\t\t\tmethods += `\t\treturn {\n`\n\n\t\t\tfor (const route of routes) {\n\t\t\t\tconst methodName = camelCase(safeToString(route.handler))\n\t\t\t\tconst httpMethod = safeToString(route.method).toLowerCase()\n\t\t\t\tconst { pathParams, queryParams, bodyParams } = this.analyzeRouteParameters(route)\n\n\t\t\t\t// Extract return type from route analysis for better type safety\n\t\t\t\tconst returnType = this.extractReturnType(route.returns)\n\n\t\t\t\tconst hasRequiredParams =\n\t\t\t\t\tpathParams.length > 0 ||\n\t\t\t\t\tqueryParams.some((p) => p.required) ||\n\t\t\t\t\t(bodyParams.length > 0 && httpMethod !== 'get')\n\n\t\t\t\t// Generate the method signature with proper typing\n\t\t\t\tmethods += `\t\t\t${methodName}: async <Result = ${returnType}>(options${hasRequiredParams ? '' : '?'}: RequestOptions<`\n\n\t\t\t\t// Path parameters type\n\t\t\t\tif (pathParams.length > 0) {\n\t\t\t\t\tconst pathParamTypes = pathParams.map((p) => {\n\t\t\t\t\t\tconst paramName = p.name\n\t\t\t\t\t\tconst paramType = p.type || 'any'\n\t\t\t\t\t\treturn `${paramName}: ${paramType}`\n\t\t\t\t\t})\n\t\t\t\t\tmethods += `{ ${pathParamTypes.join(', ')} }`\n\t\t\t\t} else {\n\t\t\t\t\tmethods += 'undefined'\n\t\t\t\t}\n\n\t\t\t\tmethods += ', '\n\n\t\t\t\t// Query parameters type\n\t\t\t\tif (queryParams.length > 0) {\n\t\t\t\t\tconst queryParamTypes = queryParams.map((p) => {\n\t\t\t\t\t\tconst paramName = p.name\n\t\t\t\t\t\tconst paramType = p.type || 'any'\n\t\t\t\t\t\treturn `${paramName}: ${paramType}`\n\t\t\t\t\t})\n\t\t\t\t\tmethods += `{ ${queryParamTypes.join(', ')} }`\n\t\t\t\t} else {\n\t\t\t\t\tmethods += 'undefined'\n\t\t\t\t}\n\n\t\t\t\tmethods += ', '\n\n\t\t\t\t// Body type\n\t\t\t\tif (bodyParams.length > 0) {\n\t\t\t\t\tconst bodyParamTypes = bodyParams.map((p) => {\n\t\t\t\t\t\tconst paramType = p.type || 'any'\n\t\t\t\t\t\treturn paramType\n\t\t\t\t\t})\n\t\t\t\t\t// Use the first body parameter type, not 'any'\n\t\t\t\t\tmethods += bodyParamTypes[0] || 'any'\n\t\t\t\t} else {\n\t\t\t\t\tmethods += 'undefined'\n\t\t\t\t}\n\n\t\t\t\tmethods += ', '\n\n\t\t\t\t// Headers type - always optional for now, but could be made conditional\n\t\t\t\tmethods += 'undefined'\n\n\t\t\t\tmethods += `>) => {\n`\n\n\t\t\t\t// Build the full API path using route information\n\t\t\t\tlet requestPath = buildFullApiPath(route)\n\n\t\t\t\t// Replace path parameters with placeholders for dynamic substitution\n\t\t\t\tif (pathParams.length > 0) {\n\t\t\t\t\tfor (const pathParam of pathParams) {\n\t\t\t\t\t\tconst paramName = pathParam.name\n\t\t\t\t\t\tconst placeholder = `:${String(pathParam.data)}`\n\t\t\t\t\t\trequestPath = requestPath.replace(placeholder, `:${paramName}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tmethods += `\t\t\t\treturn this.request<Result>('${httpMethod.toUpperCase()}', \\`${requestPath}\\`, options)\n`\n\t\t\t\tmethods += `\t\t\t},\n`\n\t\t\t}\n\n\t\t\tmethods += `\t\t}\n`\n\t\t\tmethods += `\t}\n`\n\t\t}\n\n\t\treturn methods\n\t}\n\n\t/**\n\t * Extracts the proper return type from route analysis\n\t */\n\tprivate extractReturnType(returns?: string): string {\n\t\tif (!returns) return 'any'\n\n\t\t// Handle Promise<T> types\n\t\tconst promiseMatch = returns.match(/Promise<(.+)>/)\n\t\tif (promiseMatch) {\n\t\t\treturn promiseMatch[1]\n\t\t}\n\n\t\t// Handle other types\n\t\treturn returns\n\t}\n\n\t/**\n\t * Generates schema types from integrated schema generation\n\t */\n\tprivate generateSchemaTypes(schemas: readonly SchemaInfo[]): string {\n\t\tif (schemas.length === 0) {\n\t\t\treturn '// No schemas available from integrated Schema Generation\\n'\n\t\t}\n\n\t\tlet content = '// Schema types from integrated Schema Generation\\n'\n\t\tfor (const schemaInfo of schemas) {\n\t\t\tif (schemaInfo.typescriptType) {\n\t\t\t\tcontent += `${schemaInfo.typescriptType}\\n\\n`\n\t\t\t}\n\t\t}\n\t\treturn content\n\t}\n\n\t/**\n\t * Groups routes by controller for better organization\n\t */\n\tprivate groupRoutesByController(routes: readonly ExtendedRouteInfo[]): ControllerGroups {\n\t\tconst groups = new Map<string, ExtendedRouteInfo[]>()\n\n\t\tfor (const route of routes) {\n\t\t\tconst controller = safeToString(route.controller)\n\t\t\tif (!groups.has(controller)) {\n\t\t\t\tgroups.set(controller, [])\n\t\t\t}\n\t\t\tgroups.get(controller)!.push(route)\n\t\t}\n\n\t\treturn groups\n\t}\n\n\t/**\n\t * Analyzes route parameters to determine their types and usage\n\t */\n\tprivate analyzeRouteParameters(route: ExtendedRouteInfo): {\n\t\tpathParams: readonly RouteParameter[]\n\t\tqueryParams: readonly RouteParameter[]\n\t\tbodyParams: readonly RouteParameter[]\n\t} {\n\t\tconst parameters = route.parameters || []\n\n\t\tconst pathParams = parameters\n\t\t\t.filter((p) => p.decoratorType === 'param')\n\t\t\t.map((p) => ({ ...p, required: true }))\n\n\t\tconst bodyParams = parameters\n\t\t\t.filter((p) => p.decoratorType === 'body')\n\t\t\t.map((p) => ({ ...p, required: true }))\n\n\t\tconst queryParams = parameters\n\t\t\t.filter((p) => p.decoratorType === 'query')\n\t\t\t.map((p) => ({ ...p, required: p.required === true }))\n\n\t\treturn { pathParams, queryParams, bodyParams }\n\t}\n}\n","import type { ParameterMetadata } from 'honestjs'\nimport type { ExtendedRouteInfo } from '../types/route.types'\n\n/**\n * Builds the full path with parameter placeholders\n */\nexport function buildFullPath(basePath: string, parameters: readonly ParameterMetadata[]): string {\n\tif (!basePath || typeof basePath !== 'string') return '/'\n\n\tlet path = basePath\n\n\tif (parameters && Array.isArray(parameters)) {\n\t\tfor (const param of parameters) {\n\t\t\tif (param.data && typeof param.data === 'string' && param.data.startsWith(':')) {\n\t\t\t\tconst paramName = param.data.slice(1)\n\t\t\t\tpath = path.replace(`:${paramName}`, `\\${${paramName}}`)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn path\n}\n\n/**\n * Builds the full API path using route information\n */\nexport function buildFullApiPath(route: ExtendedRouteInfo): string {\n\tconst prefix = route.prefix || ''\n\tconst version = route.version || ''\n\tconst routePath = route.route || ''\n\tconst path = route.path || ''\n\n\tlet fullPath = ''\n\n\t// Add prefix (e.g., /api)\n\tif (prefix && prefix !== '/') {\n\t\tfullPath += prefix.replace(/^\\/+|\\/+$/g, '')\n\t}\n\n\t// Add version (e.g., /v1)\n\tif (version && version !== '/') {\n\t\tfullPath += `/${version.replace(/^\\/+|\\/+$/g, '')}`\n\t}\n\n\t// Add route (e.g., /users)\n\tif (routePath && routePath !== '/') {\n\t\tfullPath += `/${routePath.replace(/^\\/+|\\/+$/g, '')}`\n\t}\n\n\t// Add path (e.g., /:id or /)\n\tif (path && path !== '/') {\n\t\tfullPath += `/${path.replace(/^\\/+|\\/+$/g, '')}`\n\t} else if (path === '/') {\n\t\tfullPath += '/'\n\t}\n\n\tif (fullPath && !fullPath.startsWith('/')) fullPath = '/' + fullPath\n\n\treturn fullPath || '/'\n}\n","/**\n * Safely converts a value to string, handling symbols and other types\n */\nexport function safeToString(value: unknown): string {\n\tif (typeof value === 'string') return value\n\tif (typeof value === 'symbol') return value.description || 'Symbol'\n\treturn String(value)\n}\n\n/**\n * Converts a string to camelCase\n */\nexport function camelCase(str: string): string {\n\treturn str.charAt(0).toLowerCase() + str.slice(1)\n}\n","import { RouteRegistry, type ParameterMetadata, type RouteInfo } from 'honestjs'\nimport { ClassDeclaration, MethodDeclaration, Project } from 'ts-morph'\nimport { LOG_PREFIX } from '../constants/defaults'\nimport type { ExtendedRouteInfo, ParameterMetadataWithType } from '../types/route.types'\nimport { buildFullPath } from '../utils/path-utils'\nimport { safeToString } from '../utils/string-utils'\n\n/**\n * Service for analyzing controller methods and extracting type information\n */\nexport class RouteAnalyzerService {\n\t/**\n\t * Analyzes controller methods to extract type information\n\t */\n\tasync analyzeControllerMethods(project: Project): Promise<ExtendedRouteInfo[]> {\n\t\tconst routes = RouteRegistry.getRoutes()\n\t\tif (!routes?.length) {\n\t\t\treturn []\n\t\t}\n\n\t\tconst controllers = this.findControllerClasses(project)\n\n\t\tif (controllers.size === 0) {\n\t\t\treturn []\n\t\t}\n\n\t\treturn this.processRoutes(routes, controllers)\n\t}\n\n\t/**\n\t * Finds controller classes in the project\n\t */\n\tprivate findControllerClasses(project: Project): Map<string, ClassDeclaration> {\n\t\tconst controllers = new Map<string, ClassDeclaration>()\n\t\tconst files = project.getSourceFiles()\n\n\t\tfor (const sourceFile of files) {\n\t\t\tconst classes = sourceFile.getClasses()\n\n\t\t\tfor (const classDeclaration of classes) {\n\t\t\t\tconst className = classDeclaration.getName()\n\n\t\t\t\tif (className?.endsWith('Controller')) {\n\t\t\t\t\tcontrollers.set(className, classDeclaration)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn controllers\n\t}\n\n\t/**\n\t * Processes all routes and extracts type information\n\t */\n\tprivate processRoutes(\n\t\troutes: readonly RouteInfo[],\n\t\tcontrollers: Map<string, ClassDeclaration>\n\t): ExtendedRouteInfo[] {\n\t\tconst analyzedRoutes: ExtendedRouteInfo[] = []\n\n\t\tfor (const route of routes) {\n\t\t\ttry {\n\t\t\t\tconst extendedRoute = this.createExtendedRoute(route, controllers)\n\t\t\t\tanalyzedRoutes.push(extendedRoute)\n\t\t\t} catch (routeError) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${LOG_PREFIX} Skipping route ${safeToString(route.controller)}.${safeToString(route.handler)}:`,\n\t\t\t\t\trouteError\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\treturn analyzedRoutes\n\t}\n\n\t/**\n\t * Creates an extended route with type information\n\t */\n\tprivate createExtendedRoute(route: RouteInfo, controllers: Map<string, ClassDeclaration>): ExtendedRouteInfo {\n\t\tconst controllerName = safeToString(route.controller)\n\t\tconst handlerName = safeToString(route.handler)\n\n\t\tconst controllerClass = controllers.get(controllerName)\n\t\tlet returns: string | undefined\n\t\tlet parameters: readonly ParameterMetadataWithType[] | undefined\n\n\t\tif (controllerClass) {\n\t\t\tconst handlerMethod = controllerClass.getMethods().find((method) => method.getName() === handlerName)\n\n\t\t\tif (handlerMethod) {\n\t\t\t\treturns = this.getReturnType(handlerMethod)\n\t\t\t\tparameters = this.getParametersWithTypes(handlerMethod, route.parameters || [])\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcontroller: controllerName,\n\t\t\thandler: handlerName,\n\t\t\tmethod: safeToString(route.method).toUpperCase(),\n\t\t\tprefix: route.prefix,\n\t\t\tversion: route.version,\n\t\t\troute: route.route,\n\t\t\tpath: route.path,\n\t\t\tfullPath: buildFullPath(route.path, route.parameters),\n\t\t\tparameters,\n\t\t\treturns\n\t\t}\n\t}\n\n\t/**\n\t * Gets the return type of a method\n\t */\n\tprivate getReturnType(method: MethodDeclaration): string {\n\t\tconst type = method.getReturnType()\n\t\tconst typeText = type.getText(method)\n\n\t\tconst aliasSymbol = type.getAliasSymbol()\n\t\tif (aliasSymbol) {\n\t\t\treturn aliasSymbol.getName()\n\t\t}\n\n\t\treturn typeText.replace(/import\\(\".*?\"\\)\\./g, '')\n\t}\n\n\t/**\n\t * Gets parameters with their types\n\t */\n\tprivate getParametersWithTypes(\n\t\tmethod: MethodDeclaration,\n\t\tparameters: readonly ParameterMetadata[]\n\t): readonly ParameterMetadataWithType[] {\n\t\tconst result: ParameterMetadataWithType[] = []\n\t\tconst declaredParams = method.getParameters()\n\t\tconst sortedParams = [...parameters].sort((a, b) => a.index - b.index)\n\n\t\tfor (const param of sortedParams) {\n\t\t\tconst index = param.index\n\t\t\tconst decoratorType = param.name\n\n\t\t\tif (index < declaredParams.length) {\n\t\t\t\tconst declaredParam = declaredParams[index]\n\t\t\t\tconst paramName = declaredParam.getName()\n\t\t\t\tconst paramType = declaredParam\n\t\t\t\t\t.getType()\n\t\t\t\t\t.getText()\n\t\t\t\t\t.replace(/import\\(\".*?\"\\)\\./g, '')\n\n\t\t\t\tresult.push({\n\t\t\t\t\tindex,\n\t\t\t\t\tname: paramName,\n\t\t\t\t\tdecoratorType,\n\t\t\t\t\ttype: paramType,\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdata: param.data,\n\t\t\t\t\tfactory: param.factory,\n\t\t\t\t\tmetatype: param.metatype\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tresult.push({\n\t\t\t\t\tindex,\n\t\t\t\t\tname: `param${index}`,\n\t\t\t\t\tdecoratorType,\n\t\t\t\t\ttype: param.metatype?.name || 'unknown',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdata: param.data,\n\t\t\t\t\tfactory: param.factory,\n\t\t\t\t\tmetatype: param.metatype\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n}\n","import { createGenerator } from 'ts-json-schema-generator'\nimport { MethodDeclaration, Project } from 'ts-morph'\nimport type { SchemaInfo } from '../types/schema.types'\nimport { generateTypeScriptInterface } from '../utils/schema-utils'\nimport { extractNamedType } from '../utils/type-utils'\n\n/**\n * Service for generating JSON schemas from TypeScript types used in controllers\n */\nexport class SchemaGeneratorService {\n\tconstructor(\n\t\tprivate readonly controllerPattern: string,\n\t\tprivate readonly tsConfigPath: string\n\t) {}\n\n\t/**\n\t * Generates JSON schemas from types used in controllers\n\t */\n\tasync generateSchemas(project: Project): Promise<SchemaInfo[]> {\n\t\tconst sourceFiles = project.getSourceFiles(this.controllerPattern)\n\n\t\tconst collectedTypes = this.collectTypesFromControllers(sourceFiles)\n\t\treturn this.processTypes(collectedTypes)\n\t}\n\n\t/**\n\t * Collects types from controller files\n\t */\n\tprivate collectTypesFromControllers(sourceFiles: readonly any[]): Set<string> {\n\t\tconst collectedTypes = new Set<string>()\n\n\t\tfor (const file of sourceFiles) {\n\t\t\tfor (const cls of file.getClasses()) {\n\t\t\t\tfor (const method of cls.getMethods()) {\n\t\t\t\t\tthis.collectTypesFromMethod(method, collectedTypes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn collectedTypes\n\t}\n\n\t/**\n\t * Collects types from a single method\n\t */\n\tprivate collectTypesFromMethod(method: MethodDeclaration, collectedTypes: Set<string>): void {\n\t\t// Collect parameter types\n\t\tfor (const param of method.getParameters()) {\n\t\t\tconst type = extractNamedType(param.getType())\n\t\t\tif (type) collectedTypes.add(type)\n\t\t}\n\n\t\t// Collect return type\n\t\tconst returnType = method.getReturnType()\n\t\tconst innerType = returnType.getTypeArguments()[0] ?? returnType\n\t\tconst type = extractNamedType(innerType)\n\t\tif (type) collectedTypes.add(type)\n\t}\n\n\t/**\n\t * Processes collected types to generate schemas\n\t */\n\tprivate async processTypes(collectedTypes: Set<string>): Promise<SchemaInfo[]> {\n\t\tconst schemas: SchemaInfo[] = []\n\n\t\tfor (const typeName of collectedTypes) {\n\t\t\ttry {\n\t\t\t\tconst schema = await this.generateSchemaForType(typeName)\n\t\t\t\tconst typescriptType = generateTypeScriptInterface(typeName, schema)\n\n\t\t\t\tschemas.push({\n\t\t\t\t\ttype: typeName,\n\t\t\t\t\tschema,\n\t\t\t\t\ttypescriptType\n\t\t\t\t})\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(`Failed to generate schema for ${typeName}:`, err)\n\t\t\t}\n\t\t}\n\n\t\treturn schemas\n\t}\n\n\t/**\n\t * Generates schema for a specific type\n\t */\n\tprivate async generateSchemaForType(typeName: string): Promise<Record<string, any>> {\n\t\ttry {\n\t\t\tconst generator = createGenerator({\n\t\t\t\tpath: this.controllerPattern,\n\t\t\t\ttsconfig: this.tsConfigPath,\n\t\t\t\ttype: typeName,\n\t\t\t\tskipTypeCheck: false // Enable type checking for better error detection\n\t\t\t})\n\n\t\t\treturn generator.createSchema(typeName)\n\t\t} catch (error) {\n\t\t\tconsole.error(`Failed to generate schema for type ${typeName}:`, error)\n\t\t\t// Return a basic schema structure as fallback\n\t\t\treturn {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {},\n\t\t\t\trequired: []\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * Maps JSON schema types to TypeScript types\n */\nexport function mapJsonSchemaTypeToTypeScript(schema: Record<string, any>): string {\n\tconst type = schema.type as string\n\n\tswitch (type) {\n\t\tcase 'string':\n\t\t\tif (schema.enum && Array.isArray(schema.enum)) {\n\t\t\t\treturn `'${schema.enum.join(\"' | '\")}'`\n\t\t\t}\n\t\t\treturn 'string'\n\t\tcase 'number':\n\t\tcase 'integer':\n\t\t\treturn 'number'\n\t\tcase 'boolean':\n\t\t\treturn 'boolean'\n\t\tcase 'array': {\n\t\t\tconst itemType = mapJsonSchemaTypeToTypeScript(schema.items || {})\n\t\t\treturn `${itemType}[]`\n\t\t}\n\t\tcase 'object':\n\t\t\treturn 'Record<string, any>'\n\t\tdefault:\n\t\t\treturn 'any'\n\t}\n}\n\n/**\n * Generates TypeScript interface from JSON schema\n */\nexport function generateTypeScriptInterface(typeName: string, schema: Record<string, any>): string {\n\ttry {\n\t\tconst typeDefinition = schema.definitions?.[typeName]\n\t\tif (!typeDefinition) {\n\t\t\treturn `export interface ${typeName} {\\n\\t// No schema definition found\\n}`\n\t\t}\n\n\t\tconst properties = typeDefinition.properties || {}\n\t\tconst required = typeDefinition.required || []\n\n\t\tlet interfaceCode = `export interface ${typeName} {\\n`\n\n\t\tfor (const [propName, propSchema] of Object.entries(properties)) {\n\t\t\tconst isRequired = required.includes(propName)\n\t\t\tconst type = mapJsonSchemaTypeToTypeScript(propSchema as Record<string, any>)\n\t\t\tconst optional = isRequired ? '' : '?'\n\n\t\t\tinterfaceCode += `\\t${propName}${optional}: ${type}\\n`\n\t\t}\n\n\t\tinterfaceCode += '}'\n\t\treturn interfaceCode\n\t} catch (error) {\n\t\tconsole.error(`Failed to generate TypeScript interface for ${typeName}:`, error)\n\t\treturn `export interface ${typeName} {\\n\\t// Failed to generate interface\\n}`\n\t}\n}\n","import type { Type } from 'ts-morph'\nimport { BUILTIN_TYPES, GENERIC_TYPES } from '../constants/defaults'\n\n/**\n * Extracts a named type from a TypeScript type\n */\nexport function extractNamedType(type: Type): string | null {\n\tconst symbol = type.getAliasSymbol() || type.getSymbol()\n\tif (!symbol) return null\n\n\tconst name = symbol.getName()\n\n\t// Handle generic types by unwrapping them\n\tif (GENERIC_TYPES.has(name)) {\n\t\tconst inner = type.getAliasTypeArguments()?.[0] || type.getTypeArguments()?.[0]\n\t\treturn inner ? extractNamedType(inner) : null\n\t}\n\n\t// Skip built-in types\n\tif (BUILTIN_TYPES.has(name)) return null\n\n\treturn name\n}\n"],"mappings":";AAAA,OAAOA,SAAQ;AAGf,OAAOC,WAAU;AACjB,SAAS,eAAe;;;ACDjB,IAAM,kBAAkB;AAAA,EAC9B,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,SAAS;AAAA,IACR,WAAW;AAAA,IACX,MAAM;AAAA,MACL,UAAU;AAAA,IACX;AAAA,EACD;AACD;AAKO,IAAM,aAAa;AAKnB,IAAM,wBAAwB,oBAAI,IAAI;AAAA,EAC5C;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACD,CAAC;AAKM,IAAM,gBAAgB,oBAAI,IAAI,CAAC,UAAU,UAAU,WAAW,OAAO,QA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vC;AAAA;AAAA;AAAA;AAAA,EAKQ,SAAS,SAAiB,OAAuB;AACxD,YAAQ,MAAM,GAAG,UAAU,IAAI,OAAO,IAAI,SAAS,EAAE;AAAA,EACtD;AACD;","names":["fs","path","path","path","path","type","path","fs"]}
1
+ {"version":3,"sources":["../src/rpc.plugin.ts","../src/constants/defaults.ts","../src/generators/typescript-client.generator.ts","../src/utils/path-utils.ts","../src/utils/string-utils.ts","../src/utils/hash-utils.ts","../src/services/route-analyzer.service.ts","../src/services/schema-generator.service.ts","../src/utils/schema-utils.ts","../src/utils/type-utils.ts"],"sourcesContent":["import fs from 'fs'\nimport type { Application, IPlugin } from 'honestjs'\nimport type { Hono } from 'hono'\nimport path from 'path'\nimport { Project } from 'ts-morph'\n\nimport { DEFAULT_OPTIONS, LOG_PREFIX } from './constants/defaults'\nimport { TypeScriptClientGenerator } from './generators'\nimport { computeHash, readChecksum, writeChecksum } from './utils/hash-utils'\nimport { RouteAnalyzerService } from './services/route-analyzer.service'\nimport { SchemaGeneratorService } from './services/schema-generator.service'\nimport type { ExtendedRouteInfo, GeneratedClientInfo, RPCGenerator, SchemaInfo } from './types'\n\n/**\n * Configuration options for the RPCPlugin\n */\nexport interface RPCPluginOptions {\n\treadonly controllerPattern?: string\n\treadonly tsConfigPath?: string\n\treadonly outputDir?: string\n\treadonly generateOnInit?: boolean\n\treadonly generators?: readonly RPCGenerator[]\n\treadonly context?: {\n\t\treadonly namespace?: string\n\t\treadonly keys?: {\n\t\t\treadonly artifact?: string\n\t\t}\n\t}\n}\n\n/**\n * Comprehensive RPC plugin that combines route analysis, schema generation, and client generation\n */\nexport class RPCPlugin implements IPlugin {\n\tprivate readonly controllerPattern: string\n\tprivate readonly tsConfigPath: string\n\tprivate readonly outputDir: string\n\tprivate readonly generateOnInit: boolean\n\tprivate readonly contextNamespace: string\n\tprivate readonly contextArtifactKey: string\n\n\t// Services\n\tprivate readonly routeAnalyzer: RouteAnalyzerService\n\tprivate readonly schemaGenerator: SchemaGeneratorService\n\tprivate readonly generators: readonly RPCGenerator[]\n\n\t// Shared ts-morph project\n\tprivate project: Project | null = null\n\n\t// Internal state\n\tprivate analyzedRoutes: ExtendedRouteInfo[] = []\n\tprivate analyzedSchemas: SchemaInfo[] = []\n\tprivate generatedInfos: GeneratedClientInfo[] = []\n\tprivate app: Application | null = null\n\n\tconstructor(options: RPCPluginOptions = {}) {\n\t\tthis.controllerPattern = options.controllerPattern ?? DEFAULT_OPTIONS.controllerPattern\n\t\tthis.tsConfigPath = options.tsConfigPath ?? path.resolve(process.cwd(), DEFAULT_OPTIONS.tsConfigPath)\n\t\tthis.outputDir = options.outputDir ?? path.resolve(process.cwd(), DEFAULT_OPTIONS.outputDir)\n\t\tthis.generateOnInit = options.generateOnInit ?? DEFAULT_OPTIONS.generateOnInit\n\t\tthis.contextNamespace = options.context?.namespace ?? DEFAULT_OPTIONS.context.namespace\n\t\tthis.contextArtifactKey = options.context?.keys?.artifact ?? DEFAULT_OPTIONS.context.keys.artifact\n\n\t\t// Initialize services\n\t\tthis.routeAnalyzer = new RouteAnalyzerService()\n\t\tthis.schemaGenerator = new SchemaGeneratorService(this.controllerPattern, this.tsConfigPath)\n\t\tthis.generators = options.generators ?? [new TypeScriptClientGenerator(this.outputDir)]\n\n\t\tthis.validateConfiguration()\n\t}\n\n\t/**\n\t * Validates the plugin configuration\n\t */\n\tprivate validateConfiguration(): void {\n\t\tconst errors: string[] = []\n\n\t\tif (!this.controllerPattern?.trim()) {\n\t\t\terrors.push('Controller pattern cannot be empty')\n\t\t}\n\n\t\tif (!this.tsConfigPath?.trim()) {\n\t\t\terrors.push('TypeScript config path cannot be empty')\n\t\t} else {\n\t\t\tif (!fs.existsSync(this.tsConfigPath)) {\n\t\t\t\terrors.push(`TypeScript config file not found at: ${this.tsConfigPath}`)\n\t\t\t}\n\t\t}\n\n\t\tif (!this.outputDir?.trim()) {\n\t\t\terrors.push('Output directory cannot be empty')\n\t\t}\n\t\tif (!this.contextNamespace?.trim()) {\n\t\t\terrors.push('Context namespace cannot be empty')\n\t\t}\n\t\tif (!this.contextArtifactKey?.trim()) {\n\t\t\terrors.push('Context artifact key cannot be empty')\n\t\t}\n\t\tfor (const generator of this.generators) {\n\t\t\tif (!generator.name?.trim()) {\n\t\t\t\terrors.push('Generator name cannot be empty')\n\t\t\t}\n\t\t\tif (typeof generator.generate !== 'function') {\n\t\t\t\terrors.push(`Generator \"${generator.name || 'unknown'}\" must implement generate(context)`)\n\t\t\t}\n\t\t}\n\n\t\tif (errors.length > 0) {\n\t\t\tthrow new Error(`Configuration validation failed: ${errors.join(', ')}`)\n\t\t}\n\n\t\tthis.log(\n\t\t\t`Configuration validated: controllerPattern=${this.controllerPattern}, tsConfigPath=${this.tsConfigPath}, outputDir=${this.outputDir}`\n\t\t)\n\t}\n\n\t/**\n\t * Called after all modules are registered\n\t */\n\tafterModulesRegistered = async (app: Application, hono: Hono): Promise<void> => {\n\t\tthis.app = app\n\t\tif (this.generateOnInit) {\n\t\t\tawait this.analyzeEverything()\n\t\t\tthis.publishArtifact(app)\n\t\t}\n\t}\n\n\t/**\n\t * Main analysis method that coordinates all three components\n\t */\n\tprivate async analyzeEverything(force = false): Promise<void> {\n\t\ttry {\n\t\t\tthis.log('Starting comprehensive RPC analysis...')\n\n\t\t\t// Create a single shared ts-morph project for both services\n\t\t\tthis.dispose()\n\t\t\tthis.project = new Project({ tsConfigFilePath: this.tsConfigPath })\n\t\t\tthis.project.addSourceFilesAtPaths([this.controllerPattern])\n\n\t\t\t// Hash check: skip if controller files are unchanged since last generation\n\t\t\tconst filePaths = this.project.getSourceFiles().map((f) => f.getFilePath())\n\n\t\t\tif (!force) {\n\t\t\t\tconst currentHash = computeHash(filePaths)\n\t\t\t\tconst stored = readChecksum(this.outputDir)\n\n\t\t\t\tif (stored && stored.hash === currentHash && this.outputFilesExist()) {\n\t\t\t\t\tif (this.loadArtifactFromDisk()) {\n\t\t\t\t\t\tthis.log('Source files unchanged — skipping regeneration')\n\t\t\t\t\t\tthis.dispose()\n\t\t\t\t\t\treturn\n\t\t\t\t\t}\n\t\t\t\t\tthis.log('Source files unchanged but cached artifact missing/invalid — regenerating')\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Clear previous analysis results to prevent stale state across runs\n\t\t\tthis.analyzedRoutes = []\n\t\t\tthis.analyzedSchemas = []\n\t\t\tthis.generatedInfos = []\n\n\t\t\t// Step 1: Analyze routes and extract type information\n\t\t\tthis.analyzedRoutes = await this.routeAnalyzer.analyzeControllerMethods(this.project)\n\n\t\t\t// Step 2: Generate schemas from the types we found\n\t\t\tthis.analyzedSchemas = await this.schemaGenerator.generateSchemas(this.project)\n\n\t\t\t// Step 3: Run configured generators\n\t\t\tthis.generatedInfos = await this.runGenerators()\n\n\t\t\t// Write checksum after successful generation\n\t\t\tawait writeChecksum(this.outputDir, { hash: computeHash(filePaths), files: filePaths })\n\t\t\tthis.writeArtifactToDisk()\n\n\t\t\tthis.log(\n\t\t\t\t`✅ RPC analysis complete: ${this.analyzedRoutes.length} routes, ${this.analyzedSchemas.length} schemas`\n\t\t\t)\n\t\t} catch (error) {\n\t\t\tthis.logError('Error during RPC analysis:', error)\n\t\t\tthis.dispose()\n\t\t\tthrow error\n\t\t}\n\t}\n\n\t/**\n\t * Manually trigger analysis (useful for testing or re-generation).\n\t * Defaults to force=true to bypass cache; pass false to use caching.\n\t */\n\tasync analyze(force = true): Promise<void> {\n\t\tawait this.analyzeEverything(force)\n\t\tif (this.app) {\n\t\t\tthis.publishArtifact(this.app)\n\t\t}\n\t}\n\n\t/**\n\t * Get the analyzed routes\n\t */\n\tgetRoutes(): readonly ExtendedRouteInfo[] {\n\t\treturn this.analyzedRoutes\n\t}\n\n\t/**\n\t * Get the analyzed schemas\n\t */\n\tgetSchemas(): readonly SchemaInfo[] {\n\t\treturn this.analyzedSchemas\n\t}\n\n\t/**\n\t * Get the generation info\n\t */\n\tgetGenerationInfo(): GeneratedClientInfo | null {\n\t\treturn this.generatedInfos[0] ?? null\n\t}\n\n\t/**\n\t * Get all generation infos\n\t */\n\tgetGenerationInfos(): readonly GeneratedClientInfo[] {\n\t\treturn this.generatedInfos\n\t}\n\n\t/**\n\t * Checks whether expected output files exist on disk\n\t */\n\tprivate outputFilesExist(): boolean {\n\t\tif (!fs.existsSync(path.join(this.outputDir, 'rpc-artifact.json'))) {\n\t\t\treturn false\n\t\t}\n\t\tif (!this.hasTypeScriptGenerator()) {\n\t\t\treturn true\n\t\t}\n\t\treturn fs.existsSync(path.join(this.outputDir, 'client.ts'))\n\t}\n\n\tprivate getArtifactPath(): string {\n\t\treturn path.join(this.outputDir, 'rpc-artifact.json')\n\t}\n\n\tprivate writeArtifactToDisk(): void {\n\t\tconst artifact = {\n\t\t\troutes: this.analyzedRoutes,\n\t\t\tschemas: this.analyzedSchemas\n\t\t}\n\t\tfs.mkdirSync(this.outputDir, { recursive: true })\n\t\tfs.writeFileSync(this.getArtifactPath(), JSON.stringify(artifact))\n\t}\n\n\tprivate loadArtifactFromDisk(): boolean {\n\t\ttry {\n\t\t\tconst raw = fs.readFileSync(this.getArtifactPath(), 'utf8')\n\t\t\tconst parsed = JSON.parse(raw) as {\n\t\t\t\troutes?: unknown\n\t\t\t\tschemas?: unknown\n\t\t\t}\n\t\t\tif (!Array.isArray(parsed.routes) || !Array.isArray(parsed.schemas)) {\n\t\t\t\treturn false\n\t\t\t}\n\t\t\tthis.analyzedRoutes = parsed.routes as ExtendedRouteInfo[]\n\t\t\tthis.analyzedSchemas = parsed.schemas as SchemaInfo[]\n\t\t\tthis.generatedInfos = []\n\t\t\treturn true\n\t\t} catch {\n\t\t\treturn false\n\t\t}\n\t}\n\n\tprivate async runGenerators(): Promise<GeneratedClientInfo[]> {\n\t\tconst results: GeneratedClientInfo[] = []\n\t\tfor (const generator of this.generators) {\n\t\t\tthis.log(`Running generator: ${generator.name}`)\n\t\t\tconst result = await generator.generate({\n\t\t\t\toutputDir: this.outputDir,\n\t\t\t\troutes: this.analyzedRoutes,\n\t\t\t\tschemas: this.analyzedSchemas\n\t\t\t})\n\t\t\tresults.push(result)\n\t\t}\n\t\treturn results\n\t}\n\n\tprivate hasTypeScriptGenerator(): boolean {\n\t\treturn this.generators.some((generator) => generator.name === 'typescript-client')\n\t}\n\n\tprivate publishArtifact(app: Application): void {\n\t\tapp.getContext().set(this.getArtifactContextKey(), {\n\t\t\troutes: this.analyzedRoutes,\n\t\t\tschemas: this.analyzedSchemas\n\t\t})\n\t}\n\n\tprivate getArtifactContextKey(): string {\n\t\treturn `${this.contextNamespace}.${this.contextArtifactKey}`\n\t}\n\n\t/**\n\t * Cleanup resources to prevent memory leaks\n\t */\n\tdispose(): void {\n\t\tif (this.project) {\n\t\t\tthis.project.getSourceFiles().forEach((file) => this.project!.removeSourceFile(file))\n\t\t\tthis.project = null\n\t\t}\n\t}\n\n\t// ============================================================================\n\t// LOGGING UTILITIES\n\t// ============================================================================\n\n\t/**\n\t * Logs a message with the plugin prefix\n\t */\n\tprivate log(message: string): void {\n\t\tconsole.log(`${LOG_PREFIX} ${message}`)\n\t}\n\n\t/**\n\t * Logs an error with the plugin prefix\n\t */\n\tprivate logError(message: string, error?: unknown): void {\n\t\tconsole.error(`${LOG_PREFIX} ${message}`, error || '')\n\t}\n}\n","/**\n * Default configuration options for the RPCPlugin\n */\nexport const DEFAULT_OPTIONS = {\n\tcontrollerPattern: 'src/modules/*/*.controller.ts',\n\ttsConfigPath: 'tsconfig.json',\n\toutputDir: './generated/rpc',\n\tgenerateOnInit: true,\n\tcontext: {\n\t\tnamespace: 'rpc',\n\t\tkeys: {\n\t\t\tartifact: 'artifact'\n\t\t}\n\t}\n} as const\n\n/**\n * Log prefix for the RPC plugin\n */\nexport const LOG_PREFIX = '[ RPCPlugin ]'\n\n/**\n * Built-in TypeScript types that should not be imported\n */\nexport const BUILTIN_UTILITY_TYPES = new Set([\n\t'Partial',\n\t'Required',\n\t'Readonly',\n\t'Pick',\n\t'Omit',\n\t'Record',\n\t'Exclude',\n\t'Extract',\n\t'ReturnType',\n\t'InstanceType'\n])\n\n/**\n * Built-in TypeScript types that should be skipped\n */\nexport const BUILTIN_TYPES = new Set(['string', 'number', 'boolean', 'any', 'void', 'unknown'])\n\n/**\n * Generic type names that should be unwrapped\n */\nexport const GENERIC_TYPES = new Set(['Array', 'Promise', 'Partial'])\n","import fs from 'fs/promises'\nimport path from 'path'\nimport type { ControllerGroups, ExtendedRouteInfo, RouteParameter } from '../types/route.types'\nimport type { RPCGenerator, RPCGeneratorContext } from '../types/generator.types'\nimport type { GeneratedClientInfo, SchemaInfo } from '../types/schema.types'\nimport { buildFullApiPath } from '../utils/path-utils'\nimport { camelCase, safeToString } from '../utils/string-utils'\n\n/**\n * Built-in generator for TypeScript RPC clients.\n */\nexport class TypeScriptClientGenerator implements RPCGenerator {\n\treadonly name = 'typescript-client'\n\n\tconstructor(private readonly outputDir: string) {}\n\n\t/**\n\t * Generates the TypeScript RPC client.\n\t */\n\tasync generate(context: RPCGeneratorContext): Promise<GeneratedClientInfo> {\n\t\treturn this.generateClient(context.routes, context.schemas)\n\t}\n\n\t/**\n\t * Generates the TypeScript RPC client.\n\t */\n\tasync generateClient(\n\t\troutes: readonly ExtendedRouteInfo[],\n\t\tschemas: readonly SchemaInfo[]\n\t): Promise<GeneratedClientInfo> {\n\t\tawait fs.mkdir(this.outputDir, { recursive: true })\n\n\t\tawait this.generateClientFile(routes, schemas)\n\n\t\tconst generatedInfo: GeneratedClientInfo = {\n\t\t\tgenerator: this.name,\n\t\t\tclientFile: path.join(this.outputDir, 'client.ts'),\n\t\t\toutputFiles: [path.join(this.outputDir, 'client.ts')],\n\t\t\tgeneratedAt: new Date().toISOString()\n\t\t}\n\n\t\treturn generatedInfo\n\t}\n\n\t/**\n\t * Generates the main client file with types included.\n\t */\n\tprivate async generateClientFile(\n\t\troutes: readonly ExtendedRouteInfo[],\n\t\tschemas: readonly SchemaInfo[]\n\t): Promise<void> {\n\t\tconst clientContent = this.generateClientContent(routes, schemas)\n\t\tconst clientPath = path.join(this.outputDir, 'client.ts')\n\t\tawait fs.writeFile(clientPath, clientContent, 'utf-8')\n\t}\n\n\t/**\n\t * Generates the client TypeScript content with types included.\n\t */\n\tprivate generateClientContent(routes: readonly ExtendedRouteInfo[], schemas: readonly SchemaInfo[]): string {\n\t\tconst controllerGroups = this.groupRoutesByController(routes)\n\n\t\treturn `// ============================================================================\n// TYPES SECTION\n// ============================================================================\n\n/**\n * API Error class\n */\nexport class ApiError extends Error {\n\tconstructor(\n\t\tpublic statusCode: number,\n\t\tmessage: string\n\t) {\n\t\tsuper(message)\n\t\tthis.name = 'ApiError'\n\t}\n}\n\n/**\n * Clean separation of concerns for request options\n */\nexport type RequestOptions<\n\tTParams = undefined,\n\tTQuery = undefined,\n\tTBody = undefined,\n\tTHeaders = undefined\n> = (TParams extends undefined ? object : { params: TParams }) &\n\t(TQuery extends undefined ? object : { query: TQuery }) &\n\t(TBody extends undefined ? object : { body: TBody }) &\n\t(THeaders extends undefined ? object : { headers: THeaders })\n\n/**\n * Custom fetch function type that matches the standard fetch API\n */\nexport type FetchFunction = (\n\tinput: RequestInfo | URL,\n\tinit?: RequestInit\n) => Promise<Response>\n\n// Generated DTOs and types from integrated Schema Generation\n${this.generateSchemaTypes(schemas)}\n\n// ============================================================================\n// CLIENT SECTION\n// ============================================================================\n\n/**\n * Generated RPC Client\n * \n * This class provides a type-safe HTTP client for interacting with your API endpoints.\n * It's automatically generated by the RPCPlugin based on your controller definitions.\n * \n * @example\n * \\`\\`\\`typescript\n * const apiClient = new ApiClient('http://localhost:3000')\n * \n * // Make a request to get users\n * const response = await apiClient.users.getUsers()\n * \n * // Make a request with parameters\n * const user = await apiClient.users.getUser({ params: { id: '123' } })\n * \n * // Make a request with body data\n * const newUser = await apiClient.users.createUser({ \n * body: { name: 'John', email: 'john@example.com' } \n * })\n * \n * // Use with custom fetch function (e.g., for testing or custom logic)\n * const customFetch = (input: RequestInfo | URL, init?: RequestInit) => {\n * console.log('Making request to:', input)\n * return fetch(input, init)\n * }\n * \n * const apiClientWithCustomFetch = new ApiClient('http://localhost:3000', {\n * fetchFn: customFetch,\n * defaultHeaders: { 'X-Custom-Header': 'value' }\n * })\n * \\`\\`\\`\n * \n * @generated This class is auto-generated by RPCPlugin\n */\nexport class ApiClient {\n\tprivate baseUrl: string\n\tprivate defaultHeaders: Record<string, string>\n\tprivate fetchFn: FetchFunction\n\n\tconstructor(\n\t\tbaseUrl: string, \n\t\toptions: {\n\t\t\tdefaultHeaders?: Record<string, string>\n\t\t\tfetchFn?: FetchFunction\n\t\t} = {}\n\t) {\n\t\tthis.baseUrl = baseUrl.replace(/\\\\/$/, '')\n\t\tthis.defaultHeaders = {\n\t\t\t'Content-Type': 'application/json',\n\t\t\t...options.defaultHeaders\n\t\t}\n\t\tthis.fetchFn = options.fetchFn || fetch\n\t}\n\n\t/**\n\t * Set default headers for all requests\n\t */\n\tsetDefaultHeaders(headers: Record<string, string>): this {\n\t\tthis.defaultHeaders = { ...this.defaultHeaders, ...headers }\n\t\treturn this\n\t}\n\n\n\t/**\n\t * Make an HTTP request with flexible options\n\t */\n\tprivate async request<T>(\n\t\tmethod: string,\n\t\tpath: string,\n\t\toptions: RequestOptions<any, any, any, any> = {}\n\t): Promise<T> {\n\t\tconst { params, query, body, headers = {} } = options as any\n\t\t\n\t\t// Build the final URL with path parameters\n\t\tlet finalPath = path\n\t\tif (params) {\n\t\t\tObject.entries(params).forEach(([key, value]) => {\n\t\t\t\tfinalPath = finalPath.replace(\\`:\\${key}\\`, String(value))\n\t\t\t})\n\t\t}\n\n\t\tconst url = new URL(finalPath, this.baseUrl)\n\t\t\n\t\t// Add query parameters\n\t\tif (query) {\n\t\t\tObject.entries(query).forEach(([key, value]) => {\n\t\t\t\tif (value !== undefined && value !== null) {\n\t\t\t\t\turl.searchParams.append(key, String(value))\n\t\t\t\t}\n\t\t\t})\n\t\t}\n\n\t\t// Merge default headers with request-specific headers\n\t\tconst finalHeaders = { ...this.defaultHeaders, ...headers }\n\n\t\tconst requestOptions: RequestInit = {\n\t\t\tmethod,\n\t\t\theaders: finalHeaders,\n\t\t}\n\n\t\tif (body && method !== 'GET') {\n\t\t\trequestOptions.body = JSON.stringify(body)\n\t\t}\n\n\t\ttry {\n\t\t\tconst response = await this.fetchFn(url.toString(), requestOptions)\n\n\t\t\tif (response.status === 204 || response.headers.get('content-length') === '0') {\n\t\t\t\tif (!response.ok) {\n\t\t\t\t\tthrow new ApiError(response.status, 'Request failed')\n\t\t\t\t}\n\t\t\t\treturn undefined as T\n\t\t\t}\n\n\t\t\tconst responseData = await response.json()\n\n\t\t\tif (!response.ok) {\n\t\t\t\tthrow new ApiError(response.status, responseData.message || 'Request failed')\n\t\t\t}\n\n\t\t\treturn responseData\n\t\t} catch (error) {\n\t\t\tif (error instanceof ApiError) {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\tthrow new ApiError(0, error instanceof Error ? error.message : 'Network error')\n\t\t}\n\t}\n\n${this.generateControllerMethods(controllerGroups)}\n}\n`\n\t}\n\n\t/**\n\t * Generates controller methods for the client.\n\t */\n\tprivate generateControllerMethods(controllerGroups: ControllerGroups): string {\n\t\tlet methods = ''\n\n\t\tfor (const [controllerName, routes] of controllerGroups) {\n\t\t\tconst className = controllerName.replace(/Controller$/, '')\n\t\t\tmethods += `\n\t// ${className} Controller\n`\n\t\t\tmethods += `\tget ${camelCase(className)}() {\n`\n\t\t\tmethods += `\t\treturn {\n`\n\n\t\t\tfor (const route of routes) {\n\t\t\t\tconst methodName = camelCase(safeToString(route.handler))\n\t\t\t\tconst httpMethod = safeToString(route.method).toLowerCase()\n\t\t\t\tconst { pathParams, queryParams, bodyParams } = this.analyzeRouteParameters(route)\n\n\t\t\t\t// Extract return type from route analysis for better type safety\n\t\t\t\tconst returnType = this.extractReturnType(route.returns)\n\n\t\t\t\tconst hasRequiredParams =\n\t\t\t\t\tpathParams.length > 0 ||\n\t\t\t\t\tqueryParams.some((p) => p.required) ||\n\t\t\t\t\t(bodyParams.length > 0 && httpMethod !== 'get')\n\n\t\t\t\t// Generate the method signature with proper typing\n\t\t\t\tmethods += `\t\t\t${methodName}: async <Result = ${returnType}>(options${hasRequiredParams ? '' : '?'}: RequestOptions<`\n\n\t\t\t\t// Path parameters type\n\t\t\t\tif (pathParams.length > 0) {\n\t\t\t\t\tconst pathParamTypes = pathParams.map((p) => {\n\t\t\t\t\t\tconst paramName = p.name\n\t\t\t\t\t\tconst paramType = p.type || 'any'\n\t\t\t\t\t\treturn `${paramName}: ${paramType}`\n\t\t\t\t\t})\n\t\t\t\t\tmethods += `{ ${pathParamTypes.join(', ')} }`\n\t\t\t\t} else {\n\t\t\t\t\tmethods += 'undefined'\n\t\t\t\t}\n\n\t\t\t\tmethods += ', '\n\n\t\t\t\t// Query parameters type\n\t\t\t\tif (queryParams.length > 0) {\n\t\t\t\t\tconst queryParamTypes = queryParams.map((p) => {\n\t\t\t\t\t\tconst paramName = p.name\n\t\t\t\t\t\tconst paramType = p.type || 'any'\n\t\t\t\t\t\treturn `${paramName}: ${paramType}`\n\t\t\t\t\t})\n\t\t\t\t\tmethods += `{ ${queryParamTypes.join(', ')} }`\n\t\t\t\t} else {\n\t\t\t\t\tmethods += 'undefined'\n\t\t\t\t}\n\n\t\t\t\tmethods += ', '\n\n\t\t\t\t// Body type\n\t\t\t\tif (bodyParams.length > 0) {\n\t\t\t\t\tconst bodyParamTypes = bodyParams.map((p) => {\n\t\t\t\t\t\tconst paramType = p.type || 'any'\n\t\t\t\t\t\treturn paramType\n\t\t\t\t\t})\n\t\t\t\t\t// Use the first body parameter type, not 'any'\n\t\t\t\t\tmethods += bodyParamTypes[0] || 'any'\n\t\t\t\t} else {\n\t\t\t\t\tmethods += 'undefined'\n\t\t\t\t}\n\n\t\t\t\tmethods += ', '\n\n\t\t\t\t// Headers type - always optional for now, but could be made conditional\n\t\t\t\tmethods += 'undefined'\n\n\t\t\t\tmethods += `>) => {\n`\n\n\t\t\t\t// Build the full API path using route information\n\t\t\t\tlet requestPath = buildFullApiPath(route)\n\n\t\t\t\t// Replace path parameters with placeholders for dynamic substitution\n\t\t\t\tif (pathParams.length > 0) {\n\t\t\t\t\tfor (const pathParam of pathParams) {\n\t\t\t\t\t\tconst paramName = pathParam.name\n\t\t\t\t\t\tconst placeholder = `:${String(pathParam.data)}`\n\t\t\t\t\t\trequestPath = requestPath.replace(placeholder, `:${paramName}`)\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tmethods += `\t\t\t\treturn this.request<Result>('${httpMethod.toUpperCase()}', \\`${requestPath}\\`, options)\n`\n\t\t\t\tmethods += `\t\t\t},\n`\n\t\t\t}\n\n\t\t\tmethods += `\t\t}\n`\n\t\t\tmethods += `\t}\n`\n\t\t}\n\n\t\treturn methods\n\t}\n\n\t/**\n\t * Extracts the proper return type from route analysis.\n\t */\n\tprivate extractReturnType(returns?: string): string {\n\t\tif (!returns) return 'any'\n\n\t\t// Handle Promise<T> types\n\t\tconst promiseMatch = returns.match(/Promise<(.+)>/)\n\t\tif (promiseMatch) {\n\t\t\treturn promiseMatch[1]\n\t\t}\n\n\t\t// Handle other types\n\t\treturn returns\n\t}\n\n\t/**\n\t * Generates schema types from integrated schema generation.\n\t */\n\tprivate generateSchemaTypes(schemas: readonly SchemaInfo[]): string {\n\t\tif (schemas.length === 0) {\n\t\t\treturn '// No schemas available from integrated Schema Generation\\n'\n\t\t}\n\n\t\tlet content = '// Schema types from integrated Schema Generation\\n'\n\t\tfor (const schemaInfo of schemas) {\n\t\t\tif (schemaInfo.typescriptType) {\n\t\t\t\tcontent += `${schemaInfo.typescriptType}\\n\\n`\n\t\t\t}\n\t\t}\n\t\treturn content\n\t}\n\n\t/**\n\t * Groups routes by controller for better organization.\n\t */\n\tprivate groupRoutesByController(routes: readonly ExtendedRouteInfo[]): ControllerGroups {\n\t\tconst groups = new Map<string, ExtendedRouteInfo[]>()\n\n\t\tfor (const route of routes) {\n\t\t\tconst controller = safeToString(route.controller)\n\t\t\tif (!groups.has(controller)) {\n\t\t\t\tgroups.set(controller, [])\n\t\t\t}\n\t\t\tgroups.get(controller)!.push(route)\n\t\t}\n\n\t\treturn groups\n\t}\n\n\t/**\n\t * Analyzes route parameters to determine their types and usage.\n\t */\n\tprivate analyzeRouteParameters(route: ExtendedRouteInfo): {\n\t\tpathParams: readonly RouteParameter[]\n\t\tqueryParams: readonly RouteParameter[]\n\t\tbodyParams: readonly RouteParameter[]\n\t} {\n\t\tconst parameters = route.parameters || []\n\n\t\tconst pathParams = parameters\n\t\t\t.filter((p) => p.decoratorType === 'param')\n\t\t\t.map((p) => ({ ...p, required: true }))\n\n\t\tconst bodyParams = parameters\n\t\t\t.filter((p) => p.decoratorType === 'body')\n\t\t\t.map((p) => ({ ...p, required: true }))\n\n\t\tconst queryParams = parameters\n\t\t\t.filter((p) => p.decoratorType === 'query')\n\t\t\t.map((p) => ({ ...p, required: p.required === true }))\n\n\t\treturn { pathParams, queryParams, bodyParams }\n\t}\n}\n","import type { ParameterMetadata } from 'honestjs'\nimport type { ExtendedRouteInfo } from '../types/route.types'\n\n/** Minimal route shape needed to build the full API path (prefix + version + route + path). */\nexport type RoutePathInput = Pick<ExtendedRouteInfo, 'prefix' | 'version' | 'route' | 'path'>\n\n/**\n * Builds the full path with parameter placeholders\n */\nexport function buildFullPath(basePath: string, parameters: readonly ParameterMetadata[]): string {\n\tif (!basePath || typeof basePath !== 'string') return '/'\n\n\tlet path = basePath\n\n\tif (parameters && Array.isArray(parameters)) {\n\t\tfor (const param of parameters) {\n\t\t\tif (param.data && typeof param.data === 'string' && param.data.startsWith(':')) {\n\t\t\t\tconst paramName = param.data.slice(1)\n\t\t\t\tpath = path.replace(`:${paramName}`, `\\${${paramName}}`)\n\t\t\t}\n\t\t}\n\t}\n\n\treturn path\n}\n\n/**\n * Builds the full API path using route information\n */\nexport function buildFullApiPath(route: RoutePathInput): string {\n\tconst prefix = route.prefix || ''\n\tconst version = route.version || ''\n\tconst routePath = route.route || ''\n\tconst path = route.path || ''\n\n\tlet fullPath = ''\n\n\t// Add prefix (e.g., /api)\n\tif (prefix && prefix !== '/') {\n\t\tfullPath += prefix.replace(/^\\/+|\\/+$/g, '')\n\t}\n\n\t// Add version (e.g., /v1)\n\tif (version && version !== '/') {\n\t\tfullPath += `/${version.replace(/^\\/+|\\/+$/g, '')}`\n\t}\n\n\t// Add route (e.g., /users)\n\tif (routePath && routePath !== '/') {\n\t\tfullPath += `/${routePath.replace(/^\\/+|\\/+$/g, '')}`\n\t}\n\n\t// Add path (e.g., /:id or /)\n\tif (path && path !== '/') {\n\t\tfullPath += `/${path.replace(/^\\/+|\\/+$/g, '')}`\n\t} else if (path === '/') {\n\t\tfullPath += '/'\n\t}\n\n\tif (fullPath && !fullPath.startsWith('/')) fullPath = '/' + fullPath\n\n\treturn fullPath || '/'\n}\n","/**\n * Safely converts a value to string, handling symbols and other types\n */\nexport function safeToString(value: unknown): string {\n\tif (typeof value === 'string') return value\n\tif (typeof value === 'symbol') return value.description || 'Symbol'\n\treturn String(value)\n}\n\n/**\n * Converts a string to camelCase\n */\nexport function camelCase(str: string): string {\n\treturn str.charAt(0).toLowerCase() + str.slice(1)\n}\n","import { createHash } from 'crypto'\nimport { existsSync, readFileSync } from 'fs'\nimport { mkdir, writeFile } from 'fs/promises'\nimport path from 'path'\n\nconst CHECKSUM_FILENAME = '.rpc-checksum'\n\nexport interface ChecksumData {\n\thash: string\n\tfiles: string[]\n}\n\n/**\n * Computes a deterministic SHA-256 hash from file contents.\n * Sorts paths before reading to ensure consistent ordering.\n * Includes the file count in the hash so adding/removing files changes it.\n */\nexport function computeHash(filePaths: string[]): string {\n\tconst sorted = [...filePaths].sort()\n\tconst hasher = createHash('sha256')\n\n\thasher.update(`files:${sorted.length}\\n`)\n\n\tfor (const filePath of sorted) {\n\t\thasher.update(readFileSync(filePath, 'utf-8'))\n\t\thasher.update('\\0')\n\t}\n\n\treturn hasher.digest('hex')\n}\n\n/**\n * Reads the stored checksum from the output directory.\n * Returns null if the file is missing or corrupt.\n */\nexport function readChecksum(outputDir: string): ChecksumData | null {\n\tconst checksumPath = path.join(outputDir, CHECKSUM_FILENAME)\n\n\tif (!existsSync(checksumPath)) return null\n\n\ttry {\n\t\tconst raw = readFileSync(checksumPath, 'utf-8')\n\t\tconst data = JSON.parse(raw) as ChecksumData\n\n\t\tif (typeof data.hash !== 'string' || !Array.isArray(data.files)) {\n\t\t\treturn null\n\t\t}\n\n\t\treturn data\n\t} catch {\n\t\treturn null\n\t}\n}\n\n/**\n * Writes the checksum data to the output directory.\n */\nexport async function writeChecksum(outputDir: string, data: ChecksumData): Promise<void> {\n\tawait mkdir(outputDir, { recursive: true })\n\tconst checksumPath = path.join(outputDir, CHECKSUM_FILENAME)\n\tawait writeFile(checksumPath, JSON.stringify(data, null, 2), 'utf-8')\n}\n","import { RouteRegistry, type ParameterMetadata, type RouteInfo } from 'honestjs'\nimport { ClassDeclaration, MethodDeclaration, Project } from 'ts-morph'\nimport { LOG_PREFIX } from '../constants/defaults'\nimport type { ExtendedRouteInfo, ParameterMetadataWithType } from '../types/route.types'\nimport { buildFullApiPath } from '../utils/path-utils'\nimport { safeToString } from '../utils/string-utils'\n\n/**\n * Service for analyzing controller methods and extracting type information\n */\nexport class RouteAnalyzerService {\n\t/**\n\t * Analyzes controller methods to extract type information\n\t */\n\tasync analyzeControllerMethods(project: Project): Promise<ExtendedRouteInfo[]> {\n\t\tconst routes = RouteRegistry.getRoutes()\n\t\tif (!routes?.length) {\n\t\t\treturn []\n\t\t}\n\n\t\tconst controllers = this.findControllerClasses(project)\n\n\t\tif (controllers.size === 0) {\n\t\t\treturn []\n\t\t}\n\n\t\treturn this.processRoutes(routes, controllers)\n\t}\n\n\t/**\n\t * Finds controller classes in the project\n\t */\n\tprivate findControllerClasses(project: Project): Map<string, ClassDeclaration> {\n\t\tconst controllers = new Map<string, ClassDeclaration>()\n\t\tconst files = project.getSourceFiles()\n\n\t\tfor (const sourceFile of files) {\n\t\t\tconst classes = sourceFile.getClasses()\n\n\t\t\tfor (const classDeclaration of classes) {\n\t\t\t\tconst className = classDeclaration.getName()\n\n\t\t\t\tif (className?.endsWith('Controller')) {\n\t\t\t\t\tcontrollers.set(className, classDeclaration)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn controllers\n\t}\n\n\t/**\n\t * Processes all routes and extracts type information\n\t */\n\tprivate processRoutes(\n\t\troutes: readonly RouteInfo[],\n\t\tcontrollers: Map<string, ClassDeclaration>\n\t): ExtendedRouteInfo[] {\n\t\tconst analyzedRoutes: ExtendedRouteInfo[] = []\n\n\t\tfor (const route of routes) {\n\t\t\ttry {\n\t\t\t\tconst extendedRoute = this.createExtendedRoute(route, controllers)\n\t\t\t\tanalyzedRoutes.push(extendedRoute)\n\t\t\t} catch (routeError) {\n\t\t\t\tconsole.warn(\n\t\t\t\t\t`${LOG_PREFIX} Skipping route ${safeToString(route.controller)}.${safeToString(route.handler)}:`,\n\t\t\t\t\trouteError\n\t\t\t\t)\n\t\t\t}\n\t\t}\n\n\t\treturn analyzedRoutes\n\t}\n\n\t/**\n\t * Creates an extended route with type information\n\t */\n\tprivate createExtendedRoute(route: RouteInfo, controllers: Map<string, ClassDeclaration>): ExtendedRouteInfo {\n\t\tconst controllerName = safeToString(route.controller)\n\t\tconst handlerName = safeToString(route.handler)\n\n\t\tconst controllerClass = controllers.get(controllerName)\n\t\tlet returns: string | undefined\n\t\tlet parameters: readonly ParameterMetadataWithType[] | undefined\n\n\t\tif (controllerClass) {\n\t\t\tconst handlerMethod = controllerClass.getMethods().find((method) => method.getName() === handlerName)\n\n\t\t\tif (handlerMethod) {\n\t\t\t\treturns = this.getReturnType(handlerMethod)\n\t\t\t\tparameters = this.getParametersWithTypes(handlerMethod, route.parameters || [])\n\t\t\t}\n\t\t}\n\n\t\treturn {\n\t\t\tcontroller: controllerName,\n\t\t\thandler: handlerName,\n\t\t\tmethod: safeToString(route.method).toUpperCase(),\n\t\t\tprefix: route.prefix,\n\t\t\tversion: route.version,\n\t\t\troute: route.route,\n\t\t\tpath: route.path,\n\t\t\tfullPath: buildFullApiPath(route),\n\t\t\tparameters,\n\t\t\treturns\n\t\t}\n\t}\n\n\t/**\n\t * Gets the return type of a method\n\t */\n\tprivate getReturnType(method: MethodDeclaration): string {\n\t\tconst type = method.getReturnType()\n\t\tconst typeText = type.getText(method)\n\n\t\tconst aliasSymbol = type.getAliasSymbol()\n\t\tif (aliasSymbol) {\n\t\t\treturn aliasSymbol.getName()\n\t\t}\n\n\t\treturn typeText.replace(/import\\(\".*?\"\\)\\./g, '')\n\t}\n\n\t/**\n\t * Gets parameters with their types\n\t */\n\tprivate getParametersWithTypes(\n\t\tmethod: MethodDeclaration,\n\t\tparameters: readonly ParameterMetadata[]\n\t): readonly ParameterMetadataWithType[] {\n\t\tconst result: ParameterMetadataWithType[] = []\n\t\tconst declaredParams = method.getParameters()\n\t\tconst sortedParams = [...parameters].sort((a, b) => a.index - b.index)\n\n\t\tfor (const param of sortedParams) {\n\t\t\tconst index = param.index\n\t\t\tconst decoratorType = param.name\n\n\t\t\tif (index < declaredParams.length) {\n\t\t\t\tconst declaredParam = declaredParams[index]\n\t\t\t\tconst paramName = declaredParam.getName()\n\t\t\t\tconst paramType = declaredParam\n\t\t\t\t\t.getType()\n\t\t\t\t\t.getText()\n\t\t\t\t\t.replace(/import\\(\".*?\"\\)\\./g, '')\n\n\t\t\t\tresult.push({\n\t\t\t\t\tindex,\n\t\t\t\t\tname: paramName,\n\t\t\t\t\tdecoratorType,\n\t\t\t\t\ttype: paramType,\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdata: param.data,\n\t\t\t\t\tfactory: param.factory,\n\t\t\t\t\tmetatype: param.metatype\n\t\t\t\t})\n\t\t\t} else {\n\t\t\t\tresult.push({\n\t\t\t\t\tindex,\n\t\t\t\t\tname: `param${index}`,\n\t\t\t\t\tdecoratorType,\n\t\t\t\t\ttype: param.metatype?.name || 'unknown',\n\t\t\t\t\trequired: true,\n\t\t\t\t\tdata: param.data,\n\t\t\t\t\tfactory: param.factory,\n\t\t\t\t\tmetatype: param.metatype\n\t\t\t\t})\n\t\t\t}\n\t\t}\n\n\t\treturn result\n\t}\n}\n","import { createGenerator } from 'ts-json-schema-generator'\nimport { MethodDeclaration, Project } from 'ts-morph'\nimport type { SchemaInfo } from '../types/schema.types'\nimport { generateTypeScriptInterface } from '../utils/schema-utils'\nimport { extractNamedType } from '../utils/type-utils'\n\n/**\n * Service for generating JSON schemas from TypeScript types used in controllers\n */\nexport class SchemaGeneratorService {\n\tconstructor(\n\t\tprivate readonly controllerPattern: string,\n\t\tprivate readonly tsConfigPath: string\n\t) {}\n\n\t/**\n\t * Generates JSON schemas from types used in controllers\n\t */\n\tasync generateSchemas(project: Project): Promise<SchemaInfo[]> {\n\t\tconst sourceFiles = project.getSourceFiles(this.controllerPattern)\n\n\t\tconst collectedTypes = this.collectTypesFromControllers(sourceFiles)\n\t\treturn this.processTypes(collectedTypes)\n\t}\n\n\t/**\n\t * Collects types from controller files\n\t */\n\tprivate collectTypesFromControllers(sourceFiles: readonly any[]): Set<string> {\n\t\tconst collectedTypes = new Set<string>()\n\n\t\tfor (const file of sourceFiles) {\n\t\t\tfor (const cls of file.getClasses()) {\n\t\t\t\tfor (const method of cls.getMethods()) {\n\t\t\t\t\tthis.collectTypesFromMethod(method, collectedTypes)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\treturn collectedTypes\n\t}\n\n\t/**\n\t * Collects types from a single method\n\t */\n\tprivate collectTypesFromMethod(method: MethodDeclaration, collectedTypes: Set<string>): void {\n\t\t// Collect parameter types\n\t\tfor (const param of method.getParameters()) {\n\t\t\tconst type = extractNamedType(param.getType())\n\t\t\tif (type) collectedTypes.add(type)\n\t\t}\n\n\t\t// Collect return type\n\t\tconst returnType = method.getReturnType()\n\t\tconst innerType = returnType.getTypeArguments()[0] ?? returnType\n\t\tconst type = extractNamedType(innerType)\n\t\tif (type) collectedTypes.add(type)\n\t}\n\n\t/**\n\t * Processes collected types to generate schemas\n\t */\n\tprivate async processTypes(collectedTypes: Set<string>): Promise<SchemaInfo[]> {\n\t\tconst schemas: SchemaInfo[] = []\n\n\t\tfor (const typeName of collectedTypes) {\n\t\t\ttry {\n\t\t\t\tconst schema = await this.generateSchemaForType(typeName)\n\t\t\t\tconst typescriptType = generateTypeScriptInterface(typeName, schema)\n\n\t\t\t\tschemas.push({\n\t\t\t\t\ttype: typeName,\n\t\t\t\t\tschema,\n\t\t\t\t\ttypescriptType\n\t\t\t\t})\n\t\t\t} catch (err) {\n\t\t\t\tconsole.error(`Failed to generate schema for ${typeName}:`, err)\n\t\t\t}\n\t\t}\n\n\t\treturn schemas\n\t}\n\n\t/**\n\t * Generates schema for a specific type\n\t */\n\tprivate async generateSchemaForType(typeName: string): Promise<Record<string, any>> {\n\t\ttry {\n\t\t\tconst generator = createGenerator({\n\t\t\t\tpath: this.controllerPattern,\n\t\t\t\ttsconfig: this.tsConfigPath,\n\t\t\t\ttype: typeName,\n\t\t\t\tskipTypeCheck: false // Enable type checking for better error detection\n\t\t\t})\n\n\t\t\treturn generator.createSchema(typeName)\n\t\t} catch (error) {\n\t\t\tconsole.error(`Failed to generate schema for type ${typeName}:`, error)\n\t\t\t// Return a basic schema structure as fallback\n\t\t\treturn {\n\t\t\t\ttype: 'object',\n\t\t\t\tproperties: {},\n\t\t\t\trequired: []\n\t\t\t}\n\t\t}\n\t}\n}\n","/**\n * Maps JSON schema types to TypeScript types\n */\nexport function mapJsonSchemaTypeToTypeScript(schema: Record<string, any>): string {\n\tconst type = schema.type as string\n\n\tswitch (type) {\n\t\tcase 'string':\n\t\t\tif (schema.enum && Array.isArray(schema.enum)) {\n\t\t\t\treturn `'${schema.enum.join(\"' | '\")}'`\n\t\t\t}\n\t\t\treturn 'string'\n\t\tcase 'number':\n\t\tcase 'integer':\n\t\t\treturn 'number'\n\t\tcase 'boolean':\n\t\t\treturn 'boolean'\n\t\tcase 'array': {\n\t\t\tconst itemType = mapJsonSchemaTypeToTypeScript(schema.items || {})\n\t\t\treturn `${itemType}[]`\n\t\t}\n\t\tcase 'object':\n\t\t\treturn 'Record<string, any>'\n\t\tdefault:\n\t\t\treturn 'any'\n\t}\n}\n\n/**\n * Generates TypeScript interface from JSON schema\n */\nexport function generateTypeScriptInterface(typeName: string, schema: Record<string, any>): string {\n\ttry {\n\t\tconst typeDefinition = schema.definitions?.[typeName]\n\t\tif (!typeDefinition) {\n\t\t\treturn `export interface ${typeName} {\\n\\t// No schema definition found\\n}`\n\t\t}\n\n\t\tconst properties = typeDefinition.properties || {}\n\t\tconst required = typeDefinition.required || []\n\n\t\tlet interfaceCode = `export interface ${typeName} {\\n`\n\n\t\tfor (const [propName, propSchema] of Object.entries(properties)) {\n\t\t\tconst isRequired = required.includes(propName)\n\t\t\tconst type = mapJsonSchemaTypeToTypeScript(propSchema as Record<string, any>)\n\t\t\tconst optional = isRequired ? '' : '?'\n\n\t\t\tinterfaceCode += `\\t${propName}${optional}: ${type}\\n`\n\t\t}\n\n\t\tinterfaceCode += '}'\n\t\treturn interfaceCode\n\t} catch (error) {\n\t\tconsole.error(`Failed to generate TypeScript interface for ${typeName}:`, error)\n\t\treturn `export interface ${typeName} {\\n\\t// Failed to generate interface\\n}`\n\t}\n}\n","import type { Type } from 'ts-morph'\nimport { BUILTIN_TYPES, GENERIC_TYPES } from '../constants/defaults'\n\n/**\n * Extracts a named type from a TypeScript type\n */\nexport function extractNamedType(type: Type): string | null {\n\tconst symbol = type.getAliasSymbol() || type.getSymbol()\n\tif (!symbol) return null\n\n\tconst name = symbol.getName()\n\n\t// Handle generic types by unwrapping them\n\tif (GENERIC_TYPES.has(name)) {\n\t\tconst inner = type.getAliasTypeArguments()?.[0] || type.getTypeArguments()?.[0]\n\t\treturn inner ? extractNamedType(inner) : null\n\t}\n\n\t// Skip built-in types\n\tif (BUILTIN_TYPES.has(name)) return null\n\n\treturn name\n}\n"],"mappings":";AAAA,OAAOA,SAAQ;AAGf,OAAOC,WAAU;AACjB,SAAS,eAAe;;;ACDjB,IAAM,kBAAkB;A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CAAC,SAAS,KAAK,QAAS,iBAAiB,IAAI,CAAC;AACpF,WAAK,UAAU;AAAA,IAChB;AAAA,EACD;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASQ,IAAI,SAAuB;AAClC,YAAQ,IAAI,GAAG,UAAU,IAAI,OAAO,EAAE;AAAA,EACvC;AAAA;AAAA;AAAA;AAAA,EAKQ,SAAS,SAAiB,OAAuB;AACxD,YAAQ,MAAM,GAAG,UAAU,IAAI,OAAO,IAAI,SAAS,EAAE;AAAA,EACtD;AACD;","names":["fs","path","path","path","type","path","fs"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@honestjs/rpc-plugin",
3
- "version": "1.4.0",
3
+ "version": "1.5.0",
4
4
  "description": "RPC plugin for HonestJS framework",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",