import { type BuildContext, type BuildEventHandler, type GCScript, type JsonObject, type JsonValue } from '../helpers'; export type JsonLocation = { line?: number; column?: number; offset?: number; length?: number; }; export type ValidationErrorReport = { code: string; message: string; fileName?: string; fileUri?: string; filePath?: string; jsonPath: string; location?: JsonLocation; error?: string; suggestion?: string; examples?: JsonValue[]; relatedDocs?: string[]; provided?: JsonValue; details?: JsonValue; }; export type ValidationProfiling = { validateMs?: number; buildMs?: number; schemaMs?: number; }; export type ValidationReport = { isValid: boolean; errors: ValidationErrorReport[]; /** Non-blocking diagnostics. These never make isValid false. */ warnings: ValidationErrorReport[]; profiling?: ValidationProfiling; }; export type ValidateOptions = { /** validate() consumes built strict JSON. JSONC comments/trailing commas are rejected here. */ input: string; fileUri?: string; fileName?: string; filePath?: string; useSchema?: JsonValue; schemaUrl?: string; schemaRootFile?: string; profiling?: ValidationProfiling; onEvent?: BuildEventHandler; }; export type ValidateContext = { input: string; fileUri: string; fileName?: string; filePath?: string; useSchema?: JsonValue; schemaUrl: string; schemaRootFile: string; options: ValidateOptions; state: Record; }; type SchemaValueIndexEntry = { propertyName: string; value: JsonValue; schemaPath: string; description?: string; docs?: string[]; examples?: JsonValue[]; context?: JsonObject; }; export type SchemaValueIndex = Map; type SchemaPropertyIndexEntry = { propertyName: string; schemaPath: string; description?: string; docs?: string[]; examples?: JsonValue[]; context?: JsonObject; siblingProperties?: string[]; requiredProperties?: string[]; typeValues?: JsonValue[]; }; export type SchemaPropertyIndex = Map; type SchemaISLFunctionEntry = { name: string; schemaPath: string; description?: string; docs?: string[]; examples?: JsonValue[]; }; export type SchemaISLFunctionIndex = Map; type SchemaBranchIndexEntry = { schemaPath: string; title?: string; description?: string; docs?: string[]; examples?: JsonValue[]; propertyNames: string[]; requiredProperties: string[]; discriminatorValues: Record; primitiveTypes: string[]; additionalProperties?: unknown; }; export type SchemaBranchIndex = SchemaBranchIndexEntry[]; export type SchemaDiagnosticIndex = { values: SchemaValueIndex; properties: SchemaPropertyIndex; branches: SchemaBranchIndex; islFunctions: SchemaISLFunctionIndex; }; type JsonParseError = { error: number; offset: number; length: number; }; type NormalizerArgs = { context: ValidateContext | BuildContext; input?: string; code?: GCScript; rootNode?: unknown; schemaValueIndex: SchemaValueIndex; schemaPropertyIndex: SchemaPropertyIndex; schemaBranchIndex?: SchemaBranchIndex; diagnosticIndex?: SchemaDiagnosticIndex; schema?: Record; schemaRootFile?: string; ajvErrors?: any[]; syntaxErrors?: JsonParseError[]; }; type DiagnosticNormalizer = (args: NormalizerArgs) => ValidationErrorReport | undefined; export declare const pathPartsToJsonPointer: (parts: string[]) => string; export declare const jsonPointerToPathParts: (path: string) => string[]; export declare const getAtJsonPath: (code: GCScript | undefined, path: string) => unknown; /** Builds a generic index of const/enum values grouped by property name. */ export declare const createSchemaValueIndex: (apiDef: Record) => SchemaValueIndex; /** Builds a generic index of valid object-property names grouped by name. */ export declare const createSchemaPropertyIndex: (apiDef: Record) => SchemaPropertyIndex; export declare const createSchemaISLFunctionIndex: (apiDef: Record) => SchemaISLFunctionIndex; export declare const createSchemaBranchIndex: (apiDef: Record) => SchemaBranchIndex; export declare const createSchemaDiagnosticIndex: (apiDef: Record) => SchemaDiagnosticIndex; export declare const getJsonPathLocation: ({ input, rootNode, jsonPath }: { input?: string; rootNode?: unknown; jsonPath: string; }) => JsonLocation | undefined; export declare const downloadGCScriptSchema: (schemaUrl?: string) => Promise; /** Normalizes strict JSON syntax failures before schema validation starts. */ export declare const normalizeStrictJsonSyntaxError: DiagnosticNormalizer; /** Explains exact nested GCScript functions that were accidentally used as root code. */ export declare const normalizeRootKnownFunctionError: DiagnosticNormalizer; /** Suggests valid const/enum values using the schema value index, not AJV branch noise. */ export declare const normalizeConstEnumError: DiagnosticNormalizer; /** Normalizes missing required property errors at the object path that owns them. */ export declare const normalizeRequiredPropertyError: DiagnosticNormalizer; /** Normalizes unexpected properties without leaking branch-specific AJV internals. */ export declare const normalizeAdditionalPropertyError: DiagnosticNormalizer; /** Normalizes primitive/object/array type mismatches at the failing JSON path. */ export declare const normalizeTypeMismatchError: DiagnosticNormalizer; /** Handles oneOf/anyOf only after more specific normalizers declined the error. */ export declare const normalizeOneOfAnyOfError: DiagnosticNormalizer; /** Last-resort AJV diagnostic when no richer normalizer can explain the error. */ export declare const normalizeFallbackAjvError: DiagnosticNormalizer; export declare const normalizers: DiagnosticNormalizer[]; /** Parses validate-only input. Validation consumes built strict JSON, not JSONC. */ export declare function parseGCScriptJSON(input: string): GCScript; export declare const validateGCScriptObject: ({ code, context, useSchema, schemaRootFile, input, rootNode }: { code: GCScript; context: ValidateContext | BuildContext; useSchema?: JsonValue; schemaRootFile?: string; input?: string; rootNode?: unknown; }) => Promise; export declare const validate: (options: ValidateOptions) => Promise; export declare const validateToDataURI: (input: string, options?: Omit) => Promise; export declare const docs: { GCScriptAPIRefURL: string; GCScriptDocsURL: string; }; export {};