@martinmilo/verve
Version:
TypeScript domain modeling library with field-level authorization, business rule validation, and context-aware access control
29 lines • 1.63 kB
TypeScript
import type { FieldMetadata, FieldOptions, FieldValidator, FieldGenerator } from "./types";
import type { ModelInstance } from "../../model/core/types";
import { VerveErrorList } from "../../errors";
export declare abstract class Field<T> {
metadata: FieldMetadata;
options: FieldOptions;
constructor(metadata: FieldMetadata, options?: FieldOptions);
protected static globalValidatorsMap: Map<Function, FieldValidator[]>;
protected static globalGeneratorsMap: Map<Function, FieldGenerator>;
static setGlobalValidators(validators: FieldValidator[]): void;
static getGlobalValidators(): FieldValidator[];
static getGlobalGenerator(): FieldGenerator | undefined;
static getEagerGenerator(options: FieldOptions): FieldGenerator | undefined;
static getEagerValidators(options: FieldOptions): FieldValidator[];
get(model: ModelInstance, key: string): T;
unsafeGet(model: ModelInstance, key: string): T | undefined;
set(model: ModelInstance, key: string, value: T): void;
unset(model: ModelInstance, key: string): void;
is(model: ModelInstance, key: string, value: T): boolean;
isEmpty(model: ModelInstance, key: string): boolean;
isPresent(model: ModelInstance, key: string): boolean;
isValid(model: ModelInstance, key: string): boolean;
generate(model: ModelInstance, key: string): void;
compute(model: ModelInstance, key: string): T;
validate(model: ModelInstance, key: string): VerveErrorList;
isReadable(model: ModelInstance, key: string): boolean;
isWritable(model: ModelInstance, key: string): boolean;
}
//# sourceMappingURL=Field.d.ts.map