packageDocumentation module textile import { grpc } from "@improbable-eng/grpc-web" ; import { ThreadID } from "@textile/threads-id" ; hidden export class Transaction < TRequest extends grpc . ProtobufMessage , TResponse extends grpc . ProtobufMessage > { param client param threadID param modelName constructor ( protected readonly client , protected readonly threadID , protected readonly modelName ) { } /**
     * end completes (flushes) the transaction. All operations between start and end will be applied as a single transaction upon a call to end.
     */ public async end ( ) { return new Promise < void > ( ( resolve , reject ) => { this . client . onEnd ( ( status , message ) => { if ( status !== grpc . Code . OK ) { reject ( new Error ( message ) ) ; } else { resolve ( ) ; } } ) ; this . client . finishSend ( ) ; } ) ; } param reject protected setReject ( reject ) { this . client . onEnd ( ( status , message ) => { if ( status !== grpc . Code . OK ) { reject ( new Error ( message ) ) ; } } ) ; } }