@fluidframework/driver-utils 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.224419
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/.eslintrc.js +17 -7
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +141 -0
- package/README.md +68 -1
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/driver-utils.api.md +401 -0
- package/dist/adapters/compression/compressionTypes.cjs +20 -0
- package/dist/adapters/compression/compressionTypes.cjs.map +1 -0
- package/dist/adapters/compression/compressionTypes.d.ts +23 -0
- package/dist/adapters/compression/compressionTypes.d.ts.map +1 -0
- package/dist/adapters/compression/documentServiceCompressionAdapter.cjs +23 -0
- package/dist/adapters/compression/documentServiceCompressionAdapter.cjs.map +1 -0
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +13 -0
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -0
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.cjs +31 -0
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.cjs.map +1 -0
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +16 -0
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -0
- package/dist/adapters/compression/index.cjs +15 -0
- package/dist/adapters/compression/index.cjs.map +1 -0
- package/dist/adapters/compression/index.d.ts +8 -0
- package/dist/adapters/compression/index.d.ts.map +1 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.cjs +370 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.cjs.map +1 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +165 -0
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -0
- package/dist/adapters/compression/summaryblob/index.cjs +11 -0
- package/dist/adapters/compression/summaryblob/index.cjs.map +1 -0
- package/dist/adapters/compression/summaryblob/index.d.ts +6 -0
- package/dist/adapters/compression/summaryblob/index.d.ts.map +1 -0
- package/dist/adapters/index.cjs +14 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.ts +7 -0
- package/dist/adapters/index.d.ts.map +1 -0
- package/dist/adapters/predefinedAdapters.cjs +52 -0
- package/dist/adapters/predefinedAdapters.cjs.map +1 -0
- package/dist/adapters/predefinedAdapters.d.ts +21 -0
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -0
- package/dist/blob.cjs +65 -0
- package/dist/blob.cjs.map +1 -0
- package/dist/blob.d.ts +56 -0
- package/dist/blob.d.ts.map +1 -0
- package/dist/{buildSnapshotTree.js → buildSnapshotTree.cjs} +7 -5
- package/dist/buildSnapshotTree.cjs.map +1 -0
- package/dist/buildSnapshotTree.d.ts +1 -0
- package/dist/buildSnapshotTree.d.ts.map +1 -1
- package/dist/documentServiceFactoryProxy.cjs +27 -0
- package/dist/documentServiceFactoryProxy.cjs.map +1 -0
- package/dist/documentServiceFactoryProxy.d.ts +19 -0
- package/dist/documentServiceFactoryProxy.d.ts.map +1 -0
- package/dist/documentServiceProxy.cjs +36 -0
- package/dist/documentServiceProxy.cjs.map +1 -0
- package/dist/documentServiceProxy.d.ts +21 -0
- package/dist/documentServiceProxy.d.ts.map +1 -0
- package/dist/{documentStorageServiceProxy.js → documentStorageServiceProxy.cjs} +10 -8
- package/dist/documentStorageServiceProxy.cjs.map +1 -0
- package/dist/documentStorageServiceProxy.d.ts +5 -2
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/driver-utils-alpha.d.ts +163 -0
- package/dist/driver-utils-beta.d.ts +178 -0
- package/dist/driver-utils-public.d.ts +178 -0
- package/dist/driver-utils-untrimmed.d.ts +590 -0
- package/dist/{error.js → error.cjs} +10 -3
- package/dist/error.cjs.map +1 -0
- package/dist/error.d.ts +8 -3
- package/dist/error.d.ts.map +1 -1
- package/dist/index.cjs +69 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +16 -21
- package/dist/index.d.ts.map +1 -1
- package/dist/{insecureUrlResolver.js → insecureUrlResolver.cjs} +10 -11
- package/dist/insecureUrlResolver.cjs.map +1 -0
- package/dist/insecureUrlResolver.d.ts +1 -0
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/messageRecognition.cjs +38 -0
- package/dist/messageRecognition.cjs.map +1 -0
- package/dist/messageRecognition.d.ts +16 -26
- package/dist/messageRecognition.d.ts.map +1 -1
- package/dist/{network.js → network.cjs} +86 -24
- package/dist/network.cjs.map +1 -0
- package/dist/network.d.ts +69 -20
- package/dist/network.d.ts.map +1 -1
- package/dist/networkUtils.cjs +29 -0
- package/dist/networkUtils.cjs.map +1 -0
- package/dist/networkUtils.d.ts +4 -10
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/{parallelRequests.js → parallelRequests.cjs} +146 -74
- package/dist/parallelRequests.cjs.map +1 -0
- package/dist/parallelRequests.d.ts +19 -6
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/{prefetchDocumentStorageService.js → prefetchDocumentStorageService.cjs} +7 -4
- package/dist/prefetchDocumentStorageService.cjs.map +1 -0
- package/dist/prefetchDocumentStorageService.d.ts +4 -2
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/{rateLimiter.js → rateLimiter.cjs} +6 -3
- package/dist/rateLimiter.cjs.map +1 -0
- package/dist/rateLimiter.d.ts +3 -0
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/readAndParse.cjs +28 -0
- package/dist/readAndParse.cjs.map +1 -0
- package/dist/readAndParse.d.ts +10 -4
- package/dist/readAndParse.d.ts.map +1 -1
- package/dist/runWithRetry.cjs +108 -0
- package/dist/runWithRetry.cjs.map +1 -0
- package/dist/runWithRetry.d.ts +26 -7
- package/dist/runWithRetry.d.ts.map +1 -1
- package/dist/{summaryForCreateNew.js → summaryForCreateNew.cjs} +20 -19
- package/dist/summaryForCreateNew.cjs.map +1 -0
- package/dist/summaryForCreateNew.d.ts +17 -4
- package/dist/summaryForCreateNew.d.ts.map +1 -1
- package/dist/{treeConversions.js → treeConversions.cjs} +16 -18
- package/dist/treeConversions.cjs.map +1 -0
- package/dist/treeConversions.d.ts +1 -0
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/tsdoc-metadata.json +11 -0
- package/lib/adapters/compression/compressionTypes.d.mts +23 -0
- package/lib/adapters/compression/compressionTypes.d.mts.map +1 -0
- package/lib/adapters/compression/compressionTypes.mjs +17 -0
- package/lib/adapters/compression/compressionTypes.mjs.map +1 -0
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.mts +13 -0
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.mts.map +1 -0
- package/lib/adapters/compression/documentServiceCompressionAdapter.mjs +19 -0
- package/lib/adapters/compression/documentServiceCompressionAdapter.mjs.map +1 -0
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.mts +16 -0
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.mts.map +1 -0
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.mjs +27 -0
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.mjs.map +1 -0
- package/lib/adapters/compression/index.d.mts +8 -0
- package/lib/adapters/compression/index.d.mts.map +1 -0
- package/lib/adapters/compression/index.mjs +8 -0
- package/lib/adapters/compression/index.mjs.map +1 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.mts +165 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.mts.map +1 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.mjs +366 -0
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.mjs.map +1 -0
- package/lib/adapters/compression/summaryblob/index.d.mts +6 -0
- package/lib/adapters/compression/summaryblob/index.d.mts.map +1 -0
- package/lib/adapters/compression/summaryblob/index.mjs +6 -0
- package/lib/adapters/compression/summaryblob/index.mjs.map +1 -0
- package/lib/adapters/index.d.mts +7 -0
- package/lib/adapters/index.d.mts.map +1 -0
- package/lib/adapters/index.mjs +7 -0
- package/lib/adapters/index.mjs.map +1 -0
- package/lib/adapters/predefinedAdapters.d.mts +21 -0
- package/lib/adapters/predefinedAdapters.d.mts.map +1 -0
- package/lib/adapters/predefinedAdapters.mjs +47 -0
- package/lib/adapters/predefinedAdapters.mjs.map +1 -0
- package/lib/blob.d.mts +56 -0
- package/lib/blob.d.mts.map +1 -0
- package/lib/blob.mjs +59 -0
- package/lib/blob.mjs.map +1 -0
- package/lib/{buildSnapshotTree.d.ts → buildSnapshotTree.d.mts} +1 -0
- package/lib/buildSnapshotTree.d.mts.map +1 -0
- package/lib/{buildSnapshotTree.js → buildSnapshotTree.mjs} +6 -4
- package/lib/buildSnapshotTree.mjs.map +1 -0
- package/lib/documentServiceFactoryProxy.d.mts +19 -0
- package/lib/documentServiceFactoryProxy.d.mts.map +1 -0
- package/lib/documentServiceFactoryProxy.mjs +23 -0
- package/lib/documentServiceFactoryProxy.mjs.map +1 -0
- package/lib/documentServiceProxy.d.mts +21 -0
- package/lib/documentServiceProxy.d.mts.map +1 -0
- package/lib/documentServiceProxy.mjs +32 -0
- package/lib/documentServiceProxy.mjs.map +1 -0
- package/lib/{documentStorageServiceProxy.d.ts → documentStorageServiceProxy.d.mts} +5 -2
- package/lib/documentStorageServiceProxy.d.mts.map +1 -0
- package/lib/{documentStorageServiceProxy.js → documentStorageServiceProxy.mjs} +10 -8
- package/lib/documentStorageServiceProxy.mjs.map +1 -0
- package/lib/driver-utils-alpha.d.mts +163 -0
- package/lib/driver-utils-beta.d.mts +178 -0
- package/lib/driver-utils-public.d.mts +178 -0
- package/lib/driver-utils-untrimmed.d.mts +590 -0
- package/lib/error.d.mts +16 -0
- package/lib/error.d.mts.map +1 -0
- package/lib/error.mjs +19 -0
- package/lib/error.mjs.map +1 -0
- package/lib/index.d.mts +21 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +21 -0
- package/lib/index.mjs.map +1 -0
- package/lib/{insecureUrlResolver.d.ts → insecureUrlResolver.d.mts} +1 -0
- package/lib/insecureUrlResolver.d.mts.map +1 -0
- package/lib/{insecureUrlResolver.js → insecureUrlResolver.mjs} +10 -11
- package/lib/insecureUrlResolver.mjs.map +1 -0
- package/lib/messageRecognition.d.mts +24 -0
- package/lib/messageRecognition.d.mts.map +1 -0
- package/lib/messageRecognition.mjs +29 -0
- package/lib/messageRecognition.mjs.map +1 -0
- package/lib/{network.d.ts → network.d.mts} +69 -20
- package/lib/network.d.mts.map +1 -0
- package/lib/{network.js → network.mjs} +85 -23
- package/lib/network.mjs.map +1 -0
- package/lib/networkUtils.d.mts +11 -0
- package/lib/networkUtils.d.mts.map +1 -0
- package/lib/networkUtils.mjs +25 -0
- package/lib/networkUtils.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
- package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{parallelRequests.d.ts → parallelRequests.d.mts} +19 -6
- package/lib/parallelRequests.d.mts.map +1 -0
- package/lib/{parallelRequests.js → parallelRequests.mjs} +119 -52
- package/lib/parallelRequests.mjs.map +1 -0
- package/lib/{prefetchDocumentStorageService.d.ts → prefetchDocumentStorageService.d.mts} +5 -7
- package/lib/prefetchDocumentStorageService.d.mts.map +1 -0
- package/lib/{prefetchDocumentStorageService.js → prefetchDocumentStorageService.mjs} +7 -8
- package/lib/prefetchDocumentStorageService.mjs.map +1 -0
- package/lib/{rateLimiter.d.ts → rateLimiter.d.mts} +3 -0
- package/lib/rateLimiter.d.mts.map +1 -0
- package/lib/{rateLimiter.js → rateLimiter.mjs} +5 -2
- package/lib/rateLimiter.mjs.map +1 -0
- package/lib/readAndParse.d.mts +20 -0
- package/lib/readAndParse.d.mts.map +1 -0
- package/lib/readAndParse.mjs +24 -0
- package/lib/readAndParse.mjs.map +1 -0
- package/lib/{runWithRetry.d.ts → runWithRetry.d.mts} +26 -7
- package/lib/runWithRetry.d.mts.map +1 -0
- package/lib/runWithRetry.mjs +103 -0
- package/lib/runWithRetry.mjs.map +1 -0
- package/lib/{summaryForCreateNew.d.ts → summaryForCreateNew.d.mts} +17 -4
- package/lib/summaryForCreateNew.d.mts.map +1 -0
- package/lib/{summaryForCreateNew.js → summaryForCreateNew.mjs} +18 -17
- package/lib/summaryForCreateNew.mjs.map +1 -0
- package/lib/{treeConversions.d.ts → treeConversions.d.mts} +1 -0
- package/lib/treeConversions.d.mts.map +1 -0
- package/lib/{treeConversions.js → treeConversions.mjs} +12 -14
- package/lib/treeConversions.mjs.map +1 -0
- package/package.json +88 -64
- package/prettier.config.cjs +8 -0
- package/src/adapters/compression/compressionTypes.ts +25 -0
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +28 -0
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +54 -0
- package/src/adapters/compression/index.ts +12 -0
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +451 -0
- package/src/adapters/compression/summaryblob/index.ts +9 -0
- package/src/adapters/index.ts +13 -0
- package/src/adapters/predefinedAdapters.ts +74 -0
- package/src/blob.ts +77 -0
- package/src/buildSnapshotTree.ts +58 -53
- package/src/documentServiceFactoryProxy.ts +47 -0
- package/src/documentServiceProxy.ts +46 -0
- package/src/documentStorageServiceProxy.ts +52 -37
- package/src/error.ts +13 -8
- package/src/index.ts +51 -21
- package/src/insecureUrlResolver.ts +125 -120
- package/src/messageRecognition.ts +24 -53
- package/src/network.ts +189 -111
- package/src/networkUtils.ts +24 -49
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +630 -519
- package/src/prefetchDocumentStorageService.ts +79 -74
- package/src/rateLimiter.ts +33 -30
- package/src/readAndParse.ts +18 -9
- package/src/runWithRetry.ts +145 -85
- package/src/summaryForCreateNew.ts +48 -29
- package/src/treeConversions.ts +49 -70
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +10 -12
- package/dist/blobAggregationStorage.d.ts +0 -43
- package/dist/blobAggregationStorage.d.ts.map +0 -1
- package/dist/blobAggregationStorage.js +0 -318
- package/dist/blobAggregationStorage.js.map +0 -1
- package/dist/blobCacheStorageService.d.ts +0 -16
- package/dist/blobCacheStorageService.d.ts.map +0 -1
- package/dist/blobCacheStorageService.js +0 -29
- package/dist/blobCacheStorageService.js.map +0 -1
- package/dist/buildSnapshotTree.js.map +0 -1
- package/dist/documentStorageServiceProxy.js.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.d.ts +0 -13
- package/dist/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/dist/emptyDocumentDeltaStorageService.js +0 -20
- package/dist/emptyDocumentDeltaStorageService.js.map +0 -1
- package/dist/error.js.map +0 -1
- package/dist/fluidResolvedUrl.d.ts +0 -8
- package/dist/fluidResolvedUrl.d.ts.map +0 -1
- package/dist/fluidResolvedUrl.js +0 -16
- package/dist/fluidResolvedUrl.js.map +0 -1
- package/dist/index.js +0 -38
- package/dist/index.js.map +0 -1
- package/dist/insecureUrlResolver.js.map +0 -1
- package/dist/messageRecognition.js +0 -73
- package/dist/messageRecognition.js.map +0 -1
- package/dist/multiDocumentServiceFactory.d.ts +0 -16
- package/dist/multiDocumentServiceFactory.d.ts.map +0 -1
- package/dist/multiDocumentServiceFactory.js +0 -63
- package/dist/multiDocumentServiceFactory.js.map +0 -1
- package/dist/multiUrlResolver.d.ts +0 -20
- package/dist/multiUrlResolver.d.ts.map +0 -1
- package/dist/multiUrlResolver.js +0 -45
- package/dist/multiUrlResolver.js.map +0 -1
- package/dist/network.js.map +0 -1
- package/dist/networkUtils.js +0 -59
- package/dist/networkUtils.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/parallelRequests.js.map +0 -1
- package/dist/prefetchDocumentStorageService.js.map +0 -1
- package/dist/rateLimiter.js.map +0 -1
- package/dist/readAndParse.js +0 -22
- package/dist/readAndParse.js.map +0 -1
- package/dist/runWithRetry.js +0 -69
- package/dist/runWithRetry.js.map +0 -1
- package/dist/summaryForCreateNew.js.map +0 -1
- package/dist/treeConversions.js.map +0 -1
- package/dist/treeUtils.d.ts +0 -51
- package/dist/treeUtils.d.ts.map +0 -1
- package/dist/treeUtils.js +0 -85
- package/dist/treeUtils.js.map +0 -1
- package/lib/blobAggregationStorage.d.ts +0 -43
- package/lib/blobAggregationStorage.d.ts.map +0 -1
- package/lib/blobAggregationStorage.js +0 -313
- package/lib/blobAggregationStorage.js.map +0 -1
- package/lib/blobCacheStorageService.d.ts +0 -16
- package/lib/blobCacheStorageService.d.ts.map +0 -1
- package/lib/blobCacheStorageService.js +0 -25
- package/lib/blobCacheStorageService.js.map +0 -1
- package/lib/buildSnapshotTree.d.ts.map +0 -1
- package/lib/buildSnapshotTree.js.map +0 -1
- package/lib/documentStorageServiceProxy.d.ts.map +0 -1
- package/lib/documentStorageServiceProxy.js.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.d.ts +0 -13
- package/lib/emptyDocumentDeltaStorageService.d.ts.map +0 -1
- package/lib/emptyDocumentDeltaStorageService.js +0 -16
- package/lib/emptyDocumentDeltaStorageService.js.map +0 -1
- package/lib/error.d.ts +0 -11
- package/lib/error.d.ts.map +0 -1
- package/lib/error.js +0 -13
- package/lib/error.js.map +0 -1
- package/lib/fluidResolvedUrl.d.ts +0 -8
- package/lib/fluidResolvedUrl.d.ts.map +0 -1
- package/lib/fluidResolvedUrl.js +0 -11
- package/lib/fluidResolvedUrl.js.map +0 -1
- package/lib/index.d.ts +0 -26
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -26
- package/lib/index.js.map +0 -1
- package/lib/insecureUrlResolver.d.ts.map +0 -1
- package/lib/insecureUrlResolver.js.map +0 -1
- package/lib/messageRecognition.d.ts +0 -38
- package/lib/messageRecognition.d.ts.map +0 -1
- package/lib/messageRecognition.js +0 -67
- package/lib/messageRecognition.js.map +0 -1
- package/lib/multiDocumentServiceFactory.d.ts +0 -16
- package/lib/multiDocumentServiceFactory.d.ts.map +0 -1
- package/lib/multiDocumentServiceFactory.js +0 -59
- package/lib/multiDocumentServiceFactory.js.map +0 -1
- package/lib/multiUrlResolver.d.ts +0 -20
- package/lib/multiUrlResolver.d.ts.map +0 -1
- package/lib/multiUrlResolver.js +0 -40
- package/lib/multiUrlResolver.js.map +0 -1
- package/lib/network.d.ts.map +0 -1
- package/lib/network.js.map +0 -1
- package/lib/networkUtils.d.ts +0 -17
- package/lib/networkUtils.d.ts.map +0 -1
- package/lib/networkUtils.js +0 -54
- package/lib/networkUtils.js.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/parallelRequests.d.ts.map +0 -1
- package/lib/parallelRequests.js.map +0 -1
- package/lib/prefetchDocumentStorageService.d.ts.map +0 -1
- package/lib/prefetchDocumentStorageService.js.map +0 -1
- package/lib/rateLimiter.d.ts.map +0 -1
- package/lib/rateLimiter.js.map +0 -1
- package/lib/readAndParse.d.ts +0 -14
- package/lib/readAndParse.d.ts.map +0 -1
- package/lib/readAndParse.js +0 -18
- package/lib/readAndParse.js.map +0 -1
- package/lib/runWithRetry.d.ts.map +0 -1
- package/lib/runWithRetry.js +0 -65
- package/lib/runWithRetry.js.map +0 -1
- package/lib/summaryForCreateNew.d.ts.map +0 -1
- package/lib/summaryForCreateNew.js.map +0 -1
- package/lib/treeConversions.d.ts.map +0 -1
- package/lib/treeConversions.js.map +0 -1
- package/lib/treeUtils.d.ts +0 -51
- package/lib/treeUtils.d.ts.map +0 -1
- package/lib/treeUtils.js +0 -80
- package/lib/treeUtils.js.map +0 -1
- package/src/blobAggregationStorage.ts +0 -374
- package/src/blobCacheStorageService.ts +0 -32
- package/src/emptyDocumentDeltaStorageService.ts +0 -24
- package/src/fluidResolvedUrl.ts +0 -15
- package/src/multiDocumentServiceFactory.ts +0 -80
- package/src/multiUrlResolver.ts +0 -51
- package/src/treeUtils.ts +0 -111
- package/tsconfig.esnext.json +0 -7
|
@@ -6,8 +6,11 @@ exports.PrefetchDocumentStorageService = void 0;
|
|
|
6
6
|
* Licensed under the MIT License.
|
|
7
7
|
*/
|
|
8
8
|
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
9
|
-
const documentStorageServiceProxy_1 = require("./documentStorageServiceProxy");
|
|
10
|
-
const network_1 = require("./network");
|
|
9
|
+
const documentStorageServiceProxy_1 = require("./documentStorageServiceProxy.cjs");
|
|
10
|
+
const network_1 = require("./network.cjs");
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
11
14
|
class PrefetchDocumentStorageService extends documentStorageServiceProxy_1.DocumentStorageServiceProxy {
|
|
12
15
|
constructor() {
|
|
13
16
|
super(...arguments);
|
|
@@ -18,7 +21,7 @@ class PrefetchDocumentStorageService extends documentStorageServiceProxy_1.Docum
|
|
|
18
21
|
get policies() {
|
|
19
22
|
const policies = this.internalStorageService.policies;
|
|
20
23
|
if (policies) {
|
|
21
|
-
return
|
|
24
|
+
return { ...policies, caching: driver_definitions_1.LoaderCachingPolicy.NoCaching };
|
|
22
25
|
}
|
|
23
26
|
}
|
|
24
27
|
async getSnapshotTree(version) {
|
|
@@ -87,4 +90,4 @@ class PrefetchDocumentStorageService extends documentStorageServiceProxy_1.Docum
|
|
|
87
90
|
}
|
|
88
91
|
}
|
|
89
92
|
exports.PrefetchDocumentStorageService = PrefetchDocumentStorageService;
|
|
90
|
-
//# sourceMappingURL=prefetchDocumentStorageService.
|
|
93
|
+
//# sourceMappingURL=prefetchDocumentStorageService.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"prefetchDocumentStorageService.cjs","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\nimport { LoaderCachingPolicy } from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree, IVersion } from \"@fluidframework/protocol-definitions\";\nimport { DocumentStorageServiceProxy } from \"./documentStorageServiceProxy\";\nimport { canRetryOnError } from \"./network\";\n\n/**\n * @internal\n */\nexport class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {\n\t// BlobId -> blob prefetchCache cache\n\tprivate readonly prefetchCache = new Map<string, Promise<ArrayBufferLike>>();\n\tprivate prefetchEnabled = true;\n\n\tpublic get policies() {\n\t\tconst policies = this.internalStorageService.policies;\n\t\tif (policies) {\n\t\t\treturn { ...policies, caching: LoaderCachingPolicy.NoCaching };\n\t\t}\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tconst p = this.internalStorageService.getSnapshotTree(version);\n\t\tif (this.prefetchEnabled) {\n\t\t\t// We don't care if the prefetch succeeds\n\t\t\tvoid p.then((tree: ISnapshotTree | null | undefined) => {\n\t\t\t\tif (tree === null || tree === undefined) {\n\t\t\t\t\treturn;\n\t\t\t\t}\n\t\t\t\tthis.prefetchTree(tree);\n\t\t\t});\n\t\t}\n\t\treturn p;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.cachedRead(blobId);\n\t}\n\tpublic stopPrefetch() {\n\t\tthis.prefetchEnabled = false;\n\t\tthis.prefetchCache.clear();\n\t}\n\n\tprivate async cachedRead(blobId: string): Promise<ArrayBufferLike> {\n\t\tif (this.prefetchEnabled) {\n\t\t\tconst prefetchedBlobP = this.prefetchCache.get(blobId);\n\t\t\tif (prefetchedBlobP !== undefined) {\n\t\t\t\treturn prefetchedBlobP;\n\t\t\t}\n\t\t\tconst prefetchedBlobPFromStorage = this.internalStorageService.readBlob(blobId);\n\t\t\tthis.prefetchCache.set(\n\t\t\t\tblobId,\n\t\t\t\tprefetchedBlobPFromStorage.catch((error) => {\n\t\t\t\t\tif (canRetryOnError(error)) {\n\t\t\t\t\t\tthis.prefetchCache.delete(blobId);\n\t\t\t\t\t}\n\t\t\t\t\tthrow error;\n\t\t\t\t}),\n\t\t\t);\n\t\t\treturn prefetchedBlobPFromStorage;\n\t\t}\n\t\treturn this.internalStorageService.readBlob(blobId);\n\t}\n\n\tprivate prefetchTree(tree: ISnapshotTree) {\n\t\tconst secondary: string[] = [];\n\t\tthis.prefetchTreeCore(tree, secondary);\n\n\t\tfor (const blob of secondary) {\n\t\t\t// We don't care if the prefetch succeeds\n\t\t\tvoid this.cachedRead(blob);\n\t\t}\n\t}\n\n\tprivate prefetchTreeCore(tree: ISnapshotTree, secondary: string[]) {\n\t\tfor (const blobKey of Object.keys(tree.blobs)) {\n\t\t\tconst blob = tree.blobs[blobKey];\n\t\t\tif (blobKey.startsWith(\".\") || blobKey === \"header\" || blobKey.startsWith(\"quorum\")) {\n\t\t\t\tif (blob !== null) {\n\t\t\t\t\t// We don't care if the prefetch succeeds\n\t\t\t\t\tvoid this.cachedRead(blob);\n\t\t\t\t}\n\t\t\t} else if (!blobKey.startsWith(\"deltas\")) {\n\t\t\t\tif (blob !== null) {\n\t\t\t\t\tsecondary.push(blob);\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\tfor (const subTree of Object.keys(tree.trees)) {\n\t\t\tthis.prefetchTreeCore(tree.trees[subTree], secondary);\n\t\t}\n\t}\n}\n"]}
|
|
@@ -5,13 +5,15 @@
|
|
|
5
5
|
import { LoaderCachingPolicy } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { DocumentStorageServiceProxy } from "./documentStorageServiceProxy";
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export declare class PrefetchDocumentStorageService extends DocumentStorageServiceProxy {
|
|
9
12
|
private readonly prefetchCache;
|
|
10
13
|
private prefetchEnabled;
|
|
11
14
|
get policies(): {
|
|
12
15
|
caching: LoaderCachingPolicy;
|
|
13
|
-
|
|
14
|
-
maximumCacheDurationMs?: number | undefined;
|
|
16
|
+
maximumCacheDurationMs?: 432000000 | undefined;
|
|
15
17
|
} | undefined;
|
|
16
18
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
17
19
|
readBlob(blobId: string): Promise<ArrayBufferLike>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prefetchDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,
|
|
1
|
+
{"version":3,"file":"prefetchDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/prefetchDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,EAAE,mBAAmB,EAAE,MAAM,oCAAoC,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sCAAsC,CAAC;AAC/E,OAAO,EAAE,2BAA2B,EAAE,MAAM,+BAA+B,CAAC;AAG5E;;GAEG;AACH,qBAAa,8BAA+B,SAAQ,2BAA2B;IAE9E,OAAO,CAAC,QAAQ,CAAC,aAAa,CAA+C;IAC7E,OAAO,CAAC,eAAe,CAAQ;IAE/B,IAAW,QAAQ;;;kBAKlB;IAEY,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAclE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAGxD,YAAY;YAKL,UAAU;IAqBxB,OAAO,CAAC,YAAY;IAUpB,OAAO,CAAC,gBAAgB;CAmBxB"}
|
|
@@ -5,7 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.RateLimiter = void 0;
|
|
8
|
-
const
|
|
8
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
+
/**
|
|
10
|
+
* @alpha
|
|
11
|
+
*/
|
|
9
12
|
class RateLimiter {
|
|
10
13
|
constructor(maxRequests) {
|
|
11
14
|
this.maxRequests = maxRequests;
|
|
@@ -19,7 +22,7 @@ class RateLimiter {
|
|
|
19
22
|
}
|
|
20
23
|
this.maxRequests++;
|
|
21
24
|
};
|
|
22
|
-
(0,
|
|
25
|
+
(0, core_utils_1.assert)(maxRequests > 0, 0x0ae /* "Tried to create rate limiter with 0 max requests!" */);
|
|
23
26
|
}
|
|
24
27
|
get waitQueueLength() {
|
|
25
28
|
return this.tasks.length;
|
|
@@ -39,4 +42,4 @@ class RateLimiter {
|
|
|
39
42
|
}
|
|
40
43
|
}
|
|
41
44
|
exports.RateLimiter = RateLimiter;
|
|
42
|
-
//# sourceMappingURL=rateLimiter.
|
|
45
|
+
//# sourceMappingURL=rateLimiter.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"rateLimiter.cjs","sourceRoot":"","sources":["../src/rateLimiter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD;;GAEG;AACH,MAAa,WAAW;IAEvB,YAAoB,WAAmB;QAAnB,gBAAW,GAAX,WAAW,CAAQ;QADtB,UAAK,GAAmB,EAAE,CAAC;QAS5C,8CAA8C;QAC9C,0EAA0E;QACvD,YAAO,GAAG,GAAG,EAAE;YACjC,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,KAAK,EAAE,CAAC;YAChC,IAAI,IAAI,KAAK,SAAS,EAAE;gBACvB,OAAO,IAAI,EAAE,CAAC;aACd;YACD,IAAI,CAAC,WAAW,EAAE,CAAC;QACpB,CAAC,CAAC;QAfD,IAAA,mBAAM,EAAC,WAAW,GAAG,CAAC,EAAE,KAAK,CAAC,yDAAyD,CAAC,CAAC;IAC1F,CAAC;IAED,IAAW,eAAe;QACzB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,CAAC;IAC1B,CAAC;IAYS,KAAK,CAAC,OAAO;QACtB,IAAI,IAAI,CAAC,WAAW,GAAG,CAAC,EAAE;YACzB,IAAI,CAAC,WAAW,EAAE,CAAC;YACnB,OAAO;SACP;QAED,OAAO,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,EAAE;YACpC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;QAC1B,CAAC,CAAC,CAAC;IACJ,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAI,IAAsB;QAC9C,MAAM,IAAI,CAAC,OAAO,EAAE,CAAC;QACrB,OAAO,IAAI,EAAE,CAAC,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrC,CAAC;CACD;AAnCD,kCAmCC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { assert } from \"@fluidframework/core-utils\";\n\n/**\n * @alpha\n */\nexport class RateLimiter {\n\tprivate readonly tasks: (() => void)[] = [];\n\tconstructor(private maxRequests: number) {\n\t\tassert(maxRequests > 0, 0x0ae /* \"Tried to create rate limiter with 0 max requests!\" */);\n\t}\n\n\tpublic get waitQueueLength(): number {\n\t\treturn this.tasks.length;\n\t}\n\n\t// Run when one of the tasks finished running.\n\t// Release next task if we have one, or allow more tasks to run in future.\n\tprotected readonly release = () => {\n\t\tconst task = this.tasks.shift();\n\t\tif (task !== undefined) {\n\t\t\treturn task();\n\t\t}\n\t\tthis.maxRequests++;\n\t};\n\n\tprotected async acquire() {\n\t\tif (this.maxRequests > 0) {\n\t\t\tthis.maxRequests--;\n\t\t\treturn;\n\t\t}\n\n\t\treturn new Promise<void>((resolve) => {\n\t\t\tthis.tasks.push(resolve);\n\t\t});\n\t}\n\n\tpublic async schedule<T>(work: () => Promise<T>) {\n\t\tawait this.acquire();\n\t\treturn work().finally(this.release);\n\t}\n}\n"]}
|
package/dist/rateLimiter.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../src/rateLimiter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,qBAAa,WAAW;
|
|
1
|
+
{"version":3,"file":"rateLimiter.d.ts","sourceRoot":"","sources":["../src/rateLimiter.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH;;GAEG;AACH,qBAAa,WAAW;IAEX,OAAO,CAAC,WAAW;IAD/B,OAAO,CAAC,QAAQ,CAAC,KAAK,CAAsB;gBACxB,WAAW,EAAE,MAAM;IAIvC,IAAW,eAAe,IAAI,MAAM,CAEnC;IAID,SAAS,CAAC,QAAQ,CAAC,OAAO,aAMxB;cAEc,OAAO;IAWV,QAAQ,CAAC,CAAC,EAAE,IAAI,EAAE,MAAM,OAAO,CAAC,CAAC,CAAC;CAI/C"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.readAndParse = void 0;
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
|
+
/**
|
|
10
|
+
* Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
|
|
11
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
|
|
12
|
+
* it into object of type `T`.
|
|
13
|
+
*
|
|
14
|
+
* @param storage - The `DocumentStorageService` to read from.
|
|
15
|
+
* @param id - The ID of the blob to read and parse.
|
|
16
|
+
*
|
|
17
|
+
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
18
|
+
*
|
|
19
|
+
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
async function readAndParse(storage, id) {
|
|
23
|
+
const blob = await storage.readBlob(id);
|
|
24
|
+
const decoded = (0, client_utils_1.bufferToString)(blob, "utf8");
|
|
25
|
+
return JSON.parse(decoded);
|
|
26
|
+
}
|
|
27
|
+
exports.readAndParse = readAndParse;
|
|
28
|
+
//# sourceMappingURL=readAndParse.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAndParse.cjs","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAA8D;AAG9D;;;;;;;;;;;;GAYG;AACI,KAAK,UAAU,YAAY,CACjC,OAAkD,EAClD,EAAU;IAEV,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,IAAA,6BAAc,EAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;AACjC,CAAC;AAPD,oCAOC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { bufferToString } from \"@fluid-internal/client-utils\";\nimport { IDocumentStorageService } from \"@fluidframework/driver-definitions\";\n\n/**\n * Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and\n * {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}\n * it into object of type `T`.\n *\n * @param storage - The `DocumentStorageService` to read from.\n * @param id - The ID of the blob to read and parse.\n *\n * @typeParam T - Output type matching JSON format of inpyt blob data.\n *\n * @returns The object that we decoded and parsed via `JSON.parse`.\n * @internal\n */\nexport async function readAndParse<T>(\n\tstorage: Pick<IDocumentStorageService, \"readBlob\">,\n\tid: string,\n): Promise<T> {\n\tconst blob = await storage.readBlob(id);\n\tconst decoded = bufferToString(blob, \"utf8\");\n\treturn JSON.parse(decoded) as T;\n}\n"]}
|
package/dist/readAndParse.d.ts
CHANGED
|
@@ -4,11 +4,17 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentStorageService } from "@fluidframework/driver-definitions";
|
|
6
6
|
/**
|
|
7
|
-
* Read a blob from IDocumentStorageService and
|
|
7
|
+
* Read a blob from {@link @fluidframework/driver-definitions#IDocumentStorageService} and
|
|
8
|
+
* {@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/JSON/parse | JSON.parse}
|
|
9
|
+
* it into object of type `T`.
|
|
8
10
|
*
|
|
9
|
-
* @param storage -
|
|
10
|
-
* @param id -
|
|
11
|
-
*
|
|
11
|
+
* @param storage - The `DocumentStorageService` to read from.
|
|
12
|
+
* @param id - The ID of the blob to read and parse.
|
|
13
|
+
*
|
|
14
|
+
* @typeParam T - Output type matching JSON format of inpyt blob data.
|
|
15
|
+
*
|
|
16
|
+
* @returns The object that we decoded and parsed via `JSON.parse`.
|
|
17
|
+
* @internal
|
|
12
18
|
*/
|
|
13
19
|
export declare function readAndParse<T>(storage: Pick<IDocumentStorageService, "readBlob">, id: string): Promise<T>;
|
|
14
20
|
//# sourceMappingURL=readAndParse.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readAndParse.d.ts","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E
|
|
1
|
+
{"version":3,"file":"readAndParse.d.ts","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAE7E;;;;;;;;;;;;GAYG;AACH,wBAAsB,YAAY,CAAC,CAAC,EACnC,OAAO,EAAE,IAAI,CAAC,uBAAuB,EAAE,UAAU,CAAC,EAClD,EAAE,EAAE,MAAM,GACR,OAAO,CAAC,CAAC,CAAC,CAIZ"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*!
|
|
3
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
4
|
+
* Licensed under the MIT License.
|
|
5
|
+
*/
|
|
6
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
+
exports.calculateMaxWaitTime = exports.runWithRetry = void 0;
|
|
8
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
9
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
10
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
11
|
+
const driver_definitions_1 = require("@fluidframework/driver-definitions");
|
|
12
|
+
const network_1 = require("./network.cjs");
|
|
13
|
+
const packageVersion_1 = require("./packageVersion.cjs");
|
|
14
|
+
/**
|
|
15
|
+
* @internal
|
|
16
|
+
*/
|
|
17
|
+
async function runWithRetry(api, fetchCallName, logger, progress) {
|
|
18
|
+
let result;
|
|
19
|
+
let success = false;
|
|
20
|
+
// We double this value in first try in when we calculate time to wait for in "calculateMaxWaitTime" function.
|
|
21
|
+
let retryAfterMs = 500; // has to be positive!
|
|
22
|
+
let numRetries = 0;
|
|
23
|
+
const startTime = client_utils_1.performance.now();
|
|
24
|
+
let lastError;
|
|
25
|
+
do {
|
|
26
|
+
try {
|
|
27
|
+
result = await api(progress.cancel);
|
|
28
|
+
success = true;
|
|
29
|
+
}
|
|
30
|
+
catch (err) {
|
|
31
|
+
// If it is not retriable, then just throw the error.
|
|
32
|
+
if (!(0, network_1.canRetryOnError)(err)) {
|
|
33
|
+
logger.sendTelemetryEvent({
|
|
34
|
+
eventName: `${fetchCallName}_cancel`,
|
|
35
|
+
retry: numRetries,
|
|
36
|
+
duration: client_utils_1.performance.now() - startTime,
|
|
37
|
+
fetchCallName,
|
|
38
|
+
}, err);
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
if (progress.cancel?.aborted === true) {
|
|
42
|
+
logger.sendTelemetryEvent({
|
|
43
|
+
eventName: `${fetchCallName}_runWithRetryAborted`,
|
|
44
|
+
retry: numRetries,
|
|
45
|
+
duration: client_utils_1.performance.now() - startTime,
|
|
46
|
+
fetchCallName,
|
|
47
|
+
reason: progress.cancel.reason,
|
|
48
|
+
}, err);
|
|
49
|
+
throw new network_1.NonRetryableError("runWithRetry was Aborted", driver_definitions_1.DriverErrorTypes.genericError, {
|
|
50
|
+
driverVersion: packageVersion_1.pkgVersion,
|
|
51
|
+
fetchCallName,
|
|
52
|
+
reason: progress.cancel.reason,
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
// logging the first failed retry instead of every attempt. We want to avoid filling telemetry
|
|
56
|
+
// when we have tight loop of retrying in offline mode, but we also want to know what caused
|
|
57
|
+
// the failure in the first place
|
|
58
|
+
if (numRetries === 0) {
|
|
59
|
+
logger.sendTelemetryEvent({
|
|
60
|
+
eventName: `${fetchCallName}_firstFailed`,
|
|
61
|
+
duration: client_utils_1.performance.now() - startTime,
|
|
62
|
+
fetchCallName,
|
|
63
|
+
}, err);
|
|
64
|
+
}
|
|
65
|
+
numRetries++;
|
|
66
|
+
lastError = err;
|
|
67
|
+
// Wait for the calculated time before retrying.
|
|
68
|
+
retryAfterMs = calculateMaxWaitTime(retryAfterMs, err);
|
|
69
|
+
if (progress.onRetry) {
|
|
70
|
+
progress.onRetry(retryAfterMs, err);
|
|
71
|
+
}
|
|
72
|
+
await (0, core_utils_1.delay)(retryAfterMs);
|
|
73
|
+
}
|
|
74
|
+
} while (!success);
|
|
75
|
+
if (numRetries > 0) {
|
|
76
|
+
logger.sendTelemetryEvent({
|
|
77
|
+
eventName: `${fetchCallName}_lastError`,
|
|
78
|
+
retry: numRetries,
|
|
79
|
+
duration: client_utils_1.performance.now() - startTime,
|
|
80
|
+
fetchCallName,
|
|
81
|
+
}, lastError);
|
|
82
|
+
}
|
|
83
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
84
|
+
return result;
|
|
85
|
+
}
|
|
86
|
+
exports.runWithRetry = runWithRetry;
|
|
87
|
+
const MaxReconnectDelayInMsWhenEndpointIsReachable = 60000;
|
|
88
|
+
const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
|
|
89
|
+
/**
|
|
90
|
+
* Calculates time to wait for after an error based on the error and wait time for previous iteration.
|
|
91
|
+
* In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some
|
|
92
|
+
* transient error not related to endpoint, in that case we want to try at faster pace and hence the
|
|
93
|
+
* max wait is lesser 8s as compared to when endpoint is reachable in which case it is 60s.
|
|
94
|
+
* @param delayMs - wait time for previous iteration
|
|
95
|
+
* @param error - error based on which we decide wait time.
|
|
96
|
+
* @returns Wait time to wait for.
|
|
97
|
+
* @internal
|
|
98
|
+
*/
|
|
99
|
+
function calculateMaxWaitTime(delayMs, error) {
|
|
100
|
+
const retryDelayFromError = (0, network_1.getRetryDelayFromError)(error);
|
|
101
|
+
let newDelayMs = Math.max(retryDelayFromError ?? 0, delayMs * 2);
|
|
102
|
+
newDelayMs = Math.min(delayMs, (0, telemetry_utils_1.isFluidError)(error) && error.getTelemetryProperties().endpointReached === true
|
|
103
|
+
? MaxReconnectDelayInMsWhenEndpointIsReachable
|
|
104
|
+
: MaxReconnectDelayInMsWhenEndpointIsNotReachable);
|
|
105
|
+
return newDelayMs;
|
|
106
|
+
}
|
|
107
|
+
exports.calculateMaxWaitTime = calculateMaxWaitTime;
|
|
108
|
+
//# sourceMappingURL=runWithRetry.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWithRetry.cjs","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"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","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt, isFluidError } from \"@fluidframework/telemetry-utils\";\nimport { performance } from \"@fluid-internal/client-utils\";\nimport { delay } from \"@fluidframework/core-utils\";\nimport { DriverErrorTypes } from \"@fluidframework/driver-definitions\";\nimport { canRetryOnError, getRetryDelayFromError, NonRetryableError } from \"./network\";\nimport { pkgVersion } from \"./packageVersion\";\n\n/**\n * Interface describing an object passed to various network APIs.\n * It allows caller to control cancellation, as well as learn about any delays.\n * @internal\n */\nexport interface IProgress {\n\t/**\n\t * Abort signal used to cancel operation.\n\t *\n\t * @remarks Note that most of the layers do not use this signal yet. We need to change that over time.\n\t * Please consult with API documentation / implementation.\n\t * Note that number of layers may not check this signal while holding this request in a queue,\n\t * so it may take a while it takes effect. This can be improved in the future.\n\t *\n\t * The layers in question are:\n\t *\n\t * - driver (RateLimiter)\n\t *\n\t * - runWithRetry\n\t */\n\tcancel?: AbortSignal;\n\n\t/**\n\t * Called whenever api returns cancellable error and the call is going to be retried.\n\t * Any exception thrown from this call back result in cancellation of operation\n\t * and propagation of thrown exception.\n\t * @param delayInMs - delay before next retry. This value will depend on internal back-off logic,\n\t * as well as information provided by service (like 429 error asking to wait for some time before retry)\n\t * @param error - error object returned from the call.\n\t */\n\tonRetry?(delayInMs: number, error: any): void;\n}\n\n/**\n * @internal\n */\nexport async function runWithRetry<T>(\n\tapi: (cancel?: AbortSignal) => Promise<T>,\n\tfetchCallName: string,\n\tlogger: ITelemetryLoggerExt,\n\tprogress: IProgress,\n): Promise<T> {\n\tlet result: T | undefined;\n\tlet success = false;\n\t// We double this value in first try in when we calculate time to wait for in \"calculateMaxWaitTime\" function.\n\tlet retryAfterMs = 500; // has to be positive!\n\tlet numRetries = 0;\n\tconst startTime = performance.now();\n\tlet lastError: any;\n\tdo {\n\t\ttry {\n\t\t\tresult = await api(progress.cancel);\n\t\t\tsuccess = true;\n\t\t} catch (err) {\n\t\t\t// If it is not retriable, then just throw the error.\n\t\t\tif (!canRetryOnError(err)) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${fetchCallName}_cancel`,\n\t\t\t\t\t\tretry: numRetries,\n\t\t\t\t\t\tduration: performance.now() - startTime,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t},\n\t\t\t\t\terr,\n\t\t\t\t);\n\t\t\t\tthrow err;\n\t\t\t}\n\n\t\t\tif (progress.cancel?.aborted === true) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${fetchCallName}_runWithRetryAborted`,\n\t\t\t\t\t\tretry: numRetries,\n\t\t\t\t\t\tduration: performance.now() - startTime,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t\treason: progress.cancel.reason,\n\t\t\t\t\t},\n\t\t\t\t\terr,\n\t\t\t\t);\n\t\t\t\tthrow new NonRetryableError(\n\t\t\t\t\t\"runWithRetry was Aborted\",\n\t\t\t\t\tDriverErrorTypes.genericError,\n\t\t\t\t\t{\n\t\t\t\t\t\tdriverVersion: pkgVersion,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t\treason: progress.cancel.reason,\n\t\t\t\t\t},\n\t\t\t\t);\n\t\t\t}\n\n\t\t\t// logging the first failed retry instead of every attempt. We want to avoid filling telemetry\n\t\t\t// when we have tight loop of retrying in offline mode, but we also want to know what caused\n\t\t\t// the failure in the first place\n\t\t\tif (numRetries === 0) {\n\t\t\t\tlogger.sendTelemetryEvent(\n\t\t\t\t\t{\n\t\t\t\t\t\teventName: `${fetchCallName}_firstFailed`,\n\t\t\t\t\t\tduration: performance.now() - startTime,\n\t\t\t\t\t\tfetchCallName,\n\t\t\t\t\t},\n\t\t\t\t\terr,\n\t\t\t\t);\n\t\t\t}\n\n\t\t\tnumRetries++;\n\t\t\tlastError = err;\n\t\t\t// Wait for the calculated time before retrying.\n\t\t\tretryAfterMs = calculateMaxWaitTime(retryAfterMs, err);\n\t\t\tif (progress.onRetry) {\n\t\t\t\tprogress.onRetry(retryAfterMs, err);\n\t\t\t}\n\t\t\tawait delay(retryAfterMs);\n\t\t}\n\t} while (!success);\n\tif (numRetries > 0) {\n\t\tlogger.sendTelemetryEvent(\n\t\t\t{\n\t\t\t\teventName: `${fetchCallName}_lastError`,\n\t\t\t\tretry: numRetries,\n\t\t\t\tduration: performance.now() - startTime,\n\t\t\t\tfetchCallName,\n\t\t\t},\n\t\t\tlastError,\n\t\t);\n\t}\n\t// eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n\treturn result!;\n}\n\nconst MaxReconnectDelayInMsWhenEndpointIsReachable = 60000;\nconst MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;\n\n/**\n * Calculates time to wait for after an error based on the error and wait time for previous iteration.\n * In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some\n * transient error not related to endpoint, in that case we want to try at faster pace and hence the\n * max wait is lesser 8s as compared to when endpoint is reachable in which case it is 60s.\n * @param delayMs - wait time for previous iteration\n * @param error - error based on which we decide wait time.\n * @returns Wait time to wait for.\n * @internal\n */\nexport function calculateMaxWaitTime(delayMs: number, error: unknown): number {\n\tconst retryDelayFromError = getRetryDelayFromError(error);\n\tlet newDelayMs = Math.max(retryDelayFromError ?? 0, delayMs * 2);\n\tnewDelayMs = Math.min(\n\t\tdelayMs,\n\t\tisFluidError(error) && error.getTelemetryProperties().endpointReached === true\n\t\t\t? MaxReconnectDelayInMsWhenEndpointIsReachable\n\t\t\t: MaxReconnectDelayInMsWhenEndpointIsNotReachable,\n\t);\n\treturn newDelayMs;\n}\n"]}
|
package/dist/runWithRetry.d.ts
CHANGED
|
@@ -2,21 +2,26 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
6
|
/**
|
|
7
7
|
* Interface describing an object passed to various network APIs.
|
|
8
8
|
* It allows caller to control cancellation, as well as learn about any delays.
|
|
9
|
+
* @internal
|
|
9
10
|
*/
|
|
10
11
|
export interface IProgress {
|
|
11
12
|
/**
|
|
12
|
-
* Abort signal used to cancel operation
|
|
13
|
-
*
|
|
13
|
+
* Abort signal used to cancel operation.
|
|
14
|
+
*
|
|
15
|
+
* @remarks Note that most of the layers do not use this signal yet. We need to change that over time.
|
|
14
16
|
* Please consult with API documentation / implementation.
|
|
15
17
|
* Note that number of layers may not check this signal while holding this request in a queue,
|
|
16
18
|
* so it may take a while it takes effect. This can be improved in the future.
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
*
|
|
19
|
+
*
|
|
20
|
+
* The layers in question are:
|
|
21
|
+
*
|
|
22
|
+
* - driver (RateLimiter)
|
|
23
|
+
*
|
|
24
|
+
* - runWithRetry
|
|
20
25
|
*/
|
|
21
26
|
cancel?: AbortSignal;
|
|
22
27
|
/**
|
|
@@ -29,5 +34,19 @@ export interface IProgress {
|
|
|
29
34
|
*/
|
|
30
35
|
onRetry?(delayInMs: number, error: any): void;
|
|
31
36
|
}
|
|
32
|
-
|
|
37
|
+
/**
|
|
38
|
+
* @internal
|
|
39
|
+
*/
|
|
40
|
+
export declare function runWithRetry<T>(api: (cancel?: AbortSignal) => Promise<T>, fetchCallName: string, logger: ITelemetryLoggerExt, progress: IProgress): Promise<T>;
|
|
41
|
+
/**
|
|
42
|
+
* Calculates time to wait for after an error based on the error and wait time for previous iteration.
|
|
43
|
+
* In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some
|
|
44
|
+
* transient error not related to endpoint, in that case we want to try at faster pace and hence the
|
|
45
|
+
* max wait is lesser 8s as compared to when endpoint is reachable in which case it is 60s.
|
|
46
|
+
* @param delayMs - wait time for previous iteration
|
|
47
|
+
* @param error - error based on which we decide wait time.
|
|
48
|
+
* @returns Wait time to wait for.
|
|
49
|
+
* @internal
|
|
50
|
+
*/
|
|
51
|
+
export declare function calculateMaxWaitTime(delayMs: number, error: unknown): number;
|
|
33
52
|
//# sourceMappingURL=runWithRetry.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"runWithRetry.d.ts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,mBAAmB,EAAgB,MAAM,iCAAiC,CAAC;AAOpF;;;;GAIG;AACH,MAAM,WAAW,SAAS;IACzB;;;;;;;;;;;;;OAaG;IACH,MAAM,CAAC,EAAE,WAAW,CAAC;IAErB;;;;;;;OAOG;IACH,OAAO,CAAC,CAAC,SAAS,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,GAAG,IAAI,CAAC;CAC9C;AAED;;GAEG;AACH,wBAAsB,YAAY,CAAC,CAAC,EACnC,GAAG,EAAE,CAAC,MAAM,CAAC,EAAE,WAAW,KAAK,OAAO,CAAC,CAAC,CAAC,EACzC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,SAAS,GACjB,OAAO,CAAC,CAAC,CAAC,CAsFZ;AAKD;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,GAAG,MAAM,CAU5E"}
|
|
@@ -4,39 +4,40 @@
|
|
|
4
4
|
* Licensed under the MIT License.
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.getQuorumValuesFromProtocolSummary = exports.getDocAttributesFromProtocolSummary = exports.
|
|
7
|
+
exports.getQuorumValuesFromProtocolSummary = exports.getDocAttributesFromProtocolSummary = exports.isCombinedAppAndProtocolSummary = void 0;
|
|
8
8
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
* @
|
|
10
|
+
* Validates the current layout of an .app + .protocol summary tree
|
|
11
|
+
* this is used internally for create new, and single commit summary
|
|
12
|
+
* @internal
|
|
13
13
|
*/
|
|
14
|
-
function
|
|
15
|
-
|
|
16
|
-
type
|
|
17
|
-
tree
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
14
|
+
function isCombinedAppAndProtocolSummary(summary, ...optionalRootTrees) {
|
|
15
|
+
if (summary?.tree === undefined ||
|
|
16
|
+
summary.tree?.[".app"]?.type !== protocol_definitions_1.SummaryType.Tree ||
|
|
17
|
+
summary.tree?.[".protocol"]?.type !== protocol_definitions_1.SummaryType.Tree) {
|
|
18
|
+
return false;
|
|
19
|
+
}
|
|
20
|
+
const treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));
|
|
21
|
+
if (treeKeys.length !== 2) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
return true;
|
|
23
25
|
}
|
|
24
|
-
exports.
|
|
26
|
+
exports.isCombinedAppAndProtocolSummary = isCombinedAppAndProtocolSummary;
|
|
25
27
|
/**
|
|
26
28
|
* Extract the attributes from the protocol summary.
|
|
27
29
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
30
|
+
* @internal
|
|
28
31
|
*/
|
|
29
32
|
function getDocAttributesFromProtocolSummary(protocolSummary) {
|
|
30
|
-
var _a;
|
|
31
33
|
const attributesBlob = protocolSummary.tree.attributes;
|
|
32
|
-
|
|
33
|
-
documentAttributes.term = (_a = documentAttributes.term) !== null && _a !== void 0 ? _a : 1;
|
|
34
|
-
return documentAttributes;
|
|
34
|
+
return JSON.parse(attributesBlob.content);
|
|
35
35
|
}
|
|
36
36
|
exports.getDocAttributesFromProtocolSummary = getDocAttributesFromProtocolSummary;
|
|
37
37
|
/**
|
|
38
38
|
* Extract quorum values from the protocol summary.
|
|
39
39
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
40
|
+
* @internal
|
|
40
41
|
*/
|
|
41
42
|
function getQuorumValuesFromProtocolSummary(protocolSummary) {
|
|
42
43
|
const quorumValuesBlob = protocolSummary.tree.quorumValues;
|
|
@@ -44,4 +45,4 @@ function getQuorumValuesFromProtocolSummary(protocolSummary) {
|
|
|
44
45
|
return quorumValues;
|
|
45
46
|
}
|
|
46
47
|
exports.getQuorumValuesFromProtocolSummary = getQuorumValuesFromProtocolSummary;
|
|
47
|
-
//# sourceMappingURL=summaryForCreateNew.
|
|
48
|
+
//# sourceMappingURL=summaryForCreateNew.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.cjs","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+EAM8C;AAc9C;;;;GAIG;AACH,SAAgB,+BAA+B,CAC9C,OAAiC,EACjC,GAAG,iBAA2B;IAE9B,IACC,OAAO,EAAE,IAAI,KAAK,SAAS;QAC3B,OAAO,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,EAAE,IAAI,KAAK,kCAAW,CAAC,IAAI;QACjD,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,KAAK,kCAAW,CAAC,IAAI,EACrD;QACD,OAAO,KAAK,CAAC;KACb;IACD,MAAM,QAAQ,GAAG,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,iBAAiB,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;IACzF,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE;QAC1B,OAAO,KAAK,CAAC;KACb;IACD,OAAO,IAAI,CAAC;AACb,CAAC;AAhBD,0EAgBC;AAED;;;;GAIG;AACH,SAAgB,mCAAmC,CAClD,eAA6B;IAE7B,MAAM,cAAc,GAAG,eAAe,CAAC,IAAI,CAAC,UAA0B,CAAC;IACvE,OAAO,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,OAAiB,CAAwB,CAAC;AAC5E,CAAC;AALD,kFAKC;AAED;;;;GAIG;AACH,SAAgB,kCAAkC,CACjD,eAA6B;IAE7B,MAAM,gBAAgB,GAAG,eAAe,CAAC,IAAI,CAAC,YAA4B,CAAC;IAC3E,MAAM,YAAY,GAAG,IAAI,CAAC,KAAK,CAAC,gBAAgB,CAAC,OAAiB,CAG/D,CAAC;IACJ,OAAO,YAAY,CAAC;AACrB,CAAC;AATD,gFASC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tISummaryTree,\n\tSummaryType,\n\tISummaryBlob,\n\tICommittedProposal,\n\tIDocumentAttributes,\n} from \"@fluidframework/protocol-definitions\";\n\n/**\n * Defines the current layout of an .app + .protocol summary tree\n * this is used internally for create new, and single commit summary\n * @internal\n */\nexport interface CombinedAppAndProtocolSummary extends ISummaryTree {\n\ttree: {\n\t\t[\".app\"]: ISummaryTree;\n\t\t[\".protocol\"]: ISummaryTree;\n\t};\n}\n\n/**\n * Validates the current layout of an .app + .protocol summary tree\n * this is used internally for create new, and single commit summary\n * @internal\n */\nexport function isCombinedAppAndProtocolSummary(\n\tsummary: ISummaryTree | undefined,\n\t...optionalRootTrees: string[]\n): summary is CombinedAppAndProtocolSummary {\n\tif (\n\t\tsummary?.tree === undefined ||\n\t\tsummary.tree?.[\".app\"]?.type !== SummaryType.Tree ||\n\t\tsummary.tree?.[\".protocol\"]?.type !== SummaryType.Tree\n\t) {\n\t\treturn false;\n\t}\n\tconst treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));\n\tif (treeKeys.length !== 2) {\n\t\treturn false;\n\t}\n\treturn true;\n}\n\n/**\n * Extract the attributes from the protocol summary.\n * @param protocolSummary - protocol summary from which the values are to be extracted.\n * @internal\n */\nexport function getDocAttributesFromProtocolSummary(\n\tprotocolSummary: ISummaryTree,\n): IDocumentAttributes {\n\tconst attributesBlob = protocolSummary.tree.attributes as ISummaryBlob;\n\treturn JSON.parse(attributesBlob.content as string) as IDocumentAttributes;\n}\n\n/**\n * Extract quorum values from the protocol summary.\n * @param protocolSummary - protocol summary from which the values are to be extracted.\n * @internal\n */\nexport function getQuorumValuesFromProtocolSummary(\n\tprotocolSummary: ISummaryTree,\n): [string, ICommittedProposal][] {\n\tconst quorumValuesBlob = protocolSummary.tree.quorumValues as ISummaryBlob;\n\tconst quorumValues = JSON.parse(quorumValuesBlob.content as string) as [\n\t\tstring,\n\t\tICommittedProposal,\n\t][];\n\treturn quorumValues;\n}\n"]}
|
|
@@ -4,19 +4,32 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ISummaryTree, ICommittedProposal, IDocumentAttributes } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
7
|
+
* Defines the current layout of an .app + .protocol summary tree
|
|
8
|
+
* this is used internally for create new, and single commit summary
|
|
9
|
+
* @internal
|
|
10
10
|
*/
|
|
11
|
-
export
|
|
11
|
+
export interface CombinedAppAndProtocolSummary extends ISummaryTree {
|
|
12
|
+
tree: {
|
|
13
|
+
[".app"]: ISummaryTree;
|
|
14
|
+
[".protocol"]: ISummaryTree;
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
/**
|
|
18
|
+
* Validates the current layout of an .app + .protocol summary tree
|
|
19
|
+
* this is used internally for create new, and single commit summary
|
|
20
|
+
* @internal
|
|
21
|
+
*/
|
|
22
|
+
export declare function isCombinedAppAndProtocolSummary(summary: ISummaryTree | undefined, ...optionalRootTrees: string[]): summary is CombinedAppAndProtocolSummary;
|
|
12
23
|
/**
|
|
13
24
|
* Extract the attributes from the protocol summary.
|
|
14
25
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
26
|
+
* @internal
|
|
15
27
|
*/
|
|
16
28
|
export declare function getDocAttributesFromProtocolSummary(protocolSummary: ISummaryTree): IDocumentAttributes;
|
|
17
29
|
/**
|
|
18
30
|
* Extract quorum values from the protocol summary.
|
|
19
31
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
32
|
+
* @internal
|
|
20
33
|
*/
|
|
21
34
|
export declare function getQuorumValuesFromProtocolSummary(protocolSummary: ISummaryTree): [string, ICommittedProposal][];
|
|
22
35
|
//# sourceMappingURL=summaryForCreateNew.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"summaryForCreateNew.d.ts","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.d.ts","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EAGZ,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,sCAAsC,CAAC;AAE9C;;;;GAIG;AACH,MAAM,WAAW,6BAA8B,SAAQ,YAAY;IAClE,IAAI,EAAE;QACL,CAAC,MAAM,CAAC,EAAE,YAAY,CAAC;QACvB,CAAC,WAAW,CAAC,EAAE,YAAY,CAAC;KAC5B,CAAC;CACF;AAED;;;;GAIG;AACH,wBAAgB,+BAA+B,CAC9C,OAAO,EAAE,YAAY,GAAG,SAAS,EACjC,GAAG,iBAAiB,EAAE,MAAM,EAAE,GAC5B,OAAO,IAAI,6BAA6B,CAa1C;AAED;;;;GAIG;AACH,wBAAgB,mCAAmC,CAClD,eAAe,EAAE,YAAY,GAC3B,mBAAmB,CAGrB;AAED;;;;GAIG;AACH,wBAAgB,kCAAkC,CACjD,eAAe,EAAE,YAAY,GAC3B,CAAC,MAAM,EAAE,kBAAkB,CAAC,EAAE,CAOhC"}
|
|
@@ -5,29 +5,27 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.convertSummaryTreeToSnapshotITree = void 0;
|
|
8
|
-
const
|
|
9
|
-
const
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
9
|
+
const core_utils_1 = require("@fluidframework/core-utils");
|
|
10
10
|
const protocol_definitions_1 = require("@fluidframework/protocol-definitions");
|
|
11
|
+
const blob_1 = require("./blob.cjs");
|
|
12
|
+
const summaryForCreateNew_1 = require("./summaryForCreateNew.cjs");
|
|
11
13
|
/**
|
|
12
14
|
* Converts ISummaryTree to ITree format.
|
|
13
15
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
16
|
+
* @internal
|
|
14
17
|
*/
|
|
15
18
|
function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
16
19
|
const entries = [];
|
|
17
|
-
const
|
|
18
|
-
const
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
20
|
-
const adaptSumaryTree = protocolSummary && appSummary;
|
|
21
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
22
|
-
const allSummaryEntries = adaptSumaryTree
|
|
20
|
+
const adaptSummaryTree = (0, summaryForCreateNew_1.isCombinedAppAndProtocolSummary)(summaryTree);
|
|
21
|
+
const allSummaryEntries = adaptSummaryTree
|
|
23
22
|
? [
|
|
24
|
-
...Object.entries(
|
|
25
|
-
...Object.entries(
|
|
23
|
+
...Object.entries(summaryTree.tree[".protocol"].tree),
|
|
24
|
+
...Object.entries(summaryTree.tree[".app"].tree),
|
|
26
25
|
]
|
|
27
26
|
: Object.entries(summaryTree.tree);
|
|
28
27
|
for (const [key, value] of allSummaryEntries) {
|
|
29
|
-
|
|
30
|
-
const k = adaptSumaryTree && ["attributes"].includes(key) ? `.${key}` : key;
|
|
28
|
+
const k = adaptSummaryTree && key === "attributes" ? ".attributes" : key;
|
|
31
29
|
switch (value.type) {
|
|
32
30
|
case protocol_definitions_1.SummaryType.Blob: {
|
|
33
31
|
let parsedContent;
|
|
@@ -36,25 +34,25 @@ function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
|
36
34
|
parsedContent = value.content;
|
|
37
35
|
}
|
|
38
36
|
else {
|
|
39
|
-
parsedContent = (0,
|
|
37
|
+
parsedContent = (0, client_utils_1.Uint8ArrayToString)(value.content, "base64");
|
|
40
38
|
encoding = "base64";
|
|
41
39
|
}
|
|
42
|
-
entries.push(new
|
|
40
|
+
entries.push(new blob_1.BlobTreeEntry(k, parsedContent, encoding));
|
|
43
41
|
break;
|
|
44
42
|
}
|
|
45
43
|
case protocol_definitions_1.SummaryType.Tree: {
|
|
46
|
-
entries.push(new
|
|
44
|
+
entries.push(new blob_1.TreeTreeEntry(k, convertSummaryTreeToSnapshotITree(value)));
|
|
47
45
|
break;
|
|
48
46
|
}
|
|
49
47
|
case protocol_definitions_1.SummaryType.Attachment: {
|
|
50
|
-
entries.push(new
|
|
48
|
+
entries.push(new blob_1.AttachmentTreeEntry(k, value.id));
|
|
51
49
|
break;
|
|
52
50
|
}
|
|
53
51
|
case protocol_definitions_1.SummaryType.Handle: {
|
|
54
52
|
throw new Error("Should not have Handle type in summary tree");
|
|
55
53
|
}
|
|
56
54
|
default:
|
|
57
|
-
(0,
|
|
55
|
+
(0, core_utils_1.unreachableCase)(value, "Unexpected summary tree type");
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
58
|
return {
|
|
@@ -63,4 +61,4 @@ function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
|
63
61
|
};
|
|
64
62
|
}
|
|
65
63
|
exports.convertSummaryTreeToSnapshotITree = convertSummaryTreeToSnapshotITree;
|
|
66
|
-
//# sourceMappingURL=treeConversions.
|
|
64
|
+
//# sourceMappingURL=treeConversions.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeConversions.cjs","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAkE;AAClE,2DAA6D;AAC7D,+EAAoG;AACpG,qCAA2E;AAC3E,mEAAwE;AAExE;;;;GAIG;AACH,SAAgB,iCAAiC,CAAC,WAAyB;IAC1E,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,IAAA,qDAA+B,EAAC,WAAW,CAAC,CAAC;IACtE,MAAM,iBAAiB,GAAG,gBAAgB;QACzC,CAAC,CAAC;YACA,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;YACrD,GAAG,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC;SAC/C;QACH,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;IAEpC,KAAK,MAAM,CAAC,GAAG,EAAE,KAAK,CAAC,IAAI,iBAAiB,EAAE;QAC7C,MAAM,CAAC,GAAG,gBAAgB,IAAI,GAAG,KAAK,YAAY,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,GAAG,CAAC;QACzE,QAAQ,KAAK,CAAC,IAAI,EAAE;YACnB,KAAK,kCAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,IAAI,aAAqB,CAAC;gBAC1B,IAAI,QAAQ,GAAuB,OAAO,CAAC;gBAC3C,IAAI,OAAO,KAAK,CAAC,OAAO,KAAK,QAAQ,EAAE;oBACtC,aAAa,GAAG,KAAK,CAAC,OAAO,CAAC;iBAC9B;qBAAM;oBACN,aAAa,GAAG,IAAA,iCAAkB,EAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAC5D,QAAQ,GAAG,QAAQ,CAAC;iBACpB;gBACD,OAAO,CAAC,IAAI,CAAC,IAAI,oBAAa,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;gBAC5D,MAAM;aACN;YAED,KAAK,kCAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,OAAO,CAAC,IAAI,CAAC,IAAI,oBAAa,CAAC,CAAC,EAAE,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC7E,MAAM;aACN;YAED,KAAK,kCAAW,CAAC,UAAU,CAAC,CAAC;gBAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,0BAAmB,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnD,MAAM;aACN;YAED,KAAK,kCAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAC/D;YAED;gBACC,IAAA,4BAAe,EAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;SACxD;KACD;IACD,OAAO;QACN,OAAO;QACP,YAAY,EAAE,WAAW,CAAC,YAAY;KACtC,CAAC;AACH,CAAC;AAhDD,8EAgDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString } from \"@fluid-internal/client-utils\";\nimport { unreachableCase } from \"@fluidframework/core-utils\";\nimport { ISummaryTree, ITree, ITreeEntry, SummaryType } from \"@fluidframework/protocol-definitions\";\nimport { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from \"./blob\";\nimport { isCombinedAppAndProtocolSummary } from \"./summaryForCreateNew\";\n\n/**\n * Converts ISummaryTree to ITree format.\n * @param summaryTree - summary tree in ISummaryTree format\n * @internal\n */\nexport function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree {\n\tconst entries: ITreeEntry[] = [];\n\tconst adaptSummaryTree = isCombinedAppAndProtocolSummary(summaryTree);\n\tconst allSummaryEntries = adaptSummaryTree\n\t\t? [\n\t\t\t\t...Object.entries(summaryTree.tree[\".protocol\"].tree),\n\t\t\t\t...Object.entries(summaryTree.tree[\".app\"].tree),\n\t\t ]\n\t\t: Object.entries(summaryTree.tree);\n\n\tfor (const [key, value] of allSummaryEntries) {\n\t\tconst k = adaptSummaryTree && key === \"attributes\" ? \".attributes\" : key;\n\t\tswitch (value.type) {\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\tlet parsedContent: string;\n\t\t\t\tlet encoding: \"utf-8\" | \"base64\" = \"utf-8\";\n\t\t\t\tif (typeof value.content === \"string\") {\n\t\t\t\t\tparsedContent = value.content;\n\t\t\t\t} else {\n\t\t\t\t\tparsedContent = Uint8ArrayToString(value.content, \"base64\");\n\t\t\t\t\tencoding = \"base64\";\n\t\t\t\t}\n\t\t\t\tentries.push(new BlobTreeEntry(k, parsedContent, encoding));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\tentries.push(new TreeTreeEntry(k, convertSummaryTreeToSnapshotITree(value)));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\tentries.push(new AttachmentTreeEntry(k, value.id));\n\t\t\t\tbreak;\n\t\t\t}\n\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tthrow new Error(\"Should not have Handle type in summary tree\");\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tunreachableCase(value, \"Unexpected summary tree type\");\n\t\t}\n\t}\n\treturn {\n\t\tentries,\n\t\tunreferenced: summaryTree.unreferenced,\n\t};\n}\n"]}
|
|
@@ -6,6 +6,7 @@ import { ISummaryTree, ITree } from "@fluidframework/protocol-definitions";
|
|
|
6
6
|
/**
|
|
7
7
|
* Converts ISummaryTree to ITree format.
|
|
8
8
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
9
|
+
* @internal
|
|
9
10
|
*/
|
|
10
11
|
export declare function convertSummaryTreeToSnapshotITree(summaryTree: ISummaryTree): ITree;
|
|
11
12
|
//# sourceMappingURL=treeConversions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"treeConversions.d.ts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"treeConversions.d.ts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,EAAE,YAAY,EAAE,KAAK,EAA2B,MAAM,sCAAsC,CAAC;AAIpG;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAgDlF"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// This file is read by tools that parse documentation comments conforming to the TSDoc standard.
|
|
2
|
+
// It should be published with your NPM package. It should not be tracked by Git.
|
|
3
|
+
{
|
|
4
|
+
"tsdocVersion": "0.12",
|
|
5
|
+
"toolPackages": [
|
|
6
|
+
{
|
|
7
|
+
"packageName": "@microsoft/api-extractor",
|
|
8
|
+
"packageVersion": "7.38.3"
|
|
9
|
+
}
|
|
10
|
+
]
|
|
11
|
+
}
|