import type { z } from "zod"; import { Middleware } from "../middleware/types.js"; import { InferRecordKey } from "./util.js"; import type { SecuritySchemeObject } from "openapi3-ts/oas31"; export type QueryArrayFormat = "brackets" | "comma" | "repeat"; export type QueryArrayFormats = readonly QueryArrayFormat[]; export type GlobalSpec = { authMiddleware: Record>; beforeAuthMiddleware?: readonly Middleware[]; afterAuthMiddleware?: readonly Middleware[]; openapi?: { apiName?: string; productionServerUrl?: string; securitySchemas?: Record; readonly globalSchemas?: Record; }; shouldValidateResponses?: boolean; supportedArrayFormats?: QueryArrayFormats; /** * If an endpoint accepts multiple auth methods and they all fail, this hook will be called with the errors thrown by the middlewares. * You can inspect the errors and throw a more generic error in this hook if you want. */ onMultipleAuthMiddlewareFailures?: (errors: unknown[]) => void; }; export type GetAuthMiddlewaresFromGlobalSpec = InferRecordKey;