import { LogicRuleInterface, OptionsInterface, RuleFunctionInterface, RuleInterface, RuleResultInterface, ShieldRule } from "./types.cjs"; //#region src/shield/rules.d.ts declare class Rule> implements RuleInterface { readonly name: string; func?: RuleFunctionInterface; constructor(name: string, func?: RuleFunctionInterface); resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; /** * * Compares a given rule with the current one * and checks whether their functions are equal. * */ equals(rule: Rule): boolean; executeRule>(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): string | boolean | Error | Promise; } declare class LogicRule> extends Rule implements LogicRuleInterface { private rules; constructor(rules: ShieldRule[]); /** * By default logic rule resolves to false. */ resolve(_ctx: TContext, _type: string, _path: string, _input: { [name: string]: any; }, _rawInput: unknown, _options: OptionsInterface): Promise; /** * Evaluates all the rules. */ evaluate(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; /** * Returns rules in a logic rule. */ getRules(): ShieldRule[]; } declare class RuleOr> extends LogicRule { constructor(rules: ShieldRule[]); /** * Makes sure that at least one of them has evaluated to true. */ resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; } declare class RuleAnd> extends LogicRule { constructor(rules: ShieldRule[]); /** * Makes sure that all of them have resolved to true. */ resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; } declare class RuleChain> extends LogicRule { constructor(rules: ShieldRule[]); /** * Makes sure that all of them have resolved to true. */ resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; /** * Evaluates all the rules. */ evaluate(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; } declare class RuleRace> extends LogicRule { constructor(rules: ShieldRule[]); /** * Makes sure that at least one of them resolved to true. */ resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; /** * Evaluates all the rules. */ evaluate(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; } declare class RuleNot> extends LogicRule implements LogicRuleInterface { error?: Error; name: string; equals: (rule: RuleInterface) => boolean; constructor(rule: ShieldRule, error?: Error); /** * Negates the result. */ resolve(ctx: TContext, type: string, path: string, input: { [name: string]: any; }, rawInput: unknown, options: OptionsInterface): Promise; } declare class RuleTrue> extends LogicRule implements LogicRuleInterface { name: string; equals: (rule: RuleInterface) => boolean; constructor(); /** * * Always true. * */ resolve(): Promise; } declare class RuleFalse> extends LogicRule implements LogicRuleInterface { name: string; equals: (rule: RuleInterface) => boolean; constructor(); /** * * Always false. * */ resolve(): Promise; } //#endregion export { LogicRule, Rule, RuleAnd, RuleChain, RuleFalse, RuleNot, RuleOr, RuleRace, RuleTrue }; //# sourceMappingURL=rules.d.cts.map