UNPKG

2.07 kBTypeScriptView Raw
1import type { AddedKeywordDefinition, AnySchemaObject, KeywordErrorCxt, KeywordCxtParams } from "../../types";
2import type { SchemaCxt, SchemaObjCxt } from "..";
3import { SubschemaArgs } from "./subschema";
4import { Code, Name, CodeGen } from "../codegen";
5import type { JSONType } from "../rules";
6import { ErrorPaths } from "../errors";
7export declare function validateFunctionCode(it: SchemaCxt): void;
8export declare class KeywordCxt implements KeywordErrorCxt {
9 readonly gen: CodeGen;
10 readonly allErrors?: boolean;
11 readonly keyword: string;
12 readonly data: Name;
13 readonly $data?: string | false;
14 schema: any;
15 readonly schemaValue: Code | number | boolean;
16 readonly schemaCode: Code | number | boolean;
17 readonly schemaType: JSONType[];
18 readonly parentSchema: AnySchemaObject;
19 readonly errsCount?: Name;
20 params: KeywordCxtParams;
21 readonly it: SchemaObjCxt;
22 readonly def: AddedKeywordDefinition;
23 constructor(it: SchemaObjCxt, def: AddedKeywordDefinition, keyword: string);
24 result(condition: Code, successAction?: () => void, failAction?: () => void): void;
25 failResult(condition: Code, successAction?: () => void, failAction?: () => void): void;
26 pass(condition: Code, failAction?: () => void): void;
27 fail(condition?: Code): void;
28 fail$data(condition: Code): void;
29 error(append?: boolean, errorParams?: KeywordCxtParams, errorPaths?: ErrorPaths): void;
30 private _error;
31 $dataError(): void;
32 reset(): void;
33 ok(cond: Code | boolean): void;
34 setParams(obj: KeywordCxtParams, assign?: true): void;
35 block$data(valid: Name, codeBlock: () => void, $dataValid?: Code): void;
36 check$data(valid?: Name, $dataValid?: Code): void;
37 invalid$data(): Code;
38 subschema(appl: SubschemaArgs, valid: Name): SchemaCxt;
39 mergeEvaluated(schemaCxt: SchemaCxt, toName?: typeof Name): void;
40 mergeValidEvaluated(schemaCxt: SchemaCxt, valid: Name): boolean | void;
41}
42export declare function getData($data: string, { dataLevel, dataNames, dataPathArr }: SchemaCxt): Code | number;