@fluidframework/odsp-driver 2.0.0-dev-rc.1.0.0.225277 → 2.0.0-dev-rc.1.0.0.232845
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 +34 -0
- package/README.md +0 -6
- package/api-report/odsp-driver.api.md +5 -5
- package/dist/{ReadBufferUtils.cjs → ReadBufferUtils.js} +1 -1
- package/dist/ReadBufferUtils.js.map +1 -0
- package/dist/{WriteBufferUtils.cjs → WriteBufferUtils.js} +2 -2
- package/dist/WriteBufferUtils.js.map +1 -0
- package/dist/{checkUrl.cjs → checkUrl.js} +2 -2
- package/dist/checkUrl.js.map +1 -0
- package/dist/compactSnapshotParser.d.ts +2 -2
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/{compactSnapshotParser.cjs → compactSnapshotParser.js} +12 -11
- package/dist/compactSnapshotParser.js.map +1 -0
- package/dist/compactSnapshotWriter.d.ts +2 -2
- package/dist/compactSnapshotWriter.d.ts.map +1 -1
- package/dist/{compactSnapshotWriter.cjs → compactSnapshotWriter.js} +5 -5
- package/dist/compactSnapshotWriter.js.map +1 -0
- package/dist/{constants.cjs → constants.js} +1 -1
- package/dist/constants.js.map +1 -0
- package/dist/contracts.d.ts +14 -0
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contracts.js +13 -0
- package/dist/contracts.js.map +1 -0
- package/dist/{contractsPublic.cjs → contractsPublic.js} +1 -1
- package/dist/contractsPublic.js.map +1 -0
- package/dist/createFile.d.ts +1 -1
- package/dist/createFile.d.ts.map +1 -1
- package/dist/{createFile.cjs → createFile.js} +19 -38
- package/dist/createFile.js.map +1 -0
- package/dist/createNewContainerOnExistingFile.d.ts.map +1 -1
- package/dist/{createNewContainerOnExistingFile.cjs → createNewContainerOnExistingFile.js} +7 -7
- package/dist/createNewContainerOnExistingFile.js.map +1 -0
- package/dist/{createNewModule.cjs → createNewModule.js} +3 -3
- package/dist/createNewModule.js.map +1 -0
- package/dist/createNewUtils.d.ts +2 -2
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/{createNewUtils.cjs → createNewUtils.js} +8 -7
- package/dist/createNewUtils.js.map +1 -0
- package/dist/createOdspCreateContainerRequest.d.ts +2 -2
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/{createOdspCreateContainerRequest.cjs → createOdspCreateContainerRequest.js} +2 -2
- package/dist/createOdspCreateContainerRequest.js.map +1 -0
- package/dist/{createOdspUrl.cjs → createOdspUrl.js} +1 -1
- package/dist/createOdspUrl.js.map +1 -0
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/{epochTracker.cjs → epochTracker.js} +9 -10
- package/dist/epochTracker.js.map +1 -0
- package/dist/{fetch.cjs → fetch.js} +1 -1
- package/dist/fetch.js.map +1 -0
- package/dist/fetchSnapshot.d.ts +4 -4
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/{fetchSnapshot.cjs → fetchSnapshot.js} +20 -21
- package/dist/fetchSnapshot.js.map +1 -0
- package/dist/getFileLink.d.ts.map +1 -1
- package/dist/{getFileLink.cjs → getFileLink.js} +8 -8
- package/dist/getFileLink.js.map +1 -0
- package/dist/{getQueryString.cjs → getQueryString.js} +1 -1
- package/dist/getQueryString.js.map +1 -0
- package/dist/{getUrlAndHeadersWithAuth.cjs → getUrlAndHeadersWithAuth.js} +1 -1
- package/dist/getUrlAndHeadersWithAuth.js.map +1 -0
- package/dist/{index.cjs → index.js} +18 -18
- package/dist/index.js.map +1 -0
- package/dist/localOdspDriver/{localOdspDeltaStorageService.cjs → localOdspDeltaStorageService.js} +1 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.js.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentService.d.ts +3 -2
- package/dist/localOdspDriver/localOdspDocumentService.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentService.cjs → localOdspDocumentService.js} +6 -4
- package/dist/localOdspDriver/localOdspDocumentService.js.map +1 -0
- package/dist/localOdspDriver/{localOdspDocumentServiceFactory.cjs → localOdspDocumentServiceFactory.js} +4 -4
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.js.map +1 -0
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts +2 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.d.ts.map +1 -1
- package/dist/localOdspDriver/{localOdspDocumentStorageManager.cjs → localOdspDocumentStorageManager.js} +7 -4
- package/dist/localOdspDriver/localOdspDocumentStorageManager.js.map +1 -0
- package/dist/odsp-driver-alpha.d.ts +4 -3
- package/dist/odsp-driver-beta.d.ts +3 -3
- package/dist/odsp-driver-public.d.ts +3 -3
- package/dist/odsp-driver-untrimmed.d.ts +5 -4
- package/dist/odspCache.d.ts +2 -2
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/{odspCache.cjs → odspCache.js} +1 -1
- package/dist/odspCache.js.map +1 -0
- package/dist/odspDelayLoadedDeltaStream.d.ts +5 -1
- package/dist/odspDelayLoadedDeltaStream.d.ts.map +1 -1
- package/dist/{odspDelayLoadedDeltaStream.cjs → odspDelayLoadedDeltaStream.js} +61 -10
- package/dist/odspDelayLoadedDeltaStream.js.map +1 -0
- package/dist/{odspDeltaStorageService.cjs → odspDeltaStorageService.js} +2 -2
- package/dist/odspDeltaStorageService.js.map +1 -0
- package/dist/{odspDocumentDeltaConnection.cjs → odspDocumentDeltaConnection.js} +4 -4
- package/dist/odspDocumentDeltaConnection.js.map +1 -0
- package/dist/odspDocumentService.d.ts +3 -2
- package/dist/odspDocumentService.d.ts.map +1 -1
- package/dist/{odspDocumentService.cjs → odspDocumentService.js} +16 -11
- package/dist/odspDocumentService.js.map +1 -0
- package/dist/{odspDocumentServiceFactory.cjs → odspDocumentServiceFactory.js} +3 -3
- package/dist/odspDocumentServiceFactory.js.map +1 -0
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/{odspDocumentServiceFactoryCore.cjs → odspDocumentServiceFactoryCore.js} +9 -14
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -0
- package/dist/{odspDocumentServiceFactoryWithCodeSplit.cjs → odspDocumentServiceFactoryWithCodeSplit.js} +2 -2
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -0
- package/dist/odspDocumentStorageManager.d.ts +2 -1
- package/dist/odspDocumentStorageManager.d.ts.map +1 -1
- package/dist/{odspDocumentStorageManager.cjs → odspDocumentStorageManager.js} +39 -18
- package/dist/odspDocumentStorageManager.js.map +1 -0
- package/dist/odspDocumentStorageServiceBase.d.ts +3 -3
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/{odspDocumentStorageServiceBase.cjs → odspDocumentStorageServiceBase.js} +4 -4
- package/dist/odspDocumentStorageServiceBase.js.map +1 -0
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/{odspDriverUrlResolver.cjs → odspDriverUrlResolver.js} +9 -18
- package/dist/odspDriverUrlResolver.js.map +1 -0
- package/dist/{odspDriverUrlResolverForShareLink.cjs → odspDriverUrlResolverForShareLink.js} +7 -7
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -0
- package/dist/odspError.d.ts.map +1 -1
- package/dist/{odspError.cjs → odspError.js} +4 -4
- package/dist/odspError.js.map +1 -0
- package/dist/{odspFluidFileLink.cjs → odspFluidFileLink.js} +2 -2
- package/dist/odspFluidFileLink.js.map +1 -0
- package/dist/{odspLocationRedirection.cjs → odspLocationRedirection.js} +2 -2
- package/dist/odspLocationRedirection.js.map +1 -0
- package/dist/odspPublicUtils.d.ts +1 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/{odspPublicUtils.cjs → odspPublicUtils.js} +1 -1
- package/dist/odspPublicUtils.js.map +1 -0
- package/dist/odspSnapshotParser.d.ts +2 -2
- package/dist/odspSnapshotParser.d.ts.map +1 -1
- package/dist/{odspSnapshotParser.cjs → odspSnapshotParser.js} +3 -2
- package/dist/odspSnapshotParser.js.map +1 -0
- package/dist/{odspSummaryUploadManager.cjs → odspSummaryUploadManager.js} +3 -3
- package/dist/odspSummaryUploadManager.js.map +1 -0
- package/dist/{odspUrlHelper.cjs → odspUrlHelper.js} +1 -1
- package/dist/odspUrlHelper.js.map +1 -0
- package/dist/odspUtils.d.ts +11 -7
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/{odspUtils.cjs → odspUtils.js} +23 -19
- package/dist/odspUtils.js.map +1 -0
- package/dist/{opsCaching.cjs → opsCaching.js} +1 -1
- package/dist/opsCaching.js.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/{packageVersion.cjs → packageVersion.js} +2 -2
- package/dist/packageVersion.js.map +1 -0
- package/dist/{prefetchLatestSnapshot.cjs → prefetchLatestSnapshot.js} +3 -3
- package/dist/prefetchLatestSnapshot.js.map +1 -0
- package/dist/retryErrorsStorageAdapter.d.ts +2 -1
- package/dist/retryErrorsStorageAdapter.d.ts.map +1 -1
- package/dist/{retryErrorsStorageAdapter.cjs → retryErrorsStorageAdapter.js} +10 -2
- package/dist/retryErrorsStorageAdapter.js.map +1 -0
- package/dist/{retryUtils.cjs → retryUtils.js} +3 -3
- package/dist/retryUtils.js.map +1 -0
- package/dist/{socketModule.cjs → socketModule.js} +1 -1
- package/dist/socketModule.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/{vroom.cjs → vroom.js} +4 -4
- package/dist/vroom.js.map +1 -0
- package/dist/{zipItDataRepresentationUtils.cjs → zipItDataRepresentationUtils.js} +5 -5
- package/dist/zipItDataRepresentationUtils.js.map +1 -0
- package/lib/compactSnapshotParser.d.mts +2 -2
- package/lib/compactSnapshotParser.d.mts.map +1 -1
- package/lib/compactSnapshotParser.mjs +8 -7
- package/lib/compactSnapshotParser.mjs.map +1 -1
- package/lib/compactSnapshotWriter.d.mts +2 -2
- package/lib/compactSnapshotWriter.d.mts.map +1 -1
- package/lib/compactSnapshotWriter.mjs +1 -1
- package/lib/compactSnapshotWriter.mjs.map +1 -1
- package/lib/contracts.d.mts +14 -0
- package/lib/contracts.d.mts.map +1 -1
- package/lib/contracts.mjs +4 -0
- package/lib/contracts.mjs.map +1 -1
- package/lib/createFile.d.mts +1 -1
- package/lib/createFile.d.mts.map +1 -1
- package/lib/createFile.mjs +10 -29
- package/lib/createFile.mjs.map +1 -1
- package/lib/createNewContainerOnExistingFile.d.mts.map +1 -1
- package/lib/createNewContainerOnExistingFile.mjs.map +1 -1
- package/lib/createNewUtils.d.mts +2 -2
- package/lib/createNewUtils.d.mts.map +1 -1
- package/lib/createNewUtils.mjs +4 -3
- package/lib/createNewUtils.mjs.map +1 -1
- package/lib/createOdspCreateContainerRequest.d.mts +2 -2
- package/lib/createOdspCreateContainerRequest.d.mts.map +1 -1
- package/lib/createOdspCreateContainerRequest.mjs.map +1 -1
- package/lib/epochTracker.d.mts.map +1 -1
- package/lib/epochTracker.mjs +4 -5
- package/lib/epochTracker.mjs.map +1 -1
- package/lib/fetchSnapshot.d.mts +4 -4
- package/lib/fetchSnapshot.d.mts.map +1 -1
- package/lib/fetchSnapshot.mjs +13 -14
- package/lib/fetchSnapshot.mjs.map +1 -1
- package/lib/getFileLink.d.mts.map +1 -1
- package/lib/getFileLink.mjs +3 -3
- package/lib/getFileLink.mjs.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.d.mts +3 -2
- package/lib/localOdspDriver/localOdspDocumentService.d.mts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs +3 -1
- package/lib/localOdspDriver/localOdspDocumentService.mjs.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts +2 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.d.mts.map +1 -1
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs +3 -0
- package/lib/localOdspDriver/localOdspDocumentStorageManager.mjs.map +1 -1
- package/lib/odsp-driver-alpha.d.mts +4 -3
- package/lib/odsp-driver-beta.d.mts +3 -3
- package/lib/odsp-driver-public.d.mts +3 -3
- package/lib/odsp-driver-untrimmed.d.mts +5 -4
- package/lib/odspCache.d.mts +2 -2
- package/lib/odspCache.d.mts.map +1 -1
- package/lib/odspCache.mjs.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts +5 -1
- package/lib/odspDelayLoadedDeltaStream.d.mts.map +1 -1
- package/lib/odspDelayLoadedDeltaStream.mjs +57 -6
- package/lib/odspDelayLoadedDeltaStream.mjs.map +1 -1
- package/lib/odspDocumentService.d.mts +3 -2
- package/lib/odspDocumentService.d.mts.map +1 -1
- package/lib/odspDocumentService.mjs +6 -3
- package/lib/odspDocumentService.mjs.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.mts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.mjs +2 -9
- package/lib/odspDocumentServiceFactoryCore.mjs.map +1 -1
- package/lib/odspDocumentStorageManager.d.mts +2 -1
- package/lib/odspDocumentStorageManager.d.mts.map +1 -1
- package/lib/odspDocumentStorageManager.mjs +33 -14
- package/lib/odspDocumentStorageManager.mjs.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.mts +3 -3
- package/lib/odspDocumentStorageServiceBase.d.mts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.mjs +3 -3
- package/lib/odspDocumentStorageServiceBase.mjs.map +1 -1
- package/lib/odspDriverUrlResolver.d.mts.map +1 -1
- package/lib/odspDriverUrlResolver.mjs +4 -13
- package/lib/odspDriverUrlResolver.mjs.map +1 -1
- package/lib/odspError.d.mts.map +1 -1
- package/lib/odspError.mjs +2 -2
- package/lib/odspError.mjs.map +1 -1
- package/lib/odspPublicUtils.d.mts +1 -0
- package/lib/odspPublicUtils.d.mts.map +1 -1
- package/lib/odspPublicUtils.mjs.map +1 -1
- package/lib/odspSnapshotParser.d.mts +2 -2
- package/lib/odspSnapshotParser.d.mts.map +1 -1
- package/lib/odspSnapshotParser.mjs +2 -1
- package/lib/odspSnapshotParser.mjs.map +1 -1
- package/lib/odspUtils.d.mts +11 -7
- package/lib/odspUtils.d.mts.map +1 -1
- package/lib/odspUtils.mjs +19 -16
- package/lib/odspUtils.mjs.map +1 -1
- package/lib/packageVersion.d.mts +1 -1
- package/lib/packageVersion.mjs +1 -1
- package/lib/packageVersion.mjs.map +1 -1
- package/lib/retryErrorsStorageAdapter.d.mts +2 -1
- package/lib/retryErrorsStorageAdapter.d.mts.map +1 -1
- package/lib/retryErrorsStorageAdapter.mjs +9 -1
- package/lib/retryErrorsStorageAdapter.mjs.map +1 -1
- package/lib/retryUtils.mjs +2 -2
- package/lib/retryUtils.mjs.map +1 -1
- package/lib/zipItDataRepresentationUtils.mjs +2 -2
- package/lib/zipItDataRepresentationUtils.mjs.map +1 -1
- package/package.json +30 -21
- package/src/compactSnapshotParser.ts +10 -9
- package/src/compactSnapshotWriter.ts +3 -3
- package/src/contracts.ts +17 -0
- package/src/createFile.ts +10 -38
- package/src/createNewContainerOnExistingFile.ts +2 -2
- package/src/createNewUtils.ts +7 -6
- package/src/createOdspCreateContainerRequest.ts +2 -2
- package/src/epochTracker.ts +4 -4
- package/src/fetchSnapshot.ts +21 -22
- package/src/getFileLink.ts +3 -3
- package/src/localOdspDriver/localOdspDocumentService.ts +9 -2
- package/src/localOdspDriver/localOdspDocumentStorageManager.ts +10 -3
- package/src/odspCache.ts +2 -2
- package/src/odspDelayLoadedDeltaStream.ts +67 -6
- package/src/odspDocumentService.ts +10 -2
- package/src/odspDocumentServiceFactoryCore.ts +3 -11
- package/src/odspDocumentStorageManager.ts +60 -27
- package/src/odspDocumentStorageServiceBase.ts +8 -5
- package/src/odspDriverUrlResolver.ts +3 -17
- package/src/odspError.ts +2 -3
- package/src/odspPublicUtils.ts +1 -0
- package/src/odspSnapshotParser.ts +5 -6
- package/src/odspUtils.ts +34 -28
- package/src/packageVersion.ts +1 -1
- package/src/retryErrorsStorageAdapter.ts +12 -1
- package/src/retryUtils.ts +2 -2
- package/src/zipItDataRepresentationUtils.ts +2 -2
- package/dist/ReadBufferUtils.cjs.map +0 -1
- package/dist/WriteBufferUtils.cjs.map +0 -1
- package/dist/checkUrl.cjs.map +0 -1
- package/dist/compactSnapshotParser.cjs.map +0 -1
- package/dist/compactSnapshotWriter.cjs.map +0 -1
- package/dist/constants.cjs.map +0 -1
- package/dist/contracts.cjs +0 -9
- package/dist/contracts.cjs.map +0 -1
- package/dist/contractsPublic.cjs.map +0 -1
- package/dist/createFile.cjs.map +0 -1
- package/dist/createNewContainerOnExistingFile.cjs.map +0 -1
- package/dist/createNewModule.cjs.map +0 -1
- package/dist/createNewUtils.cjs.map +0 -1
- package/dist/createOdspCreateContainerRequest.cjs.map +0 -1
- package/dist/createOdspUrl.cjs.map +0 -1
- package/dist/epochTracker.cjs.map +0 -1
- package/dist/fetch.cjs.map +0 -1
- package/dist/fetchSnapshot.cjs.map +0 -1
- package/dist/getFileLink.cjs.map +0 -1
- package/dist/getQueryString.cjs.map +0 -1
- package/dist/getUrlAndHeadersWithAuth.cjs.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDeltaStorageService.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentService.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentServiceFactory.cjs.map +0 -1
- package/dist/localOdspDriver/localOdspDocumentStorageManager.cjs.map +0 -1
- package/dist/odspCache.cjs.map +0 -1
- package/dist/odspDelayLoadedDeltaStream.cjs.map +0 -1
- package/dist/odspDeltaStorageService.cjs.map +0 -1
- package/dist/odspDocumentDeltaConnection.cjs.map +0 -1
- package/dist/odspDocumentService.cjs.map +0 -1
- package/dist/odspDocumentServiceFactory.cjs.map +0 -1
- package/dist/odspDocumentServiceFactoryCore.cjs.map +0 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.cjs.map +0 -1
- package/dist/odspDocumentStorageManager.cjs.map +0 -1
- package/dist/odspDocumentStorageServiceBase.cjs.map +0 -1
- package/dist/odspDriverUrlResolver.cjs.map +0 -1
- package/dist/odspDriverUrlResolverForShareLink.cjs.map +0 -1
- package/dist/odspError.cjs.map +0 -1
- package/dist/odspFluidFileLink.cjs.map +0 -1
- package/dist/odspLocationRedirection.cjs.map +0 -1
- package/dist/odspPublicUtils.cjs.map +0 -1
- package/dist/odspSnapshotParser.cjs.map +0 -1
- package/dist/odspSummaryUploadManager.cjs.map +0 -1
- package/dist/odspUrlHelper.cjs.map +0 -1
- package/dist/odspUtils.cjs.map +0 -1
- package/dist/opsCaching.cjs.map +0 -1
- package/dist/packageVersion.cjs.map +0 -1
- package/dist/prefetchLatestSnapshot.cjs.map +0 -1
- package/dist/retryErrorsStorageAdapter.cjs.map +0 -1
- package/dist/retryUtils.cjs.map +0 -1
- package/dist/socketModule.cjs.map +0 -1
- package/dist/vroom.cjs.map +0 -1
- package/dist/zipItDataRepresentationUtils.cjs.map +0 -1
- package/tsc-multi.test.json +0 -4
- /package/{.eslintrc.js → .eslintrc.cjs} +0 -0
package/src/epochTracker.ts
CHANGED
|
@@ -20,6 +20,7 @@ import {
|
|
|
20
20
|
LocationRedirectionError,
|
|
21
21
|
} from "@fluidframework/driver-utils";
|
|
22
22
|
import {
|
|
23
|
+
OdspErrorTypes,
|
|
23
24
|
snapshotKey,
|
|
24
25
|
ICacheEntry,
|
|
25
26
|
IEntry,
|
|
@@ -29,7 +30,6 @@ import {
|
|
|
29
30
|
IOdspErrorAugmentations,
|
|
30
31
|
IOdspResolvedUrl,
|
|
31
32
|
} from "@fluidframework/odsp-driver-definitions";
|
|
32
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
33
33
|
import {
|
|
34
34
|
fetchAndParseAsJSONHelper,
|
|
35
35
|
fetchArray,
|
|
@@ -292,7 +292,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
292
292
|
// location info.
|
|
293
293
|
if (
|
|
294
294
|
isFluidError(error) &&
|
|
295
|
-
error.errorType ===
|
|
295
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError
|
|
296
296
|
) {
|
|
297
297
|
const redirectLocation = (error as IOdspErrorAugmentations).redirectLocation;
|
|
298
298
|
if (redirectLocation !== undefined) {
|
|
@@ -436,7 +436,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
436
436
|
fetchType: FetchTypeInternal,
|
|
437
437
|
fromCache: boolean = false,
|
|
438
438
|
) {
|
|
439
|
-
if (isFluidError(error) && error.errorType ===
|
|
439
|
+
if (isFluidError(error) && error.errorType === OdspErrorTypes.fileOverwrittenInStorage) {
|
|
440
440
|
const epochError = this.checkForEpochErrorCore(epochFromResponse);
|
|
441
441
|
if (epochError !== undefined) {
|
|
442
442
|
epochError.addTelemetryProperties({
|
|
@@ -470,7 +470,7 @@ export class EpochTracker implements IPersistedFileCache {
|
|
|
470
470
|
// Difference - client detected mismatch, instead of server detecting it.
|
|
471
471
|
return new NonRetryableError(
|
|
472
472
|
"Epoch mismatch",
|
|
473
|
-
|
|
473
|
+
OdspErrorTypes.fileOverwrittenInStorage,
|
|
474
474
|
{ driverVersion, serverEpoch: epochFromResponse, clientEpoch: this.fluidEpoch },
|
|
475
475
|
);
|
|
476
476
|
}
|
package/src/fetchSnapshot.ts
CHANGED
|
@@ -13,11 +13,11 @@ import {
|
|
|
13
13
|
import { fromUtf8ToBase64 } from "@fluid-internal/client-utils";
|
|
14
14
|
import { assert } from "@fluidframework/core-utils";
|
|
15
15
|
import { getW3CData } from "@fluidframework/driver-base";
|
|
16
|
-
import {
|
|
16
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
17
17
|
import {
|
|
18
18
|
IOdspResolvedUrl,
|
|
19
19
|
ISnapshotOptions,
|
|
20
|
-
|
|
20
|
+
OdspErrorTypes,
|
|
21
21
|
InstrumentedStorageTokenFetcher,
|
|
22
22
|
} from "@fluidframework/odsp-driver-definitions";
|
|
23
23
|
import { ISnapshotTree } from "@fluidframework/protocol-definitions";
|
|
@@ -29,7 +29,7 @@ import {
|
|
|
29
29
|
import { fetchIncorrectResponse, throwOdspNetworkError } from "@fluidframework/odsp-doclib-utils";
|
|
30
30
|
import {
|
|
31
31
|
IOdspSnapshot,
|
|
32
|
-
|
|
32
|
+
ISnapshotCachedEntry2,
|
|
33
33
|
IVersionedValueWithEpoch,
|
|
34
34
|
persistedCacheValueVersion,
|
|
35
35
|
} from "./contracts";
|
|
@@ -44,7 +44,6 @@ import {
|
|
|
44
44
|
measure,
|
|
45
45
|
measureP,
|
|
46
46
|
} from "./odspUtils";
|
|
47
|
-
import { ISnapshotContents } from "./odspPublicUtils";
|
|
48
47
|
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "./odspSnapshotParser";
|
|
49
48
|
import {
|
|
50
49
|
currentReadVersion,
|
|
@@ -86,7 +85,7 @@ export async function fetchSnapshot(
|
|
|
86
85
|
url: string,
|
|
87
86
|
fetchOptions: { [index: string]: any },
|
|
88
87
|
) => Promise<IOdspResponse<unknown>>,
|
|
89
|
-
): Promise<
|
|
88
|
+
): Promise<ISnapshot> {
|
|
90
89
|
const path = `/trees/${versionId}`;
|
|
91
90
|
let queryParams: ISnapshotOptions = {};
|
|
92
91
|
|
|
@@ -126,7 +125,7 @@ export async function fetchSnapshotWithRedeem(
|
|
|
126
125
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
127
126
|
removeEntries: () => Promise<void>,
|
|
128
127
|
enableRedeemFallback?: boolean,
|
|
129
|
-
): Promise<
|
|
128
|
+
): Promise<ISnapshot> {
|
|
130
129
|
// back-compat: This block to be removed with #8784 when we only consume/consider odsp resolvers that are >= 0.51
|
|
131
130
|
const sharingLinkToRedeem = (odspResolvedUrl as any).sharingLinkToRedeem;
|
|
132
131
|
if (sharingLinkToRedeem) {
|
|
@@ -191,8 +190,8 @@ export async function fetchSnapshotWithRedeem(
|
|
|
191
190
|
if (
|
|
192
191
|
(typeof error === "object" &&
|
|
193
192
|
error !== null &&
|
|
194
|
-
error.errorType ===
|
|
195
|
-
error.errorType ===
|
|
193
|
+
error.errorType === OdspErrorTypes.authorizationError) ||
|
|
194
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError
|
|
196
195
|
) {
|
|
197
196
|
await removeEntries();
|
|
198
197
|
}
|
|
@@ -249,7 +248,7 @@ async function fetchLatestSnapshotCore(
|
|
|
249
248
|
) => Promise<ISnapshotRequestAndResponseOptions>,
|
|
250
249
|
putInCache: (valueWithEpoch: IVersionedValueWithEpoch) => Promise<void>,
|
|
251
250
|
enableRedeemFallback?: boolean,
|
|
252
|
-
): Promise<
|
|
251
|
+
): Promise<ISnapshot> {
|
|
253
252
|
return getWithRetryForTokenRefresh(async (tokenFetchOptions) => {
|
|
254
253
|
const storageToken = await storageTokenFetcher(tokenFetchOptions, "TreesLatest", true);
|
|
255
254
|
assert(storageToken !== null, 0x1e5 /* "Storage token should not be null" */);
|
|
@@ -328,7 +327,7 @@ async function fetchLatestSnapshotCore(
|
|
|
328
327
|
let content: IOdspSnapshot;
|
|
329
328
|
[content, parseTime] = measure(() => JSON.parse(text) as IOdspSnapshot);
|
|
330
329
|
validateBlobsAndTrees(content);
|
|
331
|
-
const snapshotContents:
|
|
330
|
+
const snapshotContents: ISnapshot =
|
|
332
331
|
convertOdspSnapshotToSnapshotTreeAndBlobs(content);
|
|
333
332
|
parsedSnapshotContents = {
|
|
334
333
|
...odspResponse,
|
|
@@ -365,7 +364,7 @@ async function fetchLatestSnapshotCore(
|
|
|
365
364
|
) {
|
|
366
365
|
throw new NonRetryableError(
|
|
367
366
|
"Returned odsp snapshot is malformed. No trees or blobs!",
|
|
368
|
-
|
|
367
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
369
368
|
propsToLog,
|
|
370
369
|
);
|
|
371
370
|
}
|
|
@@ -386,7 +385,7 @@ async function fetchLatestSnapshotCore(
|
|
|
386
385
|
default:
|
|
387
386
|
throw new NonRetryableError(
|
|
388
387
|
"Unknown snapshot content type",
|
|
389
|
-
|
|
388
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
390
389
|
propsToLog,
|
|
391
390
|
);
|
|
392
391
|
}
|
|
@@ -400,7 +399,7 @@ async function fetchLatestSnapshotCore(
|
|
|
400
399
|
(errorMessage) =>
|
|
401
400
|
new NonRetryableError(
|
|
402
401
|
`Error parsing snapshot response: ${errorMessage}`,
|
|
403
|
-
|
|
402
|
+
OdspErrorTypes.genericError,
|
|
404
403
|
propsToLog,
|
|
405
404
|
),
|
|
406
405
|
);
|
|
@@ -437,7 +436,7 @@ async function fetchLatestSnapshotCore(
|
|
|
437
436
|
fluidEpoch !== undefined,
|
|
438
437
|
0x1e6 /* "Epoch should be present in response" */,
|
|
439
438
|
);
|
|
440
|
-
const value:
|
|
439
|
+
const value: ISnapshotCachedEntry2 = {
|
|
441
440
|
...snapshot,
|
|
442
441
|
cacheEntryTime: Date.now(),
|
|
443
442
|
};
|
|
@@ -452,7 +451,7 @@ async function fetchLatestSnapshotCore(
|
|
|
452
451
|
|
|
453
452
|
event.end({
|
|
454
453
|
trees,
|
|
455
|
-
blobs: snapshot.
|
|
454
|
+
blobs: snapshot.blobContents?.size ?? 0,
|
|
456
455
|
leafNodes: numBlobs,
|
|
457
456
|
encodedBlobsSize,
|
|
458
457
|
sequenceNumber,
|
|
@@ -490,8 +489,8 @@ async function fetchLatestSnapshotCore(
|
|
|
490
489
|
if (
|
|
491
490
|
typeof error === "object" &&
|
|
492
491
|
error !== null &&
|
|
493
|
-
(error.errorType ===
|
|
494
|
-
error.errorType ===
|
|
492
|
+
(error.errorType === OdspErrorTypes.fetchFailure ||
|
|
493
|
+
error.errorType === OdspErrorTypes.fetchTimeout)
|
|
495
494
|
) {
|
|
496
495
|
error[getWithRetryForTokenRefreshRepeat] = true;
|
|
497
496
|
}
|
|
@@ -536,11 +535,11 @@ function getFormBodyAndHeaders(
|
|
|
536
535
|
return { body: postBody, headers: header };
|
|
537
536
|
}
|
|
538
537
|
|
|
539
|
-
export function evalBlobsAndTrees(snapshot:
|
|
538
|
+
export function evalBlobsAndTrees(snapshot: ISnapshot) {
|
|
540
539
|
const trees = countTreesInSnapshotTree(snapshot.snapshotTree);
|
|
541
|
-
const numBlobs = snapshot.
|
|
540
|
+
const numBlobs = snapshot.blobContents.size;
|
|
542
541
|
let encodedBlobsSize = 0;
|
|
543
|
-
for (const [_, blobContent] of snapshot.
|
|
542
|
+
for (const [_, blobContent] of snapshot.blobContents) {
|
|
544
543
|
encodedBlobsSize += blobContent.byteLength;
|
|
545
544
|
}
|
|
546
545
|
return { trees, numBlobs, encodedBlobsSize };
|
|
@@ -649,8 +648,8 @@ function isRedeemSharingLinkError(odspResolvedUrl: IOdspResolvedUrl, error: any)
|
|
|
649
648
|
odspResolvedUrl.shareLinkInfo?.sharingLinkToRedeem !== undefined &&
|
|
650
649
|
typeof error === "object" &&
|
|
651
650
|
error !== null &&
|
|
652
|
-
(error.errorType ===
|
|
653
|
-
error.errorType ===
|
|
651
|
+
(error.errorType === OdspErrorTypes.authorizationError ||
|
|
652
|
+
error.errorType === OdspErrorTypes.fileNotFoundOrAccessDeniedError)
|
|
654
653
|
) {
|
|
655
654
|
return true;
|
|
656
655
|
}
|
package/src/getFileLink.ts
CHANGED
|
@@ -6,9 +6,9 @@
|
|
|
6
6
|
import { ITelemetryLoggerExt, PerformanceEvent } from "@fluidframework/telemetry-utils";
|
|
7
7
|
import { assert } from "@fluidframework/core-utils";
|
|
8
8
|
import { NonRetryableError, runWithRetry } from "@fluidframework/driver-utils";
|
|
9
|
-
import { DriverErrorType } from "@fluidframework/driver-definitions";
|
|
10
9
|
import {
|
|
11
10
|
IOdspUrlParts,
|
|
11
|
+
OdspErrorTypes,
|
|
12
12
|
OdspResourceTokenFetchOptions,
|
|
13
13
|
TokenFetcher,
|
|
14
14
|
} from "@fluidframework/odsp-driver-definitions";
|
|
@@ -150,7 +150,7 @@ async function getFileLinkCore(
|
|
|
150
150
|
// This will retry once in getWithRetryForTokenRefresh
|
|
151
151
|
throw new NonRetryableError(
|
|
152
152
|
"Malformed GetSharingInformation response",
|
|
153
|
-
|
|
153
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
154
154
|
{ driverVersion },
|
|
155
155
|
);
|
|
156
156
|
}
|
|
@@ -229,7 +229,7 @@ async function getFileItemLite(
|
|
|
229
229
|
// This will retry once in getWithRetryForTokenRefresh
|
|
230
230
|
throw new NonRetryableError(
|
|
231
231
|
"Malformed getFileItemLite response",
|
|
232
|
-
|
|
232
|
+
OdspErrorTypes.incorrectServerResponse,
|
|
233
233
|
{ driverVersion },
|
|
234
234
|
);
|
|
235
235
|
}
|
|
@@ -3,10 +3,12 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
7
8
|
import {
|
|
8
9
|
IDocumentDeltaStorageService,
|
|
9
10
|
IDocumentService,
|
|
11
|
+
IDocumentServiceEvents,
|
|
10
12
|
IDocumentStorageService,
|
|
11
13
|
IResolvedUrl,
|
|
12
14
|
} from "@fluidframework/driver-definitions";
|
|
@@ -19,7 +21,10 @@ import { LocalOdspDocumentStorageService } from "./localOdspDocumentStorageManag
|
|
|
19
21
|
/**
|
|
20
22
|
* IDocumentService implementation that provides explicit snapshot to the document storage service.
|
|
21
23
|
*/
|
|
22
|
-
export class LocalOdspDocumentService
|
|
24
|
+
export class LocalOdspDocumentService
|
|
25
|
+
extends TypedEventEmitter<IDocumentServiceEvents>
|
|
26
|
+
implements IDocumentService
|
|
27
|
+
{
|
|
23
28
|
public policies = { storageOnly: true };
|
|
24
29
|
private storageManager?: LocalOdspDocumentStorageService;
|
|
25
30
|
|
|
@@ -27,7 +32,9 @@ export class LocalOdspDocumentService implements IDocumentService {
|
|
|
27
32
|
private readonly odspResolvedUrl: IOdspResolvedUrl,
|
|
28
33
|
private readonly logger: ITelemetryLoggerExt,
|
|
29
34
|
private readonly localSnapshot: Uint8Array | string,
|
|
30
|
-
) {
|
|
35
|
+
) {
|
|
36
|
+
super();
|
|
37
|
+
}
|
|
31
38
|
|
|
32
39
|
public get resolvedUrl(): IResolvedUrl {
|
|
33
40
|
return this.odspResolvedUrl;
|
|
@@ -5,11 +5,14 @@
|
|
|
5
5
|
|
|
6
6
|
import { assert } from "@fluidframework/core-utils";
|
|
7
7
|
import { ITelemetryLoggerExt, loggerToMonitoringContext } from "@fluidframework/telemetry-utils";
|
|
8
|
-
import {
|
|
8
|
+
import {
|
|
9
|
+
ISnapshot,
|
|
10
|
+
ISnapshotFetchOptions,
|
|
11
|
+
ISummaryContext,
|
|
12
|
+
} from "@fluidframework/driver-definitions";
|
|
9
13
|
import { UsageError } from "@fluidframework/driver-utils";
|
|
10
14
|
import * as api from "@fluidframework/protocol-definitions";
|
|
11
15
|
import { OdspDocumentStorageServiceBase } from "../odspDocumentStorageServiceBase";
|
|
12
|
-
import { ISnapshotContents } from "../odspPublicUtils";
|
|
13
16
|
import { IOdspSnapshot } from "../contracts";
|
|
14
17
|
import { convertOdspSnapshotToSnapshotTreeAndBlobs } from "../odspSnapshotParser";
|
|
15
18
|
import { parseCompactSnapshotResponse } from "../compactSnapshotParser";
|
|
@@ -45,7 +48,7 @@ export class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceB
|
|
|
45
48
|
}
|
|
46
49
|
this.calledGetVersions = true;
|
|
47
50
|
|
|
48
|
-
let snapshotContents:
|
|
51
|
+
let snapshotContents: ISnapshot;
|
|
49
52
|
|
|
50
53
|
if (typeof this.localSnapshot === "string") {
|
|
51
54
|
const content: IOdspSnapshot = JSON.parse(this.localSnapshot);
|
|
@@ -58,6 +61,10 @@ export class LocalOdspDocumentStorageService extends OdspDocumentStorageServiceB
|
|
|
58
61
|
return this.getSnapshotVersion();
|
|
59
62
|
}
|
|
60
63
|
|
|
64
|
+
public async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {
|
|
65
|
+
this.throwUsageError("getSnapshot");
|
|
66
|
+
}
|
|
67
|
+
|
|
61
68
|
private getSnapshotVersion(): api.IVersion[] {
|
|
62
69
|
return this.snapshotTreeId ? [{ id: this.snapshotTreeId, treeId: undefined! }] : [];
|
|
63
70
|
}
|
package/src/odspCache.ts
CHANGED
|
@@ -12,7 +12,7 @@ import {
|
|
|
12
12
|
ISocketStorageDiscovery,
|
|
13
13
|
getKeyForCacheEntry,
|
|
14
14
|
} from "@fluidframework/odsp-driver-definitions";
|
|
15
|
-
import {
|
|
15
|
+
import { ISnapshot } from "@fluidframework/driver-definitions";
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
18
|
* Similar to IPersistedCache, but exposes cache interface for single file
|
|
@@ -142,7 +142,7 @@ export class NonPersistentCache implements INonPersistentCache {
|
|
|
142
142
|
/**
|
|
143
143
|
* @alpha
|
|
144
144
|
*/
|
|
145
|
-
export interface IPrefetchSnapshotContents extends
|
|
145
|
+
export interface IPrefetchSnapshotContents extends ISnapshot {
|
|
146
146
|
fluidEpoch: string;
|
|
147
147
|
prefetchStartTime: number;
|
|
148
148
|
}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
import { performance } from "@fluid-internal/client-utils";
|
|
7
|
+
import { ISignalEnvelope } from "@fluidframework/core-interfaces";
|
|
7
8
|
import { assert } from "@fluidframework/core-utils";
|
|
8
9
|
import {
|
|
9
10
|
IFluidErrorBase,
|
|
@@ -14,20 +15,23 @@ import {
|
|
|
14
15
|
IDocumentDeltaConnection,
|
|
15
16
|
IResolvedUrl,
|
|
16
17
|
IDocumentServicePolicies,
|
|
17
|
-
DriverErrorType,
|
|
18
18
|
} from "@fluidframework/driver-definitions";
|
|
19
19
|
import {
|
|
20
20
|
DeltaStreamConnectionForbiddenError,
|
|
21
21
|
NonRetryableError,
|
|
22
22
|
} from "@fluidframework/driver-utils";
|
|
23
|
-
import {
|
|
23
|
+
import {
|
|
24
|
+
IClient,
|
|
25
|
+
ISequencedDocumentMessage,
|
|
26
|
+
ISignalMessage,
|
|
27
|
+
} from "@fluidframework/protocol-definitions";
|
|
24
28
|
import {
|
|
25
29
|
IOdspResolvedUrl,
|
|
26
30
|
TokenFetchOptions,
|
|
27
31
|
HostStoragePolicy,
|
|
28
32
|
InstrumentedStorageTokenFetcher,
|
|
29
33
|
ISocketStorageDiscovery,
|
|
30
|
-
|
|
34
|
+
OdspErrorTypes,
|
|
31
35
|
} from "@fluidframework/odsp-driver-definitions";
|
|
32
36
|
import { hasFacetCodes } from "@fluidframework/odsp-doclib-utils";
|
|
33
37
|
import { IOdspCache } from "./odspCache";
|
|
@@ -40,6 +44,7 @@ import {
|
|
|
40
44
|
import { fetchJoinSession } from "./vroom";
|
|
41
45
|
import { EpochTracker } from "./epochTracker";
|
|
42
46
|
import { pkgVersion as driverVersion } from "./packageVersion";
|
|
47
|
+
import { policyLabelsUpdatesSignalType } from "./contracts";
|
|
43
48
|
|
|
44
49
|
/**
|
|
45
50
|
* This OdspDelayLoadedDeltaStream is used by OdspDocumentService.ts to delay load the delta connection
|
|
@@ -55,6 +60,12 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
55
60
|
|
|
56
61
|
private _relayServiceTenantAndSessionId: string | undefined;
|
|
57
62
|
|
|
63
|
+
// Tracks the time at which the Policy Labels were updated the last time. This is used to resolve race conditions
|
|
64
|
+
// between label updates from the join session and the Fluid signals and they could have same or different timestamps.
|
|
65
|
+
// So this timestamp is updated with timestamp from the service/signals with the most recent timestamp. We could also
|
|
66
|
+
// receive stale data from join session as that call is made at intervals, so we need to update with only most recent data.
|
|
67
|
+
private labelUpdateTimestamp: number = -1;
|
|
68
|
+
|
|
58
69
|
/**
|
|
59
70
|
* @param odspResolvedUrl - resolved url identifying document that will be managed by this service instance.
|
|
60
71
|
* @param policies - Document service policies.
|
|
@@ -82,6 +93,7 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
82
93
|
private readonly hostPolicy: HostStoragePolicy,
|
|
83
94
|
private readonly epochTracker: EpochTracker,
|
|
84
95
|
private readonly opsReceived: (ops: ISequencedDocumentMessage[]) => void,
|
|
96
|
+
private readonly metadataUpdateHandler: (metadata: Record<string, string>) => void,
|
|
85
97
|
private readonly socketReferenceKeyPrefix?: string,
|
|
86
98
|
) {
|
|
87
99
|
this.joinSessionKey = getJoinSessionCacheKey(this.odspResolvedUrl);
|
|
@@ -155,13 +167,18 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
155
167
|
throw this.annotateConnectionError(
|
|
156
168
|
new NonRetryableError(
|
|
157
169
|
"Websocket token is null",
|
|
158
|
-
|
|
170
|
+
OdspErrorTypes.fetchTokenError,
|
|
159
171
|
{ driverVersion },
|
|
160
172
|
),
|
|
161
173
|
"getWebsocketToken",
|
|
162
174
|
!requestWebsocketTokenFromJoinSession,
|
|
163
175
|
);
|
|
164
176
|
}
|
|
177
|
+
if (websocketEndpoint.sensitivityLabelsInfo !== undefined) {
|
|
178
|
+
this.emitMetaDataUpdateEvent({
|
|
179
|
+
sensitivityLabelsInfo: websocketEndpoint.sensitivityLabelsInfo,
|
|
180
|
+
});
|
|
181
|
+
}
|
|
165
182
|
try {
|
|
166
183
|
const connection = await this.createDeltaConnection(
|
|
167
184
|
websocketEndpoint.tenantId,
|
|
@@ -173,6 +190,9 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
173
190
|
connection.on("op", (documentId, ops: ISequencedDocumentMessage[]) => {
|
|
174
191
|
this.opsReceived(ops);
|
|
175
192
|
});
|
|
193
|
+
connection.on("signal", this.signalHandler);
|
|
194
|
+
// Also process the initial signals
|
|
195
|
+
this.signalHandler(connection.initialSignals);
|
|
176
196
|
// On disconnect with 401/403 error code, we can just clear the joinSession cache as we will again
|
|
177
197
|
// get the auth error on reconnecting and face latency.
|
|
178
198
|
connection.once("disconnect", (error: any) => {
|
|
@@ -181,7 +201,7 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
181
201
|
if (
|
|
182
202
|
typeof error === "object" &&
|
|
183
203
|
error !== null &&
|
|
184
|
-
error.errorType ===
|
|
204
|
+
error.errorType === OdspErrorTypes.authorizationError
|
|
185
205
|
) {
|
|
186
206
|
this.cache.sessionJoinCache.remove(this.joinSessionKey);
|
|
187
207
|
}
|
|
@@ -211,6 +231,26 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
211
231
|
});
|
|
212
232
|
}
|
|
213
233
|
|
|
234
|
+
private readonly signalHandler = (signalsArg: ISignalMessage | ISignalMessage[]) => {
|
|
235
|
+
const signals = Array.isArray(signalsArg) ? signalsArg : [signalsArg];
|
|
236
|
+
signals.forEach((signal: ISignalMessage) => {
|
|
237
|
+
// Make sure it is not for a specific client as `PolicyLabelsUpdate` is meant for all clients.
|
|
238
|
+
if (signal.clientId === null) {
|
|
239
|
+
// We could have some issues/irregularities in parsing signals, so put it in try/catch block
|
|
240
|
+
// and ignore the error as we can have labels update later on through join session response.
|
|
241
|
+
let envelope: ISignalEnvelope | undefined;
|
|
242
|
+
try {
|
|
243
|
+
envelope = JSON.parse(signal.content as string) as ISignalEnvelope;
|
|
244
|
+
} catch (err) {}
|
|
245
|
+
if (envelope?.contents?.type === policyLabelsUpdatesSignalType) {
|
|
246
|
+
this.emitMetaDataUpdateEvent({
|
|
247
|
+
sensitivityLabelsInfo: JSON.stringify(envelope.contents.content),
|
|
248
|
+
});
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
});
|
|
252
|
+
};
|
|
253
|
+
|
|
214
254
|
private clearJoinSessionTimer() {
|
|
215
255
|
if (this.joinSessionRefreshTimer !== undefined) {
|
|
216
256
|
clearTimeout(this.joinSessionRefreshTimer);
|
|
@@ -273,7 +313,7 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
273
313
|
this.clearJoinSessionTimer();
|
|
274
314
|
throw new NonRetryableError(
|
|
275
315
|
"JoinSessionRefreshTimerNotCancelled",
|
|
276
|
-
|
|
316
|
+
OdspErrorTypes.genericError,
|
|
277
317
|
{
|
|
278
318
|
driverVersion,
|
|
279
319
|
details: JSON.stringify({
|
|
@@ -339,6 +379,12 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
339
379
|
isRefreshingJoinSession,
|
|
340
380
|
this.hostPolicy.sessionOptions?.unauthenticatedUserDisplayName,
|
|
341
381
|
);
|
|
382
|
+
// Emit event only in case it is fetched from the network.
|
|
383
|
+
if (joinSessionResponse.sensitivityLabelsInfo !== undefined) {
|
|
384
|
+
this.emitMetaDataUpdateEvent({
|
|
385
|
+
sensitivityLabelsInfo: joinSessionResponse.sensitivityLabelsInfo,
|
|
386
|
+
});
|
|
387
|
+
}
|
|
342
388
|
return {
|
|
343
389
|
entryTime: Date.now(),
|
|
344
390
|
joinSessionResponse,
|
|
@@ -402,6 +448,21 @@ export class OdspDelayLoadedDeltaStream {
|
|
|
402
448
|
return response.joinSessionResponse;
|
|
403
449
|
}
|
|
404
450
|
|
|
451
|
+
private emitMetaDataUpdateEvent(metadata: Record<string, string>) {
|
|
452
|
+
const label = JSON.parse(metadata.sensitivityLabelsInfo) as {
|
|
453
|
+
labels: unknown;
|
|
454
|
+
timestamp: number;
|
|
455
|
+
};
|
|
456
|
+
const time = label.timestamp;
|
|
457
|
+
assert(time > 0, "time should be positive");
|
|
458
|
+
if (time > this.labelUpdateTimestamp) {
|
|
459
|
+
this.labelUpdateTimestamp = time;
|
|
460
|
+
this.metadataUpdateHandler({
|
|
461
|
+
sensitivityLabelsInfo: metadata.sensitivityLabelsInfo,
|
|
462
|
+
});
|
|
463
|
+
}
|
|
464
|
+
}
|
|
465
|
+
|
|
405
466
|
private calculateJoinSessionRefreshDelta(
|
|
406
467
|
responseFetchTime: number,
|
|
407
468
|
refreshSessionDurationSeconds: number,
|
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
createChildMonitoringContext,
|
|
9
9
|
MonitoringContext,
|
|
10
10
|
} from "@fluidframework/telemetry-utils";
|
|
11
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
11
12
|
import { assert } from "@fluidframework/core-utils";
|
|
12
13
|
import {
|
|
13
14
|
IDocumentDeltaConnection,
|
|
@@ -16,6 +17,7 @@ import {
|
|
|
16
17
|
IResolvedUrl,
|
|
17
18
|
IDocumentStorageService,
|
|
18
19
|
IDocumentServicePolicies,
|
|
20
|
+
IDocumentServiceEvents,
|
|
19
21
|
} from "@fluidframework/driver-definitions";
|
|
20
22
|
import { IClient, ISequencedDocumentMessage } from "@fluidframework/protocol-definitions";
|
|
21
23
|
import {
|
|
@@ -40,7 +42,10 @@ import type { OdspDelayLoadedDeltaStream } from "./odspDelayLoadedDeltaStream";
|
|
|
40
42
|
* The DocumentService manages the Socket.IO connection and manages routing requests to connected
|
|
41
43
|
* clients
|
|
42
44
|
*/
|
|
43
|
-
export class OdspDocumentService
|
|
45
|
+
export class OdspDocumentService
|
|
46
|
+
extends TypedEventEmitter<IDocumentServiceEvents>
|
|
47
|
+
implements IDocumentService
|
|
48
|
+
{
|
|
44
49
|
private readonly _policies: IDocumentServicePolicies;
|
|
45
50
|
|
|
46
51
|
// Promise to load socket module only once.
|
|
@@ -123,6 +128,7 @@ export class OdspDocumentService implements IDocumentService {
|
|
|
123
128
|
private readonly socketReferenceKeyPrefix?: string,
|
|
124
129
|
private readonly clientIsSummarizer?: boolean,
|
|
125
130
|
) {
|
|
131
|
+
super();
|
|
126
132
|
this._policies = {
|
|
127
133
|
// load in storage-only mode if a file version is specified
|
|
128
134
|
storageOnly: odspResolvedUrl.fileVersion !== undefined,
|
|
@@ -141,6 +147,7 @@ export class OdspDocumentService implements IDocumentService {
|
|
|
141
147
|
});
|
|
142
148
|
|
|
143
149
|
this.hostPolicy = hostPolicy;
|
|
150
|
+
this.hostPolicy.supportGetSnapshotApi = this._policies.supportGetSnapshotApi;
|
|
144
151
|
if (this.clientIsSummarizer) {
|
|
145
152
|
this.hostPolicy = { ...this.hostPolicy, summarizerClient: true };
|
|
146
153
|
}
|
|
@@ -282,6 +289,7 @@ export class OdspDocumentService implements IDocumentService {
|
|
|
282
289
|
this.hostPolicy,
|
|
283
290
|
this.epochTracker,
|
|
284
291
|
(ops: ISequencedDocumentMessage[]) => this.opsReceived(ops),
|
|
292
|
+
(metadata: Record<string, string>) => this.emit("metadataUpdate", metadata),
|
|
285
293
|
this.socketReferenceKeyPrefix,
|
|
286
294
|
);
|
|
287
295
|
return this.odspDelayLoadedDeltaStream;
|
|
@@ -289,7 +297,7 @@ export class OdspDocumentService implements IDocumentService {
|
|
|
289
297
|
|
|
290
298
|
public dispose(error?: any) {
|
|
291
299
|
// Error might indicate mismatch between client & server knowledge about file
|
|
292
|
-
// (
|
|
300
|
+
// (OdspErrorTypes.fileOverwrittenInStorage).
|
|
293
301
|
// For example, file might have been overwritten in storage without generating new epoch
|
|
294
302
|
// In such case client cached info is stale and has to be removed.
|
|
295
303
|
if (error !== undefined) {
|
|
@@ -26,7 +26,6 @@ import {
|
|
|
26
26
|
IOdspUrlParts,
|
|
27
27
|
SharingLinkScope,
|
|
28
28
|
SharingLinkRole,
|
|
29
|
-
ShareLinkTypes,
|
|
30
29
|
ISharingLinkKind,
|
|
31
30
|
ISocketStorageDiscovery,
|
|
32
31
|
IRelaySessionAwareDriverFactory,
|
|
@@ -102,7 +101,7 @@ export class OdspDocumentServiceFactoryCore
|
|
|
102
101
|
};
|
|
103
102
|
|
|
104
103
|
let fileInfo: INewFileInfo | IExistingFileInfo;
|
|
105
|
-
let createShareLinkParam:
|
|
104
|
+
let createShareLinkParam: ISharingLinkKind | undefined;
|
|
106
105
|
if (odspResolvedUrl.itemId) {
|
|
107
106
|
fileInfo = {
|
|
108
107
|
type: "Existing",
|
|
@@ -161,7 +160,6 @@ export class OdspDocumentServiceFactoryCore
|
|
|
161
160
|
createShareLinkParam: createShareLinkParam
|
|
162
161
|
? JSON.stringify(createShareLinkParam)
|
|
163
162
|
: undefined,
|
|
164
|
-
enableShareLinkWithCreate: this.hostPolicy.enableShareLinkWithCreate,
|
|
165
163
|
enableSingleRequestForShareLinkWithCreate:
|
|
166
164
|
this.hostPolicy.enableSingleRequestForShareLinkWithCreate,
|
|
167
165
|
},
|
|
@@ -202,7 +200,6 @@ export class OdspDocumentServiceFactoryCore
|
|
|
202
200
|
?.forceAccessTokenViaAuthorizationHeader,
|
|
203
201
|
odspResolvedUrl.isClpCompliantApp,
|
|
204
202
|
this.hostPolicy.enableSingleRequestForShareLinkWithCreate,
|
|
205
|
-
this.hostPolicy.enableShareLinkWithCreate,
|
|
206
203
|
)
|
|
207
204
|
: await module.createNewContainerOnExistingFile(
|
|
208
205
|
getStorageToken,
|
|
@@ -330,9 +327,9 @@ export class OdspDocumentServiceFactoryCore
|
|
|
330
327
|
function getSharingLinkParams(
|
|
331
328
|
hostPolicy: HostStoragePolicy,
|
|
332
329
|
searchParams: URLSearchParams,
|
|
333
|
-
):
|
|
330
|
+
): ISharingLinkKind | undefined {
|
|
334
331
|
// extract request parameters for creation of sharing link (if provided) if the feature is enabled
|
|
335
|
-
let createShareLinkParam:
|
|
332
|
+
let createShareLinkParam: ISharingLinkKind | undefined;
|
|
336
333
|
if (hostPolicy.enableSingleRequestForShareLinkWithCreate) {
|
|
337
334
|
const createLinkScope = searchParams.get("createLinkScope");
|
|
338
335
|
const createLinkRole = searchParams.get("createLinkRole");
|
|
@@ -344,11 +341,6 @@ function getSharingLinkParams(
|
|
|
344
341
|
: {}),
|
|
345
342
|
};
|
|
346
343
|
}
|
|
347
|
-
} else if (hostPolicy.enableShareLinkWithCreate) {
|
|
348
|
-
const createLinkType = searchParams.get("createLinkType");
|
|
349
|
-
if (createLinkType && ShareLinkTypes[createLinkType]) {
|
|
350
|
-
createShareLinkParam = ShareLinkTypes[createLinkType || ""];
|
|
351
|
-
}
|
|
352
344
|
}
|
|
353
345
|
return createShareLinkParam;
|
|
354
346
|
}
|