import { A as UnknownField, D as StringField, b as NumberField, c as FieldBase, d as FieldOverrides, j as WalkedField, o as Editability, p as FileField, r as BooleanField, v as NullField, w as SchemaMeta } from "../types-BBQaEPfE.mjs"; import { i as DiagnosticsOptions } from "../diagnostics-mftUZI7c.mjs"; import { t as ExternalResolver } from "../ref-DWrQG1Er.mjs"; //#region src/core/walkBuilders.d.ts /** Read a key from a JSON object, returning the value when it is a string and `undefined` otherwise. */ declare function getString(obj: Record, key: string): string | undefined; /** Read a key from a JSON object, returning the value when it is an array and `undefined` otherwise. */ declare function getArray(obj: Record, key: string): unknown[] | undefined; /** Read a key from a JSON object, returning the value when it is a plain object and `undefined` otherwise. */ declare function getObject(obj: Record, key: string): Record | undefined; /** * Options accepted by `walk`. Use to inject meta overrides, field-level * overrides, the root document for cross-document `$ref` resolution, a * diagnostics sink, and an external `$ref` resolver. * * `WalkOptions` is generic in the schema's value type so callers that * walk a typed schema can carry `FieldOverrides` through. The * default `T = unknown` preserves the loose runtime record shape for * existing non-generic callers — `Record`. * * @group Walkers */ interface WalkOptions { componentMeta?: SchemaMeta | undefined; rootMeta?: SchemaMeta | undefined; /** * Nested field overrides — same shape as the schema. * * Typed against `FieldOverrides` when a schema value type is * supplied; falls back to `Record` for the * default `T = unknown` so the loose runtime shape continues to * compile. */ fieldOverrides?: unknown extends T ? Record | undefined : FieldOverrides | undefined; /** The root document for $ref resolution. */ rootDocument?: Record | undefined; /** Diagnostics channel for surfacing silent fallbacks. */ diagnostics?: DiagnosticsOptions; /** Sync resolver for external $ref URIs. */ externalResolver?: ExternalResolver; } /** * Extract recognised meta keywords (`readOnly`, `writeOnly`, * `description`, `title`, `deprecated`, `default`, `component`, * `example`, `examples`) from a JSON Schema node into the `SchemaMeta` * shape consumed by the walker. */ declare function extractMetaFromJson(schema: Record): SchemaMeta; /** * Project the meta-style keys (`readOnly`, `writeOnly`, `description`, * `title`, `deprecated`, `component`, `visible`, `order`) out of a * field override object into a `SchemaMeta`. Returns `undefined` when * the override has no meta fields so the walker can short-circuit. */ declare function extractSchemaMetaFields(overrides: Record | undefined): SchemaMeta | undefined; /** * Pluck the nested override at `key` from a parent field override map. * Returns `undefined` when no override is present or when the entry is * not a non-array object. */ declare function extractChildOverride(overrides: Record | undefined, key: string): Record | undefined; /** * Mutable context threaded through every recursive walk step. Carries * the merged metadata, field overrides, document root, nullability / * optionality flags, `$ref` cache, diagnostics sink, and per-document * `$ref` depth bound that `walkBuilders` and the walker itself share. * * @group Walkers */ interface WalkContext { componentMeta: SchemaMeta | undefined; rootMeta: SchemaMeta | undefined; fieldOverrides: Record | undefined; rootDocument: Record; isNullable: boolean; isOptional: boolean; defaultValue: unknown; /** Cache of $ref → WalkedField for recursive schema support. */ refResults: Map; /** JSON Pointer tracking for diagnostics. */ pointer: string; /** Diagnostics channel for surfacing silent fallbacks. */ diagnostics: DiagnosticsOptions | undefined; /** Derived $ref depth bound from the root document. */ maxRefDepth: number; /** Sync resolver for external $ref URIs. */ externalResolver: ExternalResolver | undefined; } /** * Build the common base shared by every field variant. */ declare function buildBase(schema: Record, ctx: WalkContext): FieldBase & { editability: Editability; }; /** Build a walked `StringField` from a JSON Schema node. */ declare function buildStringField(schema: Record, ctx: WalkContext): StringField; /** Build a walked `NumberField` from a JSON Schema node. */ declare function buildNumberField(schema: Record, ctx: WalkContext): NumberField; /** Build a walked `BooleanField` from a JSON Schema node. */ declare function buildBooleanField(schema: Record, ctx: WalkContext): BooleanField; /** Build a walked `NullField` from a JSON Schema node. */ declare function buildNullField(schema: Record, ctx: WalkContext): NullField; /** Build a walked `UnknownField` (permissive open-shape) from a JSON Schema node. */ declare function buildUnknownField(schema: Record, ctx: WalkContext): UnknownField; /** Build a walked `FileField` from a JSON Schema node carrying `contentMediaType`. */ declare function buildFileField(schema: Record, ctx: WalkContext): FileField; /** * Walk a map of sub-schemas (patternProperties, dependentSchemas, $defs). * * The callback receives each value as `unknown` so the caller can route * boolean schemas (`true`/`false`, valid per Draft 06+) through the * walker's boolean dispatch alongside object schemas. Non-schema values * (numbers, strings, arrays, undefined) are silently skipped — they * cannot represent a JSON Schema and have no walk-time meaning. */ declare function walkSubSchemaMap(map: Record, walkSubSchema: (schema: unknown, ctx: WalkContext) => T, ctx: WalkContext): Record; /** Walk a dependentRequired map (`Record`). */ declare function walkDependentRequiredMap(map: Record): Record; /** * Return a copy of the schema without the specified keys. * Used to strip composition keywords before walking the base schema. */ declare function withoutKeys(schema: Record, keys: string[]): Record; /** * Type guard for a JSON primitive: string, number, boolean, or null. * Used to short-circuit walk-time decisions about leaf values. */ declare function isPrimitive(value: unknown): value is string | number | boolean | null; /** * Convert any JSON-shaped value to a display string suitable for * form input attributes or text rendering. * * Centralises the conversion logic because `EnumField.enumValues` and * `LiteralField.literalValues` are typed as `unknown[]` (Draft 2020-12 * permits any JSON value in `enum` / `const`). Renderers call this * helper instead of inlining their own narrowing — the alternative * `String(v)` on `unknown` trips `@typescript-eslint/no-base-to-string`. * * Inputs originate from parsed JSON (or runtime JSON-equivalents) so * they are always `null | boolean | number | string | object | array`. * Objects and arrays serialise via `JSON.stringify` so a discriminated * union with object const values still produces a stable display key. * * Throws on non-JSON-shaped values (function, symbol, bigint, undefined) * — their presence indicates the producer violated the JSON contract. */ declare function displayJsonValue(value: unknown): string; //#endregion export { WalkContext, WalkOptions, buildBase, buildBooleanField, buildFileField, buildNullField, buildNumberField, buildStringField, buildUnknownField, displayJsonValue, extractChildOverride, extractMetaFromJson, extractSchemaMetaFields, getArray, getObject, getString, isPrimitive, walkDependentRequiredMap, walkSubSchemaMap, withoutKeys };