/// import { EntityDict, RowStore, OperateOption, OperationResult, SelectOption, Context, TxnOption, OpRecord, AggregationResult } from "../types"; import { IncomingHttpHeaders } from "http"; export declare abstract class AsyncContext implements Context { private rowStore; private uuid?; opRecords: OpRecord[]; private scene?; private headers?; private message?; events: { commit: Array<() => Promise>; rollback: Array<() => Promise>; }; constructor(store: AsyncRowStore>, headers?: IncomingHttpHeaders); setHeaders(headers: IncomingHttpHeaders): void; getHeader(key: string): string | string[] | undefined; getScene(): string | undefined; setScene(scene?: string): void; private resetEvents; on(event: 'commit' | 'rollback', callback: () => Promise): void; /** * 一个context中不应该有并发的事务,这里将事务串行化,使用的时候千万要注意不要自己等自己 * @param options */ begin(options?: TxnOption): Promise; commit(): Promise; rollback(): Promise; operate(entity: T, operation: ED[T]['Operation'], option: OP): Promise>; select(entity: T, selection: ED[T]['Selection'], option: OP): Promise[]>; aggregate(entity: T, aggregation: ED[T]['Aggregation'], option: OP): Promise>; count(entity: T, selection: Pick, option: OP): Promise; mergeMultipleResults(toBeMerged: OperationResult[]): OperationResult; getCurrentTxnId(): string | undefined; getSchema(): import("../types").StorageSchema; setMessage(message: string): void; getMessage(): string | undefined; abstract isRoot(): boolean; abstract getCurrentUserId(allowUnloggedIn?: boolean): string | undefined; abstract toString(): string; abstract allowUserUpdate(): boolean; } export interface AsyncRowStore extends RowStore { operate(entity: T, operation: ED[T]['Operation'], context: Cxt, option: OP): Promise>; select(entity: T, selection: ED[T]['Selection'], context: Cxt, option: OP): Promise[]>; aggregate(entity: T, aggregation: ED[T]['Aggregation'], context: Cxt, option: OP): Promise>; count(entity: T, selection: Pick, context: Cxt, option: OP): Promise; begin(option?: TxnOption): Promise; commit(txnId: string): Promise; rollback(txnId: string): Promise; }