@fluidframework/odsp-driver 2.0.0-dev.6.4.0.192049 → 2.0.0-dev.7.2.0.203917
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 +66 -0
- package/api-extractor.json +1 -1
- package/api-report/odsp-driver.api.md +306 -0
- package/dist/ReadBufferUtils.js +3 -3
- package/dist/ReadBufferUtils.js.map +1 -1
- package/dist/checkUrl.d.ts +1 -0
- package/dist/checkUrl.d.ts.map +1 -1
- package/dist/checkUrl.js +1 -0
- package/dist/checkUrl.js.map +1 -1
- package/dist/compactSnapshotParser.d.ts +2 -0
- package/dist/compactSnapshotParser.d.ts.map +1 -1
- package/dist/compactSnapshotParser.js +1 -0
- package/dist/compactSnapshotParser.js.map +1 -1
- package/dist/constants.d.ts +6 -0
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +6 -0
- package/dist/constants.js.map +1 -1
- package/dist/contracts.d.ts +3 -3
- package/dist/contracts.d.ts.map +1 -1
- package/dist/contractsPublic.d.ts +15 -0
- package/dist/contractsPublic.d.ts.map +1 -1
- package/dist/contractsPublic.js +8 -2
- package/dist/contractsPublic.js.map +1 -1
- package/dist/createOdspCreateContainerRequest.d.ts +1 -0
- package/dist/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/dist/createOdspCreateContainerRequest.js +1 -0
- package/dist/createOdspCreateContainerRequest.js.map +1 -1
- package/dist/createOdspUrl.d.ts +1 -0
- package/dist/createOdspUrl.d.ts.map +1 -1
- package/dist/createOdspUrl.js +1 -0
- package/dist/createOdspUrl.js.map +1 -1
- package/dist/epochTracker.d.ts +12 -2
- package/dist/epochTracker.d.ts.map +1 -1
- package/dist/epochTracker.js +1 -0
- package/dist/epochTracker.js.map +1 -1
- package/dist/fetch.d.ts +1 -1
- package/dist/fetch.d.ts.map +1 -1
- package/dist/fetchSnapshot.d.ts +1 -0
- package/dist/fetchSnapshot.d.ts.map +1 -1
- package/dist/fetchSnapshot.js +15 -11
- package/dist/fetchSnapshot.js.map +1 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/odsp-driver-alpha.d.ts +558 -0
- package/dist/odsp-driver-beta.d.ts +558 -0
- package/dist/odsp-driver-public.d.ts +558 -0
- package/dist/odsp-driver-untrimmed.d.ts +558 -0
- package/dist/odspCache.d.ts +6 -0
- package/dist/odspCache.d.ts.map +1 -1
- package/dist/odspCache.js.map +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts +1 -1
- package/dist/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/dist/odspDocumentDeltaConnection.js +78 -69
- package/dist/odspDocumentDeltaConnection.js.map +1 -1
- package/dist/odspDocumentService.js +23 -19
- package/dist/odspDocumentService.js.map +1 -1
- package/dist/odspDocumentServiceFactory.d.ts +4 -0
- package/dist/odspDocumentServiceFactory.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactory.js +4 -0
- package/dist/odspDocumentServiceFactory.js.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.d.ts +1 -0
- package/dist/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryCore.js +32 -27
- package/dist/odspDocumentServiceFactoryCore.js.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts +2 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js +2 -1
- package/dist/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
- package/dist/odspDocumentStorageManager.js +5 -1
- package/dist/odspDocumentStorageManager.js.map +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts +1 -1
- package/dist/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/dist/odspDocumentStorageServiceBase.js +1 -14
- package/dist/odspDocumentStorageServiceBase.js.map +1 -1
- package/dist/odspDriverUrlResolver.d.ts +1 -0
- package/dist/odspDriverUrlResolver.d.ts.map +1 -1
- package/dist/odspDriverUrlResolver.js +2 -0
- package/dist/odspDriverUrlResolver.js.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.d.ts +2 -0
- package/dist/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/dist/odspDriverUrlResolverForShareLink.js +1 -0
- package/dist/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/dist/odspFluidFileLink.d.ts +10 -1
- package/dist/odspFluidFileLink.d.ts.map +1 -1
- package/dist/odspFluidFileLink.js +14 -6
- package/dist/odspFluidFileLink.js.map +1 -1
- package/dist/odspPublicUtils.d.ts +6 -0
- package/dist/odspPublicUtils.d.ts.map +1 -1
- package/dist/odspPublicUtils.js +3 -0
- package/dist/odspPublicUtils.js.map +1 -1
- package/dist/odspSummaryUploadManager.js +5 -1
- package/dist/odspSummaryUploadManager.js.map +1 -1
- package/dist/odspUrlHelper.d.ts +5 -0
- package/dist/odspUrlHelper.d.ts.map +1 -1
- package/dist/odspUrlHelper.js +5 -0
- package/dist/odspUrlHelper.js.map +1 -1
- package/dist/odspUtils.d.ts +4 -1
- package/dist/odspUtils.d.ts.map +1 -1
- package/dist/odspUtils.js +1 -0
- package/dist/odspUtils.js.map +1 -1
- package/dist/opsCaching.d.ts +1 -1
- package/dist/opsCaching.d.ts.map +1 -1
- package/dist/opsCaching.js +13 -1
- package/dist/opsCaching.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/prefetchLatestSnapshot.d.ts +2 -0
- package/dist/prefetchLatestSnapshot.d.ts.map +1 -1
- package/dist/prefetchLatestSnapshot.js +2 -0
- package/dist/prefetchLatestSnapshot.js.map +1 -1
- package/dist/socketModule.d.ts +7 -0
- package/dist/socketModule.d.ts.map +1 -0
- package/dist/socketModule.js +10 -0
- package/dist/socketModule.js.map +1 -0
- package/dist/tsdoc-metadata.json +1 -1
- package/dist/zipItDataRepresentationUtils.d.ts +2 -2
- package/dist/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/dist/zipItDataRepresentationUtils.js +6 -6
- package/dist/zipItDataRepresentationUtils.js.map +1 -1
- package/lib/ReadBufferUtils.js +3 -3
- package/lib/ReadBufferUtils.js.map +1 -1
- package/lib/checkUrl.d.ts +1 -0
- package/lib/checkUrl.d.ts.map +1 -1
- package/lib/checkUrl.js +1 -0
- package/lib/checkUrl.js.map +1 -1
- package/lib/compactSnapshotParser.d.ts +2 -0
- package/lib/compactSnapshotParser.d.ts.map +1 -1
- package/lib/compactSnapshotParser.js +1 -0
- package/lib/compactSnapshotParser.js.map +1 -1
- package/lib/constants.d.ts +6 -0
- package/lib/constants.d.ts.map +1 -1
- package/lib/constants.js +6 -0
- package/lib/constants.js.map +1 -1
- package/lib/contracts.d.ts +3 -3
- package/lib/contracts.d.ts.map +1 -1
- package/lib/contractsPublic.d.ts +15 -0
- package/lib/contractsPublic.d.ts.map +1 -1
- package/lib/contractsPublic.js +6 -0
- package/lib/contractsPublic.js.map +1 -1
- package/lib/createOdspCreateContainerRequest.d.ts +1 -0
- package/lib/createOdspCreateContainerRequest.d.ts.map +1 -1
- package/lib/createOdspCreateContainerRequest.js +1 -0
- package/lib/createOdspCreateContainerRequest.js.map +1 -1
- package/lib/createOdspUrl.d.ts +1 -0
- package/lib/createOdspUrl.d.ts.map +1 -1
- package/lib/createOdspUrl.js +1 -0
- package/lib/createOdspUrl.js.map +1 -1
- package/lib/epochTracker.d.ts +12 -2
- package/lib/epochTracker.d.ts.map +1 -1
- package/lib/epochTracker.js +1 -0
- package/lib/epochTracker.js.map +1 -1
- package/lib/fetch.d.ts +1 -1
- package/lib/fetch.d.ts.map +1 -1
- package/lib/fetchSnapshot.d.ts +1 -0
- package/lib/fetchSnapshot.d.ts.map +1 -1
- package/lib/fetchSnapshot.js +14 -10
- package/lib/fetchSnapshot.js.map +1 -1
- package/lib/index.d.ts +5 -1
- package/lib/index.d.ts.map +1 -1
- package/lib/index.js +1 -0
- package/lib/index.js.map +1 -1
- package/lib/odspCache.d.ts +6 -0
- package/lib/odspCache.d.ts.map +1 -1
- package/lib/odspCache.js.map +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts +1 -1
- package/lib/odspDocumentDeltaConnection.d.ts.map +1 -1
- package/lib/odspDocumentDeltaConnection.js +77 -68
- package/lib/odspDocumentDeltaConnection.js.map +1 -1
- package/lib/odspDocumentService.js +18 -18
- package/lib/odspDocumentService.js.map +1 -1
- package/lib/odspDocumentServiceFactory.d.ts +4 -0
- package/lib/odspDocumentServiceFactory.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactory.js +4 -0
- package/lib/odspDocumentServiceFactory.js.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.d.ts +1 -0
- package/lib/odspDocumentServiceFactoryCore.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryCore.js +27 -26
- package/lib/odspDocumentServiceFactoryCore.js.map +1 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts +2 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.d.ts.map +1 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js +2 -1
- package/lib/odspDocumentServiceFactoryWithCodeSplit.js.map +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts +1 -1
- package/lib/odspDocumentStorageServiceBase.d.ts.map +1 -1
- package/lib/odspDocumentStorageServiceBase.js +1 -14
- package/lib/odspDocumentStorageServiceBase.js.map +1 -1
- package/lib/odspDriverUrlResolver.d.ts +1 -0
- package/lib/odspDriverUrlResolver.d.ts.map +1 -1
- package/lib/odspDriverUrlResolver.js +2 -0
- package/lib/odspDriverUrlResolver.js.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.d.ts +2 -0
- package/lib/odspDriverUrlResolverForShareLink.d.ts.map +1 -1
- package/lib/odspDriverUrlResolverForShareLink.js +1 -0
- package/lib/odspDriverUrlResolverForShareLink.js.map +1 -1
- package/lib/odspFluidFileLink.d.ts +10 -1
- package/lib/odspFluidFileLink.d.ts.map +1 -1
- package/lib/odspFluidFileLink.js +14 -6
- package/lib/odspFluidFileLink.js.map +1 -1
- package/lib/odspPublicUtils.d.ts +6 -0
- package/lib/odspPublicUtils.d.ts.map +1 -1
- package/lib/odspPublicUtils.js +3 -0
- package/lib/odspPublicUtils.js.map +1 -1
- package/lib/odspUrlHelper.d.ts +5 -0
- package/lib/odspUrlHelper.d.ts.map +1 -1
- package/lib/odspUrlHelper.js +5 -0
- package/lib/odspUrlHelper.js.map +1 -1
- package/lib/odspUtils.d.ts +4 -1
- package/lib/odspUtils.d.ts.map +1 -1
- package/lib/odspUtils.js +1 -0
- package/lib/odspUtils.js.map +1 -1
- package/lib/opsCaching.d.ts +1 -1
- package/lib/opsCaching.d.ts.map +1 -1
- package/lib/opsCaching.js +13 -1
- package/lib/opsCaching.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/prefetchLatestSnapshot.d.ts +2 -0
- package/lib/prefetchLatestSnapshot.d.ts.map +1 -1
- package/lib/prefetchLatestSnapshot.js +2 -0
- package/lib/prefetchLatestSnapshot.js.map +1 -1
- package/lib/socketModule.d.ts +7 -0
- package/lib/socketModule.d.ts.map +1 -0
- package/lib/socketModule.js +7 -0
- package/lib/socketModule.js.map +1 -0
- package/lib/zipItDataRepresentationUtils.d.ts +2 -2
- package/lib/zipItDataRepresentationUtils.d.ts.map +1 -1
- package/lib/zipItDataRepresentationUtils.js +3 -3
- package/lib/zipItDataRepresentationUtils.js.map +1 -1
- package/package.json +24 -26
- package/src/checkUrl.ts +1 -0
- package/src/compactSnapshotParser.ts +2 -0
- package/src/constants.ts +7 -0
- package/src/contractsPublic.ts +15 -1
- package/src/createOdspCreateContainerRequest.ts +1 -0
- package/src/createOdspUrl.ts +1 -0
- package/src/epochTracker.ts +10 -0
- package/src/fetchSnapshot.ts +16 -15
- package/src/index.ts +10 -1
- package/src/odspCache.ts +6 -0
- package/src/odspDocumentDeltaConnection.ts +56 -32
- package/src/odspDocumentServiceFactory.ts +4 -0
- package/src/odspDocumentServiceFactoryCore.ts +1 -0
- package/src/odspDocumentServiceFactoryWithCodeSplit.ts +2 -1
- package/src/odspDocumentStorageServiceBase.ts +1 -15
- package/src/odspDriverUrlResolver.ts +2 -0
- package/src/odspDriverUrlResolverForShareLink.ts +2 -0
- package/src/odspFluidFileLink.ts +21 -5
- package/src/odspPublicUtils.ts +6 -0
- package/src/odspUrlHelper.ts +5 -0
- package/src/odspUtils.ts +4 -0
- package/src/opsCaching.ts +15 -1
- package/src/packageVersion.ts +1 -1
- package/src/prefetchLatestSnapshot.ts +2 -0
- package/src/socketModule.ts +8 -0
- package/src/zipItDataRepresentationUtils.ts +5 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACN,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAIlF
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactory.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACN,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAIlF;;;;GAIG;AACH,qBAAa,0BAA2B,SAAQ,8BAA8B;gBAE5E,eAAe,EAAE,YAAY,CAAC,6BAA6B,CAAC,EAC5D,iBAAiB,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,EAC1E,cAAc,CAAC,EAAE,eAAe,EAChC,UAAU,CAAC,EAAE,iBAAiB;CAI/B;AAED;;GAEG;AACH,wBAAgB,qCAAqC,CACpD,aAAa,EAAE,UAAU,GAAG,MAAM,GAChC,uBAAuB,CAEzB"}
|
|
@@ -11,6 +11,7 @@ const localOdspDocumentServiceFactory_1 = require("./localOdspDriver/localOdspDo
|
|
|
11
11
|
/**
|
|
12
12
|
* Factory for creating the sharepoint document service. Use this if you want to
|
|
13
13
|
* use the sharepoint implementation.
|
|
14
|
+
* @public
|
|
14
15
|
*/
|
|
15
16
|
class OdspDocumentServiceFactory extends odspDocumentServiceFactoryCore_1.OdspDocumentServiceFactoryCore {
|
|
16
17
|
constructor(getStorageToken, getWebsocketToken, persistedCache, hostPolicy) {
|
|
@@ -18,6 +19,9 @@ class OdspDocumentServiceFactory extends odspDocumentServiceFactoryCore_1.OdspDo
|
|
|
18
19
|
}
|
|
19
20
|
}
|
|
20
21
|
exports.OdspDocumentServiceFactory = OdspDocumentServiceFactory;
|
|
22
|
+
/**
|
|
23
|
+
* @public
|
|
24
|
+
*/
|
|
21
25
|
function createLocalOdspDocumentServiceFactory(localSnapshot) {
|
|
22
26
|
return new localOdspDocumentServiceFactory_1.LocalOdspDocumentServiceFactory(localSnapshot);
|
|
23
27
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,qFAAkF;AAClF,sDAAsD;AACtD,uGAAoG;AAEpG
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactory.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,qFAAkF;AAClF,sDAAsD;AACtD,uGAAoG;AAEpG;;;;GAIG;AACH,MAAa,0BAA2B,SAAQ,+DAA8B;IAC7E,YACC,eAA4D,EAC5D,iBAA0E,EAC1E,cAAgC,EAChC,UAA8B;QAE9B,KAAK,CAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;CACD;AATD,gEASC;AAED;;GAEG;AACH,SAAgB,qCAAqC,CACpD,aAAkC;IAElC,OAAO,IAAI,iEAA+B,CAAC,aAAa,CAAC,CAAC;AAC3D,CAAC;AAJD,sFAIC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentServiceFactory } from \"@fluidframework/driver-definitions\";\nimport {\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tIPersistedCache,\n\tHostStoragePolicy,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore\";\n// eslint-disable-next-line import/no-internal-modules\nimport { LocalOdspDocumentServiceFactory } from \"./localOdspDriver/localOdspDocumentServiceFactory\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n * @public\n */\nexport class OdspDocumentServiceFactory extends OdspDocumentServiceFactoryCore {\n\tconstructor(\n\t\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tgetWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n\t\tpersistedCache?: IPersistedCache,\n\t\thostPolicy?: HostStoragePolicy,\n\t) {\n\t\tsuper(getStorageToken, getWebsocketToken, persistedCache, hostPolicy);\n\t}\n}\n\n/**\n * @public\n */\nexport function createLocalOdspDocumentServiceFactory(\n\tlocalSnapshot: Uint8Array | string,\n): IDocumentServiceFactory {\n\treturn new LocalOdspDocumentServiceFactory(localSnapshot);\n}\n"]}
|
|
@@ -13,6 +13,7 @@ import { ICacheAndTracker } from "./epochTracker";
|
|
|
13
13
|
*
|
|
14
14
|
* This constructor should be used by environments that support dynamic imports and that wish
|
|
15
15
|
* to leverage code splitting as a means to keep bundles as small as possible.
|
|
16
|
+
* @public
|
|
16
17
|
*/
|
|
17
18
|
export declare class OdspDocumentServiceFactoryCore implements IDocumentServiceFactory, IRelaySessionAwareDriverFactory {
|
|
18
19
|
private readonly getStorageToken;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactoryCore.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAMpE,OAAO,EAEN,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EAOjB,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAA6B,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAY7E
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactoryCore.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AACzF,OAAO,EACN,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAMpE,OAAO,EAEN,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EAOjB,uBAAuB,EACvB,+BAA+B,EAC/B,MAAM,yCAAyC,CAAC;AAGjD,OAAO,EAA6B,gBAAgB,EAAE,MAAM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(this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -38,34 +42,9 @@ const odspUtils_1 = require("./odspUtils");
|
|
|
38
42
|
*
|
|
39
43
|
* This constructor should be used by environments that support dynamic imports and that wish
|
|
40
44
|
* to leverage code splitting as a means to keep bundles as small as possible.
|
|
45
|
+
* @public
|
|
41
46
|
*/
|
|
42
47
|
class OdspDocumentServiceFactoryCore {
|
|
43
|
-
/**
|
|
44
|
-
* @param getStorageToken - function that can provide the storage token for a given site. This is
|
|
45
|
-
* is also referred to as the "Vroom" token in SPO.
|
|
46
|
-
* @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also
|
|
47
|
-
* to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
|
|
48
|
-
* response payload.
|
|
49
|
-
* @param persistedCache - PersistedCache provided by host for use in this session.
|
|
50
|
-
* @param hostPolicy - Policy for storage provided by host.
|
|
51
|
-
*/
|
|
52
|
-
constructor(getStorageToken, getWebsocketToken, persistedCache = new odspCache_1.LocalPersistentCache(), hostPolicy = {}) {
|
|
53
|
-
this.getStorageToken = getStorageToken;
|
|
54
|
-
this.getWebsocketToken = getWebsocketToken;
|
|
55
|
-
this.persistedCache = persistedCache;
|
|
56
|
-
this.hostPolicy = hostPolicy;
|
|
57
|
-
this.nonPersistentCache = new odspCache_1.NonPersistentCache();
|
|
58
|
-
if (this.hostPolicy.isolateSocketCache === true) {
|
|
59
|
-
// create the key to separate the socket reuse cache
|
|
60
|
-
this.socketReferenceKeyPrefix = (0, uuid_1.v4)();
|
|
61
|
-
}
|
|
62
|
-
// Set enableRedeemFallback by default as true.
|
|
63
|
-
this.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;
|
|
64
|
-
this.hostPolicy.sessionOptions = {
|
|
65
|
-
forceAccessTokenViaAuthorizationHeader: true,
|
|
66
|
-
...this.hostPolicy.sessionOptions,
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
48
|
get snapshotPrefetchResultCache() {
|
|
70
49
|
return this.nonPersistentCache.snapshotPrefetchResultCache;
|
|
71
50
|
}
|
|
@@ -166,6 +145,32 @@ class OdspDocumentServiceFactoryCore {
|
|
|
166
145
|
return docService;
|
|
167
146
|
});
|
|
168
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* @param getStorageToken - function that can provide the storage token for a given site. This is
|
|
150
|
+
* is also referred to as the "Vroom" token in SPO.
|
|
151
|
+
* @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also
|
|
152
|
+
* to as the "Push" token in SPO. If undefined then websocket token is expected to be returned with joinSession
|
|
153
|
+
* response payload.
|
|
154
|
+
* @param persistedCache - PersistedCache provided by host for use in this session.
|
|
155
|
+
* @param hostPolicy - Policy for storage provided by host.
|
|
156
|
+
*/
|
|
157
|
+
constructor(getStorageToken, getWebsocketToken, persistedCache = new odspCache_1.LocalPersistentCache(), hostPolicy = {}) {
|
|
158
|
+
this.getStorageToken = getStorageToken;
|
|
159
|
+
this.getWebsocketToken = getWebsocketToken;
|
|
160
|
+
this.persistedCache = persistedCache;
|
|
161
|
+
this.hostPolicy = hostPolicy;
|
|
162
|
+
this.nonPersistentCache = new odspCache_1.NonPersistentCache();
|
|
163
|
+
if (this.hostPolicy.isolateSocketCache === true) {
|
|
164
|
+
// create the key to separate the socket reuse cache
|
|
165
|
+
this.socketReferenceKeyPrefix = (0, uuid_1.v4)();
|
|
166
|
+
}
|
|
167
|
+
// Set enableRedeemFallback by default as true.
|
|
168
|
+
this.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;
|
|
169
|
+
this.hostPolicy.sessionOptions = {
|
|
170
|
+
forceAccessTokenViaAuthorizationHeader: true,
|
|
171
|
+
...this.hostPolicy.sessionOptions,
|
|
172
|
+
};
|
|
173
|
+
}
|
|
169
174
|
async createDocumentService(resolvedUrl, logger, clientIsSummarizer) {
|
|
170
175
|
return this.createDocumentServiceCore(resolvedUrl, (0, odspUtils_1.createOdspLogger)(logger), undefined, clientIsSummarizer);
|
|
171
176
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactoryCore.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AASH,qEAAmE;AACnE,+DAGsC;AACtC,qFAciD;AACjD,+BAAkC;AAClC,2CAA4F;AAC5F,iDAA6E;AAC7E,+DAA4D;AAC5D,2CAQqB;AAErB;;;;;;GAMG;AACH,MAAa,8BAA8B;IA4K1C;;;;;;;;OAQG;IACH,YACkB,eAA4D,EAC5D,iBAA0E,EACjF,iBAAkC,IAAI,gCAAoB,EAAE,EACrD,aAAgC,EAAE;QAHlC,oBAAe,GAAf,eAAe,CAA6C;QAC5D,sBAAiB,GAAjB,iBAAiB,CAAyD;QACjF,mBAAc,GAAd,cAAc,CAA8C;QACrD,eAAU,GAAV,UAAU,CAAwB;QAtLnC,uBAAkB,GAAwB,IAAI,8BAAkB,EAAE,CAAC;QAwLnF,IAAI,IAAI,CAAC,UAAU,CAAC,kBAAkB,KAAK,IAAI,EAAE;YAChD,oDAAoD;YACpD,IAAI,CAAC,wBAAwB,GAAG,IAAA,SAAI,GAAE,CAAC;SACvC;QACD,+CAA+C;QAC/C,IAAI,CAAC,UAAU,CAAC,oBAAoB,GAAG,IAAI,CAAC,UAAU,CAAC,oBAAoB,IAAI,IAAI,CAAC;QACpF,IAAI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Ac,CAAC,EAAE;oBAC3C,CAAC,CAAC,EAAE,CAAC;aACN,CAAC;SACF;KACD;SAAM,IAAI,UAAU,CAAC,yBAAyB,EAAE;QAChD,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC1D,IAAI,cAAc,IAAI,wCAAc,CAAC,cAAc,CAAC,EAAE;YACrD,oBAAoB,GAAG,wCAAc,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;SAC5D;KACD;IACD,OAAO,oBAAoB,CAAC;AAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tTokenFetchOptions,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tIPersistedCache,\n\tHostStoragePolicy,\n\tIFileEntry,\n\tIOdspUrlParts,\n\tSharingLinkScope,\n\tSharingLinkRole,\n\tShareLinkTypes,\n\tISharingLinkKind,\n\tISocketStorageDiscovery,\n\tIRelaySessionAwareDriverFactory,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { INonPersistentCache, LocalPersistentCache, NonPersistentCache } from \"./odspCache\";\nimport { createOdspCacheAndTracker, ICacheAndTracker } from \"./epochTracker\";\nimport { OdspDocumentService } from \"./odspDocumentService\";\nimport {\n\tINewFileInfo,\n\tgetOdspResolvedUrl,\n\tcreateOdspLogger,\n\ttoInstrumentedOdspTokenFetcher,\n\tIExistingFileInfo,\n\tisNewFileInfo,\n\tgetJoinSessionCacheKey,\n} from \"./odspUtils\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n *\n * This constructor should be used by environments that support dynamic imports and that wish\n * to leverage code splitting as a means to keep bundles as small as possible.\n */\nexport class OdspDocumentServiceFactoryCore\n\timplements IDocumentServiceFactory, IRelaySessionAwareDriverFactory\n{\n\tprivate readonly nonPersistentCache: INonPersistentCache = new NonPersistentCache();\n\tprivate readonly socketReferenceKeyPrefix?: string;\n\n\tpublic get snapshotPrefetchResultCache() {\n\t\treturn this.nonPersistentCache.snapshotPrefetchResultCache;\n\t}\n\n\tpublic get IRelaySessionAwareDriverFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * This function would return info about relay service session only if this factory established (or attempted to\n\t * establish) connection very recently. Otherwise, it will return undefined.\n\t * @param resolvedUrl - resolved url for container\n\t * @returns The current join session response stored in cache. `undefined` if not present.\n\t */\n\tpublic async getRelayServiceSessionInfo(\n\t\tresolvedUrl: IResolvedUrl,\n\t): Promise<ISocketStorageDiscovery | undefined> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst joinSessionResponse = await this.nonPersistentCache.sessionJoinCache.get(\n\t\t\tgetJoinSessionCacheKey(odspResolvedUrl),\n\t\t);\n\t\treturn joinSessionResponse?.joinSessionResponse;\n\t}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tlet odspResolvedUrl = getOdspResolvedUrl(createNewResolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\n\t\tlet fileInfo: INewFileInfo | IExistingFileInfo;\n\t\tlet createShareLinkParam: ShareLinkTypes | ISharingLinkKind | undefined;\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"Existing\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\titemId: odspResolvedUrl.itemId,\n\t\t\t};\n\t\t} else if (odspResolvedUrl.fileName) {\n\t\t\tconst [, queryString] = odspResolvedUrl.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst filePath = searchParams.get(\"path\");\n\t\t\tif (filePath === undefined || filePath === null) {\n\t\t\t\tthrow new Error(\"File path should be provided!!\");\n\t\t\t}\n\t\t\tcreateShareLinkParam = getSharingLinkParams(this.hostPolicy, searchParams);\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"New\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\tfilePath,\n\t\t\t\tfilename: odspResolvedUrl.fileName,\n\t\t\t\tcreateLinkType: createShareLinkParam,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new Error(\"A new or existing file must be specified to create container!\");\n\t\t}\n\n\t\tif (isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\t\tconst documentAttributes = getDocAttributesFromProtocolSummary(\n\t\t\t\tcreateNewSummary.tree[\".protocol\"],\n\t\t\t);\n\t\t\tif (documentAttributes?.sequenceNumber !== 0) {\n\t\t\t\tthrow new Error(\"Seq number in detached ODSP container should be 0\");\n\t\t\t}\n\t\t}\n\n\t\tconst odspLogger = createOdspLogger(logger);\n\n\t\tconst fileEntry: IFileEntry = {\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t};\n\t\tconst cacheAndTracker = createOdspCacheAndTracker(\n\t\t\tthis.persistedCache,\n\t\t\tthis.nonPersistentCache,\n\t\t\tfileEntry,\n\t\t\todspLogger,\n\t\t\tclientIsSummarizer,\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\todspLogger,\n\t\t\t{\n\t\t\t\teventName: \"CreateNew\",\n\t\t\t\tisWithSummaryUpload: true,\n\t\t\t\tcreateShareLinkParam: createShareLinkParam\n\t\t\t\t\t? JSON.stringify(createShareLinkParam)\n\t\t\t\t\t: undefined,\n\t\t\t\tenableShareLinkWithCreate: this.hostPolicy.enableShareLinkWithCreate,\n\t\t\t\tenableSingleRequestForShareLinkWithCreate:\n\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst getStorageToken = toInstrumentedOdspTokenFetcher(\n\t\t\t\t\todspLogger,\n\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t\ttrue /* throwOnNullToken */,\n\t\t\t\t);\n\t\t\t\t// We can delay load this module as this path will not be executed in load flows and create flow\n\t\t\t\t// while only happens once in lifetime of a document happens in the background after creation of\n\t\t\t\t// detached container.\n\t\t\t\tconst module = await import(\n\t\t\t\t\t/* webpackChunkName: \"createNewModule\" */ \"./createNewModule\"\n\t\t\t\t)\n\t\t\t\t\t.then((m) => {\n\t\t\t\t\t\todspLogger.sendTelemetryEvent({ eventName: \"createNewModuleLoaded\" });\n\t\t\t\t\t\treturn m;\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\todspLogger.sendErrorEvent(\n\t\t\t\t\t\t\t{ eventName: \"createNewModuleLoadFailed\" },\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t\todspResolvedUrl = isNewFileInfo(fileInfo)\n\t\t\t\t\t? await module.createNewFluidFile(\n\t\t\t\t\t\t\tgetStorageToken,\n\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions\n\t\t\t\t\t\t\t\t?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t\t\t\t\tthis.hostPolicy.enableShareLinkWithCreate,\n\t\t\t\t\t )\n\t\t\t\t\t: await module.createNewContainerOnExistingFile(\n\t\t\t\t\t\t\tgetStorageToken,\n\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions\n\t\t\t\t\t\t\t\t?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t );\n\t\t\t\tconst docService = this.createDocumentServiceCore(\n\t\t\t\t\todspResolvedUrl,\n\t\t\t\t\todspLogger,\n\t\t\t\t\tcacheAndTracker,\n\t\t\t\t\tclientIsSummarizer,\n\t\t\t\t);\n\t\t\t\tevent.end({\n\t\t\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\t\t});\n\t\t\t\treturn docService;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * @param getStorageToken - function that can provide the storage token for a given site. This is\n\t * is also referred to as the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also\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 persistedCache - PersistedCache provided by host for use in this session.\n\t * @param hostPolicy - Policy for storage provided by host.\n\t */\n\tconstructor(\n\t\tprivate readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tprivate readonly getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n\t\tprotected persistedCache: IPersistedCache = new LocalPersistentCache(),\n\t\tprivate readonly hostPolicy: HostStoragePolicy = {},\n\t) {\n\t\tif (this.hostPolicy.isolateSocketCache === true) {\n\t\t\t// create the key to separate the socket reuse cache\n\t\t\tthis.socketReferenceKeyPrefix = uuid();\n\t\t}\n\t\t// Set enableRedeemFallback by default as true.\n\t\tthis.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;\n\t\tthis.hostPolicy.sessionOptions = {\n\t\t\tforceAccessTokenViaAuthorizationHeader: true,\n\t\t\t...this.hostPolicy.sessionOptions,\n\t\t};\n\t}\n\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn this.createDocumentServiceCore(\n\t\t\tresolvedUrl,\n\t\t\tcreateOdspLogger(logger),\n\t\t\tundefined,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n\n\tprotected async createDocumentServiceCore(\n\t\tresolvedUrl: IResolvedUrl,\n\t\todspLogger: ITelemetryLogger,\n\t\tcacheAndTrackerArg?: ICacheAndTracker,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\t\tconst cacheAndTracker =\n\t\t\tcacheAndTrackerArg ??\n\t\t\tcreateOdspCacheAndTracker(\n\t\t\t\tthis.persistedCache,\n\t\t\t\tthis.nonPersistentCache,\n\t\t\t\t{ resolvedUrl: odspResolvedUrl, docId: odspResolvedUrl.hashedDocumentId },\n\t\t\t\todspLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t);\n\n\t\tconst storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n\t\t\todspLogger,\n\t\t\tresolvedUrlData,\n\t\t\tthis.getStorageToken,\n\t\t\ttrue /* throwOnNullToken */,\n\t\t);\n\n\t\tconst webSocketTokenFetcher =\n\t\t\tthis.getWebsocketToken === undefined\n\t\t\t\t? undefined\n\t\t\t\t: async (options: TokenFetchOptions) =>\n\t\t\t\t\t\ttoInstrumentedOdspTokenFetcher(\n\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\t\t\tthis.getWebsocketToken!,\n\t\t\t\t\t\t\tfalse /* throwOnNullToken */,\n\t\t\t\t\t\t)(options, \"GetWebsocketToken\");\n\n\t\treturn OdspDocumentService.create(\n\t\t\tresolvedUrl,\n\t\t\tstorageTokenFetcher,\n\t\t\twebSocketTokenFetcher,\n\t\t\todspLogger,\n\t\t\tcacheAndTracker.cache,\n\t\t\tthis.hostPolicy,\n\t\t\tcacheAndTracker.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n}\n\n/**\n * Extract the sharing link kind from the resolved URL's query paramerters\n */\nfunction getSharingLinkParams(\n\thostPolicy: HostStoragePolicy,\n\tsearchParams: URLSearchParams,\n): ShareLinkTypes | ISharingLinkKind | undefined {\n\t// extract request parameters for creation of sharing link (if provided) if the feature is enabled\n\tlet createShareLinkParam: ShareLinkTypes | ISharingLinkKind | undefined;\n\tif (hostPolicy.enableSingleRequestForShareLinkWithCreate) {\n\t\tconst createLinkScope = searchParams.get(\"createLinkScope\");\n\t\tconst createLinkRole = searchParams.get(\"createLinkRole\");\n\t\tif (createLinkScope && SharingLinkScope[createLinkScope]) {\n\t\t\tcreateShareLinkParam = {\n\t\t\t\tscope: SharingLinkScope[createLinkScope],\n\t\t\t\t...(createLinkRole && SharingLinkRole[createLinkRole]\n\t\t\t\t\t? { role: SharingLinkRole[createLinkRole] }\n\t\t\t\t\t: {}),\n\t\t\t};\n\t\t}\n\t} else if (hostPolicy.enableShareLinkWithCreate) {\n\t\tconst createLinkType = searchParams.get(\"createLinkType\");\n\t\tif (createLinkType && ShareLinkTypes[createLinkType]) {\n\t\t\tcreateShareLinkParam = ShareLinkTypes[createLinkType || \"\"];\n\t\t}\n\t}\n\treturn createShareLinkParam;\n}\n"]}
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactoryCore.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryCore.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;AASH,qEAAmE;AACnE,+DAGsC;AACtC,qFAciD;AACjD,+BAAkC;AAClC,2CAA4F;AAC5F,iDAA6E;AAC7E,+DAA4D;AAC5D,2CAQqB;AAErB;;;;;;;GAOG;AACH,MAAa,8BAA8B;IAM1C,IAAW,2BAA2B;QACrC,OAAO,IAAI,CAAC,kBAAkB,CAAC,2BAA2B,CAAC;IAC5D,CAAC;IAED,IAAW,+BAA+B;QACzC,OAAO,IAAI,CAAC;IACb,CAAC;IAED;;;;;OAKG;IACI,KAAK,CAAC,0BAA0B,CACtC,WAAyB;QAEzB,MAAM,eAAe,GAAG,IAAA,8BAAkB,EAAC,WAAW,CAAC,CAAC;QACxD,MAAM,mBAAmB,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,CAC7E,IAAA,kCAAsB,EAAC,eAAe,CAAC,CACvC,CAAC;QACF,OAAO,mBAAmB,EAAE,mBAAmB,CAAC;IACjD,CAAC;IAEM,KAAK,CAAC,eAAe,CAC3B,gBAA0C,EAC1C,oBAAkC,EACl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oBACpD,CAAC,CAAC,EAAE,IAAI,EAAE,yCAAe,CAAC,cAAc,CAAC,EAAE;oBAC3C,CAAC,CAAC,EAAE,CAAC;aACN,CAAC;SACF;KACD;SAAM,IAAI,UAAU,CAAC,yBAAyB,EAAE;QAChD,MAAM,cAAc,GAAG,YAAY,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;QAC1D,IAAI,cAAc,IAAI,wCAAc,CAAC,cAAc,CAAC,EAAE;YACrD,oBAAoB,GAAG,wCAAc,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;SAC5D;KACD;IACD,OAAO,oBAAoB,CAAC;AAC7B,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryBaseLogger, ITelemetryLogger } from \"@fluidframework/core-interfaces\";\nimport {\n\tIDocumentService,\n\tIDocumentServiceFactory,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { ISummaryTree } from \"@fluidframework/protocol-definitions\";\nimport { PerformanceEvent } from \"@fluidframework/telemetry-utils\";\nimport {\n\tgetDocAttributesFromProtocolSummary,\n\tisCombinedAppAndProtocolSummary,\n} from \"@fluidframework/driver-utils\";\nimport {\n\tTokenFetchOptions,\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tIPersistedCache,\n\tHostStoragePolicy,\n\tIFileEntry,\n\tIOdspUrlParts,\n\tSharingLinkScope,\n\tSharingLinkRole,\n\tShareLinkTypes,\n\tISharingLinkKind,\n\tISocketStorageDiscovery,\n\tIRelaySessionAwareDriverFactory,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { v4 as uuid } from \"uuid\";\nimport { INonPersistentCache, LocalPersistentCache, NonPersistentCache } from \"./odspCache\";\nimport { createOdspCacheAndTracker, ICacheAndTracker } from \"./epochTracker\";\nimport { OdspDocumentService } from \"./odspDocumentService\";\nimport {\n\tINewFileInfo,\n\tgetOdspResolvedUrl,\n\tcreateOdspLogger,\n\ttoInstrumentedOdspTokenFetcher,\n\tIExistingFileInfo,\n\tisNewFileInfo,\n\tgetJoinSessionCacheKey,\n} from \"./odspUtils\";\n\n/**\n * Factory for creating the sharepoint document service. Use this if you want to\n * use the sharepoint implementation.\n *\n * This constructor should be used by environments that support dynamic imports and that wish\n * to leverage code splitting as a means to keep bundles as small as possible.\n * @public\n */\nexport class OdspDocumentServiceFactoryCore\n\timplements IDocumentServiceFactory, IRelaySessionAwareDriverFactory\n{\n\tprivate readonly nonPersistentCache: INonPersistentCache = new NonPersistentCache();\n\tprivate readonly socketReferenceKeyPrefix?: string;\n\n\tpublic get snapshotPrefetchResultCache() {\n\t\treturn this.nonPersistentCache.snapshotPrefetchResultCache;\n\t}\n\n\tpublic get IRelaySessionAwareDriverFactory() {\n\t\treturn this;\n\t}\n\n\t/**\n\t * This function would return info about relay service session only if this factory established (or attempted to\n\t * establish) connection very recently. Otherwise, it will return undefined.\n\t * @param resolvedUrl - resolved url for container\n\t * @returns The current join session response stored in cache. `undefined` if not present.\n\t */\n\tpublic async getRelayServiceSessionInfo(\n\t\tresolvedUrl: IResolvedUrl,\n\t): Promise<ISocketStorageDiscovery | undefined> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst joinSessionResponse = await this.nonPersistentCache.sessionJoinCache.get(\n\t\t\tgetJoinSessionCacheKey(odspResolvedUrl),\n\t\t);\n\t\treturn joinSessionResponse?.joinSessionResponse;\n\t}\n\n\tpublic async createContainer(\n\t\tcreateNewSummary: ISummaryTree | undefined,\n\t\tcreateNewResolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tlet odspResolvedUrl = getOdspResolvedUrl(createNewResolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\n\t\tlet fileInfo: INewFileInfo | IExistingFileInfo;\n\t\tlet createShareLinkParam: ShareLinkTypes | ISharingLinkKind | undefined;\n\t\tif (odspResolvedUrl.itemId) {\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"Existing\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\titemId: odspResolvedUrl.itemId,\n\t\t\t};\n\t\t} else if (odspResolvedUrl.fileName) {\n\t\t\tconst [, queryString] = odspResolvedUrl.url.split(\"?\");\n\t\t\tconst searchParams = new URLSearchParams(queryString);\n\t\t\tconst filePath = searchParams.get(\"path\");\n\t\t\tif (filePath === undefined || filePath === null) {\n\t\t\t\tthrow new Error(\"File path should be provided!!\");\n\t\t\t}\n\t\t\tcreateShareLinkParam = getSharingLinkParams(this.hostPolicy, searchParams);\n\t\t\tfileInfo = {\n\t\t\t\ttype: \"New\",\n\t\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\t\tfilePath,\n\t\t\t\tfilename: odspResolvedUrl.fileName,\n\t\t\t\tcreateLinkType: createShareLinkParam,\n\t\t\t};\n\t\t} else {\n\t\t\tthrow new Error(\"A new or existing file must be specified to create container!\");\n\t\t}\n\n\t\tif (isCombinedAppAndProtocolSummary(createNewSummary)) {\n\t\t\tconst documentAttributes = getDocAttributesFromProtocolSummary(\n\t\t\t\tcreateNewSummary.tree[\".protocol\"],\n\t\t\t);\n\t\t\tif (documentAttributes?.sequenceNumber !== 0) {\n\t\t\t\tthrow new Error(\"Seq number in detached ODSP container should be 0\");\n\t\t\t}\n\t\t}\n\n\t\tconst odspLogger = createOdspLogger(logger);\n\n\t\tconst fileEntry: IFileEntry = {\n\t\t\tresolvedUrl: odspResolvedUrl,\n\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t};\n\t\tconst cacheAndTracker = createOdspCacheAndTracker(\n\t\t\tthis.persistedCache,\n\t\t\tthis.nonPersistentCache,\n\t\t\tfileEntry,\n\t\t\todspLogger,\n\t\t\tclientIsSummarizer,\n\t\t);\n\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\todspLogger,\n\t\t\t{\n\t\t\t\teventName: \"CreateNew\",\n\t\t\t\tisWithSummaryUpload: true,\n\t\t\t\tcreateShareLinkParam: createShareLinkParam\n\t\t\t\t\t? JSON.stringify(createShareLinkParam)\n\t\t\t\t\t: undefined,\n\t\t\t\tenableShareLinkWithCreate: this.hostPolicy.enableShareLinkWithCreate,\n\t\t\t\tenableSingleRequestForShareLinkWithCreate:\n\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst getStorageToken = toInstrumentedOdspTokenFetcher(\n\t\t\t\t\todspLogger,\n\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t\ttrue /* throwOnNullToken */,\n\t\t\t\t);\n\t\t\t\t// We can delay load this module as this path will not be executed in load flows and create flow\n\t\t\t\t// while only happens once in lifetime of a document happens in the background after creation of\n\t\t\t\t// detached container.\n\t\t\t\tconst module = await import(\n\t\t\t\t\t/* webpackChunkName: \"createNewModule\" */ \"./createNewModule\"\n\t\t\t\t)\n\t\t\t\t\t.then((m) => {\n\t\t\t\t\t\todspLogger.sendTelemetryEvent({ eventName: \"createNewModuleLoaded\" });\n\t\t\t\t\t\treturn m;\n\t\t\t\t\t})\n\t\t\t\t\t.catch((error) => {\n\t\t\t\t\t\todspLogger.sendErrorEvent(\n\t\t\t\t\t\t\t{ eventName: \"createNewModuleLoadFailed\" },\n\t\t\t\t\t\t\terror,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tthrow error;\n\t\t\t\t\t});\n\t\t\t\todspResolvedUrl = isNewFileInfo(fileInfo)\n\t\t\t\t\t? await module.createNewFluidFile(\n\t\t\t\t\t\t\tgetStorageToken,\n\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions\n\t\t\t\t\t\t\t\t?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t\t\tthis.hostPolicy.enableSingleRequestForShareLinkWithCreate,\n\t\t\t\t\t\t\tthis.hostPolicy.enableShareLinkWithCreate,\n\t\t\t\t\t )\n\t\t\t\t\t: await module.createNewContainerOnExistingFile(\n\t\t\t\t\t\t\tgetStorageToken,\n\t\t\t\t\t\t\tfileInfo,\n\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\tcreateNewSummary,\n\t\t\t\t\t\t\tcacheAndTracker.epochTracker,\n\t\t\t\t\t\t\tfileEntry,\n\t\t\t\t\t\t\tthis.hostPolicy.cacheCreateNewSummary ?? true,\n\t\t\t\t\t\t\t!!this.hostPolicy.sessionOptions\n\t\t\t\t\t\t\t\t?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\t\t\todspResolvedUrl.isClpCompliantApp,\n\t\t\t\t\t );\n\t\t\t\tconst docService = this.createDocumentServiceCore(\n\t\t\t\t\todspResolvedUrl,\n\t\t\t\t\todspLogger,\n\t\t\t\t\tcacheAndTracker,\n\t\t\t\t\tclientIsSummarizer,\n\t\t\t\t);\n\t\t\t\tevent.end({\n\t\t\t\t\tdocId: odspResolvedUrl.hashedDocumentId,\n\t\t\t\t});\n\t\t\t\treturn docService;\n\t\t\t},\n\t\t);\n\t}\n\n\t/**\n\t * @param getStorageToken - function that can provide the storage token for a given site. This is\n\t * is also referred to as the \"Vroom\" token in SPO.\n\t * @param getWebsocketToken - function that can provide a token for accessing the web socket. This is also\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 persistedCache - PersistedCache provided by host for use in this session.\n\t * @param hostPolicy - Policy for storage provided by host.\n\t */\n\tconstructor(\n\t\tprivate readonly getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tprivate readonly getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n\t\tprotected persistedCache: IPersistedCache = new LocalPersistentCache(),\n\t\tprivate readonly hostPolicy: HostStoragePolicy = {},\n\t) {\n\t\tif (this.hostPolicy.isolateSocketCache === true) {\n\t\t\t// create the key to separate the socket reuse cache\n\t\t\tthis.socketReferenceKeyPrefix = uuid();\n\t\t}\n\t\t// Set enableRedeemFallback by default as true.\n\t\tthis.hostPolicy.enableRedeemFallback = this.hostPolicy.enableRedeemFallback ?? true;\n\t\tthis.hostPolicy.sessionOptions = {\n\t\t\tforceAccessTokenViaAuthorizationHeader: true,\n\t\t\t...this.hostPolicy.sessionOptions,\n\t\t};\n\t}\n\n\tpublic async createDocumentService(\n\t\tresolvedUrl: IResolvedUrl,\n\t\tlogger?: ITelemetryBaseLogger,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\treturn this.createDocumentServiceCore(\n\t\t\tresolvedUrl,\n\t\t\tcreateOdspLogger(logger),\n\t\t\tundefined,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n\n\tprotected async createDocumentServiceCore(\n\t\tresolvedUrl: IResolvedUrl,\n\t\todspLogger: ITelemetryLogger,\n\t\tcacheAndTrackerArg?: ICacheAndTracker,\n\t\tclientIsSummarizer?: boolean,\n\t): Promise<IDocumentService> {\n\t\tconst odspResolvedUrl = getOdspResolvedUrl(resolvedUrl);\n\t\tconst resolvedUrlData: IOdspUrlParts = {\n\t\t\tsiteUrl: odspResolvedUrl.siteUrl,\n\t\t\tdriveId: odspResolvedUrl.driveId,\n\t\t\titemId: odspResolvedUrl.itemId,\n\t\t};\n\t\tconst cacheAndTracker =\n\t\t\tcacheAndTrackerArg ??\n\t\t\tcreateOdspCacheAndTracker(\n\t\t\t\tthis.persistedCache,\n\t\t\t\tthis.nonPersistentCache,\n\t\t\t\t{ resolvedUrl: odspResolvedUrl, docId: odspResolvedUrl.hashedDocumentId },\n\t\t\t\todspLogger,\n\t\t\t\tclientIsSummarizer,\n\t\t\t);\n\n\t\tconst storageTokenFetcher = toInstrumentedOdspTokenFetcher(\n\t\t\todspLogger,\n\t\t\tresolvedUrlData,\n\t\t\tthis.getStorageToken,\n\t\t\ttrue /* throwOnNullToken */,\n\t\t);\n\n\t\tconst webSocketTokenFetcher =\n\t\t\tthis.getWebsocketToken === undefined\n\t\t\t\t? undefined\n\t\t\t\t: async (options: TokenFetchOptions) =>\n\t\t\t\t\t\ttoInstrumentedOdspTokenFetcher(\n\t\t\t\t\t\t\todspLogger,\n\t\t\t\t\t\t\tresolvedUrlData,\n\t\t\t\t\t\t\tthis.getWebsocketToken!,\n\t\t\t\t\t\t\tfalse /* throwOnNullToken */,\n\t\t\t\t\t\t)(options, \"GetWebsocketToken\");\n\n\t\treturn OdspDocumentService.create(\n\t\t\tresolvedUrl,\n\t\t\tstorageTokenFetcher,\n\t\t\twebSocketTokenFetcher,\n\t\t\todspLogger,\n\t\t\tcacheAndTracker.cache,\n\t\t\tthis.hostPolicy,\n\t\t\tcacheAndTracker.epochTracker,\n\t\t\tthis.socketReferenceKeyPrefix,\n\t\t\tclientIsSummarizer,\n\t\t);\n\t}\n}\n\n/**\n * Extract the sharing link kind from the resolved URL's query paramerters\n */\nfunction getSharingLinkParams(\n\thostPolicy: HostStoragePolicy,\n\tsearchParams: URLSearchParams,\n): ShareLinkTypes | ISharingLinkKind | undefined {\n\t// extract request parameters for creation of sharing link (if provided) if the feature is enabled\n\tlet createShareLinkParam: ShareLinkTypes | ISharingLinkKind | undefined;\n\tif (hostPolicy.enableSingleRequestForShareLinkWithCreate) {\n\t\tconst createLinkScope = searchParams.get(\"createLinkScope\");\n\t\tconst createLinkRole = searchParams.get(\"createLinkRole\");\n\t\tif (createLinkScope && SharingLinkScope[createLinkScope]) {\n\t\t\tcreateShareLinkParam = {\n\t\t\t\tscope: SharingLinkScope[createLinkScope],\n\t\t\t\t...(createLinkRole && SharingLinkRole[createLinkRole]\n\t\t\t\t\t? { role: SharingLinkRole[createLinkRole] }\n\t\t\t\t\t: {}),\n\t\t\t};\n\t\t}\n\t} else if (hostPolicy.enableShareLinkWithCreate) {\n\t\tconst createLinkType = searchParams.get(\"createLinkType\");\n\t\tif (createLinkType && ShareLinkTypes[createLinkType]) {\n\t\t\tcreateShareLinkParam = ShareLinkTypes[createLinkType || \"\"];\n\t\t}\n\t}\n\treturn createShareLinkParam;\n}\n"]}
|
|
@@ -6,8 +6,9 @@ import { IDocumentServiceFactory } from "@fluidframework/driver-definitions";
|
|
|
6
6
|
import { OdspResourceTokenFetchOptions, TokenFetcher, IPersistedCache, HostStoragePolicy } from "@fluidframework/odsp-driver-definitions";
|
|
7
7
|
import { OdspDocumentServiceFactoryCore } from "./odspDocumentServiceFactoryCore";
|
|
8
8
|
/**
|
|
9
|
-
* @deprecated
|
|
9
|
+
* @deprecated This is deprecated in favour of OdspDocumentServiceFactory as the socket io is now loaded inside the
|
|
10
10
|
* other dynamically imported module.
|
|
11
|
+
* @public
|
|
11
12
|
*/
|
|
12
13
|
export declare class OdspDocumentServiceFactoryWithCodeSplit extends OdspDocumentServiceFactoryCore implements IDocumentServiceFactory {
|
|
13
14
|
constructor(getStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>, getWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined, persistedCache?: IPersistedCache, hostPolicy?: HostStoragePolicy);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactoryWithCodeSplit.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryWithCodeSplit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACN,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactoryWithCodeSplit.d.ts","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryWithCodeSplit.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EACN,6BAA6B,EAC7B,YAAY,EACZ,eAAe,EACf,iBAAiB,EACjB,MAAM,yCAAyC,CAAC;AACjD,OAAO,EAAE,8BAA8B,EAAE,MAAM,kCAAkC,CAAC;AAElF;;;;GAIG;AACH,qBAAa,uCACZ,SAAQ,8BACR,YAAW,uBAAuB;gBAGjC,eAAe,EAAE,YAAY,CAAC,6BAA6B,CAAC,EAC5D,iBAAiB,EAAE,YAAY,CAAC,6BAA6B,CAAC,GAAG,SAAS,EAC1E,cAAc,CAAC,EAAE,eAAe,EAChC,UAAU,CAAC,EAAE,iBAAiB;CAI/B"}
|
|
@@ -7,8 +7,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
7
7
|
exports.OdspDocumentServiceFactoryWithCodeSplit = void 0;
|
|
8
8
|
const odspDocumentServiceFactoryCore_1 = require("./odspDocumentServiceFactoryCore");
|
|
9
9
|
/**
|
|
10
|
-
* @deprecated
|
|
10
|
+
* @deprecated This is deprecated in favour of OdspDocumentServiceFactory as the socket io is now loaded inside the
|
|
11
11
|
* other dynamically imported module.
|
|
12
|
+
* @public
|
|
12
13
|
*/
|
|
13
14
|
class OdspDocumentServiceFactoryWithCodeSplit extends odspDocumentServiceFactoryCore_1.OdspDocumentServiceFactoryCore {
|
|
14
15
|
constructor(getStorageToken, getWebsocketToken, persistedCache, hostPolicy) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentServiceFactoryWithCodeSplit.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryWithCodeSplit.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,qFAAkF;AAElF
|
|
1
|
+
{"version":3,"file":"odspDocumentServiceFactoryWithCodeSplit.js","sourceRoot":"","sources":["../src/odspDocumentServiceFactoryWithCodeSplit.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AASH,qFAAkF;AAElF;;;;GAIG;AACH,MAAa,uCACZ,SAAQ,+DAA8B;IAGtC,YACC,eAA4D,EAC5D,iBAA0E,EAC1E,cAAgC,EAChC,UAA8B;QAE9B,KAAK,CAAC,eAAe,EAAE,iBAAiB,EAAE,cAAc,EAAE,UAAU,CAAC,CAAC;IACvE,CAAC;CACD;AAZD,0FAYC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IDocumentServiceFactory } from \"@fluidframework/driver-definitions\";\nimport {\n\tOdspResourceTokenFetchOptions,\n\tTokenFetcher,\n\tIPersistedCache,\n\tHostStoragePolicy,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport { OdspDocumentServiceFactoryCore } from \"./odspDocumentServiceFactoryCore\";\n\n/**\n * @deprecated This is deprecated in favour of OdspDocumentServiceFactory as the socket io is now loaded inside the\n * other dynamically imported module.\n * @public\n */\nexport class OdspDocumentServiceFactoryWithCodeSplit\n\textends OdspDocumentServiceFactoryCore\n\timplements IDocumentServiceFactory\n{\n\tconstructor(\n\t\tgetStorageToken: TokenFetcher<OdspResourceTokenFetchOptions>,\n\t\tgetWebsocketToken: TokenFetcher<OdspResourceTokenFetchOptions> | undefined,\n\t\tpersistedCache?: IPersistedCache,\n\t\thostPolicy?: HostStoragePolicy,\n\t) {\n\t\tsuper(getStorageToken, getWebsocketToken, persistedCache, hostPolicy);\n\t}\n}\n"]}
|
|
@@ -5,7 +5,11 @@
|
|
|
5
5
|
*/
|
|
6
6
|
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
7
7
|
if (k2 === undefined) k2 = k;
|
|
8
|
-
Object.
|
|
8
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
9
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
10
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
11
|
+
}
|
|
12
|
+
Object.defineProperty(o, k2, desc);
|
|
9
13
|
}) : (function(o, m, k, k2) {
|
|
10
14
|
if (k2 === undefined) k2 = k;
|
|
11
15
|
o[k2] = m[k];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentStorageManager.js","sourceRoot":"","sources":["../src/odspDocumentStorageManager.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;AAEH,qEAOyC;AACzC,+DAA2D;AAC3D,2DAA2D;AAC3D,qEAA2D;AAE3D,6DAAoE;AACpE,2EAAmG;AACnG,+DAA8E;AAC9E,qFAMiD;AAOjD,mDAMyB;AACzB,yEAAsE;AAEtE,2CAAkF;AAKlF,qDAA+D;AAC/D,qFAAkF;AAErE,QAAA,mCAAmC,GAAW,EAAE,GAAG,IAAI,CAAC,CAAC,cAAc;AAOpF,MAAa,0BAA2B,SAAQ,+DAA8B;IAuB7E,YACkB,eAAiC,EACjC,eAAgD,EAChD,MAA2B,EAC3B,iBAA0B,EAC1B,KAAiB,EACjB,UAAqC,EACrC,YAA0B,EAC1B,aAAyC,EACzC,8BAAwD,EACxD,uBAAmD;QAEpE,KAAK,CAAC,IAAA,2CAAyB,EAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC;QAX/B,oBAAe,GAAf,eAAe,CAAkB;QACjC,oBAAe,GAAf,eAAe,CAAiC;QAChD,WAAM,GAAN,MAAM,CAAqB;QAC3B,sBAAiB,GAAjB,iBA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AI,QAAQ,CAAC,KAAK,EAAE;gBACnB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACpC;YACD,4GAA4G;YAC5G,+CAA+C;YAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA3rBD,gEA2rBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tnormalizeError,\n\toverwriteStack,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert, delay } from \"@fluidframework/core-utils\";\nimport { LogLevel } from \"@fluidframework/core-interfaces\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { promiseRaceWithWinner } from \"@fluidframework/driver-base\";\nimport { ISummaryContext, DriverErrorType, FetchSource } from \"@fluidframework/driver-definitions\";\nimport { RateLimiter, NonRetryableError } from \"@fluidframework/driver-utils\";\nimport {\n\tIOdspResolvedUrl,\n\tISnapshotOptions,\n\tOdspErrorType,\n\tInstrumentedStorageTokenFetcher,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tIDocumentStorageGetVersionsResponse,\n\tHostStoragePolicyInternal,\n\tIVersionedValueWithEpoch,\n\tISnapshotCachedEntry,\n} from \"./contracts\";\nimport {\n\tdownloadSnapshot,\n\tevalBlobsAndTrees,\n\tfetchSnapshot,\n\tfetchSnapshotWithRedeem,\n\tSnapshotFormatSupportType,\n} from \"./fetchSnapshot\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport { IOdspCache, IPrefetchSnapshotContents } from \"./odspCache\";\nimport { createCacheSnapshotKey, getWithRetryForTokenRefresh } from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { EpochTracker } from \"./epochTracker\";\nimport type { OdspSummaryUploadManager } from \"./odspSummaryUploadManager\";\nimport { FlushResult } from \"./odspDocumentDeltaConnection\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { OdspDocumentStorageServiceBase } from \"./odspDocumentStorageServiceBase\";\n\nexport const defaultSummarizerCacheExpiryTimeout: number = 60 * 1000; // 60 seconds.\n\ninterface GetVersionsTelemetryProps {\n\tcacheEntryAge?: number;\n\tcacheSummarizerExpired?: boolean;\n}\n\nexport class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {\n\tprivate odspSummaryModuleLoaded: boolean = false;\n\tprivate summaryModuleP: Promise<OdspSummaryUploadManager> | undefined;\n\tprivate odspSummaryUploadManager: OdspSummaryUploadManager | undefined;\n\n\tprivate firstVersionCall = true;\n\tprivate _isFirstSnapshotFromNetwork: boolean | undefined;\n\tprivate readonly documentId: string;\n\tprivate readonly snapshotUrl: string | undefined;\n\tprivate readonly attachmentPOSTUrl: string | undefined;\n\tprivate readonly attachmentGETUrl: string | undefined;\n\t// Driver specified limits for snapshot size and time.\n\t/**\n\t * NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to\n\t * happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large\n\t * snapshot size and timeout limits so that such failures are unlikely to occur.\n\t */\n\tprivate readonly maxSnapshotSizeLimit = 500000000; // 500 MB\n\tprivate readonly maxSnapshotFetchTimeout = 120000; // 2 min\n\n\t// limits the amount of parallel \"attachment\" blob uploads\n\tprivate readonly createBlobRateLimiter = new RateLimiter(1);\n\n\tconstructor(\n\t\tprivate readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tprivate readonly getStorageToken: InstrumentedStorageTokenFetcher,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly fetchFullSnapshot: boolean,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicyInternal,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly flushCallback: () => Promise<FlushResult>,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t\tprivate readonly snapshotFormatFetchType?: SnapshotFormatSupportType,\n\t) {\n\t\tsuper(loggerToMonitoringContext(logger).config);\n\n\t\tthis.documentId = this.odspResolvedUrl.hashedDocumentId;\n\t\tthis.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;\n\t\tthis.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;\n\t\tthis.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;\n\t}\n\n\tpublic get isFirstSnapshotFromNetwork() {\n\t\treturn this._isFirstSnapshotFromNetwork;\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n\t\tthis.checkAttachmentPOSTUrl();\n\n\t\tconst response = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"CreateBlob\");\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.attachmentPOSTUrl}/content`,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\t\t\theaders[\"Content-Type\"] = \"application/octet-stream\";\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"createBlob\",\n\t\t\t\t\tsize: file.byteLength,\n\t\t\t\t\twaitQueueLength: this.createBlobRateLimiter.waitQueueLength,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tconst res = await this.createBlobRateLimiter.schedule(async () =>\n\t\t\t\t\t\tthis.epochTracker.fetchAndParseAsJSON<api.ICreateBlobResponse>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: file,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"createBlob\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tblobId: res.content.id,\n\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t});\n\t\t\t\t\treturn res;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\n\t\treturn response.content;\n\t}\n\n\tprotected async fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer> {\n\t\tthis.checkAttachmentGETUrl();\n\n\t\tconst blob = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"GetBlob\");\n\t\t\tconst unAuthedUrl = `${this.attachmentGETUrl}/${encodeURIComponent(blobId)}/content`;\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\tunAuthedUrl,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"readDataBlob\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tevicted,\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t\twaitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tconst res = await this.epochTracker.fetchArray(url, { headers }, \"blob\");\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\twaitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,\n\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\t\t});\n\t\t\t\t\tconst cacheControl = res.headers.get(\"cache-control\");\n\t\t\t\t\tif (\n\t\t\t\t\t\tcacheControl === undefined ||\n\t\t\t\t\t\t!(cacheControl.includes(\"private\") || cacheControl.includes(\"public\"))\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\t\teventName: \"NonCacheableBlob\",\n\t\t\t\t\t\t\tcacheControl,\n\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn res.content;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\t\tthis.blobCache.setBlob(blobId, blob);\n\t\treturn blob;\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: api.IVersion,\n\t\tscenarioName?: string,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<api.ISnapshotTree | null> {\n\t\tif (!this.snapshotUrl) {\n\t\t\treturn null;\n\t\t}\n\t\treturn super.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tblobid: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<api.IVersion[]> {\n\t\t// Regular load workflow uses blobId === documentID to indicate \"latest\".\n\t\tif (blobid !== this.documentId && blobid) {\n\t\t\t// FluidFetch & FluidDebugger tools use empty sting to query for versions\n\t\t\t// In such case we need to make a call against SPO to give full picture to the tool.\n\t\t\t// Otherwise, each commit calls getVersions but odsp doesn't have a history for each commit\n\t\t\t// return the blobid as is\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: blobid,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\t// Can't really make a call if we do not have URL\n\t\tif (!this.snapshotUrl) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// If count is one, we can use the trees/latest API, which returns the latest version and trees in a single request for better performance\n\t\tif (count === 1 && (blobid === null || blobid === this.documentId)) {\n\t\t\tconst hostSnapshotOptions = this.hostPolicy.snapshotOptions;\n\t\t\tconst odspSnapshotCacheValue: ISnapshotContents = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: \"ObtainSnapshot\", fetchSource },\n\t\t\t\tasync (event: PerformanceEvent) => {\n\t\t\t\t\tconst props: GetVersionsTelemetryProps = {};\n\t\t\t\t\tlet cacheLookupTimeInSerialFetch = 0;\n\t\t\t\t\tlet retrievedSnapshot:\n\t\t\t\t\t\t| ISnapshotContents\n\t\t\t\t\t\t| IPrefetchSnapshotContents\n\t\t\t\t\t\t| undefined;\n\n\t\t\t\t\tlet method: string;\n\t\t\t\t\tlet prefetchWaitStartTime: number = performance.now();\n\t\t\t\t\tif (fetchSource === FetchSource.noCache) {\n\t\t\t\t\t\tretrievedSnapshot = await this.fetchSnapshot(\n\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmethod = \"networkOnly\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Here's the logic to grab the persistent cache snapshot implemented by the host\n\t\t\t\t\t\t// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions\n\t\t\t\t\t\tconst cachedSnapshotP: Promise<ISnapshotContents | undefined> =\n\t\t\t\t\t\t\tthis.epochTracker\n\t\t\t\t\t\t\t\t.get(createCacheSnapshotKey(this.odspResolvedUrl))\n\t\t\t\t\t\t\t\t.then(async (snapshotCachedEntry: ISnapshotCachedEntry) => {\n\t\t\t\t\t\t\t\t\tif (snapshotCachedEntry !== undefined) {\n\t\t\t\t\t\t\t\t\t\t// If the cached entry does not contain the entry time, then assign it a default of 30 days old.\n\t\t\t\t\t\t\t\t\t\tconst age =\n\t\t\t\t\t\t\t\t\t\t\tDate.now() -\n\t\t\t\t\t\t\t\t\t\t\t(snapshotCachedEntry.cacheEntryTime ??\n\t\t\t\t\t\t\t\t\t\t\t\tDate.now() - 30 * 24 * 60 * 60 * 1000);\n\n\t\t\t\t\t\t\t\t\t\t// In order to decrease the number of times we have to execute a snapshot refresh,\n\t\t\t\t\t\t\t\t\t\t// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,\n\t\t\t\t\t\t\t\t\t\t// force the network retrieval instead as there might be a more recent snapshot available.\n\t\t\t\t\t\t\t\t\t\t// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.\n\t\t\t\t\t\t\t\t\t\tif (this.hostPolicy.summarizerClient) {\n\t\t\t\t\t\t\t\t\t\t\tif (age > defaultSummarizerCacheExpiryTimeout) {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.cacheSummarizerExpired = true;\n\t\t\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.cacheSummarizerExpired = false;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Record the cache age\n\t\t\t\t\t\t\t\t\t\tprops.cacheEntryAge = age;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn snapshotCachedEntry;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t// Based on the concurrentSnapshotFetch policy:\n\t\t\t\t\t\t// Either retrieve both the network and cache snapshots concurrently and pick the first to return,\n\t\t\t\t\t\t// or grab the cache value and then the network value if the cache value returns undefined.\n\t\t\t\t\t\t// For summarizer which could call this during refreshing of summary parent, always use the cache\n\t\t\t\t\t\t// first. Also for other clients, if it is not critical path which is determined by firstVersionCall,\n\t\t\t\t\t\t// then also check the cache first.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.firstVersionCall &&\n\t\t\t\t\t\t\tthis.hostPolicy.concurrentSnapshotFetch &&\n\t\t\t\t\t\t\t!this.hostPolicy.summarizerClient\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst networkSnapshotP = this.fetchSnapshot(\n\t\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Ensure that failures on both paths are ignored initially.\n\t\t\t\t\t\t\t// I.e. if cache fails for some reason, we will proceed with network result.\n\t\t\t\t\t\t\t// And vice versa - if (for example) client is offline and network request fails first, we\n\t\t\t\t\t\t\t// do want to attempt to succeed with cached data!\n\t\t\t\t\t\t\tconst promiseRaceWinner = await promiseRaceWithWinner([\n\t\t\t\t\t\t\t\tcachedSnapshotP.catch(() => undefined),\n\t\t\t\t\t\t\t\tnetworkSnapshotP.catch(() => undefined),\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tretrievedSnapshot = promiseRaceWinner.value;\n\t\t\t\t\t\t\tmethod = promiseRaceWinner.index === 0 ? \"cache\" : \"network\";\n\n\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\t// if network failed -> wait for cache ( then return network failure)\n\t\t\t\t\t\t\t\t// If cache returned empty or failed -> wait for network (success of failure)\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tif (promiseRaceWinner.index === 1) {\n\t\t\t\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\t\t\t\tmethod = \"cache\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\t\t\tretrievedSnapshot = await networkSnapshotP;\n\t\t\t\t\t\t\t\t\t\tmethod = \"network\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\t\t\t\t// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:\n\t\t\t\t\t\t\t\t\t// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--\n\t\t\t\t\t\t\t\t\t// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the \"zero-cost async stack traces\" document\n\t\t\t\t\t\t\t\t\t// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.\n\t\t\t\t\t\t\t\t\t// Regenerating the stack at this level provides more information for logged errors.\n\t\t\t\t\t\t\t\t\t// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and\n\t\t\t\t\t\t\t\t\t// get similar quality stacks with less hand-crafted code.\n\t\t\t\t\t\t\t\t\tconst innerStack = (err as Error).stack;\n\t\t\t\t\t\t\t\t\tconst normalizedError = normalizeError(err);\n\t\t\t\t\t\t\t\t\tnormalizedError.addTelemetryProperties({ innerStack });\n\n\t\t\t\t\t\t\t\t\tconst newStack = `<<STACK TRUNCATED: see innerStack property>> \\n${generateStack()}`;\n\t\t\t\t\t\t\t\t\toverwriteStack(normalizedError, newStack);\n\n\t\t\t\t\t\t\t\t\tthrow normalizedError;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Note: There's a race condition here - another caller may come past the undefined check\n\t\t\t\t\t\t\t// while the first caller is awaiting later async code in this block.\n\t\t\t\t\t\t\tconst startTime = performance.now();\n\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\tcacheLookupTimeInSerialFetch = performance.now() - startTime;\n\t\t\t\t\t\t\tmethod = retrievedSnapshot !== undefined ? \"cache\" : \"network\";\n\n\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\tprefetchWaitStartTime = performance.now();\n\t\t\t\t\t\t\t\tretrievedSnapshot = await this.fetchSnapshot(\n\t\t\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (method === \"network\") {\n\t\t\t\t\t\tprops.cacheEntryAge = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.firstVersionCall) {\n\t\t\t\t\t\tthis._isFirstSnapshotFromNetwork = method === \"cache\" ? false : true;\n\t\t\t\t\t}\n\t\t\t\t\tconst prefetchStartTime: number | undefined = (\n\t\t\t\t\t\tretrievedSnapshot as IPrefetchSnapshotContents\n\t\t\t\t\t).prefetchStartTime;\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tmethod,\n\t\t\t\t\t\tavoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,\n\t\t\t\t\t\t...evalBlobsAndTrees(retrievedSnapshot),\n\t\t\t\t\t\tcacheLookupTimeInSerialFetch,\n\t\t\t\t\t\tprefetchSavedDuration:\n\t\t\t\t\t\t\tprefetchStartTime !== undefined && method !== \"cache\"\n\t\t\t\t\t\t\t\t? prefetchWaitStartTime - prefetchStartTime\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t});\n\t\t\t\t\treturn retrievedSnapshot;\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst stTime = performance.now();\n\t\t\t// Don't override ops which were fetched during initial load, since we could still need them.\n\t\t\tconst id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstVersionCall);\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"SnapshotInitializeTime\",\n\t\t\t\t\tduration: performance.now() - stTime,\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\tLogLevel.verbose,\n\t\t\t);\n\t\t\tthis.firstVersionCall = false;\n\n\t\t\treturn id ? [{ id, treeId: undefined! }] : [];\n\t\t}\n\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"GetVersions\");\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.snapshotUrl}/versions?top=${count}`,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\n\t\t\t// Fetch the latest snapshot versions for the document\n\t\t\tconst response = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"getVersions\",\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t},\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.epochTracker.fetchAndParseAsJSON<IDocumentStorageGetVersionsResponse>(\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t{ headers },\n\t\t\t\t\t\t\"versions\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t),\n\t\t\t);\n\t\t\tconst versionsResponse = response.content;\n\t\t\tif (!versionsResponse) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"No response from /versions endpoint\",\n\t\t\t\t\tDriverErrorType.genericNetworkError,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!Array.isArray(versionsResponse.value)) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"Incorrect response from /versions endpoint, expected an array\",\n\t\t\t\t\tDriverErrorType.genericNetworkError,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn versionsResponse.value.map((version) => {\n\t\t\t\treturn {\n\t\t\t\t\tid: version.id,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t};\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate async fetchSnapshot(\n\t\thostSnapshotOptions: ISnapshotOptions | undefined,\n\t\tscenarioName?: string,\n\t) {\n\t\treturn this.fetchSnapshotCore(hostSnapshotOptions, scenarioName).catch((error) => {\n\t\t\t// Issue #5895:\n\t\t\t// If we are offline, this error is retryable. But that means that RetriableDocumentStorageService\n\t\t\t// will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class\n\t\t\t// going getVersions / individual blob download path. This path is very slow, and will not work with\n\t\t\t// delay-loaded data stores and ODSP storage deleting old snapshots and blobs.\n\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\terror.canRetry = false;\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tprivate async fetchSnapshotCore(\n\t\thostSnapshotOptions: ISnapshotOptions | undefined,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotContents | IPrefetchSnapshotContents> {\n\t\t// Don't look into cache, if the host specifically tells us so.\n\t\tif (!this.hostPolicy.avoidPrefetchSnapshotCache) {\n\t\t\tconst prefetchCacheKey = getKeyForCacheEntry(\n\t\t\t\tcreateCacheSnapshotKey(this.odspResolvedUrl),\n\t\t\t);\n\t\t\tconst result = await this.cache.snapshotPrefetchResultCache\n\t\t\t\t?.get(prefetchCacheKey)\n\t\t\t\t?.then(async (response) => {\n\t\t\t\t\t// Remove it from cache once used.\n\t\t\t\t\tthis.cache.snapshotPrefetchResultCache.remove(prefetchCacheKey);\n\t\t\t\t\t// Validate the epoch from the prefetched snapshot result.\n\t\t\t\t\tawait this.epochTracker.validateEpoch(response.fluidEpoch, \"treesLatest\");\n\t\t\t\t\treturn response;\n\t\t\t\t})\n\t\t\t\t.catch(async (err) => {\n\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"PrefetchSnapshotError\",\n\t\t\t\t\t\t\tconcurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terr,\n\t\t\t\t\t);\n\t\t\t\t\treturn undefined;\n\t\t\t\t});\n\t\t\t// If the prefetch call, is successful, then return the contents otherwise as backup for now, just\n\t\t\t// proceed with the old snapshot fetch flow.\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst snapshotOptions: ISnapshotOptions = {\n\t\t\tmds: this.maxSnapshotSizeLimit,\n\t\t\t...hostSnapshotOptions,\n\t\t\ttimeout: hostSnapshotOptions?.timeout\n\t\t\t\t? Math.min(hostSnapshotOptions.timeout, this.maxSnapshotFetchTimeout)\n\t\t\t\t: this.maxSnapshotFetchTimeout,\n\t\t};\n\n\t\t// No limit on size of snapshot or time to fetch, as otherwise we fail all clients to summarize\n\t\tif (this.hostPolicy.summarizerClient) {\n\t\t\tsnapshotOptions.mds = undefined;\n\t\t\tsnapshotOptions.timeout = undefined;\n\t\t}\n\n\t\tconst snapshotDownloader = async (\n\t\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\t\tstorageToken: string,\n\t\t\toptions: ISnapshotOptions | undefined,\n\t\t\tcontroller?: AbortController,\n\t\t) => {\n\t\t\treturn downloadSnapshot(\n\t\t\t\tfinalOdspResolvedUrl,\n\t\t\t\tstorageToken,\n\t\t\t\tthis.logger,\n\t\t\t\toptions,\n\t\t\t\tthis.snapshotFormatFetchType,\n\t\t\t\tcontroller,\n\t\t\t\tthis.epochTracker,\n\t\t\t\tscenarioName,\n\t\t\t);\n\t\t};\n\t\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {\n\t\t\treturn this.cache.persistedCache.put(\n\t\t\t\tcreateCacheSnapshotKey(this.odspResolvedUrl),\n\t\t\t\t// Epoch tracker will add the epoch and version to the value here. So just send value to cache.\n\t\t\t\tvalueWithEpoch.value,\n\t\t\t);\n\t\t};\n\t\tconst removeEntries = async () => this.cache.persistedCache.removeEntries();\n\t\ttry {\n\t\t\tconst odspSnapshot = await fetchSnapshotWithRedeem(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\tthis.getStorageToken,\n\t\t\t\tsnapshotOptions,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\tthis.logger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tthis.hostPolicy.enableRedeemFallback,\n\t\t\t);\n\t\t\treturn odspSnapshot;\n\t\t} catch (error: any) {\n\t\t\tconst errorType = error.errorType;\n\t\t\t// If the snapshot size is too big and the host specified the size limitation(specified in hostSnapshotOptions), then don't try to fetch the snapshot again.\n\t\t\tif (\n\t\t\t\terrorType === OdspErrorType.snapshotTooBig &&\n\t\t\t\thostSnapshotOptions?.mds !== undefined &&\n\t\t\t\tthis.hostPolicy.summarizerClient !== true\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// If the first snapshot request was with blobs and we either timed out or the size was too big, then try to fetch without blobs.\n\t\t\tif (\n\t\t\t\t(errorType === OdspErrorType.snapshotTooBig ||\n\t\t\t\t\terrorType === OdspErrorType.fetchTimeout) &&\n\t\t\t\tsnapshotOptions.blobs\n\t\t\t) {\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"TreeLatest_SecondCall\",\n\t\t\t\t\terrorType,\n\t\t\t\t});\n\t\t\t\tconst snapshotOptionsWithoutBlobs: ISnapshotOptions = {\n\t\t\t\t\t...snapshotOptions,\n\t\t\t\t\tblobs: 0,\n\t\t\t\t\tmds: undefined,\n\t\t\t\t\ttimeout: undefined,\n\t\t\t\t};\n\t\t\t\tconst odspSnapshot = await fetchSnapshotWithRedeem(\n\t\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t\tsnapshotOptionsWithoutBlobs,\n\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\tthis.logger,\n\t\t\t\t\tsnapshotDownloader,\n\t\t\t\t\tputInCache,\n\t\t\t\t\tremoveEntries,\n\t\t\t\t\tthis.hostPolicy.enableRedeemFallback,\n\t\t\t\t);\n\t\t\t\treturn odspSnapshot;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: api.ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tthis.checkSnapshotUrl();\n\n\t\t// Set the module promise right away, so as to not call it twice.\n\t\tif (this.summaryModuleP === undefined) {\n\t\t\tthis.summaryModuleP = this.getDelayLoadedSummaryManager();\n\t\t}\n\n\t\t// Enable flushing only if we have single commit summary and this is not the initial summary for an empty file\n\t\tif (\".protocol\" in summary.tree && context.ackHandle !== undefined) {\n\t\t\tlet retry = 1;\n\t\t\tfor (;;) {\n\t\t\t\tconst result = await this.flushCallback();\n\t\t\t\tconst seq = result.lastPersistedSequenceNumber;\n\t\t\t\tif (seq !== undefined && seq >= context.referenceSequenceNumber) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (retry > 3) {\n\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\teventName: \"FlushFailure\",\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tretry,\n\t\t\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"FlushExtraCall\",\n\t\t\t\t\t...result,\n\t\t\t\t\tretry,\n\t\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t\t});\n\n\t\t\t\tretry++;\n\t\t\t\tawait delay(1000 * (result.retryAfter ?? 1));\n\t\t\t}\n\t\t}\n\n\t\tif (!this.odspSummaryUploadManager) {\n\t\t\tthis.odspSummaryUploadManager = await this.summaryModuleP\n\t\t\t\t.then(async (m) => {\n\t\t\t\t\tthis.odspSummaryModuleLoaded = true;\n\t\t\t\t\treturn m;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.odspSummaryModuleLoaded = false;\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tthis.odspSummaryUploadManager !== undefined,\n\t\t\t0x56e /* summary upload manager should have been initialized */,\n\t\t);\n\t\tconst id = await this.odspSummaryUploadManager.writeSummaryTree(summary, context);\n\t\treturn id;\n\t}\n\n\tprivate async getDelayLoadedSummaryManager() {\n\t\tassert(this.odspSummaryModuleLoaded === false, 0x56f /* Should be loaded only once */);\n\t\tconst module = await import(\n\t\t\t/* webpackChunkName: \"summaryModule\" */ \"./odspSummaryUploadManager\"\n\t\t)\n\t\t\t.then((m) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"SummaryModuleLoaded\" });\n\t\t\t\treturn m;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"SummaryModuleLoadFailed\" }, error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tthis.odspSummaryUploadManager = new module.OdspSummaryUploadManager(\n\t\t\tthis.odspResolvedUrl.endpoints.snapshotStorageUrl,\n\t\t\tthis.getStorageToken,\n\t\t\tthis.logger,\n\t\t\tthis.epochTracker,\n\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\tthis.relayServiceTenantAndSessionId,\n\t\t);\n\t\treturn this.odspSummaryUploadManager;\n\t}\n\n\tprivate checkSnapshotUrl() {\n\t\tif (!this.snapshotUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no snapshot url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate checkAttachmentPOSTUrl() {\n\t\tif (!this.attachmentPOSTUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no attachment POST url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate checkAttachmentGETUrl() {\n\t\tif (!this.attachmentGETUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no attachment GET url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected async fetchTreeFromSnapshot(\n\t\tid: string,\n\t\tscenarioName?: string,\n\t): Promise<api.ISnapshotTree | undefined> {\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"ReadCommit\");\n\t\t\tconst snapshotDownloader = async (\n\t\t\t\turl: string,\n\t\t\t\tfetchOptions: { [index: string]: any },\n\t\t\t) => {\n\t\t\t\treturn this.epochTracker.fetchAndParseAsJSON(\n\t\t\t\t\turl,\n\t\t\t\t\tfetchOptions,\n\t\t\t\t\t\"snapshotTree\",\n\t\t\t\t\tundefined,\n\t\t\t\t\tscenarioName,\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst snapshot = await fetchSnapshot(\n\t\t\t\tthis.snapshotUrl!,\n\t\t\t\tstorageToken,\n\t\t\t\tid,\n\t\t\t\tthis.fetchFullSnapshot,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\tthis.logger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t);\n\t\t\tlet treeId = \"\";\n\t\t\tif (snapshot.snapshotTree) {\n\t\t\t\tassert(\n\t\t\t\t\tsnapshot.snapshotTree.id !== undefined,\n\t\t\t\t\t0x222 /* \"Root tree should contain the id!!\" */,\n\t\t\t\t);\n\t\t\t\ttreeId = snapshot.snapshotTree.id;\n\t\t\t\tthis.setRootTree(treeId, snapshot.snapshotTree);\n\t\t\t}\n\t\t\tif (snapshot.blobs) {\n\t\t\t\tthis.initBlobsCache(snapshot.blobs);\n\t\t\t}\n\t\t\t// If the version id doesn't match with the id of the tree, then use the id of first tree which in that case\n\t\t\t// will be the actual id of tree to be fetched.\n\t\t\treturn this.commitCache.get(id) ?? this.commitCache.get(treeId);\n\t\t});\n\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AAe,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;YACvE,MAAM,kBAAkB,GAAG,KAAK,EAC/B,GAAW,EACX,YAAsC,EACrC,EAAE;gBACH,OAAO,IAAI,CAAC,YAAY,CAAC,mBAAmB,CAC3C,GAAG,EACH,YAAY,EACZ,cAAc,EACd,SAAS,EACT,YAAY,CACZ,CAAC;YACH,CAAC,CAAC;YACF,MAAM,QAAQ,GAAG,MAAM,IAAA,6BAAa,EACnC,IAAI,CAAC,WAAY,EACjB,YAAY,EACZ,EAAE,EACF,IAAI,CAAC,iBAAiB,EACtB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,cAAc,EAAE,sCAAsC,EACxE,IAAI,CAAC,MAAM,EACX,kBAAkB,CAClB,CAAC;YACF,IAAI,MAAM,GAAG,EAAE,CAAC;YAChB,IAAI,QAAQ,CAAC,YAAY,EAAE;gBAC1B,IAAA,mBAAM,EACL,QAAQ,CAAC,YAAY,CAAC,EAAE,KAAK,SAAS,EACtC,KAAK,CAAC,yCAAyC,CAC/C,CAAC;gBACF,MAAM,GAAG,QAAQ,CAAC,YAAY,CAAC,EAAE,CAAC;gBAClC,IAAI,CAAC,WAAW,CAAC,MAAM,EAAE,QAAQ,CAAC,YAAY,CAAC,CAAC;aAChD;YACD,IAAI,QAAQ,CAAC,KAAK,EAAE;gBACnB,IAAI,CAAC,cAAc,CAAC,QAAQ,CAAC,KAAK,CAAC,CAAC;aACpC;YACD,4GAA4G;YAC5G,+CAA+C;YAC/C,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,EAAE,CAAC,IAAI,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;QACjE,CAAC,CAAC,CAAC;IACJ,CAAC;CACD;AA3rBD,gEA2rBC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tgenerateStack,\n\tITelemetryLoggerExt,\n\tloggerToMonitoringContext,\n\tnormalizeError,\n\toverwriteStack,\n\tPerformanceEvent,\n} from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { assert, delay } from \"@fluidframework/core-utils\";\nimport { LogLevel } from \"@fluidframework/core-interfaces\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport { promiseRaceWithWinner } from \"@fluidframework/driver-base\";\nimport { ISummaryContext, DriverErrorType, FetchSource } from \"@fluidframework/driver-definitions\";\nimport { RateLimiter, NonRetryableError } from \"@fluidframework/driver-utils\";\nimport {\n\tIOdspResolvedUrl,\n\tISnapshotOptions,\n\tOdspErrorType,\n\tInstrumentedStorageTokenFetcher,\n\tgetKeyForCacheEntry,\n} from \"@fluidframework/odsp-driver-definitions\";\nimport {\n\tIDocumentStorageGetVersionsResponse,\n\tHostStoragePolicyInternal,\n\tIVersionedValueWithEpoch,\n\tISnapshotCachedEntry,\n} from \"./contracts\";\nimport {\n\tdownloadSnapshot,\n\tevalBlobsAndTrees,\n\tfetchSnapshot,\n\tfetchSnapshotWithRedeem,\n\tSnapshotFormatSupportType,\n} from \"./fetchSnapshot\";\nimport { getUrlAndHeadersWithAuth } from \"./getUrlAndHeadersWithAuth\";\nimport { IOdspCache, IPrefetchSnapshotContents } from \"./odspCache\";\nimport { createCacheSnapshotKey, getWithRetryForTokenRefresh } from \"./odspUtils\";\nimport { ISnapshotContents } from \"./odspPublicUtils\";\nimport { EpochTracker } from \"./epochTracker\";\nimport type { OdspSummaryUploadManager } from \"./odspSummaryUploadManager\";\nimport { FlushResult } from \"./odspDocumentDeltaConnection\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\nimport { OdspDocumentStorageServiceBase } from \"./odspDocumentStorageServiceBase\";\n\nexport const defaultSummarizerCacheExpiryTimeout: number = 60 * 1000; // 60 seconds.\n\ninterface GetVersionsTelemetryProps {\n\tcacheEntryAge?: number;\n\tcacheSummarizerExpired?: boolean;\n}\n\nexport class OdspDocumentStorageService extends OdspDocumentStorageServiceBase {\n\tprivate odspSummaryModuleLoaded: boolean = false;\n\tprivate summaryModuleP: Promise<OdspSummaryUploadManager> | undefined;\n\tprivate odspSummaryUploadManager: OdspSummaryUploadManager | undefined;\n\n\tprivate firstVersionCall = true;\n\tprivate _isFirstSnapshotFromNetwork: boolean | undefined;\n\tprivate readonly documentId: string;\n\tprivate readonly snapshotUrl: string | undefined;\n\tprivate readonly attachmentPOSTUrl: string | undefined;\n\tprivate readonly attachmentGETUrl: string | undefined;\n\t// Driver specified limits for snapshot size and time.\n\t/**\n\t * NOTE: While commit cfff6e3 added restrictions to prevent large payloads, snapshot failures will continue to\n\t * happen until blob request throttling is implemented. Until then, as a temporary fix we set arbitrarily large\n\t * snapshot size and timeout limits so that such failures are unlikely to occur.\n\t */\n\tprivate readonly maxSnapshotSizeLimit = 500000000; // 500 MB\n\tprivate readonly maxSnapshotFetchTimeout = 120000; // 2 min\n\n\t// limits the amount of parallel \"attachment\" blob uploads\n\tprivate readonly createBlobRateLimiter = new RateLimiter(1);\n\n\tconstructor(\n\t\tprivate readonly odspResolvedUrl: IOdspResolvedUrl,\n\t\tprivate readonly getStorageToken: InstrumentedStorageTokenFetcher,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t\tprivate readonly fetchFullSnapshot: boolean,\n\t\tprivate readonly cache: IOdspCache,\n\t\tprivate readonly hostPolicy: HostStoragePolicyInternal,\n\t\tprivate readonly epochTracker: EpochTracker,\n\t\tprivate readonly flushCallback: () => Promise<FlushResult>,\n\t\tprivate readonly relayServiceTenantAndSessionId: () => string | undefined,\n\t\tprivate readonly snapshotFormatFetchType?: SnapshotFormatSupportType,\n\t) {\n\t\tsuper(loggerToMonitoringContext(logger).config);\n\n\t\tthis.documentId = this.odspResolvedUrl.hashedDocumentId;\n\t\tthis.snapshotUrl = this.odspResolvedUrl.endpoints.snapshotStorageUrl;\n\t\tthis.attachmentPOSTUrl = this.odspResolvedUrl.endpoints.attachmentPOSTStorageUrl;\n\t\tthis.attachmentGETUrl = this.odspResolvedUrl.endpoints.attachmentGETStorageUrl;\n\t}\n\n\tpublic get isFirstSnapshotFromNetwork() {\n\t\treturn this._isFirstSnapshotFromNetwork;\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse> {\n\t\tthis.checkAttachmentPOSTUrl();\n\n\t\tconst response = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"CreateBlob\");\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.attachmentPOSTUrl}/content`,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\t\t\theaders[\"Content-Type\"] = \"application/octet-stream\";\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"createBlob\",\n\t\t\t\t\tsize: file.byteLength,\n\t\t\t\t\twaitQueueLength: this.createBlobRateLimiter.waitQueueLength,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tconst res = await this.createBlobRateLimiter.schedule(async () =>\n\t\t\t\t\t\tthis.epochTracker.fetchAndParseAsJSON<api.ICreateBlobResponse>(\n\t\t\t\t\t\t\turl,\n\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\tbody: file,\n\t\t\t\t\t\t\t\theaders,\n\t\t\t\t\t\t\t\tmethod: \"POST\",\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\"createBlob\",\n\t\t\t\t\t\t),\n\t\t\t\t\t);\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tblobId: res.content.id,\n\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t});\n\t\t\t\t\treturn res;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\n\t\treturn response.content;\n\t}\n\n\tprotected async fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer> {\n\t\tthis.checkAttachmentGETUrl();\n\n\t\tconst blob = await getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"GetBlob\");\n\t\t\tconst unAuthedUrl = `${this.attachmentGETUrl}/${encodeURIComponent(blobId)}/content`;\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\tunAuthedUrl,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\n\t\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"readDataBlob\",\n\t\t\t\t\tblobId,\n\t\t\t\t\tevicted,\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t\twaitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tconst res = await this.epochTracker.fetchArray(url, { headers }, \"blob\");\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\twaitQueueLength: this.epochTracker.rateLimiter.waitQueueLength,\n\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t\tattempts: options.refresh ? 2 : 1,\n\t\t\t\t\t});\n\t\t\t\t\tconst cacheControl = res.headers.get(\"cache-control\");\n\t\t\t\t\tif (\n\t\t\t\t\t\tcacheControl === undefined ||\n\t\t\t\t\t\t!(cacheControl.includes(\"private\") || cacheControl.includes(\"public\"))\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\t\teventName: \"NonCacheableBlob\",\n\t\t\t\t\t\t\tcacheControl,\n\t\t\t\t\t\t\tblobId,\n\t\t\t\t\t\t\t...res.propsToLog,\n\t\t\t\t\t\t});\n\t\t\t\t\t}\n\t\t\t\t\treturn res.content;\n\t\t\t\t},\n\t\t\t);\n\t\t});\n\t\tthis.blobCache.setBlob(blobId, blob);\n\t\treturn blob;\n\t}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: api.IVersion,\n\t\tscenarioName?: string,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<api.ISnapshotTree | null> {\n\t\tif (!this.snapshotUrl) {\n\t\t\treturn null;\n\t\t}\n\t\treturn super.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getVersions(\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t\tblobid: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<api.IVersion[]> {\n\t\t// Regular load workflow uses blobId === documentID to indicate \"latest\".\n\t\tif (blobid !== this.documentId && blobid) {\n\t\t\t// FluidFetch & FluidDebugger tools use empty sting to query for versions\n\t\t\t// In such case we need to make a call against SPO to give full picture to the tool.\n\t\t\t// Otherwise, each commit calls getVersions but odsp doesn't have a history for each commit\n\t\t\t// return the blobid as is\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: blobid,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\t// Can't really make a call if we do not have URL\n\t\tif (!this.snapshotUrl) {\n\t\t\treturn [];\n\t\t}\n\n\t\t// If count is one, we can use the trees/latest API, which returns the latest version and trees in a single request for better performance\n\t\tif (count === 1 && (blobid === null || blobid === this.documentId)) {\n\t\t\tconst hostSnapshotOptions = this.hostPolicy.snapshotOptions;\n\t\t\tconst odspSnapshotCacheValue: ISnapshotContents = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{ eventName: \"ObtainSnapshot\", fetchSource },\n\t\t\t\tasync (event: PerformanceEvent) => {\n\t\t\t\t\tconst props: GetVersionsTelemetryProps = {};\n\t\t\t\t\tlet cacheLookupTimeInSerialFetch = 0;\n\t\t\t\t\tlet retrievedSnapshot:\n\t\t\t\t\t\t| ISnapshotContents\n\t\t\t\t\t\t| IPrefetchSnapshotContents\n\t\t\t\t\t\t| undefined;\n\n\t\t\t\t\tlet method: string;\n\t\t\t\t\tlet prefetchWaitStartTime: number = performance.now();\n\t\t\t\t\tif (fetchSource === FetchSource.noCache) {\n\t\t\t\t\t\tretrievedSnapshot = await this.fetchSnapshot(\n\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t);\n\t\t\t\t\t\tmethod = \"networkOnly\";\n\t\t\t\t\t} else {\n\t\t\t\t\t\t// Here's the logic to grab the persistent cache snapshot implemented by the host\n\t\t\t\t\t\t// Epoch tracker is responsible for communicating with the persistent cache, handling epochs and cache versions\n\t\t\t\t\t\tconst cachedSnapshotP: Promise<ISnapshotContents | undefined> =\n\t\t\t\t\t\t\tthis.epochTracker\n\t\t\t\t\t\t\t\t.get(createCacheSnapshotKey(this.odspResolvedUrl))\n\t\t\t\t\t\t\t\t.then(async (snapshotCachedEntry: ISnapshotCachedEntry) => {\n\t\t\t\t\t\t\t\t\tif (snapshotCachedEntry !== undefined) {\n\t\t\t\t\t\t\t\t\t\t// If the cached entry does not contain the entry time, then assign it a default of 30 days old.\n\t\t\t\t\t\t\t\t\t\tconst age =\n\t\t\t\t\t\t\t\t\t\t\tDate.now() -\n\t\t\t\t\t\t\t\t\t\t\t(snapshotCachedEntry.cacheEntryTime ??\n\t\t\t\t\t\t\t\t\t\t\t\tDate.now() - 30 * 24 * 60 * 60 * 1000);\n\n\t\t\t\t\t\t\t\t\t\t// In order to decrease the number of times we have to execute a snapshot refresh,\n\t\t\t\t\t\t\t\t\t\t// if this is the summarizer and we have a cache entry but it is past the defaultSummarizerCacheExpiryTimeout,\n\t\t\t\t\t\t\t\t\t\t// force the network retrieval instead as there might be a more recent snapshot available.\n\t\t\t\t\t\t\t\t\t\t// See: https://github.com/microsoft/FluidFramework/issues/8995 for additional information.\n\t\t\t\t\t\t\t\t\t\tif (this.hostPolicy.summarizerClient) {\n\t\t\t\t\t\t\t\t\t\t\tif (age > defaultSummarizerCacheExpiryTimeout) {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.cacheSummarizerExpired = true;\n\t\t\t\t\t\t\t\t\t\t\t\treturn undefined;\n\t\t\t\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\t\t\t\tprops.cacheSummarizerExpired = false;\n\t\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t// Record the cache age\n\t\t\t\t\t\t\t\t\t\tprops.cacheEntryAge = age;\n\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\treturn snapshotCachedEntry;\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t// Based on the concurrentSnapshotFetch policy:\n\t\t\t\t\t\t// Either retrieve both the network and cache snapshots concurrently and pick the first to return,\n\t\t\t\t\t\t// or grab the cache value and then the network value if the cache value returns undefined.\n\t\t\t\t\t\t// For summarizer which could call this during refreshing of summary parent, always use the cache\n\t\t\t\t\t\t// first. Also for other clients, if it is not critical path which is determined by firstVersionCall,\n\t\t\t\t\t\t// then also check the cache first.\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\tthis.firstVersionCall &&\n\t\t\t\t\t\t\tthis.hostPolicy.concurrentSnapshotFetch &&\n\t\t\t\t\t\t\t!this.hostPolicy.summarizerClient\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tconst networkSnapshotP = this.fetchSnapshot(\n\t\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t\t);\n\n\t\t\t\t\t\t\t// Ensure that failures on both paths are ignored initially.\n\t\t\t\t\t\t\t// I.e. if cache fails for some reason, we will proceed with network result.\n\t\t\t\t\t\t\t// And vice versa - if (for example) client is offline and network request fails first, we\n\t\t\t\t\t\t\t// do want to attempt to succeed with cached data!\n\t\t\t\t\t\t\tconst promiseRaceWinner = await promiseRaceWithWinner([\n\t\t\t\t\t\t\t\tcachedSnapshotP.catch(() => undefined),\n\t\t\t\t\t\t\t\tnetworkSnapshotP.catch(() => undefined),\n\t\t\t\t\t\t\t]);\n\t\t\t\t\t\t\tretrievedSnapshot = promiseRaceWinner.value;\n\t\t\t\t\t\t\tmethod = promiseRaceWinner.index === 0 ? \"cache\" : \"network\";\n\n\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\t// if network failed -> wait for cache ( then return network failure)\n\t\t\t\t\t\t\t\t// If cache returned empty or failed -> wait for network (success of failure)\n\t\t\t\t\t\t\t\ttry {\n\t\t\t\t\t\t\t\t\tif (promiseRaceWinner.index === 1) {\n\t\t\t\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\t\t\t\tmethod = \"cache\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\t\t\tretrievedSnapshot = await networkSnapshotP;\n\t\t\t\t\t\t\t\t\t\tmethod = \"network\";\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t} catch (err: unknown) {\n\t\t\t\t\t\t\t\t\t// The call stacks of any errors thrown by cached snapshot or network snapshot aren't very useful:\n\t\t\t\t\t\t\t\t\t// they get truncated at this stack frame due to the promise race and how v8 tracks async stack traces--\n\t\t\t\t\t\t\t\t\t// see https://v8.dev/docs/stack-trace-api#async-stack-traces and the \"zero-cost async stack traces\" document\n\t\t\t\t\t\t\t\t\t// linked there. https://v8.dev/blog/fast-async#await-under-the-hood may also be helpful for context on internals.\n\t\t\t\t\t\t\t\t\t// Regenerating the stack at this level provides more information for logged errors.\n\t\t\t\t\t\t\t\t\t// Once FF uses an ES2021 target, we could convert the above promise race to use `Promise.any` + AggregateError and\n\t\t\t\t\t\t\t\t\t// get similar quality stacks with less hand-crafted code.\n\t\t\t\t\t\t\t\t\tconst innerStack = (err as Error).stack;\n\t\t\t\t\t\t\t\t\tconst normalizedError = normalizeError(err);\n\t\t\t\t\t\t\t\t\tnormalizedError.addTelemetryProperties({ innerStack });\n\n\t\t\t\t\t\t\t\t\tconst newStack = `<<STACK TRUNCATED: see innerStack property>> \\n${generateStack()}`;\n\t\t\t\t\t\t\t\t\toverwriteStack(normalizedError, newStack);\n\n\t\t\t\t\t\t\t\t\tthrow normalizedError;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t// Note: There's a race condition here - another caller may come past the undefined check\n\t\t\t\t\t\t\t// while the first caller is awaiting later async code in this block.\n\t\t\t\t\t\t\tconst startTime = performance.now();\n\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\tcacheLookupTimeInSerialFetch = performance.now() - startTime;\n\t\t\t\t\t\t\tmethod = retrievedSnapshot !== undefined ? \"cache\" : \"network\";\n\n\t\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\t\tprefetchWaitStartTime = performance.now();\n\t\t\t\t\t\t\t\tretrievedSnapshot = await this.fetchSnapshot(\n\t\t\t\t\t\t\t\t\thostSnapshotOptions,\n\t\t\t\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t\t\t\t);\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif (method === \"network\") {\n\t\t\t\t\t\tprops.cacheEntryAge = undefined;\n\t\t\t\t\t}\n\t\t\t\t\tif (this.firstVersionCall) {\n\t\t\t\t\t\tthis._isFirstSnapshotFromNetwork = method === \"cache\" ? false : true;\n\t\t\t\t\t}\n\t\t\t\t\tconst prefetchStartTime: number | undefined = (\n\t\t\t\t\t\tretrievedSnapshot as IPrefetchSnapshotContents\n\t\t\t\t\t).prefetchStartTime;\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\t...props,\n\t\t\t\t\t\tmethod,\n\t\t\t\t\t\tavoidPrefetchSnapshotCache: this.hostPolicy.avoidPrefetchSnapshotCache,\n\t\t\t\t\t\t...evalBlobsAndTrees(retrievedSnapshot),\n\t\t\t\t\t\tcacheLookupTimeInSerialFetch,\n\t\t\t\t\t\tprefetchSavedDuration:\n\t\t\t\t\t\t\tprefetchStartTime !== undefined && method !== \"cache\"\n\t\t\t\t\t\t\t\t? prefetchWaitStartTime - prefetchStartTime\n\t\t\t\t\t\t\t\t: undefined,\n\t\t\t\t\t});\n\t\t\t\t\treturn retrievedSnapshot;\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst stTime = performance.now();\n\t\t\t// Don't override ops which were fetched during initial load, since we could still need them.\n\t\t\tconst id = this.initializeFromSnapshot(odspSnapshotCacheValue, this.firstVersionCall);\n\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t{\n\t\t\t\t\teventName: \"SnapshotInitializeTime\",\n\t\t\t\t\tduration: performance.now() - stTime,\n\t\t\t\t},\n\t\t\t\tundefined,\n\t\t\t\tLogLevel.verbose,\n\t\t\t);\n\t\t\tthis.firstVersionCall = false;\n\n\t\t\treturn id ? [{ id, treeId: undefined! }] : [];\n\t\t}\n\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"GetVersions\");\n\t\t\tconst { url, headers } = getUrlAndHeadersWithAuth(\n\t\t\t\t`${this.snapshotUrl}/versions?top=${count}`,\n\t\t\t\tstorageToken,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t);\n\n\t\t\t// Fetch the latest snapshot versions for the document\n\t\t\tconst response = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"getVersions\",\n\t\t\t\t\theaders: Object.keys(headers).length !== 0 ? true : undefined,\n\t\t\t\t},\n\t\t\t\tasync () =>\n\t\t\t\t\tthis.epochTracker.fetchAndParseAsJSON<IDocumentStorageGetVersionsResponse>(\n\t\t\t\t\t\turl,\n\t\t\t\t\t\t{ headers },\n\t\t\t\t\t\t\"versions\",\n\t\t\t\t\t\tundefined,\n\t\t\t\t\t\tscenarioName,\n\t\t\t\t\t),\n\t\t\t);\n\t\t\tconst versionsResponse = response.content;\n\t\t\tif (!versionsResponse) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"No response from /versions endpoint\",\n\t\t\t\t\tDriverErrorType.genericNetworkError,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\tif (!Array.isArray(versionsResponse.value)) {\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"Incorrect response from /versions endpoint, expected an array\",\n\t\t\t\t\tDriverErrorType.genericNetworkError,\n\t\t\t\t\t{ driverVersion },\n\t\t\t\t);\n\t\t\t}\n\t\t\treturn versionsResponse.value.map((version) => {\n\t\t\t\treturn {\n\t\t\t\t\tid: version.id,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t};\n\t\t\t});\n\t\t});\n\t}\n\n\tprivate async fetchSnapshot(\n\t\thostSnapshotOptions: ISnapshotOptions | undefined,\n\t\tscenarioName?: string,\n\t) {\n\t\treturn this.fetchSnapshotCore(hostSnapshotOptions, scenarioName).catch((error) => {\n\t\t\t// Issue #5895:\n\t\t\t// If we are offline, this error is retryable. But that means that RetriableDocumentStorageService\n\t\t\t// will run in circles calling getSnapshotTree, which would result in OdspDocumentStorageService class\n\t\t\t// going getVersions / individual blob download path. This path is very slow, and will not work with\n\t\t\t// delay-loaded data stores and ODSP storage deleting old snapshots and blobs.\n\t\t\tif (typeof error === \"object\" && error !== null) {\n\t\t\t\terror.canRetry = false;\n\t\t\t}\n\t\t\tthrow error;\n\t\t});\n\t}\n\n\tprivate async fetchSnapshotCore(\n\t\thostSnapshotOptions: ISnapshotOptions | undefined,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotContents | IPrefetchSnapshotContents> {\n\t\t// Don't look into cache, if the host specifically tells us so.\n\t\tif (!this.hostPolicy.avoidPrefetchSnapshotCache) {\n\t\t\tconst prefetchCacheKey = getKeyForCacheEntry(\n\t\t\t\tcreateCacheSnapshotKey(this.odspResolvedUrl),\n\t\t\t);\n\t\t\tconst result = await this.cache.snapshotPrefetchResultCache\n\t\t\t\t?.get(prefetchCacheKey)\n\t\t\t\t?.then(async (response) => {\n\t\t\t\t\t// Remove it from cache once used.\n\t\t\t\t\tthis.cache.snapshotPrefetchResultCache.remove(prefetchCacheKey);\n\t\t\t\t\t// Validate the epoch from the prefetched snapshot result.\n\t\t\t\t\tawait this.epochTracker.validateEpoch(response.fluidEpoch, \"treesLatest\");\n\t\t\t\t\treturn response;\n\t\t\t\t})\n\t\t\t\t.catch(async (err) => {\n\t\t\t\t\tthis.logger.sendTelemetryEvent(\n\t\t\t\t\t\t{\n\t\t\t\t\t\t\teventName: \"PrefetchSnapshotError\",\n\t\t\t\t\t\t\tconcurrentSnapshotFetch: this.hostPolicy.concurrentSnapshotFetch,\n\t\t\t\t\t\t},\n\t\t\t\t\t\terr,\n\t\t\t\t\t);\n\t\t\t\t\treturn undefined;\n\t\t\t\t});\n\t\t\t// If the prefetch call, is successful, then return the contents otherwise as backup for now, just\n\t\t\t// proceed with the old snapshot fetch flow.\n\t\t\tif (result !== undefined) {\n\t\t\t\treturn result;\n\t\t\t}\n\t\t}\n\t\tconst snapshotOptions: ISnapshotOptions = {\n\t\t\tmds: this.maxSnapshotSizeLimit,\n\t\t\t...hostSnapshotOptions,\n\t\t\ttimeout: hostSnapshotOptions?.timeout\n\t\t\t\t? Math.min(hostSnapshotOptions.timeout, this.maxSnapshotFetchTimeout)\n\t\t\t\t: this.maxSnapshotFetchTimeout,\n\t\t};\n\n\t\t// No limit on size of snapshot or time to fetch, as otherwise we fail all clients to summarize\n\t\tif (this.hostPolicy.summarizerClient) {\n\t\t\tsnapshotOptions.mds = undefined;\n\t\t\tsnapshotOptions.timeout = undefined;\n\t\t}\n\n\t\tconst snapshotDownloader = async (\n\t\t\tfinalOdspResolvedUrl: IOdspResolvedUrl,\n\t\t\tstorageToken: string,\n\t\t\toptions: ISnapshotOptions | undefined,\n\t\t\tcontroller?: AbortController,\n\t\t) => {\n\t\t\treturn downloadSnapshot(\n\t\t\t\tfinalOdspResolvedUrl,\n\t\t\t\tstorageToken,\n\t\t\t\tthis.logger,\n\t\t\t\toptions,\n\t\t\t\tthis.snapshotFormatFetchType,\n\t\t\t\tcontroller,\n\t\t\t\tthis.epochTracker,\n\t\t\t\tscenarioName,\n\t\t\t);\n\t\t};\n\t\tconst putInCache = async (valueWithEpoch: IVersionedValueWithEpoch) => {\n\t\t\treturn this.cache.persistedCache.put(\n\t\t\t\tcreateCacheSnapshotKey(this.odspResolvedUrl),\n\t\t\t\t// Epoch tracker will add the epoch and version to the value here. So just send value to cache.\n\t\t\t\tvalueWithEpoch.value,\n\t\t\t);\n\t\t};\n\t\tconst removeEntries = async () => this.cache.persistedCache.removeEntries();\n\t\ttry {\n\t\t\tconst odspSnapshot = await fetchSnapshotWithRedeem(\n\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\tthis.getStorageToken,\n\t\t\t\tsnapshotOptions,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\tthis.logger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t\tputInCache,\n\t\t\t\tremoveEntries,\n\t\t\t\tthis.hostPolicy.enableRedeemFallback,\n\t\t\t);\n\t\t\treturn odspSnapshot;\n\t\t} catch (error: any) {\n\t\t\tconst errorType = error.errorType;\n\t\t\t// If the snapshot size is too big and the host specified the size limitation(specified in hostSnapshotOptions), then don't try to fetch the snapshot again.\n\t\t\tif (\n\t\t\t\terrorType === OdspErrorType.snapshotTooBig &&\n\t\t\t\thostSnapshotOptions?.mds !== undefined &&\n\t\t\t\tthis.hostPolicy.summarizerClient !== true\n\t\t\t) {\n\t\t\t\tthrow error;\n\t\t\t}\n\t\t\t// If the first snapshot request was with blobs and we either timed out or the size was too big, then try to fetch without blobs.\n\t\t\tif (\n\t\t\t\t(errorType === OdspErrorType.snapshotTooBig ||\n\t\t\t\t\terrorType === OdspErrorType.fetchTimeout) &&\n\t\t\t\tsnapshotOptions.blobs\n\t\t\t) {\n\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\teventName: \"TreeLatest_SecondCall\",\n\t\t\t\t\terrorType,\n\t\t\t\t});\n\t\t\t\tconst snapshotOptionsWithoutBlobs: ISnapshotOptions = {\n\t\t\t\t\t...snapshotOptions,\n\t\t\t\t\tblobs: 0,\n\t\t\t\t\tmds: undefined,\n\t\t\t\t\ttimeout: undefined,\n\t\t\t\t};\n\t\t\t\tconst odspSnapshot = await fetchSnapshotWithRedeem(\n\t\t\t\t\tthis.odspResolvedUrl,\n\t\t\t\t\tthis.getStorageToken,\n\t\t\t\t\tsnapshotOptionsWithoutBlobs,\n\t\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\t\tthis.logger,\n\t\t\t\t\tsnapshotDownloader,\n\t\t\t\t\tputInCache,\n\t\t\t\t\tremoveEntries,\n\t\t\t\t\tthis.hostPolicy.enableRedeemFallback,\n\t\t\t\t);\n\t\t\t\treturn odspSnapshot;\n\t\t\t}\n\t\t\tthrow error;\n\t\t}\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: api.ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tthis.checkSnapshotUrl();\n\n\t\t// Set the module promise right away, so as to not call it twice.\n\t\tif (this.summaryModuleP === undefined) {\n\t\t\tthis.summaryModuleP = this.getDelayLoadedSummaryManager();\n\t\t}\n\n\t\t// Enable flushing only if we have single commit summary and this is not the initial summary for an empty file\n\t\tif (\".protocol\" in summary.tree && context.ackHandle !== undefined) {\n\t\t\tlet retry = 1;\n\t\t\tfor (;;) {\n\t\t\t\tconst result = await this.flushCallback();\n\t\t\t\tconst seq = result.lastPersistedSequenceNumber;\n\t\t\t\tif (seq !== undefined && seq >= context.referenceSequenceNumber) {\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tif (retry > 3) {\n\t\t\t\t\tthis.logger.sendErrorEvent({\n\t\t\t\t\t\teventName: \"FlushFailure\",\n\t\t\t\t\t\t...result,\n\t\t\t\t\t\tretry,\n\t\t\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t\t\t});\n\t\t\t\t\tbreak;\n\t\t\t\t}\n\n\t\t\t\tthis.logger.sendPerformanceEvent({\n\t\t\t\t\teventName: \"FlushExtraCall\",\n\t\t\t\t\t...result,\n\t\t\t\t\tretry,\n\t\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t\t});\n\n\t\t\t\tretry++;\n\t\t\t\tawait delay(1000 * (result.retryAfter ?? 1));\n\t\t\t}\n\t\t}\n\n\t\tif (!this.odspSummaryUploadManager) {\n\t\t\tthis.odspSummaryUploadManager = await this.summaryModuleP\n\t\t\t\t.then(async (m) => {\n\t\t\t\t\tthis.odspSummaryModuleLoaded = true;\n\t\t\t\t\treturn m;\n\t\t\t\t})\n\t\t\t\t.catch((error) => {\n\t\t\t\t\tthis.odspSummaryModuleLoaded = false;\n\t\t\t\t\tthrow error;\n\t\t\t\t});\n\t\t}\n\n\t\tassert(\n\t\t\tthis.odspSummaryUploadManager !== undefined,\n\t\t\t0x56e /* summary upload manager should have been initialized */,\n\t\t);\n\t\tconst id = await this.odspSummaryUploadManager.writeSummaryTree(summary, context);\n\t\treturn id;\n\t}\n\n\tprivate async getDelayLoadedSummaryManager() {\n\t\tassert(this.odspSummaryModuleLoaded === false, 0x56f /* Should be loaded only once */);\n\t\tconst module = await import(\n\t\t\t/* webpackChunkName: \"summaryModule\" */ \"./odspSummaryUploadManager\"\n\t\t)\n\t\t\t.then((m) => {\n\t\t\t\tthis.logger.sendTelemetryEvent({ eventName: \"SummaryModuleLoaded\" });\n\t\t\t\treturn m;\n\t\t\t})\n\t\t\t.catch((error) => {\n\t\t\t\tthis.logger.sendErrorEvent({ eventName: \"SummaryModuleLoadFailed\" }, error);\n\t\t\t\tthrow error;\n\t\t\t});\n\t\tthis.odspSummaryUploadManager = new module.OdspSummaryUploadManager(\n\t\t\tthis.odspResolvedUrl.endpoints.snapshotStorageUrl,\n\t\t\tthis.getStorageToken,\n\t\t\tthis.logger,\n\t\t\tthis.epochTracker,\n\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\tthis.relayServiceTenantAndSessionId,\n\t\t);\n\t\treturn this.odspSummaryUploadManager;\n\t}\n\n\tprivate checkSnapshotUrl() {\n\t\tif (!this.snapshotUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no snapshot url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate checkAttachmentPOSTUrl() {\n\t\tif (!this.attachmentPOSTUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no attachment POST url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprivate checkAttachmentGETUrl() {\n\t\tif (!this.attachmentGETUrl) {\n\t\t\tthrow new NonRetryableError(\n\t\t\t\t\"Method failed because no attachment GET url was available\",\n\t\t\t\tDriverErrorType.genericError,\n\t\t\t\t{ driverVersion },\n\t\t\t);\n\t\t}\n\t}\n\n\tprotected async fetchTreeFromSnapshot(\n\t\tid: string,\n\t\tscenarioName?: string,\n\t): Promise<api.ISnapshotTree | undefined> {\n\t\treturn getWithRetryForTokenRefresh(async (options) => {\n\t\t\tconst storageToken = await this.getStorageToken(options, \"ReadCommit\");\n\t\t\tconst snapshotDownloader = async (\n\t\t\t\turl: string,\n\t\t\t\tfetchOptions: { [index: string]: any },\n\t\t\t) => {\n\t\t\t\treturn this.epochTracker.fetchAndParseAsJSON(\n\t\t\t\t\turl,\n\t\t\t\t\tfetchOptions,\n\t\t\t\t\t\"snapshotTree\",\n\t\t\t\t\tundefined,\n\t\t\t\t\tscenarioName,\n\t\t\t\t);\n\t\t\t};\n\t\t\tconst snapshot = await fetchSnapshot(\n\t\t\t\tthis.snapshotUrl!,\n\t\t\t\tstorageToken,\n\t\t\t\tid,\n\t\t\t\tthis.fetchFullSnapshot,\n\t\t\t\t!!this.hostPolicy.sessionOptions?.forceAccessTokenViaAuthorizationHeader,\n\t\t\t\tthis.logger,\n\t\t\t\tsnapshotDownloader,\n\t\t\t);\n\t\t\tlet treeId = \"\";\n\t\t\tif (snapshot.snapshotTree) {\n\t\t\t\tassert(\n\t\t\t\t\tsnapshot.snapshotTree.id !== undefined,\n\t\t\t\t\t0x222 /* \"Root tree should contain the id!!\" */,\n\t\t\t\t);\n\t\t\t\ttreeId = snapshot.snapshotTree.id;\n\t\t\t\tthis.setRootTree(treeId, snapshot.snapshotTree);\n\t\t\t}\n\t\t\tif (snapshot.blobs) {\n\t\t\t\tthis.initBlobsCache(snapshot.blobs);\n\t\t\t}\n\t\t\t// If the version id doesn't match with the id of the tree, then use the id of first tree which in that case\n\t\t\t// will be the actual id of tree to be fetched.\n\t\t\treturn this.commitCache.get(id) ?? this.commitCache.get(treeId);\n\t\t});\n\t}\n}\n"]}
|
|
@@ -36,7 +36,7 @@ export declare abstract class OdspDocumentStorageServiceBase implements IDocumen
|
|
|
36
36
|
set ops(ops: api.ISequencedDocumentMessage[] | undefined);
|
|
37
37
|
get ops(): api.ISequencedDocumentMessage[] | undefined;
|
|
38
38
|
get snapshotSequenceNumber(): number | undefined;
|
|
39
|
-
|
|
39
|
+
readonly repositoryUrl = "";
|
|
40
40
|
abstract createBlob(file: ArrayBufferLike): Promise<api.ICreateBlobResponse>;
|
|
41
41
|
private readBlobCore;
|
|
42
42
|
protected abstract fetchBlobFromStorage(blobId: string, evicted: boolean): Promise<ArrayBuffer>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"odspDocumentStorageServiceBase.d.ts","sourceRoot":"","sources":["../src/odspDocumentStorageServiceBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAGf,WAAW,EACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,eAAe,EAAE,MAAM,iCAAiC,CAAC;AAClE,OAAO,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAC;AAItD,cAAM,SAAS;IAEd,OAAO,CAAC,gBAAgB,CAA4C;IAIpE,OAAO,CAAC,mBAAmB,CAAkB;IAE7C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAuC;IAGlE,OAAO,CAAC,QAAQ,CAAC,YAAY,CAA0B;IAKvD,OAAO,CAAC,wBAAwB,CAAiB;IAMjD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAS;IAEtC,IAAW,KAAK,6BAEf;IAEM,QAAQ,CAAC,KAAK,EAAE,GAAG,CAAC,MAAM,EAAE,WAAW,CAAC;IAQ/C;;OAEG;IACH,OAAO,CAAC,uBAAuB;IA8BxB,OAAO,CAAC,MAAM,EAAE,MAAM;;;;IAQtB,OAAO,CAAC,MAAM,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW;CAiBhD;AAED,8BAAsB,8BAA+B,YAAW,uBAAuB;IACtF,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,CAAC;gBAEvC,MAAM,EAAE,eAAe;
|
|
1
|
+
{"version":3,"file":"odspDocumentStorageServiceBase.d.ts","sourceRoot":"","sources":["../src/odspDocumentStorageServiceBase.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EAGf,WAAW,EACX,MAAM,oCAAoC,CAAC;AAC5C,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EAAE,eAAe,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entStorageServiceBase {
|
|
|
102
102
|
this.commitCache = new Map();
|
|
103
103
|
this.attributesBlobHandles = new Set();
|
|
104
104
|
this.blobCache = new BlobCache();
|
|
105
|
+
this.repositoryUrl = "";
|
|
105
106
|
// We circumvent the restrictions on the policy only when using this TestOverride setting,
|
|
106
107
|
// which also applies to the code that reads from the cache in epochTracker.ts
|
|
107
108
|
// This may result in files created for testing being unusable in production sessions,
|
|
@@ -112,17 +113,6 @@ class OdspDocumentStorageServiceBase {
|
|
|
112
113
|
this.policies = {
|
|
113
114
|
// By default, ODSP tells the container not to prefetch/cache.
|
|
114
115
|
caching: driver_definitions_1.LoaderCachingPolicy.NoCaching,
|
|
115
|
-
// ODSP storage works better if it has less number of blobs / edges
|
|
116
|
-
// Runtime creating many small blobs results in sub-optimal perf.
|
|
117
|
-
// 2K seems like the sweat spot:
|
|
118
|
-
// The smaller the number, less blobs we aggregate. Most storages are very likely to have notion
|
|
119
|
-
// of minimal "cluster" size, so having small blobs is wasteful
|
|
120
|
-
// At the same time increasing the limit ensure that more blobs with user content are aggregated,
|
|
121
|
-
// reducing possibility for de-duping of same blobs (i.e. .attributes rolled into aggregate blob
|
|
122
|
-
// are not reused across data stores, or even within data store, resulting in duplication of content)
|
|
123
|
-
// Note that duplication of content should not have significant impact for bytes over wire as
|
|
124
|
-
// compression of http payload mostly takes care of it, but it does impact storage size and in-memory sizes.
|
|
125
|
-
minBlobSize: 2048,
|
|
126
116
|
maximumCacheDurationMs: maximumCacheDurationMsInEffect,
|
|
127
117
|
};
|
|
128
118
|
}
|
|
@@ -136,9 +126,6 @@ class OdspDocumentStorageServiceBase {
|
|
|
136
126
|
get snapshotSequenceNumber() {
|
|
137
127
|
return this._snapshotSequenceNumber;
|
|
138
128
|
}
|
|
139
|
-
get repositoryUrl() {
|
|
140
|
-
return "";
|
|
141
|
-
}
|
|
142
129
|
async readBlobCore(blobId) {
|
|
143
130
|
const { blobContent, evicted } = this.blobCache.getBlob(blobId);
|
|
144
131
|
return blobContent ?? this.fetchBlobFromStorage(blobId, evicted);
|