UNPKG

typeorm-revisions

Version:

Revisions History for [TypeORM](http://typeorm.io) Entities

17 lines (16 loc) 1.07 kB
import { EntityManager, InsertEvent, RemoveEvent, UpdateEvent } from 'typeorm'; import { HistoryActionType } from './historyActionType'; import { HistoryEntityInterface } from './historyEntityInterface'; import { HistorySubscriberInterface } from './historySubscriberInterface'; export declare abstract class HistorySubscriber<Entity, HistoryEntity extends HistoryEntityInterface & Entity> implements HistorySubscriberInterface<Entity, HistoryEntity> { beforeHistory(action: HistoryActionType, history: HistoryEntity): void | Promise<void>; afterHistory(action: HistoryActionType, history: HistoryEntity): void | Promise<void>; abstract readonly entity: Function; abstract readonly historyEntity: Function; listenTo(): Function; createHistoryEntity(manager: Readonly<EntityManager>, entity: Entity): HistoryEntity | Promise<HistoryEntity>; afterInsert(event: InsertEvent<Entity>): Promise<void>; afterUpdate(event: UpdateEvent<Entity>): Promise<void>; beforeRemove(event: RemoveEvent<Entity>): Promise<void>; private createHistory; }