UNPKG

@equinor/fusion-framework-vite-plugin-api-service

Version:

Vite plugin for proxying service discovery and mocking

20 lines (19 loc) 766 B
import type { ApiRoute } from './types.js'; /** * Error thrown when an {@link ApiRoute} fails structural validation. * * Consumers can use `instanceof InvalidRouteError` to distinguish route * validation failures from other error types. */ export declare class InvalidRouteError extends Error { constructor(message: string, options?: ErrorOptions); } /** * Validates that an {@link ApiRoute} has the minimum required structure: * a `match` pattern and at least one of `middleware` or `proxy`. * * @param route - The route definition to validate. * @throws {InvalidRouteError} When `route.match` is falsy. * @throws {InvalidRouteError} When neither `middleware` nor `proxy` is defined. */ export declare function validateRoute(route: ApiRoute): void;