@vibeship/devtools
Version:
Comprehensive markdown-based project management system with AI capabilities for Next.js applications
110 lines (101 loc) • 3.06 kB
text/typescript
import * as next_server from 'next/server';
import { NextRequest } from 'next/server';
/**
* Types for the Vibeship DevTools API
*/
interface ApiConfig {
scanPaths?: string[];
include?: string[];
exclude?: string[];
features?: {
tasks?: boolean;
ai?: boolean;
realtime?: boolean;
files?: boolean;
health?: boolean;
};
security?: {
authentication?: boolean;
rateLimit?: boolean;
cors?: boolean;
allowedPaths?: string[];
};
cache?: {
enabled?: boolean;
ttl?: number;
};
}
interface HandlerOptions {
config?: ApiConfig;
basePath?: string;
enableCors?: boolean;
enableHealthCheck?: boolean;
}
interface RouteContext {
config: ApiConfig;
request: Request;
requestId: string;
basePath: string;
}
interface ApiResponse {
data?: any;
error?: {
code: string;
message: string;
cause?: string;
solution?: string;
docs?: string;
};
meta?: {
requestId: string;
timestamp: string;
version: string;
};
}
/**
* Main API handler for Vibeship DevTools
* Handles dynamic routing and middleware pipeline
*/
/**
* Create a unified handler for all HTTP methods
*/
declare function createHandler(options?: HandlerOptions): (request: NextRequest) => Promise<Response>;
declare const GET: (request: next_server.NextRequest) => Promise<Response>;
declare const POST: (request: next_server.NextRequest) => Promise<Response>;
declare const PUT: (request: next_server.NextRequest) => Promise<Response>;
declare const DELETE: (request: next_server.NextRequest) => Promise<Response>;
declare const PATCH: (request: next_server.NextRequest) => Promise<Response>;
declare const OPTIONS: (request: next_server.NextRequest) => Promise<Response>;
/**
* Configuration loading for the API handler
* Supports multiple loading strategies with fallbacks
*/
/**
* Default configuration that works out of the box
*/
declare function getDefaultApiConfig(): ApiConfig;
/**
* Load configuration with multiple fallback strategies
*/
declare function loadApiConfig(): Promise<ApiConfig>;
/**
* Response utilities for the API handler
*/
/**
* Create a successful API response
*/
declare function createApiResponse(data: any, requestId: string, status?: number): Response;
/**
* Create an error response
*/
declare function createErrorResponse(code: string, status: number, details: {
message: string;
cause?: string;
solution?: string;
docs?: string;
}, requestId: string, debugInfo?: any): Response;
/**
* Create a streaming response for real-time data
*/
declare function createStreamResponse(requestId: string, onStream: (send: (data: any) => void) => Promise<void>): Response;
export { type ApiConfig, type ApiResponse, DELETE, GET, type HandlerOptions, OPTIONS, PATCH, POST, PUT, type RouteContext, createApiResponse, createErrorResponse, createHandler, createStreamResponse, getDefaultApiConfig, loadApiConfig };