@fluidframework/container-loader 2.74.0 → 2.80.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/container.d.ts.map +1 -1
- package/dist/container.js +2 -2
- package/dist/container.js.map +1 -1
- package/dist/deltaManager.d.ts +10 -0
- package/dist/deltaManager.d.ts.map +1 -1
- package/dist/deltaManager.js +42 -1
- package/dist/deltaManager.js.map +1 -1
- package/dist/loaderLayerCompatState.d.ts +4 -4
- package/dist/loaderLayerCompatState.d.ts.map +1 -1
- package/dist/loaderLayerCompatState.js +6 -5
- package/dist/loaderLayerCompatState.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/serializedStateManager.d.ts +3 -4
- package/dist/serializedStateManager.d.ts.map +1 -1
- package/dist/serializedStateManager.js +4 -7
- package/dist/serializedStateManager.js.map +1 -1
- package/lib/container.d.ts.map +1 -1
- package/lib/container.js +2 -2
- package/lib/container.js.map +1 -1
- package/lib/deltaManager.d.ts +10 -0
- package/lib/deltaManager.d.ts.map +1 -1
- package/lib/deltaManager.js +42 -1
- package/lib/deltaManager.js.map +1 -1
- package/lib/loaderLayerCompatState.d.ts +4 -4
- package/lib/loaderLayerCompatState.d.ts.map +1 -1
- package/lib/loaderLayerCompatState.js +6 -5
- package/lib/loaderLayerCompatState.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/serializedStateManager.d.ts +3 -4
- package/lib/serializedStateManager.d.ts.map +1 -1
- package/lib/serializedStateManager.js +4 -7
- package/lib/serializedStateManager.js.map +1 -1
- package/package.json +20 -20
- package/src/container.ts +2 -5
- package/src/deltaManager.ts +52 -1
- package/src/loaderLayerCompatState.ts +10 -9
- package/src/packageVersion.ts +1 -1
- package/src/serializedStateManager.ts +3 -7
package/dist/deltaManager.d.ts
CHANGED
|
@@ -59,6 +59,11 @@ export declare class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
59
59
|
private lastObservedSeqNumber;
|
|
60
60
|
private lastProcessedSequenceNumber;
|
|
61
61
|
private lastProcessedMessage;
|
|
62
|
+
/**
|
|
63
|
+
* Map of clientId to the last observed message from that client. This is used to validate
|
|
64
|
+
* that clientSequenceNumbers are always increasing for a given clientId.
|
|
65
|
+
*/
|
|
66
|
+
private readonly lastObservedMessageByClient;
|
|
62
67
|
/**
|
|
63
68
|
* Count the number of noops sent by the client which may not be acked
|
|
64
69
|
*/
|
|
@@ -158,6 +163,11 @@ export declare class DeltaManager<TConnectionManager extends IConnectionManager>
|
|
|
158
163
|
*/
|
|
159
164
|
emitDelayInfo(id: string, delayMs: number, error: unknown): void;
|
|
160
165
|
private comparableMessagePayload;
|
|
166
|
+
/**
|
|
167
|
+
* Validates that the clientSequenceNumber for a given clientId is always increasing.
|
|
168
|
+
* @param message - The message to validate.
|
|
169
|
+
*/
|
|
170
|
+
private validateClientSequenceNumberConsistency;
|
|
161
171
|
private enqueueMessages;
|
|
162
172
|
private processInboundMessage;
|
|
163
173
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaManager.d.ts","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,KAAK,EACX,mBAAmB,EACnB,iBAAiB,EACjB,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,MAAM,gDAAgD,CAAC;AACxD,OAAO,KAAK,EACX,cAAc,EAEd,wBAAwB,EACxB,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,kBAAkB,EAAc,MAAM,0CAA0C,CAAC;AAE/F,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAEN,KAAK,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,KAAK,CAAC,EAAE,uBAAuB,GAAG,IAAI;IAWnD;;;;;;;OAOG;IACI,OAAO,CAAC,KAAK,CAAC,EAAE,KAAK,GAAG,uBAAuB,GAAG,IAAI;IAoB7D,OAAO,CAAC,WAAW;IAeZ,gBAAgB,CAAC,EAAE,EAAE,MAAM,GAAG,IAAI;IAOzC,OAAO,CAAC,iBAAiB;IAKzB;;;;;OAKG;IACI,aAAa,CAAC,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,IAAI;IAsBvE,OAAO,CAAC,wBAAwB;IAIhC;;;OAGG;IACH,OAAO,CAAC,uCAAuC;IAuC/C,OAAO,CAAC,eAAe;IA0JvB,OAAO,CAAC,qBAAqB;IAmG7B;;OAEG;IACH,OAAO,CAAC,kBAAkB;IAM1B;;OAEG;YACW,sBAAsB;IA8DpC;;OAEG;IACH,OAAO,CAAC,iBAAiB;IAiCzB,OAAO,CAAC,4BAA4B;CAKpC"}
|
package/dist/deltaManager.js
CHANGED
|
@@ -226,6 +226,11 @@ class DeltaManager extends internal_5.EventEmitterWithErrorHandling {
|
|
|
226
226
|
this.lastQueuedSequenceNumber = 0;
|
|
227
227
|
this.lastObservedSeqNumber = 0;
|
|
228
228
|
this.lastProcessedSequenceNumber = 0;
|
|
229
|
+
/**
|
|
230
|
+
* Map of clientId to the last observed message from that client. This is used to validate
|
|
231
|
+
* that clientSequenceNumbers are always increasing for a given clientId.
|
|
232
|
+
*/
|
|
233
|
+
this.lastObservedMessageByClient = new Map();
|
|
229
234
|
/**
|
|
230
235
|
* Count the number of noops sent by the client which may not be acked
|
|
231
236
|
*/
|
|
@@ -577,7 +582,42 @@ class DeltaManager extends internal_5.EventEmitterWithErrorHandling {
|
|
|
577
582
|
// Also payload goes to telemetry, so no content or anything else that shouldn't be logged for privacy reasons
|
|
578
583
|
// Note: It's possible for a duplicate op to be broadcasted and have everything the same except the timestamp.
|
|
579
584
|
comparableMessagePayload(m) {
|
|
580
|
-
return `${m.clientId}-${m.type}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;
|
|
585
|
+
return `${m.clientId}-${m.type}-${m.sequenceNumber}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;
|
|
586
|
+
}
|
|
587
|
+
/**
|
|
588
|
+
* Validates that the clientSequenceNumber for a given clientId is always increasing.
|
|
589
|
+
* @param message - The message to validate.
|
|
590
|
+
*/
|
|
591
|
+
validateClientSequenceNumberConsistency(message) {
|
|
592
|
+
// Once client leaves, we no longer need to track its last observed message as the client won't send messages.
|
|
593
|
+
if (message.type === internal_3.MessageType.ClientLeave) {
|
|
594
|
+
const systemLeaveMessage = message;
|
|
595
|
+
const clientId = JSON.parse(systemLeaveMessage.data);
|
|
596
|
+
this.lastObservedMessageByClient.delete(clientId);
|
|
597
|
+
}
|
|
598
|
+
if (message.clientId === null) {
|
|
599
|
+
return;
|
|
600
|
+
}
|
|
601
|
+
const lastObservedClientMessage = this.lastObservedMessageByClient.get(message.clientId);
|
|
602
|
+
if (lastObservedClientMessage !== undefined &&
|
|
603
|
+
message.clientSequenceNumber <= lastObservedClientMessage.clientSequenceNumber) {
|
|
604
|
+
// This looks like a data corruption issue where the clientSequenceNumber for a given clientId is not
|
|
605
|
+
// increasing. The Fluid Service ensures that it only processes ops with contiguous increasing
|
|
606
|
+
// clientSequenceNumbers for a given clientId.
|
|
607
|
+
// So, if we see this error, it is likely a service issue.
|
|
608
|
+
// One example of this is if the service sequences the same op more than once. In this case, all the
|
|
609
|
+
// properties except the sequenceNumber will be the same.
|
|
610
|
+
// Note that we are not checking for gaps in clientSequenceNumber because very old clients may have gaps
|
|
611
|
+
// as per the op stream in the snapshot tests under test/snapshots/content.
|
|
612
|
+
const error = new internal_5.DataCorruptionError("Found two messages with non-increasing clientSequenceNumber for a given client. Likely to be a service issue", {
|
|
613
|
+
clientId: this.connectionManager.clientId,
|
|
614
|
+
sequenceNumber: message.sequenceNumber,
|
|
615
|
+
message1: this.comparableMessagePayload(lastObservedClientMessage),
|
|
616
|
+
message2: this.comparableMessagePayload(message),
|
|
617
|
+
});
|
|
618
|
+
this.close(error);
|
|
619
|
+
}
|
|
620
|
+
this.lastObservedMessageByClient.set(message.clientId, message);
|
|
581
621
|
}
|
|
582
622
|
enqueueMessages(messages, reason, allowGaps = false) {
|
|
583
623
|
if (this.handler === undefined) {
|
|
@@ -692,6 +732,7 @@ class DeltaManager extends internal_5.EventEmitterWithErrorHandling {
|
|
|
692
732
|
}
|
|
693
733
|
}
|
|
694
734
|
else if (message.sequenceNumber === this.lastQueuedSequenceNumber + 1) {
|
|
735
|
+
this.validateClientSequenceNumberConsistency(message);
|
|
695
736
|
this.lastQueuedSequenceNumber = message.sequenceNumber;
|
|
696
737
|
this.previouslyProcessedMessage = message;
|
|
697
738
|
this._inbound.push(message);
|
package/dist/deltaManager.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,uEAAqE;AAErE,kEAA6D;AAE7D,0EAUqD;AACrD,oEAA4F;AAC5F,uEAYkD;AAClD,+BAAkC;AAQlC,mDAA6C;AAC7C,yCAA+C;AAgD/C;;GAEG;AACH,SAAS,eAAe,CAAC,OAAqD;IAC7E,IAAI,IAAA,2BAAgB,EAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,sBAAW,CAAC,OAAO,CAAC;QACzB,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAAK,sBAAW,CAAC,IAAI,CAAC;QACtB,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAAK,sBAAW,CAAC,SAAS,CAAC,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC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oft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport type {\n\tIDeltaManagerEvents,\n\tIDeltaManagerFull,\n\tIDeltaQueue,\n\tIDeltaSender,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tIEventProvider,\n\tITelemetryBaseEvent,\n\tITelemetryBaseProperties,\n} from \"@fluidframework/core-interfaces\";\nimport { JsonParse } from \"@fluidframework/core-interfaces/internal\";\nimport type { IThrottlingWarning, JsonString } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\ttype IDocumentDeltaStorageService,\n\ttype IDocumentService,\n\tDriverErrorTypes,\n\ttype IDocumentMessage,\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n\ttype ISignalMessage,\n\ttype IClientDetails,\n\ttype IClientConfiguration,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError, isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype ITelemetryErrorEventExt,\n\ttype ITelemetryGenericEventExt,\n\ttype ITelemetryLoggerExt,\n\tDataCorruptionError,\n\tDataProcessingError,\n\tUsageError,\n\textractSafePropertiesFromMessage,\n\tisFluidError,\n\tnormalizeError,\n\tsafeRaiseEvent,\n\tEventEmitterWithErrorHandling,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tIConnectionDetailsInternal,\n\tIConnectionManager,\n\tIConnectionManagerFactoryArgs,\n\tIConnectionStateChangeReason,\n} from \"./contracts.js\";\nimport { DeltaQueue } from \"./deltaQueue.js\";\nimport { ThrottlingWarning } from \"./error.js\";\n\nexport interface IConnectionArgs {\n\tmode?: ConnectionMode;\n\tfetchOpsFromStorage?: boolean;\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Includes events emitted by the concrete implementation DeltaManager\n * but not exposed on the public interface IDeltaManager\n */\nexport interface IDeltaManagerInternalEvents extends IDeltaManagerEvents {\n\t(event: \"throttled\", listener: (error: IThrottlingWarning) => void);\n\t(event: \"closed\" | \"disposed\", listener: (error?: ICriticalContainerError) => void);\n\t(\n\t\tevent: \"connect\",\n\t\tlistener: (details: IConnectionDetailsInternal, opsBehind?: number) => void,\n\t);\n\t(event: \"establishingConnection\", listener: (reason: IConnectionStateChangeReason) => void);\n\t(\n\t\tevent: \"cancelEstablishingConnection\",\n\t\tlistener: (reason: IConnectionStateChangeReason) => void,\n\t);\n}\n\n/**\n * Batching makes assumptions about what might be on the metadata. This interface codifies those assumptions, but does not validate them.\n */\ninterface IBatchMetadata {\n\tbatch?: boolean;\n}\n\n/**\n * Interface used to define a strategy for handling incoming delta messages\n */\nexport interface IDeltaHandlerStrategy {\n\t/**\n\t * Processes the message.\n\t */\n\tprocess: (message: ISequencedDocumentMessage) => void;\n\n\t/**\n\t * Processes the signal.\n\t */\n\tprocessSignal: (message: ISignalMessage) => void;\n}\n\n/**\n * Determines if message was sent by client, not service\n */\nfunction isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n\tif (isRuntimeMessage(message)) {\n\t\treturn true;\n\t}\n\tswitch (message.type) {\n\t\tcase MessageType.Propose:\n\t\tcase MessageType.Reject:\n\t\tcase MessageType.NoOp:\n\t\tcase MessageType.Accept:\n\t\tcase MessageType.Summarize: {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\n/**\n * Like assert, but logs only if the condition is false, rather than throwing\n * @param condition - The condition to attest too\n * @param logger - The logger to log with\n * @param event - The string or event to log\n * @returns The outcome of the condition\n */\nfunction logIfFalse(\n\tcondition: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tevent: string | ITelemetryGenericEventExt,\n): condition is true {\n\tif (condition) {\n\t\treturn true;\n\t}\n\tconst newEvent: ITelemetryBaseEvent =\n\t\ttypeof event === \"string\"\n\t\t\t? { eventName: event, category: \"error\" }\n\t\t\t: { category: \"error\", ...event };\n\tlogger.send(newEvent);\n\treturn false;\n}\n\n/**\n * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta\n * messages in order regardless of possible network conditions or timings causing out of order delivery.\n */\nexport class DeltaManager<TConnectionManager extends IConnectionManager>\n\textends EventEmitterWithErrorHandling<IDeltaManagerInternalEvents>\n\timplements IDeltaManagerFull, IEventProvider<IDeltaManagerInternalEvents>\n{\n\tpublic readonly connectionManager: TConnectionManager;\n\n\tpublic get active(): boolean {\n\t\treturn this._active();\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._closed;\n\t}\n\n\tpublic get IDeltaSender(): IDeltaSender {\n\t\treturn this;\n\t}\n\n\tprivate pending: ISequencedDocumentMessage[] = [];\n\tprivate fetchReason: string | undefined;\n\n\t// A boolean used to assert that ops are not being sent while processing another op.\n\tprivate currentlyProcessingOps: boolean = false;\n\n\t// The minimum sequence number and last sequence number received from the server\n\tprivate minSequenceNumber: number = 0;\n\n\t// There are three numbers we track\n\t// * lastQueuedSequenceNumber is the last queued sequence number. If there are gaps in seq numbers, then this number\n\t// is not updated until we cover that gap, so it increases each time by 1.\n\t// * lastObservedSeqNumber is an estimation of last known sequence number for container in storage. It's initially\n\t// populated at web socket connection time (if storage provides that info) and is updated once ops shows up.\n\t// It's never less than lastQueuedSequenceNumber\n\t// * lastProcessedSequenceNumber - last processed sequence number\n\tprivate lastQueuedSequenceNumber: number = 0;\n\tprivate lastObservedSeqNumber: number = 0;\n\tprivate lastProcessedSequenceNumber: number = 0;\n\tprivate lastProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t/**\n\t * Count the number of noops sent by the client which may not be acked\n\t */\n\tprivate noOpCount: number = 0;\n\t/**\n\t * Track clientSequenceNumber of the last op\n\t */\n\tprivate lastClientSequenceNumber: number = 0;\n\n\t/**\n\t * Track down the ops size.\n\t */\n\tprivate opsSize: number = 0;\n\tprivate prevEnqueueMessagesReason: string | undefined;\n\tprivate previouslyProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t// The sequence number we initially loaded from\n\t// In case of reading from a snapshot or pending state, its value will be equal to\n\t// the last message that got serialized.\n\tprivate initSequenceNumber: number = 0;\n\n\tprivate readonly _inbound: DeltaQueue<ISequencedDocumentMessage>;\n\tprivate readonly _inboundSignal: DeltaQueue<\n\t\tISignalMessage<{ type: never; content: JsonString<unknown> }>\n\t>;\n\n\tprivate _closed = false;\n\tprivate _disposed = false;\n\n\tprivate handler: IDeltaHandlerStrategy | undefined;\n\tprivate deltaStorage: IDocumentDeltaStorageService | undefined;\n\n\tprivate readonly throttlingIdSet = new Set<string>();\n\tprivate timeTillThrottling: number = 0;\n\n\tpublic readonly closeAbortController = new AbortController();\n\n\tprivate readonly deltaStorageDelayId = uuid();\n\tprivate readonly deltaStreamDelayId = uuid();\n\n\tprivate messageBuffer: IDocumentMessage[] = [];\n\n\tprivate _checkpointSequenceNumber: number | undefined;\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this._inbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this._inboundSignal;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.initSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.lastProcessedSequenceNumber;\n\t}\n\n\tpublic get lastMessage(): ISequencedDocumentMessage | undefined {\n\t\treturn this.lastProcessedMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber(): number {\n\t\treturn this.lastObservedSeqNumber;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.minSequenceNumber;\n\t}\n\n\t/**\n\t * Tells if current connection has checkpoint information.\n\t * I.e. we know how far behind the client was at the time of establishing connection\n\t */\n\tpublic get hasCheckpointSequenceNumber(): boolean {\n\t\t// Valid to be called only if we have active connection.\n\t\tassert(this.connectionManager.connected, 0x0df /* \"Missing active connection\" */);\n\t\treturn this._checkpointSequenceNumber !== undefined;\n\t}\n\n\t// Forwarding connection manager properties / IDeltaManager implementation\n\tpublic get maxMessageSize(): number {\n\t\treturn this.connectionManager.maxMessageSize;\n\t}\n\tpublic get version(): string {\n\t\treturn this.connectionManager.version;\n\t}\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.connectionManager.serviceConfiguration;\n\t}\n\tpublic get outbound(): IDeltaQueue<IDocumentMessage[]> {\n\t\treturn this.connectionManager.outbound;\n\t}\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this.connectionManager.readOnlyInfo;\n\t}\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.connectionManager.clientDetails;\n\t}\n\n\tpublic submit(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch = false,\n\t\tmetadata?: unknown,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\t// Back-compat ADO:3455\n\t\tconst backCompatRefSeqNum = referenceSequenceNumber ?? this.lastProcessedSequenceNumber;\n\t\tconst messagePartial: Omit<IDocumentMessage, \"clientSequenceNumber\"> = {\n\t\t\tcontents,\n\t\t\tmetadata,\n\t\t\treferenceSequenceNumber: backCompatRefSeqNum,\n\t\t\ttype,\n\t\t\tcompression,\n\t\t};\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\tconst message = this.connectionManager.prepareMessageToSend(messagePartial);\n\t\tif (message === undefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tassert(isClientMessage(message), 0x419 /* client sends non-client message */);\n\n\t\tif (contents !== undefined) {\n\t\t\tthis.opsSize += contents.length;\n\t\t}\n\n\t\tthis.messageBuffer.push(message);\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\tthis.noOpCount++;\n\t\t}\n\n\t\tthis.emit(\"submitOp\", message);\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn message.clientSequenceNumber;\n\t}\n\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\treturn this.connectionManager.submitSignal(content, targetClientId);\n\t}\n\n\tpublic flush(): void {\n\t\tconst batch = this.messageBuffer;\n\t\tif (batch.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.messageBuffer = [];\n\n\t\t// The prepareFlush event allows listeners to append metadata to the batch prior to submission.\n\t\tthis.emit(\"prepareSend\", batch);\n\n\t\tif (batch.length === 1) {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === undefined,\n\t\t\t\t0x3c9 /* no batch markup on single message */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === true,\n\t\t\t\t0x3ca /* no start batch markup */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t(batch[batch.length - 1].metadata as IBatchMetadata)?.batch === false,\n\t\t\t\t0x3cb /* no end batch markup */,\n\t\t\t);\n\t\t}\n\n\t\tthis.connectionManager.sendMessages(batch);\n\n\t\tassert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);\n\t}\n\n\tpublic get connectionProps(): ITelemetryBaseProperties {\n\t\treturn {\n\t\t\tsequenceNumber: this.lastSequenceNumber,\n\t\t\topsSize: this.opsSize > 0 ? this.opsSize : undefined,\n\t\t\tdeltaManagerState: this._disposed ? \"disposed\" : this._closed ? \"closed\" : \"open\",\n\t\t\t...this.connectionManager.connectionProps,\n\t\t};\n\t}\n\n\t/**\n\t * Log error event with a bunch of internal to DeltaManager information about state of op processing\n\t * Used to diagnose connectivity issues related to op processing (i.e. cases where for some reason\n\t * we stop processing ops that results in no processing join op and thus moving to connected state)\n\t * @param event - Event to log.\n\t */\n\tpublic logConnectionIssue(event: ITelemetryErrorEventExt): void {\n\t\tassert(this.connectionManager.connected, 0x238 /* \"called only in connected state\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\t...event,\n\t\t\t// This directly tells us if fetching ops is in flight, and thus likely the reason of\n\t\t\t// stalled op processing\n\t\t\tfetchReason: this.fetchReason,\n\t\t\t// A bunch of useful sequence numbers to understand if we are holding some ops from processing\n\t\t\tlastQueuedSequenceNumber: this.lastQueuedSequenceNumber, // last sequential op\n\t\t\tlastProcessedSequenceNumber: this.lastProcessedSequenceNumber, // same as above, but after processing\n\t\t\tlastObserved: this.lastObservedSeqNumber, // last sequence we ever saw; may have gaps with above.\n\t\t\t// connection info\n\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\tpendingOps: this.pending.length, // Do we have any pending ops?\n\t\t\tpendingFirst: pendingSorted[0]?.sequenceNumber, // is the first pending op the one that we are missing?\n\t\t\thaveHandler: this.handler !== undefined, // do we have handler installed?\n\t\t\tinboundLength: this.inbound.length,\n\t\t\tinboundPaused: this.inbound.paused,\n\t\t});\n\t}\n\n\tconstructor(\n\t\tprivate readonly serviceProvider: () => IDocumentService | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly _active: () => boolean,\n\t\tcreateConnectionManager: (props: IConnectionManagerFactoryArgs) => TConnectionManager,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaManagerEventHandlerException\",\n\t\t\t\t\tname: typeof name === \"string\" ? name : undefined,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\t\tconst props: IConnectionManagerFactoryArgs = {\n\t\t\tincomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.enqueueMessages(messages, reason);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"EnqueueMessages_Exception\" }, error);\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\tsignalHandler: (\n\t\t\t\tsignals: ISignalMessage<{ type: never; content: JsonString<unknown> }>[],\n\t\t\t) => {\n\t\t\t\tfor (const signal of signals) {\n\t\t\t\t\tthis._inboundSignal.push(signal);\n\t\t\t\t}\n\t\t\t},\n\t\t\treconnectionDelayHandler: (delayMs: number, error: unknown) =>\n\t\t\t\tthis.emitDelayInfo(this.deltaStreamDelayId, delayMs, error),\n\t\t\tcloseHandler: (error: ICriticalContainerError | undefined) => this.close(error),\n\t\t\tdisconnectHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.disconnectHandler(reason),\n\t\t\tconnectHandler: (connection: IConnectionDetailsInternal) =>\n\t\t\t\tthis.connectHandler(connection),\n\t\t\tpongHandler: (latency: number) => this.emit(\"pong\", latency),\n\t\t\treadonlyChangeHandler: (\n\t\t\t\treadonly?: boolean,\n\t\t\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t\t\t) => {\n\t\t\t\tsafeRaiseEvent(this, this.logger, \"readonly\", readonly, readonlyConnectionReason);\n\t\t\t},\n\t\t\testablishConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.establishingConnection(reason),\n\t\t\tcancelConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.cancelEstablishingConnection(reason),\n\t\t};\n\n\t\tthis.connectionManager = createConnectionManager(props);\n\t\tthis._inbound = new DeltaQueue<ISequencedDocumentMessage>((op) => {\n\t\t\tthis.processInboundMessage(op);\n\t\t});\n\n\t\tthis._inbound.on(\"error\", (error) => {\n\t\t\tthis.close(\n\t\t\t\tDataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"deltaManagerInboundErrorHandler\",\n\t\t\t\t\tthis.lastMessage,\n\t\t\t\t),\n\t\t\t);\n\t\t});\n\n\t\t// Inbound signal queue\n\t\tthis._inboundSignal = new DeltaQueue<\n\t\t\tISignalMessage<{ type: never; content: JsonString<unknown> }>\n\t\t>((message) => {\n\t\t\tif (this.handler === undefined) {\n\t\t\t\tthrow new Error(\"Attempted to process an inbound signal without a handler attached\");\n\t\t\t}\n\n\t\t\tthis.handler.processSignal({\n\t\t\t\t...message,\n\t\t\t\tcontent: JsonParse(message.content),\n\t\t\t});\n\t\t});\n\n\t\tthis._inboundSignal.on(\"error\", (error) => {\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\t// Initially, all queues are created paused.\n\t\t// - outbound is flipped back and forth in setupNewSuccessfulConnection / disconnectFromDeltaStream\n\t\t// - inbound & inboundSignal are resumed in attachOpHandler() when we have handler setup\n\t}\n\n\tprivate cancelEstablishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"cancelEstablishingConnection\", reason);\n\t}\n\n\tprivate establishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"establishingConnection\", reason);\n\t}\n\n\tprivate connectHandler(connection: IConnectionDetailsInternal): void {\n\t\tthis.refreshDelayInfo(this.deltaStreamDelayId);\n\n\t\tconst props = this.connectionManager.connectionVerboseProps;\n\t\tprops.connectionLastQueuedSequenceNumber = this.lastQueuedSequenceNumber;\n\t\tprops.connectionLastObservedSeqNumber = this.lastObservedSeqNumber;\n\n\t\tconst checkpointSequenceNumber = connection.checkpointSequenceNumber;\n\t\tthis._checkpointSequenceNumber = checkpointSequenceNumber;\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\tthis.updateLatestKnownOpSeqNumber(checkpointSequenceNumber);\n\t\t}\n\n\t\t// We cancel all ops on lost of connectivity, and rely on DDSes to resubmit them.\n\t\t// Semantics are not well defined for batches (and they are broken right now on disconnects anyway),\n\t\t// but it's safe to assume (until better design is put into place) that batches should not exist\n\t\t// across multiple connections. Right now we assume runtime will not submit any ops in disconnected\n\t\t// state. As requirements change, so should these checks.\n\t\tassert(\n\t\t\tthis.messageBuffer.length === 0,\n\t\t\t0x0e9 /* \"messageBuffer is not empty on new connection\" */,\n\t\t);\n\n\t\tthis.opsSize = 0;\n\t\tthis.noOpCount = 0;\n\n\t\tthis.emit(\n\t\t\t\"connect\",\n\t\t\tconnection,\n\t\t\tcheckpointSequenceNumber === undefined\n\t\t\t\t? undefined\n\t\t\t\t: this.lastObservedSeqNumber - this.lastSequenceNumber,\n\t\t);\n\n\t\t// If we got some initial ops, then we know the gap and call above fetched ops to fill it.\n\t\t// Same is true for \"write\" mode even if we have no ops - we will get \"join\" own op very very soon.\n\t\t// However if we are connecting as view-only, then there is no good signal to realize if client is behind.\n\t\t// Thus we have to hit storage to see if any ops are there.\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\t// We know how far we are behind (roughly). If it's non-zero gap, fetch ops right away.\n\t\t\tif (checkpointSequenceNumber > this.lastQueuedSequenceNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"AfterConnection\");\n\t\t\t}\n\t\t\t// we do not know the gap, and we will not learn about it if socket is quite - have to ask.\n\t\t} else if (connection.mode === \"read\") {\n\t\t\tthis.fetchMissingDeltas(\"AfterReadConnection\");\n\t\t}\n\t}\n\n\t/**\n\t * Sets the sequence number from which inbound messages should be returned\n\t * @param snapshotSequenceNumber - The sequence number of the snapshot at which the document loaded from.\n\t * @param lastProcessedSequenceNumber - The last processed sequence number, for offline, it should be greater than the sequence number.\n\t * Setting lastProcessedSequenceNumber allows the DeltaManager to skip downloading and processing ops that have already been processed.\n\t */\n\tpublic async attachOpHandler(\n\t\tminSequenceNumber: number,\n\t\tsnapshotSequenceNumber: number,\n\t\thandler: IDeltaHandlerStrategy,\n\t\tprefetchType: \"cached\" | \"all\" | \"none\" = \"none\",\n\t\tlastProcessedSequenceNumber: number = snapshotSequenceNumber,\n\t): Promise<void> {\n\t\tthis.initSequenceNumber = snapshotSequenceNumber;\n\t\tthis.lastProcessedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.minSequenceNumber = minSequenceNumber;\n\t\tthis.lastQueuedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.lastObservedSeqNumber = lastProcessedSequenceNumber;\n\n\t\t// We will use same check in other places to make sure all the seq number above are set properly.\n\t\tassert(\n\t\t\tthis.handler === undefined,\n\t\t\t0x0e2 /* \"DeltaManager already has attached op handler!\" */,\n\t\t);\n\t\tthis.handler = handler;\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!this.handler, 0x0e3 /* \"Newly set op handler is null/undefined!\" */);\n\n\t\t// There should be no pending fetch!\n\t\t// This API is called right after attachOpHandler by Container.load().\n\t\t// We might have connection already and it might have called fetchMissingDeltas() from\n\t\t// setupNewSuccessfulConnection. But it should do nothing, because there is no way to fetch ops before\n\t\t// we know snapshot sequence number that is set in attachOpHandler. So all such calls should be noop.\n\t\tassert(\n\t\t\tthis.fetchReason === undefined,\n\t\t\t0x268 /* \"There can't be pending fetch that early in boot sequence!\" */,\n\t\t);\n\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._inbound.resume();\n\t\tthis._inboundSignal.resume();\n\n\t\tif (prefetchType !== \"none\") {\n\t\t\tconst cacheOnly = prefetchType === \"cached\";\n\t\t\tawait this.fetchMissingDeltasCore(`DocumentOpen_${prefetchType}`, cacheOnly);\n\n\t\t\t// Keep going with fetching ops from storage once we have all cached ops in.\n\t\t\t// But do not block load and make this request async / not blocking this api.\n\t\t\t// Ops processing will start once cached ops are in and and will stop when queue is empty\n\t\t\t// (which in most cases will happen when we are done processing cached ops)\n\t\t\tif (cacheOnly) {\n\t\t\t\t// fire and forget\n\t\t\t\tthis.fetchMissingDeltas(\"PostDocumentOpen\");\n\t\t\t}\n\t\t}\n\n\t\t// Ensure there is no need to call this.processPendingOps() at the end of boot sequence\n\t\tassert(\n\t\t\tthis.fetchReason !== undefined || this.pending.length === 0,\n\t\t\t0x269 /* \"pending ops are not dropped\" */,\n\t\t);\n\t}\n\n\tpublic connect(args: IConnectionArgs): void {\n\t\tconst fetchOpsFromStorage = args.fetchOpsFromStorage ?? true;\n\t\tlogIfFalse(\n\t\t\tthis.handler !== undefined || !fetchOpsFromStorage,\n\t\t\tthis.logger,\n\t\t\t\"CantFetchWithoutBaseline\",\n\t\t); // can't fetch if no baseline\n\n\t\t// Note: There is race condition here.\n\t\t// We want to issue request to storage as soon as possible, to\n\t\t// reduce latency of becoming current, thus this code here.\n\t\t// But there is no ordering between fetching OPs and connection to delta stream\n\t\t// As result, we might be behind by the time we connect to delta stream\n\t\t// In case of r/w connection, that's not an issue, because we will hear our\n\t\t// own \"join\" message and realize any gap client has in ops.\n\t\t// But for view-only connection, we have no such signal, and with no traffic\n\t\t// on the wire, we might be always behind.\n\t\t// See comment at the end of \"connect\" handler\n\t\tif (fetchOpsFromStorage) {\n\t\t\tthis.fetchMissingDeltas(args.reason.text);\n\t\t}\n\n\t\tthis.connectionManager.connect(args.reason, args.mode);\n\t}\n\n\tprivate async getDeltas(\n\t\tfrom: number, // inclusive\n\t\tto: number | undefined, // exclusive\n\t\tfetchReason: string,\n\t\tcallback: (messages: ISequencedDocumentMessage[]) => void,\n\t\tcacheOnly: boolean,\n\t): Promise<void> {\n\t\tconst docService = this.serviceProvider();\n\t\tif (docService === undefined) {\n\t\t\tthrow new Error(\"Delta manager is not attached\");\n\t\t}\n\n\t\tif (this.deltaStorage === undefined) {\n\t\t\tthis.deltaStorage = await docService.connectToDeltaStorage();\n\t\t}\n\n\t\tlet cancelFetch: (op: ISequencedDocumentMessage) => boolean;\n\n\t\tif (to === undefined) {\n\t\t\t// Unbound requests are made to proactively fetch ops, but also get up to date in cases where socket\n\t\t\t// is silent (and connection is \"read\", thus we might not have any data on how far client is behind).\n\t\t\t// Once we have any op coming in from socket, we can cancel it as it's not needed any more.\n\t\t\t// That said, if we have socket connection, make sure we got ops up to checkpointSequenceNumber!\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= this.lastObservedSeqNumber;\n\t\t} else {\n\t\t\tconst lastExpectedOp = to - 1; // make it inclusive!\n\n\t\t\t// It is possible that due to asynchrony (including await above), required ops were already\n\t\t\t// received through delta stream. Validate that before moving forward.\n\t\t\tif (this.lastQueuedSequenceNumber >= lastExpectedOp) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\treason: fetchReason,\n\t\t\t\t\teventName: \"ExtraStorageCall\",\n\t\t\t\t\tearly: true,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Be prepared for the case where webSocket would receive the ops that we are trying to fill through\n\t\t\t// storage. Ideally it should never happen (i.e. ops on socket are always ordered, and thus once we\n\t\t\t// detected gap, this gap can't be filled in later on through websocket).\n\t\t\t// And in practice that does look like the case. The place where this code gets hit is if we lost\n\t\t\t// connection and reconnected (likely to another box), and new socket's initial ops contains these ops.\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= lastExpectedOp;\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tlet opsFromFetch = false;\n\n\t\tconst opListener = (op: ISequencedDocumentMessage): void => {\n\t\t\tassert(op.sequenceNumber === this.lastQueuedSequenceNumber, 0x23a /* \"seq#'s\" */);\n\t\t\t// Ops that are coming from this request should not cancel itself.\n\t\t\t// This is useless for known ranges (to is defined) as it means request is over either way.\n\t\t\t// And it will cancel unbound request too early, not allowing us to learn where the end of the file is.\n\t\t\tif (!opsFromFetch && cancelFetch(op)) {\n\t\t\t\tcontroller.abort(\"DeltaManager getDeltas fetch cancelled\");\n\t\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tthis._inbound.on(\"push\", opListener);\n\t\t\tassert(this.closeAbortController.signal.onabort === null, 0x1e8 /* \"reentrancy\" */);\n\t\t\tthis.closeAbortController.signal.addEventListener(\"abort\", () =>\n\t\t\t\tcontroller.abort(this.closeAbortController.signal.reason),\n\t\t\t);\n\n\t\t\tconst stream = this.deltaStorage.fetchMessages(\n\t\t\t\tfrom, // inclusive\n\t\t\t\tto, // exclusive\n\t\t\t\tcontroller.signal,\n\t\t\t\tcacheOnly,\n\t\t\t\tfetchReason,\n\t\t\t);\n\n\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\twhile (true) {\n\t\t\t\tconst result = await stream.read();\n\t\t\t\tif (result.done) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\topsFromFetch = true;\n\t\t\t\t\tcallback(result.value);\n\t\t\t\t} finally {\n\t\t\t\t\topsFromFetch = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (controller.signal.aborted) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeltaManager_GetDeltasAborted\",\n\t\t\t\t\tfetchReason,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\treason: controller.signal.reason,\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/no-null, unicorn/prefer-add-event-listener\n\t\t\tthis.closeAbortController.signal.onabort = null;\n\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\tassert(!opsFromFetch, 0x289 /* \"logic error\" */);\n\t\t}\n\t}\n\n\t/**\n\t * Closes the connection and clears inbound & outbound queues.\n\t *\n\t * Differences from dispose:\n\t * - close will trigger readonly notification\n\t * - close emits \"closed\"\n\t * - close cannot be called after dispose\n\t */\n\tpublic close(error?: ICriticalContainerError): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._closed = true;\n\n\t\tthis.connectionManager.dispose(error, true /* switchToReadonly */);\n\t\tthis.clearQueues();\n\t\tthis.emit(\"closed\", error);\n\t}\n\n\t/**\n\t * Disposes the connection and clears the inbound & outbound queues.\n\t *\n\t * Differences from close:\n\t * - dispose will emit \"disposed\"\n\t * - dispose will remove all listeners\n\t * - dispose can be called after closure\n\t */\n\tpublic dispose(error?: Error | ICriticalContainerError): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (error !== undefined && !isFluidError(error)) {\n\t\t\tthrow new UsageError(\"Error must be a Fluid error\");\n\t\t}\n\n\t\tthis._disposed = true;\n\t\tthis._closed = true; // We consider \"disposed\" as a further state than \"closed\"\n\n\t\tthis.connectionManager.dispose(error, false /* switchToReadonly */);\n\t\tthis.clearQueues();\n\n\t\t// This needs to be the last thing we do (before removing listeners), as it causes\n\t\t// Container to dispose context and break ability of data stores / runtime to \"hear\" from delta manager.\n\t\tthis.emit(\"disposed\", error);\n\t\tthis.removeAllListeners();\n\t}\n\n\tprivate clearQueues(): void {\n\t\tthis.closeAbortController.abort(\"DeltaManager is closed\");\n\n\t\tthis._inbound.clear();\n\t\tthis._inboundSignal.clear();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inboundSignal.pause();\n\n\t\t// Drop pending messages - this will ensure catchUp() does not go into infinite loop\n\t\tthis.pending = [];\n\t}\n\n\tpublic refreshDelayInfo(id: string): void {\n\t\tthis.throttlingIdSet.delete(id);\n\t\tif (this.throttlingIdSet.size === 0) {\n\t\t\tthis.timeTillThrottling = 0;\n\t\t}\n\t}\n\n\tprivate disconnectHandler(reason: IConnectionStateChangeReason): void {\n\t\tthis.messageBuffer.length = 0;\n\t\tthis.emit(\"disconnect\", reason.text, reason.error);\n\t}\n\n\t/**\n\t * Emit info about a delay in service communication on account of throttling.\n\t * @param id - Id of the connection that is delayed\n\t * @param delayMs - Duration of the delay\n\t * @param error - error object indicating the throttling\n\t */\n\tpublic emitDelayInfo(id: string, delayMs: number, error: unknown): void {\n\t\tconst timeNow = Date.now();\n\t\tthis.throttlingIdSet.add(id);\n\t\tif (delayMs > 0 && timeNow + delayMs > this.timeTillThrottling) {\n\t\t\tthis.timeTillThrottling = timeNow + delayMs;\n\n\t\t\tconst throttlingWarning: IThrottlingWarning = ThrottlingWarning.wrap(\n\t\t\t\terror,\n\t\t\t\tdelayMs / 1000 /* retryAfterSeconds */,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\tthis.emit(\"throttled\", throttlingWarning);\n\t\t}\n\t}\n\n\t// returns parts of message (in string format) that should never change for a given message.\n\t// Used for message comparison. It attempts to avoid comparing fields that potentially may differ.\n\t// for example, it's not clear if serverMetadata or timestamp property is a property of message or server state.\n\t// We only extract the most obvious fields that are sufficient (with high probability) to detect sequence number\n\t// reuse.\n\t// Also payload goes to telemetry, so no content or anything else that shouldn't be logged for privacy reasons\n\t// Note: It's possible for a duplicate op to be broadcasted and have everything the same except the timestamp.\n\tprivate comparableMessagePayload(m: ISequencedDocumentMessage): string {\n\t\treturn `${m.clientId}-${m.type}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;\n\t}\n\n\tprivate enqueueMessages(\n\t\tmessages: ISequencedDocumentMessage[],\n\t\treason: string,\n\t\tallowGaps = false,\n\t): void {\n\t\tif (this.handler === undefined) {\n\t\t\t// We did not setup handler yet.\n\t\t\t// This happens when we connect to web socket faster than we get attributes for container\n\t\t\t// and thus faster than attachOpHandler() is called\n\t\t\t// this.lastProcessedSequenceNumber is still zero, so we can't rely on this.fetchMissingDeltas()\n\t\t\t// to do the right thing.\n\t\t\tthis.pending = [...this.pending, ...messages];\n\t\t\treturn;\n\t\t}\n\n\t\t// Pending ops should never just hang around for nothing.\n\t\t// This invariant will stay true through this function execution,\n\t\t// so there is no need to process pending ops here.\n\t\t// It's responsibility of\n\t\t// - attachOpHandler()\n\t\t// - fetchMissingDeltas() after it's done with querying storage\n\t\tassert(\n\t\t\tthis.pending.length === 0 || this.fetchReason !== undefined,\n\t\t\t0x1e9 /* \"Pending ops\" */,\n\t\t);\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst from = messages[0].sequenceNumber;\n\t\tconst last = messages[messages.length - 1].sequenceNumber;\n\n\t\t// Report stats about missing and duplicate ops\n\t\t// This helps better understand why we fetch ops from storage, and thus may delay\n\t\t// getting current / sending ops\n\t\t// It's possible that this batch is already too late - do not bother\n\t\tif (last > this.lastQueuedSequenceNumber) {\n\t\t\tlet prev = from - 1;\n\t\t\tconst initialGap = prev - this.lastQueuedSequenceNumber;\n\t\t\tlet firstMissing: number | undefined;\n\t\t\tlet duplicate = 0;\n\t\t\tlet gap = 0;\n\n\t\t\t// Count all gaps and duplicates\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (message.sequenceNumber === prev) {\n\t\t\t\t\tduplicate++;\n\t\t\t\t} else if (message.sequenceNumber !== prev + 1) {\n\t\t\t\t\tgap++;\n\t\t\t\t\tif (firstMissing === undefined) {\n\t\t\t\t\t\tfirstMissing = prev + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprev = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tlet eventName: string | undefined;\n\n\t\t\t// Report if we found some issues\n\t\t\tif (\n\t\t\t\tduplicate !== 0 ||\n\t\t\t\t(gap !== 0 && !allowGaps) ||\n\t\t\t\t(initialGap > 0 && this.fetchReason === undefined)\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessages\";\n\t\t\t\t// Also report if we are fetching ops, and same range comes in, thus making this fetch obsolete.\n\t\t\t} else if (\n\t\t\t\tthis.fetchReason !== undefined &&\n\t\t\t\tthis.fetchReason !== reason &&\n\t\t\t\tfrom <= this.lastQueuedSequenceNumber + 1 &&\n\t\t\t\tlast > this.lastQueuedSequenceNumber\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessagesExtraFetch\";\n\t\t\t}\n\n\t\t\t// Report if there is something to report\n\t\t\t// Do not report when pending fetch is in progress, as such reporting will not\n\t\t\t// correctly take into account pending ops.\n\t\t\tif (eventName !== undefined) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName,\n\t\t\t\t\treason,\n\t\t\t\t\tpreviousReason: this.prevEnqueueMessagesReason,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto: last + 1, // exclusive, being consistent with the other telemetry / APIs\n\t\t\t\t\tlength: messages.length,\n\t\t\t\t\tfetchReason: this.fetchReason,\n\t\t\t\t\tduplicate: duplicate > 0 ? duplicate : undefined,\n\t\t\t\t\tinitialGap: initialGap === 0 ? undefined : initialGap,\n\t\t\t\t\tgap: gap > 0 ? gap : undefined,\n\t\t\t\t\tfirstMissing,\n\t\t\t\t\tdmInitialSeqNumber: this.initialSequenceNumber,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis.updateLatestKnownOpSeqNumber(messages[messages.length - 1].sequenceNumber);\n\n\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\tassert(\n\t\t\tn === undefined || n === this.lastQueuedSequenceNumber,\n\t\t\t0x0ec /* \"Unexpected value for previously processed message's sequence number\" */,\n\t\t);\n\n\t\tfor (const message of messages) {\n\t\t\t// Check that the messages are arriving in the expected order\n\t\t\tif (message.sequenceNumber <= this.lastQueuedSequenceNumber) {\n\t\t\t\t// Validate that we do not have data loss, i.e. sequencing is reset and started again\n\t\t\t\t// with numbers that this client already observed before.\n\t\t\t\tif (this.previouslyProcessedMessage?.sequenceNumber === message.sequenceNumber) {\n\t\t\t\t\tconst message1 = this.comparableMessagePayload(this.previouslyProcessedMessage);\n\t\t\t\t\tconst message2 = this.comparableMessagePayload(message);\n\t\t\t\t\tif (message1 !== message2) {\n\t\t\t\t\t\tconst error = new NonRetryableError(\n\t\t\t\t\t\t\t// This looks like a data corruption but the culprit was that the file was overwritten\n\t\t\t\t\t\t\t// in storage. See PR #5882.\n\t\t\t\t\t\t\t// Likely to be an issue with Fluid Services. Content does not match previous client\n\t\t\t\t\t\t\t// knowledge about this file. If the file is overwritten for any reason, this error can be\n\t\t\t\t\t\t\t// hit. One example is that some clients could be submitting ops to two different service\n\t\t\t\t\t\t\t// instances such that the same sequence number is reused for two different ops.\n\t\t\t\t\t\t\t// pre-0.58 error message: twoMessagesWithSameSeqNumAndDifferentPayload\n\t\t\t\t\t\t\t\"Found two messages with the same sequenceNumber but different payloads. Likely to be a \" +\n\t\t\t\t\t\t\t\t\"service issue\",\n\t\t\t\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tmessage1,\n\t\t\t\t\t\t\t\tmessage2,\n\t\t\t\t\t\t\t\tdriverVersion: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.close(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (message.sequenceNumber === this.lastQueuedSequenceNumber + 1) {\n\t\t\t\tthis.lastQueuedSequenceNumber = message.sequenceNumber;\n\t\t\t\tthis.previouslyProcessedMessage = message;\n\t\t\t\tthis._inbound.push(message);\n\t\t\t} else {\n\t\t\t\tthis.pending.push(message);\n\t\t\t\tthis.fetchMissingDeltas(reason, message.sequenceNumber);\n\t\t\t}\n\t\t}\n\n\t\t// When / if we report a gap in ops in the future, we want telemetry to correctly reflect source\n\t\t// of prior ops. But if we have some out of order ops (this.pending), then reporting current reason\n\t\t// becomes not accurate, as the gap existed before current batch, so we should just report \"unknown\".\n\t\tthis.prevEnqueueMessagesReason = this.pending.length > 0 ? \"unknown\" : reason;\n\t}\n\n\tprivate processInboundMessage(message: ISequencedDocumentMessage): void {\n\t\tconst startTime = Date.now();\n\t\tassert(!this.currentlyProcessingOps, 0x3af /* Already processing ops. */);\n\t\tthis.currentlyProcessingOps = true;\n\t\tthis.lastProcessedMessage = message;\n\n\t\tconst isString = typeof message.clientId === \"string\";\n\t\tassert(message.clientId === null || isString, 0x41a /* undefined or string */);\n\t\t// All client messages are coming from some client, and should have clientId,\n\t\t// and non-client message should not have clientId. But, there are two exceptions:\n\t\t// 1. (Legacy) We can see message.type === \"attach\" or \"chunkedOp\" for legacy files before RTM\n\t\t// 2. Non-immediate noops (contents: null) can be sent by service without clientId\n\t\tif (!isString && isClientMessage(message) && message.type !== MessageType.NoOp) {\n\t\t\tthrow new DataCorruptionError(\"Mismatch in clientId\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tmessageType: message.type,\n\t\t\t});\n\t\t}\n\n\t\t// Validate client sequence number has no gap. Decrement the noOpCount by gap\n\t\t// If the count ends up negative, that means we have a real gap and throw error\n\t\tif (\n\t\t\tthis.connectionManager.clientId !== undefined &&\n\t\t\tthis.connectionManager.clientId === message.clientId\n\t\t) {\n\t\t\tif (message.type === MessageType.NoOp) {\n\t\t\t\tthis.noOpCount--;\n\t\t\t}\n\t\t\tconst clientSeqNumGap = message.clientSequenceNumber - this.lastClientSequenceNumber - 1;\n\t\t\tthis.noOpCount -= clientSeqNumGap;\n\t\t\tif (this.noOpCount < 0) {\n\t\t\t\tthrow new Error(`gap in client sequence number: ${clientSeqNumGap}`);\n\t\t\t}\n\t\t\tthis.lastClientSequenceNumber = message.clientSequenceNumber;\n\t\t}\n\n\t\tthis.connectionManager.beforeProcessingIncomingOp(message);\n\n\t\t// Watch the minimum sequence number and be ready to update as needed\n\t\tif (this.minSequenceNumber > message.minimumSequenceNumber) {\n\t\t\t// This indicates that an invalid series of ops was received by this client.\n\t\t\t// In the unlikely case where these ops have been truly sequenced and persisted to storage,\n\t\t\t// this document is corrupted - It will fail here on boot every time.\n\t\t\t// The more likely scenario, based on the realities of production service operation, is that\n\t\t\t// something has changed out from under the file on the server, such that the service lost some ops\n\t\t\t// which this client already processed - the very ops that made this _next_ op to appear invalid.\n\t\t\t// In this case, only this client will fail (and lose this recent data), but others will be able to connect and continue.\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t// error message through v0.57: msnMovesBackwards\n\t\t\t\t// error message through v2.1: \"Found a lower minimumSequenceNumber (msn) than previously recorded\",\n\t\t\t\t\"Invalid MinimumSequenceNumber from service - document may have been restored to previous state\",\n\t\t\t\t\"DeltaManager.processInboundMessage\",\n\t\t\t\tmessage,\n\t\t\t\t{\n\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Client ops: MSN has to be lower than sequence #, as client can continue to send ops with same\n\t\t// reference sequence number as this op.\n\t\t// System ops (when no clients are connected) are the only ops where equation is possible.\n\t\tconst diff = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (diff < 0 || (diff === 0 && message.clientId !== null)) {\n\t\t\tthrow new DataCorruptionError(\n\t\t\t\t\"MSN has to be lower than sequence #\",\n\t\t\t\textractSafePropertiesFromMessage(message),\n\t\t\t);\n\t\t}\n\n\t\tthis.minSequenceNumber = message.minimumSequenceNumber;\n\n\t\tif (message.sequenceNumber !== this.lastProcessedSequenceNumber + 1) {\n\t\t\t// pre-0.58 error message: nonSequentialSequenceNumber\n\t\t\tthrow new DataCorruptionError(\"Found a non-Sequential sequenceNumber\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t});\n\t\t}\n\t\tthis.lastProcessedSequenceNumber = message.sequenceNumber;\n\n\t\t// a bunch of code assumes that this is true\n\t\tassert(\n\t\t\tthis.lastProcessedSequenceNumber <= this.lastObservedSeqNumber,\n\t\t\t0x267 /* \"lastObservedSeqNumber should be updated first\" */,\n\t\t);\n\n\t\tif (this.handler === undefined) {\n\t\t\tthrow new Error(\"Attempted to process an inbound message without a handler attached\");\n\t\t}\n\t\tthis.handler.process(message);\n\t\tthis.currentlyProcessingOps = false;\n\t\tconst endTime = Date.now();\n\n\t\t// Should be last, after changing this.lastProcessedSequenceNumber above, as many callers\n\t\t// test this.lastProcessedSequenceNumber instead of using op.sequenceNumber itself.\n\t\tthis.emit(\"op\", message, endTime - startTime);\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate fetchMissingDeltas(reasonArg: string, to?: number): void {\n\t\tthis.fetchMissingDeltasCore(reasonArg, false /* cacheOnly */, to).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"fetchMissingDeltasException\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate async fetchMissingDeltasCore(\n\t\treason: string,\n\t\tcacheOnly: boolean,\n\t\tto?: number,\n\t): Promise<void> {\n\t\t// Exit out early if we're already fetching deltas\n\t\tif (this.fetchReason !== undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._closed) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"fetchMissingDeltasClosedConnection\",\n\t\t\t\treason,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.handler === undefined) {\n\t\t\t// We do not poses yet any information\n\t\t\tassert(this.lastQueuedSequenceNumber === 0, 0x26b /* \"initial state\" */);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlet from = this.lastQueuedSequenceNumber + 1;\n\n\t\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\t\tif (n !== undefined) {\n\t\t\t\t// If we already processed at least one op, then we have this.previouslyProcessedMessage populated\n\t\t\t\t// and can use it to validate that we are operating on same file, i.e. it was not overwritten.\n\t\t\t\t// Knowing about this mechanism, we could ask for op we already observed to increase validation.\n\t\t\t\t// This is especially useful when coming out of offline mode or loading from\n\t\t\t\t// very old cached (by client / driver) snapshot.\n\t\t\t\tassert(n === this.lastQueuedSequenceNumber, 0x0f2 /* \"previouslyProcessedMessage\" */);\n\t\t\t\tassert(from > 1, 0x0f3 /* \"not positive\" */);\n\t\t\t\tfrom--;\n\t\t\t}\n\n\t\t\tconst fetchReason = `${reason}_fetch`;\n\t\t\tthis.fetchReason = fetchReason;\n\n\t\t\tawait this.getDeltas(\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t\t(messages) => {\n\t\t\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\t\t\tthis.enqueueMessages(messages, fetchReason);\n\t\t\t\t},\n\t\t\t\tcacheOnly,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetDeltas_Exception\" }, error);\n\t\t\tthis.close(normalizeError(error));\n\t\t} finally {\n\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\tthis.fetchReason = undefined;\n\t\t\tthis.processPendingOps(reason);\n\t\t}\n\t}\n\n\t/**\n\t * Sorts pending ops and attempts to apply them\n\t */\n\tprivate processPendingOps(reason?: string): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.handler !== undefined, 0x26c /* \"handler should be installed\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.pending = [];\n\t\t// Given that we do not track where these ops came from any more, it's not very\n\t\t// actionably to report gaps in this range.\n\t\tthis.enqueueMessages(pendingSorted, `${reason}_pending`, true /* allowGaps */);\n\n\t\t// Re-entrancy is ignored by fetchMissingDeltas, execution will come here when it's over\n\t\tif (this.fetchReason === undefined) {\n\t\t\t// See issue #7312 for more details\n\t\t\t// We observe cases where client gets into situation where it is not aware of missing ops\n\t\t\t// (i.e. client being behind), and as such, does not attempt to fetch them.\n\t\t\t// In some cases client may not have enough signal (example - \"read\" connection that is silent -\n\t\t\t// there is no easy way for client to realize it's behind, see a bit of commentary / logic at the\n\t\t\t// end of setupNewSuccessfulConnection). In other cases it should be able to learn that info (\"write\"\n\t\t\t// connection, learn by receiving its own join op), but data suggest it does not happen.\n\t\t\t// In 50% of these cases we do know we are behind through checkpointSequenceNumber on connection object\n\t\t\t// and thus can leverage that to trigger recovery. But this is not going to solve all the problems\n\t\t\t// (the other 50%), and thus these errors below should be looked at even if code below results in\n\t\t\t// recovery.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if -- Docs make more sense like this\n\t\t\tif (this.lastQueuedSequenceNumber < this.lastObservedSeqNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"OpsBehind\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateLatestKnownOpSeqNumber(seq: number): void {\n\t\tif (this.lastObservedSeqNumber < seq) {\n\t\t\tthis.lastObservedSeqNumber = seq;\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"deltaManager.js","sourceRoot":"","sources":["../src/deltaManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAeH,uEAAqE;AAErE,kEAA6D;AAE7D,0EAWqD;AACrD,oEAA4F;AAC5F,uEAYkD;AAClD,+BAAkC;AAQlC,mDAA6C;AAC7C,yCAA+C;AAgD/C;;GAEG;AACH,SAAS,eAAe,CAAC,OAAqD;IAC7E,IAAI,IAAA,2BAAgB,EAAC,OAAO,CAAC,EAAE,CAAC;QAC/B,OAAO,IAAI,CAAC;IACb,CAAC;IACD,QAAQ,OAAO,CAAC,IAAI,EAAE,CAAC;QACtB,KAAK,sBAAW,CAAC,OAAO,CAAC;QACzB,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAAK,sBAAW,CAAC,IAAI,CAAC;QACtB,KAAK,sBAAW,CAAC,MAAM,CAAC;QACxB,KAAK,sBAAW,CAAC,SAAS,CAAC,CAAC,CAAC;YAC5B,OAAO,IAAI,CAAC;QACb,CAAC;QACD,OAAO,CAAC,CAAC,CAAC;YACT,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;AACF,CAAC;AAED;;;;;;GAMG;AACH,SAAS,UAAU,CAClB,SAAkB,EAClB,MAA2B,EAC3B,KAAyC;IAEzC,IAAI,SAAS,EAAE,CAAC;QACf,OAAO,IAAI,CAAC;IACb,CAAC;IACD,MAAM,QAAQ,GACb,OAAO,KAAK,KAAK,QAAQ;QACxB,CAAC,CAAC,EAAE,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IAAA,iBAAM,EAAC,IAAI,CAAC,OAAO,KAAK,SAAS,EAAE,KAAK,CAAC,mCAAmC,CAAC,CAAC;QAE9E,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,CAAC,cAAc,CAAC,CAAC;QACvF,IAAI,CAAC,OAAO,GAAG,EAAE,CAAC;QAClB,+EAA+E;QAC/E,2CAA2C;QAC3C,IAAI,CAAC,eAAe,CAAC,aAAa,EAAE,GAAG,MAAM,UAAU,EAAE,IAAI,CAAC,eAAe,CAAC,CAAC;QAE/E,wFAAwF;QACxF,IAAI,IAAI,CAAC,WAAW,KAAK,SAAS,EAAE,CAAC;YACpC,mCAAmC;YACnC,yFAAyF;YACzF,2EAA2E;YAC3E,gGAAgG;YAChG,iGAAiG;YACjG,qGAAqG;YACrG,wFAAwF;YACxF,uGAAuG;YACvG,kGAAkG;YAClG,iGAAiG;YACjG,YAAY;YACZ,kFAAkF;YAClF,IAAI,IAAI,CAAC,wBAAwB,GAAG,IAAI,CAAC,qBAAqB,EAAE,CAAC;gBAChE,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,CAAC;YACtC,CAAC;QACF,CAAC;IACF,CAAC;IAEO,4BAA4B,CAAC,GAAW;QAC/C,IAAI,IAAI,CAAC,qBAAqB,GAAG,GAAG,EAAE,CAAC;YACtC,IAAI,CAAC,qBAAqB,GAAG,GAAG,CAAC;QAClC,CAAC;IACF,CAAC;CACD;AA3mCD,oCA2mCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport type {\n\tIDeltaManagerEvents,\n\tIDeltaManagerFull,\n\tIDeltaQueue,\n\tIDeltaSender,\n\tReadOnlyInfo,\n} from \"@fluidframework/container-definitions/internal\";\nimport type {\n\tIEventProvider,\n\tITelemetryBaseEvent,\n\tITelemetryBaseProperties,\n} from \"@fluidframework/core-interfaces\";\nimport { JsonParse } from \"@fluidframework/core-interfaces/internal\";\nimport type { IThrottlingWarning, JsonString } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\ttype IDocumentDeltaStorageService,\n\ttype IDocumentService,\n\tDriverErrorTypes,\n\ttype IDocumentMessage,\n\tMessageType,\n\ttype ISequencedDocumentMessage,\n\ttype ISignalMessage,\n\ttype IClientDetails,\n\ttype IClientConfiguration,\n\ttype ISequencedDocumentSystemMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { NonRetryableError, isRuntimeMessage } from \"@fluidframework/driver-utils/internal\";\nimport {\n\ttype ITelemetryErrorEventExt,\n\ttype ITelemetryGenericEventExt,\n\ttype ITelemetryLoggerExt,\n\tDataCorruptionError,\n\tDataProcessingError,\n\tUsageError,\n\textractSafePropertiesFromMessage,\n\tisFluidError,\n\tnormalizeError,\n\tsafeRaiseEvent,\n\tEventEmitterWithErrorHandling,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type {\n\tIConnectionDetailsInternal,\n\tIConnectionManager,\n\tIConnectionManagerFactoryArgs,\n\tIConnectionStateChangeReason,\n} from \"./contracts.js\";\nimport { DeltaQueue } from \"./deltaQueue.js\";\nimport { ThrottlingWarning } from \"./error.js\";\n\nexport interface IConnectionArgs {\n\tmode?: ConnectionMode;\n\tfetchOpsFromStorage?: boolean;\n\treason: IConnectionStateChangeReason;\n}\n\n/**\n * Includes events emitted by the concrete implementation DeltaManager\n * but not exposed on the public interface IDeltaManager\n */\nexport interface IDeltaManagerInternalEvents extends IDeltaManagerEvents {\n\t(event: \"throttled\", listener: (error: IThrottlingWarning) => void);\n\t(event: \"closed\" | \"disposed\", listener: (error?: ICriticalContainerError) => void);\n\t(\n\t\tevent: \"connect\",\n\t\tlistener: (details: IConnectionDetailsInternal, opsBehind?: number) => void,\n\t);\n\t(event: \"establishingConnection\", listener: (reason: IConnectionStateChangeReason) => void);\n\t(\n\t\tevent: \"cancelEstablishingConnection\",\n\t\tlistener: (reason: IConnectionStateChangeReason) => void,\n\t);\n}\n\n/**\n * Batching makes assumptions about what might be on the metadata. This interface codifies those assumptions, but does not validate them.\n */\ninterface IBatchMetadata {\n\tbatch?: boolean;\n}\n\n/**\n * Interface used to define a strategy for handling incoming delta messages\n */\nexport interface IDeltaHandlerStrategy {\n\t/**\n\t * Processes the message.\n\t */\n\tprocess: (message: ISequencedDocumentMessage) => void;\n\n\t/**\n\t * Processes the signal.\n\t */\n\tprocessSignal: (message: ISignalMessage) => void;\n}\n\n/**\n * Determines if message was sent by client, not service\n */\nfunction isClientMessage(message: ISequencedDocumentMessage | IDocumentMessage): boolean {\n\tif (isRuntimeMessage(message)) {\n\t\treturn true;\n\t}\n\tswitch (message.type) {\n\t\tcase MessageType.Propose:\n\t\tcase MessageType.Reject:\n\t\tcase MessageType.NoOp:\n\t\tcase MessageType.Accept:\n\t\tcase MessageType.Summarize: {\n\t\t\treturn true;\n\t\t}\n\t\tdefault: {\n\t\t\treturn false;\n\t\t}\n\t}\n}\n\n/**\n * Like assert, but logs only if the condition is false, rather than throwing\n * @param condition - The condition to attest too\n * @param logger - The logger to log with\n * @param event - The string or event to log\n * @returns The outcome of the condition\n */\nfunction logIfFalse(\n\tcondition: boolean,\n\tlogger: ITelemetryLoggerExt,\n\tevent: string | ITelemetryGenericEventExt,\n): condition is true {\n\tif (condition) {\n\t\treturn true;\n\t}\n\tconst newEvent: ITelemetryBaseEvent =\n\t\ttypeof event === \"string\"\n\t\t\t? { eventName: event, category: \"error\" }\n\t\t\t: { category: \"error\", ...event };\n\tlogger.send(newEvent);\n\treturn false;\n}\n\n/**\n * Manages the flow of both inbound and outbound messages. This class ensures that shared objects receive delta\n * messages in order regardless of possible network conditions or timings causing out of order delivery.\n */\nexport class DeltaManager<TConnectionManager extends IConnectionManager>\n\textends EventEmitterWithErrorHandling<IDeltaManagerInternalEvents>\n\timplements IDeltaManagerFull, IEventProvider<IDeltaManagerInternalEvents>\n{\n\tpublic readonly connectionManager: TConnectionManager;\n\n\tpublic get active(): boolean {\n\t\treturn this._active();\n\t}\n\n\tpublic get disposed(): boolean {\n\t\treturn this._closed;\n\t}\n\n\tpublic get IDeltaSender(): IDeltaSender {\n\t\treturn this;\n\t}\n\n\tprivate pending: ISequencedDocumentMessage[] = [];\n\tprivate fetchReason: string | undefined;\n\n\t// A boolean used to assert that ops are not being sent while processing another op.\n\tprivate currentlyProcessingOps: boolean = false;\n\n\t// The minimum sequence number and last sequence number received from the server\n\tprivate minSequenceNumber: number = 0;\n\n\t// There are three numbers we track\n\t// * lastQueuedSequenceNumber is the last queued sequence number. If there are gaps in seq numbers, then this number\n\t// is not updated until we cover that gap, so it increases each time by 1.\n\t// * lastObservedSeqNumber is an estimation of last known sequence number for container in storage. It's initially\n\t// populated at web socket connection time (if storage provides that info) and is updated once ops shows up.\n\t// It's never less than lastQueuedSequenceNumber\n\t// * lastProcessedSequenceNumber - last processed sequence number\n\tprivate lastQueuedSequenceNumber: number = 0;\n\tprivate lastObservedSeqNumber: number = 0;\n\tprivate lastProcessedSequenceNumber: number = 0;\n\tprivate lastProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t/**\n\t * Map of clientId to the last observed message from that client. This is used to validate\n\t * that clientSequenceNumbers are always increasing for a given clientId.\n\t */\n\tprivate readonly lastObservedMessageByClient = new Map<string, ISequencedDocumentMessage>();\n\n\t/**\n\t * Count the number of noops sent by the client which may not be acked\n\t */\n\tprivate noOpCount: number = 0;\n\t/**\n\t * Track clientSequenceNumber of the last op\n\t */\n\tprivate lastClientSequenceNumber: number = 0;\n\n\t/**\n\t * Track down the ops size.\n\t */\n\tprivate opsSize: number = 0;\n\tprivate prevEnqueueMessagesReason: string | undefined;\n\tprivate previouslyProcessedMessage: ISequencedDocumentMessage | undefined;\n\n\t// The sequence number we initially loaded from\n\t// In case of reading from a snapshot or pending state, its value will be equal to\n\t// the last message that got serialized.\n\tprivate initSequenceNumber: number = 0;\n\n\tprivate readonly _inbound: DeltaQueue<ISequencedDocumentMessage>;\n\tprivate readonly _inboundSignal: DeltaQueue<\n\t\tISignalMessage<{ type: never; content: JsonString<unknown> }>\n\t>;\n\n\tprivate _closed = false;\n\tprivate _disposed = false;\n\n\tprivate handler: IDeltaHandlerStrategy | undefined;\n\tprivate deltaStorage: IDocumentDeltaStorageService | undefined;\n\n\tprivate readonly throttlingIdSet = new Set<string>();\n\tprivate timeTillThrottling: number = 0;\n\n\tpublic readonly closeAbortController = new AbortController();\n\n\tprivate readonly deltaStorageDelayId = uuid();\n\tprivate readonly deltaStreamDelayId = uuid();\n\n\tprivate messageBuffer: IDocumentMessage[] = [];\n\n\tprivate _checkpointSequenceNumber: number | undefined;\n\n\tpublic get inbound(): IDeltaQueue<ISequencedDocumentMessage> {\n\t\treturn this._inbound;\n\t}\n\n\tpublic get inboundSignal(): IDeltaQueue<ISignalMessage> {\n\t\treturn this._inboundSignal;\n\t}\n\n\tpublic get initialSequenceNumber(): number {\n\t\treturn this.initSequenceNumber;\n\t}\n\n\tpublic get lastSequenceNumber(): number {\n\t\treturn this.lastProcessedSequenceNumber;\n\t}\n\n\tpublic get lastMessage(): ISequencedDocumentMessage | undefined {\n\t\treturn this.lastProcessedMessage;\n\t}\n\n\tpublic get lastKnownSeqNumber(): number {\n\t\treturn this.lastObservedSeqNumber;\n\t}\n\n\tpublic get minimumSequenceNumber(): number {\n\t\treturn this.minSequenceNumber;\n\t}\n\n\t/**\n\t * Tells if current connection has checkpoint information.\n\t * I.e. we know how far behind the client was at the time of establishing connection\n\t */\n\tpublic get hasCheckpointSequenceNumber(): boolean {\n\t\t// Valid to be called only if we have active connection.\n\t\tassert(this.connectionManager.connected, 0x0df /* \"Missing active connection\" */);\n\t\treturn this._checkpointSequenceNumber !== undefined;\n\t}\n\n\t// Forwarding connection manager properties / IDeltaManager implementation\n\tpublic get maxMessageSize(): number {\n\t\treturn this.connectionManager.maxMessageSize;\n\t}\n\tpublic get version(): string {\n\t\treturn this.connectionManager.version;\n\t}\n\tpublic get serviceConfiguration(): IClientConfiguration | undefined {\n\t\treturn this.connectionManager.serviceConfiguration;\n\t}\n\tpublic get outbound(): IDeltaQueue<IDocumentMessage[]> {\n\t\treturn this.connectionManager.outbound;\n\t}\n\tpublic get readOnlyInfo(): ReadOnlyInfo {\n\t\treturn this.connectionManager.readOnlyInfo;\n\t}\n\tpublic get clientDetails(): IClientDetails {\n\t\treturn this.connectionManager.clientDetails;\n\t}\n\n\tpublic submit(\n\t\ttype: MessageType,\n\t\tcontents?: string,\n\t\tbatch = false,\n\t\tmetadata?: unknown,\n\t\tcompression?: string,\n\t\treferenceSequenceNumber?: number,\n\t): number {\n\t\t// Back-compat ADO:3455\n\t\tconst backCompatRefSeqNum = referenceSequenceNumber ?? this.lastProcessedSequenceNumber;\n\t\tconst messagePartial: Omit<IDocumentMessage, \"clientSequenceNumber\"> = {\n\t\t\tcontents,\n\t\t\tmetadata,\n\t\t\treferenceSequenceNumber: backCompatRefSeqNum,\n\t\t\ttype,\n\t\t\tcompression,\n\t\t};\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\tconst message = this.connectionManager.prepareMessageToSend(messagePartial);\n\t\tif (message === undefined) {\n\t\t\treturn -1;\n\t\t}\n\n\t\tassert(isClientMessage(message), 0x419 /* client sends non-client message */);\n\n\t\tif (contents !== undefined) {\n\t\t\tthis.opsSize += contents.length;\n\t\t}\n\n\t\tthis.messageBuffer.push(message);\n\n\t\tif (message.type === MessageType.NoOp) {\n\t\t\tthis.noOpCount++;\n\t\t}\n\n\t\tthis.emit(\"submitOp\", message);\n\n\t\tif (!batch) {\n\t\t\tthis.flush();\n\t\t}\n\t\treturn message.clientSequenceNumber;\n\t}\n\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\treturn this.connectionManager.submitSignal(content, targetClientId);\n\t}\n\n\tpublic flush(): void {\n\t\tconst batch = this.messageBuffer;\n\t\tif (batch.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.messageBuffer = [];\n\n\t\t// The prepareFlush event allows listeners to append metadata to the batch prior to submission.\n\t\tthis.emit(\"prepareSend\", batch);\n\n\t\tif (batch.length === 1) {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === undefined,\n\t\t\t\t0x3c9 /* no batch markup on single message */,\n\t\t\t);\n\t\t} else {\n\t\t\tassert(\n\t\t\t\t(batch[0].metadata as IBatchMetadata)?.batch === true,\n\t\t\t\t0x3ca /* no start batch markup */,\n\t\t\t);\n\t\t\tassert(\n\t\t\t\t(batch[batch.length - 1].metadata as IBatchMetadata)?.batch === false,\n\t\t\t\t0x3cb /* no end batch markup */,\n\t\t\t);\n\t\t}\n\n\t\tthis.connectionManager.sendMessages(batch);\n\n\t\tassert(this.messageBuffer.length === 0, 0x3cc /* reentrancy */);\n\t}\n\n\tpublic get connectionProps(): ITelemetryBaseProperties {\n\t\treturn {\n\t\t\tsequenceNumber: this.lastSequenceNumber,\n\t\t\topsSize: this.opsSize > 0 ? this.opsSize : undefined,\n\t\t\tdeltaManagerState: this._disposed ? \"disposed\" : this._closed ? \"closed\" : \"open\",\n\t\t\t...this.connectionManager.connectionProps,\n\t\t};\n\t}\n\n\t/**\n\t * Log error event with a bunch of internal to DeltaManager information about state of op processing\n\t * Used to diagnose connectivity issues related to op processing (i.e. cases where for some reason\n\t * we stop processing ops that results in no processing join op and thus moving to connected state)\n\t * @param event - Event to log.\n\t */\n\tpublic logConnectionIssue(event: ITelemetryErrorEventExt): void {\n\t\tassert(this.connectionManager.connected, 0x238 /* \"called only in connected state\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\t...event,\n\t\t\t// This directly tells us if fetching ops is in flight, and thus likely the reason of\n\t\t\t// stalled op processing\n\t\t\tfetchReason: this.fetchReason,\n\t\t\t// A bunch of useful sequence numbers to understand if we are holding some ops from processing\n\t\t\tlastQueuedSequenceNumber: this.lastQueuedSequenceNumber, // last sequential op\n\t\t\tlastProcessedSequenceNumber: this.lastProcessedSequenceNumber, // same as above, but after processing\n\t\t\tlastObserved: this.lastObservedSeqNumber, // last sequence we ever saw; may have gaps with above.\n\t\t\t// connection info\n\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\tpendingOps: this.pending.length, // Do we have any pending ops?\n\t\t\tpendingFirst: pendingSorted[0]?.sequenceNumber, // is the first pending op the one that we are missing?\n\t\t\thaveHandler: this.handler !== undefined, // do we have handler installed?\n\t\t\tinboundLength: this.inbound.length,\n\t\t\tinboundPaused: this.inbound.paused,\n\t\t});\n\t}\n\n\tconstructor(\n\t\tprivate readonly serviceProvider: () => IDocumentService | undefined,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly _active: () => boolean,\n\t\tcreateConnectionManager: (props: IConnectionManagerFactoryArgs) => TConnectionManager,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.logger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaManagerEventHandlerException\",\n\t\t\t\t\tname: typeof name === \"string\" ? name : undefined,\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\t\tconst props: IConnectionManagerFactoryArgs = {\n\t\t\tincomingOpHandler: (messages: ISequencedDocumentMessage[], reason: string) => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.enqueueMessages(messages, reason);\n\t\t\t\t} catch (error) {\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"EnqueueMessages_Exception\" }, error);\n\t\t\t\t\tthis.close(normalizeError(error));\n\t\t\t\t}\n\t\t\t},\n\t\t\tsignalHandler: (\n\t\t\t\tsignals: ISignalMessage<{ type: never; content: JsonString<unknown> }>[],\n\t\t\t) => {\n\t\t\t\tfor (const signal of signals) {\n\t\t\t\t\tthis._inboundSignal.push(signal);\n\t\t\t\t}\n\t\t\t},\n\t\t\treconnectionDelayHandler: (delayMs: number, error: unknown) =>\n\t\t\t\tthis.emitDelayInfo(this.deltaStreamDelayId, delayMs, error),\n\t\t\tcloseHandler: (error: ICriticalContainerError | undefined) => this.close(error),\n\t\t\tdisconnectHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.disconnectHandler(reason),\n\t\t\tconnectHandler: (connection: IConnectionDetailsInternal) =>\n\t\t\t\tthis.connectHandler(connection),\n\t\t\tpongHandler: (latency: number) => this.emit(\"pong\", latency),\n\t\t\treadonlyChangeHandler: (\n\t\t\t\treadonly?: boolean,\n\t\t\t\treadonlyConnectionReason?: IConnectionStateChangeReason,\n\t\t\t) => {\n\t\t\t\tsafeRaiseEvent(this, this.logger, \"readonly\", readonly, readonlyConnectionReason);\n\t\t\t},\n\t\t\testablishConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.establishingConnection(reason),\n\t\t\tcancelConnectionHandler: (reason: IConnectionStateChangeReason) =>\n\t\t\t\tthis.cancelEstablishingConnection(reason),\n\t\t};\n\n\t\tthis.connectionManager = createConnectionManager(props);\n\t\tthis._inbound = new DeltaQueue<ISequencedDocumentMessage>((op) => {\n\t\t\tthis.processInboundMessage(op);\n\t\t});\n\n\t\tthis._inbound.on(\"error\", (error) => {\n\t\t\tthis.close(\n\t\t\t\tDataProcessingError.wrapIfUnrecognized(\n\t\t\t\t\terror,\n\t\t\t\t\t\"deltaManagerInboundErrorHandler\",\n\t\t\t\t\tthis.lastMessage,\n\t\t\t\t),\n\t\t\t);\n\t\t});\n\n\t\t// Inbound signal queue\n\t\tthis._inboundSignal = new DeltaQueue<\n\t\t\tISignalMessage<{ type: never; content: JsonString<unknown> }>\n\t\t>((message) => {\n\t\t\tif (this.handler === undefined) {\n\t\t\t\tthrow new Error(\"Attempted to process an inbound signal without a handler attached\");\n\t\t\t}\n\n\t\t\tthis.handler.processSignal({\n\t\t\t\t...message,\n\t\t\t\tcontent: JsonParse(message.content),\n\t\t\t});\n\t\t});\n\n\t\tthis._inboundSignal.on(\"error\", (error) => {\n\t\t\tthis.close(normalizeError(error));\n\t\t});\n\n\t\t// Initially, all queues are created paused.\n\t\t// - outbound is flipped back and forth in setupNewSuccessfulConnection / disconnectFromDeltaStream\n\t\t// - inbound & inboundSignal are resumed in attachOpHandler() when we have handler setup\n\t}\n\n\tprivate cancelEstablishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"cancelEstablishingConnection\", reason);\n\t}\n\n\tprivate establishingConnection(reason: IConnectionStateChangeReason): void {\n\t\tthis.emit(\"establishingConnection\", reason);\n\t}\n\n\tprivate connectHandler(connection: IConnectionDetailsInternal): void {\n\t\tthis.refreshDelayInfo(this.deltaStreamDelayId);\n\n\t\tconst props = this.connectionManager.connectionVerboseProps;\n\t\tprops.connectionLastQueuedSequenceNumber = this.lastQueuedSequenceNumber;\n\t\tprops.connectionLastObservedSeqNumber = this.lastObservedSeqNumber;\n\n\t\tconst checkpointSequenceNumber = connection.checkpointSequenceNumber;\n\t\tthis._checkpointSequenceNumber = checkpointSequenceNumber;\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\tthis.updateLatestKnownOpSeqNumber(checkpointSequenceNumber);\n\t\t}\n\n\t\t// We cancel all ops on lost of connectivity, and rely on DDSes to resubmit them.\n\t\t// Semantics are not well defined for batches (and they are broken right now on disconnects anyway),\n\t\t// but it's safe to assume (until better design is put into place) that batches should not exist\n\t\t// across multiple connections. Right now we assume runtime will not submit any ops in disconnected\n\t\t// state. As requirements change, so should these checks.\n\t\tassert(\n\t\t\tthis.messageBuffer.length === 0,\n\t\t\t0x0e9 /* \"messageBuffer is not empty on new connection\" */,\n\t\t);\n\n\t\tthis.opsSize = 0;\n\t\tthis.noOpCount = 0;\n\n\t\tthis.emit(\n\t\t\t\"connect\",\n\t\t\tconnection,\n\t\t\tcheckpointSequenceNumber === undefined\n\t\t\t\t? undefined\n\t\t\t\t: this.lastObservedSeqNumber - this.lastSequenceNumber,\n\t\t);\n\n\t\t// If we got some initial ops, then we know the gap and call above fetched ops to fill it.\n\t\t// Same is true for \"write\" mode even if we have no ops - we will get \"join\" own op very very soon.\n\t\t// However if we are connecting as view-only, then there is no good signal to realize if client is behind.\n\t\t// Thus we have to hit storage to see if any ops are there.\n\t\tif (checkpointSequenceNumber !== undefined) {\n\t\t\t// We know how far we are behind (roughly). If it's non-zero gap, fetch ops right away.\n\t\t\tif (checkpointSequenceNumber > this.lastQueuedSequenceNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"AfterConnection\");\n\t\t\t}\n\t\t\t// we do not know the gap, and we will not learn about it if socket is quite - have to ask.\n\t\t} else if (connection.mode === \"read\") {\n\t\t\tthis.fetchMissingDeltas(\"AfterReadConnection\");\n\t\t}\n\t}\n\n\t/**\n\t * Sets the sequence number from which inbound messages should be returned\n\t * @param snapshotSequenceNumber - The sequence number of the snapshot at which the document loaded from.\n\t * @param lastProcessedSequenceNumber - The last processed sequence number, for offline, it should be greater than the sequence number.\n\t * Setting lastProcessedSequenceNumber allows the DeltaManager to skip downloading and processing ops that have already been processed.\n\t */\n\tpublic async attachOpHandler(\n\t\tminSequenceNumber: number,\n\t\tsnapshotSequenceNumber: number,\n\t\thandler: IDeltaHandlerStrategy,\n\t\tprefetchType: \"cached\" | \"all\" | \"none\" = \"none\",\n\t\tlastProcessedSequenceNumber: number = snapshotSequenceNumber,\n\t): Promise<void> {\n\t\tthis.initSequenceNumber = snapshotSequenceNumber;\n\t\tthis.lastProcessedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.minSequenceNumber = minSequenceNumber;\n\t\tthis.lastQueuedSequenceNumber = lastProcessedSequenceNumber;\n\t\tthis.lastObservedSeqNumber = lastProcessedSequenceNumber;\n\n\t\t// We will use same check in other places to make sure all the seq number above are set properly.\n\t\tassert(\n\t\t\tthis.handler === undefined,\n\t\t\t0x0e2 /* \"DeltaManager already has attached op handler!\" */,\n\t\t);\n\t\tthis.handler = handler;\n\t\t// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions\n\t\tassert(!!this.handler, 0x0e3 /* \"Newly set op handler is null/undefined!\" */);\n\n\t\t// There should be no pending fetch!\n\t\t// This API is called right after attachOpHandler by Container.load().\n\t\t// We might have connection already and it might have called fetchMissingDeltas() from\n\t\t// setupNewSuccessfulConnection. But it should do nothing, because there is no way to fetch ops before\n\t\t// we know snapshot sequence number that is set in attachOpHandler. So all such calls should be noop.\n\t\tassert(\n\t\t\tthis.fetchReason === undefined,\n\t\t\t0x268 /* \"There can't be pending fetch that early in boot sequence!\" */,\n\t\t);\n\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._inbound.resume();\n\t\tthis._inboundSignal.resume();\n\n\t\tif (prefetchType !== \"none\") {\n\t\t\tconst cacheOnly = prefetchType === \"cached\";\n\t\t\tawait this.fetchMissingDeltasCore(`DocumentOpen_${prefetchType}`, cacheOnly);\n\n\t\t\t// Keep going with fetching ops from storage once we have all cached ops in.\n\t\t\t// But do not block load and make this request async / not blocking this api.\n\t\t\t// Ops processing will start once cached ops are in and and will stop when queue is empty\n\t\t\t// (which in most cases will happen when we are done processing cached ops)\n\t\t\tif (cacheOnly) {\n\t\t\t\t// fire and forget\n\t\t\t\tthis.fetchMissingDeltas(\"PostDocumentOpen\");\n\t\t\t}\n\t\t}\n\n\t\t// Ensure there is no need to call this.processPendingOps() at the end of boot sequence\n\t\tassert(\n\t\t\tthis.fetchReason !== undefined || this.pending.length === 0,\n\t\t\t0x269 /* \"pending ops are not dropped\" */,\n\t\t);\n\t}\n\n\tpublic connect(args: IConnectionArgs): void {\n\t\tconst fetchOpsFromStorage = args.fetchOpsFromStorage ?? true;\n\t\tlogIfFalse(\n\t\t\tthis.handler !== undefined || !fetchOpsFromStorage,\n\t\t\tthis.logger,\n\t\t\t\"CantFetchWithoutBaseline\",\n\t\t); // can't fetch if no baseline\n\n\t\t// Note: There is race condition here.\n\t\t// We want to issue request to storage as soon as possible, to\n\t\t// reduce latency of becoming current, thus this code here.\n\t\t// But there is no ordering between fetching OPs and connection to delta stream\n\t\t// As result, we might be behind by the time we connect to delta stream\n\t\t// In case of r/w connection, that's not an issue, because we will hear our\n\t\t// own \"join\" message and realize any gap client has in ops.\n\t\t// But for view-only connection, we have no such signal, and with no traffic\n\t\t// on the wire, we might be always behind.\n\t\t// See comment at the end of \"connect\" handler\n\t\tif (fetchOpsFromStorage) {\n\t\t\tthis.fetchMissingDeltas(args.reason.text);\n\t\t}\n\n\t\tthis.connectionManager.connect(args.reason, args.mode);\n\t}\n\n\tprivate async getDeltas(\n\t\tfrom: number, // inclusive\n\t\tto: number | undefined, // exclusive\n\t\tfetchReason: string,\n\t\tcallback: (messages: ISequencedDocumentMessage[]) => void,\n\t\tcacheOnly: boolean,\n\t): Promise<void> {\n\t\tconst docService = this.serviceProvider();\n\t\tif (docService === undefined) {\n\t\t\tthrow new Error(\"Delta manager is not attached\");\n\t\t}\n\n\t\tif (this.deltaStorage === undefined) {\n\t\t\tthis.deltaStorage = await docService.connectToDeltaStorage();\n\t\t}\n\n\t\tlet cancelFetch: (op: ISequencedDocumentMessage) => boolean;\n\n\t\tif (to === undefined) {\n\t\t\t// Unbound requests are made to proactively fetch ops, but also get up to date in cases where socket\n\t\t\t// is silent (and connection is \"read\", thus we might not have any data on how far client is behind).\n\t\t\t// Once we have any op coming in from socket, we can cancel it as it's not needed any more.\n\t\t\t// That said, if we have socket connection, make sure we got ops up to checkpointSequenceNumber!\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= this.lastObservedSeqNumber;\n\t\t} else {\n\t\t\tconst lastExpectedOp = to - 1; // make it inclusive!\n\n\t\t\t// It is possible that due to asynchrony (including await above), required ops were already\n\t\t\t// received through delta stream. Validate that before moving forward.\n\t\t\tif (this.lastQueuedSequenceNumber >= lastExpectedOp) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\treason: fetchReason,\n\t\t\t\t\teventName: \"ExtraStorageCall\",\n\t\t\t\t\tearly: true,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\t// Be prepared for the case where webSocket would receive the ops that we are trying to fill through\n\t\t\t// storage. Ideally it should never happen (i.e. ops on socket are always ordered, and thus once we\n\t\t\t// detected gap, this gap can't be filled in later on through websocket).\n\t\t\t// And in practice that does look like the case. The place where this code gets hit is if we lost\n\t\t\t// connection and reconnected (likely to another box), and new socket's initial ops contains these ops.\n\t\t\tcancelFetch = (op: ISequencedDocumentMessage): boolean =>\n\t\t\t\top.sequenceNumber >= lastExpectedOp;\n\t\t}\n\n\t\tconst controller = new AbortController();\n\t\tlet opsFromFetch = false;\n\n\t\tconst opListener = (op: ISequencedDocumentMessage): void => {\n\t\t\tassert(op.sequenceNumber === this.lastQueuedSequenceNumber, 0x23a /* \"seq#'s\" */);\n\t\t\t// Ops that are coming from this request should not cancel itself.\n\t\t\t// This is useless for known ranges (to is defined) as it means request is over either way.\n\t\t\t// And it will cancel unbound request too early, not allowing us to learn where the end of the file is.\n\t\t\tif (!opsFromFetch && cancelFetch(op)) {\n\t\t\t\tcontroller.abort(\"DeltaManager getDeltas fetch cancelled\");\n\t\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\t}\n\t\t};\n\n\t\ttry {\n\t\t\tthis._inbound.on(\"push\", opListener);\n\t\t\tassert(this.closeAbortController.signal.onabort === null, 0x1e8 /* \"reentrancy\" */);\n\t\t\tthis.closeAbortController.signal.addEventListener(\"abort\", () =>\n\t\t\t\tcontroller.abort(this.closeAbortController.signal.reason),\n\t\t\t);\n\n\t\t\tconst stream = this.deltaStorage.fetchMessages(\n\t\t\t\tfrom, // inclusive\n\t\t\t\tto, // exclusive\n\t\t\t\tcontroller.signal,\n\t\t\t\tcacheOnly,\n\t\t\t\tfetchReason,\n\t\t\t);\n\n\t\t\t// eslint-disable-next-line no-constant-condition\n\t\t\twhile (true) {\n\t\t\t\tconst result = await stream.read();\n\t\t\t\tif (result.done) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\t\t\t\ttry {\n\t\t\t\t\topsFromFetch = true;\n\t\t\t\t\tcallback(result.value);\n\t\t\t\t} finally {\n\t\t\t\t\topsFromFetch = false;\n\t\t\t\t}\n\t\t\t}\n\t\t} finally {\n\t\t\tif (controller.signal.aborted) {\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"DeltaManager_GetDeltasAborted\",\n\t\t\t\t\tfetchReason,\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment\n\t\t\t\t\treason: controller.signal.reason,\n\t\t\t\t});\n\t\t\t}\n\t\t\t// eslint-disable-next-line unicorn/no-null, unicorn/prefer-add-event-listener\n\t\t\tthis.closeAbortController.signal.onabort = null;\n\t\t\tthis._inbound.off(\"push\", opListener);\n\t\t\tassert(!opsFromFetch, 0x289 /* \"logic error\" */);\n\t\t}\n\t}\n\n\t/**\n\t * Closes the connection and clears inbound & outbound queues.\n\t *\n\t * Differences from dispose:\n\t * - close will trigger readonly notification\n\t * - close emits \"closed\"\n\t * - close cannot be called after dispose\n\t */\n\tpublic close(error?: ICriticalContainerError): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\t\tthis._closed = true;\n\n\t\tthis.connectionManager.dispose(error, true /* switchToReadonly */);\n\t\tthis.clearQueues();\n\t\tthis.emit(\"closed\", error);\n\t}\n\n\t/**\n\t * Disposes the connection and clears the inbound & outbound queues.\n\t *\n\t * Differences from close:\n\t * - dispose will emit \"disposed\"\n\t * - dispose will remove all listeners\n\t * - dispose can be called after closure\n\t */\n\tpublic dispose(error?: Error | ICriticalContainerError): void {\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\t\tif (error !== undefined && !isFluidError(error)) {\n\t\t\tthrow new UsageError(\"Error must be a Fluid error\");\n\t\t}\n\n\t\tthis._disposed = true;\n\t\tthis._closed = true; // We consider \"disposed\" as a further state than \"closed\"\n\n\t\tthis.connectionManager.dispose(error, false /* switchToReadonly */);\n\t\tthis.clearQueues();\n\n\t\t// This needs to be the last thing we do (before removing listeners), as it causes\n\t\t// Container to dispose context and break ability of data stores / runtime to \"hear\" from delta manager.\n\t\tthis.emit(\"disposed\", error);\n\t\tthis.removeAllListeners();\n\t}\n\n\tprivate clearQueues(): void {\n\t\tthis.closeAbortController.abort(\"DeltaManager is closed\");\n\n\t\tthis._inbound.clear();\n\t\tthis._inboundSignal.clear();\n\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inbound.pause();\n\t\t// eslint-disable-next-line @typescript-eslint/no-floating-promises\n\t\tthis._inboundSignal.pause();\n\n\t\t// Drop pending messages - this will ensure catchUp() does not go into infinite loop\n\t\tthis.pending = [];\n\t}\n\n\tpublic refreshDelayInfo(id: string): void {\n\t\tthis.throttlingIdSet.delete(id);\n\t\tif (this.throttlingIdSet.size === 0) {\n\t\t\tthis.timeTillThrottling = 0;\n\t\t}\n\t}\n\n\tprivate disconnectHandler(reason: IConnectionStateChangeReason): void {\n\t\tthis.messageBuffer.length = 0;\n\t\tthis.emit(\"disconnect\", reason.text, reason.error);\n\t}\n\n\t/**\n\t * Emit info about a delay in service communication on account of throttling.\n\t * @param id - Id of the connection that is delayed\n\t * @param delayMs - Duration of the delay\n\t * @param error - error object indicating the throttling\n\t */\n\tpublic emitDelayInfo(id: string, delayMs: number, error: unknown): void {\n\t\tconst timeNow = Date.now();\n\t\tthis.throttlingIdSet.add(id);\n\t\tif (delayMs > 0 && timeNow + delayMs > this.timeTillThrottling) {\n\t\t\tthis.timeTillThrottling = timeNow + delayMs;\n\n\t\t\tconst throttlingWarning: IThrottlingWarning = ThrottlingWarning.wrap(\n\t\t\t\terror,\n\t\t\t\tdelayMs / 1000 /* retryAfterSeconds */,\n\t\t\t\tthis.logger,\n\t\t\t);\n\t\t\tthis.emit(\"throttled\", throttlingWarning);\n\t\t}\n\t}\n\n\t// returns parts of message (in string format) that should never change for a given message.\n\t// Used for message comparison. It attempts to avoid comparing fields that potentially may differ.\n\t// for example, it's not clear if serverMetadata or timestamp property is a property of message or server state.\n\t// We only extract the most obvious fields that are sufficient (with high probability) to detect sequence number\n\t// reuse.\n\t// Also payload goes to telemetry, so no content or anything else that shouldn't be logged for privacy reasons\n\t// Note: It's possible for a duplicate op to be broadcasted and have everything the same except the timestamp.\n\tprivate comparableMessagePayload(m: ISequencedDocumentMessage): string {\n\t\treturn `${m.clientId}-${m.type}-${m.sequenceNumber}-${m.minimumSequenceNumber}-${m.referenceSequenceNumber}-${m.timestamp}`;\n\t}\n\n\t/**\n\t * Validates that the clientSequenceNumber for a given clientId is always increasing.\n\t * @param message - The message to validate.\n\t */\n\tprivate validateClientSequenceNumberConsistency(message: ISequencedDocumentMessage): void {\n\t\t// Once client leaves, we no longer need to track its last observed message as the client won't send messages.\n\t\tif (message.type === MessageType.ClientLeave) {\n\t\t\tconst systemLeaveMessage = message as ISequencedDocumentSystemMessage;\n\t\t\tconst clientId = JSON.parse(systemLeaveMessage.data) as string;\n\t\t\tthis.lastObservedMessageByClient.delete(clientId);\n\t\t}\n\n\t\tif (message.clientId === null) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst lastObservedClientMessage = this.lastObservedMessageByClient.get(message.clientId);\n\t\tif (\n\t\t\tlastObservedClientMessage !== undefined &&\n\t\t\tmessage.clientSequenceNumber <= lastObservedClientMessage.clientSequenceNumber\n\t\t) {\n\t\t\t// This looks like a data corruption issue where the clientSequenceNumber for a given clientId is not\n\t\t\t// increasing. The Fluid Service ensures that it only processes ops with contiguous increasing\n\t\t\t// clientSequenceNumbers for a given clientId.\n\t\t\t// So, if we see this error, it is likely a service issue.\n\t\t\t// One example of this is if the service sequences the same op more than once. In this case, all the\n\t\t\t// properties except the sequenceNumber will be the same.\n\t\t\t// Note that we are not checking for gaps in clientSequenceNumber because very old clients may have gaps\n\t\t\t// as per the op stream in the snapshot tests under test/snapshots/content.\n\t\t\tconst error = new DataCorruptionError(\n\t\t\t\t\"Found two messages with non-increasing clientSequenceNumber for a given client. Likely to be a service issue\",\n\t\t\t\t{\n\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\tmessage1: this.comparableMessagePayload(lastObservedClientMessage),\n\t\t\t\t\tmessage2: this.comparableMessagePayload(message),\n\t\t\t\t},\n\t\t\t);\n\t\t\tthis.close(error);\n\t\t}\n\t\tthis.lastObservedMessageByClient.set(message.clientId, message);\n\t}\n\n\tprivate enqueueMessages(\n\t\tmessages: ISequencedDocumentMessage[],\n\t\treason: string,\n\t\tallowGaps = false,\n\t): void {\n\t\tif (this.handler === undefined) {\n\t\t\t// We did not setup handler yet.\n\t\t\t// This happens when we connect to web socket faster than we get attributes for container\n\t\t\t// and thus faster than attachOpHandler() is called\n\t\t\t// this.lastProcessedSequenceNumber is still zero, so we can't rely on this.fetchMissingDeltas()\n\t\t\t// to do the right thing.\n\t\t\tthis.pending = [...this.pending, ...messages];\n\t\t\treturn;\n\t\t}\n\n\t\t// Pending ops should never just hang around for nothing.\n\t\t// This invariant will stay true through this function execution,\n\t\t// so there is no need to process pending ops here.\n\t\t// It's responsibility of\n\t\t// - attachOpHandler()\n\t\t// - fetchMissingDeltas() after it's done with querying storage\n\t\tassert(\n\t\t\tthis.pending.length === 0 || this.fetchReason !== undefined,\n\t\t\t0x1e9 /* \"Pending ops\" */,\n\t\t);\n\n\t\tif (messages.length === 0) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst from = messages[0].sequenceNumber;\n\t\tconst last = messages[messages.length - 1].sequenceNumber;\n\n\t\t// Report stats about missing and duplicate ops\n\t\t// This helps better understand why we fetch ops from storage, and thus may delay\n\t\t// getting current / sending ops\n\t\t// It's possible that this batch is already too late - do not bother\n\t\tif (last > this.lastQueuedSequenceNumber) {\n\t\t\tlet prev = from - 1;\n\t\t\tconst initialGap = prev - this.lastQueuedSequenceNumber;\n\t\t\tlet firstMissing: number | undefined;\n\t\t\tlet duplicate = 0;\n\t\t\tlet gap = 0;\n\n\t\t\t// Count all gaps and duplicates\n\t\t\tfor (const message of messages) {\n\t\t\t\tif (message.sequenceNumber === prev) {\n\t\t\t\t\tduplicate++;\n\t\t\t\t} else if (message.sequenceNumber !== prev + 1) {\n\t\t\t\t\tgap++;\n\t\t\t\t\tif (firstMissing === undefined) {\n\t\t\t\t\t\tfirstMissing = prev + 1;\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tprev = message.sequenceNumber;\n\t\t\t}\n\n\t\t\tlet eventName: string | undefined;\n\n\t\t\t// Report if we found some issues\n\t\t\tif (\n\t\t\t\tduplicate !== 0 ||\n\t\t\t\t(gap !== 0 && !allowGaps) ||\n\t\t\t\t(initialGap > 0 && this.fetchReason === undefined)\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessages\";\n\t\t\t\t// Also report if we are fetching ops, and same range comes in, thus making this fetch obsolete.\n\t\t\t} else if (\n\t\t\t\tthis.fetchReason !== undefined &&\n\t\t\t\tthis.fetchReason !== reason &&\n\t\t\t\tfrom <= this.lastQueuedSequenceNumber + 1 &&\n\t\t\t\tlast > this.lastQueuedSequenceNumber\n\t\t\t) {\n\t\t\t\teventName = \"enqueueMessagesExtraFetch\";\n\t\t\t}\n\n\t\t\t// Report if there is something to report\n\t\t\t// Do not report when pending fetch is in progress, as such reporting will not\n\t\t\t// correctly take into account pending ops.\n\t\t\tif (eventName !== undefined) {\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName,\n\t\t\t\t\treason,\n\t\t\t\t\tpreviousReason: this.prevEnqueueMessagesReason,\n\t\t\t\t\tfrom,\n\t\t\t\t\tto: last + 1, // exclusive, being consistent with the other telemetry / APIs\n\t\t\t\t\tlength: messages.length,\n\t\t\t\t\tfetchReason: this.fetchReason,\n\t\t\t\t\tduplicate: duplicate > 0 ? duplicate : undefined,\n\t\t\t\t\tinitialGap: initialGap === 0 ? undefined : initialGap,\n\t\t\t\t\tgap: gap > 0 ? gap : undefined,\n\t\t\t\t\tfirstMissing,\n\t\t\t\t\tdmInitialSeqNumber: this.initialSequenceNumber,\n\t\t\t\t\t...this.connectionManager.connectionVerboseProps,\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\n\t\tthis.updateLatestKnownOpSeqNumber(messages[messages.length - 1].sequenceNumber);\n\n\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\tassert(\n\t\t\tn === undefined || n === this.lastQueuedSequenceNumber,\n\t\t\t0x0ec /* \"Unexpected value for previously processed message's sequence number\" */,\n\t\t);\n\n\t\tfor (const message of messages) {\n\t\t\t// Check that the messages are arriving in the expected order\n\t\t\tif (message.sequenceNumber <= this.lastQueuedSequenceNumber) {\n\t\t\t\t// Validate that we do not have data loss, i.e. sequencing is reset and started again\n\t\t\t\t// with numbers that this client already observed before.\n\t\t\t\tif (this.previouslyProcessedMessage?.sequenceNumber === message.sequenceNumber) {\n\t\t\t\t\tconst message1 = this.comparableMessagePayload(this.previouslyProcessedMessage);\n\t\t\t\t\tconst message2 = this.comparableMessagePayload(message);\n\t\t\t\t\tif (message1 !== message2) {\n\t\t\t\t\t\tconst error = new NonRetryableError(\n\t\t\t\t\t\t\t// This looks like a data corruption but the culprit was that the file was overwritten\n\t\t\t\t\t\t\t// in storage. See PR #5882.\n\t\t\t\t\t\t\t// Likely to be an issue with Fluid Services. Content does not match previous client\n\t\t\t\t\t\t\t// knowledge about this file. If the file is overwritten for any reason, this error can be\n\t\t\t\t\t\t\t// hit. One example is that some clients could be submitting ops to two different service\n\t\t\t\t\t\t\t// instances such that the same sequence number is reused for two different ops.\n\t\t\t\t\t\t\t// pre-0.58 error message: twoMessagesWithSameSeqNumAndDifferentPayload\n\t\t\t\t\t\t\t\"Found two messages with the same sequenceNumber but different payloads. Likely to be a \" +\n\t\t\t\t\t\t\t\t\"service issue\",\n\t\t\t\t\t\t\tDriverErrorTypes.fileOverwrittenInStorage,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t\t\t\t\tsequenceNumber: message.sequenceNumber,\n\t\t\t\t\t\t\t\tmessage1,\n\t\t\t\t\t\t\t\tmessage2,\n\t\t\t\t\t\t\t\tdriverVersion: undefined,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthis.close(error);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t} else if (message.sequenceNumber === this.lastQueuedSequenceNumber + 1) {\n\t\t\t\tthis.validateClientSequenceNumberConsistency(message);\n\t\t\t\tthis.lastQueuedSequenceNumber = message.sequenceNumber;\n\t\t\t\tthis.previouslyProcessedMessage = message;\n\t\t\t\tthis._inbound.push(message);\n\t\t\t} else {\n\t\t\t\tthis.pending.push(message);\n\t\t\t\tthis.fetchMissingDeltas(reason, message.sequenceNumber);\n\t\t\t}\n\t\t}\n\n\t\t// When / if we report a gap in ops in the future, we want telemetry to correctly reflect source\n\t\t// of prior ops. But if we have some out of order ops (this.pending), then reporting current reason\n\t\t// becomes not accurate, as the gap existed before current batch, so we should just report \"unknown\".\n\t\tthis.prevEnqueueMessagesReason = this.pending.length > 0 ? \"unknown\" : reason;\n\t}\n\n\tprivate processInboundMessage(message: ISequencedDocumentMessage): void {\n\t\tconst startTime = Date.now();\n\t\tassert(!this.currentlyProcessingOps, 0x3af /* Already processing ops. */);\n\t\tthis.currentlyProcessingOps = true;\n\t\tthis.lastProcessedMessage = message;\n\n\t\tconst isString = typeof message.clientId === \"string\";\n\t\tassert(message.clientId === null || isString, 0x41a /* undefined or string */);\n\t\t// All client messages are coming from some client, and should have clientId,\n\t\t// and non-client message should not have clientId. But, there are two exceptions:\n\t\t// 1. (Legacy) We can see message.type === \"attach\" or \"chunkedOp\" for legacy files before RTM\n\t\t// 2. Non-immediate noops (contents: null) can be sent by service without clientId\n\t\tif (!isString && isClientMessage(message) && message.type !== MessageType.NoOp) {\n\t\t\tthrow new DataCorruptionError(\"Mismatch in clientId\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tmessageType: message.type,\n\t\t\t});\n\t\t}\n\n\t\t// Validate client sequence number has no gap. Decrement the noOpCount by gap\n\t\t// If the count ends up negative, that means we have a real gap and throw error\n\t\tif (\n\t\t\tthis.connectionManager.clientId !== undefined &&\n\t\t\tthis.connectionManager.clientId === message.clientId\n\t\t) {\n\t\t\tif (message.type === MessageType.NoOp) {\n\t\t\t\tthis.noOpCount--;\n\t\t\t}\n\t\t\tconst clientSeqNumGap = message.clientSequenceNumber - this.lastClientSequenceNumber - 1;\n\t\t\tthis.noOpCount -= clientSeqNumGap;\n\t\t\tif (this.noOpCount < 0) {\n\t\t\t\tthrow new Error(`gap in client sequence number: ${clientSeqNumGap}`);\n\t\t\t}\n\t\t\tthis.lastClientSequenceNumber = message.clientSequenceNumber;\n\t\t}\n\n\t\tthis.connectionManager.beforeProcessingIncomingOp(message);\n\n\t\t// Watch the minimum sequence number and be ready to update as needed\n\t\tif (this.minSequenceNumber > message.minimumSequenceNumber) {\n\t\t\t// This indicates that an invalid series of ops was received by this client.\n\t\t\t// In the unlikely case where these ops have been truly sequenced and persisted to storage,\n\t\t\t// this document is corrupted - It will fail here on boot every time.\n\t\t\t// The more likely scenario, based on the realities of production service operation, is that\n\t\t\t// something has changed out from under the file on the server, such that the service lost some ops\n\t\t\t// which this client already processed - the very ops that made this _next_ op to appear invalid.\n\t\t\t// In this case, only this client will fail (and lose this recent data), but others will be able to connect and continue.\n\t\t\tthrow DataProcessingError.create(\n\t\t\t\t// error message through v0.57: msnMovesBackwards\n\t\t\t\t// error message through v2.1: \"Found a lower minimumSequenceNumber (msn) than previously recorded\",\n\t\t\t\t\"Invalid MinimumSequenceNumber from service - document may have been restored to previous state\",\n\t\t\t\t\"DeltaManager.processInboundMessage\",\n\t\t\t\tmessage,\n\t\t\t\t{\n\t\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\n\t\t// Client ops: MSN has to be lower than sequence #, as client can continue to send ops with same\n\t\t// reference sequence number as this op.\n\t\t// System ops (when no clients are connected) are the only ops where equation is possible.\n\t\tconst diff = message.sequenceNumber - message.minimumSequenceNumber;\n\t\tif (diff < 0 || (diff === 0 && message.clientId !== null)) {\n\t\t\tthrow new DataCorruptionError(\n\t\t\t\t\"MSN has to be lower than sequence #\",\n\t\t\t\textractSafePropertiesFromMessage(message),\n\t\t\t);\n\t\t}\n\n\t\tthis.minSequenceNumber = message.minimumSequenceNumber;\n\n\t\tif (message.sequenceNumber !== this.lastProcessedSequenceNumber + 1) {\n\t\t\t// pre-0.58 error message: nonSequentialSequenceNumber\n\t\t\tthrow new DataCorruptionError(\"Found a non-Sequential sequenceNumber\", {\n\t\t\t\t...extractSafePropertiesFromMessage(message),\n\t\t\t\tclientId: this.connectionManager.clientId,\n\t\t\t});\n\t\t}\n\t\tthis.lastProcessedSequenceNumber = message.sequenceNumber;\n\n\t\t// a bunch of code assumes that this is true\n\t\tassert(\n\t\t\tthis.lastProcessedSequenceNumber <= this.lastObservedSeqNumber,\n\t\t\t0x267 /* \"lastObservedSeqNumber should be updated first\" */,\n\t\t);\n\n\t\tif (this.handler === undefined) {\n\t\t\tthrow new Error(\"Attempted to process an inbound message without a handler attached\");\n\t\t}\n\t\tthis.handler.process(message);\n\t\tthis.currentlyProcessingOps = false;\n\t\tconst endTime = Date.now();\n\n\t\t// Should be last, after changing this.lastProcessedSequenceNumber above, as many callers\n\t\t// test this.lastProcessedSequenceNumber instead of using op.sequenceNumber itself.\n\t\tthis.emit(\"op\", message, endTime - startTime);\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate fetchMissingDeltas(reasonArg: string, to?: number): void {\n\t\tthis.fetchMissingDeltasCore(reasonArg, false /* cacheOnly */, to).catch((error) => {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"fetchMissingDeltasException\" }, error);\n\t\t});\n\t}\n\n\t/**\n\t * Retrieves the missing deltas between the given sequence numbers\n\t */\n\tprivate async fetchMissingDeltasCore(\n\t\treason: string,\n\t\tcacheOnly: boolean,\n\t\tto?: number,\n\t): Promise<void> {\n\t\t// Exit out early if we're already fetching deltas\n\t\tif (this.fetchReason !== undefined) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this._closed) {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"fetchMissingDeltasClosedConnection\",\n\t\t\t\treason,\n\t\t\t});\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.handler === undefined) {\n\t\t\t// We do not poses yet any information\n\t\t\tassert(this.lastQueuedSequenceNumber === 0, 0x26b /* \"initial state\" */);\n\t\t\treturn;\n\t\t}\n\n\t\ttry {\n\t\t\tlet from = this.lastQueuedSequenceNumber + 1;\n\n\t\t\tconst n = this.previouslyProcessedMessage?.sequenceNumber;\n\t\t\tif (n !== undefined) {\n\t\t\t\t// If we already processed at least one op, then we have this.previouslyProcessedMessage populated\n\t\t\t\t// and can use it to validate that we are operating on same file, i.e. it was not overwritten.\n\t\t\t\t// Knowing about this mechanism, we could ask for op we already observed to increase validation.\n\t\t\t\t// This is especially useful when coming out of offline mode or loading from\n\t\t\t\t// very old cached (by client / driver) snapshot.\n\t\t\t\tassert(n === this.lastQueuedSequenceNumber, 0x0f2 /* \"previouslyProcessedMessage\" */);\n\t\t\t\tassert(from > 1, 0x0f3 /* \"not positive\" */);\n\t\t\t\tfrom--;\n\t\t\t}\n\n\t\t\tconst fetchReason = `${reason}_fetch`;\n\t\t\tthis.fetchReason = fetchReason;\n\n\t\t\tawait this.getDeltas(\n\t\t\t\tfrom,\n\t\t\t\tto,\n\t\t\t\tfetchReason,\n\t\t\t\t(messages) => {\n\t\t\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\t\t\tthis.enqueueMessages(messages, fetchReason);\n\t\t\t\t},\n\t\t\t\tcacheOnly,\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"GetDeltas_Exception\" }, error);\n\t\t\tthis.close(normalizeError(error));\n\t\t} finally {\n\t\t\tthis.refreshDelayInfo(this.deltaStorageDelayId);\n\t\t\tthis.fetchReason = undefined;\n\t\t\tthis.processPendingOps(reason);\n\t\t}\n\t}\n\n\t/**\n\t * Sorts pending ops and attempts to apply them\n\t */\n\tprivate processPendingOps(reason?: string): void {\n\t\tif (this._closed) {\n\t\t\treturn;\n\t\t}\n\n\t\tassert(this.handler !== undefined, 0x26c /* \"handler should be installed\" */);\n\n\t\tconst pendingSorted = this.pending.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\tthis.pending = [];\n\t\t// Given that we do not track where these ops came from any more, it's not very\n\t\t// actionably to report gaps in this range.\n\t\tthis.enqueueMessages(pendingSorted, `${reason}_pending`, true /* allowGaps */);\n\n\t\t// Re-entrancy is ignored by fetchMissingDeltas, execution will come here when it's over\n\t\tif (this.fetchReason === undefined) {\n\t\t\t// See issue #7312 for more details\n\t\t\t// We observe cases where client gets into situation where it is not aware of missing ops\n\t\t\t// (i.e. client being behind), and as such, does not attempt to fetch them.\n\t\t\t// In some cases client may not have enough signal (example - \"read\" connection that is silent -\n\t\t\t// there is no easy way for client to realize it's behind, see a bit of commentary / logic at the\n\t\t\t// end of setupNewSuccessfulConnection). In other cases it should be able to learn that info (\"write\"\n\t\t\t// connection, learn by receiving its own join op), but data suggest it does not happen.\n\t\t\t// In 50% of these cases we do know we are behind through checkpointSequenceNumber on connection object\n\t\t\t// and thus can leverage that to trigger recovery. But this is not going to solve all the problems\n\t\t\t// (the other 50%), and thus these errors below should be looked at even if code below results in\n\t\t\t// recovery.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if -- Docs make more sense like this\n\t\t\tif (this.lastQueuedSequenceNumber < this.lastObservedSeqNumber) {\n\t\t\t\tthis.fetchMissingDeltas(\"OpsBehind\");\n\t\t\t}\n\t\t}\n\t}\n\n\tprivate updateLatestKnownOpSeqNumber(seq: number): void {\n\t\tif (this.lastObservedSeqNumber < seq) {\n\t\t\tthis.lastObservedSeqNumber = seq;\n\t\t}\n\t}\n}\n"]}
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import type
|
|
5
|
+
import { type ILayerCompatDetails, type ILayerCompatSupportRequirements } from "@fluid-internal/client-utils";
|
|
6
6
|
import type { ICriticalContainerError } from "@fluidframework/container-definitions";
|
|
7
|
-
import { type
|
|
7
|
+
import { type MonitoringContext } from "@fluidframework/telemetry-utils/internal";
|
|
8
8
|
/**
|
|
9
9
|
* The core compatibility details of the Loader layer that is the same across all layer boundaries.
|
|
10
10
|
* @internal
|
|
@@ -38,10 +38,10 @@ export declare const driverSupportRequirementsForLoader: ILayerCompatSupportRequ
|
|
|
38
38
|
* Validates that the Runtime layer is compatible with the Loader. *
|
|
39
39
|
* @internal
|
|
40
40
|
*/
|
|
41
|
-
export declare function validateRuntimeCompatibility(maybeRuntimeCompatDetails: ILayerCompatDetails | undefined,
|
|
41
|
+
export declare function validateRuntimeCompatibility(maybeRuntimeCompatDetails: ILayerCompatDetails | undefined, mc: MonitoringContext): void;
|
|
42
42
|
/**
|
|
43
43
|
* Validates that the Driver layer is compatible with the Loader.
|
|
44
44
|
* @internal
|
|
45
45
|
*/
|
|
46
|
-
export declare function validateDriverCompatibility(maybeDriverCompatDetails: ILayerCompatDetails | undefined, disposeFn: (error?: ICriticalContainerError) => void,
|
|
46
|
+
export declare function validateDriverCompatibility(maybeDriverCompatDetails: ILayerCompatDetails | undefined, disposeFn: (error?: ICriticalContainerError) => void, mc: MonitoringContext): void;
|
|
47
47
|
//# sourceMappingURL=loaderLayerCompatState.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderLayerCompatState.d.ts","sourceRoot":"","sources":["../src/loaderLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"loaderLayerCompatState.d.ts","sourceRoot":"","sources":["../src/loaderLayerCompatState.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAEN,KAAK,mBAAmB,EACxB,KAAK,+BAA+B,EACpC,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,uBAAuB,EAAE,MAAM,uCAAuC,CAAC;AACrF,OAAO,EAEN,KAAK,iBAAiB,EACtB,MAAM,0CAA0C,CAAC;AAIlD;;;GAGG;AACH,eAAO,MAAM,uBAAuB;IACnC;;OAEG;;IAEH;;OAEG;;CAEH,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,6BAA6B,EAAE,mBAM3C,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,mCAAmC,EAAE,+BAUjD,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,kCAAkC,EAAE,+BAUhD,CAAC;AAEF;;;GAGG;AACH,wBAAgB,4BAA4B,CAC3C,yBAAyB,EAAE,mBAAmB,GAAG,SAAS,EAC1D,EAAE,EAAE,iBAAiB,GACnB,IAAI,CAUN;AAED;;;GAGG;AACH,wBAAgB,2BAA2B,CAC1C,wBAAwB,EAAE,mBAAmB,GAAG,SAAS,EACzD,SAAS,EAAE,CAAC,KAAK,CAAC,EAAE,uBAAuB,KAAK,IAAI,EACpD,EAAE,EAAE,iBAAiB,GACnB,IAAI,CAUN"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.validateDriverCompatibility = exports.validateRuntimeCompatibility = exports.driverSupportRequirementsForLoader = exports.runtimeSupportRequirementsForLoader = exports.loaderCompatDetailsForRuntime = exports.loaderCoreCompatDetails = void 0;
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
8
9
|
const internal_1 = require("@fluidframework/telemetry-utils/internal");
|
|
9
10
|
const packageVersion_js_1 = require("./packageVersion.js");
|
|
10
11
|
/**
|
|
@@ -19,7 +20,7 @@ exports.loaderCoreCompatDetails = {
|
|
|
19
20
|
/**
|
|
20
21
|
* The current generation of the Loader layer.
|
|
21
22
|
*/
|
|
22
|
-
generation:
|
|
23
|
+
generation: client_utils_1.generation,
|
|
23
24
|
};
|
|
24
25
|
/**
|
|
25
26
|
* Loader's compatibility details that is exposed to the Runtime layer.
|
|
@@ -66,16 +67,16 @@ exports.driverSupportRequirementsForLoader = {
|
|
|
66
67
|
* Validates that the Runtime layer is compatible with the Loader. *
|
|
67
68
|
* @internal
|
|
68
69
|
*/
|
|
69
|
-
function validateRuntimeCompatibility(maybeRuntimeCompatDetails,
|
|
70
|
-
(0, internal_1.validateLayerCompatibility)("loader", "runtime", exports.loaderCompatDetailsForRuntime, exports.runtimeSupportRequirementsForLoader, maybeRuntimeCompatDetails, () => { } /* disposeFn - no op. This will be handled by the caller */,
|
|
70
|
+
function validateRuntimeCompatibility(maybeRuntimeCompatDetails, mc) {
|
|
71
|
+
(0, internal_1.validateLayerCompatibility)("loader", "runtime", exports.loaderCompatDetailsForRuntime, exports.runtimeSupportRequirementsForLoader, maybeRuntimeCompatDetails, () => { } /* disposeFn - no op. This will be handled by the caller */, mc);
|
|
71
72
|
}
|
|
72
73
|
exports.validateRuntimeCompatibility = validateRuntimeCompatibility;
|
|
73
74
|
/**
|
|
74
75
|
* Validates that the Driver layer is compatible with the Loader.
|
|
75
76
|
* @internal
|
|
76
77
|
*/
|
|
77
|
-
function validateDriverCompatibility(maybeDriverCompatDetails, disposeFn,
|
|
78
|
-
(0, internal_1.validateLayerCompatibility)("loader", "driver", exports.loaderCompatDetailsForRuntime, exports.driverSupportRequirementsForLoader, maybeDriverCompatDetails, disposeFn,
|
|
78
|
+
function validateDriverCompatibility(maybeDriverCompatDetails, disposeFn, mc) {
|
|
79
|
+
(0, internal_1.validateLayerCompatibility)("loader", "driver", exports.loaderCompatDetailsForRuntime, exports.driverSupportRequirementsForLoader, maybeDriverCompatDetails, disposeFn, mc);
|
|
79
80
|
}
|
|
80
81
|
exports.validateDriverCompatibility = validateDriverCompatibility;
|
|
81
82
|
//# sourceMappingURL=loaderLayerCompatState.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"loaderLayerCompatState.js","sourceRoot":"","sources":["../src/loaderLayerCompatState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"loaderLayerCompatState.js","sourceRoot":"","sources":["../src/loaderLayerCompatState.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAIsC;AAEtC,uEAGkD;AAElD,2DAAiD;AAEjD;;;GAGG;AACU,QAAA,uBAAuB,GAAG;IACtC;;OAEG;IACH,UAAU,EAAV,8BAAU;IACV;;OAEG;IACH,UAAU,EAAV,yBAAU;CACV,CAAC;AAEF;;;GAGG;AACU,QAAA,6BAA6B,GAAwB;IACjE,GAAG,+BAAuB;IAC1B;;OAEG;IACH,iBAAiB,EAAE,IAAI,GAAG,EAAU;CACpC,CAAC;AAEF;;;GAGG;AACU,QAAA,mCAAmC,GAAoC;IACnF;;;OAGG;IACH,sBAAsB,EAAE,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,EAAE;CACpB,CAAC;AAEF;;;GAGG;AACU,QAAA,kCAAkC,GAAoC;IAClF;;;OAGG;IACH,sBAAsB,EAAE,CAAC;IACzB;;OAEG;IACH,gBAAgB,EAAE,EAAE;CACpB,CAAC;AAEF;;;GAGG;AACH,SAAgB,4BAA4B,CAC3C,yBAA0D,EAC1D,EAAqB;IAErB,IAAA,qCAA0B,EACzB,QAAQ,EACR,SAAS,EACT,qCAA6B,EAC7B,2CAAmC,EACnC,yBAAyB,EACzB,GAAG,EAAE,GAAE,CAAC,CAAC,2DAA2D,EACpE,EAAE,CACF,CAAC;AACH,CAAC;AAbD,oEAaC;AAED;;;GAGG;AACH,SAAgB,2BAA2B,CAC1C,wBAAyD,EACzD,SAAoD,EACpD,EAAqB;IAErB,IAAA,qCAA0B,EACzB,QAAQ,EACR,QAAQ,EACR,qCAA6B,EAC7B,0CAAkC,EAClC,wBAAwB,EACxB,SAAS,EACT,EAAE,CACF,CAAC;AACH,CAAC;AAdD,kEAcC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tgeneration,\n\ttype ILayerCompatDetails,\n\ttype ILayerCompatSupportRequirements,\n} from \"@fluid-internal/client-utils\";\nimport type { ICriticalContainerError } from \"@fluidframework/container-definitions\";\nimport {\n\tvalidateLayerCompatibility,\n\ttype MonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { pkgVersion } from \"./packageVersion.js\";\n\n/**\n * The core compatibility details of the Loader layer that is the same across all layer boundaries.\n * @internal\n */\nexport const loaderCoreCompatDetails = {\n\t/**\n\t * The package version of the Loader layer.\n\t */\n\tpkgVersion,\n\t/**\n\t * The current generation of the Loader layer.\n\t */\n\tgeneration,\n};\n\n/**\n * Loader's compatibility details that is exposed to the Runtime layer.\n * @internal\n */\nexport const loaderCompatDetailsForRuntime: ILayerCompatDetails = {\n\t...loaderCoreCompatDetails,\n\t/**\n\t * The features supported by the Loader layer across the Loader / Runtime boundary.\n\t */\n\tsupportedFeatures: new Set<string>(),\n};\n\n/**\n * The requirements that the Runtime layer must meet to be compatible with this Loader.\n * @internal\n */\nexport const runtimeSupportRequirementsForLoader: ILayerCompatSupportRequirements = {\n\t/**\n\t * Minimum generation that Runtime must be at to be compatible with Loader. Note that 0 is used here for\n\t * Runtime layers before the introduction of the layer compatibility enforcement.\n\t */\n\tminSupportedGeneration: 0,\n\t/**\n\t * The features that the Runtime must support to be compatible with Loader.\n\t */\n\trequiredFeatures: [],\n};\n\n/**\n * The requirements that the Driver layer must meet to be compatible with this Loader.\n * @internal\n */\nexport const driverSupportRequirementsForLoader: ILayerCompatSupportRequirements = {\n\t/**\n\t * Minimum generation that Driver must be at to be compatible with Loader. Note that 0 is used here for\n\t * Driver layers before the introduction of the layer compatibility enforcement.\n\t */\n\tminSupportedGeneration: 0,\n\t/**\n\t * The features that the Driver must support to be compatible with Loader.\n\t */\n\trequiredFeatures: [],\n};\n\n/**\n * Validates that the Runtime layer is compatible with the Loader. *\n * @internal\n */\nexport function validateRuntimeCompatibility(\n\tmaybeRuntimeCompatDetails: ILayerCompatDetails | undefined,\n\tmc: MonitoringContext,\n): void {\n\tvalidateLayerCompatibility(\n\t\t\"loader\",\n\t\t\"runtime\",\n\t\tloaderCompatDetailsForRuntime,\n\t\truntimeSupportRequirementsForLoader,\n\t\tmaybeRuntimeCompatDetails,\n\t\t() => {} /* disposeFn - no op. This will be handled by the caller */,\n\t\tmc,\n\t);\n}\n\n/**\n * Validates that the Driver layer is compatible with the Loader.\n * @internal\n */\nexport function validateDriverCompatibility(\n\tmaybeDriverCompatDetails: ILayerCompatDetails | undefined,\n\tdisposeFn: (error?: ICriticalContainerError) => void,\n\tmc: MonitoringContext,\n): void {\n\tvalidateLayerCompatibility(\n\t\t\"loader\",\n\t\t\"driver\",\n\t\tloaderCompatDetailsForRuntime,\n\t\tdriverSupportRequirementsForLoader,\n\t\tmaybeDriverCompatDetails,\n\t\tdisposeFn,\n\t\tmc,\n\t);\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/container-loader";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.80.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/container-loader";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.80.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|