@fluidframework/driver-utils 1.4.0-121020 → 2.0.0-dev-rc.1.0.0.225277
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-esm.json +4 -0
- 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} +2 -1
- 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} +6 -3
- 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} +2 -1
- 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} +70 -21
- 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} +2 -2
- package/lib/packageVersion.d.mts.map +1 -0
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{parallelRequests.d.ts → parallelRequests.d.mts} +20 -7
- 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} +6 -8
- 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} +4 -1
- 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} +27 -8
- 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} +18 -5
- 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} +2 -1
- 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 +86 -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.d.ts.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
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { bufferToString } from "@fluid-internal/client-utils";
|
|
6
|
+
/**
|
|
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`.
|
|
10
|
+
*
|
|
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
|
|
18
|
+
*/
|
|
19
|
+
export async function readAndParse(storage, id) {
|
|
20
|
+
const blob = await storage.readBlob(id);
|
|
21
|
+
const decoded = bufferToString(blob, "utf8");
|
|
22
|
+
return JSON.parse(decoded);
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=readAndParse.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"readAndParse.mjs","sourceRoot":"","sources":["../src/readAndParse.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,cAAc,EAAE,MAAM,8BAA8B;AAG7D;;;;;;;;;;;;GAYG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,OAAkD,EAClD,EAAU;IAEV,MAAM,IAAI,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IACxC,MAAM,OAAO,GAAG,cAAc,CAAC,IAAI,EAAE,MAAM,CAAC,CAAC;IAC7C,OAAO,IAAI,CAAC,KAAK,CAAC,OAAO,CAAM,CAAC;AACjC,CAAC","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"]}
|
|
@@ -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
|
-
|
|
33
|
-
|
|
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;
|
|
52
|
+
//# sourceMappingURL=runWithRetry.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWithRetry.d.mts","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAgB,MAAM,iCAAiC;AAOnF;;;;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"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { isFluidError } from "@fluidframework/telemetry-utils";
|
|
6
|
+
import { performance } from "@fluid-internal/client-utils";
|
|
7
|
+
import { delay } from "@fluidframework/core-utils";
|
|
8
|
+
import { DriverErrorTypes } from "@fluidframework/driver-definitions";
|
|
9
|
+
import { canRetryOnError, getRetryDelayFromError, NonRetryableError } from "./network.mjs";
|
|
10
|
+
import { pkgVersion } from "./packageVersion.mjs";
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
14
|
+
export async function runWithRetry(api, fetchCallName, logger, progress) {
|
|
15
|
+
let result;
|
|
16
|
+
let success = false;
|
|
17
|
+
// We double this value in first try in when we calculate time to wait for in "calculateMaxWaitTime" function.
|
|
18
|
+
let retryAfterMs = 500; // has to be positive!
|
|
19
|
+
let numRetries = 0;
|
|
20
|
+
const startTime = performance.now();
|
|
21
|
+
let lastError;
|
|
22
|
+
do {
|
|
23
|
+
try {
|
|
24
|
+
result = await api(progress.cancel);
|
|
25
|
+
success = true;
|
|
26
|
+
}
|
|
27
|
+
catch (err) {
|
|
28
|
+
// If it is not retriable, then just throw the error.
|
|
29
|
+
if (!canRetryOnError(err)) {
|
|
30
|
+
logger.sendTelemetryEvent({
|
|
31
|
+
eventName: `${fetchCallName}_cancel`,
|
|
32
|
+
retry: numRetries,
|
|
33
|
+
duration: performance.now() - startTime,
|
|
34
|
+
fetchCallName,
|
|
35
|
+
}, err);
|
|
36
|
+
throw err;
|
|
37
|
+
}
|
|
38
|
+
if (progress.cancel?.aborted === true) {
|
|
39
|
+
logger.sendTelemetryEvent({
|
|
40
|
+
eventName: `${fetchCallName}_runWithRetryAborted`,
|
|
41
|
+
retry: numRetries,
|
|
42
|
+
duration: performance.now() - startTime,
|
|
43
|
+
fetchCallName,
|
|
44
|
+
reason: progress.cancel.reason,
|
|
45
|
+
}, err);
|
|
46
|
+
throw new NonRetryableError("runWithRetry was Aborted", DriverErrorTypes.genericError, {
|
|
47
|
+
driverVersion: pkgVersion,
|
|
48
|
+
fetchCallName,
|
|
49
|
+
reason: progress.cancel.reason,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
// logging the first failed retry instead of every attempt. We want to avoid filling telemetry
|
|
53
|
+
// when we have tight loop of retrying in offline mode, but we also want to know what caused
|
|
54
|
+
// the failure in the first place
|
|
55
|
+
if (numRetries === 0) {
|
|
56
|
+
logger.sendTelemetryEvent({
|
|
57
|
+
eventName: `${fetchCallName}_firstFailed`,
|
|
58
|
+
duration: performance.now() - startTime,
|
|
59
|
+
fetchCallName,
|
|
60
|
+
}, err);
|
|
61
|
+
}
|
|
62
|
+
numRetries++;
|
|
63
|
+
lastError = err;
|
|
64
|
+
// Wait for the calculated time before retrying.
|
|
65
|
+
retryAfterMs = calculateMaxWaitTime(retryAfterMs, err);
|
|
66
|
+
if (progress.onRetry) {
|
|
67
|
+
progress.onRetry(retryAfterMs, err);
|
|
68
|
+
}
|
|
69
|
+
await delay(retryAfterMs);
|
|
70
|
+
}
|
|
71
|
+
} while (!success);
|
|
72
|
+
if (numRetries > 0) {
|
|
73
|
+
logger.sendTelemetryEvent({
|
|
74
|
+
eventName: `${fetchCallName}_lastError`,
|
|
75
|
+
retry: numRetries,
|
|
76
|
+
duration: performance.now() - startTime,
|
|
77
|
+
fetchCallName,
|
|
78
|
+
}, lastError);
|
|
79
|
+
}
|
|
80
|
+
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
81
|
+
return result;
|
|
82
|
+
}
|
|
83
|
+
const MaxReconnectDelayInMsWhenEndpointIsReachable = 60000;
|
|
84
|
+
const MaxReconnectDelayInMsWhenEndpointIsNotReachable = 8000;
|
|
85
|
+
/**
|
|
86
|
+
* Calculates time to wait for after an error based on the error and wait time for previous iteration.
|
|
87
|
+
* In case endpoint(service or socket) is not reachable, then we maybe offline or may have got some
|
|
88
|
+
* transient error not related to endpoint, in that case we want to try at faster pace and hence the
|
|
89
|
+
* max wait is lesser 8s as compared to when endpoint is reachable in which case it is 60s.
|
|
90
|
+
* @param delayMs - wait time for previous iteration
|
|
91
|
+
* @param error - error based on which we decide wait time.
|
|
92
|
+
* @returns Wait time to wait for.
|
|
93
|
+
* @internal
|
|
94
|
+
*/
|
|
95
|
+
export function calculateMaxWaitTime(delayMs, error) {
|
|
96
|
+
const retryDelayFromError = getRetryDelayFromError(error);
|
|
97
|
+
let newDelayMs = Math.max(retryDelayFromError ?? 0, delayMs * 2);
|
|
98
|
+
newDelayMs = Math.min(delayMs, isFluidError(error) && error.getTelemetryProperties().endpointReached === true
|
|
99
|
+
? MaxReconnectDelayInMsWhenEndpointIsReachable
|
|
100
|
+
: MaxReconnectDelayInMsWhenEndpointIsNotReachable);
|
|
101
|
+
return newDelayMs;
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=runWithRetry.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runWithRetry.mjs","sourceRoot":"","sources":["../src/runWithRetry.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAuB,YAAY,EAAE,MAAM,iCAAiC;OAC5E,EAAE,WAAW,EAAE,MAAM,8BAA8B;OACnD,EAAE,KAAK,EAAE,MAAM,4BAA4B;OAC3C,EAAE,gBAAgB,EAAE,MAAM,oCAAoC;OAC9D,EAAE,eAAe,EAAE,sBAAsB,EAAE,iBAAiB,EAAE;OAC9D,EAAE,UAAU,EAAE;AAmCrB;;GAEG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CACjC,GAAyC,EACzC,aAAqB,EACrB,MAA2B,EAC3B,QAAmB;IAEnB,IAAI,MAAqB,CAAC;IAC1B,IAAI,OAAO,GAAG,KAAK,CAAC;IACpB,8GAA8G;IAC9G,IAAI,YAAY,GAAG,GAAG,CAAC,CAAC,sBAAsB;IAC9C,IAAI,UAAU,GAAG,CAAC,CAAC;IACnB,MAAM,SAAS,GAAG,WAAW,CAAC,GAAG,EAAE,CAAC;IACpC,IAAI,SAAc,CAAC;IACnB,GAAG;QACF,IAAI;YACH,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;YACpC,OAAO,GAAG,IAAI,CAAC;SACf;QAAC,OAAO,GAAG,EAAE;YACb,qDAAqD;YACrD,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,EAAE;gBAC1B,MAAM,CAAC,kBAAkB,CACxB;oBACC,SAAS,EAAE,GAAG,aAAa,SAAS;oBACpC,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;oBACvC,aAAa;iBACb,EACD,GAAG,CACH,CAAC;gBACF,MAAM,GAAG,CAAC;aACV;YAED,IAAI,QAAQ,CAAC,MAAM,EAAE,OAAO,KAAK,IAAI,EAAE;gBACtC,MAAM,CAAC,kBAAkB,CACxB;oBACC,SAAS,EAAE,GAAG,aAAa,sBAAsB;oBACjD,KAAK,EAAE,UAAU;oBACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;oBACvC,aAAa;oBACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;iBAC9B,EACD,GAAG,CACH,CAAC;gBACF,MAAM,IAAI,iBAAiB,CAC1B,0BAA0B,EAC1B,gBAAgB,CAAC,YAAY,EAC7B;oBACC,aAAa,EAAE,UAAU;oBACzB,aAAa;oBACb,MAAM,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM;iBAC9B,CACD,CAAC;aACF;YAED,8FAA8F;YAC9F,4FAA4F;YAC5F,iCAAiC;YACjC,IAAI,UAAU,KAAK,CAAC,EAAE;gBACrB,MAAM,CAAC,kBAAkB,CACxB;oBACC,SAAS,EAAE,GAAG,aAAa,cAAc;oBACzC,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;oBACvC,aAAa;iBACb,EACD,GAAG,CACH,CAAC;aACF;YAED,UAAU,EAAE,CAAC;YACb,SAAS,GAAG,GAAG,CAAC;YAChB,gDAAgD;YAChD,YAAY,GAAG,oBAAoB,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;YACvD,IAAI,QAAQ,CAAC,OAAO,EAAE;gBACrB,QAAQ,CAAC,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC;aACpC;YACD,MAAM,KAAK,CAAC,YAAY,CAAC,CAAC;SAC1B;KACD,QAAQ,CAAC,OAAO,EAAE;IACnB,IAAI,UAAU,GAAG,CAAC,EAAE;QACnB,MAAM,CAAC,kBAAkB,CACxB;YACC,SAAS,EAAE,GAAG,aAAa,YAAY;YACvC,KAAK,EAAE,UAAU;YACjB,QAAQ,EAAE,WAAW,CAAC,GAAG,EAAE,GAAG,SAAS;YACvC,aAAa;SACb,EACD,SAAS,CACT,CAAC;KACF;IACD,oEAAoE;IACpE,OAAO,MAAO,CAAC;AAChB,CAAC;AAED,MAAM,4CAA4C,GAAG,KAAK,CAAC;AAC3D,MAAM,+CAA+C,GAAG,IAAI,CAAC;AAE7D;;;;;;;;;GASG;AACH,MAAM,UAAU,oBAAoB,CAAC,OAAe,EAAE,KAAc;IACnE,MAAM,mBAAmB,GAAG,sBAAsB,CAAC,KAAK,CAAC,CAAC;IAC1D,IAAI,UAAU,GAAG,IAAI,CAAC,GAAG,CAAC,mBAAmB,IAAI,CAAC,EAAE,OAAO,GAAG,CAAC,CAAC,CAAC;IACjE,UAAU,GAAG,IAAI,CAAC,GAAG,CACpB,OAAO,EACP,YAAY,CAAC,KAAK,CAAC,IAAI,KAAK,CAAC,sBAAsB,EAAE,CAAC,eAAe,KAAK,IAAI;QAC7E,CAAC,CAAC,4CAA4C;QAC9C,CAAC,CAAC,+CAA+C,CAClD,CAAC;IACF,OAAO,UAAU,CAAC;AACnB,CAAC","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"]}
|
|
@@ -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
|
-
//# sourceMappingURL=summaryForCreateNew.d.
|
|
35
|
+
//# sourceMappingURL=summaryForCreateNew.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.d.mts","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EACN,YAAY,EAGZ,kBAAkB,EAClB,mBAAmB,EACnB,MAAM,sCAAsC;AAE7C;;;;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"}
|
|
@@ -4,38 +4,39 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
6
6
|
/**
|
|
7
|
-
*
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
7
|
+
* Validates 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 function
|
|
12
|
-
|
|
13
|
-
type
|
|
14
|
-
tree
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
11
|
+
export function isCombinedAppAndProtocolSummary(summary, ...optionalRootTrees) {
|
|
12
|
+
if (summary?.tree === undefined ||
|
|
13
|
+
summary.tree?.[".app"]?.type !== SummaryType.Tree ||
|
|
14
|
+
summary.tree?.[".protocol"]?.type !== SummaryType.Tree) {
|
|
15
|
+
return false;
|
|
16
|
+
}
|
|
17
|
+
const treeKeys = Object.keys(summary.tree).filter((t) => !optionalRootTrees.includes(t));
|
|
18
|
+
if (treeKeys.length !== 2) {
|
|
19
|
+
return false;
|
|
20
|
+
}
|
|
21
|
+
return true;
|
|
20
22
|
}
|
|
21
23
|
/**
|
|
22
24
|
* Extract the attributes from the protocol summary.
|
|
23
25
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
26
|
+
* @internal
|
|
24
27
|
*/
|
|
25
28
|
export function getDocAttributesFromProtocolSummary(protocolSummary) {
|
|
26
|
-
var _a;
|
|
27
29
|
const attributesBlob = protocolSummary.tree.attributes;
|
|
28
|
-
|
|
29
|
-
documentAttributes.term = (_a = documentAttributes.term) !== null && _a !== void 0 ? _a : 1;
|
|
30
|
-
return documentAttributes;
|
|
30
|
+
return JSON.parse(attributesBlob.content);
|
|
31
31
|
}
|
|
32
32
|
/**
|
|
33
33
|
* Extract quorum values from the protocol summary.
|
|
34
34
|
* @param protocolSummary - protocol summary from which the values are to be extracted.
|
|
35
|
+
* @internal
|
|
35
36
|
*/
|
|
36
37
|
export function getQuorumValuesFromProtocolSummary(protocolSummary) {
|
|
37
38
|
const quorumValuesBlob = protocolSummary.tree.quorumValues;
|
|
38
39
|
const quorumValues = JSON.parse(quorumValuesBlob.content);
|
|
39
40
|
return quorumValues;
|
|
40
41
|
}
|
|
41
|
-
//# sourceMappingURL=summaryForCreateNew.
|
|
42
|
+
//# sourceMappingURL=summaryForCreateNew.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summaryForCreateNew.mjs","sourceRoot":"","sources":["../src/summaryForCreateNew.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAEN,WAAW,GAIX,MAAM,sCAAsC;AAc7C;;;;GAIG;AACH,MAAM,UAAU,+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,WAAW,CAAC,IAAI;QACjD,OAAO,CAAC,IAAI,EAAE,CAAC,WAAW,CAAC,EAAE,IAAI,KAAK,WAAW,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;AAED;;;;GAIG;AACH,MAAM,UAAU,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;AAED;;;;GAIG;AACH,MAAM,UAAU,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","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"]}
|
|
@@ -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
|
-
//# sourceMappingURL=treeConversions.d.
|
|
12
|
+
//# sourceMappingURL=treeConversions.d.mts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeConversions.d.mts","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAII,EAAE,YAAY,EAAE,KAAK,EAA2B,MAAM,sCAAsC;AAInG;;;;GAIG;AACH,wBAAgB,iCAAiC,CAAC,WAAW,EAAE,YAAY,GAAG,KAAK,CAgDlF"}
|
|
@@ -2,29 +2,27 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { Uint8ArrayToString
|
|
6
|
-
import {
|
|
7
|
-
import { SummaryType
|
|
5
|
+
import { Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
6
|
+
import { unreachableCase } from "@fluidframework/core-utils";
|
|
7
|
+
import { SummaryType } from "@fluidframework/protocol-definitions";
|
|
8
|
+
import { AttachmentTreeEntry, BlobTreeEntry, TreeTreeEntry } from "./blob.mjs";
|
|
9
|
+
import { isCombinedAppAndProtocolSummary } from "./summaryForCreateNew.mjs";
|
|
8
10
|
/**
|
|
9
11
|
* Converts ISummaryTree to ITree format.
|
|
10
12
|
* @param summaryTree - summary tree in ISummaryTree format
|
|
13
|
+
* @internal
|
|
11
14
|
*/
|
|
12
15
|
export function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
13
16
|
const entries = [];
|
|
14
|
-
const
|
|
15
|
-
const
|
|
16
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
17
|
-
const adaptSumaryTree = protocolSummary && appSummary;
|
|
18
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
19
|
-
const allSummaryEntries = adaptSumaryTree
|
|
17
|
+
const adaptSummaryTree = isCombinedAppAndProtocolSummary(summaryTree);
|
|
18
|
+
const allSummaryEntries = adaptSummaryTree
|
|
20
19
|
? [
|
|
21
|
-
...Object.entries(
|
|
22
|
-
...Object.entries(
|
|
20
|
+
...Object.entries(summaryTree.tree[".protocol"].tree),
|
|
21
|
+
...Object.entries(summaryTree.tree[".app"].tree),
|
|
23
22
|
]
|
|
24
23
|
: Object.entries(summaryTree.tree);
|
|
25
24
|
for (const [key, value] of allSummaryEntries) {
|
|
26
|
-
|
|
27
|
-
const k = adaptSumaryTree && ["attributes"].includes(key) ? `.${key}` : key;
|
|
25
|
+
const k = adaptSummaryTree && key === "attributes" ? ".attributes" : key;
|
|
28
26
|
switch (value.type) {
|
|
29
27
|
case SummaryType.Blob: {
|
|
30
28
|
let parsedContent;
|
|
@@ -59,4 +57,4 @@ export function convertSummaryTreeToSnapshotITree(summaryTree) {
|
|
|
59
57
|
unreferenced: summaryTree.unreferenced,
|
|
60
58
|
};
|
|
61
59
|
}
|
|
62
|
-
//# sourceMappingURL=treeConversions.
|
|
60
|
+
//# sourceMappingURL=treeConversions.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeConversions.mjs","sourceRoot":"","sources":["../src/treeConversions.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,kBAAkB,EAAE,MAAM,8BAA8B;OAC1D,EAAE,eAAe,EAAE,MAAM,4BAA4B;OACrD,EAAmC,WAAW,EAAE,MAAM,sCAAsC;OAC5F,EAAE,mBAAmB,EAAE,aAAa,EAAE,aAAa,EAAE;OACrD,EAAE,+BAA+B,EAAE;AAE1C;;;;GAIG;AACH,MAAM,UAAU,iCAAiC,CAAC,WAAyB;IAC1E,MAAM,OAAO,GAAiB,EAAE,CAAC;IACjC,MAAM,gBAAgB,GAAG,+BAA+B,CAAC,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,WAAW,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,kBAAkB,CAAC,KAAK,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;oBAC5D,QAAQ,GAAG,QAAQ,CAAC;iBACpB;gBACD,OAAO,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,aAAa,EAAE,QAAQ,CAAC,CAAC,CAAC;gBAC5D,MAAM;aACN;YAED,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;gBACtB,OAAO,CAAC,IAAI,CAAC,IAAI,aAAa,CAAC,CAAC,EAAE,iCAAiC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;gBAC7E,MAAM;aACN;YAED,KAAK,WAAW,CAAC,UAAU,CAAC,CAAC;gBAC5B,OAAO,CAAC,IAAI,CAAC,IAAI,mBAAmB,CAAC,CAAC,EAAE,KAAK,CAAC,EAAE,CAAC,CAAC,CAAC;gBACnD,MAAM;aACN;YAED,KAAK,WAAW,CAAC,MAAM,CAAC,CAAC;gBACxB,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;aAC/D;YAED;gBACC,eAAe,CAAC,KAAK,EAAE,8BAA8B,CAAC,CAAC;SACxD;KACD;IACD,OAAO;QACN,OAAO;QACP,YAAY,EAAE,WAAW,CAAC,YAAY;KACtC,CAAC;AACH,CAAC","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"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fluidframework/driver-utils",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "2.0.0-dev-rc.1.0.0.225277",
|
|
4
4
|
"description": "Collection of utility functions for Fluid drivers",
|
|
5
5
|
"homepage": "https://fluidframework.com",
|
|
6
6
|
"repository": {
|
|
@@ -11,44 +11,20 @@
|
|
|
11
11
|
"license": "MIT",
|
|
12
12
|
"author": "Microsoft and contributors",
|
|
13
13
|
"sideEffects": false,
|
|
14
|
-
"main": "dist/index.
|
|
15
|
-
"module": "lib/index.
|
|
14
|
+
"main": "dist/index.cjs",
|
|
15
|
+
"module": "lib/index.mjs",
|
|
16
16
|
"types": "dist/index.d.ts",
|
|
17
|
-
"
|
|
18
|
-
"build": "npm run build:genver && concurrently npm:build:compile npm:lint && npm run build:docs",
|
|
19
|
-
"build:commonjs": "npm run tsc && npm run typetests:gen && npm run build:test",
|
|
20
|
-
"build:compile": "concurrently npm:build:commonjs npm:build:esnext",
|
|
21
|
-
"build:docs": "api-extractor run --local --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/doc-models/* ../../../_api-extractor-temp/",
|
|
22
|
-
"build:esnext": "tsc --project ./tsconfig.esnext.json",
|
|
23
|
-
"build:full": "npm run build",
|
|
24
|
-
"build:full:compile": "npm run build:compile",
|
|
25
|
-
"build:genver": "gen-version",
|
|
26
|
-
"build:test": "tsc --project ./src/test/tsconfig.json",
|
|
27
|
-
"ci:build:docs": "api-extractor run --typescript-compiler-folder ../../../node_modules/typescript && copyfiles -u 1 ./_api-extractor-temp/* ../../../_api-extractor-temp/",
|
|
28
|
-
"clean": "rimraf dist lib *.tsbuildinfo *.build.log",
|
|
29
|
-
"eslint": "eslint --format stylish src",
|
|
30
|
-
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
31
|
-
"lint": "npm run eslint",
|
|
32
|
-
"lint:fix": "npm run eslint:fix",
|
|
33
|
-
"test": "npm run test:mocha",
|
|
34
|
-
"test:coverage": "nyc npm test -- --reporter xunit --reporter-option output=nyc/junit-report.xml",
|
|
35
|
-
"test:mocha": "mocha --ignore 'dist/test/types/*' --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup --unhandled-rejections=strict",
|
|
36
|
-
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
37
|
-
"tsc": "tsc",
|
|
38
|
-
"typetests:gen": "flub generate typetests --generate --dir . --no-generateInName",
|
|
39
|
-
"typetests:prepare": "flub generate typetests --prepare --dir . --pin"
|
|
40
|
-
},
|
|
41
|
-
"nyc": {
|
|
17
|
+
"c8": {
|
|
42
18
|
"all": true,
|
|
43
19
|
"cache-dir": "nyc/.cache",
|
|
44
20
|
"exclude": [
|
|
45
|
-
"src/test
|
|
46
|
-
"dist/test
|
|
21
|
+
"src/test/**/*.*ts",
|
|
22
|
+
"dist/test/**/*.*js"
|
|
47
23
|
],
|
|
48
24
|
"exclude-after-remap": false,
|
|
49
25
|
"include": [
|
|
50
|
-
"src
|
|
51
|
-
"dist
|
|
26
|
+
"src/**/*.*ts",
|
|
27
|
+
"dist/**/*.*js"
|
|
52
28
|
],
|
|
53
29
|
"report-dir": "nyc/report",
|
|
54
30
|
"reporter": [
|
|
@@ -59,42 +35,88 @@
|
|
|
59
35
|
"temp-directory": "nyc/.nyc_output"
|
|
60
36
|
},
|
|
61
37
|
"dependencies": {
|
|
62
|
-
"@
|
|
63
|
-
"@fluidframework/
|
|
64
|
-
"@fluidframework/core-
|
|
65
|
-
"@fluidframework/driver-definitions": "1.
|
|
66
|
-
"@fluidframework/gitresources": "^0.
|
|
67
|
-
"@fluidframework/protocol-base": "^0.
|
|
68
|
-
"@fluidframework/protocol-definitions": "^
|
|
69
|
-
"@fluidframework/telemetry-utils": "1.
|
|
70
|
-
"axios": "^
|
|
71
|
-
"
|
|
38
|
+
"@fluid-internal/client-utils": "2.0.0-dev-rc.1.0.0.225277",
|
|
39
|
+
"@fluidframework/core-interfaces": "2.0.0-dev-rc.1.0.0.225277",
|
|
40
|
+
"@fluidframework/core-utils": "2.0.0-dev-rc.1.0.0.225277",
|
|
41
|
+
"@fluidframework/driver-definitions": "2.0.0-dev-rc.1.0.0.225277",
|
|
42
|
+
"@fluidframework/gitresources": "^3.0.0-223236",
|
|
43
|
+
"@fluidframework/protocol-base": "^3.0.0-223236",
|
|
44
|
+
"@fluidframework/protocol-definitions": "^3.1.0-223007",
|
|
45
|
+
"@fluidframework/telemetry-utils": "2.0.0-dev-rc.1.0.0.225277",
|
|
46
|
+
"axios": "^1.6.2",
|
|
47
|
+
"lz4js": "^0.2.0",
|
|
48
|
+
"url": "^0.11.0",
|
|
49
|
+
"uuid": "^9.0.0"
|
|
72
50
|
},
|
|
73
51
|
"devDependencies": {
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"@fluidframework/
|
|
77
|
-
"@fluidframework/
|
|
78
|
-
"@fluidframework/
|
|
79
|
-
"@fluidframework/
|
|
80
|
-
"@
|
|
81
|
-
"@
|
|
52
|
+
"@arethetypeswrong/cli": "^0.13.3",
|
|
53
|
+
"@fluid-tools/build-cli": "0.29.0-222379",
|
|
54
|
+
"@fluidframework/build-common": "^2.0.3",
|
|
55
|
+
"@fluidframework/build-tools": "0.29.0-222379",
|
|
56
|
+
"@fluidframework/driver-utils-previous": "npm:@fluidframework/driver-utils@2.0.0-internal.8.0.0",
|
|
57
|
+
"@fluidframework/eslint-config-fluid": "^3.1.0",
|
|
58
|
+
"@fluidframework/mocha-test-setup": "2.0.0-dev-rc.1.0.0.225277",
|
|
59
|
+
"@microsoft/api-extractor": "^7.38.3",
|
|
82
60
|
"@types/mocha": "^9.1.1",
|
|
83
|
-
"@types/node": "^
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
"
|
|
92
|
-
"
|
|
61
|
+
"@types/node": "^18.19.0",
|
|
62
|
+
"@types/sinon": "^7.0.13",
|
|
63
|
+
"c8": "^8.0.1",
|
|
64
|
+
"copyfiles": "^2.4.1",
|
|
65
|
+
"cross-env": "^7.0.3",
|
|
66
|
+
"eslint": "~8.50.0",
|
|
67
|
+
"mocha": "^10.2.0",
|
|
68
|
+
"mocha-json-output-reporter": "^2.0.1",
|
|
69
|
+
"mocha-multi-reporters": "^1.5.1",
|
|
70
|
+
"moment": "^2.21.0",
|
|
71
|
+
"prettier": "~3.0.3",
|
|
72
|
+
"rimraf": "^4.4.0",
|
|
73
|
+
"sinon": "^7.4.2",
|
|
74
|
+
"tsc-multi": "^1.1.0",
|
|
75
|
+
"typescript": "~5.1.6"
|
|
76
|
+
},
|
|
77
|
+
"fluidBuild": {
|
|
78
|
+
"tasks": {
|
|
79
|
+
"build:docs": {
|
|
80
|
+
"dependsOn": [
|
|
81
|
+
"...",
|
|
82
|
+
"api-extractor:commonjs",
|
|
83
|
+
"api-extractor:esnext"
|
|
84
|
+
],
|
|
85
|
+
"script": false
|
|
86
|
+
}
|
|
87
|
+
}
|
|
93
88
|
},
|
|
94
89
|
"typeValidation": {
|
|
95
|
-
"version": "1.4.0",
|
|
96
|
-
"baselineRange": "~1.3.0",
|
|
97
|
-
"baselineVersion": "1.3.1",
|
|
98
90
|
"broken": {}
|
|
91
|
+
},
|
|
92
|
+
"scripts": {
|
|
93
|
+
"api": "fluid-build . --task api",
|
|
94
|
+
"api-extractor:commonjs": "api-extractor run --local",
|
|
95
|
+
"api-extractor:esnext": "api-extractor run --config ./api-extractor-esm.json",
|
|
96
|
+
"build": "fluid-build . --task build",
|
|
97
|
+
"build:commonjs": "fluid-build . --task commonjs",
|
|
98
|
+
"build:compile": "fluid-build . --task compile",
|
|
99
|
+
"build:docs": "fluid-build . --task api",
|
|
100
|
+
"build:esnext": "tsc-multi --config ../../../common/build/build-common/tsc-multi.esm.json",
|
|
101
|
+
"build:genver": "gen-version",
|
|
102
|
+
"build:test": "tsc-multi --config ./tsc-multi.test.json",
|
|
103
|
+
"check:are-the-types-wrong": "attw --pack",
|
|
104
|
+
"check:release-tags": "api-extractor run --local --config ./api-extractor-lint.json",
|
|
105
|
+
"ci:build:docs": "api-extractor run",
|
|
106
|
+
"clean": "rimraf --glob dist lib \"**/*.tsbuildinfo\" \"**/*.build.log\" _api-extractor-temp nyc",
|
|
107
|
+
"eslint": "eslint --format stylish src",
|
|
108
|
+
"eslint:fix": "eslint --format stylish src --fix --fix-type problem,suggestion,layout",
|
|
109
|
+
"format": "npm run prettier:fix",
|
|
110
|
+
"lint": "npm run prettier && npm run check:release-tags && npm run eslint",
|
|
111
|
+
"lint:fix": "npm run prettier:fix && npm run eslint:fix",
|
|
112
|
+
"prettier": "prettier --check . --cache --ignore-path ../../../.prettierignore",
|
|
113
|
+
"prettier:fix": "prettier --write . --cache --ignore-path ../../../.prettierignore",
|
|
114
|
+
"test": "npm run test:mocha",
|
|
115
|
+
"test:coverage": "c8 npm test",
|
|
116
|
+
"test:mocha": "mocha --ignore \"dist/test/types/*\" --recursive dist/test -r node_modules/@fluidframework/mocha-test-setup",
|
|
117
|
+
"test:mocha:verbose": "cross-env FLUID_TEST_VERBOSE=1 npm run test:mocha",
|
|
118
|
+
"tsc": "tsc-multi --config ../../../common/build/build-common/tsc-multi.cjs.json",
|
|
119
|
+
"typetests:gen": "fluid-type-test-generator",
|
|
120
|
+
"typetests:prepare": "flub typetests --dir . --reset --previous --normalize"
|
|
99
121
|
}
|
|
100
|
-
}
|
|
122
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* @public
|
|
8
|
+
*/
|
|
9
|
+
export enum SummaryCompressionAlgorithm {
|
|
10
|
+
None = 0,
|
|
11
|
+
LZ4 = 1,
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @public
|
|
16
|
+
*/
|
|
17
|
+
export interface ICompressionStorageConfig {
|
|
18
|
+
algorithm: SummaryCompressionAlgorithm;
|
|
19
|
+
minSizeToCompress: number;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export const DefaultCompressionStorageConfig = {
|
|
23
|
+
algorithm: SummaryCompressionAlgorithm.LZ4,
|
|
24
|
+
minSizeToCompress: 500,
|
|
25
|
+
};
|