@fluidframework/odsp-driver 2.80.0 → 2.81.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/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/compactSnapshotWriter.js +1 -0
- package/dist/compactSnapshotWriter.js.map +1 -1
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +2 -0
- package/dist/epochTracker.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +2 -2
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/odspDocumentService.js +2 -0
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/odspDocumentStorageManager.js +2 -0
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +1 -0
- package/dist/odspDocumentStorageServiceBase.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/eslint.config.mts +4 -23
- package/lib/compactSnapshotWriter.d.ts.map +1 -1
- package/lib/compactSnapshotWriter.js +1 -0
- package/lib/compactSnapshotWriter.js.map +1 -1
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js +2 -0
- package/lib/epochTracker.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +2 -2
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.d.ts.map +1 -1
- package/lib/odspDocumentService.js +2 -0
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentStorageManager.d.ts.map +1 -1
- package/lib/odspDocumentStorageManager.js +2 -0
- package/lib/odspDocumentStorageManager.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js +1 -0
- package/lib/odspDocumentStorageServiceBase.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 +15 -15
- package/src/compactSnapshotWriter.ts +1 -0
- package/src/epochTracker.ts +2 -0
- package/src/odspDocumentDeltaConnection.ts +2 -2
- package/src/odspDocumentService.ts +2 -0
- package/src/odspDocumentStorageManager.ts +2 -0
- package/src/odspDocumentStorageServiceBase.ts +1 -0
- package/src/packageVersion.ts +1 -1
- package/.eslintrc.cjs +0 -49
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/odspDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEjF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAW/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAElF,OAAO,EAGN,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,oBAAoB,EAAE,MAAM,mBAAmB,CAAC;AAEzD,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,QAAQ,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC;AAClE,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,iBAAiB,GAAG,eAAe,CAAC;AAO1C,uFAAuF;AACvF,+DAA+D;AAC/D,MAAM,yBAAyB,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AG,IAAI,CAAC,eAAe,CAAC;QACpC,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QAEjC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,qEAAqE;YACrE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,CAAC,uBAAuB,EAAE,CAAC;QACjC,IACC,IAAI,CAAC,6BAA6B,KAAK,SAAS;YAChD,CAAC,IAAI,CAAC,6BAA6B,CAAC,WAAW,EAC9C,CAAC;YACF,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter, performanceNow } from \"@fluid-internal/client-utils\";\nimport type { IEvent } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport { DocumentDeltaConnection } from \"@fluidframework/driver-base/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIAnyDriverError,\n\tIConnect,\n\tIDocumentMessage,\n\tINack,\n\tISentSignalMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { createGenericNetworkError } from \"@fluidframework/driver-utils/internal\";\nimport type { OdspError } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\ttype ITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { IFlushOpsResponse, IGetOpsResponse, IOdspSocketError } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport { errorObjectFromSocketError } from \"./odspError.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { SocketIOClientStatic } from \"./socketModule.js\";\n\nconst protocolVersions = [\"^0.4.0\", \"^0.3.0\", \"^0.2.0\", \"^0.1.0\"];\nconst feature_get_ops = \"api_get_ops\";\nconst feature_flush_ops = \"api_flush_ops\";\n\nexport interface FlushResult {\n\tlastPersistedSequenceNumber?: number;\n\tretryAfter?: number;\n}\n\n// How long to wait before disconnecting the socket after the last reference is removed\n// This allows reconnection after receiving a nack to be smooth\nconst socketReferenceBufferTime = 2000;\n\ninterface ISocketEvents extends IEvent {\n\t(\n\t\tevent: \"disconnect\",\n\t\tlistener: (error: IFluidErrorBase & OdspError, clientId?: string) => void,\n\t);\n}\n\nclass SocketReference extends TypedEventEmitter<ISocketEvents> {\n\tprivate references: number = 1;\n\tprivate delayDeleteTimeout: ReturnType<typeof setTimeout> | undefined;\n\tprivate _socket: Socket | undefined;\n\n\t// When making decisions about socket reuse, we do not reuse disconnected socket.\n\t// But we want to differentiate the following case from disconnected case:\n\t// Socket that never connected and never failed, it's in \"attempting to connect\" mode\n\t// such sockets should be reused, despite socket.disconnected === true\n\tprivate isPendingInitialConnection = true;\n\n\t// Map of all existing socket io sockets. [url, tenantId, documentId] -> socket\n\tprivate static readonly socketIoSockets: Map<string, SocketReference> = new Map();\n\n\tpublic static find(key: string, logger: ITelemetryLoggerExt): SocketReference | undefined {\n\t\tconst socketReference = SocketReference.socketIoSockets.get(key);\n\n\t\t// Verify the socket is healthy before reusing it\n\t\tif (socketReference?.disconnected) {\n\t\t\t// The socket is in a bad state. fully remove the reference\n\t\t\tsocketReference.closeSocket();\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (socketReference) {\n\t\t\t// Clear the pending deletion if there is one\n\t\t\tsocketReference.clearTimer();\n\t\t\tsocketReference.references++;\n\t\t}\n\n\t\treturn socketReference;\n\t}\n\n\t/**\n\t * Removes a reference for the given key\n\t * Once the ref count hits 0, the socket is disconnected and removed\n\t */\n\tpublic removeSocketIoReference(): void {\n\t\tassert(this.references > 0, 0x09f /* \"No more socketIO refs to remove!\" */);\n\t\tthis.references--;\n\n\t\t// see comment in disconnected() getter\n\t\tthis.isPendingInitialConnection = false;\n\n\t\tif (this.disconnected) {\n\t\t\tthis.closeSocket();\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.references === 0 && this.delayDeleteTimeout === undefined) {\n\t\t\tthis.delayDeleteTimeout = setTimeout(() => {\n\t\t\t\t// We should not get here with active users.\n\t\t\t\tassert(this.references === 0, 0x0a0 /* \"Unexpected socketIO references on timeout\" */);\n\t\t\t\tthis.closeSocket();\n\t\t\t}, socketReferenceBufferTime);\n\t\t}\n\t}\n\n\tpublic get socket(): Socket {\n\t\tif (!this._socket) {\n\t\t\tthrow new Error(`Invalid socket for key \"${this.key}`);\n\t\t}\n\t\treturn this._socket;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly key: string,\n\t\tsocket: Socket,\n\t) {\n\t\tsuper();\n\n\t\tthis._socket = socket;\n\t\tassert(!SocketReference.socketIoSockets.has(key), 0x220 /* \"socket key collision\" */);\n\t\tSocketReference.socketIoSockets.set(key, this);\n\n\t\t// Server sends this event when it wants to disconnect a particular client in which case the client id would\n\t\t// be present or if it wants to disconnect all the clients. The server always closes the socket in case all\n\t\t// clients needs to be disconnected. So fully remove the socket reference in this case.\n\t\tsocket.on(\"server_disconnect\", this.serverDisconnectEventHandler);\n\t}\n\n\tprivate readonly serverDisconnectEventHandler = (\n\t\tsocketError: IOdspSocketError,\n\t\tclientId?: string,\n\t): void => {\n\t\t// Treat all errors as recoverable, and rely on joinSession / reconnection flow to\n\t\t// filter out retryable vs. non-retryable cases.\n\t\tconst error = errorObjectFromSocketError(socketError, \"server_disconnect\");\n\t\terror.addTelemetryProperties({ disconnectClientId: clientId });\n\t\terror.canRetry = true;\n\n\t\t// see comment in disconnected() getter\n\t\t// Setting it here to ensure socket reuse does not happen if new request to connect\n\t\t// comes in from \"disconnect\" listener below, before we close socket.\n\t\tthis.isPendingInitialConnection = false;\n\n\t\tif (clientId === undefined) {\n\t\t\t// We could first raise \"disconnect\" event, but that may result in socket reuse due to\n\t\t\t// new connection comming in. So, it's better to have more explicit flow to make it impossible.\n\t\t\tthis.closeSocket(error);\n\t\t} else {\n\t\t\tthis.emit(\"disconnect\", error, clientId);\n\t\t}\n\t};\n\n\tprivate clearTimer(): void {\n\t\tif (this.delayDeleteTimeout !== undefined) {\n\t\t\tclearTimeout(this.delayDeleteTimeout);\n\t\t\tthis.delayDeleteTimeout = undefined;\n\t\t}\n\t}\n\n\tpublic closeSocket(error?: IAnyDriverError): void {\n\t\tif (!this._socket) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._socket.off(\"server_disconnect\", this.serverDisconnectEventHandler);\n\t\tthis.clearTimer();\n\n\t\tassert(\n\t\t\tSocketReference.socketIoSockets.get(this.key) === this,\n\t\t\t0x0a1 /* \"Socket reference set unexpectedly does not point to this socket!\" */,\n\t\t);\n\n\t\t// First, remove socket to ensure no socket reuse is possible.\n\t\tSocketReference.socketIoSockets.delete(this.key);\n\n\t\t// Block access to socket. From now on, calls like flush() or requestOps()\n\t\t// Disconnect flow should be synchronous and result in system fully forgetting about this connection / socket.\n\t\tconst socket = this._socket;\n\t\tthis._socket = undefined;\n\n\t\t// Let all connections know they need to go through disconnect flow.\n\t\tthis.emit(\n\t\t\t\"disconnect\",\n\t\t\terror ??\n\t\t\t\tcreateGenericNetworkError(\n\t\t\t\t\t\"Socket closed without error\",\n\t\t\t\t\t{ canRetry: true },\n\t\t\t\t\t{ driverVersion: pkgVersion },\n\t\t\t\t),\n\t\t\tundefined /* clientId */,\n\t\t);\n\n\t\t// We should not have any users now, assuming synchronous disconnect flow in response to\n\t\t// \"disconnect\" event\n\t\tassert(\n\t\t\tthis.references === 0,\n\t\t\t0x412 /* Nobody should be connected to this socket at this point! */,\n\t\t);\n\n\t\tsocket.disconnect();\n\t}\n\n\tpublic get disconnected(): boolean {\n\t\tif (this._socket === undefined) {\n\t\t\treturn true;\n\t\t}\n\t\tif (this.socket.connected) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// We have a socket that is not connected. Possible cases:\n\t\t// 1) It was connected some time ago and lost connection. We do not want to reuse it.\n\t\t// 2) It failed to connect (was never connected).\n\t\t// 3) It was just created and never had a chance to connect - connection is in process.\n\t\t// We have to differentiate 1 from 2-3 (specifically 1 & 3) in order to be able to reuse socket in #3.\n\t\t// We will use the fact that socket had some activity. I.e. if socket disconnected, or client stopped using\n\t\t// socket, then removeSocketIoReference() will be called for it, and it will be the indiction that it's not #3.\n\t\treturn !this.isPendingInitialConnection;\n\t}\n}\n\n/**\n * Represents a connection to a stream of delta updates\n */\nexport class OdspDocumentDeltaConnection extends DocumentDeltaConnection {\n\t/**\n\t * Create a OdspDocumentDeltaConnection\n\t * If url #1 fails to connect, will try url #2 if applicable.\n\t *\n\t * @param tenantId - the ID of the tenant\n\t * @param documentId - document ID\n\t * @param token - authorization token for storage service\n\t * @param client - information about the client\n\t * @param mode - mode of the client\n\t * @param url - websocket URL\n\t * @param telemetryLogger - optional telemetry logger\n\t * @param timeoutMs - time limit on making the connection\n\t * @param epochTracker - track epoch changes\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t * @param connectionId - (optional) connection ID for the connection\n\t */\n\tpublic static async create(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\ttoken: string | null,\n\t\tclient: IClient,\n\t\turl: string,\n\t\ttelemetryLogger: ITelemetryLoggerExt,\n\t\ttimeoutMs: number,\n\t\tepochTracker: EpochTracker,\n\t\tsocketReferenceKeyPrefix: string | undefined,\n\t\tconnectionId: string = uuid(),\n\t): Promise<OdspDocumentDeltaConnection> {\n\t\tconst mc = loggerToMonitoringContext(telemetryLogger);\n\n\t\t// enable multiplexing when the websocket url does not include the tenant/document id\n\t\tconst parsedUrl = new URL(url);\n\t\tconst enableMultiplexing =\n\t\t\t!parsedUrl.searchParams.has(\"documentId\") && !parsedUrl.searchParams.has(\"tenantId\");\n\n\t\t// do not include the specific tenant/doc id in the ref key when multiplexing\n\t\t// this will allow multiple documents to share the same websocket connection\n\t\tconst key = socketReferenceKeyPrefix ? `${socketReferenceKeyPrefix},${url}` : url;\n\t\tconst socketReferenceKey = enableMultiplexing ? key : `${key},${tenantId},${documentId}`;\n\n\t\tconst socketReference = OdspDocumentDeltaConnection.getOrCreateSocketIoReference(\n\t\t\ttimeoutMs,\n\t\t\tsocketReferenceKey,\n\t\t\turl,\n\t\t\tenableMultiplexing,\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\ttelemetryLogger,\n\t\t);\n\n\t\tconst socket = socketReference.socket;\n\t\tconst connectMessage: IConnect = {\n\t\t\tclient,\n\t\t\tid: documentId,\n\t\t\tmode: client.mode,\n\t\t\ttenantId,\n\t\t\ttoken, // Token is going to indicate tenant level information, etc...\n\t\t\tversions: protocolVersions,\n\t\t\tdriverVersion: pkgVersion,\n\t\t\tnonce: connectionId,\n\t\t\tepoch: epochTracker.fluidEpoch,\n\t\t\trelayUserAgent: [client.details.environment, ` driverVersion:${pkgVersion}`].join(\";\"),\n\t\t};\n\n\t\tconnectMessage.supportedFeatures = {};\n\n\t\t// Reference to this client supporting get_ops flow.\n\t\tif (mc.config.getBoolean(\"Fluid.Driver.Odsp.GetOpsEnabled\") !== false) {\n\t\t\tconnectMessage.supportedFeatures[feature_get_ops] = true;\n\t\t}\n\n\t\tconst deltaConnection = new OdspDocumentDeltaConnection(\n\t\t\tsocket,\n\t\t\tdocumentId,\n\t\t\tsocketReference,\n\t\t\ttelemetryLogger,\n\t\t\tenableMultiplexing,\n\t\t\tconnectionId,\n\t\t);\n\n\t\ttry {\n\t\t\tawait deltaConnection.initialize(connectMessage, timeoutMs);\n\t\t\tawait epochTracker.validateEpoch(deltaConnection.details.epoch, \"push\");\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tif (error !== null && typeof error === \"object\") {\n\t\t\t\t// We have to special-case error types here in terms of what is re-triable.\n\t\t\t\t// These errors have to re-retried, we just need new joinSession result to connect to right server:\n\t\t\t\t// 400: Invalid tenant or document id. The WebSocket is connected to a different document\n\t\t\t\t// Document is full (with retryAfter)\n\t\t\t\t// 404: Invalid document. The document \\\"local/w1-...\\\" does not exist\n\t\t\t\t// But this has to stay not-retriable:\n\t\t\t\t// 406: Unsupported client protocol. This path is the only gatekeeper, have to fail!\n\t\t\t\t// 409: Epoch Version Mismatch. Client epoch and server epoch does not match, so app needs\n\t\t\t\t// to be refreshed.\n\t\t\t\t// This one is fine either way\n\t\t\t\t// 401/403: Code will retry once with new token either way, then it becomes fatal - on this path\n\t\t\t\t// and on join Session path.\n\t\t\t\t// 501: (Fluid not enabled): this is fine either way, as joinSession is gatekeeper\n\t\t\t\t// eslint-disable-next-line unicorn/no-lonely-if, @typescript-eslint/no-unsafe-member-access\n\t\t\t\tif (error.statusCode === 400 || error.statusCode === 404) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\terror.canRetry = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn deltaConnection;\n\t}\n\n\tprivate socketReference: SocketReference | undefined;\n\n\tprivate readonly requestOpsNoncePrefix: string;\n\tprivate pushCallCounter = 0;\n\tprivate readonly getOpsMap: Map<string, { start: number; from: number; to: number }> =\n\t\tnew Map();\n\tprivate flushOpNonce: string | undefined;\n\tprivate flushDeferred: Deferred<FlushResult> | undefined;\n\tprivate connectionNotYetDisposedTimeout: ReturnType<typeof setTimeout> | undefined;\n\t// Due to socket reuse(multiplexing), we can get \"disconnect\" event from other clients in the socket reference.\n\t// So, a race condition could happen, where this client is establishing connection and listening for \"connect_document_success\"\n\t// on the socket among other events, but we get \"disconnect\" event on the socket reference from other clients, in which case,\n\t// we dispose connection object and stop listening to further events on the socket. Due to this we get stuck as the connection\n\t// is not yet established and so we don't return any connection object to the client(connection manager). So, we remain stuck.\n\t// In order to handle this, we use this deferred promise to keep track of connection initialization and reject this promise with\n\t// error in the disconnectCore so that the caller can know and handle the error.\n\tprivate connectionInitializeDeferredP: Deferred<void> | undefined;\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(\n\t\thandler: string,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\t\terror?: any,\n\t\tcanRetry = true,\n\t): IAnyDriverError {\n\t\t// Note: we suspect the incoming error object is either:\n\t\t// - a socketError: add it to the OdspError object for driver to be able to parse it and reason over it.\n\t\t// - anything else: let base class handle it\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\treturn canRetry && Number.isInteger(error?.code) && typeof error?.message === \"string\"\n\t\t\t? errorObjectFromSocketError(error as IOdspSocketError, handler)\n\t\t\t: super.createErrorObject(handler, error, canRetry);\n\t}\n\n\t/**\n\t * Gets or create a socket io connection for the given key\n\t */\n\tprivate static getOrCreateSocketIoReference(\n\t\ttimeoutMs: number,\n\t\tkey: string,\n\t\turl: string,\n\t\tenableMultiplexing: boolean,\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t): SocketReference {\n\t\t// eslint-disable-next-line unicorn/no-array-callback-reference, unicorn/no-array-method-this-argument\n\t\tconst existingSocketReference = SocketReference.find(key, logger);\n\t\tif (existingSocketReference) {\n\t\t\treturn existingSocketReference;\n\t\t}\n\n\t\tconst query = enableMultiplexing ? undefined : { documentId, tenantId };\n\n\t\tconst socket = SocketIOClientStatic(url, {\n\t\t\tmultiplex: false, // Don't rely on socket.io built-in multiplexing\n\t\t\tquery,\n\t\t\treconnection: false,\n\t\t\ttransports: [\"websocket\"],\n\t\t\ttimeout: timeoutMs,\n\t\t});\n\n\t\treturn new SocketReference(key, socket);\n\t}\n\n\t/**\n\t * @param socket - websocket to be used\n\t * @param documentId - ID of the document\n\t * @param details - details of the websocket connection\n\t * @param socketReferenceKey - socket reference key\n\t * @param enableMultiplexing - If the websocket is multiplexing multiple documents\n\t */\n\tprivate constructor(\n\t\tsocket: Socket,\n\t\tdocumentId: string,\n\t\tsocketReference: SocketReference,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly enableMultiplexing?: boolean,\n\t\tconnectionId?: string,\n\t) {\n\t\tsuper(socket, documentId, logger, false, connectionId);\n\t\tthis.socketReference = socketReference;\n\t\tthis.requestOpsNoncePrefix = `${uuid()}-`;\n\t}\n\n\t/**\n\t * Retrieves ops from PUSH\n\t * @param from - inclusive\n\t * @param to - exclusive\n\t * @returns ops retrieved\n\t */\n\tpublic requestOps(from: number, to: number): void {\n\t\tassert(!this.socketReference?.disconnected, 0x413 /* non-active socket */);\n\n\t\t// Given that to is exclusive, we should be asking for at least something!\n\t\tassert(to > from, 0x272 /* \"empty request\" */);\n\n\t\t// PUSH may disable this functionality\n\t\t// back-compat: remove cast to any once latest version of IConnected is consumed\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\tif ((this.details as any).supportedFeatures?.[feature_get_ops] !== true) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.pushCallCounter++;\n\t\tconst nonce = `${this.requestOpsNoncePrefix}${this.pushCallCounter}`;\n\t\tconst start = performanceNow();\n\n\t\t// We may keep keep accumulating memory for nothing, if we are not getting responses.\n\t\t// Note that we should not have overlapping requests, as DeltaManager allows only one\n\t\t// outstanding request to storage, and that's the only way to get here.\n\t\t// But requests could be cancelled, and thus overlapping requests might be in the picture\n\t\t// If it happens, we do not care about stale requests.\n\t\t// So track some number of requests, but log if we get too many in flight - that likely\n\t\t// indicates an error somewhere.\n\t\tif (this.getOpsMap.size >= 5) {\n\t\t\tlet time = start;\n\t\t\tlet key: string | undefined;\n\t\t\tfor (const [keyCandidate, value] of this.getOpsMap.entries()) {\n\t\t\t\tif (value.start <= time || key === undefined) {\n\t\t\t\t\ttime = value.start;\n\t\t\t\t\tkey = keyCandidate;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst payloadToDelete = this.getOpsMap.get(key!)!;\n\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\teventName: \"GetOpsTooMany\",\n\t\t\t\tnonce,\n\t\t\t\tfrom: payloadToDelete.from,\n\t\t\t\tto: payloadToDelete.to,\n\t\t\t\tlength: payloadToDelete.to - payloadToDelete.from,\n\t\t\t\tduration: performanceNow() - payloadToDelete.start,\n\t\t\t});\n\t\t\tthis.getOpsMap.delete(key!);\n\t\t}\n\t\tthis.getOpsMap.set(nonce, {\n\t\t\tstart,\n\t\t\tfrom,\n\t\t\tto,\n\t\t});\n\t\tthis.socket.emit(\"get_ops\", this.clientId, {\n\t\t\tnonce,\n\t\t\tfrom,\n\t\t\tto: to - 1,\n\t\t});\n\t}\n\n\tpublic async flush(): Promise<FlushResult> {\n\t\tassert(!this.socketReference?.disconnected, 0x414 /* non-active socket */);\n\n\t\t// back-compat: remove cast to any once latest version of IConnected is consumed\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\tif ((this.details as any).supportedFeatures?.[feature_flush_ops] !== true) {\n\t\t\t// Once single-commit summary is enabled end-to-end, flush support is a must!\n\t\t\t// The only alternative is change in design where SPO fetches ops from PUSH OR\n\t\t\t// summary includes required ops and SPO has some validation mechanism to ensure\n\t\t\t// they are not forged by client.\n\t\t\t// If design changes, we can reconsider it, but right now it's non-recoverable failure.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FlushOpsNotSupported\" });\n\t\t\tthrow new Error(\n\t\t\t\t\"flush() API is not supported by PUSH, required for single-commit summaries\",\n\t\t\t);\n\t\t}\n\n\t\tthis.pushCallCounter++;\n\t\tconst nonce = `${this.requestOpsNoncePrefix}${this.pushCallCounter}`;\n\t\t// There should be only one flush ops in flight, kicked out by upload summary workflow\n\t\t// That said, it could timeout and request could be repeated, so theoretically we can\n\t\t// get overlapping requests, but it should be very rare\n\t\tif (this.flushDeferred !== undefined) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FlushOpsTooMany\" });\n\t\t\tthis.flushDeferred.reject(\n\t\t\t\t\"process involving flush() was cancelled OR unsupported concurrency\",\n\t\t\t);\n\t\t}\n\t\tthis.socket.emit(\"flush_ops\", this.clientId, { nonce });\n\n\t\tthis.flushOpNonce = nonce;\n\t\tthis.flushDeferred = new Deferred<FlushResult>();\n\t\treturn this.flushDeferred.promise;\n\t}\n\n\tprotected disconnectHandler = (\n\t\terror: IFluidErrorBase & OdspError,\n\t\tclientId?: string,\n\t): void => {\n\t\tif (clientId === undefined || clientId === this.clientId) {\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"ServerDisconnect\",\n\t\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.disconnect(error);\n\t\t}\n\t};\n\n\tprotected async initialize(connectMessage: IConnect, timeout: number): Promise<void> {\n\t\tassert(!this.socketReference?.disconnected, 0x415 /* non-active socket */);\n\n\t\tif (this.enableMultiplexing) {\n\t\t\t// multiplex compatible early handlers\n\t\t\tthis.earlyOpHandler = (\n\t\t\t\tmessageDocumentId: string,\n\t\t\t\tmsgs: ISequencedDocumentMessage[],\n\t\t\t): void => {\n\t\t\t\tif (this.documentId === messageDocumentId) {\n\t\t\t\t\tthis.queuedMessages.push(...msgs);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.earlySignalHandler = (\n\t\t\t\tmsg: ISignalMessage | ISignalMessage[],\n\t\t\t\tmessageDocumentId?: string,\n\t\t\t): void => {\n\t\t\t\tif (messageDocumentId === undefined || messageDocumentId === this.documentId) {\n\t\t\t\t\tif (Array.isArray(msg)) {\n\t\t\t\t\t\tthis.queuedSignals.push(...msg);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.queuedSignals.push(msg);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tthis.socketReference!.on(\"disconnect\", this.disconnectHandler);\n\n\t\tthis.addTrackedListener(\"get_ops_response\", (result: IGetOpsResponse) => {\n\t\t\tconst messages = result.messages;\n\t\t\tconst data = this.getOpsMap.get(result.nonce);\n\t\t\t// Due to socket multiplexing, this client may not have asked for any data\n\t\t\t// If so, there it most likely does not need these ops (otherwise it already asked for them)\n\t\t\t// Also we may have deleted entry in this.getOpsMap due to too many requests and too slow response.\n\t\t\t// But not processing such result may push us into infinite loop of fast requests and dropping all responses\n\t\t\tif (data !== undefined || result.nonce.startsWith(this.requestOpsNoncePrefix)) {\n\t\t\t\tthis.getOpsMap.delete(result.nonce);\n\t\t\t\tconst common = {\n\t\t\t\t\teventName: \"GetOps\",\n\t\t\t\t\t// We need nonce only to pair with GetOpsTooMany events, i.e. when record was deleted\n\t\t\t\t\tnonce: data === undefined ? result.nonce : undefined,\n\t\t\t\t\tcode: result.code,\n\t\t\t\t\tfrom: data?.from,\n\t\t\t\t\tto: data?.to,\n\t\t\t\t\tduration: data === undefined ? undefined : performanceNow() - data.start,\n\t\t\t\t};\n\t\t\t\tif (messages !== undefined && messages.length > 0) {\n\t\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\t\t...common,\n\t\t\t\t\t\tfirst: messages[0].sequenceNumber,\n\t\t\t\t\t\tlast: messages[messages.length - 1].sequenceNumber,\n\t\t\t\t\t\tlength: messages.length,\n\t\t\t\t\t});\n\t\t\t\t\tthis.emit(\"op\", this.documentId, messages);\n\t\t\t\t} else {\n\t\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\t\t...common,\n\t\t\t\t\t\tlength: 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.addTrackedListener(\"flush_ops_response\", (result: IFlushOpsResponse) => {\n\t\t\tif (this.flushOpNonce === result.nonce) {\n\t\t\t\tconst seq = result.lastPersistedSequenceNumber;\n\t\t\t\tlet category: \"generic\" | \"error\" = \"generic\";\n\t\t\t\tif (result.lastPersistedSequenceNumber === undefined || result.code !== 200) {\n\t\t\t\t\tswitch (result.code) {\n\t\t\t\t\t\tcase 409:\n\t\t\t\t\t\tcase 429: {\n\t\t\t\t\t\t\tcategory = \"error\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase 204: {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tcategory = \"error\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FlushResult\",\n\t\t\t\t\tcode: result.code,\n\t\t\t\t\tsequenceNumber: seq,\n\t\t\t\t\tcategory,\n\t\t\t\t});\n\t\t\t\tthis.flushDeferred!.resolve(result);\n\t\t\t\tthis.flushDeferred = undefined;\n\t\t\t\tthis.flushOpNonce = undefined;\n\t\t\t}\n\t\t});\n\n\t\tthis.connectionInitializeDeferredP = new Deferred<void>();\n\n\t\tsuper\n\t\t\t.initialize(connectMessage, timeout)\n\t\t\t.then(() => this.connectionInitializeDeferredP?.resolve())\n\t\t\t.catch((error) => this.connectionInitializeDeferredP?.reject(error));\n\n\t\tawait this.connectionInitializeDeferredP.promise.finally(() => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"ConnectionAttemptInfo\",\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t});\n\t\t});\n\t}\n\n\tprotected addTrackedListener(event: string, listener: (...args: any[]) => void): void {\n\t\t// override some event listeners in order to support multiple documents/clients over the same websocket\n\t\tswitch (event) {\n\t\t\tcase \"op\": {\n\t\t\t\t// per document op handling\n\t\t\t\tsuper.addTrackedListener(\n\t\t\t\t\tevent,\n\t\t\t\t\t(documentId: string, msgs: ISequencedDocumentMessage[]) => {\n\t\t\t\t\t\tif (!this.enableMultiplexing || this.documentId === documentId) {\n\t\t\t\t\t\t\tlistener(documentId, msgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"signal\": {\n\t\t\t\t// per document signal handling\n\t\t\t\tsuper.addTrackedListener(\n\t\t\t\t\tevent,\n\t\t\t\t\t(msg: ISignalMessage | ISignalMessage[], documentId?: string) => {\n\t\t\t\t\t\tif (!this.enableMultiplexing) {\n\t\t\t\t\t\t\tlistener(msg, documentId);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tdocumentId !== undefined,\n\t\t\t\t\t\t\t0xa65 /* documentId is required when multiplexing is enabled. */,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (documentId !== this.documentId) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst msgs = Array.isArray(msg) ? msg : [msg];\n\n\t\t\t\t\t\tconst filteredMsgs = msgs.filter(\n\t\t\t\t\t\t\t(m) => !m.targetClientId || m.targetClientId === this.clientId,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (filteredMsgs.length > 0) {\n\t\t\t\t\t\t\t// This ternary is needed for signal-based layer compat tests to pass,\n\t\t\t\t\t\t\t// specifically the layer version combination where you have an old loader and the most recent driver layer.\n\t\t\t\t\t\t\t// Old loader doesn't send or receive batched signals (ISignalMessage[]),\n\t\t\t\t\t\t\t// so only individual ISignalMessage's should be passed when there's one element for backcompat.\n\t\t\t\t\t\t\tlistener(filteredMsgs.length === 1 ? filteredMsgs[0] : filteredMsgs, documentId);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"nack\": {\n\t\t\t\t// per client / document nack handling\n\t\t\t\tsuper.addTrackedListener(event, (clientIdOrDocumentId: string, nacks: INack[]) => {\n\t\t\t\t\tconst handle =\n\t\t\t\t\t\tclientIdOrDocumentId.length === 0 ||\n\t\t\t\t\t\tclientIdOrDocumentId === this.documentId ||\n\t\t\t\t\t\tclientIdOrDocumentId === this.clientId;\n\t\t\t\t\tconst { code, type, message, retryAfter } = nacks[0]?.content ?? {};\n\t\t\t\t\tconst { clientSequenceNumber, referenceSequenceNumber } = nacks[0]?.operation ?? {};\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"ServerNack\",\n\t\t\t\t\t\tcode,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tretryAfterSeconds: retryAfter,\n\t\t\t\t\t\tclientId: this.clientId,\n\t\t\t\t\t\thandle,\n\t\t\t\t\t\tclientSequenceNumber,\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\topType: nacks[0]?.operation?.type,\n\t\t\t\t\t});\n\t\t\t\t\tif (handle) {\n\t\t\t\t\t\tthis.emit(\"nack\", clientIdOrDocumentId, nacks);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tsuper.addTrackedListener(event, listener);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get disposed(): boolean {\n\t\tif (!(this._disposed || this.socket.connected)) {\n\t\t\t// Send error event if this connection is not yet disposed after socket is disconnected for 15s.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if\n\t\t\tif (this.connectionNotYetDisposedTimeout === undefined) {\n\t\t\t\tthis.connectionNotYetDisposedTimeout = setTimeout(() => {\n\t\t\t\t\tif (!this._disposed) {\n\t\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\t\teventName: \"ConnectionNotYetDisposed\",\n\t\t\t\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}, 15000);\n\t\t\t}\n\t\t}\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Returns true in case the connection is not yet disposed and the socket is also connected. The expectation is\n\t * that it will be called only after connection is fully established. i.e. there should no way to submit an op\n\t * while we are connecting, as connection object is not exposed to Loader layer until connection is established.\n\t */\n\tprivate get connected(): boolean {\n\t\treturn !this.disposed && this.socket.connected;\n\t}\n\n\tprotected override emitMessages(type: \"submitOp\", messages: IDocumentMessage[][]): void;\n\tprotected override emitMessages(\n\t\ttype: \"submitSignal\",\n\t\tmessages: string[][] | ISentSignalMessage[],\n\t): void;\n\tprotected override emitMessages(type: string, messages: unknown): void {\n\t\t// Only submit the op/signals if we are connected.\n\t\tif (this.connected) {\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 * @param message - delta operation to submit\n\t */\n\tpublic submit(messages: IDocumentMessage[]): void {\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\tconst signal: ISentSignalMessage = {\n\t\t\tcontent,\n\t\t\ttargetClientId,\n\t\t};\n\n\t\tthis.emitMessages(\"submitSignal\", [signal]);\n\t}\n\n\t/**\n\t * Critical path where we need to also close the socket for an error.\n\t * @param error - Error causing the socket to close.\n\t */\n\tprotected closeSocketCore(error: IAnyDriverError): void {\n\t\tconst socket = this.socketReference;\n\t\tassert(socket !== undefined, 0x416 /* reentrancy not supported in close socket */);\n\t\tsocket.closeSocket(error);\n\t\tassert(\n\t\t\tthis.socketReference === undefined,\n\t\t\t0x417 /* disconnect flow did not work correctly */,\n\t\t);\n\t}\n\n\t/**\n\t * Disconnect from the websocket\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tconst socket = this.socketReference;\n\t\tassert(socket !== undefined, 0x0a2 /* \"reentrancy not supported!\" */);\n\t\tthis.socketReference = undefined;\n\n\t\tsocket.off(\"disconnect\", this.disconnectHandler);\n\t\tif (this.hasDetails) {\n\t\t\t// tell the server we are disconnecting this client from the document\n\t\t\tthis.socket.emit(\"disconnect_document\", this.clientId, this.documentId);\n\t\t}\n\n\t\tsocket.removeSocketIoReference();\n\t\tif (\n\t\t\tthis.connectionInitializeDeferredP !== undefined &&\n\t\t\t!this.connectionInitializeDeferredP.isCompleted\n\t\t) {\n\t\t\tthis.connectionInitializeDeferredP.reject(err);\n\t\t}\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDocumentDeltaConnection.js","sourceRoot":"","sources":["../src/odspDocumentDeltaConnection.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAEjF,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,qCAAqC,CAAC;AACvE,OAAO,EAAE,uBAAuB,EAAE,MAAM,sCAAsC,CAAC;AAW/E,OAAO,EAAE,yBAAyB,EAAE,MAAM,uCAAuC,CAAC;AAElF,OAAO,EAGN,yBAAyB,GACzB,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAIlC,OAAO,EAAE,0BAA0B,EAAE,MAAM,gBAAgB,CAAC;AAC5D,O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AM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;QACpC,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,8CAA8C,CAAC,CAAC;QACnF,MAAM,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;QAC1B,MAAM,CACL,IAAI,CAAC,eAAe,KAAK,SAAS,EAClC,KAAK,CAAC,4CAA4C,CAClD,CAAC;IACH,CAAC;IAED;;OAEG;IACO,cAAc,CAAC,GAAoB;QAC5C,MAAM,MAAM,GAAG,IAAI,CAAC,eAAe,CAAC;QACpC,MAAM,CAAC,MAAM,KAAK,SAAS,EAAE,KAAK,CAAC,iCAAiC,CAAC,CAAC;QACtE,IAAI,CAAC,eAAe,GAAG,SAAS,CAAC;QAEjC,MAAM,CAAC,GAAG,CAAC,YAAY,EAAE,IAAI,CAAC,iBAAiB,CAAC,CAAC;QACjD,IAAI,IAAI,CAAC,UAAU,EAAE,CAAC;YACrB,qEAAqE;YACrE,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,EAAE,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,UAAU,CAAC,CAAC;QACzE,CAAC;QAED,MAAM,CAAC,uBAAuB,EAAE,CAAC;QACjC,IACC,IAAI,CAAC,6BAA6B,KAAK,SAAS;YAChD,CAAC,IAAI,CAAC,6BAA6B,CAAC,WAAW,EAC9C,CAAC;YACF,IAAI,CAAC,6BAA6B,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAChD,CAAC;IACF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter, performanceNow } from \"@fluid-internal/client-utils\";\nimport type { IEvent } from \"@fluidframework/core-interfaces\";\nimport { assert, Deferred } from \"@fluidframework/core-utils/internal\";\nimport { DocumentDeltaConnection } from \"@fluidframework/driver-base/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIAnyDriverError,\n\tIConnect,\n\tIDocumentMessage,\n\tINack,\n\tISentSignalMessage,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { createGenericNetworkError } from \"@fluidframework/driver-utils/internal\";\nimport type { OdspError } from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\ttype ITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport type { Socket } from \"socket.io-client\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { IFlushOpsResponse, IGetOpsResponse, IOdspSocketError } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport { errorObjectFromSocketError } from \"./odspError.js\";\nimport { pkgVersion } from \"./packageVersion.js\";\nimport { SocketIOClientStatic } from \"./socketModule.js\";\n\nconst protocolVersions = [\"^0.4.0\", \"^0.3.0\", \"^0.2.0\", \"^0.1.0\"];\nconst feature_get_ops = \"api_get_ops\";\nconst feature_flush_ops = \"api_flush_ops\";\n\nexport interface FlushResult {\n\tlastPersistedSequenceNumber?: number;\n\tretryAfter?: number;\n}\n\n// How long to wait before disconnecting the socket after the last reference is removed\n// This allows reconnection after receiving a nack to be smooth\nconst socketReferenceBufferTime = 2000;\n\ninterface ISocketEvents extends IEvent {\n\t(\n\t\tevent: \"disconnect\",\n\t\tlistener: (error: IFluidErrorBase & OdspError, clientId?: string) => void,\n\t);\n}\n\nclass SocketReference extends TypedEventEmitter<ISocketEvents> {\n\tprivate references: number = 1;\n\tprivate delayDeleteTimeout: ReturnType<typeof setTimeout> | undefined;\n\tprivate _socket: Socket | undefined;\n\n\t// When making decisions about socket reuse, we do not reuse disconnected socket.\n\t// But we want to differentiate the following case from disconnected case:\n\t// Socket that never connected and never failed, it's in \"attempting to connect\" mode\n\t// such sockets should be reused, despite socket.disconnected === true\n\tprivate isPendingInitialConnection = true;\n\n\t// Map of all existing socket io sockets. [url, tenantId, documentId] -> socket\n\tprivate static readonly socketIoSockets: Map<string, SocketReference> = new Map();\n\n\tpublic static find(key: string, logger: ITelemetryLoggerExt): SocketReference | undefined {\n\t\tconst socketReference = SocketReference.socketIoSockets.get(key);\n\n\t\t// Verify the socket is healthy before reusing it\n\t\tif (socketReference?.disconnected) {\n\t\t\t// The socket is in a bad state. fully remove the reference\n\t\t\tsocketReference.closeSocket();\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (socketReference) {\n\t\t\t// Clear the pending deletion if there is one\n\t\t\tsocketReference.clearTimer();\n\t\t\tsocketReference.references++;\n\t\t}\n\n\t\treturn socketReference;\n\t}\n\n\t/**\n\t * Removes a reference for the given key\n\t * Once the ref count hits 0, the socket is disconnected and removed\n\t */\n\tpublic removeSocketIoReference(): void {\n\t\tassert(this.references > 0, 0x09f /* \"No more socketIO refs to remove!\" */);\n\t\tthis.references--;\n\n\t\t// see comment in disconnected() getter\n\t\tthis.isPendingInitialConnection = false;\n\n\t\tif (this.disconnected) {\n\t\t\tthis.closeSocket();\n\t\t\treturn;\n\t\t}\n\n\t\tif (this.references === 0 && this.delayDeleteTimeout === undefined) {\n\t\t\tthis.delayDeleteTimeout = setTimeout(() => {\n\t\t\t\t// We should not get here with active users.\n\t\t\t\tassert(this.references === 0, 0x0a0 /* \"Unexpected socketIO references on timeout\" */);\n\t\t\t\tthis.closeSocket();\n\t\t\t}, socketReferenceBufferTime);\n\t\t}\n\t}\n\n\tpublic get socket(): Socket {\n\t\tif (!this._socket) {\n\t\t\tthrow new Error(`Invalid socket for key \"${this.key}`);\n\t\t}\n\t\treturn this._socket;\n\t}\n\n\tpublic constructor(\n\t\tpublic readonly key: string,\n\t\tsocket: Socket,\n\t) {\n\t\tsuper();\n\n\t\tthis._socket = socket;\n\t\tassert(!SocketReference.socketIoSockets.has(key), 0x220 /* \"socket key collision\" */);\n\t\tSocketReference.socketIoSockets.set(key, this);\n\n\t\t// Server sends this event when it wants to disconnect a particular client in which case the client id would\n\t\t// be present or if it wants to disconnect all the clients. The server always closes the socket in case all\n\t\t// clients needs to be disconnected. So fully remove the socket reference in this case.\n\t\tsocket.on(\"server_disconnect\", this.serverDisconnectEventHandler);\n\t}\n\n\tprivate readonly serverDisconnectEventHandler = (\n\t\tsocketError: IOdspSocketError,\n\t\tclientId?: string,\n\t): void => {\n\t\t// Treat all errors as recoverable, and rely on joinSession / reconnection flow to\n\t\t// filter out retryable vs. non-retryable cases.\n\t\tconst error = errorObjectFromSocketError(socketError, \"server_disconnect\");\n\t\terror.addTelemetryProperties({ disconnectClientId: clientId });\n\t\terror.canRetry = true;\n\n\t\t// see comment in disconnected() getter\n\t\t// Setting it here to ensure socket reuse does not happen if new request to connect\n\t\t// comes in from \"disconnect\" listener below, before we close socket.\n\t\tthis.isPendingInitialConnection = false;\n\n\t\tif (clientId === undefined) {\n\t\t\t// We could first raise \"disconnect\" event, but that may result in socket reuse due to\n\t\t\t// new connection comming in. So, it's better to have more explicit flow to make it impossible.\n\t\t\tthis.closeSocket(error);\n\t\t} else {\n\t\t\tthis.emit(\"disconnect\", error, clientId);\n\t\t}\n\t};\n\n\tprivate clearTimer(): void {\n\t\tif (this.delayDeleteTimeout !== undefined) {\n\t\t\tclearTimeout(this.delayDeleteTimeout);\n\t\t\tthis.delayDeleteTimeout = undefined;\n\t\t}\n\t}\n\n\tpublic closeSocket(error?: IAnyDriverError): void {\n\t\tif (!this._socket) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis._socket.off(\"server_disconnect\", this.serverDisconnectEventHandler);\n\t\tthis.clearTimer();\n\n\t\tassert(\n\t\t\tSocketReference.socketIoSockets.get(this.key) === this,\n\t\t\t0x0a1 /* \"Socket reference set unexpectedly does not point to this socket!\" */,\n\t\t);\n\n\t\t// First, remove socket to ensure no socket reuse is possible.\n\t\tSocketReference.socketIoSockets.delete(this.key);\n\n\t\t// Block access to socket. From now on, calls like flush() or requestOps()\n\t\t// Disconnect flow should be synchronous and result in system fully forgetting about this connection / socket.\n\t\tconst socket = this._socket;\n\t\tthis._socket = undefined;\n\n\t\t// Let all connections know they need to go through disconnect flow.\n\t\tthis.emit(\n\t\t\t\"disconnect\",\n\t\t\terror ??\n\t\t\t\tcreateGenericNetworkError(\n\t\t\t\t\t\"Socket closed without error\",\n\t\t\t\t\t{ canRetry: true },\n\t\t\t\t\t{ driverVersion: pkgVersion },\n\t\t\t\t),\n\t\t\tundefined /* clientId */,\n\t\t);\n\n\t\t// We should not have any users now, assuming synchronous disconnect flow in response to\n\t\t// \"disconnect\" event\n\t\tassert(\n\t\t\tthis.references === 0,\n\t\t\t0x412 /* Nobody should be connected to this socket at this point! */,\n\t\t);\n\n\t\tsocket.disconnect();\n\t}\n\n\tpublic get disconnected(): boolean {\n\t\tif (this._socket === undefined) {\n\t\t\treturn true;\n\t\t}\n\t\tif (this.socket.connected) {\n\t\t\treturn false;\n\t\t}\n\n\t\t// We have a socket that is not connected. Possible cases:\n\t\t// 1) It was connected some time ago and lost connection. We do not want to reuse it.\n\t\t// 2) It failed to connect (was never connected).\n\t\t// 3) It was just created and never had a chance to connect - connection is in process.\n\t\t// We have to differentiate 1 from 2-3 (specifically 1 & 3) in order to be able to reuse socket in #3.\n\t\t// We will use the fact that socket had some activity. I.e. if socket disconnected, or client stopped using\n\t\t// socket, then removeSocketIoReference() will be called for it, and it will be the indiction that it's not #3.\n\t\treturn !this.isPendingInitialConnection;\n\t}\n}\n\n/**\n * Represents a connection to a stream of delta updates\n */\nexport class OdspDocumentDeltaConnection extends DocumentDeltaConnection {\n\t/**\n\t * Create a OdspDocumentDeltaConnection\n\t * If url #1 fails to connect, will try url #2 if applicable.\n\t *\n\t * @param tenantId - the ID of the tenant\n\t * @param documentId - document ID\n\t * @param token - authorization token for storage service\n\t * @param client - information about the client\n\t * @param mode - mode of the client\n\t * @param url - websocket URL\n\t * @param telemetryLogger - optional telemetry logger\n\t * @param timeoutMs - time limit on making the connection\n\t * @param epochTracker - track epoch changes\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t * @param connectionId - (optional) connection ID for the connection\n\t */\n\tpublic static async create(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\ttoken: string | null,\n\t\tclient: IClient,\n\t\turl: string,\n\t\ttelemetryLogger: ITelemetryLoggerExt,\n\t\ttimeoutMs: number,\n\t\tepochTracker: EpochTracker,\n\t\tsocketReferenceKeyPrefix: string | undefined,\n\t\tconnectionId: string = uuid(),\n\t): Promise<OdspDocumentDeltaConnection> {\n\t\tconst mc = loggerToMonitoringContext(telemetryLogger);\n\n\t\t// enable multiplexing when the websocket url does not include the tenant/document id\n\t\tconst parsedUrl = new URL(url);\n\t\tconst enableMultiplexing =\n\t\t\t!parsedUrl.searchParams.has(\"documentId\") && !parsedUrl.searchParams.has(\"tenantId\");\n\n\t\t// do not include the specific tenant/doc id in the ref key when multiplexing\n\t\t// this will allow multiple documents to share the same websocket connection\n\t\tconst key = socketReferenceKeyPrefix ? `${socketReferenceKeyPrefix},${url}` : url;\n\t\tconst socketReferenceKey = enableMultiplexing ? key : `${key},${tenantId},${documentId}`;\n\n\t\tconst socketReference = OdspDocumentDeltaConnection.getOrCreateSocketIoReference(\n\t\t\ttimeoutMs,\n\t\t\tsocketReferenceKey,\n\t\t\turl,\n\t\t\tenableMultiplexing,\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\ttelemetryLogger,\n\t\t);\n\n\t\tconst socket = socketReference.socket;\n\t\tconst connectMessage: IConnect = {\n\t\t\tclient,\n\t\t\tid: documentId,\n\t\t\tmode: client.mode,\n\t\t\ttenantId,\n\t\t\ttoken, // Token is going to indicate tenant level information, etc...\n\t\t\tversions: protocolVersions,\n\t\t\tdriverVersion: pkgVersion,\n\t\t\tnonce: connectionId,\n\t\t\tepoch: epochTracker.fluidEpoch,\n\t\t\trelayUserAgent: [client.details.environment, ` driverVersion:${pkgVersion}`].join(\";\"),\n\t\t};\n\n\t\tconnectMessage.supportedFeatures = {};\n\n\t\t// Reference to this client supporting get_ops flow.\n\t\tif (mc.config.getBoolean(\"Fluid.Driver.Odsp.GetOpsEnabled\") !== false) {\n\t\t\tconnectMessage.supportedFeatures[feature_get_ops] = true;\n\t\t}\n\n\t\tconst deltaConnection = new OdspDocumentDeltaConnection(\n\t\t\tsocket,\n\t\t\tdocumentId,\n\t\t\tsocketReference,\n\t\t\ttelemetryLogger,\n\t\t\tenableMultiplexing,\n\t\t\tconnectionId,\n\t\t);\n\n\t\ttry {\n\t\t\tawait deltaConnection.initialize(connectMessage, timeoutMs);\n\t\t\tawait epochTracker.validateEpoch(deltaConnection.details.epoch, \"push\");\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any\n\t\t} catch (error: any) {\n\t\t\tif (error !== null && typeof error === \"object\") {\n\t\t\t\t// We have to special-case error types here in terms of what is re-triable.\n\t\t\t\t// These errors have to re-retried, we just need new joinSession result to connect to right server:\n\t\t\t\t// 400: Invalid tenant or document id. The WebSocket is connected to a different document\n\t\t\t\t// Document is full (with retryAfter)\n\t\t\t\t// 404: Invalid document. The document \\\"local/w1-...\\\" does not exist\n\t\t\t\t// But this has to stay not-retriable:\n\t\t\t\t// 406: Unsupported client protocol. This path is the only gatekeeper, have to fail!\n\t\t\t\t// 409: Epoch Version Mismatch. Client epoch and server epoch does not match, so app needs\n\t\t\t\t// to be refreshed.\n\t\t\t\t// This one is fine either way\n\t\t\t\t// 401/403: Code will retry once with new token either way, then it becomes fatal - on this path\n\t\t\t\t// and on join Session path.\n\t\t\t\t// 501: (Fluid not enabled): this is fine either way, as joinSession is gatekeeper\n\t\t\t\t// eslint-disable-next-line unicorn/no-lonely-if, @typescript-eslint/no-unsafe-member-access\n\t\t\t\tif (error.statusCode === 400 || error.statusCode === 404) {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\t\t\t\terror.canRetry = true;\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\n\t\treturn deltaConnection;\n\t}\n\n\tprivate socketReference: SocketReference | undefined;\n\n\tprivate readonly requestOpsNoncePrefix: string;\n\tprivate pushCallCounter = 0;\n\tprivate readonly getOpsMap: Map<string, { start: number; from: number; to: number }> =\n\t\tnew Map();\n\tprivate flushOpNonce: string | undefined;\n\tprivate flushDeferred: Deferred<FlushResult> | undefined;\n\tprivate connectionNotYetDisposedTimeout: ReturnType<typeof setTimeout> | undefined;\n\t// Due to socket reuse(multiplexing), we can get \"disconnect\" event from other clients in the socket reference.\n\t// So, a race condition could happen, where this client is establishing connection and listening for \"connect_document_success\"\n\t// on the socket among other events, but we get \"disconnect\" event on the socket reference from other clients, in which case,\n\t// we dispose connection object and stop listening to further events on the socket. Due to this we get stuck as the connection\n\t// is not yet established and so we don't return any connection object to the client(connection manager). So, we remain stuck.\n\t// In order to handle this, we use this deferred promise to keep track of connection initialization and reject this promise with\n\t// error in the disconnectCore so that the caller can know and handle the error.\n\tprivate connectionInitializeDeferredP: Deferred<void> | undefined;\n\n\t/**\n\t * Error raising for socket.io issues\n\t */\n\tprotected createErrorObject(\n\t\thandler: string,\n\t\t// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types, @typescript-eslint/no-explicit-any\n\t\terror?: any,\n\t\tcanRetry = true,\n\t): IAnyDriverError {\n\t\t// Note: we suspect the incoming error object is either:\n\t\t// - a socketError: add it to the OdspError object for driver to be able to parse it and reason over it.\n\t\t// - anything else: let base class handle it\n\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n\t\treturn canRetry && Number.isInteger(error?.code) && typeof error?.message === \"string\"\n\t\t\t? errorObjectFromSocketError(error as IOdspSocketError, handler)\n\t\t\t: super.createErrorObject(handler, error, canRetry);\n\t}\n\n\t/**\n\t * Gets or create a socket io connection for the given key\n\t */\n\tprivate static getOrCreateSocketIoReference(\n\t\ttimeoutMs: number,\n\t\tkey: string,\n\t\turl: string,\n\t\tenableMultiplexing: boolean,\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\tlogger: ITelemetryLoggerExt,\n\t): SocketReference {\n\t\t// eslint-disable-next-line unicorn/no-array-method-this-argument\n\t\tconst existingSocketReference = SocketReference.find(key, logger);\n\t\tif (existingSocketReference) {\n\t\t\treturn existingSocketReference;\n\t\t}\n\n\t\tconst query = enableMultiplexing ? undefined : { documentId, tenantId };\n\n\t\tconst socket = SocketIOClientStatic(url, {\n\t\t\tmultiplex: false, // Don't rely on socket.io built-in multiplexing\n\t\t\tquery,\n\t\t\treconnection: false,\n\t\t\ttransports: [\"websocket\"],\n\t\t\ttimeout: timeoutMs,\n\t\t});\n\n\t\treturn new SocketReference(key, socket);\n\t}\n\n\t/**\n\t * @param socket - websocket to be used\n\t * @param documentId - ID of the document\n\t * @param details - details of the websocket connection\n\t * @param socketReferenceKey - socket reference key\n\t * @param enableMultiplexing - If the websocket is multiplexing multiple documents\n\t */\n\tprivate constructor(\n\t\tsocket: Socket,\n\t\tdocumentId: string,\n\t\tsocketReference: SocketReference,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly enableMultiplexing?: boolean,\n\t\tconnectionId?: string,\n\t) {\n\t\tsuper(socket, documentId, logger, false, connectionId);\n\t\tthis.socketReference = socketReference;\n\t\tthis.requestOpsNoncePrefix = `${uuid()}-`;\n\t}\n\n\t/**\n\t * Retrieves ops from PUSH\n\t * @param from - inclusive\n\t * @param to - exclusive\n\t * @returns ops retrieved\n\t */\n\tpublic requestOps(from: number, to: number): void {\n\t\tassert(!this.socketReference?.disconnected, 0x413 /* non-active socket */);\n\n\t\t// Given that to is exclusive, we should be asking for at least something!\n\t\tassert(to > from, 0x272 /* \"empty request\" */);\n\n\t\t// PUSH may disable this functionality\n\t\t// back-compat: remove cast to any once latest version of IConnected is consumed\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\tif ((this.details as any).supportedFeatures?.[feature_get_ops] !== true) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.pushCallCounter++;\n\t\tconst nonce = `${this.requestOpsNoncePrefix}${this.pushCallCounter}`;\n\t\tconst start = performanceNow();\n\n\t\t// We may keep keep accumulating memory for nothing, if we are not getting responses.\n\t\t// Note that we should not have overlapping requests, as DeltaManager allows only one\n\t\t// outstanding request to storage, and that's the only way to get here.\n\t\t// But requests could be cancelled, and thus overlapping requests might be in the picture\n\t\t// If it happens, we do not care about stale requests.\n\t\t// So track some number of requests, but log if we get too many in flight - that likely\n\t\t// indicates an error somewhere.\n\t\tif (this.getOpsMap.size >= 5) {\n\t\t\tlet time = start;\n\t\t\tlet key: string | undefined;\n\t\t\tfor (const [keyCandidate, value] of this.getOpsMap.entries()) {\n\t\t\t\tif (value.start <= time || key === undefined) {\n\t\t\t\t\ttime = value.start;\n\t\t\t\t\tkey = keyCandidate;\n\t\t\t\t}\n\t\t\t}\n\t\t\tconst payloadToDelete = this.getOpsMap.get(key!)!;\n\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\teventName: \"GetOpsTooMany\",\n\t\t\t\tnonce,\n\t\t\t\tfrom: payloadToDelete.from,\n\t\t\t\tto: payloadToDelete.to,\n\t\t\t\tlength: payloadToDelete.to - payloadToDelete.from,\n\t\t\t\tduration: performanceNow() - payloadToDelete.start,\n\t\t\t});\n\t\t\tthis.getOpsMap.delete(key!);\n\t\t}\n\t\tthis.getOpsMap.set(nonce, {\n\t\t\tstart,\n\t\t\tfrom,\n\t\t\tto,\n\t\t});\n\t\tthis.socket.emit(\"get_ops\", this.clientId, {\n\t\t\tnonce,\n\t\t\tfrom,\n\t\t\tto: to - 1,\n\t\t});\n\t}\n\n\tpublic async flush(): Promise<FlushResult> {\n\t\tassert(!this.socketReference?.disconnected, 0x414 /* non-active socket */);\n\n\t\t// back-compat: remove cast to any once latest version of IConnected is consumed\n\t\t// eslint-disable-next-line @typescript-eslint/no-explicit-any, @typescript-eslint/no-unsafe-member-access\n\t\tif ((this.details as any).supportedFeatures?.[feature_flush_ops] !== true) {\n\t\t\t// Once single-commit summary is enabled end-to-end, flush support is a must!\n\t\t\t// The only alternative is change in design where SPO fetches ops from PUSH OR\n\t\t\t// summary includes required ops and SPO has some validation mechanism to ensure\n\t\t\t// they are not forged by client.\n\t\t\t// If design changes, we can reconsider it, but right now it's non-recoverable failure.\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FlushOpsNotSupported\" });\n\t\t\tthrow new Error(\n\t\t\t\t\"flush() API is not supported by PUSH, required for single-commit summaries\",\n\t\t\t);\n\t\t}\n\n\t\tthis.pushCallCounter++;\n\t\tconst nonce = `${this.requestOpsNoncePrefix}${this.pushCallCounter}`;\n\t\t// There should be only one flush ops in flight, kicked out by upload summary workflow\n\t\t// That said, it could timeout and request could be repeated, so theoretically we can\n\t\t// get overlapping requests, but it should be very rare\n\t\tif (this.flushDeferred !== undefined) {\n\t\t\tthis.logger.sendErrorEvent({ eventName: \"FlushOpsTooMany\" });\n\t\t\tthis.flushDeferred.reject(\n\t\t\t\t\"process involving flush() was cancelled OR unsupported concurrency\",\n\t\t\t);\n\t\t}\n\t\tthis.socket.emit(\"flush_ops\", this.clientId, { nonce });\n\n\t\tthis.flushOpNonce = nonce;\n\t\tthis.flushDeferred = new Deferred<FlushResult>();\n\t\treturn this.flushDeferred.promise;\n\t}\n\n\tprotected disconnectHandler = (\n\t\terror: IFluidErrorBase & OdspError,\n\t\tclientId?: string,\n\t): void => {\n\t\tif (clientId === undefined || clientId === this.clientId) {\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"ServerDisconnect\",\n\t\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t\terror,\n\t\t\t);\n\t\t\tthis.disconnect(error);\n\t\t}\n\t};\n\n\tprotected async initialize(connectMessage: IConnect, timeout: number): Promise<void> {\n\t\tassert(!this.socketReference?.disconnected, 0x415 /* non-active socket */);\n\n\t\tif (this.enableMultiplexing) {\n\t\t\t// multiplex compatible early handlers\n\t\t\tthis.earlyOpHandler = (\n\t\t\t\tmessageDocumentId: string,\n\t\t\t\tmsgs: ISequencedDocumentMessage[],\n\t\t\t): void => {\n\t\t\t\tif (this.documentId === messageDocumentId) {\n\t\t\t\t\tthis.queuedMessages.push(...msgs);\n\t\t\t\t}\n\t\t\t};\n\n\t\t\tthis.earlySignalHandler = (\n\t\t\t\tmsg: ISignalMessage | ISignalMessage[],\n\t\t\t\tmessageDocumentId?: string,\n\t\t\t): void => {\n\t\t\t\tif (messageDocumentId === undefined || messageDocumentId === this.documentId) {\n\t\t\t\t\tif (Array.isArray(msg)) {\n\t\t\t\t\t\tthis.queuedSignals.push(...msg);\n\t\t\t\t\t} else {\n\t\t\t\t\t\tthis.queuedSignals.push(msg);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t};\n\t\t}\n\n\t\tthis.socketReference!.on(\"disconnect\", this.disconnectHandler);\n\n\t\tthis.addTrackedListener(\"get_ops_response\", (result: IGetOpsResponse) => {\n\t\t\tconst messages = result.messages;\n\t\t\tconst data = this.getOpsMap.get(result.nonce);\n\t\t\t// Due to socket multiplexing, this client may not have asked for any data\n\t\t\t// If so, there it most likely does not need these ops (otherwise it already asked for them)\n\t\t\t// Also we may have deleted entry in this.getOpsMap due to too many requests and too slow response.\n\t\t\t// But not processing such result may push us into infinite loop of fast requests and dropping all responses\n\t\t\tif (data !== undefined || result.nonce.startsWith(this.requestOpsNoncePrefix)) {\n\t\t\t\tthis.getOpsMap.delete(result.nonce);\n\t\t\t\tconst common = {\n\t\t\t\t\teventName: \"GetOps\",\n\t\t\t\t\t// We need nonce only to pair with GetOpsTooMany events, i.e. when record was deleted\n\t\t\t\t\tnonce: data === undefined ? result.nonce : undefined,\n\t\t\t\t\tcode: result.code,\n\t\t\t\t\tfrom: data?.from,\n\t\t\t\t\tto: data?.to,\n\t\t\t\t\tduration: data === undefined ? undefined : performanceNow() - data.start,\n\t\t\t\t};\n\t\t\t\tif (messages !== undefined && messages.length > 0) {\n\t\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\t\t...common,\n\t\t\t\t\t\tfirst: messages[0].sequenceNumber,\n\t\t\t\t\t\tlast: messages[messages.length - 1].sequenceNumber,\n\t\t\t\t\t\tlength: messages.length,\n\t\t\t\t\t});\n\t\t\t\t\tthis.emit(\"op\", this.documentId, messages);\n\t\t\t\t} else {\n\t\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\t\t...common,\n\t\t\t\t\t\tlength: 0,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t}\n\t\t});\n\n\t\tthis.addTrackedListener(\"flush_ops_response\", (result: IFlushOpsResponse) => {\n\t\t\tif (this.flushOpNonce === result.nonce) {\n\t\t\t\tconst seq = result.lastPersistedSequenceNumber;\n\t\t\t\tlet category: \"generic\" | \"error\" = \"generic\";\n\t\t\t\tif (result.lastPersistedSequenceNumber === undefined || result.code !== 200) {\n\t\t\t\t\tswitch (result.code) {\n\t\t\t\t\t\tcase 409:\n\t\t\t\t\t\tcase 429: {\n\t\t\t\t\t\t\tcategory = \"error\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tcase 204: {\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tcategory = \"error\";\n\t\t\t\t\t\t\tbreak;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FlushResult\",\n\t\t\t\t\tcode: result.code,\n\t\t\t\t\tsequenceNumber: seq,\n\t\t\t\t\tcategory,\n\t\t\t\t});\n\t\t\t\tthis.flushDeferred!.resolve(result);\n\t\t\t\tthis.flushDeferred = undefined;\n\t\t\t\tthis.flushOpNonce = undefined;\n\t\t\t}\n\t\t});\n\n\t\tthis.connectionInitializeDeferredP = new Deferred<void>();\n\n\t\tsuper\n\t\t\t.initialize(connectMessage, timeout)\n\t\t\t.then(() => this.connectionInitializeDeferredP?.resolve())\n\t\t\t.catch((error) => this.connectionInitializeDeferredP?.reject(error));\n\n\t\tawait this.connectionInitializeDeferredP.promise.finally(() => {\n\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\teventName: \"ConnectionAttemptInfo\",\n\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t});\n\t\t});\n\t}\n\n\tprotected addTrackedListener(event: string, listener: (...args: any[]) => void): void {\n\t\t// override some event listeners in order to support multiple documents/clients over the same websocket\n\t\tswitch (event) {\n\t\t\tcase \"op\": {\n\t\t\t\t// per document op handling\n\t\t\t\tsuper.addTrackedListener(\n\t\t\t\t\tevent,\n\t\t\t\t\t(documentId: string, msgs: ISequencedDocumentMessage[]) => {\n\t\t\t\t\t\tif (!this.enableMultiplexing || this.documentId === documentId) {\n\t\t\t\t\t\t\tlistener(documentId, msgs);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"signal\": {\n\t\t\t\t// per document signal handling\n\t\t\t\tsuper.addTrackedListener(\n\t\t\t\t\tevent,\n\t\t\t\t\t(msg: ISignalMessage | ISignalMessage[], documentId?: string) => {\n\t\t\t\t\t\tif (!this.enableMultiplexing) {\n\t\t\t\t\t\t\tlistener(msg, documentId);\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tassert(\n\t\t\t\t\t\t\tdocumentId !== undefined,\n\t\t\t\t\t\t\t0xa65 /* documentId is required when multiplexing is enabled. */,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (documentId !== this.documentId) {\n\t\t\t\t\t\t\treturn;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst msgs = Array.isArray(msg) ? msg : [msg];\n\n\t\t\t\t\t\tconst filteredMsgs = msgs.filter(\n\t\t\t\t\t\t\t(m) => !m.targetClientId || m.targetClientId === this.clientId,\n\t\t\t\t\t\t);\n\n\t\t\t\t\t\tif (filteredMsgs.length > 0) {\n\t\t\t\t\t\t\t// This ternary is needed for signal-based layer compat tests to pass,\n\t\t\t\t\t\t\t// specifically the layer version combination where you have an old loader and the most recent driver layer.\n\t\t\t\t\t\t\t// Old loader doesn't send or receive batched signals (ISignalMessage[]),\n\t\t\t\t\t\t\t// so only individual ISignalMessage's should be passed when there's one element for backcompat.\n\t\t\t\t\t\t\tlistener(filteredMsgs.length === 1 ? filteredMsgs[0] : filteredMsgs, documentId);\n\t\t\t\t\t\t}\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase \"nack\": {\n\t\t\t\t// per client / document nack handling\n\t\t\t\tsuper.addTrackedListener(event, (clientIdOrDocumentId: string, nacks: INack[]) => {\n\t\t\t\t\tconst handle =\n\t\t\t\t\t\tclientIdOrDocumentId.length === 0 ||\n\t\t\t\t\t\tclientIdOrDocumentId === this.documentId ||\n\t\t\t\t\t\tclientIdOrDocumentId === this.clientId;\n\t\t\t\t\tconst { code, type, message, retryAfter } = nacks[0]?.content ?? {};\n\t\t\t\t\tconst { clientSequenceNumber, referenceSequenceNumber } = nacks[0]?.operation ?? {};\n\t\t\t\t\tthis.logger.sendTelemetryEvent({\n\t\t\t\t\t\teventName: \"ServerNack\",\n\t\t\t\t\t\tcode,\n\t\t\t\t\t\ttype,\n\t\t\t\t\t\tmessage,\n\t\t\t\t\t\tretryAfterSeconds: retryAfter,\n\t\t\t\t\t\tclientId: this.clientId,\n\t\t\t\t\t\thandle,\n\t\t\t\t\t\tclientSequenceNumber,\n\t\t\t\t\t\treferenceSequenceNumber,\n\t\t\t\t\t\topType: nacks[0]?.operation?.type,\n\t\t\t\t\t});\n\t\t\t\t\tif (handle) {\n\t\t\t\t\t\tthis.emit(\"nack\", clientIdOrDocumentId, nacks);\n\t\t\t\t\t}\n\t\t\t\t});\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tdefault: {\n\t\t\t\tsuper.addTrackedListener(event, listener);\n\t\t\t\tbreak;\n\t\t\t}\n\t\t}\n\t}\n\n\tpublic get disposed(): boolean {\n\t\tif (!(this._disposed || this.socket.connected)) {\n\t\t\t// Send error event if this connection is not yet disposed after socket is disconnected for 15s.\n\t\t\t// eslint-disable-next-line unicorn/no-lonely-if, @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\t\tif (this.connectionNotYetDisposedTimeout === undefined) {\n\t\t\t\tthis.connectionNotYetDisposedTimeout = setTimeout(() => {\n\t\t\t\t\tif (!this._disposed) {\n\t\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\t\teventName: \"ConnectionNotYetDisposed\",\n\t\t\t\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\t\t\t...this.getConnectionDetailsProps(),\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t}, 15000);\n\t\t\t}\n\t\t}\n\t\treturn this._disposed;\n\t}\n\n\t/**\n\t * Returns true in case the connection is not yet disposed and the socket is also connected. The expectation is\n\t * that it will be called only after connection is fully established. i.e. there should no way to submit an op\n\t * while we are connecting, as connection object is not exposed to Loader layer until connection is established.\n\t */\n\tprivate get connected(): boolean {\n\t\treturn !this.disposed && this.socket.connected;\n\t}\n\n\tprotected override emitMessages(type: \"submitOp\", messages: IDocumentMessage[][]): void;\n\tprotected override emitMessages(\n\t\ttype: \"submitSignal\",\n\t\tmessages: string[][] | ISentSignalMessage[],\n\t): void;\n\tprotected override emitMessages(type: string, messages: unknown): void {\n\t\t// Only submit the op/signals if we are connected.\n\t\tif (this.connected) {\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 * @param message - delta operation to submit\n\t */\n\tpublic submit(messages: IDocumentMessage[]): void {\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\tconst signal: ISentSignalMessage = {\n\t\t\tcontent,\n\t\t\ttargetClientId,\n\t\t};\n\n\t\tthis.emitMessages(\"submitSignal\", [signal]);\n\t}\n\n\t/**\n\t * Critical path where we need to also close the socket for an error.\n\t * @param error - Error causing the socket to close.\n\t */\n\tprotected closeSocketCore(error: IAnyDriverError): void {\n\t\tconst socket = this.socketReference;\n\t\tassert(socket !== undefined, 0x416 /* reentrancy not supported in close socket */);\n\t\tsocket.closeSocket(error);\n\t\tassert(\n\t\t\tthis.socketReference === undefined,\n\t\t\t0x417 /* disconnect flow did not work correctly */,\n\t\t);\n\t}\n\n\t/**\n\t * Disconnect from the websocket\n\t */\n\tprotected disconnectCore(err: IAnyDriverError): void {\n\t\tconst socket = this.socketReference;\n\t\tassert(socket !== undefined, 0x0a2 /* \"reentrancy not supported!\" */);\n\t\tthis.socketReference = undefined;\n\n\t\tsocket.off(\"disconnect\", this.disconnectHandler);\n\t\tif (this.hasDetails) {\n\t\t\t// tell the server we are disconnecting this client from the document\n\t\t\tthis.socket.emit(\"disconnect_document\", this.clientId, this.documentId);\n\t\t}\n\n\t\tsocket.removeSocketIoReference();\n\t\tif (\n\t\t\tthis.connectionInitializeDeferredP !== undefined &&\n\t\t\t!this.connectionInitializeDeferredP.isCompleted\n\t\t) {\n\t\t\tthis.connectionInitializeDeferredP.reject(err);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentService.d.ts","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AA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AAwB,CAE9C;IAED;;;;OAIG;IACU,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IA6BjE;;;;OAIG;IACU,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAqC3E;;;;OAIG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAkBrF;;;;;OAKG;YACW,yBAAyB;IA6BhC,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAerC,SAAS,KAAK,QAAQ,IAAI,QAAQ,GAAG,SAAS,CAkC7C;IAID,SAAS,CAAC,WAAW,CAAC,GAAG,EAAE,yBAAyB,EAAE,GAAG,IAAI;CAQ7D"}
|
|
@@ -92,6 +92,7 @@ export class OdspDocumentService extends TypedEventEmitter {
|
|
|
92
92
|
* @returns returns the document storage service for sharepoint driver.
|
|
93
93
|
*/
|
|
94
94
|
async connectToStorage() {
|
|
95
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy
|
|
95
96
|
if (!this.storageManager) {
|
|
96
97
|
this.storageManager = new OdspDocumentStorageService(this.odspResolvedUrl, this.getAuthHeader, this.mc.logger, true, this.cache, this.hostPolicy, this.epochTracker,
|
|
97
98
|
// flushCallback
|
|
@@ -140,6 +141,7 @@ export class OdspDocumentService extends TypedEventEmitter {
|
|
|
140
141
|
* @returns returns the document delta stream service for onedrive/sharepoint driver.
|
|
141
142
|
*/
|
|
142
143
|
async connectToDeltaStream(client) {
|
|
144
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy
|
|
143
145
|
if (this.socketModuleP === undefined) {
|
|
144
146
|
this.socketModuleP = this.getDelayLoadedDeltaStream();
|
|
145
147
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentService.js","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;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,MAAM,EAAE,GAAG,EAAE,CAAgC;YACjF,MAAM,EAAE,GAAS,EAAE;gBAClB,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,aAAa,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAC3D,CAAC;SACD,EACD,SAAS,EACT,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,gBAAgB,IAAI,IAAI,EACpD,IAAI,CAAC,UAAU,CAAC,UAAU,EAAE,eAAe,IAAI,IAAI,CACnD,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC;IACvB,CAAC;IAED,mHAAmH;IACnH,8EAA8E;IACpE,WAAW,CAAC,GAAgC;QACrD,2CAA2C;QAC3C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;YACzD,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServicePolicies,\n\tIDocumentStorageService,\n\tIEntry,\n\tIResolvedUrl,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tHostStoragePolicy,\n\tIOdspResolvedUrl,\n\tInstrumentedStorageTokenFetcher,\n\tTokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\ttype MonitoringContext,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { HostStoragePolicyInternal } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport type { IOdspCache } from \"./odspCache.js\";\nimport type { OdspDelayLoadedDeltaStream } from \"./odspDelayLoadedDeltaStream.js\";\nimport {\n\tOdspDeltaStorageService,\n\tOdspDeltaStorageWithCache,\n} from \"./odspDeltaStorageService.js\";\nimport { OdspDocumentStorageService } from \"./odspDocumentStorageManager.js\";\nimport { hasOdcOrigin } from \"./odspUrlHelper.js\";\nimport { getOdspResolvedUrl } from \"./odspUtils.js\";\nimport { OpsCache } from \"./opsCaching.js\";\nimport { RetryErrorsStorageAdapter } from \"./retryErrorsStorageAdapter.js\";\n\n/**\n * The DocumentService manages the Socket.IO connection and manages routing requests to connected\n * clients\n */\nexport class OdspDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tprivate readonly _policies: IDocumentServicePolicies;\n\n\t// Promise to load socket module only once.\n\tprivate socketModuleP: Promise<OdspDelayLoadedDeltaStream> | undefined;\n\n\tprivate odspDelayLoadedDeltaStream: OdspDelayLoadedDeltaStream | undefined;\n\n\tprivate odspSocketModuleLoaded: boolean = false;\n\n\t/**\n\t * Creates a new OdspDocumentService instance.\n\t *\n\t * @param resolvedUrl - resolved url identifying document that will be managed by returned service instance.\n\t * @param getAuthHeader - function that can provide the Authentication header value. This is is also referred to as\n\t * the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n\t * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n\t * response payload.\n\t * @param logger - a logger that can capture performance and diagnostic information\n\t * @param cache - This caches response for joinSession.\n\t * @param hostPolicy - This host constructed policy which customizes service behavior.\n\t * @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tpublic static async create(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tgetWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tcache: IOdspCache,\n\t\thostPolicy: HostStoragePolicy,\n\t\tepochTracker: EpochTracker,\n\t\tsocketReferenceKeyPrefix?: string,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new OdspDocumentService(\n\t\t\tgetOdspResolvedUrl(resolvedUrl),\n\t\t\tgetAuthHeader,\n\t\t\tgetWebsocketToken,\n\t\t\tlogger,\n\t\t\tcache,\n\t\t\thostPolicy,\n\t\t\tepochTracker,\n\t\t\tsocketReferenceKeyPrefix,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n\n\tprivate storageManager?: OdspDocumentStorageService;\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly hostPolicy: HostStoragePolicyInternal;\n\n\tprivate _opsCache?: OpsCache;\n\n\t/**\n\t * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n\t * @param getAuthHeader - function that can provide the Authentication header value. This is is also referred to as\n\t * the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n\t * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n\t * response payload.\n\t * @param logger - a logger that can capture performance and diagnostic information\n\t * @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver\n\t * @param cache - This caches response for joinSession.\n\t * @param hostPolicy - host constructed policy which customizes service behavior.\n\t * @param epochTracker - This helper class which adds epoch to backend calls made by this service instance.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tprivate constructor(\n\t\tpublic readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tprivate readonly getAuthHeader: InstrumentedStorageTokenFetcher,\n\t\tprivate readonly getWebsocketToken:\n\t\t\t| ((options: TokenFetchOptions) => Promise<string | null>)\n\t\t\t| undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly cache: IOdspCache,\n\t\thostPolicy: HostStoragePolicy,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly socketReferenceKeyPrefix?: string,\n\t\tprivate readonly clientIsSummarizer?: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._policies = {\n\t\t\t// load in storage-only mode if a file version is specified\n\t\t\tstorageOnly: odspResolvedUrl.fileVersion !== undefined,\n\t\t\tsummarizeProtocolTree: true,\n\t\t\tsupportGetSnapshotApi: true,\n\t\t};\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\todc: hasOdcOrigin(new URL(this.odspResolvedUrl.endpoints.snapshotStorageUrl)),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tthis.hostPolicy = hostPolicy;\n\t\tthis.hostPolicy.supportGetSnapshotApi = this._policies.supportGetSnapshotApi;\n\t\tif (this.clientIsSummarizer) {\n\t\t\tthis.hostPolicy = { ...this.hostPolicy, summarizerClient: true };\n\t\t}\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\tpublic get policies(): IDocumentServicePolicies {\n\t\treturn this._policies;\n\t}\n\n\t/**\n\t * Connects to a storage endpoint for snapshot service.\n\t *\n\t * @returns returns the document storage service for sharepoint driver.\n\t */\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\tif (!this.storageManager) {\n\t\t\tthis.storageManager = new OdspDocumentStorageService(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\tthis.getAuthHeader,\n\t\t\t\tthis.mc.logger,\n\t\t\t\ttrue,\n\t\t\t\tthis.cache,\n\t\t\t\tthis.hostPolicy,\n\t\t\t\tthis.epochTracker,\n\t\t\t\t// flushCallback\n\t\t\t\tasync () => {\n\t\t\t\t\tconst currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;\n\t\t\t\t\tif (currentConnection !== undefined && !currentConnection.disposed) {\n\t\t\t\t\t\treturn currentConnection.flush();\n\t\t\t\t\t}\n\t\t\t\t\tthrow new Error(\"Disconnected while uploading summary (attempt to perform flush())\");\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\treturn this.odspDelayLoadedDeltaStream?.relayServiceTenantAndSessionId;\n\t\t\t\t},\n\t\t\t\tthis.mc.config.getNumber(\"Fluid.Driver.Odsp.snapshotFormatFetchType\"),\n\t\t\t);\n\t\t}\n\n\t\treturn new RetryErrorsStorageAdapter(this.storageManager, this.mc.logger);\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint for getting ops between a range.\n\t *\n\t * @returns returns the document delta storage service for sharepoint driver.\n\t */\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tconst snapshotOps = this.storageManager?.ops ?? [];\n\t\tconst service = new OdspDeltaStorageService(\n\t\t\tthis.odspResolvedUrl.endpoints.deltaStorageUrl,\n\t\t\tthis.getAuthHeader,\n\t\t\tthis.epochTracker,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// batch size, please see issue #5211 for data around batch sizing\n\t\tconst batchSize = this.hostPolicy.opsBatchSize ?? 5000;\n\t\tconst concurrency = this.hostPolicy.concurrentOpsBatches ?? 1;\n\t\treturn new OdspDeltaStorageWithCache(\n\t\t\tsnapshotOps,\n\t\t\tthis.mc.logger,\n\t\t\tbatchSize,\n\t\t\tconcurrency,\n\t\t\t// Get Ops from storage callback.\n\t\t\tasync (from, to, telemetryProps, fetchReason) =>\n\t\t\t\tservice.get(from, to, telemetryProps, fetchReason),\n\t\t\t// Get cachedOps Callback.\n\t\t\tasync (from, to) => {\n\t\t\t\tconst res = await this.opsCache?.get(from, to);\n\t\t\t\treturn (res as ISequencedDocumentMessage[]) ?? [];\n\t\t\t},\n\t\t\t// Ops requestFromSocket Callback.\n\t\t\t(from, to) => {\n\t\t\t\tconst currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;\n\t\t\t\tif (currentConnection !== undefined && !currentConnection.disposed) {\n\t\t\t\t\tcurrentConnection.requestOps(from, to);\n\t\t\t\t}\n\t\t\t},\n\t\t\t(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n\t\t\t() => this.storageManager,\n\t\t);\n\t}\n\n\t/**\n\t * Connects to a delta stream endpoint for emitting ops.\n\t *\n\t * @returns returns the document delta stream service for onedrive/sharepoint driver.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\tif (this.socketModuleP === undefined) {\n\t\t\tthis.socketModuleP = this.getDelayLoadedDeltaStream();\n\t\t}\n\t\treturn this.socketModuleP\n\t\t\t.then(async (m) => {\n\t\t\t\tthis.odspSocketModuleLoaded = true;\n\t\t\t\treturn m.connectToDeltaStream(client);\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t// Setting undefined in case someone tries to recover from module failure by calling again.\n\t\t\t\tthis.socketModuleP = undefined;\n\t\t\t\tthis.odspSocketModuleLoaded = false;\n\t\t\t\tthrow error;\n\t\t\t});\n\t}\n\n\t/**\n\t * This dynamically imports the module for loading the delta connection. In many cases the delta stream, is not\n\t * required during the critical load flow. So this way we don't have to bundle this in the initial bundle and can\n\t * import this later on when required.\n\t * @returns The delta stream object.\n\t */\n\tprivate async getDelayLoadedDeltaStream(): Promise<OdspDelayLoadedDeltaStream> {\n\t\tassert(this.odspSocketModuleLoaded === false, 0x507 /* Should be loaded only once */);\n\t\tconst module = await import(\n\t\t\t/* webpackChunkName: \"socketModule\" */ \"./odspDelayLoadedDeltaStream.js\"\n\t\t)\n\t\t\t.then((m) => {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"SocketModuleLoaded\" });\n\t\t\t\treturn m;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"SocketModuleLoadFailed\" }, error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tthis.odspDelayLoadedDeltaStream = new module.OdspDelayLoadedDeltaStream(\n\t\t\tthis.odspResolvedUrl,\n\t\t\tthis._policies,\n\t\t\tthis.getAuthHeader,\n\t\t\tthis.getWebsocketToken,\n\t\t\tthis.mc,\n\t\t\tthis.cache,\n\t\t\tthis.hostPolicy,\n\t\t\tthis.epochTracker,\n\t\t\t(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n\t\t\t(metadata: Record<string, string>) => this.emit(\"metadataUpdate\", metadata),\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t);\n\t\treturn this.odspDelayLoadedDeltaStream;\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\t// Error might indicate mismatch between client & server knowledge about file\n\t\t// (OdspErrorTypes.fileOverwrittenInStorage).\n\t\t// For example, file might have been overwritten in storage without generating new epoch\n\t\t// In such case client cached info is stale and has to be removed.\n\t\tif (error === undefined) {\n\t\t\tthis._opsCache?.flushOps();\n\t\t} else {\n\t\t\tthis.epochTracker.removeEntries().catch(() => {});\n\t\t}\n\t\tthis._opsCache?.dispose();\n\t\t// Only need to dipose this, if it is already loaded.\n\t\tthis.odspDelayLoadedDeltaStream?.dispose();\n\t}\n\n\tprotected get opsCache(): OpsCache | undefined {\n\t\tif (this._opsCache) {\n\t\t\treturn this._opsCache;\n\t\t}\n\n\t\tconst seqNumber = this.storageManager?.snapshotSequenceNumber;\n\t\tconst batchSize = this.hostPolicy.opsCaching?.batchSize ?? 100;\n\t\tif (seqNumber === undefined || batchSize < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst opsKey: Omit<IEntry, \"key\"> = {\n\t\t\ttype: \"ops\",\n\t\t};\n\t\tthis._opsCache = new OpsCache(\n\t\t\tseqNumber,\n\t\t\tthis.mc.logger,\n\t\t\t// ICache\n\t\t\t{\n\t\t\t\twrite: async (key: string, opsData: string): Promise<void> => {\n\t\t\t\t\treturn this.cache.persistedCache.put({ ...opsKey, key }, opsData);\n\t\t\t\t},\n\t\t\t\tread: async (key: string): Promise<string | undefined> =>\n\t\t\t\t\t// typing workaround because this.cache.persistedCache.get returns `Promise<any>`\n\t\t\t\t\tthis.cache.persistedCache.get({ ...opsKey, key }) as Promise<string | undefined>,\n\t\t\t\tremove: (): void => {\n\t\t\t\t\tthis.cache.persistedCache.removeEntries().catch(() => {});\n\t\t\t\t},\n\t\t\t},\n\t\t\tbatchSize,\n\t\t\tthis.hostPolicy.opsCaching?.timerGranularity ?? 5000,\n\t\t\tthis.hostPolicy.opsCaching?.totalOpsToCache ?? 5000,\n\t\t);\n\t\treturn this._opsCache;\n\t}\n\n\t// Called whenever we receive ops through any channel for this document (snapshot, delta connection, delta storage)\n\t// We use it to notify caching layer of how stale is snapshot stored in cache.\n\tprotected opsReceived(ops: ISequencedDocumentMessage[]): void {\n\t\t// No need for two clients to save same ops\n\t\tif (ops.length === 0 || this.odspResolvedUrl.summarizer) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.opsCache?.addOps(ops);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDocumentService.js","sourceRoot":"","sources":["../src/odspDocumentService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAmB7D,OAAO,EAGN,4BAA4B,GAC5B,MAAM,0CAA0C,CAAC;AAMlD,OAAO,EACN,uBAAuB,EACvB,yBAAyB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,0BAA0B,EAAE,MAAM,iCAAiC,CAAC;AAC7E,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,QAAQ,EAAE,MAAM,iBAAiB,CAAC;AAC3C,OAAO,EAAE,yBAAyB,EAAE,M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2CAA2C;QAC3C,IAAI,GAAG,CAAC,MAAM,KAAK,CAAC,IAAI,IAAI,CAAC,eAAe,CAAC,UAAU,EAAE,CAAC;YACzD,OAAO;QACR,CAAC;QAED,IAAI,CAAC,QAAQ,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC;IAC5B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentServicePolicies,\n\tIDocumentStorageService,\n\tIEntry,\n\tIResolvedUrl,\n\tISequencedDocumentMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport type {\n\tHostStoragePolicy,\n\tIOdspResolvedUrl,\n\tInstrumentedStorageTokenFetcher,\n\tTokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\ttype MonitoringContext,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport type { HostStoragePolicyInternal } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport type { IOdspCache } from \"./odspCache.js\";\nimport type { OdspDelayLoadedDeltaStream } from \"./odspDelayLoadedDeltaStream.js\";\nimport {\n\tOdspDeltaStorageService,\n\tOdspDeltaStorageWithCache,\n} from \"./odspDeltaStorageService.js\";\nimport { OdspDocumentStorageService } from \"./odspDocumentStorageManager.js\";\nimport { hasOdcOrigin } from \"./odspUrlHelper.js\";\nimport { getOdspResolvedUrl } from \"./odspUtils.js\";\nimport { OpsCache } from \"./opsCaching.js\";\nimport { RetryErrorsStorageAdapter } from \"./retryErrorsStorageAdapter.js\";\n\n/**\n * The DocumentService manages the Socket.IO connection and manages routing requests to connected\n * clients\n */\nexport class OdspDocumentService\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tprivate readonly _policies: IDocumentServicePolicies;\n\n\t// Promise to load socket module only once.\n\tprivate socketModuleP: Promise<OdspDelayLoadedDeltaStream> | undefined;\n\n\tprivate odspDelayLoadedDeltaStream: OdspDelayLoadedDeltaStream | undefined;\n\n\tprivate odspSocketModuleLoaded: boolean = false;\n\n\t/**\n\t * Creates a new OdspDocumentService instance.\n\t *\n\t * @param resolvedUrl - resolved url identifying document that will be managed by returned service instance.\n\t * @param getAuthHeader - function that can provide the Authentication header value. This is is also referred to as\n\t * the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n\t * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n\t * response payload.\n\t * @param logger - a logger that can capture performance and diagnostic information\n\t * @param cache - This caches response for joinSession.\n\t * @param hostPolicy - This host constructed policy which customizes service behavior.\n\t * @param epochTracker - This helper class which adds epoch to backend calls made by returned service instance.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tpublic static async create(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tgetWebsocketToken: ((options: TokenFetchOptions) => Promise<string | null>) | undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tcache: IOdspCache,\n\t\thostPolicy: HostStoragePolicy,\n\t\tepochTracker: EpochTracker,\n\t\tsocketReferenceKeyPrefix?: string,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn new OdspDocumentService(\n\t\t\tgetOdspResolvedUrl(resolvedUrl),\n\t\t\tgetAuthHeader,\n\t\t\tgetWebsocketToken,\n\t\t\tlogger,\n\t\t\tcache,\n\t\t\thostPolicy,\n\t\t\tepochTracker,\n\t\t\tsocketReferenceKeyPrefix,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n\n\tprivate storageManager?: OdspDocumentStorageService;\n\n\tprivate readonly mc: MonitoringContext;\n\n\tprivate readonly hostPolicy: HostStoragePolicyInternal;\n\n\tprivate _opsCache?: OpsCache;\n\n\t/**\n\t * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n\t * @param getAuthHeader - function that can provide the Authentication header value. This is is also referred to as\n\t * the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also referred\n\t * to as the \"Push\" token in SPO. If undefined then websocket token is expected to be returned with joinSession\n\t * response payload.\n\t * @param logger - a logger that can capture performance and diagnostic information\n\t * @param socketIoClientFactory - A factory that returns a promise to the socket io library required by the driver\n\t * @param cache - This caches response for joinSession.\n\t * @param hostPolicy - host constructed policy which customizes service behavior.\n\t * @param epochTracker - This helper class which adds epoch to backend calls made by this service instance.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tprivate constructor(\n\t\tpublic readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tprivate readonly getAuthHeader: InstrumentedStorageTokenFetcher,\n\t\tprivate readonly getWebsocketToken:\n\t\t\t| ((options: TokenFetchOptions) => Promise<string | null>)\n\t\t\t| undefined,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tprivate readonly cache: IOdspCache,\n\t\thostPolicy: HostStoragePolicy,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly socketReferenceKeyPrefix?: string,\n\t\tprivate readonly clientIsSummarizer?: boolean,\n\t) {\n\t\tsuper();\n\t\tthis._policies = {\n\t\t\t// load in storage-only mode if a file version is specified\n\t\t\tstorageOnly: odspResolvedUrl.fileVersion !== undefined,\n\t\t\tsummarizeProtocolTree: true,\n\t\t\tsupportGetSnapshotApi: true,\n\t\t};\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger,\n\t\t\tproperties: {\n\t\t\t\tall: {\n\t\t\t\t\todc: hasOdcOrigin(new URL(this.odspResolvedUrl.endpoints.snapshotStorageUrl)),\n\t\t\t\t},\n\t\t\t},\n\t\t});\n\n\t\tthis.hostPolicy = hostPolicy;\n\t\tthis.hostPolicy.supportGetSnapshotApi = this._policies.supportGetSnapshotApi;\n\t\tif (this.clientIsSummarizer) {\n\t\t\tthis.hostPolicy = { ...this.hostPolicy, summarizerClient: true };\n\t\t}\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\tpublic get policies(): IDocumentServicePolicies {\n\t\treturn this._policies;\n\t}\n\n\t/**\n\t * Connects to a storage endpoint for snapshot service.\n\t *\n\t * @returns returns the document storage service for sharepoint driver.\n\t */\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\tif (!this.storageManager) {\n\t\t\tthis.storageManager = new OdspDocumentStorageService(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\tthis.getAuthHeader,\n\t\t\t\tthis.mc.logger,\n\t\t\t\ttrue,\n\t\t\t\tthis.cache,\n\t\t\t\tthis.hostPolicy,\n\t\t\t\tthis.epochTracker,\n\t\t\t\t// flushCallback\n\t\t\t\tasync () => {\n\t\t\t\t\tconst currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;\n\t\t\t\t\tif (currentConnection !== undefined && !currentConnection.disposed) {\n\t\t\t\t\t\treturn currentConnection.flush();\n\t\t\t\t\t}\n\t\t\t\t\tthrow new Error(\"Disconnected while uploading summary (attempt to perform flush())\");\n\t\t\t\t},\n\t\t\t\t() => {\n\t\t\t\t\treturn this.odspDelayLoadedDeltaStream?.relayServiceTenantAndSessionId;\n\t\t\t\t},\n\t\t\t\tthis.mc.config.getNumber(\"Fluid.Driver.Odsp.snapshotFormatFetchType\"),\n\t\t\t);\n\t\t}\n\n\t\treturn new RetryErrorsStorageAdapter(this.storageManager, this.mc.logger);\n\t}\n\n\t/**\n\t * Connects to a delta storage endpoint for getting ops between a range.\n\t *\n\t * @returns returns the document delta storage service for sharepoint driver.\n\t */\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\tconst snapshotOps = this.storageManager?.ops ?? [];\n\t\tconst service = new OdspDeltaStorageService(\n\t\t\tthis.odspResolvedUrl.endpoints.deltaStorageUrl,\n\t\t\tthis.getAuthHeader,\n\t\t\tthis.epochTracker,\n\t\t\tthis.mc.logger,\n\t\t);\n\n\t\t// batch size, please see issue #5211 for data around batch sizing\n\t\tconst batchSize = this.hostPolicy.opsBatchSize ?? 5000;\n\t\tconst concurrency = this.hostPolicy.concurrentOpsBatches ?? 1;\n\t\treturn new OdspDeltaStorageWithCache(\n\t\t\tsnapshotOps,\n\t\t\tthis.mc.logger,\n\t\t\tbatchSize,\n\t\t\tconcurrency,\n\t\t\t// Get Ops from storage callback.\n\t\t\tasync (from, to, telemetryProps, fetchReason) =>\n\t\t\t\tservice.get(from, to, telemetryProps, fetchReason),\n\t\t\t// Get cachedOps Callback.\n\t\t\tasync (from, to) => {\n\t\t\t\tconst res = await this.opsCache?.get(from, to);\n\t\t\t\treturn (res as ISequencedDocumentMessage[]) ?? [];\n\t\t\t},\n\t\t\t// Ops requestFromSocket Callback.\n\t\t\t(from, to) => {\n\t\t\t\tconst currentConnection = this.odspDelayLoadedDeltaStream?.currentDeltaConnection;\n\t\t\t\tif (currentConnection !== undefined && !currentConnection.disposed) {\n\t\t\t\t\tcurrentConnection.requestOps(from, to);\n\t\t\t\t}\n\t\t\t},\n\t\t\t(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n\t\t\t() => this.storageManager,\n\t\t);\n\t}\n\n\t/**\n\t * Connects to a delta stream endpoint for emitting ops.\n\t *\n\t * @returns returns the document delta stream service for onedrive/sharepoint driver.\n\t */\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\t// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy\n\t\tif (this.socketModuleP === undefined) {\n\t\t\tthis.socketModuleP = this.getDelayLoadedDeltaStream();\n\t\t}\n\t\treturn this.socketModuleP\n\t\t\t.then(async (m) => {\n\t\t\t\tthis.odspSocketModuleLoaded = true;\n\t\t\t\treturn m.connectToDeltaStream(client);\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\t// Setting undefined in case someone tries to recover from module failure by calling again.\n\t\t\t\tthis.socketModuleP = undefined;\n\t\t\t\tthis.odspSocketModuleLoaded = false;\n\t\t\t\tthrow error;\n\t\t\t});\n\t}\n\n\t/**\n\t * This dynamically imports the module for loading the delta connection. In many cases the delta stream, is not\n\t * required during the critical load flow. So this way we don't have to bundle this in the initial bundle and can\n\t * import this later on when required.\n\t * @returns The delta stream object.\n\t */\n\tprivate async getDelayLoadedDeltaStream(): Promise<OdspDelayLoadedDeltaStream> {\n\t\tassert(this.odspSocketModuleLoaded === false, 0x507 /* Should be loaded only once */);\n\t\tconst module = await import(\n\t\t\t/* webpackChunkName: \"socketModule\" */ \"./odspDelayLoadedDeltaStream.js\"\n\t\t)\n\t\t\t.then((m) => {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({ eventName: \"SocketModuleLoaded\" });\n\t\t\t\treturn m;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.mc.logger.sendErrorEvent({ eventName: \"SocketModuleLoadFailed\" }, error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tthis.odspDelayLoadedDeltaStream = new module.OdspDelayLoadedDeltaStream(\n\t\t\tthis.odspResolvedUrl,\n\t\t\tthis._policies,\n\t\t\tthis.getAuthHeader,\n\t\t\tthis.getWebsocketToken,\n\t\t\tthis.mc,\n\t\t\tthis.cache,\n\t\t\tthis.hostPolicy,\n\t\t\tthis.epochTracker,\n\t\t\t(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),\n\t\t\t(metadata: Record<string, string>) => this.emit(\"metadataUpdate\", metadata),\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t);\n\t\treturn this.odspDelayLoadedDeltaStream;\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\t// Error might indicate mismatch between client & server knowledge about file\n\t\t// (OdspErrorTypes.fileOverwrittenInStorage).\n\t\t// For example, file might have been overwritten in storage without generating new epoch\n\t\t// In such case client cached info is stale and has to be removed.\n\t\tif (error === undefined) {\n\t\t\tthis._opsCache?.flushOps();\n\t\t} else {\n\t\t\tthis.epochTracker.removeEntries().catch(() => {});\n\t\t}\n\t\tthis._opsCache?.dispose();\n\t\t// Only need to dipose this, if it is already loaded.\n\t\tthis.odspDelayLoadedDeltaStream?.dispose();\n\t}\n\n\tprotected get opsCache(): OpsCache | undefined {\n\t\tif (this._opsCache) {\n\t\t\treturn this._opsCache;\n\t\t}\n\n\t\tconst seqNumber = this.storageManager?.snapshotSequenceNumber;\n\t\tconst batchSize = this.hostPolicy.opsCaching?.batchSize ?? 100;\n\t\tif (seqNumber === undefined || batchSize < 1) {\n\t\t\treturn;\n\t\t}\n\n\t\tconst opsKey: Omit<IEntry, \"key\"> = {\n\t\t\ttype: \"ops\",\n\t\t};\n\t\tthis._opsCache = new OpsCache(\n\t\t\tseqNumber,\n\t\t\tthis.mc.logger,\n\t\t\t// ICache\n\t\t\t{\n\t\t\t\twrite: async (key: string, opsData: string): Promise<void> => {\n\t\t\t\t\treturn this.cache.persistedCache.put({ ...opsKey, key }, opsData);\n\t\t\t\t},\n\t\t\t\tread: async (key: string): Promise<string | undefined> =>\n\t\t\t\t\t// typing workaround because this.cache.persistedCache.get returns `Promise<any>`\n\t\t\t\t\tthis.cache.persistedCache.get({ ...opsKey, key }) as Promise<string | undefined>,\n\t\t\t\tremove: (): void => {\n\t\t\t\t\tthis.cache.persistedCache.removeEntries().catch(() => {});\n\t\t\t\t},\n\t\t\t},\n\t\t\tbatchSize,\n\t\t\tthis.hostPolicy.opsCaching?.timerGranularity ?? 5000,\n\t\t\tthis.hostPolicy.opsCaching?.totalOpsToCache ?? 5000,\n\t\t);\n\t\treturn this._opsCache;\n\t}\n\n\t// Called whenever we receive ops through any channel for this document (snapshot, delta connection, delta storage)\n\t// We use it to notify caching layer of how stale is snapshot stored in cache.\n\tprotected opsReceived(ops: ISequencedDocumentMessage[]): void {\n\t\t// No need for two clients to save same ops\n\t\tif (ops.length === 0 || this.odspResolvedUrl.summarizer) {\n\t\t\treturn;\n\t\t}\n\n\t\tthis.opsCache?.addOps(ops);\n\t}\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentStorageManager.d.ts","sourceRoot":"","sources":["../src/odspDocumentStorageManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,oCAAoC,CAAC;AACvE,OAAO,EACN,WAAW,EACX,KAAK,SAAS,EACd,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,mBAAmB,EACxB,KAAK,QAAQ,EACb,KAAK,aAAa,EAClB,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EACN,KAAK,gBAAgB,EAErB,KAAK,+BAA+B,EAEpC,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAOxB,MAAM,0CAA0C,CAAC;AAElD,OAAO,KAAK,EACX,yBAAyB,EAMzB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,EAEN,KAAK,yBAAyB,EAK9B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,KAAK,EAAE,UAAU,EAA6B,MAAM,gBAAgB,CAAC;AAC5E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,kCAAkC,CAAC;AACpE,OAAO,EAAE,8BAA8B,EAAE,MAAM,qCAAqC,CAAC;AAcrF,eAAO,MAAM,mCAAmC,EAAE,MAAkB,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,CAAC;YAyFJ,4BAA4B;IAuB1C,OAAO,CAAC,gBAAgB;IAUxB,OAAO,CAAC,sBAAsB;IAU9B,OAAO,CAAC,qBAAqB;cAUb,qBAAqB,CACpC,EAAE,EAAE,MAAM,EACV,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,SAAS,CAAC;CAyCrC"}
|
|
@@ -453,6 +453,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
453
453
|
async uploadSummaryWithContext(summary, context) {
|
|
454
454
|
this.checkSnapshotUrl();
|
|
455
455
|
// Set the module promise right away, so as to not call it twice.
|
|
456
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy
|
|
456
457
|
if (this.summaryModuleP === undefined) {
|
|
457
458
|
this.summaryModuleP = this.getDelayLoadedSummaryManager();
|
|
458
459
|
}
|
|
@@ -484,6 +485,7 @@ export class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {
|
|
|
484
485
|
await delay(1000 * (result.retryAfter ?? 1));
|
|
485
486
|
}
|
|
486
487
|
}
|
|
488
|
+
// eslint-disable-next-line @typescript-eslint/prefer-nullish-coalescing -- using ??= could change behavior if value is falsy
|
|
487
489
|
if (!this.odspSummaryUploadManager) {
|
|
488
490
|
this.odspSummaryUploadManager = await this.summaryModuleP
|
|
489
491
|
.then(async (m) => {
|