UNPKG

typeorm-transactional-async-callbacks

Version:

A Transactional Method Decorator for typeorm that uses cls-hooked to handle and propagate transactions between different repositories and service methods. Inpired by Spring Trasnactional Annotation and Sequelize CLS

11 lines (10 loc) 747 B
/// <reference types="node" /> import { EventEmitter } from 'events'; import { StorageDriver } from '../storage/driver/interface'; export declare const getTransactionalContextHook: () => EventEmitter; export declare const runAndTriggerHooks: (hook: EventEmitter, cb: () => unknown) => Promise<unknown>; export declare const createEventEmitterInNewContext: () => EventEmitter; export declare const runInNewHookContext: (context: StorageDriver, cb: () => unknown) => Promise<unknown>; export declare const runOnTransactionCommit: (cb: () => void | Promise<unknown>) => void; export declare const runOnTransactionRollback: (cb: (e: Error) => void) => void; export declare const runOnTransactionComplete: (cb: (e: Error | undefined) => void) => void;