@fluidframework/odsp-driver 2.81.1 → 2.82.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +4 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/odspDelayLoadedDeltaStream.js +2 -2
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -1
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/vroom.d.ts.map +1 -1
- package/dist/vroom.js +2 -0
- package/dist/vroom.js.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.js +2 -2
- package/lib/odspDelayLoadedDeltaStream.js.map +1 -1
- package/lib/packageVersion.d.ts +1 -1
- package/lib/packageVersion.js +1 -1
- package/lib/packageVersion.js.map +1 -1
- package/lib/vroom.d.ts.map +1 -1
- package/lib/vroom.js +2 -0
- package/lib/vroom.js.map +1 -1
- package/package.json +13 -13
- package/src/odspDelayLoadedDeltaStream.ts +5 -2
- package/src/packageVersion.ts +1 -1
- package/src/vroom.ts +2 -0
- package/biome.jsonc +0 -4
package/CHANGELOG.md
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDelayLoadedDeltaStream.d.ts","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EACX,wBAAwB,EACxB,wBAAwB,EACxB,YAAY,EAEZ,yBAAyB,EAEzB,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAGrB,KAAK,+BAA+B,EAEpC,KAAK,iBAAiB,EACtB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK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;IAED,IAAW,8BAA8B,IAAI,MAAM,GAAG,SAAS,CAE9D;IAED;;OAEG;IACH,OAAO,CAAC,uBAAuB;IAa/B;;;;OAIG;IACU,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAmIrF,OAAO,CAAC,QAAQ,CAAC,aAAa,CAoB5B;IAEF,OAAO,CAAC,qBAAqB;YAOf,0BAA0B;YA4C1B,WAAW;YAkEX,eAAe;IAsG7B,OAAO,CAAC,+BAA+B;IAgBvC,OAAO,CAAC,gCAAgC;IAQxC;;;;;;;;;OASG;YACW,qBAAqB;IAkC5B,OAAO,CAAC,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;CAKrC"}
|
|
@@ -336,8 +336,8 @@ class OdspDelayLoadedDeltaStream {
|
|
|
336
336
|
return response.joinSessionResponse;
|
|
337
337
|
}
|
|
338
338
|
emitSensitivityLabelUpdateEvent(sensitivityLabelsInfo) {
|
|
339
|
-
const createdTimestamp =
|
|
340
|
-
(0, internal_1.assert)(createdTimestamp > 0, 0x8e0 /* time should be positive */);
|
|
339
|
+
const createdTimestamp = sensitivityLabelsInfo.timestamp;
|
|
340
|
+
(0, internal_1.assert)(typeof createdTimestamp === "number" && createdTimestamp > 0, 0x8e0 /* time should be a positive number */);
|
|
341
341
|
if (createdTimestamp > this.labelUpdateTimestamp) {
|
|
342
342
|
this.labelUpdateTimestamp = createdTimestamp;
|
|
343
343
|
this.metadataUpdateHandler({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDelayLoadedDeltaStream.js","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAE9D,kEAA6D;AAU7D,oEAG+C;AAC/C,yEAA2E;AAC3E,+EAS0D;AAC1D,uEAIkD;AAClD,+BAAkC;AAElC,iDAA+D;AAG/D,qFAA+E;AAC/E,iDAIwB;AACxB,2DAAkE;AAClE,y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,GAAG,IAAA,6BAAc,GAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,4DAA2B,CAAC,MAAM,CAC1D,QAAQ,EACR,UAAU,EACV,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,CAAC,EAAE,CAAC,MAAM,EACd,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,wBAAwB,EAC7B,YAAY,CACZ,CAAC;QACF,MAAM,QAAQ,GAAG,IAAA,6BAAc,GAAE,GAAG,SAAS,CAAC;QAC9C,uEAAuE;QACvE,+EAA+E;QAC/E,sDAAsD;QACtD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBACnC,SAAS,EAAE,mBAAmB;gBAC9B,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,OAAO,CAAC,KAAe;QAC7B,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,IAAI,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACpC,CAAC;CACD;AA9gBD,gEA8gBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport type { ISignalEnvelope } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentServicePolicies,\n\tIResolvedUrl,\n\tIAnyDriverError,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tDeltaStreamConnectionForbiddenError,\n\tNonRetryableError,\n} from \"@fluidframework/driver-utils/internal\";\nimport { hasFacetCodes } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport {\n\ttype HostStoragePolicy,\n\ttype IOdspError,\n\ttype IOdspResolvedUrl,\n\ttype ISocketStorageDiscovery,\n\ttype ISensitivityLabelsInfo,\n\ttype InstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\ttype TokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\ttype MonitoringContext,\n\tnormalizeError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { policyLabelsUpdatesSignalType } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport type { IOdspCache } from \"./odspCache.js\";\nimport { OdspDocumentDeltaConnection } from \"./odspDocumentDeltaConnection.js\";\nimport {\n\ttype TokenFetchOptionsEx,\n\tgetJoinSessionCacheKey,\n\tgetWithRetryForTokenRefresh,\n} from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { fetchJoinSession } from \"./vroom.js\";\n\n/**\n * This OdspDelayLoadedDeltaStream is used by OdspDocumentService.ts to delay load the delta connection\n * as they are not on critical path of loading a container.\n */\nexport class OdspDelayLoadedDeltaStream {\n\t// Timer which runs and executes the join session call after intervals.\n\tprivate joinSessionRefreshTimer: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate readonly joinSessionKey: string;\n\n\tprivate currentConnection?: OdspDocumentDeltaConnection;\n\n\tprivate _relayServiceTenantAndSessionId: string | undefined;\n\n\tprivate firstConnectionAttempt = true;\n\n\t// Tracks the time at which the Policy Labels were updated the last time. This is used to resolve race conditions\n\t// between label updates from the join session and the Fluid signals and they could have same or different timestamps.\n\t// So this timestamp is updated with timestamp from the service/signals with the most recent timestamp. We could also\n\t// receive stale data from join session as that call is made at intervals, so we need to update with only most recent data.\n\tprivate labelUpdateTimestamp: number = -1;\n\n\t/**\n\t * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n\t * @param policies - Document service policies.\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 mc - a logger that can capture performance and diagnostic information\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 opsReceived - To register the ops received through socket.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tpublic constructor(\n\t\tpublic readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tpublic policies: IDocumentServicePolicies,\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\tprivate readonly mc: MonitoringContext,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicy,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,\n\t\tprivate readonly metadataUpdateHandler: (metadata: Record<string, string>) => void,\n\t\tprivate readonly socketReferenceKeyPrefix?: string,\n\t) {\n\t\tthis.joinSessionKey = getJoinSessionCacheKey(this.odspResolvedUrl);\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\n\tpublic get currentDeltaConnection(): OdspDocumentDeltaConnection | undefined {\n\t\treturn this.currentConnection;\n\t}\n\n\tpublic get relayServiceTenantAndSessionId(): string | undefined {\n\t\treturn this._relayServiceTenantAndSessionId;\n\t}\n\n\t/**\n\t * Annotate the given error indicating which connection step failed\n\t */\n\tprivate annotateConnectionError(\n\t\terror: unknown,\n\t\tfailedConnectionStep: string,\n\t\tseparateTokenRequest: boolean,\n\t): IFluidErrorBase {\n\t\treturn normalizeError(error, {\n\t\t\tprops: {\n\t\t\t\tfailedConnectionStep,\n\t\t\t\tseparateTokenRequest,\n\t\t\t},\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\tassert(\n\t\t\tthis.currentConnection === undefined,\n\t\t\t0x4ad /* Should not be called when connection is already present! */,\n\t\t);\n\t\t// Attempt to connect twice, in case we used expired token.\n\t\treturn getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {\n\t\t\t// Presence of getWebsocketToken callback dictates whether callback is used for fetching\n\t\t\t// websocket token or whether it is returned with joinSession response payload\n\t\t\tconst requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;\n\t\t\tconst websocketTokenPromise = requestWebsocketTokenFromJoinSession\n\t\t\t\t? // eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tPromise.resolve(null)\n\t\t\t\t: this.getWebsocketToken(options);\n\n\t\t\tconst annotateAndRethrowConnectionError = (step: string) => (error: unknown) => {\n\t\t\t\tthrow this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);\n\t\t\t};\n\n\t\t\t// Log telemetry for join session attempt\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstJoinSessionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\trequestWebsocketToken: requestWebsocketTokenFromJoinSession,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst joinSessionPromise = this.joinSession(\n\t\t\t\trequestWebsocketTokenFromJoinSession,\n\t\t\t\toptions,\n\t\t\t\tfalse /* isRefreshingJoinSession */,\n\t\t\t\tundefined /* clientId */,\n\t\t\t\tthis.hostPolicy.sessionOptions?.displayName,\n\t\t\t);\n\t\t\tconst [websocketEndpoint, websocketToken] = await Promise.all([\n\t\t\t\tjoinSessionPromise.catch(annotateAndRethrowConnectionError(\"joinSession\")),\n\t\t\t\twebsocketTokenPromise.catch(annotateAndRethrowConnectionError(\"getWebsocketToken\")),\n\t\t\t]);\n\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst finalWebsocketToken = websocketToken ?? websocketEndpoint.socketToken ?? null;\n\t\t\tif (finalWebsocketToken === null) {\n\t\t\t\tthrow this.annotateConnectionError(\n\t\t\t\t\tnew NonRetryableError(\"Websocket token is null\", OdspErrorTypes.fetchTokenError, {\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t}),\n\t\t\t\t\t\"getWebsocketToken\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (websocketEndpoint.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(websocketEndpoint.sensitivityLabelsInfo);\n\t\t\t}\n\n\t\t\tconst connectionId = uuid();\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.firstConnectionAttempt = false;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstConnectionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tconnectionId,\n\t\t\t\t\t\ttenantId: websocketEndpoint.tenantId,\n\t\t\t\t\t\tdocumentId: websocketEndpoint.id,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst connection = await this.createDeltaConnection(\n\t\t\t\t\twebsocketEndpoint.tenantId,\n\t\t\t\t\twebsocketEndpoint.id,\n\t\t\t\t\tfinalWebsocketToken,\n\t\t\t\t\tclient,\n\t\t\t\t\twebsocketEndpoint.deltaStreamSocketUrl,\n\t\t\t\t\tconnectionId,\n\t\t\t\t);\n\t\t\t\tconnection.on(\"op\", (documentId, ops: ISequencedDocumentMessage[]) => {\n\t\t\t\t\tthis.opsReceived(ops);\n\t\t\t\t});\n\t\t\t\tconnection.on(\"signal\", this.signalHandler);\n\t\t\t\t// Also process the initial signals\n\t\t\t\tthis.signalHandler(connection.initialSignals);\n\t\t\t\t// On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again\n\t\t\t\t// get the auth error on reconnecting and face latency.\n\t\t\t\tconnection.once(\"disconnect\", (error: unknown) => {\n\t\t\t\t\t// Clear the join session refresh timer so that it can be restarted on reconnection.\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t\terror !== null &&\n\t\t\t\t\t\t(error as Partial<IOdspError>).errorType === OdspErrorTypes.authorizationError\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t\t}\n\t\t\t\t\t// If we hit this assert, it means that \"disconnect\" event is emitted before the connection went through\n\t\t\t\t\t// dispose flow which is not correct and could lead to a bunch of errors.\n\t\t\t\t\tassert(connection.disposed, 0x4ae /* Connection should be disposed by now */);\n\t\t\t\t\tthis.currentConnection = undefined;\n\t\t\t\t});\n\t\t\t\tthis.currentConnection = connection;\n\t\t\t\treturn connection;\n\t\t\t} catch (error) {\n\t\t\t\t// Remove join session information from cache only if it is an error is from socket event connect_document_error.\n\t\t\t\t// Otherwise keep it in cache so that this session can be re-used after disconnection.\n\t\t\t\t// Also keeping an undefined check here to account for any unknown code path that is unable to stamp the value as in that case also\n\t\t\t\t// it is safer to clear join session cache and start over.\n\t\t\t\tif (\n\t\t\t\t\terror &&\n\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t((error as IAnyDriverError).scenarioName === \"connect_document_error\" ||\n\t\t\t\t\t\t(error as IAnyDriverError).scenarioName === undefined)\n\t\t\t\t) {\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t}\n\t\t\t\tconst normalizedError = this.annotateConnectionError(\n\t\t\t\t\terror,\n\t\t\t\t\t\"createDeltaConnection\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\t\tnormalizedError.addTelemetryProperties({\n\t\t\t\t\t\tsocketDocumentId: websocketEndpoint.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthrow normalizedError;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate readonly signalHandler = (signalsArg: ISignalMessage | ISignalMessage[]): void => {\n\t\tconst signals = Array.isArray(signalsArg) ? signalsArg : [signalsArg];\n\t\tfor (const signal of signals) {\n\t\t\t// Make sure it is not for a specific client as `PolicyLabelsUpdate` is meant for all clients.\n\t\t\tif (signal.clientId === null) {\n\t\t\t\t// We could have some issues/irregularities in parsing signals, so put it in try/catch block\n\t\t\t\t// and ignore the error as we can have labels update later on through join session response.\n\t\t\t\tlet envelope: ISignalEnvelope | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tenvelope = JSON.parse(signal.content as string) as ISignalEnvelope;\n\t\t\t\t} catch {\n\t\t\t\t\t// Drop error\n\t\t\t\t}\n\t\t\t\tif (envelope?.contents?.type === policyLabelsUpdatesSignalType) {\n\t\t\t\t\tthis.emitSensitivityLabelUpdateEvent(\n\t\t\t\t\t\tenvelope.contents.content as ISensitivityLabelsInfo,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate clearJoinSessionTimer(): void {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tclearTimeout(this.joinSessionRefreshTimer);\n\t\t\tthis.joinSessionRefreshTimer = undefined;\n\t\t}\n\t}\n\n\tprivate async scheduleJoinSessionRefresh(\n\t\tdelta: number,\n\t\trequestSocketToken: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<void> {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\tconst originalStackTraceLimit = (Error as any).stackTraceLimit;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = 50;\n\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DuplicateJoinSessionRefresh\",\n\t\t\t\t},\n\t\t\t\tnew Error(\"DuplicateJoinSessionRefresh\"),\n\t\t\t);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = originalStackTraceLimit;\n\t\t}\n\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tthis.joinSessionRefreshTimer = setTimeout(() => {\n\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t// Clear the timer as it is going to be scheduled again as part of refreshing join session.\n\t\t\t\tgetWithRetryForTokenRefresh(async (options) => {\n\t\t\t\t\tawait this.joinSession(\n\t\t\t\t\t\trequestSocketToken,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttrue /* isRefreshingJoinSession */,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t);\n\t\t\t\t\tresolve();\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t\t}, delta);\n\t\t});\n\t}\n\n\tprivate async joinSession(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\t// If this call is to refresh the join session for the current connection but we are already disconnected in\n\t\t// the meantime or disconnected and then reconnected then do not make the call. However, we should not have\n\t\t// come here if that is the case because timer should have been disposed, but due to race condition with the\n\t\t// timer we should not make the call and throw error.\n\t\tif (\n\t\t\tisRefreshingJoinSession &&\n\t\t\t(this.currentConnection === undefined ||\n\t\t\t\t(clientId !== undefined && this.currentConnection.clientId !== clientId))\n\t\t) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"JoinSessionRefreshTimerNotCancelled\",\n\t\t\t\tOdspErrorTypes.genericError,\n\t\t\t\t{\n\t\t\t\t\tdriverVersion,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tschedulerClientId: clientId,\n\t\t\t\t\t\tcurrentClientId: this.currentConnection?.clientId,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tconst response = await this.joinSessionCore(\n\t\t\trequestSocketToken,\n\t\t\toptions,\n\t\t\tisRefreshingJoinSession,\n\t\t\tdisplayName,\n\t\t).catch((error) => {\n\t\t\tif (hasFacetCodes(error) && error.facetCodes !== undefined) {\n\t\t\t\tfor (const code of error.facetCodes) {\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\tcase \"sessionForbidden\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnPreservedFiles\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnModerationEnabledLibrary\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnRequireCheckout\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnCheckoutFile\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnInvisibleMinorVersion\": {\n\t\t\t\t\t\t\t// This document can only be opened in storage-only mode.\n\t\t\t\t\t\t\t// DeltaManager will recognize this error\n\t\t\t\t\t\t\t// and load without a delta stream connection.\n\t\t\t\t\t\t\tthis.policies = { ...this.policies, storageOnly: true };\n\t\t\t\t\t\t\tthrow new DeltaStreamConnectionForbiddenError(\n\t\t\t\t\t\t\t\t`Storage-only due to ${code}`,\n\t\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t\tthis._relayServiceTenantAndSessionId = `${response.tenantId}/${response.id}`;\n\t\treturn response;\n\t}\n\n\tprivate async joinSessionCore(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\tconst disableJoinSessionRefresh = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.disableJoinSessionRefresh\",\n\t\t);\n\t\tconst setSensitivityLabelHeader = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.setSensitivityLabelHeader\",\n\t\t);\n\t\tconst executeFetch = async (): Promise<{\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst joinSessionResponse = await fetchJoinSession(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\"opStream/joinSession\",\n\t\t\t\t\"POST\",\n\t\t\t\tthis.mc.logger,\n\t\t\t\tthis.getAuthHeader,\n\t\t\t\tthis.epochTracker,\n\t\t\t\trequestSocketToken,\n\t\t\t\toptions,\n\t\t\t\tdisableJoinSessionRefresh,\n\t\t\t\tsetSensitivityLabelHeader,\n\t\t\t\tisRefreshingJoinSession,\n\t\t\t\tdisplayName,\n\t\t\t);\n\t\t\t// Emit event only in case it is fetched from the network.\n\t\t\tif (joinSessionResponse.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(joinSessionResponse.sensitivityLabelsInfo);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tentryTime: Date.now(),\n\t\t\t\tjoinSessionResponse,\n\t\t\t};\n\t\t};\n\n\t\tconst getResponseAndRefreshAfterDeltaMs = async (): Promise<{\n\t\t\trefreshAfterDeltaMs: number;\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst _response = await this.cache.sessionJoinCache.addOrGet(\n\t\t\t\tthis.joinSessionKey,\n\t\t\t\texecuteFetch,\n\t\t\t);\n\t\t\t// If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the\n\t\t\t// cache entry to be treated as expired after 1 hour.\n\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds =\n\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds ?? 3600;\n\t\t\treturn {\n\t\t\t\t..._response,\n\t\t\t\trefreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(\n\t\t\t\t\t_response.entryTime,\n\t\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\t),\n\t\t\t};\n\t\t};\n\t\tlet response = await getResponseAndRefreshAfterDeltaMs();\n\t\t// This means that the cached entry has expired(This should not be possible if the response is fetched\n\t\t// from the network call). In this case we remove the cached entry and fetch the new response.\n\t\tif (response.refreshAfterDeltaMs <= 0) {\n\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\tresponse = await getResponseAndRefreshAfterDeltaMs();\n\t\t}\n\t\tif (!disableJoinSessionRefresh) {\n\t\t\tconst props = {\n\t\t\t\tentryTime: response.entryTime,\n\t\t\t\trefreshSessionDurationSeconds:\n\t\t\t\t\tresponse.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\trefreshAfterDeltaMs: response.refreshAfterDeltaMs,\n\t\t\t};\n\t\t\tif (response.refreshAfterDeltaMs > 0) {\n\t\t\t\tthis.scheduleJoinSessionRefresh(\n\t\t\t\t\tresponse.refreshAfterDeltaMs,\n\t\t\t\t\trequestSocketToken,\n\t\t\t\t\tthis.currentConnection?.clientId,\n\t\t\t\t\tdisplayName,\n\t\t\t\t).catch((error) => {\n\t\t\t\t\t// Log the error and do nothing as the reconnection would fetch the join session.\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"JoinSessionRefreshError\",\n\t\t\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Logging just for informational purposes to help with debugging as this is a new feature.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"JoinSessionRefreshNotScheduled\",\n\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn response.joinSessionResponse;\n\t}\n\n\tprivate emitSensitivityLabelUpdateEvent(\n\t\tsensitivityLabelsInfo: ISensitivityLabelsInfo,\n\t): void {\n\t\tconst createdTimestamp = Date.parse(sensitivityLabelsInfo.timestamp);\n\t\tassert(createdTimestamp > 0, 0x8e0 /* time should be positive */);\n\t\tif (createdTimestamp > this.labelUpdateTimestamp) {\n\t\t\tthis.labelUpdateTimestamp = createdTimestamp;\n\t\t\tthis.metadataUpdateHandler({\n\t\t\t\tsensitivityLabelsInfo: JSON.stringify(sensitivityLabelsInfo),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate calculateJoinSessionRefreshDelta(\n\t\tresponseFetchTime: number,\n\t\trefreshSessionDurationSeconds: number,\n\t): number {\n\t\t// 30 seconds is buffer time to refresh the session.\n\t\treturn responseFetchTime + (refreshSessionDurationSeconds * 1000 - 30000) - Date.now();\n\t}\n\n\t/**\n\t * Creates a connection to the given delta stream endpoint\n\t *\n\t * @param tenantId - the ID of the tenant\n\t * @param documentId - document ID\n\t * @param token - authorization token for delta service\n\t * @param client - information about the client\n\t * @param webSocketUrl - websocket URL\n\t * @param connectionId - connection ID for the connection\n\t */\n\tprivate async createDeltaConnection(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\ttoken: string | null,\n\t\tclient: IClient,\n\t\twebSocketUrl: string,\n\t\tconnectionId: string,\n\t): Promise<OdspDocumentDeltaConnection> {\n\t\tconst startTime = performanceNow();\n\t\tconst connection = await OdspDocumentDeltaConnection.create(\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\ttoken,\n\t\t\tclient,\n\t\t\twebSocketUrl,\n\t\t\tthis.mc.logger,\n\t\t\t60000,\n\t\t\tthis.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tconnectionId,\n\t\t);\n\t\tconst duration = performanceNow() - startTime;\n\t\t// This event happens rather often, so it adds up to cost of telemetry.\n\t\t// Given that most reconnects result in reusing socket and happen very quickly,\n\t\t// report event only if it took longer than threshold.\n\t\tif (duration >= 2000) {\n\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"ConnectionSuccess\",\n\t\t\t\tduration,\n\t\t\t});\n\t\t}\n\t\treturn connection;\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\tthis.clearJoinSessionTimer();\n\t\tthis.currentConnection?.dispose();\n\t\tthis.currentConnection = undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDelayLoadedDeltaStream.js","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAE9D,kEAA6D;AAU7D,oEAG+C;AAC/C,yEAA2E;AAC3E,+EAS0D;AAC1D,uEAIkD;AAClD,+BAAkC;AAElC,iDAA+D;AAG/D,qFAA+E;AAC/E,iDAIwB;AACxB,2DAAkE;AAClE,yCAA8C;AAE9C;;;GAGG;AACH,MAAa,0BAA0B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,MAAM,UAAU,GAAG,MAAM,4DAA2B,CAAC,MAAM,CAC1D,QAAQ,EACR,UAAU,EACV,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,CAAC,EAAE,CAAC,MAAM,EACd,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,wBAAwB,EAC7B,YAAY,CACZ,CAAC;QACF,MAAM,QAAQ,GAAG,IAAA,6BAAc,GAAE,GAAG,SAAS,CAAC;QAC9C,uEAAuE;QACvE,+EAA+E;QAC/E,sDAAsD;QACtD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBACnC,SAAS,EAAE,mBAAmB;gBAC9B,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,OAAO,CAAC,KAAe;QAC7B,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,IAAI,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACpC,CAAC;CACD;AAjhBD,gEAihBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport type { ISignalEnvelope } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentServicePolicies,\n\tIResolvedUrl,\n\tIAnyDriverError,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tDeltaStreamConnectionForbiddenError,\n\tNonRetryableError,\n} from \"@fluidframework/driver-utils/internal\";\nimport { hasFacetCodes } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport {\n\ttype HostStoragePolicy,\n\ttype IOdspError,\n\ttype IOdspResolvedUrl,\n\ttype ISocketStorageDiscovery,\n\ttype ISensitivityLabelsInfo,\n\ttype InstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\ttype TokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\ttype MonitoringContext,\n\tnormalizeError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { policyLabelsUpdatesSignalType } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport type { IOdspCache } from \"./odspCache.js\";\nimport { OdspDocumentDeltaConnection } from \"./odspDocumentDeltaConnection.js\";\nimport {\n\ttype TokenFetchOptionsEx,\n\tgetJoinSessionCacheKey,\n\tgetWithRetryForTokenRefresh,\n} from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { fetchJoinSession } from \"./vroom.js\";\n\n/**\n * This OdspDelayLoadedDeltaStream is used by OdspDocumentService.ts to delay load the delta connection\n * as they are not on critical path of loading a container.\n */\nexport class OdspDelayLoadedDeltaStream {\n\t// Timer which runs and executes the join session call after intervals.\n\tprivate joinSessionRefreshTimer: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate readonly joinSessionKey: string;\n\n\tprivate currentConnection?: OdspDocumentDeltaConnection;\n\n\tprivate _relayServiceTenantAndSessionId: string | undefined;\n\n\tprivate firstConnectionAttempt = true;\n\n\t// Tracks the time at which the Policy Labels were updated the last time. This is used to resolve race conditions\n\t// between label updates from the join session and the Fluid signals and they could have same or different timestamps.\n\t// So this timestamp is updated with timestamp from the service/signals with the most recent timestamp. We could also\n\t// receive stale data from join session as that call is made at intervals, so we need to update with only most recent data.\n\tprivate labelUpdateTimestamp: number = -1;\n\n\t/**\n\t * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n\t * @param policies - Document service policies.\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 mc - a logger that can capture performance and diagnostic information\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 opsReceived - To register the ops received through socket.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tpublic constructor(\n\t\tpublic readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tpublic policies: IDocumentServicePolicies,\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\tprivate readonly mc: MonitoringContext,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicy,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,\n\t\tprivate readonly metadataUpdateHandler: (metadata: Record<string, string>) => void,\n\t\tprivate readonly socketReferenceKeyPrefix?: string,\n\t) {\n\t\tthis.joinSessionKey = getJoinSessionCacheKey(this.odspResolvedUrl);\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\n\tpublic get currentDeltaConnection(): OdspDocumentDeltaConnection | undefined {\n\t\treturn this.currentConnection;\n\t}\n\n\tpublic get relayServiceTenantAndSessionId(): string | undefined {\n\t\treturn this._relayServiceTenantAndSessionId;\n\t}\n\n\t/**\n\t * Annotate the given error indicating which connection step failed\n\t */\n\tprivate annotateConnectionError(\n\t\terror: unknown,\n\t\tfailedConnectionStep: string,\n\t\tseparateTokenRequest: boolean,\n\t): IFluidErrorBase {\n\t\treturn normalizeError(error, {\n\t\t\tprops: {\n\t\t\t\tfailedConnectionStep,\n\t\t\t\tseparateTokenRequest,\n\t\t\t},\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\tassert(\n\t\t\tthis.currentConnection === undefined,\n\t\t\t0x4ad /* Should not be called when connection is already present! */,\n\t\t);\n\t\t// Attempt to connect twice, in case we used expired token.\n\t\treturn getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {\n\t\t\t// Presence of getWebsocketToken callback dictates whether callback is used for fetching\n\t\t\t// websocket token or whether it is returned with joinSession response payload\n\t\t\tconst requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;\n\t\t\tconst websocketTokenPromise = requestWebsocketTokenFromJoinSession\n\t\t\t\t? // eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tPromise.resolve(null)\n\t\t\t\t: this.getWebsocketToken(options);\n\n\t\t\tconst annotateAndRethrowConnectionError = (step: string) => (error: unknown) => {\n\t\t\t\tthrow this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);\n\t\t\t};\n\n\t\t\t// Log telemetry for join session attempt\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstJoinSessionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\trequestWebsocketToken: requestWebsocketTokenFromJoinSession,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst joinSessionPromise = this.joinSession(\n\t\t\t\trequestWebsocketTokenFromJoinSession,\n\t\t\t\toptions,\n\t\t\t\tfalse /* isRefreshingJoinSession */,\n\t\t\t\tundefined /* clientId */,\n\t\t\t\tthis.hostPolicy.sessionOptions?.displayName,\n\t\t\t);\n\t\t\tconst [websocketEndpoint, websocketToken] = await Promise.all([\n\t\t\t\tjoinSessionPromise.catch(annotateAndRethrowConnectionError(\"joinSession\")),\n\t\t\t\twebsocketTokenPromise.catch(annotateAndRethrowConnectionError(\"getWebsocketToken\")),\n\t\t\t]);\n\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst finalWebsocketToken = websocketToken ?? websocketEndpoint.socketToken ?? null;\n\t\t\tif (finalWebsocketToken === null) {\n\t\t\t\tthrow this.annotateConnectionError(\n\t\t\t\t\tnew NonRetryableError(\"Websocket token is null\", OdspErrorTypes.fetchTokenError, {\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t}),\n\t\t\t\t\t\"getWebsocketToken\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (websocketEndpoint.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(websocketEndpoint.sensitivityLabelsInfo);\n\t\t\t}\n\n\t\t\tconst connectionId = uuid();\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.firstConnectionAttempt = false;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstConnectionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tconnectionId,\n\t\t\t\t\t\ttenantId: websocketEndpoint.tenantId,\n\t\t\t\t\t\tdocumentId: websocketEndpoint.id,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst connection = await this.createDeltaConnection(\n\t\t\t\t\twebsocketEndpoint.tenantId,\n\t\t\t\t\twebsocketEndpoint.id,\n\t\t\t\t\tfinalWebsocketToken,\n\t\t\t\t\tclient,\n\t\t\t\t\twebsocketEndpoint.deltaStreamSocketUrl,\n\t\t\t\t\tconnectionId,\n\t\t\t\t);\n\t\t\t\tconnection.on(\"op\", (documentId, ops: ISequencedDocumentMessage[]) => {\n\t\t\t\t\tthis.opsReceived(ops);\n\t\t\t\t});\n\t\t\t\tconnection.on(\"signal\", this.signalHandler);\n\t\t\t\t// Also process the initial signals\n\t\t\t\tthis.signalHandler(connection.initialSignals);\n\t\t\t\t// On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again\n\t\t\t\t// get the auth error on reconnecting and face latency.\n\t\t\t\tconnection.once(\"disconnect\", (error: unknown) => {\n\t\t\t\t\t// Clear the join session refresh timer so that it can be restarted on reconnection.\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t\terror !== null &&\n\t\t\t\t\t\t(error as Partial<IOdspError>).errorType === OdspErrorTypes.authorizationError\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t\t}\n\t\t\t\t\t// If we hit this assert, it means that \"disconnect\" event is emitted before the connection went through\n\t\t\t\t\t// dispose flow which is not correct and could lead to a bunch of errors.\n\t\t\t\t\tassert(connection.disposed, 0x4ae /* Connection should be disposed by now */);\n\t\t\t\t\tthis.currentConnection = undefined;\n\t\t\t\t});\n\t\t\t\tthis.currentConnection = connection;\n\t\t\t\treturn connection;\n\t\t\t} catch (error) {\n\t\t\t\t// Remove join session information from cache only if it is an error is from socket event connect_document_error.\n\t\t\t\t// Otherwise keep it in cache so that this session can be re-used after disconnection.\n\t\t\t\t// Also keeping an undefined check here to account for any unknown code path that is unable to stamp the value as in that case also\n\t\t\t\t// it is safer to clear join session cache and start over.\n\t\t\t\tif (\n\t\t\t\t\terror &&\n\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t((error as IAnyDriverError).scenarioName === \"connect_document_error\" ||\n\t\t\t\t\t\t(error as IAnyDriverError).scenarioName === undefined)\n\t\t\t\t) {\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t}\n\t\t\t\tconst normalizedError = this.annotateConnectionError(\n\t\t\t\t\terror,\n\t\t\t\t\t\"createDeltaConnection\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\t\tnormalizedError.addTelemetryProperties({\n\t\t\t\t\t\tsocketDocumentId: websocketEndpoint.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthrow normalizedError;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate readonly signalHandler = (signalsArg: ISignalMessage | ISignalMessage[]): void => {\n\t\tconst signals = Array.isArray(signalsArg) ? signalsArg : [signalsArg];\n\t\tfor (const signal of signals) {\n\t\t\t// Make sure it is not for a specific client as `PolicyLabelsUpdate` is meant for all clients.\n\t\t\tif (signal.clientId === null) {\n\t\t\t\t// We could have some issues/irregularities in parsing signals, so put it in try/catch block\n\t\t\t\t// and ignore the error as we can have labels update later on through join session response.\n\t\t\t\tlet envelope: ISignalEnvelope | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tenvelope = JSON.parse(signal.content as string) as ISignalEnvelope;\n\t\t\t\t} catch {\n\t\t\t\t\t// Drop error\n\t\t\t\t}\n\t\t\t\tif (envelope?.contents?.type === policyLabelsUpdatesSignalType) {\n\t\t\t\t\tthis.emitSensitivityLabelUpdateEvent(\n\t\t\t\t\t\tenvelope.contents.content as ISensitivityLabelsInfo,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate clearJoinSessionTimer(): void {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tclearTimeout(this.joinSessionRefreshTimer);\n\t\t\tthis.joinSessionRefreshTimer = undefined;\n\t\t}\n\t}\n\n\tprivate async scheduleJoinSessionRefresh(\n\t\tdelta: number,\n\t\trequestSocketToken: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<void> {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\tconst originalStackTraceLimit = (Error as any).stackTraceLimit;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = 50;\n\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DuplicateJoinSessionRefresh\",\n\t\t\t\t},\n\t\t\t\tnew Error(\"DuplicateJoinSessionRefresh\"),\n\t\t\t);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = originalStackTraceLimit;\n\t\t}\n\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tthis.joinSessionRefreshTimer = setTimeout(() => {\n\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t// Clear the timer as it is going to be scheduled again as part of refreshing join session.\n\t\t\t\tgetWithRetryForTokenRefresh(async (options) => {\n\t\t\t\t\tawait this.joinSession(\n\t\t\t\t\t\trequestSocketToken,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttrue /* isRefreshingJoinSession */,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t);\n\t\t\t\t\tresolve();\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t\t}, delta);\n\t\t});\n\t}\n\n\tprivate async joinSession(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\t// If this call is to refresh the join session for the current connection but we are already disconnected in\n\t\t// the meantime or disconnected and then reconnected then do not make the call. However, we should not have\n\t\t// come here if that is the case because timer should have been disposed, but due to race condition with the\n\t\t// timer we should not make the call and throw error.\n\t\tif (\n\t\t\tisRefreshingJoinSession &&\n\t\t\t(this.currentConnection === undefined ||\n\t\t\t\t(clientId !== undefined && this.currentConnection.clientId !== clientId))\n\t\t) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"JoinSessionRefreshTimerNotCancelled\",\n\t\t\t\tOdspErrorTypes.genericError,\n\t\t\t\t{\n\t\t\t\t\tdriverVersion,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tschedulerClientId: clientId,\n\t\t\t\t\t\tcurrentClientId: this.currentConnection?.clientId,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tconst response = await this.joinSessionCore(\n\t\t\trequestSocketToken,\n\t\t\toptions,\n\t\t\tisRefreshingJoinSession,\n\t\t\tdisplayName,\n\t\t).catch((error) => {\n\t\t\tif (hasFacetCodes(error) && error.facetCodes !== undefined) {\n\t\t\t\tfor (const code of error.facetCodes) {\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\tcase \"sessionForbidden\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnPreservedFiles\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnModerationEnabledLibrary\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnRequireCheckout\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnCheckoutFile\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnInvisibleMinorVersion\": {\n\t\t\t\t\t\t\t// This document can only be opened in storage-only mode.\n\t\t\t\t\t\t\t// DeltaManager will recognize this error\n\t\t\t\t\t\t\t// and load without a delta stream connection.\n\t\t\t\t\t\t\tthis.policies = { ...this.policies, storageOnly: true };\n\t\t\t\t\t\t\tthrow new DeltaStreamConnectionForbiddenError(\n\t\t\t\t\t\t\t\t`Storage-only due to ${code}`,\n\t\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t\tthis._relayServiceTenantAndSessionId = `${response.tenantId}/${response.id}`;\n\t\treturn response;\n\t}\n\n\tprivate async joinSessionCore(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\tconst disableJoinSessionRefresh = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.disableJoinSessionRefresh\",\n\t\t);\n\t\tconst setSensitivityLabelHeader = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.setSensitivityLabelHeader\",\n\t\t);\n\t\tconst executeFetch = async (): Promise<{\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst joinSessionResponse = await fetchJoinSession(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\"opStream/joinSession\",\n\t\t\t\t\"POST\",\n\t\t\t\tthis.mc.logger,\n\t\t\t\tthis.getAuthHeader,\n\t\t\t\tthis.epochTracker,\n\t\t\t\trequestSocketToken,\n\t\t\t\toptions,\n\t\t\t\tdisableJoinSessionRefresh,\n\t\t\t\tsetSensitivityLabelHeader,\n\t\t\t\tisRefreshingJoinSession,\n\t\t\t\tdisplayName,\n\t\t\t);\n\t\t\t// Emit event only in case it is fetched from the network.\n\t\t\tif (joinSessionResponse.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(joinSessionResponse.sensitivityLabelsInfo);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tentryTime: Date.now(),\n\t\t\t\tjoinSessionResponse,\n\t\t\t};\n\t\t};\n\n\t\tconst getResponseAndRefreshAfterDeltaMs = async (): Promise<{\n\t\t\trefreshAfterDeltaMs: number;\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst _response = await this.cache.sessionJoinCache.addOrGet(\n\t\t\t\tthis.joinSessionKey,\n\t\t\t\texecuteFetch,\n\t\t\t);\n\t\t\t// If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the\n\t\t\t// cache entry to be treated as expired after 1 hour.\n\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds =\n\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds ?? 3600;\n\t\t\treturn {\n\t\t\t\t..._response,\n\t\t\t\trefreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(\n\t\t\t\t\t_response.entryTime,\n\t\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\t),\n\t\t\t};\n\t\t};\n\t\tlet response = await getResponseAndRefreshAfterDeltaMs();\n\t\t// This means that the cached entry has expired(This should not be possible if the response is fetched\n\t\t// from the network call). In this case we remove the cached entry and fetch the new response.\n\t\tif (response.refreshAfterDeltaMs <= 0) {\n\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\tresponse = await getResponseAndRefreshAfterDeltaMs();\n\t\t}\n\t\tif (!disableJoinSessionRefresh) {\n\t\t\tconst props = {\n\t\t\t\tentryTime: response.entryTime,\n\t\t\t\trefreshSessionDurationSeconds:\n\t\t\t\t\tresponse.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\trefreshAfterDeltaMs: response.refreshAfterDeltaMs,\n\t\t\t};\n\t\t\tif (response.refreshAfterDeltaMs > 0) {\n\t\t\t\tthis.scheduleJoinSessionRefresh(\n\t\t\t\t\tresponse.refreshAfterDeltaMs,\n\t\t\t\t\trequestSocketToken,\n\t\t\t\t\tthis.currentConnection?.clientId,\n\t\t\t\t\tdisplayName,\n\t\t\t\t).catch((error) => {\n\t\t\t\t\t// Log the error and do nothing as the reconnection would fetch the join session.\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"JoinSessionRefreshError\",\n\t\t\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Logging just for informational purposes to help with debugging as this is a new feature.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"JoinSessionRefreshNotScheduled\",\n\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn response.joinSessionResponse;\n\t}\n\n\tprivate emitSensitivityLabelUpdateEvent(\n\t\tsensitivityLabelsInfo: ISensitivityLabelsInfo,\n\t): void {\n\t\tconst createdTimestamp = sensitivityLabelsInfo.timestamp;\n\t\tassert(\n\t\t\ttypeof createdTimestamp === \"number\" && createdTimestamp > 0,\n\t\t\t0x8e0 /* time should be a positive number */,\n\t\t);\n\t\tif (createdTimestamp > this.labelUpdateTimestamp) {\n\t\t\tthis.labelUpdateTimestamp = createdTimestamp;\n\t\t\tthis.metadataUpdateHandler({\n\t\t\t\tsensitivityLabelsInfo: JSON.stringify(sensitivityLabelsInfo),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate calculateJoinSessionRefreshDelta(\n\t\tresponseFetchTime: number,\n\t\trefreshSessionDurationSeconds: number,\n\t): number {\n\t\t// 30 seconds is buffer time to refresh the session.\n\t\treturn responseFetchTime + (refreshSessionDurationSeconds * 1000 - 30000) - Date.now();\n\t}\n\n\t/**\n\t * Creates a connection to the given delta stream endpoint\n\t *\n\t * @param tenantId - the ID of the tenant\n\t * @param documentId - document ID\n\t * @param token - authorization token for delta service\n\t * @param client - information about the client\n\t * @param webSocketUrl - websocket URL\n\t * @param connectionId - connection ID for the connection\n\t */\n\tprivate async createDeltaConnection(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\ttoken: string | null,\n\t\tclient: IClient,\n\t\twebSocketUrl: string,\n\t\tconnectionId: string,\n\t): Promise<OdspDocumentDeltaConnection> {\n\t\tconst startTime = performanceNow();\n\t\tconst connection = await OdspDocumentDeltaConnection.create(\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\ttoken,\n\t\t\tclient,\n\t\t\twebSocketUrl,\n\t\t\tthis.mc.logger,\n\t\t\t60000,\n\t\t\tthis.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tconnectionId,\n\t\t);\n\t\tconst duration = performanceNow() - startTime;\n\t\t// This event happens rather often, so it adds up to cost of telemetry.\n\t\t// Given that most reconnects result in reusing socket and happen very quickly,\n\t\t// report event only if it took longer than threshold.\n\t\tif (duration >= 2000) {\n\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"ConnectionSuccess\",\n\t\t\t\tduration,\n\t\t\t});\n\t\t}\n\t\treturn connection;\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\tthis.clearJoinSessionTimer();\n\t\tthis.currentConnection?.dispose();\n\t\tthis.currentConnection = undefined;\n\t}\n}\n"]}
|
package/dist/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/odsp-driver";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.82.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/dist/packageVersion.js
CHANGED
|
@@ -8,5 +8,5 @@
|
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.pkgVersion = exports.pkgName = void 0;
|
|
10
10
|
exports.pkgName = "@fluidframework/odsp-driver";
|
|
11
|
-
exports.pkgVersion = "2.
|
|
11
|
+
exports.pkgVersion = "2.82.0";
|
|
12
12
|
//# sourceMappingURL=packageVersion.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":";AAAA;;;;;GAKG;;;AAEU,QAAA,OAAO,GAAG,6BAA6B,CAAC;AACxC,QAAA,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.82.0\";\n"]}
|
package/dist/vroom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vroom.d.ts","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,6CAEjB,aAAa,QACjB,MAAM,UACJ,KAAK,GAAG,MAAM,UACd,mBAAmB,iBACZ,+BAA+B,gBAChC,YAAY,sBACN,OAAO,WAClB,mBAAmB,6BACD,OAAO,GAAG,SAAS,6BACnB,OAAO,GAAG,SAAS,2BACrB,OAAO,eACnB,MAAM,GAAG,SAAS,KAC7B,QAAQ,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"vroom.d.ts","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,6CAEjB,aAAa,QACjB,MAAM,UACJ,KAAK,GAAG,MAAM,UACd,mBAAmB,iBACZ,+BAA+B,gBAChC,YAAY,sBACN,OAAO,WAClB,mBAAmB,6BACD,OAAO,GAAG,SAAS,6BACnB,OAAO,GAAG,SAAS,2BACrB,OAAO,eACnB,MAAM,GAAG,SAAS,KAC7B,QAAQ,uBAAuB,CAAC,CA0FnC,CAAC"}
|
package/dist/vroom.js
CHANGED
|
@@ -40,6 +40,7 @@ exports.fetchJoinSession = (0, mockify_js_1.mockify)(async (urlParts, path, meth
|
|
|
40
40
|
requestSocketToken,
|
|
41
41
|
...tokenRefreshProps,
|
|
42
42
|
refreshingSession: isRefreshingJoinSession,
|
|
43
|
+
setSensitivityLabelHeader: setSensitivityLabelHeader ?? false,
|
|
43
44
|
};
|
|
44
45
|
return internal_1.PerformanceEvent.timedExecAsync(logger, {
|
|
45
46
|
eventName: "JoinSession",
|
|
@@ -84,6 +85,7 @@ exports.fetchJoinSession = (0, mockify_js_1.mockify)(async (urlParts, path, meth
|
|
|
84
85
|
pushv2: socketUrl.includes("pushf"),
|
|
85
86
|
webSocketHostName,
|
|
86
87
|
refreshSessionDurationSeconds: response.content.refreshSessionDurationSeconds,
|
|
88
|
+
hasSensitivityLabelsInfo: response.content.sensitivityLabelsInfo !== undefined,
|
|
87
89
|
});
|
|
88
90
|
if (response.content.runtimeTenantId && !response.content.tenantId) {
|
|
89
91
|
response.content.tenantId = response.content.runtimeTenantId;
|
package/dist/vroom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vroom.js","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAQH,uEAGkD;AAClD,+BAAkC;AAGlC,6CAAuC;AACvC,yDAAgD;AAEhD,mDAA+C;AAO/C;;;;;;;;;;;;;;;;;GAiBG;AACU,QAAA,gBAAgB,GAAG,IAAA,oBAAO,EACtC,KAAK,EACJ,QAAuB,EACvB,IAAY,EACZ,MAAsB,EACtB,MAA2B,EAC3B,aAA8C,EAC9C,YAA0B,EAC1B,kBAA2B,EAC3B,OAA4B,EAC5B,yBAA8C,EAC9C,yBAA8C,EAC9C,uBAAgC,EAChC,WAA+B,EACI,EAAE;IACrC,MAAM,OAAO,GAAG,IAAA,6BAAU,EAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,GAAG,OAAO,WAAW,QAAQ,CAAC,OAAO,UAAU,QAAQ,CAAC,MAAM,IAAI,IAAI,QAAQ,CAAC;IAC3F,MAAM,UAAU,G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C,CACD,CAAC;AACH,CAAC,CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIOdspUrlParts,\n\tISocketStorageDiscovery,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport { mockify } from \"./mockify.js\";\nimport { getApiRoot } from \"./odspUrlHelper.js\";\nimport type { TokenFetchOptionsEx } from \"./odspUtils.js\";\nimport { runWithRetry } from \"./retryUtils.js\";\n\ninterface IJoinSessionBody {\n\trequestSocketToken?: boolean;\n\tdisplayName?: string;\n}\n\n/**\n * Makes join session call on SPO to get information about the web socket for a document\n * @param urlParts - The SPO drive id, itemId, siteUrl that this request should be made against\n * @param path - The API path that is relevant to this request\n * @param method - The type of request, such as GET or POST\n * @param logger - A logger to use for this request\n * @param getAuthHeader - A function that is able to provide the access token for this request\n * @param epochTracker - fetch wrapper which incorporates epoch logic around joinSession call\n * @param requestSocketToken - flag indicating whether joinSession is expected to return access token\n * which is used when establishing websocket connection with collab session backend service.\n * @param options - Options to fetch the token.\n * @param disableJoinSessionRefresh - Whether the caller wants to disable refreshing join session periodically.\n * @param setSensitivityLabelHeader - Whether the caller wants to set the Return-Sensitivity-Labels Prefer header in the join session request.\n * @param isRefreshingJoinSession - whether call is to refresh the session before expiry.\n * @param displayName - display name used to identify client joining a session.\n * This is optional and used only when collab session is being joined by client acting in app-only mode (i.e. without user context).\n * If not specified client display name is extracted from the access token that is used to join session.\n */\nexport const fetchJoinSession = mockify(\n\tasync (\n\t\turlParts: IOdspUrlParts,\n\t\tpath: string,\n\t\tmethod: \"GET\" | \"POST\",\n\t\tlogger: ITelemetryLoggerExt,\n\t\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\t\tepochTracker: EpochTracker,\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tdisableJoinSessionRefresh: boolean | undefined,\n\t\tsetSensitivityLabelHeader: boolean | undefined,\n\t\tisRefreshingJoinSession: boolean,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> => {\n\t\tconst apiRoot = getApiRoot(new URL(urlParts.siteUrl));\n\t\tconst url = `${apiRoot}/drives/${urlParts.driveId}/items/${urlParts.itemId}/${path}?ump=1`;\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"JoinSession\",\n\t\t);\n\n\t\tconst tokenRefreshProps = options.refresh\n\t\t\t? { hasClaims: !!options.claims, hasTenantId: !!options.tenantId }\n\t\t\t: {};\n\t\tconst details: ITelemetryBaseProperties = {\n\t\t\trefreshedToken: options.refresh,\n\t\t\trequestSocketToken,\n\t\t\t...tokenRefreshProps,\n\t\t\trefreshingSession: isRefreshingJoinSession,\n\t\t\tsetSensitivityLabelHeader: setSensitivityLabelHeader ?? false,\n\t\t};\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"JoinSession\",\n\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\tdetails: JSON.stringify(details),\n\t\t\t\t...tokenRefreshProps,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst formBoundary = uuid();\n\t\t\t\tlet postBody = `--${formBoundary}\\r\\n`;\n\t\t\t\tpostBody += `Authorization: ${authHeader}\\r\\n`;\n\t\t\t\tpostBody += `X-HTTP-Method-Override: POST\\r\\n`;\n\t\t\t\tpostBody += `Content-Type: application/json\\r\\n`;\n\t\t\t\tif (!disableJoinSessionRefresh) {\n\t\t\t\t\tpostBody += `Prefer: FluidRemoveCheckAccess\\r\\n`;\n\t\t\t\t}\n\t\t\t\tif (setSensitivityLabelHeader) {\n\t\t\t\t\tpostBody += `Prefer: Return-Sensitivity-Labels\\r\\n`;\n\t\t\t\t}\n\t\t\t\tpostBody += `_post: 1\\r\\n`;\n\n\t\t\t\tlet requestBody: IJoinSessionBody | undefined;\n\t\t\t\tif (requestSocketToken) {\n\t\t\t\t\trequestBody = { ...requestBody, requestSocketToken: true };\n\t\t\t\t}\n\t\t\t\tif (displayName) {\n\t\t\t\t\trequestBody = { ...requestBody, displayName };\n\t\t\t\t}\n\t\t\t\tif (requestBody) {\n\t\t\t\t\tpostBody += `\\r\\n${JSON.stringify(requestBody)}\\r\\n`;\n\t\t\t\t}\n\t\t\t\tpostBody += `\\r\\n--${formBoundary}--`;\n\t\t\t\tconst headers: { [index: string]: string } = {\n\t\t\t\t\t\"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n\t\t\t\t};\n\n\t\t\t\tconst response = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<ISocketStorageDiscovery>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{ method, headers, body: postBody },\n\t\t\t\t\t\t\t\"joinSession\",\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t),\n\t\t\t\t\t\"joinSession\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst socketUrl = response.content.deltaStreamSocketUrl;\n\t\t\t\t// expecting socketUrl to be something like https://{hostName}/...\n\t\t\t\tconst webSocketHostName = socketUrl.split(\"/\")[2];\n\n\t\t\t\t// TODO SPO-specific telemetry\n\t\t\t\tevent.end({\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t// pushV2 websocket urls will contain pushf\n\t\t\t\t\tpushv2: socketUrl.includes(\"pushf\"),\n\t\t\t\t\twebSocketHostName,\n\t\t\t\t\trefreshSessionDurationSeconds: response.content.refreshSessionDurationSeconds,\n\t\t\t\t\thasSensitivityLabelsInfo: response.content.sensitivityLabelsInfo !== undefined,\n\t\t\t\t});\n\n\t\t\t\tif (response.content.runtimeTenantId && !response.content.tenantId) {\n\t\t\t\t\tresponse.content.tenantId = response.content.runtimeTenantId;\n\t\t\t\t}\n\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\t},\n);\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDelayLoadedDeltaStream.d.ts","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,oCAAoC,CAAC;AAClE,OAAO,KAAK,EACX,wBAAwB,EACxB,wBAAwB,EACxB,YAAY,EAEZ,yBAAyB,EAEzB,MAAM,6CAA6C,CAAC;AAMrD,OAAO,EACN,KAAK,iBAAiB,EAEtB,KAAK,gBAAgB,EAGrB,KAAK,+BAA+B,EAEpC,KAAK,iBAAiB,EACtB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAEN,KAAK,iBAAiB,EAEtB,MAAM,0CAA0C,CAAC;AAIlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AACtD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AACjD,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAS/E;;;GAGG;AACH,qBAAa,0BAA0B;aAkCrB,eAAe,EAAE,gBAAgB;IAC1C,QAAQ,EAAE,wBAAwB;IACzC,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAGlC,OAAO,CAAC,QAAQ,CAAC,EAAE;IACnB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,UAAU;IAC3B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,WAAW;IAC5B,OAAO,CAAC,QAAQ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) {
|
|
336
|
-
const createdTimestamp =
|
|
337
|
-
assert(createdTimestamp > 0, 0x8e0 /* time should be positive */);
|
|
336
|
+
const createdTimestamp = sensitivityLabelsInfo.timestamp;
|
|
337
|
+
assert(typeof createdTimestamp === "number" && createdTimestamp > 0, 0x8e0 /* time should be a positive number */);
|
|
338
338
|
if (createdTimestamp > this.labelUpdateTimestamp) {
|
|
339
339
|
this.labelUpdateTimestamp = createdTimestamp;
|
|
340
340
|
this.metadataUpdateHandler({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDelayLoadedDeltaStream.js","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EACN,mCAAmC,EACnC,iBAAiB,GACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAON,cAAc,GAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAGN,cAAc,GACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kCAAkC,CAAC;AAC/E,OAAO,EAEN,sBAAsB,EACtB,2BAA2B,GAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,UAAU,IAAI,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9C;;;GAGG;AACH,MAAM,OAAO,0BAA0B;IAkBtC;;;;;;;;;;;;;;OAcG;IACH,YACiB,eAAiC,EAC1C,QAAkC,EACxB,aAA8C,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B,EAC7B,YAAY,CACZ,CAAC;QACF,MAAM,QAAQ,GAAG,cAAc,EAAE,GAAG,SAAS,CAAC;QAC9C,uEAAuE;QACvE,+EAA+E;QAC/E,sDAAsD;QACtD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBACnC,SAAS,EAAE,mBAAmB;gBAC9B,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,OAAO,CAAC,KAAe;QAC7B,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,IAAI,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport type { ISignalEnvelope } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentServicePolicies,\n\tIResolvedUrl,\n\tIAnyDriverError,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tDeltaStreamConnectionForbiddenError,\n\tNonRetryableError,\n} from \"@fluidframework/driver-utils/internal\";\nimport { hasFacetCodes } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport {\n\ttype HostStoragePolicy,\n\ttype IOdspError,\n\ttype IOdspResolvedUrl,\n\ttype ISocketStorageDiscovery,\n\ttype ISensitivityLabelsInfo,\n\ttype InstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\ttype TokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\ttype MonitoringContext,\n\tnormalizeError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { policyLabelsUpdatesSignalType } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport type { IOdspCache } from \"./odspCache.js\";\nimport { OdspDocumentDeltaConnection } from \"./odspDocumentDeltaConnection.js\";\nimport {\n\ttype TokenFetchOptionsEx,\n\tgetJoinSessionCacheKey,\n\tgetWithRetryForTokenRefresh,\n} from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { fetchJoinSession } from \"./vroom.js\";\n\n/**\n * This OdspDelayLoadedDeltaStream is used by OdspDocumentService.ts to delay load the delta connection\n * as they are not on critical path of loading a container.\n */\nexport class OdspDelayLoadedDeltaStream {\n\t// Timer which runs and executes the join session call after intervals.\n\tprivate joinSessionRefreshTimer: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate readonly joinSessionKey: string;\n\n\tprivate currentConnection?: OdspDocumentDeltaConnection;\n\n\tprivate _relayServiceTenantAndSessionId: string | undefined;\n\n\tprivate firstConnectionAttempt = true;\n\n\t// Tracks the time at which the Policy Labels were updated the last time. This is used to resolve race conditions\n\t// between label updates from the join session and the Fluid signals and they could have same or different timestamps.\n\t// So this timestamp is updated with timestamp from the service/signals with the most recent timestamp. We could also\n\t// receive stale data from join session as that call is made at intervals, so we need to update with only most recent data.\n\tprivate labelUpdateTimestamp: number = -1;\n\n\t/**\n\t * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n\t * @param policies - Document service policies.\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 mc - a logger that can capture performance and diagnostic information\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 opsReceived - To register the ops received through socket.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tpublic constructor(\n\t\tpublic readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tpublic policies: IDocumentServicePolicies,\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\tprivate readonly mc: MonitoringContext,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicy,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,\n\t\tprivate readonly metadataUpdateHandler: (metadata: Record<string, string>) => void,\n\t\tprivate readonly socketReferenceKeyPrefix?: string,\n\t) {\n\t\tthis.joinSessionKey = getJoinSessionCacheKey(this.odspResolvedUrl);\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\n\tpublic get currentDeltaConnection(): OdspDocumentDeltaConnection | undefined {\n\t\treturn this.currentConnection;\n\t}\n\n\tpublic get relayServiceTenantAndSessionId(): string | undefined {\n\t\treturn this._relayServiceTenantAndSessionId;\n\t}\n\n\t/**\n\t * Annotate the given error indicating which connection step failed\n\t */\n\tprivate annotateConnectionError(\n\t\terror: unknown,\n\t\tfailedConnectionStep: string,\n\t\tseparateTokenRequest: boolean,\n\t): IFluidErrorBase {\n\t\treturn normalizeError(error, {\n\t\t\tprops: {\n\t\t\t\tfailedConnectionStep,\n\t\t\t\tseparateTokenRequest,\n\t\t\t},\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\tassert(\n\t\t\tthis.currentConnection === undefined,\n\t\t\t0x4ad /* Should not be called when connection is already present! */,\n\t\t);\n\t\t// Attempt to connect twice, in case we used expired token.\n\t\treturn getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {\n\t\t\t// Presence of getWebsocketToken callback dictates whether callback is used for fetching\n\t\t\t// websocket token or whether it is returned with joinSession response payload\n\t\t\tconst requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;\n\t\t\tconst websocketTokenPromise = requestWebsocketTokenFromJoinSession\n\t\t\t\t? // eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tPromise.resolve(null)\n\t\t\t\t: this.getWebsocketToken(options);\n\n\t\t\tconst annotateAndRethrowConnectionError = (step: string) => (error: unknown) => {\n\t\t\t\tthrow this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);\n\t\t\t};\n\n\t\t\t// Log telemetry for join session attempt\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstJoinSessionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\trequestWebsocketToken: requestWebsocketTokenFromJoinSession,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst joinSessionPromise = this.joinSession(\n\t\t\t\trequestWebsocketTokenFromJoinSession,\n\t\t\t\toptions,\n\t\t\t\tfalse /* isRefreshingJoinSession */,\n\t\t\t\tundefined /* clientId */,\n\t\t\t\tthis.hostPolicy.sessionOptions?.displayName,\n\t\t\t);\n\t\t\tconst [websocketEndpoint, websocketToken] = await Promise.all([\n\t\t\t\tjoinSessionPromise.catch(annotateAndRethrowConnectionError(\"joinSession\")),\n\t\t\t\twebsocketTokenPromise.catch(annotateAndRethrowConnectionError(\"getWebsocketToken\")),\n\t\t\t]);\n\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst finalWebsocketToken = websocketToken ?? websocketEndpoint.socketToken ?? null;\n\t\t\tif (finalWebsocketToken === null) {\n\t\t\t\tthrow this.annotateConnectionError(\n\t\t\t\t\tnew NonRetryableError(\"Websocket token is null\", OdspErrorTypes.fetchTokenError, {\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t}),\n\t\t\t\t\t\"getWebsocketToken\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (websocketEndpoint.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(websocketEndpoint.sensitivityLabelsInfo);\n\t\t\t}\n\n\t\t\tconst connectionId = uuid();\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.firstConnectionAttempt = false;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstConnectionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tconnectionId,\n\t\t\t\t\t\ttenantId: websocketEndpoint.tenantId,\n\t\t\t\t\t\tdocumentId: websocketEndpoint.id,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst connection = await this.createDeltaConnection(\n\t\t\t\t\twebsocketEndpoint.tenantId,\n\t\t\t\t\twebsocketEndpoint.id,\n\t\t\t\t\tfinalWebsocketToken,\n\t\t\t\t\tclient,\n\t\t\t\t\twebsocketEndpoint.deltaStreamSocketUrl,\n\t\t\t\t\tconnectionId,\n\t\t\t\t);\n\t\t\t\tconnection.on(\"op\", (documentId, ops: ISequencedDocumentMessage[]) => {\n\t\t\t\t\tthis.opsReceived(ops);\n\t\t\t\t});\n\t\t\t\tconnection.on(\"signal\", this.signalHandler);\n\t\t\t\t// Also process the initial signals\n\t\t\t\tthis.signalHandler(connection.initialSignals);\n\t\t\t\t// On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again\n\t\t\t\t// get the auth error on reconnecting and face latency.\n\t\t\t\tconnection.once(\"disconnect\", (error: unknown) => {\n\t\t\t\t\t// Clear the join session refresh timer so that it can be restarted on reconnection.\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t\terror !== null &&\n\t\t\t\t\t\t(error as Partial<IOdspError>).errorType === OdspErrorTypes.authorizationError\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t\t}\n\t\t\t\t\t// If we hit this assert, it means that \"disconnect\" event is emitted before the connection went through\n\t\t\t\t\t// dispose flow which is not correct and could lead to a bunch of errors.\n\t\t\t\t\tassert(connection.disposed, 0x4ae /* Connection should be disposed by now */);\n\t\t\t\t\tthis.currentConnection = undefined;\n\t\t\t\t});\n\t\t\t\tthis.currentConnection = connection;\n\t\t\t\treturn connection;\n\t\t\t} catch (error) {\n\t\t\t\t// Remove join session information from cache only if it is an error is from socket event connect_document_error.\n\t\t\t\t// Otherwise keep it in cache so that this session can be re-used after disconnection.\n\t\t\t\t// Also keeping an undefined check here to account for any unknown code path that is unable to stamp the value as in that case also\n\t\t\t\t// it is safer to clear join session cache and start over.\n\t\t\t\tif (\n\t\t\t\t\terror &&\n\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t((error as IAnyDriverError).scenarioName === \"connect_document_error\" ||\n\t\t\t\t\t\t(error as IAnyDriverError).scenarioName === undefined)\n\t\t\t\t) {\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t}\n\t\t\t\tconst normalizedError = this.annotateConnectionError(\n\t\t\t\t\terror,\n\t\t\t\t\t\"createDeltaConnection\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\t\tnormalizedError.addTelemetryProperties({\n\t\t\t\t\t\tsocketDocumentId: websocketEndpoint.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthrow normalizedError;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate readonly signalHandler = (signalsArg: ISignalMessage | ISignalMessage[]): void => {\n\t\tconst signals = Array.isArray(signalsArg) ? signalsArg : [signalsArg];\n\t\tfor (const signal of signals) {\n\t\t\t// Make sure it is not for a specific client as `PolicyLabelsUpdate` is meant for all clients.\n\t\t\tif (signal.clientId === null) {\n\t\t\t\t// We could have some issues/irregularities in parsing signals, so put it in try/catch block\n\t\t\t\t// and ignore the error as we can have labels update later on through join session response.\n\t\t\t\tlet envelope: ISignalEnvelope | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tenvelope = JSON.parse(signal.content as string) as ISignalEnvelope;\n\t\t\t\t} catch {\n\t\t\t\t\t// Drop error\n\t\t\t\t}\n\t\t\t\tif (envelope?.contents?.type === policyLabelsUpdatesSignalType) {\n\t\t\t\t\tthis.emitSensitivityLabelUpdateEvent(\n\t\t\t\t\t\tenvelope.contents.content as ISensitivityLabelsInfo,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate clearJoinSessionTimer(): void {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tclearTimeout(this.joinSessionRefreshTimer);\n\t\t\tthis.joinSessionRefreshTimer = undefined;\n\t\t}\n\t}\n\n\tprivate async scheduleJoinSessionRefresh(\n\t\tdelta: number,\n\t\trequestSocketToken: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<void> {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\tconst originalStackTraceLimit = (Error as any).stackTraceLimit;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = 50;\n\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DuplicateJoinSessionRefresh\",\n\t\t\t\t},\n\t\t\t\tnew Error(\"DuplicateJoinSessionRefresh\"),\n\t\t\t);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = originalStackTraceLimit;\n\t\t}\n\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tthis.joinSessionRefreshTimer = setTimeout(() => {\n\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t// Clear the timer as it is going to be scheduled again as part of refreshing join session.\n\t\t\t\tgetWithRetryForTokenRefresh(async (options) => {\n\t\t\t\t\tawait this.joinSession(\n\t\t\t\t\t\trequestSocketToken,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttrue /* isRefreshingJoinSession */,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t);\n\t\t\t\t\tresolve();\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t\t}, delta);\n\t\t});\n\t}\n\n\tprivate async joinSession(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\t// If this call is to refresh the join session for the current connection but we are already disconnected in\n\t\t// the meantime or disconnected and then reconnected then do not make the call. However, we should not have\n\t\t// come here if that is the case because timer should have been disposed, but due to race condition with the\n\t\t// timer we should not make the call and throw error.\n\t\tif (\n\t\t\tisRefreshingJoinSession &&\n\t\t\t(this.currentConnection === undefined ||\n\t\t\t\t(clientId !== undefined && this.currentConnection.clientId !== clientId))\n\t\t) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"JoinSessionRefreshTimerNotCancelled\",\n\t\t\t\tOdspErrorTypes.genericError,\n\t\t\t\t{\n\t\t\t\t\tdriverVersion,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tschedulerClientId: clientId,\n\t\t\t\t\t\tcurrentClientId: this.currentConnection?.clientId,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tconst response = await this.joinSessionCore(\n\t\t\trequestSocketToken,\n\t\t\toptions,\n\t\t\tisRefreshingJoinSession,\n\t\t\tdisplayName,\n\t\t).catch((error) => {\n\t\t\tif (hasFacetCodes(error) && error.facetCodes !== undefined) {\n\t\t\t\tfor (const code of error.facetCodes) {\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\tcase \"sessionForbidden\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnPreservedFiles\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnModerationEnabledLibrary\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnRequireCheckout\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnCheckoutFile\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnInvisibleMinorVersion\": {\n\t\t\t\t\t\t\t// This document can only be opened in storage-only mode.\n\t\t\t\t\t\t\t// DeltaManager will recognize this error\n\t\t\t\t\t\t\t// and load without a delta stream connection.\n\t\t\t\t\t\t\tthis.policies = { ...this.policies, storageOnly: true };\n\t\t\t\t\t\t\tthrow new DeltaStreamConnectionForbiddenError(\n\t\t\t\t\t\t\t\t`Storage-only due to ${code}`,\n\t\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t\tthis._relayServiceTenantAndSessionId = `${response.tenantId}/${response.id}`;\n\t\treturn response;\n\t}\n\n\tprivate async joinSessionCore(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\tconst disableJoinSessionRefresh = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.disableJoinSessionRefresh\",\n\t\t);\n\t\tconst setSensitivityLabelHeader = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.setSensitivityLabelHeader\",\n\t\t);\n\t\tconst executeFetch = async (): Promise<{\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst joinSessionResponse = await fetchJoinSession(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\"opStream/joinSession\",\n\t\t\t\t\"POST\",\n\t\t\t\tthis.mc.logger,\n\t\t\t\tthis.getAuthHeader,\n\t\t\t\tthis.epochTracker,\n\t\t\t\trequestSocketToken,\n\t\t\t\toptions,\n\t\t\t\tdisableJoinSessionRefresh,\n\t\t\t\tsetSensitivityLabelHeader,\n\t\t\t\tisRefreshingJoinSession,\n\t\t\t\tdisplayName,\n\t\t\t);\n\t\t\t// Emit event only in case it is fetched from the network.\n\t\t\tif (joinSessionResponse.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(joinSessionResponse.sensitivityLabelsInfo);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tentryTime: Date.now(),\n\t\t\t\tjoinSessionResponse,\n\t\t\t};\n\t\t};\n\n\t\tconst getResponseAndRefreshAfterDeltaMs = async (): Promise<{\n\t\t\trefreshAfterDeltaMs: number;\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst _response = await this.cache.sessionJoinCache.addOrGet(\n\t\t\t\tthis.joinSessionKey,\n\t\t\t\texecuteFetch,\n\t\t\t);\n\t\t\t// If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the\n\t\t\t// cache entry to be treated as expired after 1 hour.\n\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds =\n\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds ?? 3600;\n\t\t\treturn {\n\t\t\t\t..._response,\n\t\t\t\trefreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(\n\t\t\t\t\t_response.entryTime,\n\t\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\t),\n\t\t\t};\n\t\t};\n\t\tlet response = await getResponseAndRefreshAfterDeltaMs();\n\t\t// This means that the cached entry has expired(This should not be possible if the response is fetched\n\t\t// from the network call). In this case we remove the cached entry and fetch the new response.\n\t\tif (response.refreshAfterDeltaMs <= 0) {\n\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\tresponse = await getResponseAndRefreshAfterDeltaMs();\n\t\t}\n\t\tif (!disableJoinSessionRefresh) {\n\t\t\tconst props = {\n\t\t\t\tentryTime: response.entryTime,\n\t\t\t\trefreshSessionDurationSeconds:\n\t\t\t\t\tresponse.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\trefreshAfterDeltaMs: response.refreshAfterDeltaMs,\n\t\t\t};\n\t\t\tif (response.refreshAfterDeltaMs > 0) {\n\t\t\t\tthis.scheduleJoinSessionRefresh(\n\t\t\t\t\tresponse.refreshAfterDeltaMs,\n\t\t\t\t\trequestSocketToken,\n\t\t\t\t\tthis.currentConnection?.clientId,\n\t\t\t\t\tdisplayName,\n\t\t\t\t).catch((error) => {\n\t\t\t\t\t// Log the error and do nothing as the reconnection would fetch the join session.\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"JoinSessionRefreshError\",\n\t\t\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Logging just for informational purposes to help with debugging as this is a new feature.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"JoinSessionRefreshNotScheduled\",\n\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn response.joinSessionResponse;\n\t}\n\n\tprivate emitSensitivityLabelUpdateEvent(\n\t\tsensitivityLabelsInfo: ISensitivityLabelsInfo,\n\t): void {\n\t\tconst createdTimestamp = Date.parse(sensitivityLabelsInfo.timestamp);\n\t\tassert(createdTimestamp > 0, 0x8e0 /* time should be positive */);\n\t\tif (createdTimestamp > this.labelUpdateTimestamp) {\n\t\t\tthis.labelUpdateTimestamp = createdTimestamp;\n\t\t\tthis.metadataUpdateHandler({\n\t\t\t\tsensitivityLabelsInfo: JSON.stringify(sensitivityLabelsInfo),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate calculateJoinSessionRefreshDelta(\n\t\tresponseFetchTime: number,\n\t\trefreshSessionDurationSeconds: number,\n\t): number {\n\t\t// 30 seconds is buffer time to refresh the session.\n\t\treturn responseFetchTime + (refreshSessionDurationSeconds * 1000 - 30000) - Date.now();\n\t}\n\n\t/**\n\t * Creates a connection to the given delta stream endpoint\n\t *\n\t * @param tenantId - the ID of the tenant\n\t * @param documentId - document ID\n\t * @param token - authorization token for delta service\n\t * @param client - information about the client\n\t * @param webSocketUrl - websocket URL\n\t * @param connectionId - connection ID for the connection\n\t */\n\tprivate async createDeltaConnection(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\ttoken: string | null,\n\t\tclient: IClient,\n\t\twebSocketUrl: string,\n\t\tconnectionId: string,\n\t): Promise<OdspDocumentDeltaConnection> {\n\t\tconst startTime = performanceNow();\n\t\tconst connection = await OdspDocumentDeltaConnection.create(\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\ttoken,\n\t\t\tclient,\n\t\t\twebSocketUrl,\n\t\t\tthis.mc.logger,\n\t\t\t60000,\n\t\t\tthis.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tconnectionId,\n\t\t);\n\t\tconst duration = performanceNow() - startTime;\n\t\t// This event happens rather often, so it adds up to cost of telemetry.\n\t\t// Given that most reconnects result in reusing socket and happen very quickly,\n\t\t// report event only if it took longer than threshold.\n\t\tif (duration >= 2000) {\n\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"ConnectionSuccess\",\n\t\t\t\tduration,\n\t\t\t});\n\t\t}\n\t\treturn connection;\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\tthis.clearJoinSessionTimer();\n\t\tthis.currentConnection?.dispose();\n\t\tthis.currentConnection = undefined;\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDelayLoadedDeltaStream.js","sourceRoot":"","sources":["../src/odspDelayLoadedDeltaStream.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAU7D,OAAO,EACN,mCAAmC,EACnC,iBAAiB,GACjB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,4CAA4C,CAAC;AAC3E,OAAO,EAON,cAAc,GAEd,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EAGN,cAAc,GACd,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAElC,OAAO,EAAE,6BAA6B,EAAE,MAAM,gBAAgB,CAAC;AAG/D,OAAO,EAAE,2BAA2B,EAAE,MAAM,kC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AAgB,EAChB,UAAkB,EAClB,KAAoB,EACpB,MAAe,EACf,YAAoB,EACpB,YAAoB;QAEpB,MAAM,SAAS,GAAG,cAAc,EAAE,CAAC;QACnC,MAAM,UAAU,GAAG,MAAM,2BAA2B,CAAC,MAAM,CAC1D,QAAQ,EACR,UAAU,EACV,KAAK,EACL,MAAM,EACN,YAAY,EACZ,IAAI,CAAC,EAAE,CAAC,MAAM,EACd,KAAK,EACL,IAAI,CAAC,YAAY,EACjB,IAAI,CAAC,wBAAwB,EAC7B,YAAY,CACZ,CAAC;QACF,MAAM,QAAQ,GAAG,cAAc,EAAE,GAAG,SAAS,CAAC;QAC9C,uEAAuE;QACvE,+EAA+E;QAC/E,sDAAsD;QACtD,IAAI,QAAQ,IAAI,IAAI,EAAE,CAAC;YACtB,IAAI,CAAC,EAAE,CAAC,MAAM,CAAC,oBAAoB,CAAC;gBACnC,SAAS,EAAE,mBAAmB;gBAC9B,QAAQ;aACR,CAAC,CAAC;QACJ,CAAC;QACD,OAAO,UAAU,CAAC;IACnB,CAAC;IAEM,OAAO,CAAC,KAAe;QAC7B,IAAI,CAAC,qBAAqB,EAAE,CAAC;QAC7B,IAAI,CAAC,iBAAiB,EAAE,OAAO,EAAE,CAAC;QAClC,IAAI,CAAC,iBAAiB,GAAG,SAAS,CAAC;IACpC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { performanceNow } from \"@fluid-internal/client-utils\";\nimport type { ISignalEnvelope } from \"@fluidframework/core-interfaces/internal\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport type { IClient } from \"@fluidframework/driver-definitions\";\nimport type {\n\tIDocumentDeltaConnection,\n\tIDocumentServicePolicies,\n\tIResolvedUrl,\n\tIAnyDriverError,\n\tISequencedDocumentMessage,\n\tISignalMessage,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tDeltaStreamConnectionForbiddenError,\n\tNonRetryableError,\n} from \"@fluidframework/driver-utils/internal\";\nimport { hasFacetCodes } from \"@fluidframework/odsp-doclib-utils/internal\";\nimport {\n\ttype HostStoragePolicy,\n\ttype IOdspError,\n\ttype IOdspResolvedUrl,\n\ttype ISocketStorageDiscovery,\n\ttype ISensitivityLabelsInfo,\n\ttype InstrumentedStorageTokenFetcher,\n\tOdspErrorTypes,\n\ttype TokenFetchOptions,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype IFluidErrorBase,\n\ttype MonitoringContext,\n\tnormalizeError,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport { policyLabelsUpdatesSignalType } from \"./contracts.js\";\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport type { IOdspCache } from \"./odspCache.js\";\nimport { OdspDocumentDeltaConnection } from \"./odspDocumentDeltaConnection.js\";\nimport {\n\ttype TokenFetchOptionsEx,\n\tgetJoinSessionCacheKey,\n\tgetWithRetryForTokenRefresh,\n} from \"./odspUtils.js\";\nimport { pkgVersion as driverVersion } from \"./packageVersion.js\";\nimport { fetchJoinSession } from \"./vroom.js\";\n\n/**\n * This OdspDelayLoadedDeltaStream is used by OdspDocumentService.ts to delay load the delta connection\n * as they are not on critical path of loading a container.\n */\nexport class OdspDelayLoadedDeltaStream {\n\t// Timer which runs and executes the join session call after intervals.\n\tprivate joinSessionRefreshTimer: ReturnType<typeof setTimeout> | undefined;\n\n\tprivate readonly joinSessionKey: string;\n\n\tprivate currentConnection?: OdspDocumentDeltaConnection;\n\n\tprivate _relayServiceTenantAndSessionId: string | undefined;\n\n\tprivate firstConnectionAttempt = true;\n\n\t// Tracks the time at which the Policy Labels were updated the last time. This is used to resolve race conditions\n\t// between label updates from the join session and the Fluid signals and they could have same or different timestamps.\n\t// So this timestamp is updated with timestamp from the service/signals with the most recent timestamp. We could also\n\t// receive stale data from join session as that call is made at intervals, so we need to update with only most recent data.\n\tprivate labelUpdateTimestamp: number = -1;\n\n\t/**\n\t * @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.\n\t * @param policies - Document service policies.\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 mc - a logger that can capture performance and diagnostic information\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 opsReceived - To register the ops received through socket.\n\t * @param socketReferenceKeyPrefix - (optional) prefix to isolate socket reuse cache\n\t */\n\tpublic constructor(\n\t\tpublic readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tpublic policies: IDocumentServicePolicies,\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\tprivate readonly mc: MonitoringContext,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicy,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,\n\t\tprivate readonly metadataUpdateHandler: (metadata: Record<string, string>) => void,\n\t\tprivate readonly socketReferenceKeyPrefix?: string,\n\t) {\n\t\tthis.joinSessionKey = getJoinSessionCacheKey(this.odspResolvedUrl);\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this.odspResolvedUrl;\n\t}\n\n\tpublic get currentDeltaConnection(): OdspDocumentDeltaConnection | undefined {\n\t\treturn this.currentConnection;\n\t}\n\n\tpublic get relayServiceTenantAndSessionId(): string | undefined {\n\t\treturn this._relayServiceTenantAndSessionId;\n\t}\n\n\t/**\n\t * Annotate the given error indicating which connection step failed\n\t */\n\tprivate annotateConnectionError(\n\t\terror: unknown,\n\t\tfailedConnectionStep: string,\n\t\tseparateTokenRequest: boolean,\n\t): IFluidErrorBase {\n\t\treturn normalizeError(error, {\n\t\t\tprops: {\n\t\t\t\tfailedConnectionStep,\n\t\t\t\tseparateTokenRequest,\n\t\t\t},\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\tassert(\n\t\t\tthis.currentConnection === undefined,\n\t\t\t0x4ad /* Should not be called when connection is already present! */,\n\t\t);\n\t\t// Attempt to connect twice, in case we used expired token.\n\t\treturn getWithRetryForTokenRefresh<IDocumentDeltaConnection>(async (options) => {\n\t\t\t// Presence of getWebsocketToken callback dictates whether callback is used for fetching\n\t\t\t// websocket token or whether it is returned with joinSession response payload\n\t\t\tconst requestWebsocketTokenFromJoinSession = this.getWebsocketToken === undefined;\n\t\t\tconst websocketTokenPromise = requestWebsocketTokenFromJoinSession\n\t\t\t\t? // eslint-disable-next-line unicorn/no-null\n\t\t\t\t\tPromise.resolve(null)\n\t\t\t\t: this.getWebsocketToken(options);\n\n\t\t\tconst annotateAndRethrowConnectionError = (step: string) => (error: unknown) => {\n\t\t\t\tthrow this.annotateConnectionError(error, step, !requestWebsocketTokenFromJoinSession);\n\t\t\t};\n\n\t\t\t// Log telemetry for join session attempt\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstJoinSessionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\trequestWebsocketToken: requestWebsocketTokenFromJoinSession,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\n\t\t\tconst joinSessionPromise = this.joinSession(\n\t\t\t\trequestWebsocketTokenFromJoinSession,\n\t\t\t\toptions,\n\t\t\t\tfalse /* isRefreshingJoinSession */,\n\t\t\t\tundefined /* clientId */,\n\t\t\t\tthis.hostPolicy.sessionOptions?.displayName,\n\t\t\t);\n\t\t\tconst [websocketEndpoint, websocketToken] = await Promise.all([\n\t\t\t\tjoinSessionPromise.catch(annotateAndRethrowConnectionError(\"joinSession\")),\n\t\t\t\twebsocketTokenPromise.catch(annotateAndRethrowConnectionError(\"getWebsocketToken\")),\n\t\t\t]);\n\n\t\t\t// eslint-disable-next-line unicorn/no-null\n\t\t\tconst finalWebsocketToken = websocketToken ?? websocketEndpoint.socketToken ?? null;\n\t\t\tif (finalWebsocketToken === null) {\n\t\t\t\tthrow this.annotateConnectionError(\n\t\t\t\t\tnew NonRetryableError(\"Websocket token is null\", OdspErrorTypes.fetchTokenError, {\n\t\t\t\t\t\tdriverVersion,\n\t\t\t\t\t}),\n\t\t\t\t\t\"getWebsocketToken\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (websocketEndpoint.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(websocketEndpoint.sensitivityLabelsInfo);\n\t\t\t}\n\n\t\t\tconst connectionId = uuid();\n\t\t\tif (this.firstConnectionAttempt) {\n\t\t\t\tthis.firstConnectionAttempt = false;\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"FirstConnectionAttemptDetails\",\n\t\t\t\t\tdetails: {\n\t\t\t\t\t\tconnectionId,\n\t\t\t\t\t\ttenantId: websocketEndpoint.tenantId,\n\t\t\t\t\t\tdocumentId: websocketEndpoint.id,\n\t\t\t\t\t},\n\t\t\t\t});\n\t\t\t}\n\t\t\ttry {\n\t\t\t\tconst connection = await this.createDeltaConnection(\n\t\t\t\t\twebsocketEndpoint.tenantId,\n\t\t\t\t\twebsocketEndpoint.id,\n\t\t\t\t\tfinalWebsocketToken,\n\t\t\t\t\tclient,\n\t\t\t\t\twebsocketEndpoint.deltaStreamSocketUrl,\n\t\t\t\t\tconnectionId,\n\t\t\t\t);\n\t\t\t\tconnection.on(\"op\", (documentId, ops: ISequencedDocumentMessage[]) => {\n\t\t\t\t\tthis.opsReceived(ops);\n\t\t\t\t});\n\t\t\t\tconnection.on(\"signal\", this.signalHandler);\n\t\t\t\t// Also process the initial signals\n\t\t\t\tthis.signalHandler(connection.initialSignals);\n\t\t\t\t// On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again\n\t\t\t\t// get the auth error on reconnecting and face latency.\n\t\t\t\tconnection.once(\"disconnect\", (error: unknown) => {\n\t\t\t\t\t// Clear the join session refresh timer so that it can be restarted on reconnection.\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t\terror !== null &&\n\t\t\t\t\t\t(error as Partial<IOdspError>).errorType === OdspErrorTypes.authorizationError\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t\t}\n\t\t\t\t\t// If we hit this assert, it means that \"disconnect\" event is emitted before the connection went through\n\t\t\t\t\t// dispose flow which is not correct and could lead to a bunch of errors.\n\t\t\t\t\tassert(connection.disposed, 0x4ae /* Connection should be disposed by now */);\n\t\t\t\t\tthis.currentConnection = undefined;\n\t\t\t\t});\n\t\t\t\tthis.currentConnection = connection;\n\t\t\t\treturn connection;\n\t\t\t} catch (error) {\n\t\t\t\t// Remove join session information from cache only if it is an error is from socket event connect_document_error.\n\t\t\t\t// Otherwise keep it in cache so that this session can be re-used after disconnection.\n\t\t\t\t// Also keeping an undefined check here to account for any unknown code path that is unable to stamp the value as in that case also\n\t\t\t\t// it is safer to clear join session cache and start over.\n\t\t\t\tif (\n\t\t\t\t\terror &&\n\t\t\t\t\ttypeof error === \"object\" &&\n\t\t\t\t\t((error as IAnyDriverError).scenarioName === \"connect_document_error\" ||\n\t\t\t\t\t\t(error as IAnyDriverError).scenarioName === undefined)\n\t\t\t\t) {\n\t\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\t\t}\n\t\t\t\tconst normalizedError = this.annotateConnectionError(\n\t\t\t\t\terror,\n\t\t\t\t\t\"createDeltaConnection\",\n\t\t\t\t\t!requestWebsocketTokenFromJoinSession,\n\t\t\t\t);\n\t\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\t\tnormalizedError.addTelemetryProperties({\n\t\t\t\t\t\tsocketDocumentId: websocketEndpoint.id,\n\t\t\t\t\t});\n\t\t\t\t}\n\t\t\t\tthrow normalizedError;\n\t\t\t}\n\t\t});\n\t}\n\n\tprivate readonly signalHandler = (signalsArg: ISignalMessage | ISignalMessage[]): void => {\n\t\tconst signals = Array.isArray(signalsArg) ? signalsArg : [signalsArg];\n\t\tfor (const signal of signals) {\n\t\t\t// Make sure it is not for a specific client as `PolicyLabelsUpdate` is meant for all clients.\n\t\t\tif (signal.clientId === null) {\n\t\t\t\t// We could have some issues/irregularities in parsing signals, so put it in try/catch block\n\t\t\t\t// and ignore the error as we can have labels update later on through join session response.\n\t\t\t\tlet envelope: ISignalEnvelope | undefined;\n\t\t\t\ttry {\n\t\t\t\t\tenvelope = JSON.parse(signal.content as string) as ISignalEnvelope;\n\t\t\t\t} catch {\n\t\t\t\t\t// Drop error\n\t\t\t\t}\n\t\t\t\tif (envelope?.contents?.type === policyLabelsUpdatesSignalType) {\n\t\t\t\t\tthis.emitSensitivityLabelUpdateEvent(\n\t\t\t\t\t\tenvelope.contents.content as ISensitivityLabelsInfo,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t};\n\n\tprivate clearJoinSessionTimer(): void {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tclearTimeout(this.joinSessionRefreshTimer);\n\t\t\tthis.joinSessionRefreshTimer = undefined;\n\t\t}\n\t}\n\n\tprivate async scheduleJoinSessionRefresh(\n\t\tdelta: number,\n\t\trequestSocketToken: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<void> {\n\t\tif (this.joinSessionRefreshTimer !== undefined) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\t// TODO: use a stronger type\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\tconst originalStackTraceLimit = (Error as any).stackTraceLimit;\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = 50;\n\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"DuplicateJoinSessionRefresh\",\n\t\t\t\t},\n\t\t\t\tnew Error(\"DuplicateJoinSessionRefresh\"),\n\t\t\t);\n\t\t\t// eslint-disable-next-line @typescript-eslint/no-unsafe-assignment, @typescript-eslint/no-unsafe-member-access, @typescript-eslint/no-explicit-any\n\t\t\t(Error as any).stackTraceLimit = originalStackTraceLimit;\n\t\t}\n\n\t\tawait new Promise<void>((resolve, reject) => {\n\t\t\tthis.joinSessionRefreshTimer = setTimeout(() => {\n\t\t\t\tthis.clearJoinSessionTimer();\n\t\t\t\t// Clear the timer as it is going to be scheduled again as part of refreshing join session.\n\t\t\t\tgetWithRetryForTokenRefresh(async (options) => {\n\t\t\t\t\tawait this.joinSession(\n\t\t\t\t\t\trequestSocketToken,\n\t\t\t\t\t\toptions,\n\t\t\t\t\t\ttrue /* isRefreshingJoinSession */,\n\t\t\t\t\t\tclientId,\n\t\t\t\t\t\tdisplayName,\n\t\t\t\t\t);\n\t\t\t\t\tresolve();\n\t\t\t\t}).catch((error) => {\n\t\t\t\t\t// eslint-disable-next-line @typescript-eslint/prefer-promise-reject-errors\n\t\t\t\t\treject(error);\n\t\t\t\t});\n\t\t\t}, delta);\n\t\t});\n\t}\n\n\tprivate async joinSession(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tclientId: string | undefined,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\t// If this call is to refresh the join session for the current connection but we are already disconnected in\n\t\t// the meantime or disconnected and then reconnected then do not make the call. However, we should not have\n\t\t// come here if that is the case because timer should have been disposed, but due to race condition with the\n\t\t// timer we should not make the call and throw error.\n\t\tif (\n\t\t\tisRefreshingJoinSession &&\n\t\t\t(this.currentConnection === undefined ||\n\t\t\t\t(clientId !== undefined && this.currentConnection.clientId !== clientId))\n\t\t) {\n\t\t\tthis.clearJoinSessionTimer();\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"JoinSessionRefreshTimerNotCancelled\",\n\t\t\t\tOdspErrorTypes.genericError,\n\t\t\t\t{\n\t\t\t\t\tdriverVersion,\n\t\t\t\t\tdetails: JSON.stringify({\n\t\t\t\t\t\tschedulerClientId: clientId,\n\t\t\t\t\t\tcurrentClientId: this.currentConnection?.clientId,\n\t\t\t\t\t}),\n\t\t\t\t},\n\t\t\t);\n\t\t}\n\t\tconst response = await this.joinSessionCore(\n\t\t\trequestSocketToken,\n\t\t\toptions,\n\t\t\tisRefreshingJoinSession,\n\t\t\tdisplayName,\n\t\t).catch((error) => {\n\t\t\tif (hasFacetCodes(error) && error.facetCodes !== undefined) {\n\t\t\t\tfor (const code of error.facetCodes) {\n\t\t\t\t\tswitch (code) {\n\t\t\t\t\t\tcase \"sessionForbidden\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnPreservedFiles\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnModerationEnabledLibrary\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnRequireCheckout\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnCheckoutFile\":\n\t\t\t\t\t\tcase \"sessionForbiddenOnInvisibleMinorVersion\": {\n\t\t\t\t\t\t\t// This document can only be opened in storage-only mode.\n\t\t\t\t\t\t\t// DeltaManager will recognize this error\n\t\t\t\t\t\t\t// and load without a delta stream connection.\n\t\t\t\t\t\t\tthis.policies = { ...this.policies, storageOnly: true };\n\t\t\t\t\t\t\tthrow new DeltaStreamConnectionForbiddenError(\n\t\t\t\t\t\t\t\t`Storage-only due to ${code}`,\n\t\t\t\t\t\t\t\t{ driverVersion },\n\t\t\t\t\t\t\t\tcode,\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\t\t\t\t\t\tdefault: {\n\t\t\t\t\t\t\tcontinue;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t\tthis._relayServiceTenantAndSessionId = `${response.tenantId}/${response.id}`;\n\t\treturn response;\n\t}\n\n\tprivate async joinSessionCore(\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tisRefreshingJoinSession: boolean,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> {\n\t\tconst disableJoinSessionRefresh = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.disableJoinSessionRefresh\",\n\t\t);\n\t\tconst setSensitivityLabelHeader = this.mc.config.getBoolean(\n\t\t\t\"Fluid.Driver.Odsp.setSensitivityLabelHeader\",\n\t\t);\n\t\tconst executeFetch = async (): Promise<{\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst joinSessionResponse = await fetchJoinSession(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\"opStream/joinSession\",\n\t\t\t\t\"POST\",\n\t\t\t\tthis.mc.logger,\n\t\t\t\tthis.getAuthHeader,\n\t\t\t\tthis.epochTracker,\n\t\t\t\trequestSocketToken,\n\t\t\t\toptions,\n\t\t\t\tdisableJoinSessionRefresh,\n\t\t\t\tsetSensitivityLabelHeader,\n\t\t\t\tisRefreshingJoinSession,\n\t\t\t\tdisplayName,\n\t\t\t);\n\t\t\t// Emit event only in case it is fetched from the network.\n\t\t\tif (joinSessionResponse.sensitivityLabelsInfo !== undefined) {\n\t\t\t\tthis.emitSensitivityLabelUpdateEvent(joinSessionResponse.sensitivityLabelsInfo);\n\t\t\t}\n\t\t\treturn {\n\t\t\t\tentryTime: Date.now(),\n\t\t\t\tjoinSessionResponse,\n\t\t\t};\n\t\t};\n\n\t\tconst getResponseAndRefreshAfterDeltaMs = async (): Promise<{\n\t\t\trefreshAfterDeltaMs: number;\n\t\t\tentryTime: number;\n\t\t\tjoinSessionResponse: ISocketStorageDiscovery;\n\t\t}> => {\n\t\t\tconst _response = await this.cache.sessionJoinCache.addOrGet(\n\t\t\t\tthis.joinSessionKey,\n\t\t\t\texecuteFetch,\n\t\t\t);\n\t\t\t// If the response does not contain refreshSessionDurationSeconds, then treat it as old flow and let the\n\t\t\t// cache entry to be treated as expired after 1 hour.\n\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds =\n\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds ?? 3600;\n\t\t\treturn {\n\t\t\t\t..._response,\n\t\t\t\trefreshAfterDeltaMs: this.calculateJoinSessionRefreshDelta(\n\t\t\t\t\t_response.entryTime,\n\t\t\t\t\t_response.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\t),\n\t\t\t};\n\t\t};\n\t\tlet response = await getResponseAndRefreshAfterDeltaMs();\n\t\t// This means that the cached entry has expired(This should not be possible if the response is fetched\n\t\t// from the network call). In this case we remove the cached entry and fetch the new response.\n\t\tif (response.refreshAfterDeltaMs <= 0) {\n\t\t\tthis.cache.sessionJoinCache.remove(this.joinSessionKey);\n\t\t\tresponse = await getResponseAndRefreshAfterDeltaMs();\n\t\t}\n\t\tif (!disableJoinSessionRefresh) {\n\t\t\tconst props = {\n\t\t\t\tentryTime: response.entryTime,\n\t\t\t\trefreshSessionDurationSeconds:\n\t\t\t\t\tresponse.joinSessionResponse.refreshSessionDurationSeconds,\n\t\t\t\trefreshAfterDeltaMs: response.refreshAfterDeltaMs,\n\t\t\t};\n\t\t\tif (response.refreshAfterDeltaMs > 0) {\n\t\t\t\tthis.scheduleJoinSessionRefresh(\n\t\t\t\t\tresponse.refreshAfterDeltaMs,\n\t\t\t\t\trequestSocketToken,\n\t\t\t\t\tthis.currentConnection?.clientId,\n\t\t\t\t\tdisplayName,\n\t\t\t\t).catch((error) => {\n\t\t\t\t\t// Log the error and do nothing as the reconnection would fetch the join session.\n\t\t\t\t\tthis.mc.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"JoinSessionRefreshError\",\n\t\t\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t\t\t},\n\t\t\t\t\t\terror,\n\t\t\t\t\t);\n\t\t\t\t});\n\t\t\t} else {\n\t\t\t\t// Logging just for informational purposes to help with debugging as this is a new feature.\n\t\t\t\tthis.mc.logger.sendTelemetryEvent({\n\t\t\t\t\teventName: \"JoinSessionRefreshNotScheduled\",\n\t\t\t\t\tdetails: JSON.stringify(props),\n\t\t\t\t});\n\t\t\t}\n\t\t}\n\t\treturn response.joinSessionResponse;\n\t}\n\n\tprivate emitSensitivityLabelUpdateEvent(\n\t\tsensitivityLabelsInfo: ISensitivityLabelsInfo,\n\t): void {\n\t\tconst createdTimestamp = sensitivityLabelsInfo.timestamp;\n\t\tassert(\n\t\t\ttypeof createdTimestamp === \"number\" && createdTimestamp > 0,\n\t\t\t0x8e0 /* time should be a positive number */,\n\t\t);\n\t\tif (createdTimestamp > this.labelUpdateTimestamp) {\n\t\t\tthis.labelUpdateTimestamp = createdTimestamp;\n\t\t\tthis.metadataUpdateHandler({\n\t\t\t\tsensitivityLabelsInfo: JSON.stringify(sensitivityLabelsInfo),\n\t\t\t});\n\t\t}\n\t}\n\n\tprivate calculateJoinSessionRefreshDelta(\n\t\tresponseFetchTime: number,\n\t\trefreshSessionDurationSeconds: number,\n\t): number {\n\t\t// 30 seconds is buffer time to refresh the session.\n\t\treturn responseFetchTime + (refreshSessionDurationSeconds * 1000 - 30000) - Date.now();\n\t}\n\n\t/**\n\t * Creates a connection to the given delta stream endpoint\n\t *\n\t * @param tenantId - the ID of the tenant\n\t * @param documentId - document ID\n\t * @param token - authorization token for delta service\n\t * @param client - information about the client\n\t * @param webSocketUrl - websocket URL\n\t * @param connectionId - connection ID for the connection\n\t */\n\tprivate async createDeltaConnection(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\ttoken: string | null,\n\t\tclient: IClient,\n\t\twebSocketUrl: string,\n\t\tconnectionId: string,\n\t): Promise<OdspDocumentDeltaConnection> {\n\t\tconst startTime = performanceNow();\n\t\tconst connection = await OdspDocumentDeltaConnection.create(\n\t\t\ttenantId,\n\t\t\tdocumentId,\n\t\t\ttoken,\n\t\t\tclient,\n\t\t\twebSocketUrl,\n\t\t\tthis.mc.logger,\n\t\t\t60000,\n\t\t\tthis.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tconnectionId,\n\t\t);\n\t\tconst duration = performanceNow() - startTime;\n\t\t// This event happens rather often, so it adds up to cost of telemetry.\n\t\t// Given that most reconnects result in reusing socket and happen very quickly,\n\t\t// report event only if it took longer than threshold.\n\t\tif (duration >= 2000) {\n\t\t\tthis.mc.logger.sendPerformanceEvent({\n\t\t\t\teventName: \"ConnectionSuccess\",\n\t\t\t\tduration,\n\t\t\t});\n\t\t}\n\t\treturn connection;\n\t}\n\n\tpublic dispose(error?: unknown): void {\n\t\tthis.clearJoinSessionTimer();\n\t\tthis.currentConnection?.dispose();\n\t\tthis.currentConnection = undefined;\n\t}\n}\n"]}
|
package/lib/packageVersion.d.ts
CHANGED
|
@@ -5,5 +5,5 @@
|
|
|
5
5
|
* THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY
|
|
6
6
|
*/
|
|
7
7
|
export declare const pkgName = "@fluidframework/odsp-driver";
|
|
8
|
-
export declare const pkgVersion = "2.
|
|
8
|
+
export declare const pkgVersion = "2.82.0";
|
|
9
9
|
//# sourceMappingURL=packageVersion.d.ts.map
|
package/lib/packageVersion.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.
|
|
1
|
+
{"version":3,"file":"packageVersion.js","sourceRoot":"","sources":["../src/packageVersion.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,CAAC,MAAM,OAAO,GAAG,6BAA6B,CAAC;AACrD,MAAM,CAAC,MAAM,UAAU,GAAG,QAAQ,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n *\n * THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY\n */\n\nexport const pkgName = \"@fluidframework/odsp-driver\";\nexport const pkgVersion = \"2.82.0\";\n"]}
|
package/lib/vroom.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vroom.d.ts","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,6CAEjB,aAAa,QACjB,MAAM,UACJ,KAAK,GAAG,MAAM,UACd,mBAAmB,iBACZ,+BAA+B,gBAChC,YAAY,sBACN,OAAO,WAClB,mBAAmB,6BACD,OAAO,GAAG,SAAS,6BACnB,OAAO,GAAG,SAAS,2BACrB,OAAO,eACnB,MAAM,GAAG,SAAS,KAC7B,QAAQ,uBAAuB,CAAC,
|
|
1
|
+
{"version":3,"file":"vroom.d.ts","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,EACX,aAAa,EACb,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACN,KAAK,mBAAmB,EAExB,MAAM,0CAA0C,CAAC;AAGlD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,mBAAmB,CAAC;AAGtD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAQ1D;;;;;;;;;;;;;;;;;GAiBG;AACH,eAAO,MAAM,gBAAgB,6CAEjB,aAAa,QACjB,MAAM,UACJ,KAAK,GAAG,MAAM,UACd,mBAAmB,iBACZ,+BAA+B,gBAChC,YAAY,sBACN,OAAO,WAClB,mBAAmB,6BACD,OAAO,GAAG,SAAS,6BACnB,OAAO,GAAG,SAAS,2BACrB,OAAO,eACnB,MAAM,GAAG,SAAS,KAC7B,QAAQ,uBAAuB,CAAC,CA0FnC,CAAC"}
|
package/lib/vroom.js
CHANGED
|
@@ -37,6 +37,7 @@ export const fetchJoinSession = mockify(async (urlParts, path, method, logger, g
|
|
|
37
37
|
requestSocketToken,
|
|
38
38
|
...tokenRefreshProps,
|
|
39
39
|
refreshingSession: isRefreshingJoinSession,
|
|
40
|
+
setSensitivityLabelHeader: setSensitivityLabelHeader ?? false,
|
|
40
41
|
};
|
|
41
42
|
return PerformanceEvent.timedExecAsync(logger, {
|
|
42
43
|
eventName: "JoinSession",
|
|
@@ -81,6 +82,7 @@ export const fetchJoinSession = mockify(async (urlParts, path, method, logger, g
|
|
|
81
82
|
pushv2: socketUrl.includes("pushf"),
|
|
82
83
|
webSocketHostName,
|
|
83
84
|
refreshSessionDurationSeconds: response.content.refreshSessionDurationSeconds,
|
|
85
|
+
hasSensitivityLabelsInfo: response.content.sensitivityLabelsInfo !== undefined,
|
|
84
86
|
});
|
|
85
87
|
if (response.content.runtimeTenantId && !response.content.tenantId) {
|
|
86
88
|
response.content.tenantId = response.content.runtimeTenantId;
|
package/lib/vroom.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"vroom.js","sourceRoot":"","sources":["../src/vroom.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAQH,OAAO,EAEN,gBAAgB,GAChB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EAAE,EAAE,IAAI,IAAI,EAAE,MAAM,MAAM,CAAC;AAGlC,OAAO,EAAE,OAAO,EAAE,MAAM,cAAc,CAAC;AACvC,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAO/C;;;;;;;;;;;;;;;;;GAiBG;AACH,MAAM,CAAC,MAAM,gBAAgB,GAAG,OAAO,CACtC,KAAK,EACJ,QAAuB,EACvB,IAAY,EACZ,MAAsB,EACtB,MAA2B,EAC3B,aAA8C,EAC9C,YAA0B,EAC1B,kBAA2B,EAC3B,OAA4B,EAC5B,yBAA8C,EAC9C,yBAA8C,EAC9C,uBAAgC,EAChC,WAA+B,EACI,EAAE;IACrC,MAAM,OAAO,GAAG,UAAU,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC;IACtD,MAAM,GAAG,GAAG,GAAG,OAAO,WAAW,QAAQ,CAAC,OAAO,UAAU,QAAQ,CAAC,MAAM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AC,OAAO,CAAC,eAAe,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC;YACpE,QAAQ,CAAC,OAAO,CAAC,QAAQ,GAAG,QAAQ,CAAC,OAAO,CAAC,eAAe,CAAC;QAC9D,CAAC;QAED,OAAO,QAAQ,CAAC,OAAO,CAAC;IACzB,CAAC,CACD,CAAC;AACH,CAAC,CACD,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { ITelemetryBaseProperties } from \"@fluidframework/core-interfaces\";\nimport type {\n\tIOdspUrlParts,\n\tISocketStorageDiscovery,\n\tInstrumentedStorageTokenFetcher,\n} from \"@fluidframework/odsp-driver-definitions/internal\";\nimport {\n\ttype ITelemetryLoggerExt,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils/internal\";\nimport { v4 as uuid } from \"uuid\";\n\nimport type { EpochTracker } from \"./epochTracker.js\";\nimport { mockify } from \"./mockify.js\";\nimport { getApiRoot } from \"./odspUrlHelper.js\";\nimport type { TokenFetchOptionsEx } from \"./odspUtils.js\";\nimport { runWithRetry } from \"./retryUtils.js\";\n\ninterface IJoinSessionBody {\n\trequestSocketToken?: boolean;\n\tdisplayName?: string;\n}\n\n/**\n * Makes join session call on SPO to get information about the web socket for a document\n * @param urlParts - The SPO drive id, itemId, siteUrl that this request should be made against\n * @param path - The API path that is relevant to this request\n * @param method - The type of request, such as GET or POST\n * @param logger - A logger to use for this request\n * @param getAuthHeader - A function that is able to provide the access token for this request\n * @param epochTracker - fetch wrapper which incorporates epoch logic around joinSession call\n * @param requestSocketToken - flag indicating whether joinSession is expected to return access token\n * which is used when establishing websocket connection with collab session backend service.\n * @param options - Options to fetch the token.\n * @param disableJoinSessionRefresh - Whether the caller wants to disable refreshing join session periodically.\n * @param setSensitivityLabelHeader - Whether the caller wants to set the Return-Sensitivity-Labels Prefer header in the join session request.\n * @param isRefreshingJoinSession - whether call is to refresh the session before expiry.\n * @param displayName - display name used to identify client joining a session.\n * This is optional and used only when collab session is being joined by client acting in app-only mode (i.e. without user context).\n * If not specified client display name is extracted from the access token that is used to join session.\n */\nexport const fetchJoinSession = mockify(\n\tasync (\n\t\turlParts: IOdspUrlParts,\n\t\tpath: string,\n\t\tmethod: \"GET\" | \"POST\",\n\t\tlogger: ITelemetryLoggerExt,\n\t\tgetAuthHeader: InstrumentedStorageTokenFetcher,\n\t\tepochTracker: EpochTracker,\n\t\trequestSocketToken: boolean,\n\t\toptions: TokenFetchOptionsEx,\n\t\tdisableJoinSessionRefresh: boolean | undefined,\n\t\tsetSensitivityLabelHeader: boolean | undefined,\n\t\tisRefreshingJoinSession: boolean,\n\t\tdisplayName: string | undefined,\n\t): Promise<ISocketStorageDiscovery> => {\n\t\tconst apiRoot = getApiRoot(new URL(urlParts.siteUrl));\n\t\tconst url = `${apiRoot}/drives/${urlParts.driveId}/items/${urlParts.itemId}/${path}?ump=1`;\n\t\tconst authHeader = await getAuthHeader(\n\t\t\t{ ...options, request: { url, method } },\n\t\t\t\"JoinSession\",\n\t\t);\n\n\t\tconst tokenRefreshProps = options.refresh\n\t\t\t? { hasClaims: !!options.claims, hasTenantId: !!options.tenantId }\n\t\t\t: {};\n\t\tconst details: ITelemetryBaseProperties = {\n\t\t\trefreshedToken: options.refresh,\n\t\t\trequestSocketToken,\n\t\t\t...tokenRefreshProps,\n\t\t\trefreshingSession: isRefreshingJoinSession,\n\t\t\tsetSensitivityLabelHeader: setSensitivityLabelHeader ?? false,\n\t\t};\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tlogger,\n\t\t\t{\n\t\t\t\teventName: \"JoinSession\",\n\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\tdetails: JSON.stringify(details),\n\t\t\t\t...tokenRefreshProps,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst formBoundary = uuid();\n\t\t\t\tlet postBody = `--${formBoundary}\\r\\n`;\n\t\t\t\tpostBody += `Authorization: ${authHeader}\\r\\n`;\n\t\t\t\tpostBody += `X-HTTP-Method-Override: POST\\r\\n`;\n\t\t\t\tpostBody += `Content-Type: application/json\\r\\n`;\n\t\t\t\tif (!disableJoinSessionRefresh) {\n\t\t\t\t\tpostBody += `Prefer: FluidRemoveCheckAccess\\r\\n`;\n\t\t\t\t}\n\t\t\t\tif (setSensitivityLabelHeader) {\n\t\t\t\t\tpostBody += `Prefer: Return-Sensitivity-Labels\\r\\n`;\n\t\t\t\t}\n\t\t\t\tpostBody += `_post: 1\\r\\n`;\n\n\t\t\t\tlet requestBody: IJoinSessionBody | undefined;\n\t\t\t\tif (requestSocketToken) {\n\t\t\t\t\trequestBody = { ...requestBody, requestSocketToken: true };\n\t\t\t\t}\n\t\t\t\tif (displayName) {\n\t\t\t\t\trequestBody = { ...requestBody, displayName };\n\t\t\t\t}\n\t\t\t\tif (requestBody) {\n\t\t\t\t\tpostBody += `\\r\\n${JSON.stringify(requestBody)}\\r\\n`;\n\t\t\t\t}\n\t\t\t\tpostBody += `\\r\\n--${formBoundary}--`;\n\t\t\t\tconst headers: { [index: string]: string } = {\n\t\t\t\t\t\"Content-Type\": `multipart/form-data;boundary=${formBoundary}`,\n\t\t\t\t};\n\n\t\t\t\tconst response = await runWithRetry(\n\t\t\t\t\tasync () =>\n\t\t\t\t\t\tepochTracker.fetchAndParseAsJSON<ISocketStorageDiscovery>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{ method, headers, body: postBody },\n\t\t\t\t\t\t\t\"joinSession\",\n\t\t\t\t\t\t\ttrue,\n\t\t\t\t\t\t),\n\t\t\t\t\t\"joinSession\",\n\t\t\t\t\tlogger,\n\t\t\t\t);\n\n\t\t\t\tconst socketUrl = response.content.deltaStreamSocketUrl;\n\t\t\t\t// expecting socketUrl to be something like https://{hostName}/...\n\t\t\t\tconst webSocketHostName = socketUrl.split(\"/\")[2];\n\n\t\t\t\t// TODO SPO-specific telemetry\n\t\t\t\tevent.end({\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\t// pushV2 websocket urls will contain pushf\n\t\t\t\t\tpushv2: socketUrl.includes(\"pushf\"),\n\t\t\t\t\twebSocketHostName,\n\t\t\t\t\trefreshSessionDurationSeconds: response.content.refreshSessionDurationSeconds,\n\t\t\t\t\thasSensitivityLabelsInfo: response.content.sensitivityLabelsInfo !== undefined,\n\t\t\t\t});\n\n\t\t\t\tif (response.content.runtimeTenantId && !response.content.tenantId) {\n\t\t\t\t\tresponse.content.tenantId = response.content.runtimeTenantId;\n\t\t\t\t}\n\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\t},\n);\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/odsp-driver",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.82.0",
|
|
4
4
|
"description": "Socket storage implementation for SPO and ODC",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -69,30 +69,30 @@
|
|
|
69
69
|
"temp-directory": "nyc/.nyc_output"
|
|
70
70
|
},
|
|
71
71
|
"dependencies": {
|
|
72
|
-
"@fluid-internal/client-utils": "~2.
|
|
73
|
-
"@fluidframework/core-interfaces": "~2.
|
|
74
|
-
"@fluidframework/core-utils": "~2.
|
|
75
|
-
"@fluidframework/driver-base": "~2.
|
|
76
|
-
"@fluidframework/driver-definitions": "~2.
|
|
77
|
-
"@fluidframework/driver-utils": "~2.
|
|
78
|
-
"@fluidframework/odsp-doclib-utils": "~2.
|
|
79
|
-
"@fluidframework/odsp-driver-definitions": "~2.
|
|
80
|
-
"@fluidframework/telemetry-utils": "~2.
|
|
72
|
+
"@fluid-internal/client-utils": "~2.82.0",
|
|
73
|
+
"@fluidframework/core-interfaces": "~2.82.0",
|
|
74
|
+
"@fluidframework/core-utils": "~2.82.0",
|
|
75
|
+
"@fluidframework/driver-base": "~2.82.0",
|
|
76
|
+
"@fluidframework/driver-definitions": "~2.82.0",
|
|
77
|
+
"@fluidframework/driver-utils": "~2.82.0",
|
|
78
|
+
"@fluidframework/odsp-doclib-utils": "~2.82.0",
|
|
79
|
+
"@fluidframework/odsp-driver-definitions": "~2.82.0",
|
|
80
|
+
"@fluidframework/telemetry-utils": "~2.82.0",
|
|
81
81
|
"socket.io-client": "~4.7.5",
|
|
82
82
|
"uuid": "^11.1.0"
|
|
83
83
|
},
|
|
84
84
|
"devDependencies": {
|
|
85
85
|
"@arethetypeswrong/cli": "^0.18.2",
|
|
86
86
|
"@biomejs/biome": "~1.9.3",
|
|
87
|
-
"@fluid-internal/mocha-test-setup": "~2.
|
|
87
|
+
"@fluid-internal/mocha-test-setup": "~2.82.0",
|
|
88
88
|
"@fluid-tools/build-cli": "^0.63.0",
|
|
89
89
|
"@fluidframework/build-common": "^2.0.3",
|
|
90
90
|
"@fluidframework/build-tools": "^0.63.0",
|
|
91
|
-
"@fluidframework/eslint-config-fluid": "~2.
|
|
91
|
+
"@fluidframework/eslint-config-fluid": "~2.82.0",
|
|
92
92
|
"@fluidframework/odsp-driver-previous": "npm:@fluidframework/odsp-driver@2.81.0",
|
|
93
93
|
"@microsoft/api-extractor": "7.52.11",
|
|
94
94
|
"@types/mocha": "^10.0.10",
|
|
95
|
-
"@types/node": "
|
|
95
|
+
"@types/node": "~20.19.30",
|
|
96
96
|
"@types/sinon": "^17.0.3",
|
|
97
97
|
"c8": "^10.1.3",
|
|
98
98
|
"concurrently": "^9.2.1",
|
|
@@ -512,8 +512,11 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
512
512
|
private emitSensitivityLabelUpdateEvent(
|
|
513
513
|
sensitivityLabelsInfo: ISensitivityLabelsInfo,
|
|
514
514
|
): void {
|
|
515
|
-
const createdTimestamp =
|
|
516
|
-
assert(
|
|
515
|
+
const createdTimestamp = sensitivityLabelsInfo.timestamp;
|
|
516
|
+
assert(
|
|
517
|
+
typeof createdTimestamp === "number" && createdTimestamp > 0,
|
|
518
|
+
0x8e0 /* time should be a positive number */,
|
|
519
|
+
);
|
|
517
520
|
if (createdTimestamp > this.labelUpdateTimestamp) {
|
|
518
521
|
this.labelUpdateTimestamp = createdTimestamp;
|
|
519
522
|
this.metadataUpdateHandler({
|
package/src/packageVersion.ts
CHANGED
package/src/vroom.ts
CHANGED
|
@@ -74,6 +74,7 @@ export const fetchJoinSession = mockify(
|
|
|
74
74
|
requestSocketToken,
|
|
75
75
|
...tokenRefreshProps,
|
|
76
76
|
refreshingSession: isRefreshingJoinSession,
|
|
77
|
+
setSensitivityLabelHeader: setSensitivityLabelHeader ?? false,
|
|
77
78
|
};
|
|
78
79
|
|
|
79
80
|
return PerformanceEvent.timedExecAsync(
|
|
@@ -136,6 +137,7 @@ export const fetchJoinSession = mockify(
|
|
|
136
137
|
pushv2: socketUrl.includes("pushf"),
|
|
137
138
|
webSocketHostName,
|
|
138
139
|
refreshSessionDurationSeconds: response.content.refreshSessionDurationSeconds,
|
|
140
|
+
hasSensitivityLabelsInfo: response.content.sensitivityLabelsInfo !== undefined,
|
|
139
141
|
});
|
|
140
142
|
|
|
141
143
|
if (response.content.runtimeTenantId && !response.content.tenantId) {
|
package/biome.jsonc
DELETED