import { OperationGenerator as Generator } from '@kubb/plugin-oas' import { Oas } from '@kubb/plugin-oas/components' import { App, createRoot } from '@kubb/react' import { Client, Operations } from './components/index.ts' import type { Operation } from '@kubb/oas' import type { OperationMethodResult, OperationsByMethod } from '@kubb/plugin-oas' import type { FileMeta, PluginClient } from './types.ts' export class OperationGenerator extends Generator { async all(operations: Operation[], _operationsByMethod: OperationsByMethod): OperationMethodResult { const { pluginManager, oas, plugin, mode } = this.context const root = createRoot({ logger: pluginManager.logger, }) const templates = { operations: Operations.templates, client: Client.templates, ...this.options.templates, } root.render( {templates.operations && } , ) return root.files } async operation(operation: Operation, options: PluginClient['resolvedOptions']): OperationMethodResult { const { oas, pluginManager, plugin, mode } = this.context const root = createRoot({ logger: pluginManager.logger, }) const templates = { operations: Operations.templates, client: Client.templates, ...options.templates, } if (!templates.client) { return [] } root.render( , ) return root.files } }