import { JsonError, SchemaNode } from 'json-schema-library'; import type { JsonSchema } from './jsonSchema'; import { DefaultNodeOptions } from './node/createNode'; export type { JsonSchema, JsonError }; export type DoneEvent = { type: 'done'; previous: JsonNode; next: JsonNode; changes: PluginEvent[]; }; export type UndoEvent = { type: 'undo'; previous: JsonNode; next: JsonNode; }; export type RedoEvent = { type: 'redo'; previous: JsonNode; next: JsonNode; }; export type ValidationEvent = { type: 'validation'; previous: JsonNode; next: JsonNode; errors: JsonError[]; }; export type PluginEvent = Change | DoneEvent | UndoEvent | RedoEvent | ValidationEvent; export type JsonNode = ArrayNode | ObjectNode | FileNode | StringNode | NumberNode | BooleanNode | NullNode; export type Change = { type: 'update' | 'create' | 'delete'; node: JsonNode; }; export declare function isChangeEvent(event: Record): event is Change; /** node type refers to the actual data value - it is not the expected schema type */ export type NodeType = ArrayType | ObjectType | FileType | StringType | NumberType | BooleanType | NullType; export type ArrayType = 'array'; export type ArrayNode = { id: string; type: ArrayType; children: JsonNode[]; oneOfIndex?: number; options: T; pointer: string; property: string; /** true, if this array is an array item */ isArrayItem: boolean; /** final, reduced JSON Schema ob this array */ schema: JsonSchema; /** unreduced schemaNode for this schema */ schemaNode: SchemaNode; /** list of validation errors on this array */ errors: JsonError[]; }; export type ObjectType = 'object'; export type ObjectNode = { id: string; type: ObjectType; children: JsonNode[]; options: T; oneOfIndex?: number; /** list of all optional properties, present or missing */ optionalProperties: string[]; /** list of all missing optional properties */ missingProperties: string[]; pointer: string; property: string; /** true, if this object is an array item */ isArrayItem: boolean; /** final, reduced JSON Schema of this object */ schema: JsonSchema; /** unreduced (original) schemaNode for this schema */ schemaNode: SchemaNode; /** list of validation errors on this object */ errors: JsonError[]; }; export type StringType = 'string'; export type StringNode = { id: string; type: StringType; options: T; oneOfIndex?: number; pointer: string; /** do we store parent property here or on parent node? */ property: string; isArrayItem: boolean; /** final, reduced JSON Schema of this node */ schema: JsonSchema; value?: string; /** unreduced schemaNode for this schema */ schemaNode: SchemaNode; errors: JsonError[]; }; export type FileType = 'file'; export type FileNode = { id: string; type: FileType; options: T; oneOfIndex?: number; pointer: string; /** do we store parent property here or on parent node? */ property: string; isArrayItem: boolean; /** final, reduced JSON Schema of this node */ schema: JsonSchema; value?: File; /** unreduced schemaNode for this schema */ schemaNode: SchemaNode; errors: JsonError[]; }; export type NumberType = 'number'; export type NumberNode = { id: string; type: NumberType; options: T; oneOfIndex?: number; pointer: string; /** do we store parent property here or on parent node? */ property: string; isArrayItem: boolean; /** final, reduced JSON Schema of this node */ schema: JsonSchema; value?: number; /** unreduced schemaNode for this schema */ schemaNode: SchemaNode; errors: JsonError[]; }; export type BooleanType = 'boolean'; export type BooleanNode = { id: string; type: BooleanType; options: T; oneOfIndex?: number; pointer: string; /** do we store parent property here or on parent node? */ property: string; isArrayItem: boolean; /** final, reduced JSON Schema of this node */ schema: JsonSchema; value?: boolean; /** unreduced schemaNode for this schema */ schemaNode: SchemaNode; errors: JsonError[]; }; export type NullType = 'null'; export type NullNode = { id: string; type: NullType; options: T; oneOfIndex?: number; pointer: string; /** do we store parent property here or on parent node? */ property: string; isArrayItem: boolean; /** final, reduced JSON Schema of this node */ schema: JsonSchema; value?: null; /** unreduced schemaNode for this schema */ schemaNode: SchemaNode; errors: JsonError[]; }; export type ParentNode = ArrayNode | ObjectNode; export type ValueNode = StringNode | NumberNode | NullNode | BooleanNode; export declare const isJsonNode: (node: any) => node is JsonNode; export declare const isParentNode: (node: unknown) => node is ObjectNode | ArrayNode; export declare const isFileNode: (node: unknown) => node is FileNode; export declare const isValueNode: (node: unknown) => node is StringNode | NumberNode | NullNode | BooleanNode; export declare const isArrayNode: (node: unknown) => node is ArrayNode; export declare const isObjectNode: (node: unknown) => node is ObjectNode; export declare const isNumberNode: (node: unknown) => node is NumberNode; export declare const isStringNode: (node: unknown) => node is StringNode; export declare const isBooleanNode: (node: unknown) => node is BooleanNode; export declare const isNullNode: (node: unknown) => node is NullNode; export { isJsonError } from 'json-schema-library';