import type { OperationInsertable } from './types.js'; import type { OasOperation } from '../../oas/operation/Operation.js'; import type { ContentSettings } from '../ContentSettings.js'; import type { GeneratedDefinition, GenerationType } from '../../types/GeneratedValue.js'; import type { GeneratedValue } from '../../types/GeneratedValue.js'; import type { GenerateContext } from '../../context/GenerateContext.js'; type CreateOperationArgs = { context: GenerateContext; insertable: OperationInsertable; operation: OasOperation; generation?: T; destinationPath?: string; noExport?: boolean; }; /** * Driver class for generating operation-based artifacts from OpenAPI operations. * * The `OperationDriver` manages the transformation of OpenAPI operation objects * into code artifacts, handling path generation, identifier resolution, and * definition management. It serves as the core orchestrator for operation-based * code generation in the SKMTC pipeline. * * @template V - Type of generated values produced by this driver * @template T - Type of generation strategy (e.g., 'function', 'class', 'hook') * @template EnrichmentType - Type of enrichments that can be applied * * @example Basic usage in an operation generator * ```typescript * class APIClientGenerator extends OperationBase { * generate() { * const driver = new OperationDriver({ * context: this.context, * insertable: this, * operation: this.operation, * generation: 'function' * }); * * const functionCode = driver.definition.toValueString(); * const file = this.createFile(functionCode); * this.register({ file }); * } * } * ``` */ export declare class OperationDriver { /** The generation context providing access to OAS objects and utilities */ context: GenerateContext; /** The insertable object that provides generation configuration */ insertable: OperationInsertable; /** The OpenAPI operation object being processed */ operation: OasOperation; /** Content settings for customizing generation behavior */ settings: ContentSettings; /** Optional custom destination path for generated files */ destinationPath?: string; /** The generated definition containing the transformed operation */ definition: GeneratedDefinition; /** Whether to exclude this operation from exports */ noExport?: boolean; /** * Creates a new OperationDriver instance. * * @param args - Configuration for the operation driver * @param args.context - Generation context * @param args.insertable - Insertable providing generation configuration * @param args.operation - OpenAPI operation to process * @param args.generation - Optional generation type * @param args.destinationPath - Optional custom destination path * @param args.noExport - Whether to exclude from exports */ constructor({ context, insertable, operation, generation, destinationPath, noExport }: CreateOperationArgs); /** * Applies generation configuration to create the operation definition. * * This method handles the core generation logic for operations, including * identifier resolution, export path management, and import registration * for cross-file dependencies. * * @template T - The generation type * @param args - Apply configuration arguments * @param args.generation - Optional generation type (unused currently) * @param args.destinationPath - Optional destination path for imports * @returns Generated definition for the operation */ private apply; /** * Retrieves or creates a definition for the operation. * * This method first checks for cached definitions to avoid duplicate generation, * then creates a new definition if none exists. It handles the complete operation * transformation process including schema resolution and value generation. * * @param args - Definition retrieval arguments * @param args.identifier - The identifier for the definition * @param args.exportPath - The export path for the definition * @returns Operation definition instance */ private getDefinition; /** * Type guard to verify a definition matches the expected generated value type. * * This method performs type narrowing to ensure a cached definition is compatible * with the current generation requirements, including export path validation. * * @template V - The expected generated value type * @param definition - The definition to verify (may be undefined) * @param exportPath - Expected export path for validation * @returns True if definition matches expected type and constraints */ private affirmDefinition; } export {}; //# sourceMappingURL=OperationDriver.d.ts.map