export type ShieldRule = IRule | ILogicRule; export declare class IRule { readonly name: string; constructor(options: IRuleOptions); equals(rule: IRule): boolean; resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: IOptions): Promise>; } export interface IRuleOptions { } export declare class ILogicRule { constructor(rules: ShieldRule[]); getRules(): ShieldRule[]; evaluate(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: IOptions): Promise[]>; resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: IOptions): Promise>; } export type IRuleResult = boolean | string | Error | { ctx: Partial; }; export type IRuleFunction = Record> = (ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: IOptions) => IRuleResult | Promise>; export interface IRuleConstructorOptions { } export interface IRuleTypeMap { [key: string]: ShieldRule | IRuleFieldMap | IRuleTypeMap; } export interface IRuleFieldMap { [key: string]: ShieldRule; } export type IRules = ShieldRule | IRuleTypeMap; export type IFallbackErrorMapperType = (err: unknown, ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown) => Promise | Error; export type IFallbackErrorType = Error | IFallbackErrorMapperType; export interface IOptions { debug: boolean; allowExternalErrors: boolean; fallbackRule: ShieldRule; fallbackError?: IFallbackErrorType; } export interface IOptionsConstructor { debug?: boolean; allowExternalErrors?: boolean; fallbackRule?: ShieldRule; fallbackError?: string | IFallbackErrorType; } export declare function shield(ruleTree: IRules, options: IOptions): any;