quickwire
Version:
Automatic API generator for Next.js applications that creates API routes and TypeScript client functions from backend functions
113 lines • 3.44 kB
TypeScript
import { ModuleExports } from "./types";
interface FileMetadata {
generatedAt: number;
sourceFile: string;
checksum: string;
}
export declare const generatedFiles: Map<string, FileMetadata>;
interface OpenApiSchema {
type?: string;
format?: string;
items?: OpenApiSchema;
properties?: Record<string, OpenApiSchema>;
required?: string[];
oneOf?: OpenApiSchema[];
description?: string;
}
interface OpenApiParameter {
name: string;
in: 'query' | 'path' | 'header' | 'cookie';
required?: boolean;
schema: OpenApiSchema;
description?: string;
}
interface OpenApiRequestBody {
required?: boolean;
content: {
'application/json'?: {
schema: OpenApiSchema;
};
'multipart/form-data'?: {
schema: OpenApiSchema;
};
};
}
interface OpenApiResponse {
description: string;
content?: {
'application/json'?: {
schema: OpenApiSchema;
};
};
}
interface OpenApiPathItem {
summary?: string;
description?: string;
tags?: string[];
operationId?: string;
parameters?: OpenApiParameter[];
requestBody?: OpenApiRequestBody;
responses: Record<string, OpenApiResponse>;
}
interface OpenApiSpec {
openapi: string;
info: {
title: string;
description: string;
version: string;
contact?: {
name: string;
};
'x-generated-at'?: string;
};
servers: Array<{
url: string;
description: string;
}>;
paths: Record<string, Record<string, OpenApiPathItem>>;
tags: Array<{
name: string;
description: string;
}>;
}
export declare const docCache: Map<string, OpenApiSpec>;
export declare const backendToGenerated: Map<string, Set<string>>;
export declare const deletedFiles: Set<string>;
export declare const changedFiles: Set<string>;
export declare const fileOperationQueue: Set<() => Promise<void>>;
declare function calculateFileChecksum(filePath: string): string;
declare function ensureDirectoryExists(dirPath: string): boolean;
declare function safeWriteFile(filePath: string, content: string, sourceFile: string): boolean;
declare function safeRemoveFile(filePath: string): boolean;
export declare function markFileChanged(filePath: string): void;
export declare function markFileDeleted(filePath: string): void;
export declare function generateQuickwireFile(filePath: string, endpoints: Record<string, {
route: string;
method: string;
}>, moduleExports?: ModuleExports): boolean;
export declare function generateApiRoutesForFile(filePath: string, moduleExports?: ModuleExports): Record<string, {
route: string;
method: string;
}>;
export declare function processBackendFile(filePath: string): boolean;
export declare function scanAllBackendFunctions(): Promise<void>;
export declare function getGenerationStats(): {
totalGenerated: number;
bySourceFile: Record<string, number>;
oldestFile: {
path: string;
age: number;
} | null;
newestFile: {
path: string;
age: number;
} | null;
};
export declare function validateGeneratedFiles(): {
valid: number;
invalid: number;
missing: number;
};
export declare function recoverFromCorruption(): boolean;
export { ensureDirectoryExists, safeWriteFile, safeRemoveFile, calculateFileChecksum, };
//# sourceMappingURL=generator.d.ts.map