import { assert } from "@fluidframework/common-utils" ; import { IDocumentMessage , ISequencedDocumentMessage } from "@fluidframework/protocol-definitions" ; import { IDeltaConnection , IDeltaHandler } from "@fluidframework/datastore-definitions" ; import { CreateProcessingError } from "@fluidframework/container-utils" ; import { IFluidHandle } from "@fluidframework/core-interfaces" ; export class ChannelDeltaConnection implements IDeltaConnection { private _handler : IDeltaHandler | undefined ; private get handler ( ) : IDeltaHandler { assert ( ! ! this . _handler , 0x177 ) ; return this . _handler ; } public get connected ( ) : boolean { return this . _connected ; } constructor ( public objectId , private _connected , public readonly submit , public readonly dirty , public readonly addedGCOutboundReference ) { } public attach ( handler ) { assert ( this . _handler === undefined , 0x178 ) ; this . _handler = handler ; } public setConnectionState ( connected ) { this . _connected = connected ; this . handler . setConnectionState ( connected ) ; } public process ( message , local , localOpMetadata ) { try { this . handler . process ( message , local , localOpMetadata ) ; } catch ( error ) { throw CreateProcessingError ( error , "channelDeltaConnectionFailedToProcessMessage" , message ) ; } } public reSubmit ( content , localOpMetadata ) { this . handler . reSubmit ( content , localOpMetadata ) ; } public applyStashedOp ( message ) { return this . handler . applyStashedOp ( message ) ; } }