UNPKG

@lodestar/api

Version:

A Typescript REST client for the Ethereum Consensus API

20 lines 976 B
import type * as fastify from "fastify"; import { Endpoint, RouteDefinition, RouteDefinitions } from "../types.js"; import { FastifyHandler } from "./handler.js"; import { ApplicationMethod, ApplicationMethods } from "./method.js"; export type FastifySchema = fastify.FastifySchema & { operationId: string; tags?: string[]; }; export type FastifyRoute<E extends Endpoint> = { url: string; method: fastify.HTTPMethods; handler: FastifyHandler<E>; schema: FastifySchema; }; export type FastifyRoutes<Es extends Record<string, Endpoint>> = { [K in keyof Es]: FastifyRoute<Es[K]>; }; export declare function createFastifyRoute<E extends Endpoint>(definition: RouteDefinition<E>, method: ApplicationMethod<E>, operationId: string): FastifyRoute<E>; export declare function createFastifyRoutes<Es extends Record<string, Endpoint>>(definitions: RouteDefinitions<Es>, methods: ApplicationMethods<Es>): FastifyRoutes<Es>; //# sourceMappingURL=route.d.ts.map