export type JsonSchema = Record; /** A path inside a config value: object keys and array indices, as in zod issues. */ export type PathSegment = string | number; /** * The keys of a path joined with dots, array indices dropped, as the schema sees it * (e.g. ['portals', 0, 'adminUser'] -> 'portals.adminUser'). */ export declare function toKeyPath(path: PathSegment[]): string; export type FieldType = 'string' | 'boolean' | 'number' | 'integer' | 'string[]' | 'json'; /** A repeatable part of a setting: the items of an array, or the entries of an object keyed by name. */ export type FieldGroup = { /** `[]` for a setting that is an array, `portals[]` for an array field, `*` for entries keyed by name */ path: string; kind: 'array' | 'record'; title?: string; description?: string; /** record only: the pattern the entry names must match */ keyPattern?: string; }; export type Field = { /** dot path, with `[]` for array items and `*` for entries keyed by name (e.g. `portals[].name`, `*.consumerKey`) */ path: string; /** path of the group the field repeats with, if any */ group?: string; type: FieldType; title?: string; description?: string; required: boolean; enum?: unknown[]; default?: unknown; isPassword: boolean; /** `x-irreversible` in the schema: once applied, the value cannot be changed back */ isIrreversible: boolean; }; export type FlatFields = { groups: FieldGroup[]; fields: Field[]; }; /** * Returns a copy of the schema where every local `$ref` (`#/definitions/x`) is replaced by its definition, * and single-element `allOf` wrappers are merged into their parent. `definitions` and `$schema` are dropped. */ export declare function inlineRefs(schema: JsonSchema): JsonSchema; /** The schema of the value found at `path` inside a value of the given (inlined) schema. */ export declare function schemaAtPath(schema: JsonSchema, path: PathSegment[]): JsonSchema | undefined; /** The JSON type a schema expects (`string`, `boolean`, `number`, `integer`, `object`, `array`), if it has one. */ export declare function schemaType(schema: JsonSchema | undefined): string | undefined; /** * Flattens an (inlined) setting schema into fields ready to be prompted. * Objects become dot paths. The first array of objects or object keyed by name becomes a group whose * item fields are listed under it. Arrays of primitives are typed `string[]`; deeper arrays and records are `json`. */ export declare function flattenFields(schema: JsonSchema): FlatFields;