@fluidframework/driver-base 2.81.1 → 2.82.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/documentDeltaConnection.d.ts +2 -0
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/documentDeltaConnection.js +2 -0
- package/dist/documentDeltaConnection.js.map +1 -1
- package/dist/driverUtils.d.ts +2 -0
- package/dist/driverUtils.d.ts.map +1 -1
- package/dist/driverUtils.js +2 -0
- package/dist/driverUtils.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/lib/documentDeltaConnection.d.ts +2 -0
- package/lib/documentDeltaConnection.d.ts.map +1 -1
- package/lib/documentDeltaConnection.js +2 -0
- package/lib/documentDeltaConnection.js.map +1 -1
- package/lib/driverUtils.d.ts +2 -0
- package/lib/driverUtils.d.ts.map +1 -1
- package/lib/driverUtils.js +2 -0
- package/lib/driverUtils.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/package.json +10 -10
- package/src/documentDeltaConnection.ts +2 -0
- package/src/driverUtils.ts +2 -0
- package/src/packageVersion.ts +1 -1
- package/biome.jsonc +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -52,6 +52,8 @@ export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandli
|
|
|
52
52
|
protected _disposed: boolean;
|
|
53
53
|
private readonly mc;
|
|
54
54
|
/**
|
|
55
|
+
* Gets the logger from the monitoring context.
|
|
56
|
+
*
|
|
55
57
|
* @deprecated Implementors should manage their own logger or monitoring context
|
|
56
58
|
*/
|
|
57
59
|
protected get logger(): ITelemetryLoggerExt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACN,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,aAAa,EACb,YAAY,EAEZ,yBAAyB,EACzB,cAAc,EACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGN,KAAK,yBAAyB,EAC9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,6BAA6B,EAQ7B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C;;;GAGG;AACH,qBAAa,uBACZ,SAAQ,6BAA6B,CAAC,8BAA8B,CACpE,YAAW,wBAAwB,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"documentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACN,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,aAAa,EACb,YAAY,EAEZ,yBAAyB,EACzB,cAAc,EACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGN,KAAK,yBAAyB,EAC9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,6BAA6B,EAQ7B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C;;;GAGG;AACH,qBAA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I,CA8B1D;IAEF;;;OAGG;IACH,SAAS,CAAC,cAAc,CAAC,GAAG,EAAE,eAAe,GAAG,IAAI;cAIpC,UAAU,CAAC,cAAc,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAqNpF,OAAO,CAAC,eAAe;IAWvB,SAAS,CAAC,yBAAyB,IAAI;QACtC,QAAQ,EAAE,OAAO,CAAC;QAClB,eAAe,EAAE,OAAO,GAAG,SAAS,CAAC;QACrC,QAAQ,EAAE,MAAM,GAAG,SAAS,CAAC;QAC7B,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;KACjC;IASD,SAAS,CAAC,cAAc,eAAgB,MAAM,QAAQ,yBAAyB,EAAE,KAAG,IAAI,CAEtF;IAEF,SAAS,CAAC,kBAAkB,QAAS,cAAc,GAAG,cAAc,EAAE,KAAG,IAAI,CAM3E;IAEF,OAAO,CAAC,oBAAoB;IAK5B,OAAO,CAAC,wBAAwB;IAIhC,OAAO,CAAC,qBAAqB;IAc7B,SAAS,CAAC,kBAAkB,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,IAAI,GAAG,IAAI;IAMrF,OAAO,CAAC,sBAAsB;IAa9B,OAAO,CAAC,yBAAyB;IAWjC,OAAO,CAAC,eAAe;IAavB,OAAO,CAAC,0BAA0B;IAoBlC;;OAEG;IACH,SAAS,CAAC,iBAAiB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,GAAG,EAAE,QAAQ,UAAO,GAAG,eAAe;IAQ3F,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,yBAAyB;CAS7E"}
|
|
@@ -26,6 +26,8 @@ class DocumentDeltaConnection extends internal_4.EventEmitterWithErrorHandling {
|
|
|
26
26
|
return this._disposed;
|
|
27
27
|
}
|
|
28
28
|
/**
|
|
29
|
+
* Gets the logger from the monitoring context.
|
|
30
|
+
*
|
|
29
31
|
* @deprecated Implementors should manage their own logger or monitoring context
|
|
30
32
|
*/
|
|
31
33
|
get logger() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentDeltaConnection.js","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAIyC;AACzC,kEAA6D;AAE7D,0EAcqD;AACrD,oEAI+C;AAC/C,uEAUkD;AAGlD,sFAAsF;AACtF,2DAAkE;AAElE,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAEtD;;;GAGG;AACH,MAAa,uBACZ,SAAQ,wCAA6D;IA4CrE,IAAc,UAAU;QACvB,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,IAAW,QAAQ;QAClB,IAAA,iBAAM,EACL,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EACvC,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IASD;;OAEG;IACH,IAAc,MAAM;QACnB,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,OAAO;QACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAED;;;;;OAKG;IACH,YACoB,MAAc,EAC1B,UAAkB,EACzB,MAA2B,EACV,8BAAuC,KAAK,EAC1C,YAAqB;QAExC,KAAK,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE;YACrB,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,CAAC;YAC5B,MAAM,CAAC,cAAc,CACpB;gBACC,SAAS,EAAE,gCAAgC;gBAC3C,wEAAwE;gBACxE,yDAAyD;gBACzD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Content":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tITelemetryBaseProperties,\n\tLogLevel,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\tIAnyDriverError,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaConnectionEvents,\n\tIClientConfiguration,\n\tIConnect,\n\tIConnected,\n\tIDocumentMessage,\n\ttype ISentSignalMessage,\n\tISignalClient,\n\tITokenClaims,\n\tScopeType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tUsageError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\textractLogSafeErrorProperties,\n\tgetCircularReplacer,\n\tisFluidError,\n\tnormalizeError,\n\ttype IFluidErrorBase,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\n\n// For now, this package is versioned and released in unison with the specific drivers\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\nconst feature_submit_signals_v2 = \"submit_signals_v2\";\n\n/**\n * Represents a connection to a stream of delta updates.\n * @internal\n */\nexport class DocumentDeltaConnection\n\textends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents>\n\timplements IDocumentDeltaConnection, IDisposable\n{\n\tstatic readonly eventsToForward = [\"nack\", \"op\", \"signal\", \"pong\"];\n\n\t// WARNING: These are critical events that we can't miss, so registration for them has to be in place at all times!\n\t// Including before handshake is over, and after that (but before DeltaManager had a chance to put its own handlers)\n\tstatic readonly eventsAlwaysForwarded = [\"disconnect\", \"error\"];\n\n\t/**\n\t * Error message used when client is closing the delta connection cleanly.\n\t */\n\tstatic readonly errorMessageForClientDisposeWithoutError = \"Client closing delta connection\";\n\n\t/**\n\t * Last known sequence number to ordering service at the time of connection\n\t * It may lap actual last sequence number (quite a bit, if container is very active).\n\t * But it's best information for client to figure out how far it is behind, at least\n\t * for \"read\" connections. \"write\" connections may use own \"join\" op to similar information,\n\t * that is likely to be more up-to-date.\n\t */\n\tpublic checkpointSequenceNumber: number | undefined;\n\n\t// Listen for ops sent before we receive a response to connect_document\n\tprotected readonly queuedMessages: ISequencedDocumentMessage[] = [];\n\tprotected readonly queuedSignals: ISignalMessage[] = [];\n\n\t/**\n\t * A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops\n\t * to later be retrieved via initialMessages.\n\t */\n\tprivate earlyOpHandlerAttached: boolean = false;\n\n\tprivate socketConnectionTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate _details: IConnected | undefined;\n\n\tprivate trackLatencyTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\t// Listeners only needed while the connection is in progress\n\tprivate readonly connectionListeners: Map<string, (...args: any[]) => void> = new Map();\n\t// Listeners used throughout the lifetime of the DocumentDeltaConnection\n\tprivate readonly trackedListeners: Map<string, (...args: any[]) => void> = new Map();\n\n\tprotected get hasDetails(): boolean {\n\t\treturn !!this._details;\n\t}\n\n\tpublic get disposed(): boolean {\n\t\tassert(\n\t\t\tthis._disposed || this.socket.connected,\n\t\t\t0x244 /* \"Socket is closed, but connection is not!\" */,\n\t\t);\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.\n\t * After disconnection, we flip this to prevent any stale messages from being emitted.\n\t */\n\tprotected _disposed: boolean = false;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * @deprecated Implementors should manage their own logger or monitoring context\n\t */\n\tprotected get logger(): ITelemetryLoggerExt {\n\t\treturn this.mc.logger;\n\t}\n\n\tpublic get details(): IConnected {\n\t\tif (!this._details) {\n\t\t\tthrow new Error(\"Internal error: calling method before _details is initialized!\");\n\t\t}\n\t\treturn this._details;\n\t}\n\n\t/**\n\t * @param socket - websocket to be used\n\t * @param documentId - ID of the document\n\t * @param logger - for reporting telemetry events\n\t * @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure\n\t */\n\tprotected constructor(\n\t\tprotected readonly socket: Socket,\n\t\tpublic documentId: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly enableLongPollingDowngrades: boolean = false,\n\t\tprotected readonly connectionId?: string,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.addPropsToError(error);\n\t\t\tlogger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaConnection:EventException\",\n\t\t\t\t\t// Coerce to string as past typings also allowed symbols and number, but\n\t\t\t\t\t// we want telemtry properties to be consistently string.\n\t\t\t\t\tname: String(name),\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\tthis.mc = createChildMonitoringContext({ logger, namespace: \"DeltaConnection\" });\n\n\t\tthis.on(\"newListener\", (event, _listener) => {\n\t\t\tassert(!this.disposed, 0x20a /* \"register for event on disposed object\" */);\n\n\t\t\t// Some events are already forwarded - see this.addTrackedListener() calls in initialize().\n\t\t\tif (DocumentDeltaConnection.eventsAlwaysForwarded.includes(event)) {\n\t\t\t\tassert(this.trackedListeners.has(event), 0x245 /* \"tracked listener\" */);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!DocumentDeltaConnection.eventsToForward.includes(event)) {\n\t\t\t\tthrow new Error(`DocumentDeltaConnection: Registering for unknown event: ${event}`);\n\t\t\t}\n\n\t\t\t// Whenever listener is added, we should subscribe on same event on socket, so these two things\n\t\t\t// should be in sync. This currently assumes that nobody unregisters and registers back listeners,\n\t\t\t// and that there are no \"internal\" listeners installed (like \"error\" case we skip above)\n\t\t\t// Better flow might be to always unconditionally register all handlers on successful connection,\n\t\t\t// though some logic (naming assert in initialMessages getter) might need to be adjusted (it becomes noop)\n\t\t\tassert(\n\t\t\t\t(this.listeners(event).length !== 0) === this.trackedListeners.has(event),\n\t\t\t\t0x20b /* \"mismatch\" */,\n\t\t\t);\n\t\t\tif (!this.trackedListeners.has(event)) {\n\t\t\t\tif (event === \"pong\") {\n\t\t\t\t\t// Empty callback for tracking purposes in this class\n\t\t\t\t\tthis.trackedListeners.set(\"pong\", () => {});\n\n\t\t\t\t\tconst sendPingLoop = (): void => {\n\t\t\t\t\t\tconst start = Date.now();\n\n\t\t\t\t\t\tthis.socket.volatile?.emit(\"ping\", () => {\n\t\t\t\t\t\t\tthis.emit(\"pong\", Date.now() - start);\n\n\t\t\t\t\t\t\t// Schedule another ping event in 1 minute\n\t\t\t\t\t\t\tthis.trackLatencyTimeout = setTimeout(() => {\n\t\t\t\t\t\t\t\tsendPingLoop();\n\t\t\t\t\t\t\t}, 1000 * 60);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tsendPingLoop();\n\t\t\t\t} else {\n\t\t\t\t\tthis.addTrackedListener(event, (...args: any[]) => {\n\t\t\t\t\t\tthis.emit(event, ...args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the ID of the client who is sending the message\n\t *\n\t * @returns the client ID\n\t */\n\tpublic get clientId(): string {\n\t\treturn this.details.clientId;\n\t}\n\n\t/**\n\t * Get the mode of the client\n\t *\n\t * @returns the client mode\n\t */\n\tpublic get mode(): ConnectionMode {\n\t\treturn this.details.mode;\n\t}\n\n\t/**\n\t * Get the claims of the client who is sending the message\n\t *\n\t * @returns client claims\n\t */\n\tpublic get claims(): ITokenClaims {\n\t\treturn this.details.claims;\n\t}\n\n\t/**\n\t * Get whether or not this is an existing document\n\t *\n\t * @returns true if the document exists\n\t */\n\tpublic get existing(): boolean {\n\t\treturn this.details.existing;\n\t}\n\n\t/**\n\t * Get the maximum size of a message before chunking is required\n\t *\n\t * @returns the maximum size of a message before chunking is required\n\t */\n\tpublic get maxMessageSize(): number {\n\t\treturn this.details.serviceConfiguration.maxMessageSize;\n\t}\n\n\t/**\n\t * Semver of protocol being used with the service\n\t */\n\tpublic get version(): string {\n\t\treturn this.details.version;\n\t}\n\n\t/**\n\t * Configuration details provided by the service\n\t */\n\tpublic get serviceConfiguration(): IClientConfiguration {\n\t\treturn this.details.serviceConfiguration;\n\t}\n\n\tprivate checkNotDisposed(): void {\n\t\tassert(!this.disposed, 0x20c /* \"connection disposed\" */);\n\t}\n\n\t/**\n\t * Get messages sent during the connection\n\t *\n\t * @returns messages sent during the connection\n\t */\n\tpublic get initialMessages(): ISequencedDocumentMessage[] {\n\t\tthis.checkNotDisposed();\n\n\t\t// If we call this when the earlyOpHandler is not attached, then the queuedMessages may not include the\n\t\t// latest ops. This could possibly indicate that initialMessages was called twice.\n\t\tassert(this.earlyOpHandlerAttached, 0x08e /* \"Potentially missed initial messages\" */);\n\t\t// We will lose ops and perf will tank as we need to go to storage to become current!\n\t\tassert(this.listeners(\"op\").length !== 0, 0x08f /* \"No op handler is setup!\" */);\n\n\t\tthis.removeEarlyOpHandler();\n\n\t\tif (this.queuedMessages.length > 0) {\n\t\t\t// Some messages were queued.\n\t\t\t// add them to the list of initialMessages to be processed\n\t\t\tthis.details.initialMessages.push(...this.queuedMessages);\n\t\t\tthis.details.initialMessages.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\t\tthis.queuedMessages.length = 0;\n\t\t}\n\t\treturn this.details.initialMessages;\n\t}\n\n\t/**\n\t * Get signals sent during the connection\n\t *\n\t * @returns signals sent during the connection\n\t */\n\tpublic get initialSignals(): ISignalMessage[] {\n\t\tthis.checkNotDisposed();\n\t\tassert(this.listeners(\"signal\").length !== 0, 0x090 /* \"No signal handler is setup!\" */);\n\n\t\tthis.removeEarlySignalHandler();\n\n\t\tif (this.queuedSignals.length > 0) {\n\t\t\t// Some signals were queued.\n\t\t\t// add them to the list of initialSignals to be processed\n\t\t\tthis.details.initialSignals.push(...this.queuedSignals);\n\t\t\tthis.queuedSignals.length = 0;\n\t\t}\n\t\treturn this.details.initialSignals;\n\t}\n\n\t/**\n\t * Get initial client list\n\t *\n\t * @returns initial client list sent during the connection\n\t */\n\tpublic get initialClients(): ISignalClient[] {\n\t\tthis.checkNotDisposed();\n\t\treturn this.details.initialClients;\n\t}\n\t/**\n\t * Emits 'submitOp' messages.\n\t * @param type - Must be 'submitOp'.\n\t * @param messages - An array of document messages to submit.\n\t */\n\tprotected emitMessages(type: \"submitOp\", messages: IDocumentMessage[][]): void;\n\n\t/**\n\t * Emits 'submitSignal' messages.\n\t *\n\t * **Note:** When using `ISentSignalMessage[]`, the service must support the `submit_signals_v2` feature.\n\t * @param type - Must be 'submitSignal'.\n\t * @param messages - An array of signals to submit. Can be either `string[][]` or `ISentSignalMessage[]`.\n\t */\n\tprotected emitMessages(\n\t\ttype: \"submitSignal\",\n\t\tmessages: string[][] | ISentSignalMessage[],\n\t): void;\n\tprotected emitMessages(type: string, messages: unknown): void {\n\t\t// Although the implementation here disconnects the socket and does not reuse it, other subclasses\n\t\t// (e.g. OdspDocumentDeltaConnection) may reuse the socket. In these cases, we need to avoid emitting\n\t\t// on the still-live socket.\n\t\tif (!this.disposed) {\n\t\t\tthis.socket.emit(type, this.clientId, messages);\n\t\t}\n\t}\n\n\t/**\n\t * Submits a new delta operation to the server\n\t *\n\t * @param message - delta operation to submit\n\t */\n\tpublic submit(messages: IDocumentMessage[]): void {\n\t\tthis.checkNotDisposed();\n\t\tthis.emitMessages(\"submitOp\", [messages]);\n\t}\n\n\t/**\n\t * Submits a new signal to the server\n\t *\n\t * @param content - Content of the signal.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t */\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\tthis.checkNotDisposed();\n\n\t\t// Check for server-side support of v2 signals\n\t\tif (this.details.supportedFeatures?.submit_signals_v2 === true) {\n\t\t\tconst signal: ISentSignalMessage = { content };\n\t\t\tif (targetClientId !== undefined) {\n\t\t\t\tsignal.targetClientId = targetClientId;\n\t\t\t}\n\t\t\tthis.emitMessages(\"submitSignal\", [signal]);\n\t\t} else if (targetClientId !== undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Sending signals to specific client ids is not supported with this service.\",\n\t\t\t);\n\t\t} else {\n\t\t\tthis.emitMessages(\"submitSignal\", [[content]]);\n\t\t}\n\t}\n\n\t/**\n\t * Disconnect from the websocket and close the websocket too.\n\t */\n\tprivate closeSocket(error: IAnyDriverError): void {\n\t\tif (this._disposed) {\n\t\t\t// This would be rare situation due to complexity around socket emitting events.\n\t\t\treturn;\n\t\t}\n\t\tthis.closeSocketCore(error);\n\t}\n\n\tprotected closeSocketCore(error: IAnyDriverError): void {\n\t\tthis.disconnect(error);\n\t}\n\n\t/**\n\t * Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.\n\t * However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no\n\t * multiplexing here, so we need to close the socket here.\n\t *\n\t * @param error - An optional error object. If provided, the connection will be closed with the specified error,\n\t * indicating an error-triggered disconnect. If not provided, the connection will be closed cleanly.\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ClientClosingDeltaConnection\",\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t});\n\t\tif (isFluidError(error)) {\n\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\tprops: { driverVersion },\n\t\t\t}) as IFluidErrorBase & {\n\t\t\t\tcanRetry: boolean;\n\t\t\t};\n\t\t\tthis.disconnect(fluidError);\n\t\t} else {\n\t\t\tthis.disconnect(\n\t\t\t\tcreateGenericNetworkError(\n\t\t\t\t\t// pre-0.58 error message: clientClosingConnection\n\t\t\t\t\terror?.message ?? DocumentDeltaConnection.errorMessageForClientDisposeWithoutError,\n\t\t\t\t\t{ canRetry: error === undefined },\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected readonly disconnect = (err: IAnyDriverError): void => {\n\t\t// Can't check this.disposed here, as we get here on socket closure,\n\t\t// so _disposed & socket.connected might be not in sync while processing\n\t\t// \"dispose\" event.\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.trackLatencyTimeout !== undefined) {\n\t\t\tclearTimeout(this.trackLatencyTimeout);\n\t\t\tthis.trackLatencyTimeout = undefined;\n\t\t}\n\n\t\t// We set the disposed flag as a part of the contract for overriding the disconnect method. This is used by\n\t\t// DocumentDeltaConnection to determine if emitting messages (ops) on the socket is allowed, which is\n\t\t// important since OdspDocumentDeltaConnection reuses the socket rather than truly disconnecting it. Note that\n\t\t// OdspDocumentDeltaConnection may still send disconnect_document which is allowed; this is only intended\n\t\t// to prevent normal messages from being emitted.\n\t\tthis._disposed = true;\n\n\t\t// Remove all listeners listening on the socket. These are listeners on socket and not on this connection\n\t\t// object. Anyway since we have disposed this connection object, nobody should listen to event on socket\n\t\t// anymore.\n\t\tthis.removeTrackedListeners();\n\n\t\t// Clear the connection/socket before letting the deltaManager/connection manager know about the disconnect.\n\t\tthis.disconnectCore(err);\n\n\t\t// Let user of connection object know about disconnect.\n\t\tthis.emit(\"disconnect\", err);\n\t};\n\n\t/**\n\t * Disconnect from the websocket.\n\t * @param reason - reason for disconnect\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tthis.socket.disconnect();\n\t}\n\n\tprotected async initialize(connectMessage: IConnect, timeout: number): Promise<void> {\n\t\tthis.socket.on(\"op\", this.earlyOpHandler);\n\t\tthis.socket.on(\"signal\", this.earlySignalHandler);\n\t\tthis.earlyOpHandlerAttached = true;\n\n\t\tconnectMessage.supportedFeatures = {\n\t\t\t...connectMessage.supportedFeatures,\n\t\t\t[feature_submit_signals_v2]: true,\n\t\t};\n\n\t\t// Socket.io's reconnect_attempt event is unreliable, so we track connect_error count instead.\n\t\tlet internalSocketConnectionFailureCount: number = 0;\n\t\tconst isInternalSocketReconnectionEnabled = (): boolean => this.socket.io.reconnection();\n\t\tconst getMaxInternalSocketReconnectionAttempts = (): number =>\n\t\t\tisInternalSocketReconnectionEnabled() ? this.socket.io.reconnectionAttempts() : 0;\n\t\tconst getMaxAllowedInternalSocketConnectionFailures = (): number =>\n\t\t\tgetMaxInternalSocketReconnectionAttempts() + 1;\n\n\t\tthis._details = await new Promise<IConnected>((resolve, reject) => {\n\t\t\tconst failAndCloseSocket = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.closeSocket(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"CloseSocketError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\tconst failConnection = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.disconnect(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"FailConnectionError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\t// Immediately set the connection timeout.\n\t\t\t// Give extra 2 seconds for handshake on top of socket connection timeout.\n\t\t\tthis.socketConnectionTimeout = setTimeout(() => {\n\t\t\t\tfailConnection(this.createErrorObject(\"orderingServiceHandshakeTimeout\"));\n\t\t\t}, timeout + 2000);\n\n\t\t\t// Listen for connection issues\n\t\t\tthis.addConnectionListener(\"connect_error\", (error) => {\n\t\t\t\tinternalSocketConnectionFailureCount++;\n\t\t\t\tlet isWebSocketTransportError = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst description = error?.description;\n\t\t\t\t\tconst context = error?.context;\n\n\t\t\t\t\tif (context && typeof context === \"object\") {\n\t\t\t\t\t\tconst statusText = context.statusText?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.context\n\t\t\t\t\t\tif (statusText === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (description && typeof description === \"object\") {\n\t\t\t\t\t\tconst errorCode = description.error?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.description\n\t\t\t\t\t\tif (errorCode === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (error.type === \"TransportError\") {\n\t\t\t\t\t\t\tisWebSocketTransportError = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// That's a WebSocket. Clear it as we can't log it.\n\t\t\t\t\t\tdescription.target = undefined;\n\t\t\t\t\t}\n\t\t\t\t} catch (_e) {\n\t\t\t\t\t// TODO: document why we are ignoring the error here\n\t\t\t\t}\n\n\t\t\t\t// Handle socket transport downgrading when not offline.\n\t\t\t\tif (\n\t\t\t\t\tisWebSocketTransportError &&\n\t\t\t\t\tthis.enableLongPollingDowngrades &&\n\t\t\t\t\tthis.socket.io.opts.transports?.[0] !== \"polling\"\n\t\t\t\t) {\n\t\t\t\t\t// Downgrade transports to polling upgrade mechanism.\n\t\t\t\t\tthis.socket.io.opts.transports = [\"polling\", \"websocket\"];\n\t\t\t\t\t// Don't alter reconnection behavior if already enabled.\n\t\t\t\t\tif (!isInternalSocketReconnectionEnabled()) {\n\t\t\t\t\t\t// Allow single reconnection attempt using polling upgrade mechanism.\n\t\t\t\t\t\tthis.socket.io.reconnection(true);\n\t\t\t\t\t\tthis.socket.io.reconnectionAttempts(1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Allow built-in socket.io reconnection handling.\n\t\t\t\tif (\n\t\t\t\t\tisInternalSocketReconnectionEnabled() &&\n\t\t\t\t\tinternalSocketConnectionFailureCount <\n\t\t\t\t\t\tgetMaxAllowedInternalSocketConnectionFailures()\n\t\t\t\t) {\n\t\t\t\t\t// Reconnection is enabled and maximum reconnect attempts have not been reached.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error));\n\t\t\t});\n\n\t\t\t// Listen for timeouts\n\t\t\tthis.addConnectionListener(\"connect_timeout\", () => {\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_timeout\"));\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_success\", (response: IConnected) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst requestedMode = connectMessage.mode;\n\t\t\t\tconst actualMode = response.mode;\n\t\t\t\tconst writingPermitted = response.claims.scopes.includes(ScopeType.DocWrite);\n\n\t\t\t\tif (writingPermitted) {\n\t\t\t\t\t// The only time we expect a mismatch in requested/actual is if we lack write permissions\n\t\t\t\t\t// In this case we will get \"read\", even if we requested \"write\"\n\t\t\t\t\tif (actualMode !== requestedMode) {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in a different mode than was requested\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (actualMode === \"write\") {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in write mode without write permissions\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ConnectDocumentSuccess\",\n\t\t\t\t\t\tpendingClientId: response.clientId,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tLogLevel.verbose,\n\t\t\t\t);\n\n\t\t\t\tthis.checkpointSequenceNumber = response.checkpointSequenceNumber;\n\n\t\t\t\tthis.removeConnectionListeners();\n\t\t\t\tresolve(response);\n\t\t\t});\n\n\t\t\t// Socket can be disconnected while waiting for Fluid protocol messages\n\t\t\t// (connect_document_error / connect_document_success), as well as before DeltaManager\n\t\t\t// had a chance to register its handlers.\n\t\t\tthis.addTrackedListener(\"disconnect\", (reason, details) => {\n\t\t\t\tfailAndCloseSocket(\n\t\t\t\t\tthis.createErrorObjectWithProps(\"disconnect\", reason, {\n\t\t\t\t\t\tsocketErrorType: details?.context?.type,\n\t\t\t\t\t\t// https://www.rfc-editor.org/rfc/rfc6455#section-7.4\n\t\t\t\t\t\tsocketCode: details?.context?.code,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tthis.addTrackedListener(\"error\", (error) => {\n\t\t\t\t// This includes \"Invalid namespace\" error, which we consider critical (reconnecting will not help)\n\t\t\t\tconst err = this.createErrorObject(\"error\", error, error !== \"Invalid namespace\");\n\t\t\t\t// Disconnect socket - required if happened before initial handshake\n\t\t\t\tfailAndCloseSocket(err);\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_error\", (error) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// This is not an socket.io error - it's Fluid protocol error.\n\t\t\t\t// In this case fail connection and indicate that we were unable to create connection\n\t\t\t\tfailConnection(this.createErrorObject(\"connect_document_error\", error));\n\t\t\t});\n\n\t\t\tthis.socket.emit(\"connect_document\", connectMessage);\n\t\t});\n\n\t\tassert(!this.disposed, 0x246 /* \"checking consistency of socket & _disposed flags\" */);\n\t}\n\n\tprivate addPropsToError(errorToBeNormalized: unknown): IFluidErrorBase {\n\t\tconst normalizedError = normalizeError(errorToBeNormalized, {\n\t\t\tprops: {\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t\treturn normalizedError;\n\t}\n\n\tprotected getConnectionDetailsProps(): {\n\t\tdisposed: boolean;\n\t\tsocketConnected: boolean | undefined;\n\t\tclientId: string | undefined;\n\t\tconnectionId: string | undefined;\n\t} {\n\t\treturn {\n\t\t\tdisposed: this._disposed,\n\t\t\tsocketConnected: this.socket?.connected,\n\t\t\tclientId: this._details?.clientId,\n\t\t\tconnectionId: this.connectionId,\n\t\t};\n\t}\n\n\tprotected earlyOpHandler = (documentId: string, msgs: ISequencedDocumentMessage[]): void => {\n\t\tthis.queuedMessages.push(...msgs);\n\t};\n\n\tprotected earlySignalHandler = (msg: ISignalMessage | ISignalMessage[]): void => {\n\t\tif (Array.isArray(msg)) {\n\t\t\tthis.queuedSignals.push(...msg);\n\t\t} else {\n\t\t\tthis.queuedSignals.push(msg);\n\t\t}\n\t};\n\n\tprivate removeEarlyOpHandler(): void {\n\t\tthis.socket.removeListener(\"op\", this.earlyOpHandler);\n\t\tthis.earlyOpHandlerAttached = false;\n\t}\n\n\tprivate removeEarlySignalHandler(): void {\n\t\tthis.socket.removeListener(\"signal\", this.earlySignalHandler);\n\t}\n\n\tprivate addConnectionListener(event: string, listener: (...args: any[]) => void): void {\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsAlwaysForwarded.includes(event),\n\t\t\t0x247 /* \"Use addTrackedListener instead\" */,\n\t\t);\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsToForward.includes(event),\n\t\t\t0x248 /* \"should not subscribe to forwarded events\" */,\n\t\t);\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.connectionListeners.has(event), 0x20d /* \"double connection listener\" */);\n\t\tthis.connectionListeners.set(event, listener);\n\t}\n\n\tprotected addTrackedListener(event: string, listener: (...args: any[]) => void): void {\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.trackedListeners.has(event), 0x20e /* \"double tracked listener\" */);\n\t\tthis.trackedListeners.set(event, listener);\n\t}\n\n\tprivate removeTrackedListeners(): void {\n\t\tfor (const [event, listener] of this.trackedListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\t// removeTrackedListeners removes all listeners, including connection listeners\n\t\tthis.removeConnectionListeners();\n\n\t\tthis.removeEarlyOpHandler();\n\t\tthis.removeEarlySignalHandler();\n\n\t\tthis.trackedListeners.clear();\n\t}\n\n\tprivate removeConnectionListeners(): void {\n\t\tif (this.socketConnectionTimeout !== undefined) {\n\t\t\tclearTimeout(this.socketConnectionTimeout);\n\t\t}\n\n\t\tfor (const [event, listener] of this.connectionListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\tthis.connectionListeners.clear();\n\t}\n\n\tprivate getErrorMessage(error?: any): string {\n\t\tif (error?.type !== \"TransportError\") {\n\t\t\treturn extractLogSafeErrorProperties(error, true).message;\n\t\t}\n\t\t// JSON.stringify drops Error.message\n\t\tconst messagePrefix = error?.message !== undefined ? `${error.message}: ` : \"\";\n\n\t\t// Websocket errors reported by engine.io-client.\n\t\t// They are Error objects with description containing WS error and description = \"TransportError\"\n\t\t// Please see https://github.com/socketio/engine.io-client/blob/7245b80/lib/transport.ts#L44,\n\t\treturn `${messagePrefix}${JSON.stringify(error, getCircularReplacer())}`;\n\t}\n\n\tprivate createErrorObjectWithProps(\n\t\thandler: string,\n\t\terror?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t\tcanRetry = true,\n\t): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\t{\n\t\t\t\t...props,\n\t\t\t\tdriverVersion,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t\tscenarioName: handler,\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\tthis.getAdditionalErrorProps(handler),\n\t\t);\n\t}\n\n\tprotected getAdditionalErrorProps(handler: string): DriverErrorTelemetryProps {\n\t\treturn {\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t\tscenarioName: handler,\n\t\t};\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"documentDeltaConnection.js","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,qEAIyC;AACzC,kEAA6D;AAE7D,0EAcqD;AACrD,oEAI+C;AAC/C,uEAUkD;AAGlD,sFAAsF;AACtF,2DAAkE;AAElE,MAAM,yBAAyB,GAAG,m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a,EAAb,8BAAa;YACb,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gBACvB,GAAG,IAAI,CAAC,yBAAyB,EAAE;aACnC,CAAC;YACF,YAAY,EAAE,OAAO;SACrB,CACD,CAAC;IACH,CAAC;IAED;;OAEG;IACO,iBAAiB,CAAC,OAAe,EAAE,KAAW,EAAE,QAAQ,GAAG,IAAI;QACxE,OAAO,IAAA,oCAAyB,EAC/B,cAAc,OAAO,MAAM,IAAI,CAAC,eAAe,CAAC,KAAK,CAAC,EAAE,EACxD,EAAE,QAAQ,EAAE,EACZ,IAAI,CAAC,uBAAuB,CAAC,OAAO,CAAC,CACrC,CAAC;IACH,CAAC;IAES,uBAAuB,CAAC,OAAe;QAChD,OAAO;YACN,aAAa,EAAb,8BAAa;YACb,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;gBACvB,GAAG,IAAI,CAAC,yBAAyB,EAAE;aACnC,CAAC;YACF,YAAY,EAAE,OAAO;SACrB,CAAC;IACH,CAAC;;AA/wBF,0DAgxBC;AA5wBgB,uCAAe,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,AAAnC,CAAoC;AAEnE,mHAAmH;AACnH,oHAAoH;AACpG,6CAAqB,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,AAA1B,CAA2B;AAEhE;;GAEG;AACa,gEAAwC,GAAG,iCAAiC,AAApC,CAAqC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tITelemetryBaseProperties,\n\tLogLevel,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\tIAnyDriverError,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaConnectionEvents,\n\tIClientConfiguration,\n\tIConnect,\n\tIConnected,\n\tIDocumentMessage,\n\ttype ISentSignalMessage,\n\tISignalClient,\n\tITokenClaims,\n\tScopeType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tUsageError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\textractLogSafeErrorProperties,\n\tgetCircularReplacer,\n\tisFluidError,\n\tnormalizeError,\n\ttype IFluidErrorBase,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\n\n// For now, this package is versioned and released in unison with the specific drivers\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\nconst feature_submit_signals_v2 = \"submit_signals_v2\";\n\n/**\n * Represents a connection to a stream of delta updates.\n * @internal\n */\nexport class DocumentDeltaConnection\n\textends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents>\n\timplements IDocumentDeltaConnection, IDisposable\n{\n\tstatic readonly eventsToForward = [\"nack\", \"op\", \"signal\", \"pong\"];\n\n\t// WARNING: These are critical events that we can't miss, so registration for them has to be in place at all times!\n\t// Including before handshake is over, and after that (but before DeltaManager had a chance to put its own handlers)\n\tstatic readonly eventsAlwaysForwarded = [\"disconnect\", \"error\"];\n\n\t/**\n\t * Error message used when client is closing the delta connection cleanly.\n\t */\n\tstatic readonly errorMessageForClientDisposeWithoutError = \"Client closing delta connection\";\n\n\t/**\n\t * Last known sequence number to ordering service at the time of connection\n\t * It may lap actual last sequence number (quite a bit, if container is very active).\n\t * But it's best information for client to figure out how far it is behind, at least\n\t * for \"read\" connections. \"write\" connections may use own \"join\" op to similar information,\n\t * that is likely to be more up-to-date.\n\t */\n\tpublic checkpointSequenceNumber: number | undefined;\n\n\t// Listen for ops sent before we receive a response to connect_document\n\tprotected readonly queuedMessages: ISequencedDocumentMessage[] = [];\n\tprotected readonly queuedSignals: ISignalMessage[] = [];\n\n\t/**\n\t * A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops\n\t * to later be retrieved via initialMessages.\n\t */\n\tprivate earlyOpHandlerAttached: boolean = false;\n\n\tprivate socketConnectionTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate _details: IConnected | undefined;\n\n\tprivate trackLatencyTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\t// Listeners only needed while the connection is in progress\n\tprivate readonly connectionListeners: Map<string, (...args: any[]) => void> = new Map();\n\t// Listeners used throughout the lifetime of the DocumentDeltaConnection\n\tprivate readonly trackedListeners: Map<string, (...args: any[]) => void> = new Map();\n\n\tprotected get hasDetails(): boolean {\n\t\treturn !!this._details;\n\t}\n\n\tpublic get disposed(): boolean {\n\t\tassert(\n\t\t\tthis._disposed || this.socket.connected,\n\t\t\t0x244 /* \"Socket is closed, but connection is not!\" */,\n\t\t);\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.\n\t * After disconnection, we flip this to prevent any stale messages from being emitted.\n\t */\n\tprotected _disposed: boolean = false;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Gets the logger from the monitoring context.\n\t *\n\t * @deprecated Implementors should manage their own logger or monitoring context\n\t */\n\tprotected get logger(): ITelemetryLoggerExt {\n\t\treturn this.mc.logger;\n\t}\n\n\tpublic get details(): IConnected {\n\t\tif (!this._details) {\n\t\t\tthrow new Error(\"Internal error: calling method before _details is initialized!\");\n\t\t}\n\t\treturn this._details;\n\t}\n\n\t/**\n\t * @param socket - websocket to be used\n\t * @param documentId - ID of the document\n\t * @param logger - for reporting telemetry events\n\t * @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure\n\t */\n\tprotected constructor(\n\t\tprotected readonly socket: Socket,\n\t\tpublic documentId: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly enableLongPollingDowngrades: boolean = false,\n\t\tprotected readonly connectionId?: string,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.addPropsToError(error);\n\t\t\tlogger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaConnection:EventException\",\n\t\t\t\t\t// Coerce to string as past typings also allowed symbols and number, but\n\t\t\t\t\t// we want telemtry properties to be consistently string.\n\t\t\t\t\tname: String(name),\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\tthis.mc = createChildMonitoringContext({ logger, namespace: \"DeltaConnection\" });\n\n\t\tthis.on(\"newListener\", (event, _listener) => {\n\t\t\tassert(!this.disposed, 0x20a /* \"register for event on disposed object\" */);\n\n\t\t\t// Some events are already forwarded - see this.addTrackedListener() calls in initialize().\n\t\t\tif (DocumentDeltaConnection.eventsAlwaysForwarded.includes(event)) {\n\t\t\t\tassert(this.trackedListeners.has(event), 0x245 /* \"tracked listener\" */);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!DocumentDeltaConnection.eventsToForward.includes(event)) {\n\t\t\t\tthrow new Error(`DocumentDeltaConnection: Registering for unknown event: ${event}`);\n\t\t\t}\n\n\t\t\t// Whenever listener is added, we should subscribe on same event on socket, so these two things\n\t\t\t// should be in sync. This currently assumes that nobody unregisters and registers back listeners,\n\t\t\t// and that there are no \"internal\" listeners installed (like \"error\" case we skip above)\n\t\t\t// Better flow might be to always unconditionally register all handlers on successful connection,\n\t\t\t// though some logic (naming assert in initialMessages getter) might need to be adjusted (it becomes noop)\n\t\t\tassert(\n\t\t\t\t(this.listeners(event).length !== 0) === this.trackedListeners.has(event),\n\t\t\t\t0x20b /* \"mismatch\" */,\n\t\t\t);\n\t\t\tif (!this.trackedListeners.has(event)) {\n\t\t\t\tif (event === \"pong\") {\n\t\t\t\t\t// Empty callback for tracking purposes in this class\n\t\t\t\t\tthis.trackedListeners.set(\"pong\", () => {});\n\n\t\t\t\t\tconst sendPingLoop = (): void => {\n\t\t\t\t\t\tconst start = Date.now();\n\n\t\t\t\t\t\tthis.socket.volatile?.emit(\"ping\", () => {\n\t\t\t\t\t\t\tthis.emit(\"pong\", Date.now() - start);\n\n\t\t\t\t\t\t\t// Schedule another ping event in 1 minute\n\t\t\t\t\t\t\tthis.trackLatencyTimeout = setTimeout(() => {\n\t\t\t\t\t\t\t\tsendPingLoop();\n\t\t\t\t\t\t\t}, 1000 * 60);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tsendPingLoop();\n\t\t\t\t} else {\n\t\t\t\t\tthis.addTrackedListener(event, (...args: any[]) => {\n\t\t\t\t\t\tthis.emit(event, ...args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the ID of the client who is sending the message\n\t *\n\t * @returns the client ID\n\t */\n\tpublic get clientId(): string {\n\t\treturn this.details.clientId;\n\t}\n\n\t/**\n\t * Get the mode of the client\n\t *\n\t * @returns the client mode\n\t */\n\tpublic get mode(): ConnectionMode {\n\t\treturn this.details.mode;\n\t}\n\n\t/**\n\t * Get the claims of the client who is sending the message\n\t *\n\t * @returns client claims\n\t */\n\tpublic get claims(): ITokenClaims {\n\t\treturn this.details.claims;\n\t}\n\n\t/**\n\t * Get whether or not this is an existing document\n\t *\n\t * @returns true if the document exists\n\t */\n\tpublic get existing(): boolean {\n\t\treturn this.details.existing;\n\t}\n\n\t/**\n\t * Get the maximum size of a message before chunking is required\n\t *\n\t * @returns the maximum size of a message before chunking is required\n\t */\n\tpublic get maxMessageSize(): number {\n\t\treturn this.details.serviceConfiguration.maxMessageSize;\n\t}\n\n\t/**\n\t * Semver of protocol being used with the service\n\t */\n\tpublic get version(): string {\n\t\treturn this.details.version;\n\t}\n\n\t/**\n\t * Configuration details provided by the service\n\t */\n\tpublic get serviceConfiguration(): IClientConfiguration {\n\t\treturn this.details.serviceConfiguration;\n\t}\n\n\tprivate checkNotDisposed(): void {\n\t\tassert(!this.disposed, 0x20c /* \"connection disposed\" */);\n\t}\n\n\t/**\n\t * Get messages sent during the connection\n\t *\n\t * @returns messages sent during the connection\n\t */\n\tpublic get initialMessages(): ISequencedDocumentMessage[] {\n\t\tthis.checkNotDisposed();\n\n\t\t// If we call this when the earlyOpHandler is not attached, then the queuedMessages may not include the\n\t\t// latest ops. This could possibly indicate that initialMessages was called twice.\n\t\tassert(this.earlyOpHandlerAttached, 0x08e /* \"Potentially missed initial messages\" */);\n\t\t// We will lose ops and perf will tank as we need to go to storage to become current!\n\t\tassert(this.listeners(\"op\").length !== 0, 0x08f /* \"No op handler is setup!\" */);\n\n\t\tthis.removeEarlyOpHandler();\n\n\t\tif (this.queuedMessages.length > 0) {\n\t\t\t// Some messages were queued.\n\t\t\t// add them to the list of initialMessages to be processed\n\t\t\tthis.details.initialMessages.push(...this.queuedMessages);\n\t\t\tthis.details.initialMessages.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\t\tthis.queuedMessages.length = 0;\n\t\t}\n\t\treturn this.details.initialMessages;\n\t}\n\n\t/**\n\t * Get signals sent during the connection\n\t *\n\t * @returns signals sent during the connection\n\t */\n\tpublic get initialSignals(): ISignalMessage[] {\n\t\tthis.checkNotDisposed();\n\t\tassert(this.listeners(\"signal\").length !== 0, 0x090 /* \"No signal handler is setup!\" */);\n\n\t\tthis.removeEarlySignalHandler();\n\n\t\tif (this.queuedSignals.length > 0) {\n\t\t\t// Some signals were queued.\n\t\t\t// add them to the list of initialSignals to be processed\n\t\t\tthis.details.initialSignals.push(...this.queuedSignals);\n\t\t\tthis.queuedSignals.length = 0;\n\t\t}\n\t\treturn this.details.initialSignals;\n\t}\n\n\t/**\n\t * Get initial client list\n\t *\n\t * @returns initial client list sent during the connection\n\t */\n\tpublic get initialClients(): ISignalClient[] {\n\t\tthis.checkNotDisposed();\n\t\treturn this.details.initialClients;\n\t}\n\t/**\n\t * Emits 'submitOp' messages.\n\t * @param type - Must be 'submitOp'.\n\t * @param messages - An array of document messages to submit.\n\t */\n\tprotected emitMessages(type: \"submitOp\", messages: IDocumentMessage[][]): void;\n\n\t/**\n\t * Emits 'submitSignal' messages.\n\t *\n\t * **Note:** When using `ISentSignalMessage[]`, the service must support the `submit_signals_v2` feature.\n\t * @param type - Must be 'submitSignal'.\n\t * @param messages - An array of signals to submit. Can be either `string[][]` or `ISentSignalMessage[]`.\n\t */\n\tprotected emitMessages(\n\t\ttype: \"submitSignal\",\n\t\tmessages: string[][] | ISentSignalMessage[],\n\t): void;\n\tprotected emitMessages(type: string, messages: unknown): void {\n\t\t// Although the implementation here disconnects the socket and does not reuse it, other subclasses\n\t\t// (e.g. OdspDocumentDeltaConnection) may reuse the socket. In these cases, we need to avoid emitting\n\t\t// on the still-live socket.\n\t\tif (!this.disposed) {\n\t\t\tthis.socket.emit(type, this.clientId, messages);\n\t\t}\n\t}\n\n\t/**\n\t * Submits a new delta operation to the server\n\t *\n\t * @param message - delta operation to submit\n\t */\n\tpublic submit(messages: IDocumentMessage[]): void {\n\t\tthis.checkNotDisposed();\n\t\tthis.emitMessages(\"submitOp\", [messages]);\n\t}\n\n\t/**\n\t * Submits a new signal to the server\n\t *\n\t * @param content - Content of the signal.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t */\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\tthis.checkNotDisposed();\n\n\t\t// Check for server-side support of v2 signals\n\t\tif (this.details.supportedFeatures?.submit_signals_v2 === true) {\n\t\t\tconst signal: ISentSignalMessage = { content };\n\t\t\tif (targetClientId !== undefined) {\n\t\t\t\tsignal.targetClientId = targetClientId;\n\t\t\t}\n\t\t\tthis.emitMessages(\"submitSignal\", [signal]);\n\t\t} else if (targetClientId !== undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Sending signals to specific client ids is not supported with this service.\",\n\t\t\t);\n\t\t} else {\n\t\t\tthis.emitMessages(\"submitSignal\", [[content]]);\n\t\t}\n\t}\n\n\t/**\n\t * Disconnect from the websocket and close the websocket too.\n\t */\n\tprivate closeSocket(error: IAnyDriverError): void {\n\t\tif (this._disposed) {\n\t\t\t// This would be rare situation due to complexity around socket emitting events.\n\t\t\treturn;\n\t\t}\n\t\tthis.closeSocketCore(error);\n\t}\n\n\tprotected closeSocketCore(error: IAnyDriverError): void {\n\t\tthis.disconnect(error);\n\t}\n\n\t/**\n\t * Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.\n\t * However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no\n\t * multiplexing here, so we need to close the socket here.\n\t *\n\t * @param error - An optional error object. If provided, the connection will be closed with the specified error,\n\t * indicating an error-triggered disconnect. If not provided, the connection will be closed cleanly.\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ClientClosingDeltaConnection\",\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t});\n\t\tif (isFluidError(error)) {\n\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\tprops: { driverVersion },\n\t\t\t}) as IFluidErrorBase & {\n\t\t\t\tcanRetry: boolean;\n\t\t\t};\n\t\t\tthis.disconnect(fluidError);\n\t\t} else {\n\t\t\tthis.disconnect(\n\t\t\t\tcreateGenericNetworkError(\n\t\t\t\t\t// pre-0.58 error message: clientClosingConnection\n\t\t\t\t\terror?.message ?? DocumentDeltaConnection.errorMessageForClientDisposeWithoutError,\n\t\t\t\t\t{ canRetry: error === undefined },\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected readonly disconnect = (err: IAnyDriverError): void => {\n\t\t// Can't check this.disposed here, as we get here on socket closure,\n\t\t// so _disposed & socket.connected might be not in sync while processing\n\t\t// \"dispose\" event.\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.trackLatencyTimeout !== undefined) {\n\t\t\tclearTimeout(this.trackLatencyTimeout);\n\t\t\tthis.trackLatencyTimeout = undefined;\n\t\t}\n\n\t\t// We set the disposed flag as a part of the contract for overriding the disconnect method. This is used by\n\t\t// DocumentDeltaConnection to determine if emitting messages (ops) on the socket is allowed, which is\n\t\t// important since OdspDocumentDeltaConnection reuses the socket rather than truly disconnecting it. Note that\n\t\t// OdspDocumentDeltaConnection may still send disconnect_document which is allowed; this is only intended\n\t\t// to prevent normal messages from being emitted.\n\t\tthis._disposed = true;\n\n\t\t// Remove all listeners listening on the socket. These are listeners on socket and not on this connection\n\t\t// object. Anyway since we have disposed this connection object, nobody should listen to event on socket\n\t\t// anymore.\n\t\tthis.removeTrackedListeners();\n\n\t\t// Clear the connection/socket before letting the deltaManager/connection manager know about the disconnect.\n\t\tthis.disconnectCore(err);\n\n\t\t// Let user of connection object know about disconnect.\n\t\tthis.emit(\"disconnect\", err);\n\t};\n\n\t/**\n\t * Disconnect from the websocket.\n\t * @param reason - reason for disconnect\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tthis.socket.disconnect();\n\t}\n\n\tprotected async initialize(connectMessage: IConnect, timeout: number): Promise<void> {\n\t\tthis.socket.on(\"op\", this.earlyOpHandler);\n\t\tthis.socket.on(\"signal\", this.earlySignalHandler);\n\t\tthis.earlyOpHandlerAttached = true;\n\n\t\tconnectMessage.supportedFeatures = {\n\t\t\t...connectMessage.supportedFeatures,\n\t\t\t[feature_submit_signals_v2]: true,\n\t\t};\n\n\t\t// Socket.io's reconnect_attempt event is unreliable, so we track connect_error count instead.\n\t\tlet internalSocketConnectionFailureCount: number = 0;\n\t\tconst isInternalSocketReconnectionEnabled = (): boolean => this.socket.io.reconnection();\n\t\tconst getMaxInternalSocketReconnectionAttempts = (): number =>\n\t\t\tisInternalSocketReconnectionEnabled() ? this.socket.io.reconnectionAttempts() : 0;\n\t\tconst getMaxAllowedInternalSocketConnectionFailures = (): number =>\n\t\t\tgetMaxInternalSocketReconnectionAttempts() + 1;\n\n\t\tthis._details = await new Promise<IConnected>((resolve, reject) => {\n\t\t\tconst failAndCloseSocket = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.closeSocket(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"CloseSocketError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\tconst failConnection = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.disconnect(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"FailConnectionError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\t// Immediately set the connection timeout.\n\t\t\t// Give extra 2 seconds for handshake on top of socket connection timeout.\n\t\t\tthis.socketConnectionTimeout = setTimeout(() => {\n\t\t\t\tfailConnection(this.createErrorObject(\"orderingServiceHandshakeTimeout\"));\n\t\t\t}, timeout + 2000);\n\n\t\t\t// Listen for connection issues\n\t\t\tthis.addConnectionListener(\"connect_error\", (error) => {\n\t\t\t\tinternalSocketConnectionFailureCount++;\n\t\t\t\tlet isWebSocketTransportError = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst description = error?.description;\n\t\t\t\t\tconst context = error?.context;\n\n\t\t\t\t\tif (context && typeof context === \"object\") {\n\t\t\t\t\t\tconst statusText = context.statusText?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.context\n\t\t\t\t\t\tif (statusText === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (description && typeof description === \"object\") {\n\t\t\t\t\t\tconst errorCode = description.error?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.description\n\t\t\t\t\t\tif (errorCode === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (error.type === \"TransportError\") {\n\t\t\t\t\t\t\tisWebSocketTransportError = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// That's a WebSocket. Clear it as we can't log it.\n\t\t\t\t\t\tdescription.target = undefined;\n\t\t\t\t\t}\n\t\t\t\t} catch (_e) {\n\t\t\t\t\t// TODO: document why we are ignoring the error here\n\t\t\t\t}\n\n\t\t\t\t// Handle socket transport downgrading when not offline.\n\t\t\t\tif (\n\t\t\t\t\tisWebSocketTransportError &&\n\t\t\t\t\tthis.enableLongPollingDowngrades &&\n\t\t\t\t\tthis.socket.io.opts.transports?.[0] !== \"polling\"\n\t\t\t\t) {\n\t\t\t\t\t// Downgrade transports to polling upgrade mechanism.\n\t\t\t\t\tthis.socket.io.opts.transports = [\"polling\", \"websocket\"];\n\t\t\t\t\t// Don't alter reconnection behavior if already enabled.\n\t\t\t\t\tif (!isInternalSocketReconnectionEnabled()) {\n\t\t\t\t\t\t// Allow single reconnection attempt using polling upgrade mechanism.\n\t\t\t\t\t\tthis.socket.io.reconnection(true);\n\t\t\t\t\t\tthis.socket.io.reconnectionAttempts(1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Allow built-in socket.io reconnection handling.\n\t\t\t\tif (\n\t\t\t\t\tisInternalSocketReconnectionEnabled() &&\n\t\t\t\t\tinternalSocketConnectionFailureCount <\n\t\t\t\t\t\tgetMaxAllowedInternalSocketConnectionFailures()\n\t\t\t\t) {\n\t\t\t\t\t// Reconnection is enabled and maximum reconnect attempts have not been reached.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error));\n\t\t\t});\n\n\t\t\t// Listen for timeouts\n\t\t\tthis.addConnectionListener(\"connect_timeout\", () => {\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_timeout\"));\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_success\", (response: IConnected) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst requestedMode = connectMessage.mode;\n\t\t\t\tconst actualMode = response.mode;\n\t\t\t\tconst writingPermitted = response.claims.scopes.includes(ScopeType.DocWrite);\n\n\t\t\t\tif (writingPermitted) {\n\t\t\t\t\t// The only time we expect a mismatch in requested/actual is if we lack write permissions\n\t\t\t\t\t// In this case we will get \"read\", even if we requested \"write\"\n\t\t\t\t\tif (actualMode !== requestedMode) {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in a different mode than was requested\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (actualMode === \"write\") {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in write mode without write permissions\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ConnectDocumentSuccess\",\n\t\t\t\t\t\tpendingClientId: response.clientId,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tLogLevel.verbose,\n\t\t\t\t);\n\n\t\t\t\tthis.checkpointSequenceNumber = response.checkpointSequenceNumber;\n\n\t\t\t\tthis.removeConnectionListeners();\n\t\t\t\tresolve(response);\n\t\t\t});\n\n\t\t\t// Socket can be disconnected while waiting for Fluid protocol messages\n\t\t\t// (connect_document_error / connect_document_success), as well as before DeltaManager\n\t\t\t// had a chance to register its handlers.\n\t\t\tthis.addTrackedListener(\"disconnect\", (reason, details) => {\n\t\t\t\tfailAndCloseSocket(\n\t\t\t\t\tthis.createErrorObjectWithProps(\"disconnect\", reason, {\n\t\t\t\t\t\tsocketErrorType: details?.context?.type,\n\t\t\t\t\t\t// https://www.rfc-editor.org/rfc/rfc6455#section-7.4\n\t\t\t\t\t\tsocketCode: details?.context?.code,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tthis.addTrackedListener(\"error\", (error) => {\n\t\t\t\t// This includes \"Invalid namespace\" error, which we consider critical (reconnecting will not help)\n\t\t\t\tconst err = this.createErrorObject(\"error\", error, error !== \"Invalid namespace\");\n\t\t\t\t// Disconnect socket - required if happened before initial handshake\n\t\t\t\tfailAndCloseSocket(err);\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_error\", (error) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// This is not an socket.io error - it's Fluid protocol error.\n\t\t\t\t// In this case fail connection and indicate that we were unable to create connection\n\t\t\t\tfailConnection(this.createErrorObject(\"connect_document_error\", error));\n\t\t\t});\n\n\t\t\tthis.socket.emit(\"connect_document\", connectMessage);\n\t\t});\n\n\t\tassert(!this.disposed, 0x246 /* \"checking consistency of socket & _disposed flags\" */);\n\t}\n\n\tprivate addPropsToError(errorToBeNormalized: unknown): IFluidErrorBase {\n\t\tconst normalizedError = normalizeError(errorToBeNormalized, {\n\t\t\tprops: {\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t\treturn normalizedError;\n\t}\n\n\tprotected getConnectionDetailsProps(): {\n\t\tdisposed: boolean;\n\t\tsocketConnected: boolean | undefined;\n\t\tclientId: string | undefined;\n\t\tconnectionId: string | undefined;\n\t} {\n\t\treturn {\n\t\t\tdisposed: this._disposed,\n\t\t\tsocketConnected: this.socket?.connected,\n\t\t\tclientId: this._details?.clientId,\n\t\t\tconnectionId: this.connectionId,\n\t\t};\n\t}\n\n\tprotected earlyOpHandler = (documentId: string, msgs: ISequencedDocumentMessage[]): void => {\n\t\tthis.queuedMessages.push(...msgs);\n\t};\n\n\tprotected earlySignalHandler = (msg: ISignalMessage | ISignalMessage[]): void => {\n\t\tif (Array.isArray(msg)) {\n\t\t\tthis.queuedSignals.push(...msg);\n\t\t} else {\n\t\t\tthis.queuedSignals.push(msg);\n\t\t}\n\t};\n\n\tprivate removeEarlyOpHandler(): void {\n\t\tthis.socket.removeListener(\"op\", this.earlyOpHandler);\n\t\tthis.earlyOpHandlerAttached = false;\n\t}\n\n\tprivate removeEarlySignalHandler(): void {\n\t\tthis.socket.removeListener(\"signal\", this.earlySignalHandler);\n\t}\n\n\tprivate addConnectionListener(event: string, listener: (...args: any[]) => void): void {\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsAlwaysForwarded.includes(event),\n\t\t\t0x247 /* \"Use addTrackedListener instead\" */,\n\t\t);\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsToForward.includes(event),\n\t\t\t0x248 /* \"should not subscribe to forwarded events\" */,\n\t\t);\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.connectionListeners.has(event), 0x20d /* \"double connection listener\" */);\n\t\tthis.connectionListeners.set(event, listener);\n\t}\n\n\tprotected addTrackedListener(event: string, listener: (...args: any[]) => void): void {\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.trackedListeners.has(event), 0x20e /* \"double tracked listener\" */);\n\t\tthis.trackedListeners.set(event, listener);\n\t}\n\n\tprivate removeTrackedListeners(): void {\n\t\tfor (const [event, listener] of this.trackedListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\t// removeTrackedListeners removes all listeners, including connection listeners\n\t\tthis.removeConnectionListeners();\n\n\t\tthis.removeEarlyOpHandler();\n\t\tthis.removeEarlySignalHandler();\n\n\t\tthis.trackedListeners.clear();\n\t}\n\n\tprivate removeConnectionListeners(): void {\n\t\tif (this.socketConnectionTimeout !== undefined) {\n\t\t\tclearTimeout(this.socketConnectionTimeout);\n\t\t}\n\n\t\tfor (const [event, listener] of this.connectionListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\tthis.connectionListeners.clear();\n\t}\n\n\tprivate getErrorMessage(error?: any): string {\n\t\tif (error?.type !== \"TransportError\") {\n\t\t\treturn extractLogSafeErrorProperties(error, true).message;\n\t\t}\n\t\t// JSON.stringify drops Error.message\n\t\tconst messagePrefix = error?.message !== undefined ? `${error.message}: ` : \"\";\n\n\t\t// Websocket errors reported by engine.io-client.\n\t\t// They are Error objects with description containing WS error and description = \"TransportError\"\n\t\t// Please see https://github.com/socketio/engine.io-client/blob/7245b80/lib/transport.ts#L44,\n\t\treturn `${messagePrefix}${JSON.stringify(error, getCircularReplacer())}`;\n\t}\n\n\tprivate createErrorObjectWithProps(\n\t\thandler: string,\n\t\terror?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t\tcanRetry = true,\n\t): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\t{\n\t\t\t\t...props,\n\t\t\t\tdriverVersion,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t\tscenarioName: handler,\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\tthis.getAdditionalErrorProps(handler),\n\t\t);\n\t}\n\n\tprotected getAdditionalErrorProps(handler: string): DriverErrorTelemetryProps {\n\t\treturn {\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t\tscenarioName: handler,\n\t\t};\n\t}\n}\n"]}
|
package/dist/driverUtils.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promis
|
|
|
30
30
|
value: T;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
|
+
* Validates that sequenced messages are contiguous and in the expected range.
|
|
34
|
+
*
|
|
33
35
|
* @internal
|
|
34
36
|
*/
|
|
35
37
|
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E;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AS,CAAC;IAChD,yBAAyB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C,CA4EA;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC5C,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GACpB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAMtC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,yBAAyB,EAAE,EACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,EAC3B,MAAM,GAAE,OAAc,GACpB,IAAI,CAqCN"}
|
package/dist/driverUtils.js
CHANGED
|
@@ -99,6 +99,8 @@ async function promiseRaceWithWinner(promises) {
|
|
|
99
99
|
}
|
|
100
100
|
exports.promiseRaceWithWinner = promiseRaceWithWinner;
|
|
101
101
|
/**
|
|
102
|
+
* Validates that sequenced messages are contiguous and in the expected range.
|
|
103
|
+
*
|
|
102
104
|
* @internal
|
|
103
105
|
*/
|
|
104
106
|
function validateMessages(reason, messages, from, logger, strict = true) {
|
package/dist/driverUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverUtils.js","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;;;GAKG;AACH,SAAgB,UAAU,CACzB,GAAW,EACX,aAAqB;IAWrB,mFAAmF;IACnF,2EAA2E;IAC3E,8FAA8F;IAC9F,wGAAwG;IACxG,oFAAoF;IACpF,gGAAgG;IAChG,mGAAmG;IACnG,mGAAmG;IACnG,2FAA2F;IAC3F,oGAAoG;IACpG,mGAAmG;IACnG,4EAA4E;IAC5E,+FAA+F;IAE/F,gFAAgF;IAChF,IAAI,aAAiC,CAAC,CAAC,sCAAsC;IAC7E,6EAA6E;IAC7E,IAAI,YAAgC,CAAC,CAAC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!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Extract and return the w3c data.\n * @param url - request url for which w3c data needs to be reported.\n * @param initiatorType - type of the network call\n * @internal\n */\nexport function getW3CData(\n\turl: string,\n\tinitiatorType: string,\n): {\n\tdnsLookupTime: number | undefined;\n\tw3cStartTime: number | undefined;\n\tredirectTime: number | undefined;\n\ttcpHandshakeTime: number | undefined;\n\tsecureConnectionTime: number | undefined;\n\tresponseNetworkTime: number | undefined;\n\tfetchStartToResponseEndTime: number | undefined;\n\treqStartToResponseEndTime: number | undefined;\n} {\n\t// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n\t// fetchStart: immediately before the browser starts to fetch the resource.\n\t// requestStart: immediately before the browser starts requesting the resource from the server\n\t// responseStart: immediately after the browser receives the first byte of the response from the server.\n\t// responseEnd: immediately after the browser receives the last byte of the resource\n\t// or immediately before the transport connection is closed, whichever comes first.\n\t// secureConnectionStart: immediately before the browser starts the handshake process to secure the\n\t// current connection. If a secure connection is not used, this property returns zero.\n\t// startTime: Time when the resource fetch started. This value is equivalent to fetchStart.\n\t// domainLookupStart: immediately before the browser starts the domain name lookup for the resource.\n\t// domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.\n\t// redirectStart: start time of the fetch which that initiates the redirect.\n\t// redirectEnd: immediately after receiving the last byte of the response of the last redirect.\n\n\t// Interval between start and finish of the domain name lookup for the resource.\n\tlet dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart\n\t// Interval between the first fetch until the last byte of the last redirect.\n\tlet redirectTime: number | undefined; // redirectEnd - redirectStart\n\t// Time to establish the connection to the server to retrieve the resource.\n\tlet tcpHandshakeTime: number | undefined; // connectEnd - connectStart\n\t// Time from the end of the connection until the inital handshake process to secure the connection.\n\t// If 0, then no time is spent here.\n\tlet secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart\n\t// Interval to receive all (first to last) bytes form the server.\n\tlet responseNetworkTime: number | undefined; // responsEnd - responseStart\n\t// Interval between the initial fetch until the last byte is received.\n\t// Likely same as fetchTime + receiveContentTime.\n\tlet fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart\n\t// reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>\n\t// Interval between starting the request for the resource until receiving the last byte.\n\tlet reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart\n\tlet w3cStartTime: number | undefined; // W3C Start time = fetchStart time\n\n\t// getEntriesByType is only available in browser performance object\n\tconst resources1 = globalThis.performance.getEntriesByType?.(\"resource\") ?? [];\n\t// Usually the latest fetch call is to the end of resources, so we start from the end.\n\tfor (let i = resources1.length - 1; i > 0; i--) {\n\t\tconst indResTime = resources1[i] as PerformanceResourceTiming;\n\t\tconst resource_name = indResTime.name.toString();\n\t\tconst resource_initiatortype = indResTime.initiatorType;\n\t\tif (\n\t\t\tresource_initiatortype.localeCompare(initiatorType) === 0 &&\n\t\t\tresource_name.includes(url)\n\t\t) {\n\t\t\tredirectTime = indResTime.redirectEnd - indResTime.redirectStart;\n\t\t\tw3cStartTime = indResTime.fetchStart;\n\t\t\tdnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;\n\t\t\ttcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;\n\t\t\tsecureConnectionTime =\n\t\t\t\tindResTime.secureConnectionStart > 0\n\t\t\t\t\t? indResTime.connectEnd - indResTime.secureConnectionStart\n\t\t\t\t\t: 0;\n\t\t\tresponseNetworkTime =\n\t\t\t\tindResTime.responseStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.responseStart\n\t\t\t\t\t: undefined;\n\t\t\tfetchStartToResponseEndTime =\n\t\t\t\tindResTime.fetchStart > 0 ? indResTime.responseEnd - indResTime.fetchStart : undefined;\n\t\t\treqStartToResponseEndTime =\n\t\t\t\tindResTime.requestStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.requestStart\n\t\t\t\t\t: undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\tdnsLookupTime,\n\t\tw3cStartTime,\n\t\tredirectTime,\n\t\ttcpHandshakeTime,\n\t\tsecureConnectionTime,\n\t\tresponseNetworkTime,\n\t\tfetchStartToResponseEndTime,\n\t\treqStartToResponseEndTime,\n\t};\n}\n\n/**\n * An implementation of Promise.race that gives you the winner of the promise race.\n * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.\n * @internal\n */\nexport async function promiseRaceWithWinner<T>(\n\tpromises: Promise<T>[],\n): Promise<{ index: number; value: T }> {\n\treturn new Promise((resolve, reject) => {\n\t\tpromises.forEach((p, index) => {\n\t\t\tp.then((v): void => resolve({ index, value: v })).catch(reject);\n\t\t});\n\t});\n}\n\n/**\n * @internal\n */\nexport function validateMessages(\n\treason: string,\n\tmessages: ISequencedDocumentMessage[],\n\tfrom: number,\n\tlogger: ITelemetryLoggerExt,\n\tstrict: boolean = true,\n): void {\n\tif (messages.length !== 0) {\n\t\tconst start = messages[0].sequenceNumber;\n\t\tconst length = messages.length;\n\t\tconst last = messages[length - 1].sequenceNumber;\n\t\tif (last + 1 !== from + length) {\n\t\t\t// If not strict, then return the first consecutive sub-block. If strict or start\n\t\t\t// seq number is not what we expected, then return no ops.\n\t\t\tif (strict || from !== start) {\n\t\t\t\tmessages.length = 0;\n\t\t\t} else {\n\t\t\t\tlet validOpsCount = 1;\n\t\t\t\twhile (\n\t\t\t\t\tvalidOpsCount < messages.length &&\n\t\t\t\t\tmessages[validOpsCount].sequenceNumber ===\n\t\t\t\t\t\tmessages[validOpsCount - 1].sequenceNumber + 1\n\t\t\t\t) {\n\t\t\t\t\tvalidOpsCount++;\n\t\t\t\t}\n\t\t\t\tmessages.length = validOpsCount;\n\t\t\t}\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\treason,\n\t\t\t\tfrom,\n\t\t\t\tstart,\n\t\t\t\tlast,\n\t\t\t\tlength,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\tvalidLength: messages.length,\n\t\t\t\t\tlastValidOpSeqNumber:\n\t\t\t\t\t\tmessages.length > 0 ? messages[messages.length - 1].sequenceNumber : undefined,\n\t\t\t\t\tstrict,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"driverUtils.js","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAKH;;;;;GAKG;AACH,SAAgB,UAAU,CACzB,GAAW,EACX,aAAqB;IAWrB,mFAAmF;IACnF,2EAA2E;IAC3E,8FAA8F;IAC9F,wGAAwG;IACxG,oFAAoF;IACpF,gGAAgG;IAChG,mGAAmG;IACnG,mGAAmG;IACnG,2FAA2F;IAC3F,oGAAoG;IACpG,mGAAmG;IACnG,4EAA4E;IAC5E,+FAA+F;IAE/F,gFAAgF;IAChF,IAAI,aAAiC,CAAC,CAAC,sCAAsC;IAC7E,6EAA6E;IAC7E,IAAI,YAAgC,CAAC,CAAC,8BAA8B;IACpE,2EAA2E;IAC3E,IAAI,gBAAoC,CAAC,CAAC,6BAA6B;IACvE,mGAAmG;IACnG,oCAAoC;IACpC,IAAI,oBAAwC,CAAC,CAAC,sCAAsC;IACpF,iEAAiE;IACjE,IAAI,mBAAuC,CAAC,CAAC,6BAA6B;IAC1E,sEAAsE;IACtE,iDAAiD;IACjD,IAAI,2BAA+C,CAAC,CAAC,4BAA4B;IACjF,oFAAoF;IACpF,wFAAwF;IACxF,IAAI,yBAA6C,CAAC,CAAC,6BAA6B;IAChF,IAAI,YAAgC,CAAC,CAAC,mCAAmC;IAEzE,mEAAmE;IACnE,MAAM,UAAU,GAAG,UAAU,CAAC,WAAW,CAAC,gBAAgB,EAAE,CAAC,UAAU,CAAC,IAAI,EAAE,CAAC;I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GAAG,CAAC,CAAC;gBACtB,OACC,aAAa,GAAG,QAAQ,CAAC,MAAM;oBAC/B,QAAQ,CAAC,aAAa,CAAC,CAAC,cAAc;wBACrC,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,EAC9C,CAAC;oBACF,aAAa,EAAE,CAAC;gBACjB,CAAC;gBACD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC;YACjC,CAAC;YACD,MAAM,CAAC,cAAc,CAAC;gBACrB,SAAS,EAAE,mBAAmB;gBAC9B,MAAM;gBACN,IAAI;gBACJ,KAAK;gBACL,IAAI;gBACJ,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,WAAW,EAAE,QAAQ,CAAC,MAAM;oBAC5B,oBAAoB,EACnB,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;oBAC/E,MAAM;iBACN,CAAC;aACF,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;AACF,CAAC;AA3CD,4CA2CC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Extract and return the w3c data.\n * @param url - request url for which w3c data needs to be reported.\n * @param initiatorType - type of the network call\n * @internal\n */\nexport function getW3CData(\n\turl: string,\n\tinitiatorType: string,\n): {\n\tdnsLookupTime: number | undefined;\n\tw3cStartTime: number | undefined;\n\tredirectTime: number | undefined;\n\ttcpHandshakeTime: number | undefined;\n\tsecureConnectionTime: number | undefined;\n\tresponseNetworkTime: number | undefined;\n\tfetchStartToResponseEndTime: number | undefined;\n\treqStartToResponseEndTime: number | undefined;\n} {\n\t// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n\t// fetchStart: immediately before the browser starts to fetch the resource.\n\t// requestStart: immediately before the browser starts requesting the resource from the server\n\t// responseStart: immediately after the browser receives the first byte of the response from the server.\n\t// responseEnd: immediately after the browser receives the last byte of the resource\n\t// or immediately before the transport connection is closed, whichever comes first.\n\t// secureConnectionStart: immediately before the browser starts the handshake process to secure the\n\t// current connection. If a secure connection is not used, this property returns zero.\n\t// startTime: Time when the resource fetch started. This value is equivalent to fetchStart.\n\t// domainLookupStart: immediately before the browser starts the domain name lookup for the resource.\n\t// domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.\n\t// redirectStart: start time of the fetch which that initiates the redirect.\n\t// redirectEnd: immediately after receiving the last byte of the response of the last redirect.\n\n\t// Interval between start and finish of the domain name lookup for the resource.\n\tlet dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart\n\t// Interval between the first fetch until the last byte of the last redirect.\n\tlet redirectTime: number | undefined; // redirectEnd - redirectStart\n\t// Time to establish the connection to the server to retrieve the resource.\n\tlet tcpHandshakeTime: number | undefined; // connectEnd - connectStart\n\t// Time from the end of the connection until the inital handshake process to secure the connection.\n\t// If 0, then no time is spent here.\n\tlet secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart\n\t// Interval to receive all (first to last) bytes form the server.\n\tlet responseNetworkTime: number | undefined; // responsEnd - responseStart\n\t// Interval between the initial fetch until the last byte is received.\n\t// Likely same as fetchTime + receiveContentTime.\n\tlet fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart\n\t// reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>\n\t// Interval between starting the request for the resource until receiving the last byte.\n\tlet reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart\n\tlet w3cStartTime: number | undefined; // W3C Start time = fetchStart time\n\n\t// getEntriesByType is only available in browser performance object\n\tconst resources1 = globalThis.performance.getEntriesByType?.(\"resource\") ?? [];\n\t// Usually the latest fetch call is to the end of resources, so we start from the end.\n\tfor (let i = resources1.length - 1; i > 0; i--) {\n\t\tconst indResTime = resources1[i] as PerformanceResourceTiming;\n\t\tconst resource_name = indResTime.name.toString();\n\t\tconst resource_initiatortype = indResTime.initiatorType;\n\t\tif (\n\t\t\tresource_initiatortype.localeCompare(initiatorType) === 0 &&\n\t\t\tresource_name.includes(url)\n\t\t) {\n\t\t\tredirectTime = indResTime.redirectEnd - indResTime.redirectStart;\n\t\t\tw3cStartTime = indResTime.fetchStart;\n\t\t\tdnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;\n\t\t\ttcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;\n\t\t\tsecureConnectionTime =\n\t\t\t\tindResTime.secureConnectionStart > 0\n\t\t\t\t\t? indResTime.connectEnd - indResTime.secureConnectionStart\n\t\t\t\t\t: 0;\n\t\t\tresponseNetworkTime =\n\t\t\t\tindResTime.responseStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.responseStart\n\t\t\t\t\t: undefined;\n\t\t\tfetchStartToResponseEndTime =\n\t\t\t\tindResTime.fetchStart > 0 ? indResTime.responseEnd - indResTime.fetchStart : undefined;\n\t\t\treqStartToResponseEndTime =\n\t\t\t\tindResTime.requestStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.requestStart\n\t\t\t\t\t: undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\tdnsLookupTime,\n\t\tw3cStartTime,\n\t\tredirectTime,\n\t\ttcpHandshakeTime,\n\t\tsecureConnectionTime,\n\t\tresponseNetworkTime,\n\t\tfetchStartToResponseEndTime,\n\t\treqStartToResponseEndTime,\n\t};\n}\n\n/**\n * An implementation of Promise.race that gives you the winner of the promise race.\n * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.\n * @internal\n */\nexport async function promiseRaceWithWinner<T>(\n\tpromises: Promise<T>[],\n): Promise<{ index: number; value: T }> {\n\treturn new Promise((resolve, reject) => {\n\t\tpromises.forEach((p, index) => {\n\t\t\tp.then((v): void => resolve({ index, value: v })).catch(reject);\n\t\t});\n\t});\n}\n\n/**\n * Validates that sequenced messages are contiguous and in the expected range.\n *\n * @internal\n */\nexport function validateMessages(\n\treason: string,\n\tmessages: ISequencedDocumentMessage[],\n\tfrom: number,\n\tlogger: ITelemetryLoggerExt,\n\tstrict: boolean = true,\n): void {\n\tif (messages.length !== 0) {\n\t\tconst start = messages[0].sequenceNumber;\n\t\tconst length = messages.length;\n\t\tconst last = messages[length - 1].sequenceNumber;\n\t\tif (last + 1 !== from + length) {\n\t\t\t// If not strict, then return the first consecutive sub-block. If strict or start\n\t\t\t// seq number is not what we expected, then return no ops.\n\t\t\tif (strict || from !== start) {\n\t\t\t\tmessages.length = 0;\n\t\t\t} else {\n\t\t\t\tlet validOpsCount = 1;\n\t\t\t\twhile (\n\t\t\t\t\tvalidOpsCount < messages.length &&\n\t\t\t\t\tmessages[validOpsCount].sequenceNumber ===\n\t\t\t\t\t\tmessages[validOpsCount - 1].sequenceNumber + 1\n\t\t\t\t) {\n\t\t\t\t\tvalidOpsCount++;\n\t\t\t\t}\n\t\t\t\tmessages.length = validOpsCount;\n\t\t\t}\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\treason,\n\t\t\t\tfrom,\n\t\t\t\tstart,\n\t\t\t\tlast,\n\t\t\t\tlength,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\tvalidLength: messages.length,\n\t\t\t\t\tlastValidOpSeqNumber:\n\t\t\t\t\t\tmessages.length > 0 ? messages[messages.length - 1].sequenceNumber : undefined,\n\t\t\t\t\tstrict,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\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/driver-base";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.82.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/driver-base";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.82.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.82.0\";\n"]}
|
|
@@ -52,6 +52,8 @@ export declare class DocumentDeltaConnection extends EventEmitterWithErrorHandli
|
|
|
52
52
|
protected _disposed: boolean;
|
|
53
53
|
private readonly mc;
|
|
54
54
|
/**
|
|
55
|
+
* Gets the logger from the monitoring context.
|
|
56
|
+
*
|
|
55
57
|
* @deprecated Implementors should manage their own logger or monitoring context
|
|
56
58
|
*/
|
|
57
59
|
protected get logger(): ITelemetryLoggerExt;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACN,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,aAAa,EACb,YAAY,EAEZ,yBAAyB,EACzB,cAAc,EACd,MAAM,6CAA6C,CAAC;AACrD,OAAO,EAGN,KAAK,yBAAyB,EAC9B,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EACN,mBAAmB,EACnB,6BAA6B,EAQ7B,MAAM,0CAA0C,CAAC;AAClD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,kBAAkB,CAAC;AAO/C;;;GAGG;AACH,qBAAa,uBACZ,SAAQ,6BAA6B,CAAC,8BAA8B,CACpE,YAAW,wBAAwB,EAAE,WAAW;
|
|
1
|
+
{"version":3,"file":"documentDeltaConnection.d.ts","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EAGX,MAAM,iCAAiC,CAAC;AAEzC,OAAO,EAAE,cAAc,EAAE,MAAM,oCAAoC,CAAC;AACpE,OAAO,EACN,eAAe,EACf,wBAAwB,EACxB,8BAA8B,EAC9B,oBAAoB,EACpB,QAAQ,EACR,UAAU,EACV,gBAAgB,EAChB,KAAK,kBAAkB,EACvB,aAAa,EACb,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AE,GAAG,EAAE,QAAQ,UAAO,GAAG,eAAe;IAQ3F,SAAS,CAAC,uBAAuB,CAAC,OAAO,EAAE,MAAM,GAAG,yBAAyB;CAS7E"}
|
|
@@ -23,6 +23,8 @@ export class DocumentDeltaConnection extends EventEmitterWithErrorHandling {
|
|
|
23
23
|
return this._disposed;
|
|
24
24
|
}
|
|
25
25
|
/**
|
|
26
|
+
* Gets the logger from the monitoring context.
|
|
27
|
+
*
|
|
26
28
|
* @deprecated Implementors should manage their own logger or monitoring context
|
|
27
29
|
*/
|
|
28
30
|
get logger() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentDeltaConnection.js","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,QAAQ,GACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAWN,SAAS,GAGT,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,UAAU,EACV,yBAAyB,GAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEN,6BAA6B,EAE7B,4BAA4B,EAC5B,6BAA6B,EAC7B,mBAAmB,EACnB,YAAY,EACZ,cAAc,GAEd,MAAM,0CAA0C,CAAC;AAGlD,sFAAsF;AACtF,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAEtD;;;GAGG;AACH,MAAM,OAAO,uBACZ,SAAQ,6BAA6D;IA4CrE,IAAc,UAAU;QACvB,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,IAAW,QAAQ;QAClB,MAAM,CACL,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EACvC,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS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BACvB,GAAG,IAAI,CAAC,yBAAyB,EAAE;aACnC,CAAC;YACF,YAAY,EAAE,OAAO;SACrB,CAAC;IACH,CAAC;;AAzwBe,uCAAe,GAAG,CAAC,MAAM,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,CAAC,AAAnC,CAAoC;AAEnE,mHAAmH;AACnH,oHAAoH;AACpG,6CAAqB,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,AAA1B,CAA2B;AAEhE;;GAEG;AACa,gEAAwC,GAAG,iCAAiC,AAApC,CAAqC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tITelemetryBaseProperties,\n\tLogLevel,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\tIAnyDriverError,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaConnectionEvents,\n\tIClientConfiguration,\n\tIConnect,\n\tIConnected,\n\tIDocumentMessage,\n\ttype ISentSignalMessage,\n\tISignalClient,\n\tITokenClaims,\n\tScopeType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tUsageError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\textractLogSafeErrorProperties,\n\tgetCircularReplacer,\n\tisFluidError,\n\tnormalizeError,\n\ttype IFluidErrorBase,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\n\n// For now, this package is versioned and released in unison with the specific drivers\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\nconst feature_submit_signals_v2 = \"submit_signals_v2\";\n\n/**\n * Represents a connection to a stream of delta updates.\n * @internal\n */\nexport class DocumentDeltaConnection\n\textends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents>\n\timplements IDocumentDeltaConnection, IDisposable\n{\n\tstatic readonly eventsToForward = [\"nack\", \"op\", \"signal\", \"pong\"];\n\n\t// WARNING: These are critical events that we can't miss, so registration for them has to be in place at all times!\n\t// Including before handshake is over, and after that (but before DeltaManager had a chance to put its own handlers)\n\tstatic readonly eventsAlwaysForwarded = [\"disconnect\", \"error\"];\n\n\t/**\n\t * Error message used when client is closing the delta connection cleanly.\n\t */\n\tstatic readonly errorMessageForClientDisposeWithoutError = \"Client closing delta connection\";\n\n\t/**\n\t * Last known sequence number to ordering service at the time of connection\n\t * It may lap actual last sequence number (quite a bit, if container is very active).\n\t * But it's best information for client to figure out how far it is behind, at least\n\t * for \"read\" connections. \"write\" connections may use own \"join\" op to similar information,\n\t * that is likely to be more up-to-date.\n\t */\n\tpublic checkpointSequenceNumber: number | undefined;\n\n\t// Listen for ops sent before we receive a response to connect_document\n\tprotected readonly queuedMessages: ISequencedDocumentMessage[] = [];\n\tprotected readonly queuedSignals: ISignalMessage[] = [];\n\n\t/**\n\t * A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops\n\t * to later be retrieved via initialMessages.\n\t */\n\tprivate earlyOpHandlerAttached: boolean = false;\n\n\tprivate socketConnectionTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate _details: IConnected | undefined;\n\n\tprivate trackLatencyTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\t// Listeners only needed while the connection is in progress\n\tprivate readonly connectionListeners: Map<string, (...args: any[]) => void> = new Map();\n\t// Listeners used throughout the lifetime of the DocumentDeltaConnection\n\tprivate readonly trackedListeners: Map<string, (...args: any[]) => void> = new Map();\n\n\tprotected get hasDetails(): boolean {\n\t\treturn !!this._details;\n\t}\n\n\tpublic get disposed(): boolean {\n\t\tassert(\n\t\t\tthis._disposed || this.socket.connected,\n\t\t\t0x244 /* \"Socket is closed, but connection is not!\" */,\n\t\t);\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.\n\t * After disconnection, we flip this to prevent any stale messages from being emitted.\n\t */\n\tprotected _disposed: boolean = false;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * @deprecated Implementors should manage their own logger or monitoring context\n\t */\n\tprotected get logger(): ITelemetryLoggerExt {\n\t\treturn this.mc.logger;\n\t}\n\n\tpublic get details(): IConnected {\n\t\tif (!this._details) {\n\t\t\tthrow new Error(\"Internal error: calling method before _details is initialized!\");\n\t\t}\n\t\treturn this._details;\n\t}\n\n\t/**\n\t * @param socket - websocket to be used\n\t * @param documentId - ID of the document\n\t * @param logger - for reporting telemetry events\n\t * @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure\n\t */\n\tprotected constructor(\n\t\tprotected readonly socket: Socket,\n\t\tpublic documentId: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly enableLongPollingDowngrades: boolean = false,\n\t\tprotected readonly connectionId?: string,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.addPropsToError(error);\n\t\t\tlogger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaConnection:EventException\",\n\t\t\t\t\t// Coerce to string as past typings also allowed symbols and number, but\n\t\t\t\t\t// we want telemtry properties to be consistently string.\n\t\t\t\t\tname: String(name),\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\tthis.mc = createChildMonitoringContext({ logger, namespace: \"DeltaConnection\" });\n\n\t\tthis.on(\"newListener\", (event, _listener) => {\n\t\t\tassert(!this.disposed, 0x20a /* \"register for event on disposed object\" */);\n\n\t\t\t// Some events are already forwarded - see this.addTrackedListener() calls in initialize().\n\t\t\tif (DocumentDeltaConnection.eventsAlwaysForwarded.includes(event)) {\n\t\t\t\tassert(this.trackedListeners.has(event), 0x245 /* \"tracked listener\" */);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!DocumentDeltaConnection.eventsToForward.includes(event)) {\n\t\t\t\tthrow new Error(`DocumentDeltaConnection: Registering for unknown event: ${event}`);\n\t\t\t}\n\n\t\t\t// Whenever listener is added, we should subscribe on same event on socket, so these two things\n\t\t\t// should be in sync. This currently assumes that nobody unregisters and registers back listeners,\n\t\t\t// and that there are no \"internal\" listeners installed (like \"error\" case we skip above)\n\t\t\t// Better flow might be to always unconditionally register all handlers on successful connection,\n\t\t\t// though some logic (naming assert in initialMessages getter) might need to be adjusted (it becomes noop)\n\t\t\tassert(\n\t\t\t\t(this.listeners(event).length !== 0) === this.trackedListeners.has(event),\n\t\t\t\t0x20b /* \"mismatch\" */,\n\t\t\t);\n\t\t\tif (!this.trackedListeners.has(event)) {\n\t\t\t\tif (event === \"pong\") {\n\t\t\t\t\t// Empty callback for tracking purposes in this class\n\t\t\t\t\tthis.trackedListeners.set(\"pong\", () => {});\n\n\t\t\t\t\tconst sendPingLoop = (): void => {\n\t\t\t\t\t\tconst start = Date.now();\n\n\t\t\t\t\t\tthis.socket.volatile?.emit(\"ping\", () => {\n\t\t\t\t\t\t\tthis.emit(\"pong\", Date.now() - start);\n\n\t\t\t\t\t\t\t// Schedule another ping event in 1 minute\n\t\t\t\t\t\t\tthis.trackLatencyTimeout = setTimeout(() => {\n\t\t\t\t\t\t\t\tsendPingLoop();\n\t\t\t\t\t\t\t}, 1000 * 60);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tsendPingLoop();\n\t\t\t\t} else {\n\t\t\t\t\tthis.addTrackedListener(event, (...args: any[]) => {\n\t\t\t\t\t\tthis.emit(event, ...args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the ID of the client who is sending the message\n\t *\n\t * @returns the client ID\n\t */\n\tpublic get clientId(): string {\n\t\treturn this.details.clientId;\n\t}\n\n\t/**\n\t * Get the mode of the client\n\t *\n\t * @returns the client mode\n\t */\n\tpublic get mode(): ConnectionMode {\n\t\treturn this.details.mode;\n\t}\n\n\t/**\n\t * Get the claims of the client who is sending the message\n\t *\n\t * @returns client claims\n\t */\n\tpublic get claims(): ITokenClaims {\n\t\treturn this.details.claims;\n\t}\n\n\t/**\n\t * Get whether or not this is an existing document\n\t *\n\t * @returns true if the document exists\n\t */\n\tpublic get existing(): boolean {\n\t\treturn this.details.existing;\n\t}\n\n\t/**\n\t * Get the maximum size of a message before chunking is required\n\t *\n\t * @returns the maximum size of a message before chunking is required\n\t */\n\tpublic get maxMessageSize(): number {\n\t\treturn this.details.serviceConfiguration.maxMessageSize;\n\t}\n\n\t/**\n\t * Semver of protocol being used with the service\n\t */\n\tpublic get version(): string {\n\t\treturn this.details.version;\n\t}\n\n\t/**\n\t * Configuration details provided by the service\n\t */\n\tpublic get serviceConfiguration(): IClientConfiguration {\n\t\treturn this.details.serviceConfiguration;\n\t}\n\n\tprivate checkNotDisposed(): void {\n\t\tassert(!this.disposed, 0x20c /* \"connection disposed\" */);\n\t}\n\n\t/**\n\t * Get messages sent during the connection\n\t *\n\t * @returns messages sent during the connection\n\t */\n\tpublic get initialMessages(): ISequencedDocumentMessage[] {\n\t\tthis.checkNotDisposed();\n\n\t\t// If we call this when the earlyOpHandler is not attached, then the queuedMessages may not include the\n\t\t// latest ops. This could possibly indicate that initialMessages was called twice.\n\t\tassert(this.earlyOpHandlerAttached, 0x08e /* \"Potentially missed initial messages\" */);\n\t\t// We will lose ops and perf will tank as we need to go to storage to become current!\n\t\tassert(this.listeners(\"op\").length !== 0, 0x08f /* \"No op handler is setup!\" */);\n\n\t\tthis.removeEarlyOpHandler();\n\n\t\tif (this.queuedMessages.length > 0) {\n\t\t\t// Some messages were queued.\n\t\t\t// add them to the list of initialMessages to be processed\n\t\t\tthis.details.initialMessages.push(...this.queuedMessages);\n\t\t\tthis.details.initialMessages.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\t\tthis.queuedMessages.length = 0;\n\t\t}\n\t\treturn this.details.initialMessages;\n\t}\n\n\t/**\n\t * Get signals sent during the connection\n\t *\n\t * @returns signals sent during the connection\n\t */\n\tpublic get initialSignals(): ISignalMessage[] {\n\t\tthis.checkNotDisposed();\n\t\tassert(this.listeners(\"signal\").length !== 0, 0x090 /* \"No signal handler is setup!\" */);\n\n\t\tthis.removeEarlySignalHandler();\n\n\t\tif (this.queuedSignals.length > 0) {\n\t\t\t// Some signals were queued.\n\t\t\t// add them to the list of initialSignals to be processed\n\t\t\tthis.details.initialSignals.push(...this.queuedSignals);\n\t\t\tthis.queuedSignals.length = 0;\n\t\t}\n\t\treturn this.details.initialSignals;\n\t}\n\n\t/**\n\t * Get initial client list\n\t *\n\t * @returns initial client list sent during the connection\n\t */\n\tpublic get initialClients(): ISignalClient[] {\n\t\tthis.checkNotDisposed();\n\t\treturn this.details.initialClients;\n\t}\n\t/**\n\t * Emits 'submitOp' messages.\n\t * @param type - Must be 'submitOp'.\n\t * @param messages - An array of document messages to submit.\n\t */\n\tprotected emitMessages(type: \"submitOp\", messages: IDocumentMessage[][]): void;\n\n\t/**\n\t * Emits 'submitSignal' messages.\n\t *\n\t * **Note:** When using `ISentSignalMessage[]`, the service must support the `submit_signals_v2` feature.\n\t * @param type - Must be 'submitSignal'.\n\t * @param messages - An array of signals to submit. Can be either `string[][]` or `ISentSignalMessage[]`.\n\t */\n\tprotected emitMessages(\n\t\ttype: \"submitSignal\",\n\t\tmessages: string[][] | ISentSignalMessage[],\n\t): void;\n\tprotected emitMessages(type: string, messages: unknown): void {\n\t\t// Although the implementation here disconnects the socket and does not reuse it, other subclasses\n\t\t// (e.g. OdspDocumentDeltaConnection) may reuse the socket. In these cases, we need to avoid emitting\n\t\t// on the still-live socket.\n\t\tif (!this.disposed) {\n\t\t\tthis.socket.emit(type, this.clientId, messages);\n\t\t}\n\t}\n\n\t/**\n\t * Submits a new delta operation to the server\n\t *\n\t * @param message - delta operation to submit\n\t */\n\tpublic submit(messages: IDocumentMessage[]): void {\n\t\tthis.checkNotDisposed();\n\t\tthis.emitMessages(\"submitOp\", [messages]);\n\t}\n\n\t/**\n\t * Submits a new signal to the server\n\t *\n\t * @param content - Content of the signal.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t */\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\tthis.checkNotDisposed();\n\n\t\t// Check for server-side support of v2 signals\n\t\tif (this.details.supportedFeatures?.submit_signals_v2 === true) {\n\t\t\tconst signal: ISentSignalMessage = { content };\n\t\t\tif (targetClientId !== undefined) {\n\t\t\t\tsignal.targetClientId = targetClientId;\n\t\t\t}\n\t\t\tthis.emitMessages(\"submitSignal\", [signal]);\n\t\t} else if (targetClientId !== undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Sending signals to specific client ids is not supported with this service.\",\n\t\t\t);\n\t\t} else {\n\t\t\tthis.emitMessages(\"submitSignal\", [[content]]);\n\t\t}\n\t}\n\n\t/**\n\t * Disconnect from the websocket and close the websocket too.\n\t */\n\tprivate closeSocket(error: IAnyDriverError): void {\n\t\tif (this._disposed) {\n\t\t\t// This would be rare situation due to complexity around socket emitting events.\n\t\t\treturn;\n\t\t}\n\t\tthis.closeSocketCore(error);\n\t}\n\n\tprotected closeSocketCore(error: IAnyDriverError): void {\n\t\tthis.disconnect(error);\n\t}\n\n\t/**\n\t * Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.\n\t * However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no\n\t * multiplexing here, so we need to close the socket here.\n\t *\n\t * @param error - An optional error object. If provided, the connection will be closed with the specified error,\n\t * indicating an error-triggered disconnect. If not provided, the connection will be closed cleanly.\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ClientClosingDeltaConnection\",\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t});\n\t\tif (isFluidError(error)) {\n\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\tprops: { driverVersion },\n\t\t\t}) as IFluidErrorBase & {\n\t\t\t\tcanRetry: boolean;\n\t\t\t};\n\t\t\tthis.disconnect(fluidError);\n\t\t} else {\n\t\t\tthis.disconnect(\n\t\t\t\tcreateGenericNetworkError(\n\t\t\t\t\t// pre-0.58 error message: clientClosingConnection\n\t\t\t\t\terror?.message ?? DocumentDeltaConnection.errorMessageForClientDisposeWithoutError,\n\t\t\t\t\t{ canRetry: error === undefined },\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected readonly disconnect = (err: IAnyDriverError): void => {\n\t\t// Can't check this.disposed here, as we get here on socket closure,\n\t\t// so _disposed & socket.connected might be not in sync while processing\n\t\t// \"dispose\" event.\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.trackLatencyTimeout !== undefined) {\n\t\t\tclearTimeout(this.trackLatencyTimeout);\n\t\t\tthis.trackLatencyTimeout = undefined;\n\t\t}\n\n\t\t// We set the disposed flag as a part of the contract for overriding the disconnect method. This is used by\n\t\t// DocumentDeltaConnection to determine if emitting messages (ops) on the socket is allowed, which is\n\t\t// important since OdspDocumentDeltaConnection reuses the socket rather than truly disconnecting it. Note that\n\t\t// OdspDocumentDeltaConnection may still send disconnect_document which is allowed; this is only intended\n\t\t// to prevent normal messages from being emitted.\n\t\tthis._disposed = true;\n\n\t\t// Remove all listeners listening on the socket. These are listeners on socket and not on this connection\n\t\t// object. Anyway since we have disposed this connection object, nobody should listen to event on socket\n\t\t// anymore.\n\t\tthis.removeTrackedListeners();\n\n\t\t// Clear the connection/socket before letting the deltaManager/connection manager know about the disconnect.\n\t\tthis.disconnectCore(err);\n\n\t\t// Let user of connection object know about disconnect.\n\t\tthis.emit(\"disconnect\", err);\n\t};\n\n\t/**\n\t * Disconnect from the websocket.\n\t * @param reason - reason for disconnect\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tthis.socket.disconnect();\n\t}\n\n\tprotected async initialize(connectMessage: IConnect, timeout: number): Promise<void> {\n\t\tthis.socket.on(\"op\", this.earlyOpHandler);\n\t\tthis.socket.on(\"signal\", this.earlySignalHandler);\n\t\tthis.earlyOpHandlerAttached = true;\n\n\t\tconnectMessage.supportedFeatures = {\n\t\t\t...connectMessage.supportedFeatures,\n\t\t\t[feature_submit_signals_v2]: true,\n\t\t};\n\n\t\t// Socket.io's reconnect_attempt event is unreliable, so we track connect_error count instead.\n\t\tlet internalSocketConnectionFailureCount: number = 0;\n\t\tconst isInternalSocketReconnectionEnabled = (): boolean => this.socket.io.reconnection();\n\t\tconst getMaxInternalSocketReconnectionAttempts = (): number =>\n\t\t\tisInternalSocketReconnectionEnabled() ? this.socket.io.reconnectionAttempts() : 0;\n\t\tconst getMaxAllowedInternalSocketConnectionFailures = (): number =>\n\t\t\tgetMaxInternalSocketReconnectionAttempts() + 1;\n\n\t\tthis._details = await new Promise<IConnected>((resolve, reject) => {\n\t\t\tconst failAndCloseSocket = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.closeSocket(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"CloseSocketError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\tconst failConnection = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.disconnect(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"FailConnectionError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\t// Immediately set the connection timeout.\n\t\t\t// Give extra 2 seconds for handshake on top of socket connection timeout.\n\t\t\tthis.socketConnectionTimeout = setTimeout(() => {\n\t\t\t\tfailConnection(this.createErrorObject(\"orderingServiceHandshakeTimeout\"));\n\t\t\t}, timeout + 2000);\n\n\t\t\t// Listen for connection issues\n\t\t\tthis.addConnectionListener(\"connect_error\", (error) => {\n\t\t\t\tinternalSocketConnectionFailureCount++;\n\t\t\t\tlet isWebSocketTransportError = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst description = error?.description;\n\t\t\t\t\tconst context = error?.context;\n\n\t\t\t\t\tif (context && typeof context === \"object\") {\n\t\t\t\t\t\tconst statusText = context.statusText?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.context\n\t\t\t\t\t\tif (statusText === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (description && typeof description === \"object\") {\n\t\t\t\t\t\tconst errorCode = description.error?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.description\n\t\t\t\t\t\tif (errorCode === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (error.type === \"TransportError\") {\n\t\t\t\t\t\t\tisWebSocketTransportError = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// That's a WebSocket. Clear it as we can't log it.\n\t\t\t\t\t\tdescription.target = undefined;\n\t\t\t\t\t}\n\t\t\t\t} catch (_e) {\n\t\t\t\t\t// TODO: document why we are ignoring the error here\n\t\t\t\t}\n\n\t\t\t\t// Handle socket transport downgrading when not offline.\n\t\t\t\tif (\n\t\t\t\t\tisWebSocketTransportError &&\n\t\t\t\t\tthis.enableLongPollingDowngrades &&\n\t\t\t\t\tthis.socket.io.opts.transports?.[0] !== \"polling\"\n\t\t\t\t) {\n\t\t\t\t\t// Downgrade transports to polling upgrade mechanism.\n\t\t\t\t\tthis.socket.io.opts.transports = [\"polling\", \"websocket\"];\n\t\t\t\t\t// Don't alter reconnection behavior if already enabled.\n\t\t\t\t\tif (!isInternalSocketReconnectionEnabled()) {\n\t\t\t\t\t\t// Allow single reconnection attempt using polling upgrade mechanism.\n\t\t\t\t\t\tthis.socket.io.reconnection(true);\n\t\t\t\t\t\tthis.socket.io.reconnectionAttempts(1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Allow built-in socket.io reconnection handling.\n\t\t\t\tif (\n\t\t\t\t\tisInternalSocketReconnectionEnabled() &&\n\t\t\t\t\tinternalSocketConnectionFailureCount <\n\t\t\t\t\t\tgetMaxAllowedInternalSocketConnectionFailures()\n\t\t\t\t) {\n\t\t\t\t\t// Reconnection is enabled and maximum reconnect attempts have not been reached.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error));\n\t\t\t});\n\n\t\t\t// Listen for timeouts\n\t\t\tthis.addConnectionListener(\"connect_timeout\", () => {\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_timeout\"));\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_success\", (response: IConnected) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst requestedMode = connectMessage.mode;\n\t\t\t\tconst actualMode = response.mode;\n\t\t\t\tconst writingPermitted = response.claims.scopes.includes(ScopeType.DocWrite);\n\n\t\t\t\tif (writingPermitted) {\n\t\t\t\t\t// The only time we expect a mismatch in requested/actual is if we lack write permissions\n\t\t\t\t\t// In this case we will get \"read\", even if we requested \"write\"\n\t\t\t\t\tif (actualMode !== requestedMode) {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in a different mode than was requested\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (actualMode === \"write\") {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in write mode without write permissions\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ConnectDocumentSuccess\",\n\t\t\t\t\t\tpendingClientId: response.clientId,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tLogLevel.verbose,\n\t\t\t\t);\n\n\t\t\t\tthis.checkpointSequenceNumber = response.checkpointSequenceNumber;\n\n\t\t\t\tthis.removeConnectionListeners();\n\t\t\t\tresolve(response);\n\t\t\t});\n\n\t\t\t// Socket can be disconnected while waiting for Fluid protocol messages\n\t\t\t// (connect_document_error / connect_document_success), as well as before DeltaManager\n\t\t\t// had a chance to register its handlers.\n\t\t\tthis.addTrackedListener(\"disconnect\", (reason, details) => {\n\t\t\t\tfailAndCloseSocket(\n\t\t\t\t\tthis.createErrorObjectWithProps(\"disconnect\", reason, {\n\t\t\t\t\t\tsocketErrorType: details?.context?.type,\n\t\t\t\t\t\t// https://www.rfc-editor.org/rfc/rfc6455#section-7.4\n\t\t\t\t\t\tsocketCode: details?.context?.code,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tthis.addTrackedListener(\"error\", (error) => {\n\t\t\t\t// This includes \"Invalid namespace\" error, which we consider critical (reconnecting will not help)\n\t\t\t\tconst err = this.createErrorObject(\"error\", error, error !== \"Invalid namespace\");\n\t\t\t\t// Disconnect socket - required if happened before initial handshake\n\t\t\t\tfailAndCloseSocket(err);\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_error\", (error) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// This is not an socket.io error - it's Fluid protocol error.\n\t\t\t\t// In this case fail connection and indicate that we were unable to create connection\n\t\t\t\tfailConnection(this.createErrorObject(\"connect_document_error\", error));\n\t\t\t});\n\n\t\t\tthis.socket.emit(\"connect_document\", connectMessage);\n\t\t});\n\n\t\tassert(!this.disposed, 0x246 /* \"checking consistency of socket & _disposed flags\" */);\n\t}\n\n\tprivate addPropsToError(errorToBeNormalized: unknown): IFluidErrorBase {\n\t\tconst normalizedError = normalizeError(errorToBeNormalized, {\n\t\t\tprops: {\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t\treturn normalizedError;\n\t}\n\n\tprotected getConnectionDetailsProps(): {\n\t\tdisposed: boolean;\n\t\tsocketConnected: boolean | undefined;\n\t\tclientId: string | undefined;\n\t\tconnectionId: string | undefined;\n\t} {\n\t\treturn {\n\t\t\tdisposed: this._disposed,\n\t\t\tsocketConnected: this.socket?.connected,\n\t\t\tclientId: this._details?.clientId,\n\t\t\tconnectionId: this.connectionId,\n\t\t};\n\t}\n\n\tprotected earlyOpHandler = (documentId: string, msgs: ISequencedDocumentMessage[]): void => {\n\t\tthis.queuedMessages.push(...msgs);\n\t};\n\n\tprotected earlySignalHandler = (msg: ISignalMessage | ISignalMessage[]): void => {\n\t\tif (Array.isArray(msg)) {\n\t\t\tthis.queuedSignals.push(...msg);\n\t\t} else {\n\t\t\tthis.queuedSignals.push(msg);\n\t\t}\n\t};\n\n\tprivate removeEarlyOpHandler(): void {\n\t\tthis.socket.removeListener(\"op\", this.earlyOpHandler);\n\t\tthis.earlyOpHandlerAttached = false;\n\t}\n\n\tprivate removeEarlySignalHandler(): void {\n\t\tthis.socket.removeListener(\"signal\", this.earlySignalHandler);\n\t}\n\n\tprivate addConnectionListener(event: string, listener: (...args: any[]) => void): void {\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsAlwaysForwarded.includes(event),\n\t\t\t0x247 /* \"Use addTrackedListener instead\" */,\n\t\t);\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsToForward.includes(event),\n\t\t\t0x248 /* \"should not subscribe to forwarded events\" */,\n\t\t);\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.connectionListeners.has(event), 0x20d /* \"double connection listener\" */);\n\t\tthis.connectionListeners.set(event, listener);\n\t}\n\n\tprotected addTrackedListener(event: string, listener: (...args: any[]) => void): void {\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.trackedListeners.has(event), 0x20e /* \"double tracked listener\" */);\n\t\tthis.trackedListeners.set(event, listener);\n\t}\n\n\tprivate removeTrackedListeners(): void {\n\t\tfor (const [event, listener] of this.trackedListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\t// removeTrackedListeners removes all listeners, including connection listeners\n\t\tthis.removeConnectionListeners();\n\n\t\tthis.removeEarlyOpHandler();\n\t\tthis.removeEarlySignalHandler();\n\n\t\tthis.trackedListeners.clear();\n\t}\n\n\tprivate removeConnectionListeners(): void {\n\t\tif (this.socketConnectionTimeout !== undefined) {\n\t\t\tclearTimeout(this.socketConnectionTimeout);\n\t\t}\n\n\t\tfor (const [event, listener] of this.connectionListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\tthis.connectionListeners.clear();\n\t}\n\n\tprivate getErrorMessage(error?: any): string {\n\t\tif (error?.type !== \"TransportError\") {\n\t\t\treturn extractLogSafeErrorProperties(error, true).message;\n\t\t}\n\t\t// JSON.stringify drops Error.message\n\t\tconst messagePrefix = error?.message !== undefined ? `${error.message}: ` : \"\";\n\n\t\t// Websocket errors reported by engine.io-client.\n\t\t// They are Error objects with description containing WS error and description = \"TransportError\"\n\t\t// Please see https://github.com/socketio/engine.io-client/blob/7245b80/lib/transport.ts#L44,\n\t\treturn `${messagePrefix}${JSON.stringify(error, getCircularReplacer())}`;\n\t}\n\n\tprivate createErrorObjectWithProps(\n\t\thandler: string,\n\t\terror?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t\tcanRetry = true,\n\t): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\t{\n\t\t\t\t...props,\n\t\t\t\tdriverVersion,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t\tscenarioName: handler,\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\tthis.getAdditionalErrorProps(handler),\n\t\t);\n\t}\n\n\tprotected getAdditionalErrorProps(handler: string): DriverErrorTelemetryProps {\n\t\treturn {\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t\tscenarioName: handler,\n\t\t};\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"documentDeltaConnection.js","sourceRoot":"","sources":["../src/documentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAGN,QAAQ,GACR,MAAM,iCAAiC,CAAC;AACzC,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAE7D,OAAO,EAWN,SAAS,GAGT,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,UAAU,EACV,yBAAyB,GAEzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAEN,6BAA6B,EAE7B,4BAA4B,EAC5B,6BAA6B,EAC7B,mBAAmB,EACnB,YAAY,EACZ,cAAc,GAEd,MAAM,0CAA0C,CAAC;AAGlD,sFAAsF;AACtF,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAElE,MAAM,yBAAyB,GAAG,mBAAmB,CAAC;AAEtD;;;GAGG;AACH,MAAM,OAAO,uBACZ,SAAQ,6BAA6D;IA4CrE,IAAc,UAAU;QACvB,OAAO,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC;IACxB,CAAC;IAED,IAAW,QAAQ;QAClB,MAAM,CACL,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,MAAM,CAAC,SAAS,EACvC,KAAK,CAAC,gDAAgD,CACtD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IASD;;;;OAIG;IACH,IAAc,MAAM;QACnB,OAAO,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC;IACvB,CAAC;IAED,IAAW,OAAO;QACjB,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,CAAC;YACpB,MAAM,IAAI,KAAK,CAAC,gEAAgE,CAAC,CAAC;QACnF,CAAC;QACD,OAAO,IAAI,CAAC,QAAQ,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C,AAA1B,CAA2B;AAEhE;;GAEG;AACa,gEAAwC,GAAG,iCAAiC,AAApC,CAAqC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tIDisposable,\n\tITelemetryBaseProperties,\n\tLogLevel,\n} from \"@fluidframework/core-interfaces\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { ConnectionMode } from \"@fluidframework/driver-definitions\";\nimport {\n\tIAnyDriverError,\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaConnectionEvents,\n\tIClientConfiguration,\n\tIConnect,\n\tIConnected,\n\tIDocumentMessage,\n\ttype ISentSignalMessage,\n\tISignalClient,\n\tITokenClaims,\n\tScopeType,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tUsageError,\n\tcreateGenericNetworkError,\n\ttype DriverErrorTelemetryProps,\n} from \"@fluidframework/driver-utils/internal\";\nimport {\n\tITelemetryLoggerExt,\n\tEventEmitterWithErrorHandling,\n\tMonitoringContext,\n\tcreateChildMonitoringContext,\n\textractLogSafeErrorProperties,\n\tgetCircularReplacer,\n\tisFluidError,\n\tnormalizeError,\n\ttype IFluidErrorBase,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\n\n// For now, this package is versioned and released in unison with the specific drivers\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\n\nconst feature_submit_signals_v2 = \"submit_signals_v2\";\n\n/**\n * Represents a connection to a stream of delta updates.\n * @internal\n */\nexport class DocumentDeltaConnection\n\textends EventEmitterWithErrorHandling<IDocumentDeltaConnectionEvents>\n\timplements IDocumentDeltaConnection, IDisposable\n{\n\tstatic readonly eventsToForward = [\"nack\", \"op\", \"signal\", \"pong\"];\n\n\t// WARNING: These are critical events that we can't miss, so registration for them has to be in place at all times!\n\t// Including before handshake is over, and after that (but before DeltaManager had a chance to put its own handlers)\n\tstatic readonly eventsAlwaysForwarded = [\"disconnect\", \"error\"];\n\n\t/**\n\t * Error message used when client is closing the delta connection cleanly.\n\t */\n\tstatic readonly errorMessageForClientDisposeWithoutError = \"Client closing delta connection\";\n\n\t/**\n\t * Last known sequence number to ordering service at the time of connection\n\t * It may lap actual last sequence number (quite a bit, if container is very active).\n\t * But it's best information for client to figure out how far it is behind, at least\n\t * for \"read\" connections. \"write\" connections may use own \"join\" op to similar information,\n\t * that is likely to be more up-to-date.\n\t */\n\tpublic checkpointSequenceNumber: number | undefined;\n\n\t// Listen for ops sent before we receive a response to connect_document\n\tprotected readonly queuedMessages: ISequencedDocumentMessage[] = [];\n\tprotected readonly queuedSignals: ISignalMessage[] = [];\n\n\t/**\n\t * A flag to indicate whether we have our handler attached. If it's attached, we're queueing incoming ops\n\t * to later be retrieved via initialMessages.\n\t */\n\tprivate earlyOpHandlerAttached: boolean = false;\n\n\tprivate socketConnectionTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate _details: IConnected | undefined;\n\n\tprivate trackLatencyTimeout: ReturnType<typeof setTimeout> | undefined;\n\n\t// Listeners only needed while the connection is in progress\n\tprivate readonly connectionListeners: Map<string, (...args: any[]) => void> = new Map();\n\t// Listeners used throughout the lifetime of the DocumentDeltaConnection\n\tprivate readonly trackedListeners: Map<string, (...args: any[]) => void> = new Map();\n\n\tprotected get hasDetails(): boolean {\n\t\treturn !!this._details;\n\t}\n\n\tpublic get disposed(): boolean {\n\t\tassert(\n\t\t\tthis._disposed || this.socket.connected,\n\t\t\t0x244 /* \"Socket is closed, but connection is not!\" */,\n\t\t);\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Flag to indicate whether the DocumentDeltaConnection is expected to still be capable of sending messages.\n\t * After disconnection, we flip this to prevent any stale messages from being emitted.\n\t */\n\tprotected _disposed: boolean = false;\n\tprivate readonly mc: MonitoringContext;\n\n\t/**\n\t * Gets the logger from the monitoring context.\n\t *\n\t * @deprecated Implementors should manage their own logger or monitoring context\n\t */\n\tprotected get logger(): ITelemetryLoggerExt {\n\t\treturn this.mc.logger;\n\t}\n\n\tpublic get details(): IConnected {\n\t\tif (!this._details) {\n\t\t\tthrow new Error(\"Internal error: calling method before _details is initialized!\");\n\t\t}\n\t\treturn this._details;\n\t}\n\n\t/**\n\t * @param socket - websocket to be used\n\t * @param documentId - ID of the document\n\t * @param logger - for reporting telemetry events\n\t * @param enableLongPollingDowngrades - allow connection to be downgraded to long-polling on websocket failure\n\t */\n\tprotected constructor(\n\t\tprotected readonly socket: Socket,\n\t\tpublic documentId: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly enableLongPollingDowngrades: boolean = false,\n\t\tprotected readonly connectionId?: string,\n\t) {\n\t\tsuper((name, error) => {\n\t\t\tthis.addPropsToError(error);\n\t\t\tlogger.sendErrorEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DeltaConnection:EventException\",\n\t\t\t\t\t// Coerce to string as past typings also allowed symbols and number, but\n\t\t\t\t\t// we want telemtry properties to be consistently string.\n\t\t\t\t\tname: String(name),\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t});\n\n\t\tthis.mc = createChildMonitoringContext({ logger, namespace: \"DeltaConnection\" });\n\n\t\tthis.on(\"newListener\", (event, _listener) => {\n\t\t\tassert(!this.disposed, 0x20a /* \"register for event on disposed object\" */);\n\n\t\t\t// Some events are already forwarded - see this.addTrackedListener() calls in initialize().\n\t\t\tif (DocumentDeltaConnection.eventsAlwaysForwarded.includes(event)) {\n\t\t\t\tassert(this.trackedListeners.has(event), 0x245 /* \"tracked listener\" */);\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tif (!DocumentDeltaConnection.eventsToForward.includes(event)) {\n\t\t\t\tthrow new Error(`DocumentDeltaConnection: Registering for unknown event: ${event}`);\n\t\t\t}\n\n\t\t\t// Whenever listener is added, we should subscribe on same event on socket, so these two things\n\t\t\t// should be in sync. This currently assumes that nobody unregisters and registers back listeners,\n\t\t\t// and that there are no \"internal\" listeners installed (like \"error\" case we skip above)\n\t\t\t// Better flow might be to always unconditionally register all handlers on successful connection,\n\t\t\t// though some logic (naming assert in initialMessages getter) might need to be adjusted (it becomes noop)\n\t\t\tassert(\n\t\t\t\t(this.listeners(event).length !== 0) === this.trackedListeners.has(event),\n\t\t\t\t0x20b /* \"mismatch\" */,\n\t\t\t);\n\t\t\tif (!this.trackedListeners.has(event)) {\n\t\t\t\tif (event === \"pong\") {\n\t\t\t\t\t// Empty callback for tracking purposes in this class\n\t\t\t\t\tthis.trackedListeners.set(\"pong\", () => {});\n\n\t\t\t\t\tconst sendPingLoop = (): void => {\n\t\t\t\t\t\tconst start = Date.now();\n\n\t\t\t\t\t\tthis.socket.volatile?.emit(\"ping\", () => {\n\t\t\t\t\t\t\tthis.emit(\"pong\", Date.now() - start);\n\n\t\t\t\t\t\t\t// Schedule another ping event in 1 minute\n\t\t\t\t\t\t\tthis.trackLatencyTimeout = setTimeout(() => {\n\t\t\t\t\t\t\t\tsendPingLoop();\n\t\t\t\t\t\t\t}, 1000 * 60);\n\t\t\t\t\t\t});\n\t\t\t\t\t};\n\n\t\t\t\t\tsendPingLoop();\n\t\t\t\t} else {\n\t\t\t\t\tthis.addTrackedListener(event, (...args: any[]) => {\n\t\t\t\t\t\tthis.emit(event, ...args);\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\t}\n\n\t/**\n\t * Get the ID of the client who is sending the message\n\t *\n\t * @returns the client ID\n\t */\n\tpublic get clientId(): string {\n\t\treturn this.details.clientId;\n\t}\n\n\t/**\n\t * Get the mode of the client\n\t *\n\t * @returns the client mode\n\t */\n\tpublic get mode(): ConnectionMode {\n\t\treturn this.details.mode;\n\t}\n\n\t/**\n\t * Get the claims of the client who is sending the message\n\t *\n\t * @returns client claims\n\t */\n\tpublic get claims(): ITokenClaims {\n\t\treturn this.details.claims;\n\t}\n\n\t/**\n\t * Get whether or not this is an existing document\n\t *\n\t * @returns true if the document exists\n\t */\n\tpublic get existing(): boolean {\n\t\treturn this.details.existing;\n\t}\n\n\t/**\n\t * Get the maximum size of a message before chunking is required\n\t *\n\t * @returns the maximum size of a message before chunking is required\n\t */\n\tpublic get maxMessageSize(): number {\n\t\treturn this.details.serviceConfiguration.maxMessageSize;\n\t}\n\n\t/**\n\t * Semver of protocol being used with the service\n\t */\n\tpublic get version(): string {\n\t\treturn this.details.version;\n\t}\n\n\t/**\n\t * Configuration details provided by the service\n\t */\n\tpublic get serviceConfiguration(): IClientConfiguration {\n\t\treturn this.details.serviceConfiguration;\n\t}\n\n\tprivate checkNotDisposed(): void {\n\t\tassert(!this.disposed, 0x20c /* \"connection disposed\" */);\n\t}\n\n\t/**\n\t * Get messages sent during the connection\n\t *\n\t * @returns messages sent during the connection\n\t */\n\tpublic get initialMessages(): ISequencedDocumentMessage[] {\n\t\tthis.checkNotDisposed();\n\n\t\t// If we call this when the earlyOpHandler is not attached, then the queuedMessages may not include the\n\t\t// latest ops. This could possibly indicate that initialMessages was called twice.\n\t\tassert(this.earlyOpHandlerAttached, 0x08e /* \"Potentially missed initial messages\" */);\n\t\t// We will lose ops and perf will tank as we need to go to storage to become current!\n\t\tassert(this.listeners(\"op\").length !== 0, 0x08f /* \"No op handler is setup!\" */);\n\n\t\tthis.removeEarlyOpHandler();\n\n\t\tif (this.queuedMessages.length > 0) {\n\t\t\t// Some messages were queued.\n\t\t\t// add them to the list of initialMessages to be processed\n\t\t\tthis.details.initialMessages.push(...this.queuedMessages);\n\t\t\tthis.details.initialMessages.sort((a, b) => a.sequenceNumber - b.sequenceNumber);\n\t\t\tthis.queuedMessages.length = 0;\n\t\t}\n\t\treturn this.details.initialMessages;\n\t}\n\n\t/**\n\t * Get signals sent during the connection\n\t *\n\t * @returns signals sent during the connection\n\t */\n\tpublic get initialSignals(): ISignalMessage[] {\n\t\tthis.checkNotDisposed();\n\t\tassert(this.listeners(\"signal\").length !== 0, 0x090 /* \"No signal handler is setup!\" */);\n\n\t\tthis.removeEarlySignalHandler();\n\n\t\tif (this.queuedSignals.length > 0) {\n\t\t\t// Some signals were queued.\n\t\t\t// add them to the list of initialSignals to be processed\n\t\t\tthis.details.initialSignals.push(...this.queuedSignals);\n\t\t\tthis.queuedSignals.length = 0;\n\t\t}\n\t\treturn this.details.initialSignals;\n\t}\n\n\t/**\n\t * Get initial client list\n\t *\n\t * @returns initial client list sent during the connection\n\t */\n\tpublic get initialClients(): ISignalClient[] {\n\t\tthis.checkNotDisposed();\n\t\treturn this.details.initialClients;\n\t}\n\t/**\n\t * Emits 'submitOp' messages.\n\t * @param type - Must be 'submitOp'.\n\t * @param messages - An array of document messages to submit.\n\t */\n\tprotected emitMessages(type: \"submitOp\", messages: IDocumentMessage[][]): void;\n\n\t/**\n\t * Emits 'submitSignal' messages.\n\t *\n\t * **Note:** When using `ISentSignalMessage[]`, the service must support the `submit_signals_v2` feature.\n\t * @param type - Must be 'submitSignal'.\n\t * @param messages - An array of signals to submit. Can be either `string[][]` or `ISentSignalMessage[]`.\n\t */\n\tprotected emitMessages(\n\t\ttype: \"submitSignal\",\n\t\tmessages: string[][] | ISentSignalMessage[],\n\t): void;\n\tprotected emitMessages(type: string, messages: unknown): void {\n\t\t// Although the implementation here disconnects the socket and does not reuse it, other subclasses\n\t\t// (e.g. OdspDocumentDeltaConnection) may reuse the socket. In these cases, we need to avoid emitting\n\t\t// on the still-live socket.\n\t\tif (!this.disposed) {\n\t\t\tthis.socket.emit(type, this.clientId, messages);\n\t\t}\n\t}\n\n\t/**\n\t * Submits a new delta operation to the server\n\t *\n\t * @param message - delta operation to submit\n\t */\n\tpublic submit(messages: IDocumentMessage[]): void {\n\t\tthis.checkNotDisposed();\n\t\tthis.emitMessages(\"submitOp\", [messages]);\n\t}\n\n\t/**\n\t * Submits a new signal to the server\n\t *\n\t * @param content - Content of the signal.\n\t * @param targetClientId - When specified, the signal is only sent to the provided client id.\n\t */\n\tpublic submitSignal(content: string, targetClientId?: string): void {\n\t\tthis.checkNotDisposed();\n\n\t\t// Check for server-side support of v2 signals\n\t\tif (this.details.supportedFeatures?.submit_signals_v2 === true) {\n\t\t\tconst signal: ISentSignalMessage = { content };\n\t\t\tif (targetClientId !== undefined) {\n\t\t\t\tsignal.targetClientId = targetClientId;\n\t\t\t}\n\t\t\tthis.emitMessages(\"submitSignal\", [signal]);\n\t\t} else if (targetClientId !== undefined) {\n\t\t\tthrow new UsageError(\n\t\t\t\t\"Sending signals to specific client ids is not supported with this service.\",\n\t\t\t);\n\t\t} else {\n\t\t\tthis.emitMessages(\"submitSignal\", [[content]]);\n\t\t}\n\t}\n\n\t/**\n\t * Disconnect from the websocket and close the websocket too.\n\t */\n\tprivate closeSocket(error: IAnyDriverError): void {\n\t\tif (this._disposed) {\n\t\t\t// This would be rare situation due to complexity around socket emitting events.\n\t\t\treturn;\n\t\t}\n\t\tthis.closeSocketCore(error);\n\t}\n\n\tprotected closeSocketCore(error: IAnyDriverError): void {\n\t\tthis.disconnect(error);\n\t}\n\n\t/**\n\t * Disconnect from the websocket, and permanently disable this DocumentDeltaConnection and close the socket.\n\t * However the OdspDocumentDeltaConnection differ in dispose as in there we don't close the socket. There is no\n\t * multiplexing here, so we need to close the socket here.\n\t *\n\t * @param error - An optional error object. If provided, the connection will be closed with the specified error,\n\t * indicating an error-triggered disconnect. If not provided, the connection will be closed cleanly.\n\t */\n\tpublic dispose(error?: Error): void {\n\t\tthis.logger.sendTelemetryEvent({\n\t\t\teventName: \"ClientClosingDeltaConnection\",\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t});\n\t\tif (isFluidError(error)) {\n\t\t\tconst fluidError = normalizeError(error, {\n\t\t\t\tprops: { driverVersion },\n\t\t\t}) as IFluidErrorBase & {\n\t\t\t\tcanRetry: boolean;\n\t\t\t};\n\t\t\tthis.disconnect(fluidError);\n\t\t} else {\n\t\t\tthis.disconnect(\n\t\t\t\tcreateGenericNetworkError(\n\t\t\t\t\t// pre-0.58 error message: clientClosingConnection\n\t\t\t\t\terror?.message ?? DocumentDeltaConnection.errorMessageForClientDisposeWithoutError,\n\t\t\t\t\t{ canRetry: error === undefined },\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t),\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected readonly disconnect = (err: IAnyDriverError): void => {\n\t\t// Can't check this.disposed here, as we get here on socket closure,\n\t\t// so _disposed & socket.connected might be not in sync while processing\n\t\t// \"dispose\" event.\n\t\tif (this._disposed) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.trackLatencyTimeout !== undefined) {\n\t\t\tclearTimeout(this.trackLatencyTimeout);\n\t\t\tthis.trackLatencyTimeout = undefined;\n\t\t}\n\n\t\t// We set the disposed flag as a part of the contract for overriding the disconnect method. This is used by\n\t\t// DocumentDeltaConnection to determine if emitting messages (ops) on the socket is allowed, which is\n\t\t// important since OdspDocumentDeltaConnection reuses the socket rather than truly disconnecting it. Note that\n\t\t// OdspDocumentDeltaConnection may still send disconnect_document which is allowed; this is only intended\n\t\t// to prevent normal messages from being emitted.\n\t\tthis._disposed = true;\n\n\t\t// Remove all listeners listening on the socket. These are listeners on socket and not on this connection\n\t\t// object. Anyway since we have disposed this connection object, nobody should listen to event on socket\n\t\t// anymore.\n\t\tthis.removeTrackedListeners();\n\n\t\t// Clear the connection/socket before letting the deltaManager/connection manager know about the disconnect.\n\t\tthis.disconnectCore(err);\n\n\t\t// Let user of connection object know about disconnect.\n\t\tthis.emit(\"disconnect\", err);\n\t};\n\n\t/**\n\t * Disconnect from the websocket.\n\t * @param reason - reason for disconnect\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tthis.socket.disconnect();\n\t}\n\n\tprotected async initialize(connectMessage: IConnect, timeout: number): Promise<void> {\n\t\tthis.socket.on(\"op\", this.earlyOpHandler);\n\t\tthis.socket.on(\"signal\", this.earlySignalHandler);\n\t\tthis.earlyOpHandlerAttached = true;\n\n\t\tconnectMessage.supportedFeatures = {\n\t\t\t...connectMessage.supportedFeatures,\n\t\t\t[feature_submit_signals_v2]: true,\n\t\t};\n\n\t\t// Socket.io's reconnect_attempt event is unreliable, so we track connect_error count instead.\n\t\tlet internalSocketConnectionFailureCount: number = 0;\n\t\tconst isInternalSocketReconnectionEnabled = (): boolean => this.socket.io.reconnection();\n\t\tconst getMaxInternalSocketReconnectionAttempts = (): number =>\n\t\t\tisInternalSocketReconnectionEnabled() ? this.socket.io.reconnectionAttempts() : 0;\n\t\tconst getMaxAllowedInternalSocketConnectionFailures = (): number =>\n\t\t\tgetMaxInternalSocketReconnectionAttempts() + 1;\n\n\t\tthis._details = await new Promise<IConnected>((resolve, reject) => {\n\t\t\tconst failAndCloseSocket = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.closeSocket(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"CloseSocketError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\tconst failConnection = (err: IAnyDriverError): void => {\n\t\t\t\ttry {\n\t\t\t\t\tthis.disconnect(err);\n\t\t\t\t} catch (failError) {\n\t\t\t\t\tconst normalizedError = this.addPropsToError(failError);\n\t\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"FailConnectionError\" }, normalizedError);\n\t\t\t\t}\n\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\treject(err);\n\t\t\t};\n\n\t\t\t// Immediately set the connection timeout.\n\t\t\t// Give extra 2 seconds for handshake on top of socket connection timeout.\n\t\t\tthis.socketConnectionTimeout = setTimeout(() => {\n\t\t\t\tfailConnection(this.createErrorObject(\"orderingServiceHandshakeTimeout\"));\n\t\t\t}, timeout + 2000);\n\n\t\t\t// Listen for connection issues\n\t\t\tthis.addConnectionListener(\"connect_error\", (error) => {\n\t\t\t\tinternalSocketConnectionFailureCount++;\n\t\t\t\tlet isWebSocketTransportError = false;\n\t\t\t\ttry {\n\t\t\t\t\tconst description = error?.description;\n\t\t\t\t\tconst context = error?.context;\n\n\t\t\t\t\tif (context && typeof context === \"object\") {\n\t\t\t\t\t\tconst statusText = context.statusText?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.context\n\t\t\t\t\t\tif (statusText === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if (description && typeof description === \"object\") {\n\t\t\t\t\t\tconst errorCode = description.error?.code;\n\n\t\t\t\t\t\t// Self-Signed Certificate ErrorCode Found in error.description\n\t\t\t\t\t\tif (errorCode === \"DEPTH_ZERO_SELF_SIGNED_CERT\") {\n\t\t\t\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error, false));\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tif (error.type === \"TransportError\") {\n\t\t\t\t\t\t\tisWebSocketTransportError = true;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t// That's a WebSocket. Clear it as we can't log it.\n\t\t\t\t\t\tdescription.target = undefined;\n\t\t\t\t\t}\n\t\t\t\t} catch (_e) {\n\t\t\t\t\t// TODO: document why we are ignoring the error here\n\t\t\t\t}\n\n\t\t\t\t// Handle socket transport downgrading when not offline.\n\t\t\t\tif (\n\t\t\t\t\tisWebSocketTransportError &&\n\t\t\t\t\tthis.enableLongPollingDowngrades &&\n\t\t\t\t\tthis.socket.io.opts.transports?.[0] !== \"polling\"\n\t\t\t\t) {\n\t\t\t\t\t// Downgrade transports to polling upgrade mechanism.\n\t\t\t\t\tthis.socket.io.opts.transports = [\"polling\", \"websocket\"];\n\t\t\t\t\t// Don't alter reconnection behavior if already enabled.\n\t\t\t\t\tif (!isInternalSocketReconnectionEnabled()) {\n\t\t\t\t\t\t// Allow single reconnection attempt using polling upgrade mechanism.\n\t\t\t\t\t\tthis.socket.io.reconnection(true);\n\t\t\t\t\t\tthis.socket.io.reconnectionAttempts(1);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\t// Allow built-in socket.io reconnection handling.\n\t\t\t\tif (\n\t\t\t\t\tisInternalSocketReconnectionEnabled() &&\n\t\t\t\t\tinternalSocketConnectionFailureCount <\n\t\t\t\t\t\tgetMaxAllowedInternalSocketConnectionFailures()\n\t\t\t\t) {\n\t\t\t\t\t// Reconnection is enabled and maximum reconnect attempts have not been reached.\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_error\", error));\n\t\t\t});\n\n\t\t\t// Listen for timeouts\n\t\t\tthis.addConnectionListener(\"connect_timeout\", () => {\n\t\t\t\tfailAndCloseSocket(this.createErrorObject(\"connect_timeout\"));\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_success\", (response: IConnected) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== undefined &&\n\t\t\t\t\tresponse.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\tconst requestedMode = connectMessage.mode;\n\t\t\t\tconst actualMode = response.mode;\n\t\t\t\tconst writingPermitted = response.claims.scopes.includes(ScopeType.DocWrite);\n\n\t\t\t\tif (writingPermitted) {\n\t\t\t\t\t// The only time we expect a mismatch in requested/actual is if we lack write permissions\n\t\t\t\t\t// In this case we will get \"read\", even if we requested \"write\"\n\t\t\t\t\tif (actualMode !== requestedMode) {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in a different mode than was requested\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t} else {\n\t\t\t\t\tif (actualMode === \"write\") {\n\t\t\t\t\t\tfailConnection(\n\t\t\t\t\t\t\tthis.createErrorObject(\n\t\t\t\t\t\t\t\t\"connect_document_success\",\n\t\t\t\t\t\t\t\t\"Connected in write mode without write permissions\",\n\t\t\t\t\t\t\t\tfalse,\n\t\t\t\t\t\t\t),\n\t\t\t\t\t\t);\n\t\t\t\t\t\treturn;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: \"ConnectDocumentSuccess\",\n\t\t\t\t\t\tpendingClientId: response.clientId,\n\t\t\t\t\t},\n\t\t\t\t\tundefined,\n\t\t\t\t\tLogLevel.verbose,\n\t\t\t\t);\n\n\t\t\t\tthis.checkpointSequenceNumber = response.checkpointSequenceNumber;\n\n\t\t\t\tthis.removeConnectionListeners();\n\t\t\t\tresolve(response);\n\t\t\t});\n\n\t\t\t// Socket can be disconnected while waiting for Fluid protocol messages\n\t\t\t// (connect_document_error / connect_document_success), as well as before DeltaManager\n\t\t\t// had a chance to register its handlers.\n\t\t\tthis.addTrackedListener(\"disconnect\", (reason, details) => {\n\t\t\t\tfailAndCloseSocket(\n\t\t\t\t\tthis.createErrorObjectWithProps(\"disconnect\", reason, {\n\t\t\t\t\t\tsocketErrorType: details?.context?.type,\n\t\t\t\t\t\t// https://www.rfc-editor.org/rfc/rfc6455#section-7.4\n\t\t\t\t\t\tsocketCode: details?.context?.code,\n\t\t\t\t\t}),\n\t\t\t\t);\n\t\t\t});\n\n\t\t\tthis.addTrackedListener(\"error\", (error) => {\n\t\t\t\t// This includes \"Invalid namespace\" error, which we consider critical (reconnecting will not help)\n\t\t\t\tconst err = this.createErrorObject(\"error\", error, error !== \"Invalid namespace\");\n\t\t\t\t// Disconnect socket - required if happened before initial handshake\n\t\t\t\tfailAndCloseSocket(err);\n\t\t\t});\n\n\t\t\tthis.addConnectionListener(\"connect_document_error\", (error) => {\n\t\t\t\t// If we sent a nonce and the server supports nonces, check that the nonces match\n\t\t\t\tif (\n\t\t\t\t\tconnectMessage.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== undefined &&\n\t\t\t\t\terror.nonce !== connectMessage.nonce\n\t\t\t\t) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\n\t\t\t\t// This is not an socket.io error - it's Fluid protocol error.\n\t\t\t\t// In this case fail connection and indicate that we were unable to create connection\n\t\t\t\tfailConnection(this.createErrorObject(\"connect_document_error\", error));\n\t\t\t});\n\n\t\t\tthis.socket.emit(\"connect_document\", connectMessage);\n\t\t});\n\n\t\tassert(!this.disposed, 0x246 /* \"checking consistency of socket & _disposed flags\" */);\n\t}\n\n\tprivate addPropsToError(errorToBeNormalized: unknown): IFluidErrorBase {\n\t\tconst normalizedError = normalizeError(errorToBeNormalized, {\n\t\t\tprops: {\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t},\n\t\t});\n\t\treturn normalizedError;\n\t}\n\n\tprotected getConnectionDetailsProps(): {\n\t\tdisposed: boolean;\n\t\tsocketConnected: boolean | undefined;\n\t\tclientId: string | undefined;\n\t\tconnectionId: string | undefined;\n\t} {\n\t\treturn {\n\t\t\tdisposed: this._disposed,\n\t\t\tsocketConnected: this.socket?.connected,\n\t\t\tclientId: this._details?.clientId,\n\t\t\tconnectionId: this.connectionId,\n\t\t};\n\t}\n\n\tprotected earlyOpHandler = (documentId: string, msgs: ISequencedDocumentMessage[]): void => {\n\t\tthis.queuedMessages.push(...msgs);\n\t};\n\n\tprotected earlySignalHandler = (msg: ISignalMessage | ISignalMessage[]): void => {\n\t\tif (Array.isArray(msg)) {\n\t\t\tthis.queuedSignals.push(...msg);\n\t\t} else {\n\t\t\tthis.queuedSignals.push(msg);\n\t\t}\n\t};\n\n\tprivate removeEarlyOpHandler(): void {\n\t\tthis.socket.removeListener(\"op\", this.earlyOpHandler);\n\t\tthis.earlyOpHandlerAttached = false;\n\t}\n\n\tprivate removeEarlySignalHandler(): void {\n\t\tthis.socket.removeListener(\"signal\", this.earlySignalHandler);\n\t}\n\n\tprivate addConnectionListener(event: string, listener: (...args: any[]) => void): void {\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsAlwaysForwarded.includes(event),\n\t\t\t0x247 /* \"Use addTrackedListener instead\" */,\n\t\t);\n\t\tassert(\n\t\t\t!DocumentDeltaConnection.eventsToForward.includes(event),\n\t\t\t0x248 /* \"should not subscribe to forwarded events\" */,\n\t\t);\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.connectionListeners.has(event), 0x20d /* \"double connection listener\" */);\n\t\tthis.connectionListeners.set(event, listener);\n\t}\n\n\tprotected addTrackedListener(event: string, listener: (...args: any[]) => void): void {\n\t\tthis.socket.on(event, listener);\n\t\tassert(!this.trackedListeners.has(event), 0x20e /* \"double tracked listener\" */);\n\t\tthis.trackedListeners.set(event, listener);\n\t}\n\n\tprivate removeTrackedListeners(): void {\n\t\tfor (const [event, listener] of this.trackedListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\t// removeTrackedListeners removes all listeners, including connection listeners\n\t\tthis.removeConnectionListeners();\n\n\t\tthis.removeEarlyOpHandler();\n\t\tthis.removeEarlySignalHandler();\n\n\t\tthis.trackedListeners.clear();\n\t}\n\n\tprivate removeConnectionListeners(): void {\n\t\tif (this.socketConnectionTimeout !== undefined) {\n\t\t\tclearTimeout(this.socketConnectionTimeout);\n\t\t}\n\n\t\tfor (const [event, listener] of this.connectionListeners.entries()) {\n\t\t\tthis.socket.off(event, listener);\n\t\t}\n\t\tthis.connectionListeners.clear();\n\t}\n\n\tprivate getErrorMessage(error?: any): string {\n\t\tif (error?.type !== \"TransportError\") {\n\t\t\treturn extractLogSafeErrorProperties(error, true).message;\n\t\t}\n\t\t// JSON.stringify drops Error.message\n\t\tconst messagePrefix = error?.message !== undefined ? `${error.message}: ` : \"\";\n\n\t\t// Websocket errors reported by engine.io-client.\n\t\t// They are Error objects with description containing WS error and description = \"TransportError\"\n\t\t// Please see https://github.com/socketio/engine.io-client/blob/7245b80/lib/transport.ts#L44,\n\t\treturn `${messagePrefix}${JSON.stringify(error, getCircularReplacer())}`;\n\t}\n\n\tprivate createErrorObjectWithProps(\n\t\thandler: string,\n\t\terror?: any,\n\t\tprops?: ITelemetryBaseProperties,\n\t\tcanRetry = true,\n\t): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\t{\n\t\t\t\t...props,\n\t\t\t\tdriverVersion,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t}),\n\t\t\t\tscenarioName: handler,\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(handler: string, error?: any, canRetry = true): IAnyDriverError {\n\t\treturn createGenericNetworkError(\n\t\t\t`socket.io (${handler}): ${this.getErrorMessage(error)}`,\n\t\t\t{ canRetry },\n\t\t\tthis.getAdditionalErrorProps(handler),\n\t\t);\n\t}\n\n\tprotected getAdditionalErrorProps(handler: string): DriverErrorTelemetryProps {\n\t\treturn {\n\t\t\tdriverVersion,\n\t\t\tdetails: JSON.stringify({\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t}),\n\t\t\tscenarioName: handler,\n\t\t};\n\t}\n}\n"]}
|
package/lib/driverUtils.d.ts
CHANGED
|
@@ -30,6 +30,8 @@ export declare function promiseRaceWithWinner<T>(promises: Promise<T>[]): Promis
|
|
|
30
30
|
value: T;
|
|
31
31
|
}>;
|
|
32
32
|
/**
|
|
33
|
+
* Validates that sequenced messages are contiguous and in the expected range.
|
|
34
|
+
*
|
|
33
35
|
* @internal
|
|
34
36
|
*/
|
|
35
37
|
export declare function validateMessages(reason: string, messages: ISequencedDocumentMessage[], from: number, logger: ITelemetryLoggerExt, strict?: boolean): void;
|
package/lib/driverUtils.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GACnB;IACF,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,yBAAyB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C,CA4EA;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC5C,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GACpB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAMtC;AAED
|
|
1
|
+
{"version":3,"file":"driverUtils.d.ts","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,yBAAyB,EAAE,MAAM,6CAA6C,CAAC;AACxF,OAAO,EAAE,mBAAmB,EAAE,MAAM,0CAA0C,CAAC;AAE/E;;;;;GAKG;AACH,wBAAgB,UAAU,CACzB,GAAG,EAAE,MAAM,EACX,aAAa,EAAE,MAAM,GACnB;IACF,aAAa,EAAE,MAAM,GAAG,SAAS,CAAC;IAClC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,gBAAgB,EAAE,MAAM,GAAG,SAAS,CAAC;IACrC,oBAAoB,EAAE,MAAM,GAAG,SAAS,CAAC;IACzC,mBAAmB,EAAE,MAAM,GAAG,SAAS,CAAC;IACxC,2BAA2B,EAAE,MAAM,GAAG,SAAS,CAAC;IAChD,yBAAyB,EAAE,MAAM,GAAG,SAAS,CAAC;CAC9C,CA4EA;AAED;;;;GAIG;AACH,wBAAsB,qBAAqB,CAAC,CAAC,EAC5C,QAAQ,EAAE,OAAO,CAAC,CAAC,CAAC,EAAE,GACpB,OAAO,CAAC;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,CAAC,CAAA;CAAE,CAAC,CAMtC;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAC/B,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,yBAAyB,EAAE,EACrC,IAAI,EAAE,MAAM,EACZ,MAAM,EAAE,mBAAmB,EAC3B,MAAM,GAAE,OAAc,GACpB,IAAI,CAqCN"}
|
package/lib/driverUtils.js
CHANGED
|
@@ -94,6 +94,8 @@ export async function promiseRaceWithWinner(promises) {
|
|
|
94
94
|
});
|
|
95
95
|
}
|
|
96
96
|
/**
|
|
97
|
+
* Validates that sequenced messages are contiguous and in the expected range.
|
|
98
|
+
*
|
|
97
99
|
* @internal
|
|
98
100
|
*/
|
|
99
101
|
export function validateMessages(reason, messages, from, logger, strict = true) {
|
package/lib/driverUtils.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"driverU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AmB;gBAC9B,MAAM;gBACN,IAAI;gBACJ,KAAK;gBACL,IAAI;gBACJ,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,WAAW,EAAE,QAAQ,CAAC,MAAM;oBAC5B,oBAAoB,EACnB,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;oBAC/E,MAAM;iBACN,CAAC;aACF,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Extract and return the w3c data.\n * @param url - request url for which w3c data needs to be reported.\n * @param initiatorType - type of the network call\n * @internal\n */\nexport function getW3CData(\n\turl: string,\n\tinitiatorType: string,\n): {\n\tdnsLookupTime: number | undefined;\n\tw3cStartTime: number | undefined;\n\tredirectTime: number | undefined;\n\ttcpHandshakeTime: number | undefined;\n\tsecureConnectionTime: number | undefined;\n\tresponseNetworkTime: number | undefined;\n\tfetchStartToResponseEndTime: number | undefined;\n\treqStartToResponseEndTime: number | undefined;\n} {\n\t// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n\t// fetchStart: immediately before the browser starts to fetch the resource.\n\t// requestStart: immediately before the browser starts requesting the resource from the server\n\t// responseStart: immediately after the browser receives the first byte of the response from the server.\n\t// responseEnd: immediately after the browser receives the last byte of the resource\n\t// or immediately before the transport connection is closed, whichever comes first.\n\t// secureConnectionStart: immediately before the browser starts the handshake process to secure the\n\t// current connection. If a secure connection is not used, this property returns zero.\n\t// startTime: Time when the resource fetch started. This value is equivalent to fetchStart.\n\t// domainLookupStart: immediately before the browser starts the domain name lookup for the resource.\n\t// domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.\n\t// redirectStart: start time of the fetch which that initiates the redirect.\n\t// redirectEnd: immediately after receiving the last byte of the response of the last redirect.\n\n\t// Interval between start and finish of the domain name lookup for the resource.\n\tlet dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart\n\t// Interval between the first fetch until the last byte of the last redirect.\n\tlet redirectTime: number | undefined; // redirectEnd - redirectStart\n\t// Time to establish the connection to the server to retrieve the resource.\n\tlet tcpHandshakeTime: number | undefined; // connectEnd - connectStart\n\t// Time from the end of the connection until the inital handshake process to secure the connection.\n\t// If 0, then no time is spent here.\n\tlet secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart\n\t// Interval to receive all (first to last) bytes form the server.\n\tlet responseNetworkTime: number | undefined; // responsEnd - responseStart\n\t// Interval between the initial fetch until the last byte is received.\n\t// Likely same as fetchTime + receiveContentTime.\n\tlet fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart\n\t// reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>\n\t// Interval between starting the request for the resource until receiving the last byte.\n\tlet reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart\n\tlet w3cStartTime: number | undefined; // W3C Start time = fetchStart time\n\n\t// getEntriesByType is only available in browser performance object\n\tconst resources1 = globalThis.performance.getEntriesByType?.(\"resource\") ?? [];\n\t// Usually the latest fetch call is to the end of resources, so we start from the end.\n\tfor (let i = resources1.length - 1; i > 0; i--) {\n\t\tconst indResTime = resources1[i] as PerformanceResourceTiming;\n\t\tconst resource_name = indResTime.name.toString();\n\t\tconst resource_initiatortype = indResTime.initiatorType;\n\t\tif (\n\t\t\tresource_initiatortype.localeCompare(initiatorType) === 0 &&\n\t\t\tresource_name.includes(url)\n\t\t) {\n\t\t\tredirectTime = indResTime.redirectEnd - indResTime.redirectStart;\n\t\t\tw3cStartTime = indResTime.fetchStart;\n\t\t\tdnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;\n\t\t\ttcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;\n\t\t\tsecureConnectionTime =\n\t\t\t\tindResTime.secureConnectionStart > 0\n\t\t\t\t\t? indResTime.connectEnd - indResTime.secureConnectionStart\n\t\t\t\t\t: 0;\n\t\t\tresponseNetworkTime =\n\t\t\t\tindResTime.responseStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.responseStart\n\t\t\t\t\t: undefined;\n\t\t\tfetchStartToResponseEndTime =\n\t\t\t\tindResTime.fetchStart > 0 ? indResTime.responseEnd - indResTime.fetchStart : undefined;\n\t\t\treqStartToResponseEndTime =\n\t\t\t\tindResTime.requestStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.requestStart\n\t\t\t\t\t: undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\tdnsLookupTime,\n\t\tw3cStartTime,\n\t\tredirectTime,\n\t\ttcpHandshakeTime,\n\t\tsecureConnectionTime,\n\t\tresponseNetworkTime,\n\t\tfetchStartToResponseEndTime,\n\t\treqStartToResponseEndTime,\n\t};\n}\n\n/**\n * An implementation of Promise.race that gives you the winner of the promise race.\n * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.\n * @internal\n */\nexport async function promiseRaceWithWinner<T>(\n\tpromises: Promise<T>[],\n): Promise<{ index: number; value: T }> {\n\treturn new Promise((resolve, reject) => {\n\t\tpromises.forEach((p, index) => {\n\t\t\tp.then((v): void => resolve({ index, value: v })).catch(reject);\n\t\t});\n\t});\n}\n\n/**\n * @internal\n */\nexport function validateMessages(\n\treason: string,\n\tmessages: ISequencedDocumentMessage[],\n\tfrom: number,\n\tlogger: ITelemetryLoggerExt,\n\tstrict: boolean = true,\n): void {\n\tif (messages.length !== 0) {\n\t\tconst start = messages[0].sequenceNumber;\n\t\tconst length = messages.length;\n\t\tconst last = messages[length - 1].sequenceNumber;\n\t\tif (last + 1 !== from + length) {\n\t\t\t// If not strict, then return the first consecutive sub-block. If strict or start\n\t\t\t// seq number is not what we expected, then return no ops.\n\t\t\tif (strict || from !== start) {\n\t\t\t\tmessages.length = 0;\n\t\t\t} else {\n\t\t\t\tlet validOpsCount = 1;\n\t\t\t\twhile (\n\t\t\t\t\tvalidOpsCount < messages.length &&\n\t\t\t\t\tmessages[validOpsCount].sequenceNumber ===\n\t\t\t\t\t\tmessages[validOpsCount - 1].sequenceNumber + 1\n\t\t\t\t) {\n\t\t\t\t\tvalidOpsCount++;\n\t\t\t\t}\n\t\t\t\tmessages.length = validOpsCount;\n\t\t\t}\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\treason,\n\t\t\t\tfrom,\n\t\t\t\tstart,\n\t\t\t\tlast,\n\t\t\t\tlength,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\tvalidLength: messages.length,\n\t\t\t\t\tlastValidOpSeqNumber:\n\t\t\t\t\t\tmessages.length > 0 ? messages[messages.length - 1].sequenceNumber : undefined,\n\t\t\t\t\tstrict,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"driverUtils.js","sourceRoot":"","sources":["../src/driverUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;GAKG;AACH,MAAM,UAAU,UAAU,CACzB,GAAW,EACX,aAAqB;IAWrB,mFAAmF;IACnF,2EAA2E;IAC3E,8FAA8F;IAC9F,wGAAwG;IACxG,oFAAoF;IACpF,gGAAgG;IAChG,mGAAmG;IACnG,mGAAmG;IACnG,2FAA2F;IAC3F,oGAAoG;IACpG,mGAAmG;IACnG,4EAA4E;IAC5E,+FAA+F;IAE/F,gFAAgF;IAChF,IAAI,aAAiC,CAAC,CAAC,sCAAsC;IAC7E,6EAA6E;IAC7E,IAAI,YAAgC,CAAC,CAAC,8BAA8B;IACpE,2EAA2E;IAC3E,IAAI,gBAAoC,CAAC,CAAC,6BAA6B;IACvE,mGAAmG;IACnG,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C,CAAC,cAAc,CAAC;QACzC,MAAM,MAAM,GAAG,QAAQ,CAAC,MAAM,CAAC;QAC/B,MAAM,IAAI,GAAG,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC;QACjD,IAAI,IAAI,GAAG,CAAC,KAAK,IAAI,GAAG,MAAM,EAAE,CAAC;YAChC,iFAAiF;YACjF,0DAA0D;YAC1D,IAAI,MAAM,IAAI,IAAI,KAAK,KAAK,EAAE,CAAC;gBAC9B,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC;YACrB,CAAC;iBAAM,CAAC;gBACP,IAAI,aAAa,GAAG,CAAC,CAAC;gBACtB,OACC,aAAa,GAAG,QAAQ,CAAC,MAAM;oBAC/B,QAAQ,CAAC,aAAa,CAAC,CAAC,cAAc;wBACrC,QAAQ,CAAC,aAAa,GAAG,CAAC,CAAC,CAAC,cAAc,GAAG,CAAC,EAC9C,CAAC;oBACF,aAAa,EAAE,CAAC;gBACjB,CAAC;gBACD,QAAQ,CAAC,MAAM,GAAG,aAAa,CAAC;YACjC,CAAC;YACD,MAAM,CAAC,cAAc,CAAC;gBACrB,SAAS,EAAE,mBAAmB;gBAC9B,MAAM;gBACN,IAAI;gBACJ,KAAK;gBACL,IAAI;gBACJ,MAAM;gBACN,OAAO,EAAE,IAAI,CAAC,SAAS,CAAC;oBACvB,WAAW,EAAE,QAAQ,CAAC,MAAM;oBAC5B,oBAAoB,EACnB,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;oBAC/E,MAAM;iBACN,CAAC;aACF,CAAC,CAAC;QACJ,CAAC;IACF,CAAC;AACF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ISequencedDocumentMessage } from \"@fluidframework/driver-definitions/internal\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils/internal\";\n\n/**\n * Extract and return the w3c data.\n * @param url - request url for which w3c data needs to be reported.\n * @param initiatorType - type of the network call\n * @internal\n */\nexport function getW3CData(\n\turl: string,\n\tinitiatorType: string,\n): {\n\tdnsLookupTime: number | undefined;\n\tw3cStartTime: number | undefined;\n\tredirectTime: number | undefined;\n\ttcpHandshakeTime: number | undefined;\n\tsecureConnectionTime: number | undefined;\n\tresponseNetworkTime: number | undefined;\n\tfetchStartToResponseEndTime: number | undefined;\n\treqStartToResponseEndTime: number | undefined;\n} {\n\t// From: https://developer.mozilla.org/en-US/docs/Web/API/PerformanceResourceTiming\n\t// fetchStart: immediately before the browser starts to fetch the resource.\n\t// requestStart: immediately before the browser starts requesting the resource from the server\n\t// responseStart: immediately after the browser receives the first byte of the response from the server.\n\t// responseEnd: immediately after the browser receives the last byte of the resource\n\t// or immediately before the transport connection is closed, whichever comes first.\n\t// secureConnectionStart: immediately before the browser starts the handshake process to secure the\n\t// current connection. If a secure connection is not used, this property returns zero.\n\t// startTime: Time when the resource fetch started. This value is equivalent to fetchStart.\n\t// domainLookupStart: immediately before the browser starts the domain name lookup for the resource.\n\t// domainLookupEnd: immediately after the browser finishes the domain name lookup for the resource.\n\t// redirectStart: start time of the fetch which that initiates the redirect.\n\t// redirectEnd: immediately after receiving the last byte of the response of the last redirect.\n\n\t// Interval between start and finish of the domain name lookup for the resource.\n\tlet dnsLookupTime: number | undefined; // domainLookupEnd - domainLookupStart\n\t// Interval between the first fetch until the last byte of the last redirect.\n\tlet redirectTime: number | undefined; // redirectEnd - redirectStart\n\t// Time to establish the connection to the server to retrieve the resource.\n\tlet tcpHandshakeTime: number | undefined; // connectEnd - connectStart\n\t// Time from the end of the connection until the inital handshake process to secure the connection.\n\t// If 0, then no time is spent here.\n\tlet secureConnectionTime: number | undefined; // connectEnd - secureConnectionStart\n\t// Interval to receive all (first to last) bytes form the server.\n\tlet responseNetworkTime: number | undefined; // responsEnd - responseStart\n\t// Interval between the initial fetch until the last byte is received.\n\t// Likely same as fetchTime + receiveContentTime.\n\tlet fetchStartToResponseEndTime: number | undefined; // responseEnd - fetchStart\n\t// reqStartToResponseEndTime = fetchStartToResponseEndTime - <initial TCP handshake>\n\t// Interval between starting the request for the resource until receiving the last byte.\n\tlet reqStartToResponseEndTime: number | undefined; // responseEnd - requestStart\n\tlet w3cStartTime: number | undefined; // W3C Start time = fetchStart time\n\n\t// getEntriesByType is only available in browser performance object\n\tconst resources1 = globalThis.performance.getEntriesByType?.(\"resource\") ?? [];\n\t// Usually the latest fetch call is to the end of resources, so we start from the end.\n\tfor (let i = resources1.length - 1; i > 0; i--) {\n\t\tconst indResTime = resources1[i] as PerformanceResourceTiming;\n\t\tconst resource_name = indResTime.name.toString();\n\t\tconst resource_initiatortype = indResTime.initiatorType;\n\t\tif (\n\t\t\tresource_initiatortype.localeCompare(initiatorType) === 0 &&\n\t\t\tresource_name.includes(url)\n\t\t) {\n\t\t\tredirectTime = indResTime.redirectEnd - indResTime.redirectStart;\n\t\t\tw3cStartTime = indResTime.fetchStart;\n\t\t\tdnsLookupTime = indResTime.domainLookupEnd - indResTime.domainLookupStart;\n\t\t\ttcpHandshakeTime = indResTime.connectEnd - indResTime.connectStart;\n\t\t\tsecureConnectionTime =\n\t\t\t\tindResTime.secureConnectionStart > 0\n\t\t\t\t\t? indResTime.connectEnd - indResTime.secureConnectionStart\n\t\t\t\t\t: 0;\n\t\t\tresponseNetworkTime =\n\t\t\t\tindResTime.responseStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.responseStart\n\t\t\t\t\t: undefined;\n\t\t\tfetchStartToResponseEndTime =\n\t\t\t\tindResTime.fetchStart > 0 ? indResTime.responseEnd - indResTime.fetchStart : undefined;\n\t\t\treqStartToResponseEndTime =\n\t\t\t\tindResTime.requestStart > 0\n\t\t\t\t\t? indResTime.responseEnd - indResTime.requestStart\n\t\t\t\t\t: undefined;\n\t\t\tbreak;\n\t\t}\n\t}\n\treturn {\n\t\tdnsLookupTime,\n\t\tw3cStartTime,\n\t\tredirectTime,\n\t\ttcpHandshakeTime,\n\t\tsecureConnectionTime,\n\t\tresponseNetworkTime,\n\t\tfetchStartToResponseEndTime,\n\t\treqStartToResponseEndTime,\n\t};\n}\n\n/**\n * An implementation of Promise.race that gives you the winner of the promise race.\n * If one of the promises is rejected before any other is resolved, this method will return the error/reason from that rejection.\n * @internal\n */\nexport async function promiseRaceWithWinner<T>(\n\tpromises: Promise<T>[],\n): Promise<{ index: number; value: T }> {\n\treturn new Promise((resolve, reject) => {\n\t\tpromises.forEach((p, index) => {\n\t\t\tp.then((v): void => resolve({ index, value: v })).catch(reject);\n\t\t});\n\t});\n}\n\n/**\n * Validates that sequenced messages are contiguous and in the expected range.\n *\n * @internal\n */\nexport function validateMessages(\n\treason: string,\n\tmessages: ISequencedDocumentMessage[],\n\tfrom: number,\n\tlogger: ITelemetryLoggerExt,\n\tstrict: boolean = true,\n): void {\n\tif (messages.length !== 0) {\n\t\tconst start = messages[0].sequenceNumber;\n\t\tconst length = messages.length;\n\t\tconst last = messages[length - 1].sequenceNumber;\n\t\tif (last + 1 !== from + length) {\n\t\t\t// If not strict, then return the first consecutive sub-block. If strict or start\n\t\t\t// seq number is not what we expected, then return no ops.\n\t\t\tif (strict || from !== start) {\n\t\t\t\tmessages.length = 0;\n\t\t\t} else {\n\t\t\t\tlet validOpsCount = 1;\n\t\t\t\twhile (\n\t\t\t\t\tvalidOpsCount < messages.length &&\n\t\t\t\t\tmessages[validOpsCount].sequenceNumber ===\n\t\t\t\t\t\tmessages[validOpsCount - 1].sequenceNumber + 1\n\t\t\t\t) {\n\t\t\t\t\tvalidOpsCount++;\n\t\t\t\t}\n\t\t\t\tmessages.length = validOpsCount;\n\t\t\t}\n\t\t\tlogger.sendErrorEvent({\n\t\t\t\teventName: \"OpsFetchViolation\",\n\t\t\t\treason,\n\t\t\t\tfrom,\n\t\t\t\tstart,\n\t\t\t\tlast,\n\t\t\t\tlength,\n\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\tvalidLength: messages.length,\n\t\t\t\t\tlastValidOpSeqNumber:\n\t\t\t\t\t\tmessages.length > 0 ? messages[messages.length - 1].sequenceNumber : undefined,\n\t\t\t\t\tstrict,\n\t\t\t\t}),\n\t\t\t});\n\t\t}\n\t}\n}\n"]}
|
package/lib/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/driver-base";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.82.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/driver-base\";\nexport const pkgVersion = \"2.82.0\";\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-base",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.82.0",
|
|
4
4
|
"description": "Shared driver code for Fluid driver implementations",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -59,25 +59,25 @@
|
|
|
59
59
|
"temp-directory": "nyc/.nyc_output"
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
|
-
"@fluid-internal/client-utils": "~2.
|
|
63
|
-
"@fluidframework/core-interfaces": "~2.
|
|
64
|
-
"@fluidframework/core-utils": "~2.
|
|
65
|
-
"@fluidframework/driver-definitions": "~2.
|
|
66
|
-
"@fluidframework/driver-utils": "~2.
|
|
67
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
62
|
+
"@fluid-internal/client-utils": "~2.82.0",
|
|
63
|
+
"@fluidframework/core-interfaces": "~2.82.0",
|
|
64
|
+
"@fluidframework/core-utils": "~2.82.0",
|
|
65
|
+
"@fluidframework/driver-definitions": "~2.82.0",
|
|
66
|
+
"@fluidframework/driver-utils": "~2.82.0",
|
|
67
|
+
"@fluidframework/telemetry-utils": "~2.82.0"
|
|
68
68
|
},
|
|
69
69
|
"devDependencies": {
|
|
70
70
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
71
71
|
"@biomejs/biome": "~1.9.3",
|
|
72
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
72
|
+
"@fluid-internal/mocha-test-setup": "~2.82.0",
|
|
73
73
|
"@fluid-tools/build-cli": "^0.63.0",
|
|
74
74
|
"@fluidframework/build-common": "^2.0.3",
|
|
75
75
|
"@fluidframework/build-tools": "^0.63.0",
|
|
76
76
|
"@fluidframework/driver-base-previous": "npm:@fluidframework/driver-base@2.81.0",
|
|
77
|
-
"@fluidframework/eslint-config-fluid": "~2.
|
|
77
|
+
"@fluidframework/eslint-config-fluid": "~2.82.0",
|
|
78
78
|
"@microsoft/api-extractor": "7.52.11",
|
|
79
79
|
"@types/mocha": "^10.0.10",
|
|
80
|
-
"@types/node": "
|
|
80
|
+
"@types/node": "~20.19.30",
|
|
81
81
|
"c8": "^10.1.3",
|
|
82
82
|
"concurrently": "^9.2.1",
|
|
83
83
|
"copyfiles": "^2.4.1",
|
|
@@ -117,6 +117,8 @@ export class DocumentDeltaConnection
|
|
|
117
117
|
private readonly mc: MonitoringContext;
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
+
* Gets the logger from the monitoring context.
|
|
121
|
+
*
|
|
120
122
|
* @deprecated Implementors should manage their own logger or monitoring context
|
|
121
123
|
*/
|
|
122
124
|
protected get logger(): ITelemetryLoggerExt {
|
package/src/driverUtils.ts
CHANGED
package/src/packageVersion.ts
CHANGED
package/biome.jsonc
DELETED