import { RuleConstructorOptionsInterface, RuleFunctionInterface, ShieldRule } from "./types.mjs"; import { Rule, RuleAnd, RuleChain, RuleFalse, RuleNot, RuleOr, RuleRace, RuleTrue } from "./rules.mjs"; //#region src/shield/constructors.d.ts /** * 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 * }) * ``` */ declare const rule: >(name?: string, options?: RuleConstructorOptionsInterface) => (func: RuleFunctionInterface) => Rule; /** * Logical operator and serves as a wrapper for and operation. */ declare const and: >(...rules: ShieldRule[]) => RuleAnd; /** * Logical operator and serves as a wrapper for and operation. */ declare const chain: >(...rules: ShieldRule[]) => RuleChain; /** * Logical operator and serves as a wrapper for and operation. */ declare const race: >(...rules: ShieldRule[]) => RuleRace; /** * Logical operator or serves as a wrapper for or operation. */ declare const or: >(...rules: ShieldRule[]) => RuleOr; /** * Logical operator not serves as a wrapper for not operation. */ declare const not: >(rule: ShieldRule, error?: string | Error) => RuleNot; /** * Allow queries. */ declare const allow: RuleTrue>; /** * Deny queries. */ declare const deny: RuleFalse>; //#endregion export { allow, and, chain, deny, not, or, race, rule }; //# sourceMappingURL=constructors.d.mts.map