/** * ARKA Core Engine * * High-level API for the rules engine that coordinates the registry, * evaluator, and validator components. */ import type { ArkaRule, ArkaEntityType, ArkaEvent, ArkaEntity, ArkaDecision, RuleFilterParams } from '@arka-protocol/types'; import { evaluateSingleRule, type EvaluationContext, type EvaluateSingleRuleInput } from './evaluator.js'; import { type ValidationResult } from './validator.js'; /** * Configuration for the ARKA Engine */ export interface ArkaEngineConfig { /** Whether to validate entities before evaluation */ validateEntities?: boolean; /** Whether to throw on validation errors */ throwOnValidationError?: boolean; } /** * ARKA Core Engine * * Provides a unified interface for working with the rules engine. */ export declare class ArkaEngine { private ruleRegistry; private entityTypeRegistry; private config; constructor(config?: ArkaEngineConfig); /** * Registers an entity type with its schema */ registerEntityType(type: ArkaEntityType): void; /** * Gets an entity type by name */ getEntityType(name: string): ArkaEntityType | undefined; /** * Gets all registered entity types */ getAllEntityTypes(): ArkaEntityType[]; /** * Checks if an entity type exists */ hasEntityType(name: string): boolean; /** * Registers a rule with the specified version */ registerRule(rule: ArkaRule, version?: number): void; /** * Gets a rule by ID */ getRule(id: string): ArkaRule | undefined; /** * Gets a specific version of a rule */ getRuleVersion(id: string, version: number): ArkaRule | undefined; /** * Gets all versions of a rule */ getRuleVersions(id: string): ArkaRule[]; /** * Removes a rule */ unregisterRule(id: string): boolean; /** * Gets all registered rules */ getAllRules(): ArkaRule[]; /** * Gets rules matching the filter criteria */ getRules(filter?: RuleFilterParams): ArkaRule[]; /** * Gets active rules for a specific event and optional entity */ getActiveRulesFor(event: ArkaEvent, entity?: ArkaEntity | null): ArkaRule[]; /** * Validates an entity against its type schema */ validateEntity(entity: ArkaEntity): ValidationResult; /** * Validates an entity and throws if invalid */ validateEntityOrThrow(entity: ArkaEntity): void; /** * Evaluates a single rule against an event and optional entity */ evaluateSingleRule(input: Omit & { ruleId: string; }): ReturnType | null; /** * Evaluates all applicable rules against an event and optional entity */ evaluateRules(input: { event: ArkaEvent; entity?: ArkaEntity | null; context?: EvaluationContext; rules?: ArkaRule[]; }): ArkaDecision; /** * Clears all rules and entity types */ reset(): void; /** * Gets engine statistics */ getStats(): { ruleCount: number; entityTypeCount: number; }; } export declare function getDefaultEngine(): ArkaEngine; export declare function setDefaultEngine(engine: ArkaEngine): void; export declare function resetDefaultEngine(): void; //# sourceMappingURL=engine.d.ts.map