import { SchemaContext } from "./context-types.mjs"; //#region ../@warlock.js/seal/src/types/rule-types.d.ts /** * Rule validation result */ type RuleResult = { isValid: false; error: string; input: string; path: string; } | { isValid: true; }; type AttributeValue = string | number; type ValidationAttributesList = Record>; /** * Rule options - generic options passed to rules */ type SchemaRuleOptions = Record; /** * Schema rule definition */ type SchemaRule = { /** Rule name */name: string; /** Rule description */ description?: string; /** Whether the rule requires a non-undefined value */ requiresValue?: boolean; /** Validation function */ validate: (this: ContextualSchemaRule, value: any, context: SchemaContext) => Promise; /** Default error message */ defaultErrorMessage?: string; /** Error message */ errorMessage?: string; /** Sort order for rule execution */ sortOrder?: number; }; /** * Contextualized schema rule - rule with runtime context */ type ContextualSchemaRule = SchemaRule & { /** * The context object is used to pass additional information to the rule * This will be always overridden when the rule is injected into a validator */ context: { errorMessage?: string; options: Options; attributesList: ValidationAttributesList; translatedAttributes: Record; /** Raw placeholder values — substituted as-is (enums, numbers, computed strings) */ translationParams: Record; /** Field-key placeholder values — passed through the attribute translator before substitution */ translatableParams: Record; }; }; //#endregion export { ContextualSchemaRule, RuleResult, SchemaRule, SchemaRuleOptions, ValidationAttributesList }; //# sourceMappingURL=rule-types.d.mts.map