31 lines
1.1 KiB
Plaintext
31 lines
1.1 KiB
Plaintext
import type { AssertionContext, AssertResult, CustomFunction } from '../../../config/types';
|
|
import type { Location } from '../../../ref-utils';
|
|
export type AssertionFnContext = AssertionContext & {
|
|
baseLocation: Location;
|
|
rawValue?: any;
|
|
};
|
|
export type AssertionFn = (value: any, condition: any, ctx: AssertionFnContext) => AssertResult[];
|
|
export type Asserts = {
|
|
pattern: AssertionFn;
|
|
notPattern: AssertionFn;
|
|
enum: AssertionFn;
|
|
defined: AssertionFn;
|
|
required: AssertionFn;
|
|
disallowed: AssertionFn;
|
|
undefined: AssertionFn;
|
|
nonEmpty: AssertionFn;
|
|
minLength: AssertionFn;
|
|
maxLength: AssertionFn;
|
|
casing: AssertionFn;
|
|
sortOrder: AssertionFn;
|
|
mutuallyExclusive: AssertionFn;
|
|
mutuallyRequired: AssertionFn;
|
|
requireAny: AssertionFn;
|
|
ref: AssertionFn;
|
|
const: AssertionFn;
|
|
};
|
|
export declare const runOnKeysSet: Set<keyof Asserts>;
|
|
export declare const runOnValuesSet: Set<keyof Asserts>;
|
|
export declare const asserts: Asserts;
|
|
export declare function buildAssertCustomFunction(fn: CustomFunction): AssertionFn;
|