@honestjs/rpc-plugin 1.4.1 → 1.6.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.
@@ -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/** 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 { 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()?.[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R,QAAQ;AACP,aAAO;AAAA,IACR;AAAA,EACD;AAAA,EAEQ,gBAAgB,KAAwB;AAC/C,QAAI,WAAW,EAAE,IAAI,KAAK,sBAAsB,GAAG;AAAA,MAClD,QAAQ,KAAK;AAAA,MACb,SAAS,KAAK;AAAA,IACf,CAAC;AAAA,EACF;AAAA,EAEQ,wBAAgC;AACvC,WAAO,GAAG,KAAK,gBAAgB,IAAI,KAAK,kBAAkB;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA,EAKA,UAAgB;AACf,QAAI,KAAK,SAAS;AACjB,WAAK,QAAQ,eAAe,EAAE,QAAQ,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","path","type","path","fs"]}
1
+ {"version":3,"sources":["../src/rpc.plugin.ts","../src/constants/defaults.ts","../src/generators/typescript-client.generator.ts","../src/utils/string-utils.ts","../src/utils/path-utils.ts","../src/generators/generator-utils.ts","../src/utils/hash-utils.ts","../src/utils/artifact-contract.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 { ClassDeclaration, 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 { assertRpcArtifact, RPC_ARTIFACT_VERSION } from './utils/artifact-contract'\nimport { RouteAnalyzerService } from './services/route-analyzer.service'\nimport { SchemaGeneratorService } from './services/schema-generator.service'\nimport type { ExtendedRouteInfo, GeneratedClientInfo, RPCGenerator, SchemaInfo } from './types'\n\nexport type RPCMode = 'strict' | 'best-effort'\nexport type RPCLogLevel = 'silent' | 'error' | 'warn' | 'info' | 'debug'\n\nexport interface RPCDiagnostics {\n\treadonly generatedAt: string\n\treadonly mode: RPCMode\n\treadonly dryRun: boolean\n\treadonly cache: 'hit' | 'miss' | 'bypass'\n\treadonly routesCount: number\n\treadonly schemasCount: number\n\treadonly warnings: readonly string[]\n}\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 mode?: RPCMode\n\treadonly logLevel?: RPCLogLevel\n\treadonly customClassMatcher?: (classDeclaration: ClassDeclaration) => boolean\n\treadonly failOnSchemaError?: boolean\n\treadonly failOnRouteAnalysisWarning?: 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\tprivate readonly mode: RPCMode\n\tprivate readonly logLevel: RPCLogLevel\n\tprivate readonly failOnSchemaError: boolean\n\tprivate readonly failOnRouteAnalysisWarning: boolean\n\tprivate readonly customClassMatcher?: (classDeclaration: ClassDeclaration) => boolean\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 diagnostics: RPCDiagnostics | 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.mode = options.mode ?? DEFAULT_OPTIONS.mode\n\t\tthis.logLevel = options.logLevel ?? DEFAULT_OPTIONS.logLevel\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\t\tthis.customClassMatcher = options.customClassMatcher\n\t\tthis.failOnSchemaError = options.failOnSchemaError ?? this.mode === 'strict'\n\t\tthis.failOnRouteAnalysisWarning = options.failOnRouteAnalysisWarning ?? this.mode === 'strict'\n\n\t\t// Initialize services\n\t\tthis.routeAnalyzer = new RouteAnalyzerService({\n\t\t\tcustomClassMatcher: this.customClassMatcher,\n\t\t\tonWarn: (message, details) => this.logWarn(message, details)\n\t\t})\n\t\tthis.schemaGenerator = new SchemaGeneratorService(this.controllerPattern, this.tsConfigPath, {\n\t\t\tfailOnSchemaError: this.failOnSchemaError,\n\t\t\tonWarn: (message, details) => this.logWarn(message, details)\n\t\t})\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 (!['strict', 'best-effort'].includes(this.mode)) {\n\t\t\terrors.push('Mode must be \"strict\" or \"best-effort\"')\n\t\t}\n\t\tif (!['silent', 'error', 'warn', 'info', 'debug'].includes(this.logLevel)) {\n\t\t\terrors.push('logLevel must be one of: silent, error, warn, info, debug')\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}, mode=${this.mode}`\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({ force: false, dryRun: false })\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(options: { force: boolean; dryRun: boolean }): Promise<void> {\n\t\tconst { force, dryRun } = options\n\t\tconst warnings: string[] = []\n\t\tlet cacheState: RPCDiagnostics['cache'] = force ? 'bypass' : 'miss'\n\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\tcacheState = 'hit'\n\t\t\t\t\t\tthis.logDebug('Source files unchanged - skipping regeneration')\n\t\t\t\t\t\tthis.diagnostics = {\n\t\t\t\t\t\t\tgeneratedAt: new Date().toISOString(),\n\t\t\t\t\t\t\tmode: this.mode,\n\t\t\t\t\t\t\tdryRun,\n\t\t\t\t\t\t\tcache: cacheState,\n\t\t\t\t\t\t\troutesCount: this.analyzedRoutes.length,\n\t\t\t\t\t\t\tschemasCount: this.analyzedSchemas.length,\n\t\t\t\t\t\t\twarnings: []\n\t\t\t\t\t\t}\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.logDebug('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\t\t\twarnings.push(...this.routeAnalyzer.getWarnings())\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\t\t\twarnings.push(...this.schemaGenerator.getWarnings())\n\n\t\t\tif (this.failOnRouteAnalysisWarning && this.routeAnalyzer.getWarnings().length > 0) {\n\t\t\t\tthrow new Error(`Route analysis warnings encountered in strict mode: ${this.routeAnalyzer.getWarnings().join('; ')}`)\n\t\t\t}\n\n\t\t\t// Step 3: Run configured generators\n\t\t\tif (!dryRun) {\n\t\t\t\tthis.generatedInfos = await this.runGenerators()\n\t\t\t}\n\n\t\t\tif (!dryRun) {\n\t\t\t\t// Write checksum after successful generation\n\t\t\t\tawait writeChecksum(this.outputDir, { hash: computeHash(filePaths), files: filePaths })\n\t\t\t\tthis.writeArtifactToDisk()\n\t\t\t}\n\n\t\t\tthis.diagnostics = {\n\t\t\t\tgeneratedAt: new Date().toISOString(),\n\t\t\t\tmode: this.mode,\n\t\t\t\tdryRun,\n\t\t\t\tcache: cacheState,\n\t\t\t\troutesCount: this.analyzedRoutes.length,\n\t\t\t\tschemasCount: this.analyzedSchemas.length,\n\t\t\t\twarnings\n\t\t\t}\n\t\t\tthis.writeDiagnosticsToDisk()\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: boolean): Promise<void>\n\tasync analyze(options: { force?: boolean; dryRun?: boolean }): Promise<void>\n\tasync analyze(forceOrOptions: boolean | { force?: boolean; dryRun?: boolean } = true): Promise<void> {\n\t\tconst options =\n\t\t\ttypeof forceOrOptions === 'boolean'\n\t\t\t\t? { force: forceOrOptions, dryRun: false }\n\t\t\t\t: { force: forceOrOptions.force ?? true, dryRun: forceOrOptions.dryRun ?? false }\n\n\t\tawait this.analyzeEverything(options)\n\t\tif (this.app && !options.dryRun) {\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\tgetDiagnostics(): RPCDiagnostics | null {\n\t\treturn this.diagnostics\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 getDiagnosticsPath(): string {\n\t\treturn path.join(this.outputDir, 'rpc-diagnostics.json')\n\t}\n\n\tprivate writeArtifactToDisk(): void {\n\t\tconst artifact = {\n\t\t\tartifactVersion: RPC_ARTIFACT_VERSION,\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 writeDiagnosticsToDisk(): void {\n\t\tif (!this.diagnostics) return\n\t\tfs.mkdirSync(this.outputDir, { recursive: true })\n\t\tfs.writeFileSync(this.getDiagnosticsPath(), JSON.stringify(this.diagnostics, null, 2))\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\tartifactVersion?: unknown\n\t\t\t\troutes?: unknown\n\t\t\t\tschemas?: unknown\n\t\t\t}\n\t\t\tif (parsed.artifactVersion === undefined) {\n\t\t\t\tif (!Array.isArray(parsed.routes) || !Array.isArray(parsed.schemas)) {\n\t\t\t\t\treturn false\n\t\t\t\t}\n\t\t\t\tthis.analyzedRoutes = parsed.routes as ExtendedRouteInfo[]\n\t\t\t\tthis.analyzedSchemas = parsed.schemas as SchemaInfo[]\n\t\t\t} else {\n\t\t\t\tassertRpcArtifact(parsed)\n\t\t\t\tthis.analyzedRoutes = parsed.routes as ExtendedRouteInfo[]\n\t\t\t\tthis.analyzedSchemas = parsed.schemas as SchemaInfo[]\n\t\t\t}\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\tartifactVersion: RPC_ARTIFACT_VERSION,\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\tif (this.canLog('info')) {\n\t\t\tconsole.log(`${LOG_PREFIX} ${message}`)\n\t\t}\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\tif (this.canLog('error')) {\n\t\t\tconsole.error(`${LOG_PREFIX} ${message}`, error || '')\n\t\t}\n\t}\n\n\tprivate logWarn(message: string, details?: unknown): void {\n\t\tif (this.canLog('warn')) {\n\t\t\tconsole.warn(`${LOG_PREFIX} ${message}`, details || '')\n\t\t}\n\t}\n\n\tprivate logDebug(message: string): void {\n\t\tif (this.canLog('debug')) {\n\t\t\tconsole.log(`${LOG_PREFIX} ${message}`)\n\t\t}\n\t}\n\n\tprivate canLog(level: 'error' | 'warn' | 'info' | 'debug'): boolean {\n\t\tconst order: Record<RPCLogLevel, number> = {\n\t\t\tsilent: 0,\n\t\t\terror: 1,\n\t\t\twarn: 2,\n\t\t\tinfo: 3,\n\t\t\tdebug: 4\n\t\t}\n\n\t\treturn order[this.logLevel] >= order[level]\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\tmode: 'best-effort',\n\tlogLevel: 'info',\n\tartifactVersion: '1',\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 { camelCase, safeToString } from '../utils/string-utils'\nimport { buildNormalizedRequestPath, groupRoutesByController } from './generator-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 = 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 contentType = response.headers.get('content-type') || ''\n\t\t\tconst isJson = contentType.includes('application/json') || contentType.includes('+json')\n\t\t\tconst responseData = isJson ? await response.json() : await response.text()\n\n\t\t\tif (!response.ok) {\n\t\t\t\tconst message =\n\t\t\t\t\ttypeof responseData === 'object' && responseData && 'message' in (responseData as Record<string, unknown>)\n\t\t\t\t\t\t? String((responseData as Record<string, unknown>).message)\n\t\t\t\t\t\t: typeof responseData === 'string' && responseData.trim()\n\t\t\t\t\t\t\t? responseData\n\t\t\t\t\t\t\t: 'Request failed'\n\t\t\t\tthrow new ApiError(response.status, message)\n\t\t\t}\n\n\t\t\treturn responseData as T\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 normalized path with stable parameter placeholders\n\t\t\t\tconst requestPath = buildNormalizedRequestPath(route)\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 * 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","/**\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 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","import type { ControllerGroups, ExtendedRouteInfo } from '../types/route.types'\nimport { buildFullApiPath } from '../utils/path-utils'\nimport { safeToString } from '../utils/string-utils'\n\n/**\n * Groups analyzed routes by controller.\n */\nexport function groupRoutesByController(routes: readonly ExtendedRouteInfo[]): ControllerGroups {\n\tconst groups = new Map<string, ExtendedRouteInfo[]>()\n\n\tfor (const route of routes) {\n\t\tconst controller = safeToString(route.controller)\n\t\tif (!groups.has(controller)) {\n\t\t\tgroups.set(controller, [])\n\t\t}\n\t\tgroups.get(controller)!.push(route)\n\t}\n\n\treturn groups\n}\n\n/**\n * Builds a normalized request path where parameter placeholders are rewritten\n * to use parameter names inferred by analysis.\n */\nexport function buildNormalizedRequestPath(route: ExtendedRouteInfo): string {\n\tlet requestPath = buildFullApiPath(route)\n\n\tfor (const parameter of route.parameters ?? []) {\n\t\tif (parameter.decoratorType !== 'param') continue\n\n\t\tconst placeholder = `:${String(parameter.data ?? parameter.name)}`\n\t\trequestPath = requestPath.replace(placeholder, `:${parameter.name}`)\n\t}\n\n\treturn requestPath\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 type { RpcArtifact } from '../types'\n\nexport const RPC_ARTIFACT_VERSION = '1'\n\nexport function isRpcArtifact(value: unknown): value is RpcArtifact {\n\tif (!value || typeof value !== 'object' || Array.isArray(value)) return false\n\tconst obj = value as Record<string, unknown>\n\treturn typeof obj.artifactVersion === 'string' && Array.isArray(obj.routes) && Array.isArray(obj.schemas)\n}\n\nexport function assertRpcArtifact(value: unknown): asserts value is RpcArtifact {\n\tif (!isRpcArtifact(value)) {\n\t\tthrow new Error('Invalid RPC artifact: expected { artifactVersion, routes, schemas }')\n\t}\n\tif (value.artifactVersion !== RPC_ARTIFACT_VERSION) {\n\t\tthrow new Error(\n\t\t\t`Unsupported RPC artifact version '${value.artifactVersion}'. Supported: ${RPC_ARTIFACT_VERSION}.`\n\t\t)\n\t}\n}\n","import { RouteRegistry, type ParameterMetadata, type RouteInfo } from 'honestjs'\nimport { ClassDeclaration, MethodDeclaration, Project } from 'ts-morph'\nimport type { ExtendedRouteInfo, ParameterMetadataWithType } from '../types/route.types'\nimport { buildFullApiPath } from '../utils/path-utils'\nimport { safeToString } from '../utils/string-utils'\n\nexport interface RouteAnalyzerOptions {\n\treadonly customClassMatcher?: (classDeclaration: ClassDeclaration) => boolean\n\treadonly onWarn?: (message: string, details?: unknown) => void\n}\n\n/**\n * Service for analyzing controller methods and extracting type information\n */\nexport class RouteAnalyzerService {\n\tprivate readonly customClassMatcher?: (classDeclaration: ClassDeclaration) => boolean\n\tprivate readonly onWarn?: (message: string, details?: unknown) => void\n\tprivate warnings: string[] = []\n\n\tconstructor(options: RouteAnalyzerOptions = {}) {\n\t\tthis.customClassMatcher = options.customClassMatcher\n\t\tthis.onWarn = options.onWarn\n\t}\n\n\tgetWarnings(): readonly string[] {\n\t\treturn this.warnings\n\t}\n\n\t/**\n\t * Analyzes controller methods to extract type information\n\t */\n\tasync analyzeControllerMethods(project: Project): Promise<ExtendedRouteInfo[]> {\n\t\tthis.warnings = []\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 && this.isControllerClass(classDeclaration, className)) {\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\tprivate isControllerClass(classDeclaration: ClassDeclaration, _className: string): boolean {\n\t\tif (this.customClassMatcher) {\n\t\t\treturn this.customClassMatcher(classDeclaration)\n\t\t}\n\t\tconst decoratorNames = classDeclaration.getDecorators().map((decorator) => decorator.getName())\n\t\treturn decoratorNames.includes('Controller') || decoratorNames.includes('View')\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\tconst warning = `Skipping route ${safeToString(route.controller)}.${safeToString(route.handler)}`\n\t\t\t\tthis.warnings.push(warning)\n\t\t\t\tthis.onWarn?.(warning, routeError)\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} else {\n\t\t\tconst warning = `Controller class not found in source files: ${controllerName} (handler: ${handlerName})`\n\t\t\tthis.warnings.push(warning)\n\t\t\tthis.onWarn?.(warning)\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\nexport interface SchemaGeneratorOptions {\n\treadonly failOnSchemaError?: boolean\n\treadonly onWarn?: (message: string, details?: unknown) => void\n}\n\n/**\n * Service for generating JSON schemas from TypeScript types used in controllers\n */\nexport class SchemaGeneratorService {\n\tprivate readonly failOnSchemaError: boolean\n\tprivate readonly onWarn?: (message: string, details?: unknown) => void\n\tprivate warnings: string[] = []\n\n\tconstructor(\n\t\tprivate readonly controllerPattern: string,\n\t\tprivate readonly tsConfigPath: string,\n\t\toptions: SchemaGeneratorOptions = {}\n\t) {\n\t\tthis.failOnSchemaError = options.failOnSchemaError ?? false\n\t\tthis.onWarn = options.onWarn\n\t}\n\n\tgetWarnings(): readonly string[] {\n\t\treturn this.warnings\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\tthis.warnings = []\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\tif (this.failOnSchemaError) {\n\t\t\t\t\tthrow err\n\t\t\t\t}\n\n\t\t\t\tconst warning = `Failed to generate schema for ${typeName}`\n\t\t\t\tthis.warnings.push(warning)\n\t\t\t\tthis.onWarn?.(warning, 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\tif (this.failOnSchemaError) {\n\t\t\t\tthrow error\n\t\t\t}\n\t\t\tconst warning = `Failed to generate schema for type ${typeName}`\n\t\t\tthis.warnings.push(warning)\n\t\t\tthis.onWarn?.(warning, 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,SAA2B,eAAe;;;ACDnC,IAAM,kBAAkB;AAAA,EAC9B,mBAAmB;AAAA,EACnB,cAAc;AAAA,EACd,WAAW;AAAA,EACX,gBAAgB;AAAA,EAChB,MAAM;AAAA,EACN,UAAU;AAAA,EACV,iBAAiB;AAAA,EACjB,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,QAAQ,SAAS,CAAC;AAKvF,IAAM,gBAAgB,oBAAI,IAAI,CAAC,SAAS,WAAW,SAAS,CAAC;;;AChDpE,OAAO,QAAQ;AACf,OAAO,UAAU;;;ACEV,SAAS,aAAa,OAAwB;AACpD,MAAI,OAAO,UAAU,SAAU,QAAO;AACtC,MAAI,OAAO,UAAU,SAAU,QAAO,MAAM,eAAe;AAC3D,SAAO,OAAO,KAAK;AACpB;AAKO,SAAS,UAAU,KAAqB;AAC9C,SAAO,IAAI,OAAO,CAAC,EAAE,YAAY,IAAI,IAAI,MAAM,CAAC;AACjD;;;ACLO,SAAS,cAAc,UAAkB,YAAkD;AACjG,MAAI,CAAC,YAAY,OAAO,aAAa,SAAU,QAAO;AAEtD,MAAIC,QAAO;AAEX,MAAI,cAAc,MAAM,QAAQ,UAAU,GAAG;AAC5C,eAAW,SAAS,YAAY;AAC/B,UAAI,MAAM,QAAQ,OAA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qC;AAAA,MAC1C,QAAQ;AAAA,MACR,OAAO;AAAA,MACP,MAAM;AAAA,MACN,MAAM;AAAA,MACN,OAAO;AAAA,IACR;AAEA,WAAO,MAAM,KAAK,QAAQ,KAAK,MAAM,KAAK;AAAA,EAC3C;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.1",
3
+ "version": "1.6.0",
4
4
  "description": "RPC plugin for HonestJS framework",
5
5
  "main": "./dist/index.js",
6
6
  "module": "./dist/index.mjs",