UNPKG

@hiki9/rich-domain

Version:

Rich Domain is a library that provides a set of tools to help you build complex business logic in NodeJS using Domain Driven Design principles.

44 lines 1.88 kB
import { AutoMapperSerializer, EntityCompareResult, EntityConfig, EntityProps, HistorySubscribe, IEntity, WithDate, WithoutEntityProps } from "../interface/types"; import { AutoMapperEntity } from "./auto-mapper-entity"; import { EntityMetaHistory } from "./history"; import { EntityHook } from "./hooks"; import { Id } from "./ids"; export declare abstract class Entity<Props extends EntityProps, Input extends Partial<Props> = Partial<Props>> implements IEntity<Props> { protected static autoMapper: AutoMapperEntity; protected static hooks: EntityHook<any, any>; isEntity: boolean; private _id; private _createdAt; private _updatedAt; protected props: Props; protected metaHistory: EntityMetaHistory<Props> | null; protected rulesIsLocked: boolean; constructor(input: Input, options?: EntityConfig); constructor(input: Props, options?: EntityConfig); constructor(input: WithDate<Props>, options?: EntityConfig); subscribe(props: HistorySubscribe<Props, this>): void; revalidate(fieldToRevalidate?: keyof WithoutEntityProps<Props>): void; /** @deprecated This method will throw an error if called. */ getRawProps(): Props; ensureBusinessRules(): void; get history(): EntityMetaHistory<Props>; get createdAt(): Date | null; get updatedAt(): Date | null; get id(): Id; clone(): IEntity<Props>; isNew(): boolean; toPrimitives(): Readonly<AutoMapperSerializer<Props>>; toJSON(): Readonly<AutoMapperSerializer<Props>>; hashCode(): Id; isEqual(other?: IEntity<Props>): boolean; compare(other?: Entity<Props>): EntityCompareResult; private transformBeforeCreate; private onEntityCreate; private generateProxyProps; private generateOrAssignId; private assignAndRemoveTimestampSignatureFromProps; } //# sourceMappingURL=entity.d.ts.map