import { J as JsonValue, O as OpenAPIDocument } from './types-Dzi0PpYX.js'; import { S as SpecOverlay } from './overlay-B5pr09Ul.js'; /** * Raised when a `target` string doesn't parse as one of the * recognised shapes. The thrown error carries the offending `target` * verbatim so the caller can locate it in an overlay document with * many actions. */ declare class UnrecognisedTargetError extends Error { readonly target: string; constructor(target: string, reason: string); } /** * Translator from OpenAPI Overlay 1.0 spec-format documents to * `@oav/spec`'s typed `SpecOverlay`. The runtime does not ship a * JSONPath engine; it matches `target` strings against a closed set * of shapes documented in this package's README and throws a * locating error on anything outside that set. * * Two entry points: * * translateOverlay(doc): SpecOverlay * // Parses doc.actions one by one and returns the aggregated * // typed overlay. Pure: no document is touched. * * applySpecOverlay(base, doc): OpenAPIDocument * // Convenience: translate then delegate to `applyOverlays`. * * @packageDocumentation */ /** * One action from an OpenAPI Overlay 1.0 document. Either `update` * carries an additive / merging payload, or `remove: true` zeroes the * target. Setting both on the same action is rejected at translate * time. * * @public */ interface OverlayAction { target: string; update?: JsonValue; remove?: boolean; } /** * An OpenAPI Overlay 1.0 document. Mirrors the spec envelope * (https://spec.openapis.org/overlay/1.0.0). Fields outside `actions` * are metadata and are not consumed by the translator. * * @public */ interface OverlayDocument { overlay: string; info: { title: string; version: string; }; /** Optional target hint from the spec; the translator ignores it. */ extends?: string; actions: OverlayAction[]; } /** * Whether `value` carries the OpenAPI Overlay 1.0 envelope * ({@link OverlayDocument}): an object with an `overlay` version * string, an `info` object, and an `actions` array. Envelope-level * only; per-action validation happens in {@link translateOverlay}, * which throws a locating error on malformed actions. Pairs with * `@oav/spec`'s `isSpecOverlay` for callers discriminating an overlay * file of unknown format. * * @public */ declare function isOverlayDocument(value: unknown): value is OverlayDocument; /** * Translate one OpenAPI Overlay document into a typed * {@link @oav/spec!SpecOverlay}. Pure: returns a fresh overlay; the * input document is not mutated. * * @throws {@link UnrecognisedTargetError} when any action's `target` * JSONPath doesn't match a recognised shape. * @throws `Error` when an action carries both `update` and * `remove: true`, or when the action's payload shape doesn't * match the target (e.g. non-object where an object is * expected). * * @public */ declare function translateOverlay(doc: OverlayDocument): SpecOverlay; /** * Translate the overlay document and apply it to `base` in one call. * Equivalent to * `applyOverlays(base, [translateOverlay(doc)])`. * * @public */ declare function applySpecOverlay(base: OpenAPIDocument, doc: OverlayDocument): OpenAPIDocument; export { type OverlayAction, type OverlayDocument, UnrecognisedTargetError, applySpecOverlay, isOverlayDocument, translateOverlay };