@wroud/preconditions
Version:
A flexible and extensible library for managing preconditions in JavaScript and TypeScript applications. Simplify validation and preparation of entities like nodes, connections, and features with dynamic precondition handling.
23 lines • 976 B
TypeScript
import type { IPrecondition } from "./IPrecondition.js";
export declare class PreconditionManager<T> {
private preconditions;
/**
* Registers a new precondition for this entity type.
* @param precondition - The precondition to register.
*/
register(...precondition: IPrecondition<T>[]): void;
/**
* Checks if all applicable preconditions are fulfilled for the given entity instance.
* @param entity - The entity instance.
* @return {Promise<boolean>} - Resolves to true if all applicable preconditions are fulfilled.
*/
checkPreconditions(entity: T): Promise<boolean>;
/**
* Attempts to fulfill all applicable preconditions for the given entity instance.
* @param entity - The entity instance.
* @return {Promise<void>}
*/
fulfillPreconditions(entity: T): Promise<void>;
getApplicablePreconditions(entity: T): Iterable<IPrecondition<T>>;
}
//# sourceMappingURL=PreconditionManager.d.ts.map