import * as av from "anyvali"; import type { Infer } from "anyvali"; import { RenderMode } from "../contracts/common.js"; import { JsonValue } from "../contracts/json.js"; import { CacheHints, HtmlRepresentationSupport, ViewMetadata } from "../contracts/view.js"; import type { ApiAuthRequirement } from "../contracts/route.js"; import { RequestedRepresentation } from "./media.js"; type AnySchema = av.BaseSchema; export interface HtmlRenderableLike { toString(): string; } export type HtmlRenderable = string | HtmlRenderableLike; export interface ViewSchemas { params: ParamsSchema; query: QuerySchema; headers: HeadersSchema; body: BodySchema; response: ResponseSchema; } export interface CreateViewDefinitionInput { viewId: string; operationId: string; title: string; description: string; path: string; method: "GET" | "POST" | "PUT" | "PATCH" | "DELETE" | "OPTIONS"; schemas: ViewSchemas; html: HtmlRepresentationSupport; auth: ApiAuthRequirement; demoScenarios?: ReadonlyArray<{ id: string; title: string; response: Infer; }>; cacheHints: CacheHints; } export interface BetterPortalViewDefinition extends CreateViewDefinitionInput { toMetadata(): ViewMetadata; } export interface NegotiatedViewResponse { status: number; contentType: string; body: JsonValue | HtmlRenderable; } export declare function createViewDefinition(input: CreateViewDefinitionInput): BetterPortalViewDefinition; export declare function negotiateViewResponse(view: BetterPortalViewDefinition, acceptHeader: string | undefined, jsonBody: Infer, rendererKey: string | undefined, renderHtml: ((renderer: string, mode: RenderMode, body: Infer) => HtmlRenderable) | undefined): NegotiatedViewResponse; export declare function resolveRepresentationFromAccept(acceptHeader?: string): RequestedRepresentation; export {}; //# sourceMappingURL=view.d.ts.map