import { Rule, RuleAnd, RuleChain, RuleFalse, RuleNot, RuleOr, RuleRace, RuleTrue } from './rules'; import { IRuleConstructorOptions, IRuleFunction, ShieldRule } from './types'; /** * * @param name * @param options * * Wraps a function into a Rule class. This way we can identify rules * once we start generating middleware from our ruleTree. * * 1. * const auth = rule()(async (ctx, type, path, input, rawInput, options) => { * return true * }) * * 2. * const auth = rule('name')(async (ctx, type, path, input, rawInput, options) => { * return true * }) * * 3. * const auth = rule({ * name: 'name', * })(async (ctx, type, path, input, rawInput, options) => { * return true * }) * */ export declare const rule: >(name?: string, options?: IRuleConstructorOptions) => (func: IRuleFunction) => Rule; /** * * @param rules * * Logical operator and serves as a wrapper for and operation. * */ export declare const and: >(...rules: ShieldRule[]) => RuleAnd; /** * * @param rules * * Logical operator and serves as a wrapper for and operation. * */ export declare const chain: >(...rules: ShieldRule[]) => RuleChain; /** * * @param rules * * Logical operator and serves as a wrapper for and operation. * */ export declare const race: >(...rules: ShieldRule[]) => RuleRace; /** * * @param rules * * Logical operator or serves as a wrapper for or operation. * */ export declare const or: >(...rules: ShieldRule[]) => RuleOr; /** * * @param rule * * Logical operator not serves as a wrapper for not operation. * */ export declare const not: >(rule: ShieldRule, error?: string | Error) => RuleNot; /** * * Allow queries. * */ export declare const allow: RuleTrue>; /** * * Deny queries. * */ export declare const deny: RuleFalse>;