@microtica/database
Version:
Database tools
20 lines (19 loc) • 701 B
TypeScript
import * as Bluebird from "bluebird";
import { Request, Response } from "express";
import { Transaction } from "./database";
export interface Dictionary<T> {
[key: string]: T;
}
export interface UserTx {
tx: Transaction;
uid: string;
}
export interface TransactRequest<Params = void> extends Request {
params: Dictionary<string>;
userTx: UserTx;
}
export interface PostRequest<Body, Params = void> extends TransactRequest<Params> {
body: Body;
}
export declare function autoAnswer(res: Response): (d: any) => void;
export declare function wrapTx<Params>(mw: (req: TransactRequest<Params>, res: Response) => Promise<any> | Bluebird<any>): (req: Request, res: Response) => void;