fets
Version:
TypeScript HTTP Framework focusing on e2e type-safety, easy setup, performance & great developer experience
32 lines (31 loc) • 1.48 kB
TypeScript
import { FetchAPI } from '@whatwg-node/server';
import { HTTPMethod, TypedRequest, TypedResponse } from './typed-fetch';
import { OnRouteHook, OpenAPIDocument, RouteHandler, RouteSchemas } from './types';
export interface PatternHandlersObj<TServerContext> {
pattern: URLPattern;
handlers: RouteHandler<TServerContext, TypedRequest, TypedResponse>[];
}
interface AddHandlerToMethodOpts<TServerContext> {
operationId?: string;
description?: string;
tags?: string[];
method: HTTPMethod;
path: string;
schemas?: RouteSchemas;
handlers: RouteHandler<TServerContext, TypedRequest, TypedResponse>[];
internal?: boolean;
onRouteHooks: OnRouteHook<TServerContext>[];
openAPIDocument: OpenAPIDocument;
basePath: string;
fetchAPI: FetchAPI;
handlersByPatternByMethod: Map<HTTPMethod, Map<URLPattern, RouteHandler<TServerContext, TypedRequest, TypedResponse>[]>>;
internalPatternsByMethod: Map<HTTPMethod, Set<URLPattern>>;
patternHandlerObjByMethod: Map<HTTPMethod, PatternHandlersObj<TServerContext>[]>;
}
declare global {
interface URLPattern {
isPattern?: boolean;
}
}
export declare function addHandlersToMethod<TServerContext>({ operationId, description, tags, method, path, schemas, handlers, internal, onRouteHooks, openAPIDocument, basePath, fetchAPI, handlersByPatternByMethod, internalPatternsByMethod, patternHandlerObjByMethod, }: AddHandlerToMethodOpts<TServerContext>): void;
export {};