@7nohe/openapi-react-query-codegen
Version:
OpenAPI React Query Codegen
54 lines (53 loc) • 2.23 kB
text/typescript
import { type ImportDeclarationStructure, Project } from "ts-morph";
import type { GenerationContext } from "../types.mjs";
/**
* Create a shared ts-morph Project for code generation.
* Uses consistent formatting settings to match existing output.
*/
export declare function createGenerationProject(): Project;
/**
* Build import structure for the Options type.
* sdk.gen re-exports Options extended with `client` and `meta`, which the
* base client Options lacks; hooks must accept those properties.
*/
export declare function buildClientImport(_ctx: GenerationContext): ImportDeclarationStructure;
/**
* Build import structure for TanStack Query.
*/
export declare function buildQueryImport(): ImportDeclarationStructure;
/**
* Build import structure for the queryOptions/infiniteQueryOptions helpers.
*/
export declare function buildQueryOptionsImport(): ImportDeclarationStructure;
/**
* Build import structure for services.
*/
export declare function buildServiceImport(ctx: GenerationContext): ImportDeclarationStructure;
/**
* Build import structure for models.
* Emitted as a type-only import so generated code compiles under
* `verbatimModuleSyntax` (enabled by default in recent Vite templates).
*/
export declare function buildModelImport(ctx: GenerationContext): ImportDeclarationStructure | null;
/**
* Build import structure for axios error type.
*/
export declare function buildAxiosErrorImport(): ImportDeclarationStructure;
/**
* Build import for Common namespace.
*/
export declare function buildCommonImport(): ImportDeclarationStructure;
/**
* Build all imports needed for the common file.
*/
export declare function buildCommonFileImports(ctx: GenerationContext): ImportDeclarationStructure[];
/**
* Build all imports needed for hook files (queries, suspense, infinite).
*/
export declare function buildHookFileImports(ctx: GenerationContext): ImportDeclarationStructure[];
/**
* Build all imports needed for the queryOptions file.
* Narrower than the hook file imports: queryOptions only needs the
* queryOptions/infiniteQueryOptions helpers, not the TanStack hooks.
*/
export declare function buildQueryOptionsFileImports(ctx: GenerationContext): ImportDeclarationStructure[];