@fluidframework/driver-utils 2.0.0-rc.1.0.4 → 2.0.0-rc.2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/{.eslintrc.js → .eslintrc.cjs} +5 -2
- package/{.mocharc.js → .mocharc.cjs} +1 -1
- package/CHANGELOG.md +32 -0
- package/{api-extractor-esm.json → api-extractor-cjs.json} +5 -1
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/driver-utils.api.md +22 -18
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceCompressionAdapter.js +8 -4
- package/dist/adapters/compression/documentServiceCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js +7 -7
- package/dist/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/index.d.ts +3 -3
- package/dist/adapters/compression/index.d.ts.map +1 -1
- package/dist/adapters/compression/index.js +7 -7
- package/dist/adapters/compression/index.js.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts +2 -2
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js +11 -11
- package/dist/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -1
- package/dist/adapters/compression/summaryblob/index.d.ts +1 -1
- package/dist/adapters/compression/summaryblob/index.d.ts.map +1 -1
- package/dist/adapters/compression/summaryblob/index.js +3 -3
- package/dist/adapters/compression/summaryblob/index.js.map +1 -1
- package/dist/adapters/index.d.ts +2 -2
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/index.js +6 -6
- package/dist/adapters/index.js.map +1 -1
- package/dist/adapters/predefinedAdapters.d.ts +1 -1
- package/dist/adapters/predefinedAdapters.d.ts.map +1 -1
- package/dist/adapters/predefinedAdapters.js +4 -4
- package/dist/adapters/predefinedAdapters.js.map +1 -1
- package/dist/documentServiceProxy.d.ts +3 -2
- package/dist/documentServiceProxy.d.ts.map +1 -1
- package/dist/documentServiceProxy.js +3 -1
- package/dist/documentServiceProxy.js.map +1 -1
- package/dist/documentStorageServiceProxy.d.ts +2 -2
- package/dist/documentStorageServiceProxy.d.ts.map +1 -1
- package/dist/documentStorageServiceProxy.js +7 -3
- package/dist/documentStorageServiceProxy.js.map +1 -1
- package/dist/driver-utils-alpha.d.ts +6 -2
- package/dist/driver-utils-beta.d.ts +10 -2
- package/dist/driver-utils-public.d.ts +10 -2
- package/dist/driver-utils-untrimmed.d.ts +30 -17
- package/dist/error.d.ts +2 -2
- package/dist/error.d.ts.map +1 -1
- package/dist/error.js +1 -3
- package/dist/error.js.map +1 -1
- package/dist/index.d.ts +17 -16
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +64 -62
- package/dist/index.js.map +1 -1
- package/dist/insecureUrlResolver.d.ts +3 -2
- package/dist/insecureUrlResolver.d.ts.map +1 -1
- package/dist/insecureUrlResolver.js +9 -7
- package/dist/insecureUrlResolver.js.map +1 -1
- package/dist/network.d.ts +13 -10
- package/dist/network.d.ts.map +1 -1
- package/dist/network.js +9 -12
- package/dist/network.js.map +1 -1
- package/dist/networkUtils.d.ts +2 -3
- package/dist/networkUtils.d.ts.map +1 -1
- package/dist/networkUtils.js +3 -3
- package/dist/networkUtils.js.map +1 -1
- package/dist/package.json +3 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.js +1 -1
- package/dist/packageVersion.js.map +1 -1
- package/dist/parallelRequests.d.ts +3 -3
- package/dist/parallelRequests.d.ts.map +1 -1
- package/dist/parallelRequests.js +10 -10
- package/dist/parallelRequests.js.map +1 -1
- package/dist/prefetchDocumentStorageService.d.ts +1 -1
- package/dist/prefetchDocumentStorageService.d.ts.map +1 -1
- package/dist/prefetchDocumentStorageService.js +4 -4
- package/dist/prefetchDocumentStorageService.js.map +1 -1
- package/dist/runWithRetry.js +6 -6
- package/dist/runWithRetry.js.map +1 -1
- package/dist/storageUtils.d.ts +13 -0
- package/dist/storageUtils.d.ts.map +1 -0
- package/dist/storageUtils.js +17 -0
- package/dist/storageUtils.js.map +1 -0
- package/dist/treeConversions.d.ts.map +1 -1
- package/dist/treeConversions.js +7 -6
- package/dist/treeConversions.js.map +1 -1
- package/dist/tsdoc-metadata.json +1 -1
- package/lib/adapters/compression/{compressionTypes.d.mts → compressionTypes.d.ts} +1 -1
- package/lib/adapters/compression/compressionTypes.d.ts.map +1 -0
- package/lib/adapters/compression/{compressionTypes.mjs → compressionTypes.js} +1 -1
- package/lib/adapters/compression/compressionTypes.js.map +1 -0
- package/lib/adapters/compression/{documentServiceCompressionAdapter.d.mts → documentServiceCompressionAdapter.d.ts} +3 -3
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.ts.map +1 -0
- package/lib/adapters/compression/{documentServiceCompressionAdapter.mjs → documentServiceCompressionAdapter.js} +7 -3
- package/lib/adapters/compression/documentServiceCompressionAdapter.js.map +1 -0
- package/lib/adapters/compression/{documentServiceFactoryCompressionAdapter.d.mts → documentServiceFactoryCompressionAdapter.d.ts} +3 -3
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.ts.map +1 -0
- package/lib/adapters/compression/{documentServiceFactoryCompressionAdapter.mjs → documentServiceFactoryCompressionAdapter.js} +4 -4
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.js.map +1 -0
- package/lib/adapters/compression/{index.d.mts → index.d.ts} +4 -4
- package/lib/adapters/compression/index.d.ts.map +1 -0
- package/lib/adapters/compression/{index.mjs → index.js} +4 -4
- package/lib/adapters/compression/index.js.map +1 -0
- package/lib/adapters/compression/summaryblob/{documentStorageServiceSummaryBlobCompressionAdapter.d.mts → documentStorageServiceSummaryBlobCompressionAdapter.d.ts} +3 -3
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.ts.map +1 -0
- package/lib/adapters/compression/summaryblob/{documentStorageServiceSummaryBlobCompressionAdapter.mjs → documentStorageServiceSummaryBlobCompressionAdapter.js} +3 -3
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.js.map +1 -0
- package/lib/adapters/compression/summaryblob/{index.mjs → index.d.ts} +2 -2
- package/lib/adapters/compression/summaryblob/index.d.ts.map +1 -0
- package/lib/adapters/compression/summaryblob/{index.d.mts → index.js} +2 -2
- package/lib/adapters/compression/summaryblob/index.js.map +1 -0
- package/lib/adapters/{index.d.mts → index.d.ts} +3 -3
- package/lib/adapters/index.d.ts.map +1 -0
- package/lib/adapters/{index.mjs → index.js} +3 -3
- package/lib/adapters/index.js.map +1 -0
- package/lib/adapters/{predefinedAdapters.d.mts → predefinedAdapters.d.ts} +2 -2
- package/lib/adapters/predefinedAdapters.d.ts.map +1 -0
- package/lib/adapters/{predefinedAdapters.mjs → predefinedAdapters.js} +2 -2
- package/lib/adapters/predefinedAdapters.js.map +1 -0
- package/lib/{blob.d.mts → blob.d.ts} +1 -1
- package/lib/blob.d.ts.map +1 -0
- package/lib/{blob.mjs → blob.js} +1 -1
- package/lib/blob.js.map +1 -0
- package/lib/{buildSnapshotTree.d.mts → buildSnapshotTree.d.ts} +1 -1
- package/lib/buildSnapshotTree.d.ts.map +1 -0
- package/lib/{buildSnapshotTree.mjs → buildSnapshotTree.js} +1 -1
- package/lib/buildSnapshotTree.js.map +1 -0
- package/lib/{documentServiceFactoryProxy.d.mts → documentServiceFactoryProxy.d.ts} +1 -1
- package/lib/documentServiceFactoryProxy.d.ts.map +1 -0
- package/lib/{documentServiceFactoryProxy.mjs → documentServiceFactoryProxy.js} +1 -1
- package/lib/documentServiceFactoryProxy.js.map +1 -0
- package/lib/{documentServiceProxy.d.mts → documentServiceProxy.d.ts} +4 -3
- package/lib/documentServiceProxy.d.ts.map +1 -0
- package/lib/{documentServiceProxy.mjs → documentServiceProxy.js} +4 -2
- package/lib/documentServiceProxy.js.map +1 -0
- package/lib/{documentStorageServiceProxy.d.mts → documentStorageServiceProxy.d.ts} +3 -3
- package/lib/documentStorageServiceProxy.d.ts.map +1 -0
- package/lib/{documentStorageServiceProxy.mjs → documentStorageServiceProxy.js} +8 -4
- package/lib/documentStorageServiceProxy.js.map +1 -0
- package/lib/{driver-utils-alpha.d.mts → driver-utils-alpha.d.ts} +6 -2
- package/lib/{driver-utils-public.d.mts → driver-utils-beta.d.ts} +10 -2
- package/lib/{driver-utils-beta.d.mts → driver-utils-public.d.ts} +10 -2
- package/lib/{driver-utils-untrimmed.d.mts → driver-utils-untrimmed.d.ts} +30 -17
- package/lib/{error.d.mts → error.d.ts} +3 -3
- package/lib/error.d.ts.map +1 -0
- package/lib/{error.mjs → error.js} +3 -4
- package/lib/error.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +18 -17
- package/lib/index.d.ts.map +1 -0
- package/lib/{index.mjs → index.js} +18 -17
- package/lib/index.js.map +1 -0
- package/lib/{insecureUrlResolver.d.mts → insecureUrlResolver.d.ts} +4 -3
- package/lib/insecureUrlResolver.d.ts.map +1 -0
- package/lib/{insecureUrlResolver.mjs → insecureUrlResolver.js} +10 -8
- package/lib/insecureUrlResolver.js.map +1 -0
- package/lib/{messageRecognition.d.mts → messageRecognition.d.ts} +5 -1
- package/lib/messageRecognition.d.ts.map +1 -0
- package/lib/{messageRecognition.mjs → messageRecognition.js} +5 -1
- package/lib/messageRecognition.js.map +1 -0
- package/lib/{network.d.mts → network.d.ts} +14 -11
- package/lib/network.d.ts.map +1 -0
- package/lib/{network.mjs → network.js} +11 -16
- package/lib/network.js.map +1 -0
- package/lib/networkUtils.d.ts +10 -0
- package/lib/networkUtils.d.ts.map +1 -0
- package/lib/{networkUtils.mjs → networkUtils.js} +2 -2
- package/lib/networkUtils.js.map +1 -0
- package/lib/{packageVersion.d.mts → packageVersion.d.ts} +2 -2
- package/lib/packageVersion.d.ts.map +1 -0
- package/lib/{packageVersion.mjs → packageVersion.js} +2 -2
- package/lib/packageVersion.js.map +1 -0
- package/lib/{parallelRequests.d.mts → parallelRequests.d.ts} +4 -4
- package/lib/parallelRequests.d.ts.map +1 -0
- package/lib/{parallelRequests.mjs → parallelRequests.js} +10 -5
- package/lib/parallelRequests.js.map +1 -0
- package/lib/{prefetchDocumentStorageService.d.mts → prefetchDocumentStorageService.d.ts} +6 -2
- package/lib/prefetchDocumentStorageService.d.ts.map +1 -0
- package/lib/{prefetchDocumentStorageService.mjs → prefetchDocumentStorageService.js} +7 -3
- package/lib/prefetchDocumentStorageService.js.map +1 -0
- package/lib/{rateLimiter.d.mts → rateLimiter.d.ts} +1 -1
- package/lib/rateLimiter.d.ts.map +1 -0
- package/lib/{rateLimiter.mjs → rateLimiter.js} +1 -1
- package/lib/rateLimiter.js.map +1 -0
- package/lib/{readAndParse.d.mts → readAndParse.d.ts} +1 -1
- package/lib/readAndParse.d.ts.map +1 -0
- package/lib/{readAndParse.mjs → readAndParse.js} +1 -1
- package/lib/readAndParse.js.map +1 -0
- package/lib/{runWithRetry.d.mts → runWithRetry.d.ts} +1 -1
- package/lib/runWithRetry.d.ts.map +1 -0
- package/lib/{runWithRetry.mjs → runWithRetry.js} +3 -3
- package/lib/runWithRetry.js.map +1 -0
- package/lib/storageUtils.d.ts +13 -0
- package/lib/storageUtils.d.ts.map +1 -0
- package/lib/storageUtils.js +13 -0
- package/lib/storageUtils.js.map +1 -0
- package/lib/{summaryForCreateNew.d.mts → summaryForCreateNew.d.ts} +1 -1
- package/lib/summaryForCreateNew.d.ts.map +1 -0
- package/lib/{summaryForCreateNew.mjs → summaryForCreateNew.js} +1 -1
- package/lib/summaryForCreateNew.js.map +1 -0
- package/lib/test/insecureUrlResolverTest.spec.js +101 -0
- package/lib/test/insecureUrlResolverTest.spec.js.map +1 -0
- package/lib/test/parallelRequests.spec.js +186 -0
- package/lib/test/parallelRequests.spec.js.map +1 -0
- package/lib/test/rateLimiter.spec.js +85 -0
- package/lib/test/rateLimiter.spec.js.map +1 -0
- package/lib/test/runWithRetry.spec.js +180 -0
- package/lib/test/runWithRetry.spec.js.map +1 -0
- package/lib/test/summaryCompressionData.js +170 -0
- package/lib/test/summaryCompressionData.js.map +1 -0
- package/lib/test/summaryCompresssionTester.spec.js +429 -0
- package/lib/test/summaryCompresssionTester.spec.js.map +1 -0
- package/lib/test/types/validateDriverUtilsPrevious.generated.js +108 -0
- package/lib/test/types/validateDriverUtilsPrevious.generated.js.map +1 -0
- package/lib/{treeConversions.d.mts → treeConversions.d.ts} +1 -1
- package/lib/treeConversions.d.ts.map +1 -0
- package/lib/{treeConversions.mjs → treeConversions.js} +4 -3
- package/lib/treeConversions.js.map +1 -0
- package/package.json +82 -28
- package/src/adapters/compression/documentServiceCompressionAdapter.ts +9 -3
- package/src/adapters/compression/documentServiceFactoryCompressionAdapter.ts +4 -4
- package/src/adapters/compression/index.ts +3 -3
- package/src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts +2 -2
- package/src/adapters/compression/summaryblob/index.ts +1 -1
- package/src/adapters/index.ts +2 -2
- package/src/adapters/predefinedAdapters.ts +1 -1
- package/src/documentServiceProxy.ts +9 -2
- package/src/documentStorageServiceProxy.ts +12 -4
- package/src/error.ts +2 -4
- package/src/index.ts +17 -16
- package/src/insecureUrlResolver.ts +8 -6
- package/src/network.ts +11 -16
- package/src/networkUtils.ts +3 -4
- package/src/packageVersion.ts +1 -1
- package/src/parallelRequests.ts +11 -11
- package/src/prefetchDocumentStorageService.ts +2 -2
- package/src/runWithRetry.ts +2 -2
- package/src/storageUtils.ts +18 -0
- package/src/treeConversions.ts +3 -2
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/lib/adapters/compression/compressionTypes.d.mts.map +0 -1
- package/lib/adapters/compression/compressionTypes.mjs.map +0 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.d.mts.map +0 -1
- package/lib/adapters/compression/documentServiceCompressionAdapter.mjs.map +0 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.d.mts.map +0 -1
- package/lib/adapters/compression/documentServiceFactoryCompressionAdapter.mjs.map +0 -1
- package/lib/adapters/compression/index.d.mts.map +0 -1
- package/lib/adapters/compression/index.mjs.map +0 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.d.mts.map +0 -1
- package/lib/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.mjs.map +0 -1
- package/lib/adapters/compression/summaryblob/index.d.mts.map +0 -1
- package/lib/adapters/compression/summaryblob/index.mjs.map +0 -1
- package/lib/adapters/index.d.mts.map +0 -1
- package/lib/adapters/index.mjs.map +0 -1
- package/lib/adapters/predefinedAdapters.d.mts.map +0 -1
- package/lib/adapters/predefinedAdapters.mjs.map +0 -1
- package/lib/blob.d.mts.map +0 -1
- package/lib/blob.mjs.map +0 -1
- package/lib/buildSnapshotTree.d.mts.map +0 -1
- package/lib/buildSnapshotTree.mjs.map +0 -1
- package/lib/documentServiceFactoryProxy.d.mts.map +0 -1
- package/lib/documentServiceFactoryProxy.mjs.map +0 -1
- package/lib/documentServiceProxy.d.mts.map +0 -1
- package/lib/documentServiceProxy.mjs.map +0 -1
- package/lib/documentStorageServiceProxy.d.mts.map +0 -1
- package/lib/documentStorageServiceProxy.mjs.map +0 -1
- package/lib/error.d.mts.map +0 -1
- package/lib/error.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs.map +0 -1
- package/lib/insecureUrlResolver.d.mts.map +0 -1
- package/lib/insecureUrlResolver.mjs.map +0 -1
- package/lib/messageRecognition.d.mts.map +0 -1
- package/lib/messageRecognition.mjs.map +0 -1
- package/lib/network.d.mts.map +0 -1
- package/lib/network.mjs.map +0 -1
- package/lib/networkUtils.d.mts +0 -11
- package/lib/networkUtils.d.mts.map +0 -1
- package/lib/networkUtils.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/parallelRequests.d.mts.map +0 -1
- package/lib/parallelRequests.mjs.map +0 -1
- package/lib/prefetchDocumentStorageService.d.mts.map +0 -1
- package/lib/prefetchDocumentStorageService.mjs.map +0 -1
- package/lib/rateLimiter.d.mts.map +0 -1
- package/lib/rateLimiter.mjs.map +0 -1
- package/lib/readAndParse.d.mts.map +0 -1
- package/lib/readAndParse.mjs.map +0 -1
- package/lib/runWithRetry.d.mts.map +0 -1
- package/lib/runWithRetry.mjs.map +0 -1
- package/lib/summaryForCreateNew.d.mts.map +0 -1
- package/lib/summaryForCreateNew.mjs.map +0 -1
- package/lib/treeConversions.d.mts.map +0 -1
- package/lib/treeConversions.mjs.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceSummaryBlobCompressionAdapter.js","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AAEpD,+EAQ8C;AAC9C,iCAA6C;AAC7C,sFAAmF;AACnF,2BAA6E;AAE7E;;GAEG;AACU,QAAA,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAa,wCAAyC,SAAQ,yDAA2B;IAGxF,YACC,OAAgC,EACf,OAAkC;QAEnD,KAAK,CAAC,OAAO,CAAC,CAAC;QAFE,YAAO,GAAP,OAAO,CAA2B;QAJ5C,0BAAqB,GAAY,KAAK,CAAC;IAO/C,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,sBAAsB,CAAC;IACpC,CAAC;IAED;;;;OA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pC,MAAM,WAAW,GAAiB,KAAK,CAAC;QACxC,MAAM,QAAQ,GAAe,wCAAwC,CAAC,aAAa,CAClF,WAAW,CAAC,OAAO,CACnB,CAAC;QACF,MAAM,SAAS,GACd,wCAAwC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC/D,MAAM,cAAc,GAAG;YACtB,IAAI,EAAE,kCAAW,CAAC,IAAI;YACtB,OAAO,EAAE,wBAAS,CAAC,IAAI,CAAC,SAAS,CAAC;SAClC,CAAC;QACF,OAAO,cAAc,CAAC;KACtB;SAAM;QACN,OAAO,KAAK,CAAC;KACb;AACF,CAAC,AAhBkC,CAgBjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISummaryBlob,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n\tSummaryObject,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport { compress, decompress } from \"lz4js\";\nimport { DocumentStorageServiceProxy } from \"../../../documentStorageServiceProxy\";\nimport { ICompressionStorageConfig, SummaryCompressionAlgorithm } from \"../\";\n\n/**\n * @internal\n */\nexport const blobHeadersBlobName = \".metadata.blobHeaders\";\nconst metadataBlobName = \".metadata\";\n\n/**\n * This class is a proxy for the IDocumentStorageService that compresses and decompresses blobs in the summary.\n * The identification of the compressed blobs is done by adding a compression markup blob to the summary.\n * Even if the markup blob is present, it does not mean that all blobs are compressed. The blob,\n * which is compressed also contain the compression algorithm enumerated value from the\n * SummaryCompressionAlgorithm enumeration in the first byte . If the blob is not\n * commpressed, it contains the first byte equals to SummaryCompressionAlgorithm.None .\n * In case, the markup blob is present, it is expected that the first byte of the markup blob\n * will contain the info about the compression. If the first byte is not present, it is assumed\n * that the compression is not enabled and no first prefix byte is present in the blobs.\n * @public\n */\nexport class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {\n\tprivate _isCompressionEnabled: boolean = false;\n\n\tconstructor(\n\t\tservice: IDocumentStorageService,\n\t\tprivate readonly _config: ICompressionStorageConfig,\n\t) {\n\t\tsuper(service);\n\t}\n\n\tpublic get service(): IDocumentStorageService {\n\t\treturn this.internalStorageService;\n\t}\n\n\t/**\n\t * This method returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t * @param blob - The blob to compress.\n\t * @returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t */\n\tprivate static hasPrefix(blob: ArrayBufferLike): boolean {\n\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t// eslint-disable-next-line no-bitwise\n\t\treturn (firstByte & 0xf0) === 0xb0;\n\t}\n\n\t/**\n\t * This method reads the first byte from the given blob and maps that byte to the compression algorithm.\n\t * @param blob - The maybe compressed blob.\n\t */\n\tprivate static readAlgorithmFromBlob(blob: ArrayBufferLike): number {\n\t\treturn !this.hasPrefix(blob)\n\t\t\t? SummaryCompressionAlgorithm.None\n\t\t\t: // eslint-disable-next-line no-bitwise\n\t\t\t IsoBuffer.from(blob)[0] & 0x0f;\n\t}\n\n\t/**\n\t * This method writes the given algorithm to the blob as the first byte.\n\t * @param blob - The blob to write the algorithm to.\n\t * @param algorithm - The algorithm to write.\n\t * @returns The blob with the algorithm as the first byte.\n\t */\n\tprivate static writeAlgorithmToBlob(blob: ArrayBufferLike, algorithm: number): ArrayBufferLike {\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\tif ((firstByte & 0xf0) !== 0xb0) {\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t}\n\t\tassert(algorithm < 0x10, 0x6f5 /* Algorithm should be less than 0x10 */);\n\t\tconst blobView = new Uint8Array(blob);\n\t\tconst blobLength = blobView.length;\n\t\tconst newBlob = new Uint8Array(blobLength + 1);\n\t\t// eslint-disable-next-line no-bitwise\n\t\tconst prefix = 0xb0 | algorithm;\n\t\tnewBlob[0] = prefix;\n\t\tnewBlob.set(blobView, 1);\n\t\treturn IsoBuffer.from(newBlob);\n\t}\n\n\t/**\n\t * This method removes the algorithm markup prefix from the blob (1 byte)\n\t * @param blob - The blob to remove the prefix from.\n\t * @returns The blob without the prefix.\n\t */\n\tprivate static removePrefixFromBlobIfPresent(blob: ArrayBufferLike): ArrayBufferLike {\n\t\tconst blobView = new Uint8Array(blob);\n\t\treturn this.hasPrefix(blob) ? IsoBuffer.from(blobView.subarray(1)) : blob;\n\t}\n\n\t/**\n\t * This method converts the given argument to Uint8Array. If the parameter is already Uint8Array,\n\t * it is just returned as is. If the parameter is string, it is converted to Uint8Array using\n\t * TextEncoder.\n\t * @param input - The input to convert to Uint8Array.\n\t * @returns The Uint8Array representation of the input.\n\t */\n\tprivate static toBinaryArray(input: string | Uint8Array): Uint8Array {\n\t\treturn typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n\t}\n\n\t/**\n\t * This method encodes the blob inside the given summary object of the SummaryType.Blob type using the given config\n\t * containing the compression algorithm.\n\t * @param input - The summary object to encode.\n\t * @param config - The config containing the compression algorithm.\n\t * @returns The summary object with the encoded blob.\n\t */\n\tprivate static readonly blobEncoder = (\n\t\tinput: SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.toBinaryArray(summaryBlob.content);\n\t\t\tconst processed: ArrayBufferLike = DocumentStorageServiceCompressionAdapter.encodeBlob(\n\t\t\t\toriginal,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method decodes the blob inside the given summary object of the SummaryType.Blob type.\n\t * @param input - The summary object to decode.\n\t * @returns The summary object with the decoded blob.\n\t */\n\tprivate static readonly blobDecoder = (input: SummaryObject): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: Uint8Array = DocumentStorageServiceCompressionAdapter.toBinaryArray(\n\t\t\t\tsummaryBlob.content,\n\t\t\t);\n\t\t\tconst processed: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(original);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method encodes the given blob according to the given config.\n\t * @param file - The blob to encode.\n\t * @param config - The config to use for encoding.\n\t * @returns The encoded blob.\n\t */\n\tprivate static encodeBlob(\n\t\tfile: ArrayBufferLike,\n\t\tconfig: ICompressionStorageConfig,\n\t): ArrayBufferLike {\n\t\tlet maybeCompressed: ArrayBufferLike;\n\t\tlet algorithm = config.algorithm;\n\t\tif (new Uint8Array(file).length < config.minSizeToCompress) {\n\t\t\tmaybeCompressed = file;\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tmaybeCompressed = file;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tconst compressed = compress(file) as ArrayBufferLike;\n\t\t\tmaybeCompressed = compressed;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${config.algorithm}`);\n\t\t}\n\t\tmaybeCompressed = DocumentStorageServiceCompressionAdapter.writeAlgorithmToBlob(\n\t\t\tmaybeCompressed,\n\t\t\talgorithm,\n\t\t);\n\t\treturn maybeCompressed;\n\t}\n\n\t/**\n\t * This method decodes the given blob.\n\t * @param file - The blob to decode.\n\t * @returns The decoded blob.\n\t */\n\tprivate static decodeBlob(file: ArrayBufferLike): ArrayBufferLike {\n\t\tlet decompressed: ArrayBufferLike;\n\t\tlet originalBlob;\n\t\tlet algorithm;\n\t\tif (this.hasPrefix(file)) {\n\t\t\talgorithm = DocumentStorageServiceCompressionAdapter.readAlgorithmFromBlob(file);\n\t\t\toriginalBlob = this.removePrefixFromBlobIfPresent(file);\n\t\t} else {\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t\toriginalBlob = file;\n\t\t}\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tdecompressed = originalBlob;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tdecompressed = decompress(originalBlob) as ArrayBufferLike;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${algorithm}`);\n\t\t}\n\t\treturn decompressed;\n\t}\n\n\t/**\n\t * This method traverses the SummaryObject recursively. If it finds the ISummaryBlob object,\n\t * it applies encoding/decoding on it according to the given isEncode flag.\n\t * @param isEncode - True if the encoding should be applied, false if the decoding should be applied.\n\t * @param input - The summary object to traverse.\n\t * @param encoder - The encoder function to use.\n\t * @param decoder - The decoder function to use.\n\t * @param config - The config to use for encoding.\n\t * @param context - The summary context.\n\t * @returns The summary object with the encoded/decoded blob.\n\t */\n\tprivate static recursivelyReplace(\n\t\tisEncode: boolean,\n\t\tinput: SummaryObject,\n\t\tencoder: (input: SummaryObject, config: ICompressionStorageConfig) => SummaryObject,\n\t\tdecoder: (input: SummaryObject) => SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t\tcontext?: ISummaryContext,\n\t): SummaryObject {\n\t\tassert(typeof input === \"object\", 0x6f6 /* input must be a non-null object */);\n\t\tconst maybeReplaced = isEncode ? encoder(input, config) : decoder(input);\n\n\t\tif (maybeReplaced !== input) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value = input[key];\n\n\t\t\tif (Boolean(value) && typeof value === \"object\") {\n\t\t\t\tconst replaced = this.recursivelyReplace(\n\t\t\t\t\tisEncode,\n\t\t\t\t\tvalue as SummaryObject,\n\t\t\t\t\tencoder,\n\t\t\t\t\tdecoder,\n\t\t\t\t\tconfig,\n\t\t\t\t\tcontext,\n\t\t\t\t);\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\t\t\t\t\tclone[key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (clone ?? input) as SummaryObject;\n\t}\n\n\t/**\n\t * This method traverses the SummaryTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it returns the summary tree containing that blob.\n\t *\n\t * @param summary - The summary tree to traverse.\n\t * @returns The summary tree containing the metadata blob.\n\t */\n\tprivate static findMetadataHolderSummary(summary: ISummaryTree): ISummaryTree | undefined {\n\t\tassert(typeof summary === \"object\", 0x6f7 /* summary must be a non-null object */);\n\t\tfor (const key of Object.keys(summary.tree)) {\n\t\t\tconst value = summary.tree[key];\n\n\t\t\tif (Boolean(value) && value.type === SummaryType.Tree) {\n\t\t\t\tconst found = this.findMetadataHolderSummary(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Boolean(value) && key === metadataBlobName && value.type === SummaryType.Blob) {\n\t\t\t\treturn summary;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * This method obtains the summary tree containing the metadata blob. It returns the content\n\t * of the tree atribute.\n\t * @param summary - The summary tree to traverse.\n\t * @returns The content of the tree attribute of the summary tree containing the metadata blob.\n\t */\n\tprivate static getMetadataHolderTree(summary: ISummaryTree) {\n\t\tconst metadataHolder = this.findMetadataHolderSummary(summary);\n\t\tassert(metadataHolder !== undefined, 0x6f8 /* metadataHolder must be a non-null object */);\n\t\tconst metadataHolderTree = metadataHolder.tree;\n\t\treturn metadataHolderTree;\n\t}\n\n\t/**\n\t * This method adds the compression markup blob to the nested summary tree containing the metadata blob.\n\t * @param summary - The top summary tree to put the compression markup blob into.\n\t */\n\tprivate static putCompressionMarkup(summary: ISummaryTree): void {\n\t\tconst metadataHolderTree =\n\t\t\tDocumentStorageServiceCompressionAdapter.getMetadataHolderTree(summary);\n\t\tmetadataHolderTree[blobHeadersBlobName] = {\n\t\t\ttype: 2,\n\t\t\tcontent: \"\",\n\t\t};\n\t}\n\n\t/**\n\t * This method traverses the SnapshotTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it checks, if the SummaryTree holder of that object also contains the compression markup blob. If it is found,\n\t * it returns true, otherwise false.\n\t * @param snapshot - The snapshot tree to traverse.\n\t * @returns True if the compression markup blob is found, otherwise false.\n\t */\n\tprivate static hasCompressionMarkup(snapshot: ISnapshotTree): boolean {\n\t\tassert(typeof snapshot === \"object\", 0x6f9 /* snapshot must be a non-null object */);\n\t\tfor (const key of Object.keys(snapshot.blobs)) {\n\t\t\tif (key === metadataBlobName) {\n\t\t\t\tconst value = snapshot.blobs[blobHeadersBlobName];\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const key of Object.keys(snapshot.trees)) {\n\t\t\tconst value = snapshot[key] as ISnapshotTree;\n\t\t\tif (value !== undefined) {\n\t\t\t\tconst found = this.hasCompressionMarkup(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This method performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to compress.\n\t * @param config - The compression config.\n\t * @returns The compressed summary tree.\n\t */\n\tpublic static compressSummary(\n\t\tsummary: ISummaryTree,\n\t\tconfig: ICompressionStorageConfig,\n\t): ISummaryTree {\n\t\tthis.putCompressionMarkup(summary);\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\ttrue,\n\t\t\tsummary,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\tconfig,\n\t\t) as ISummaryTree;\n\t\t//\tconsole.log(`Miso summary-blob Summary Upload: ${JSON.stringify(prep).length}`);\n\t\treturn prep;\n\t}\n\n\t/**\n\t * This method read blob from the storage and decompresses it if it is compressed.\n\t * @param id - The id of the blob to read.\n\t * @returns The decompressed blob.\n\t */\n\tpublic override async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst originalBlob = await super.readBlob(id);\n\t\tif (!this._isCompressionEnabled) {\n\t\t\treturn originalBlob;\n\t\t} else {\n\t\t\tconst decompressedBlob =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(originalBlob);\n\t\t\t//\t\t\tconsole.log(`Miso summary-blob Blob read END : ${id} ${decompressedBlob.byteLength}`);\n\t\t\treturn decompressedBlob;\n\t\t}\n\t}\n\n\t/**\n\t * This method loads the snapshot tree from the server. It also checks, if the compression markup blob is present\n\t * and setups the compression flag accordingly. It also identifies the blobs that are not compressed and do not contain\n\t * algorithm byte prefix and store them.\n\t * @param version - The version of the snapshot tree to load.\n\t * @param scenarioName - The scenario name of the snapshot tree to load.\n\t * @returns The snapshot tree.\n\t */\n\tpublic override async getSnapshotTree(\n\t\tversion?: IVersion | undefined,\n\t\tscenarioName?: string | undefined,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\tconst snapshotTree = await super.getSnapshotTree(version, scenarioName);\n\t\tthis._isCompressionEnabled =\n\t\t\tsnapshotTree !== undefined &&\n\t\t\tsnapshotTree !== null &&\n\t\t\tDocumentStorageServiceCompressionAdapter.hasCompressionMarkup(snapshotTree);\n\t\treturn snapshotTree;\n\t}\n\n\t/**\n\t * This method uploads the summary to the storage. It performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to upload.\n\t * @param context - The summary context.\n\t * @returns The ID of the uploaded summary.\n\t */\n\tpublic override async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.compressSummary(\n\t\t\tsummary,\n\t\t\tthis._config,\n\t\t);\n\t\treturn super.uploadSummaryWithContext(prep, context);\n\t}\n\n\t/**\n\t * This method downloads the summary from the storage and then applies decompression on the compressed blobs.\n\t * @param id - The ID of the summary to be downloaded\n\t * @returns The summary with decompressed blobs\n\t */\n\tpublic override async downloadSummary(id: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst summary = await super.downloadSummary(id);\n\t\treturn !this._isCompressionEnabled\n\t\t\t? summary\n\t\t\t: (DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\t\t\tfalse,\n\t\t\t\t\tsummary,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\t\t\tthis._config,\n\t\t\t ) as ISummaryTree);\n\t}\n}\n"]}
|
|
1
|
+
{"version":3,"file":"documentStorageServiceSummaryBlobCompressionAdapter.js","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/documentStorageServiceSummaryBlobCompressionAdapter.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAyD;AACzD,2DAAoD;AAEpD,+EAQ8C;AAC9C,iCAA6C;AAC7C,4FAAsF;AACtF,2CAAsF;AAEtF;;GAEG;AACU,QAAA,mBAAmB,GAAG,uBAAuB,CAAC;AAC3D,MAAM,gBAAgB,GAAG,WAAW,CAAC;AAErC;;;;;;;;;;;GAWG;AACH,MAAa,wCAAyC,SAAQ,4DAA2B;IAGxF,YACC,OAA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OAAO,cAAc,CAAC;KACtB;SAAM;QACN,OAAO,KAAK,CAAC;KACb;AACF,CAAC,AApBkC,CAoBjC;AAEF;;;;GAIG;AACqB,oDAAW,GAAG,CAAC,KAAoB,EAAiB,EAAE;IAC7E,IAAI,KAAK,CAAC,IAAI,KAAK,kCAAW,CAAC,IAAI,EAAE;QACpC,MAAM,WAAW,GAAiB,KAAK,CAAC;QACxC,MAAM,QAAQ,GAAe,wCAAwC,CAAC,aAAa,CAClF,WAAW,CAAC,OAAO,CACnB,CAAC;QACF,MAAM,SAAS,GACd,wCAAwC,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC/D,MAAM,cAAc,GAAG;YACtB,IAAI,EAAE,kCAAW,CAAC,IAAI;YACtB,OAAO,EAAE,wBAAS,CAAC,IAAI,CAAC,SAAS,CAAC;SAClC,CAAC;QACF,OAAO,cAAc,CAAC;KACtB;SAAM;QACN,OAAO,KAAK,CAAC;KACb;AACF,CAAC,AAhBkC,CAgBjC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils\";\nimport { IDocumentStorageService, ISummaryContext } from \"@fluidframework/driver-definitions\";\nimport {\n\tISnapshotTree,\n\tISummaryBlob,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n\tSummaryObject,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport { compress, decompress } from \"lz4js\";\nimport { DocumentStorageServiceProxy } from \"../../../documentStorageServiceProxy.js\";\nimport { ICompressionStorageConfig, SummaryCompressionAlgorithm } from \"..//index.js\";\n\n/**\n * @internal\n */\nexport const blobHeadersBlobName = \".metadata.blobHeaders\";\nconst metadataBlobName = \".metadata\";\n\n/**\n * This class is a proxy for the IDocumentStorageService that compresses and decompresses blobs in the summary.\n * The identification of the compressed blobs is done by adding a compression markup blob to the summary.\n * Even if the markup blob is present, it does not mean that all blobs are compressed. The blob,\n * which is compressed also contain the compression algorithm enumerated value from the\n * SummaryCompressionAlgorithm enumeration in the first byte . If the blob is not\n * commpressed, it contains the first byte equals to SummaryCompressionAlgorithm.None .\n * In case, the markup blob is present, it is expected that the first byte of the markup blob\n * will contain the info about the compression. If the first byte is not present, it is assumed\n * that the compression is not enabled and no first prefix byte is present in the blobs.\n * @public\n */\nexport class DocumentStorageServiceCompressionAdapter extends DocumentStorageServiceProxy {\n\tprivate _isCompressionEnabled: boolean = false;\n\n\tconstructor(\n\t\tservice: IDocumentStorageService,\n\t\tprivate readonly _config: ICompressionStorageConfig,\n\t) {\n\t\tsuper(service);\n\t}\n\n\tpublic get service(): IDocumentStorageService {\n\t\treturn this.internalStorageService;\n\t}\n\n\t/**\n\t * This method returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t * @param blob - The blob to compress.\n\t * @returns `true` if there is a compression markup byte in the blob, otherwise `false`.\n\t */\n\tprivate static hasPrefix(blob: ArrayBufferLike): boolean {\n\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t// eslint-disable-next-line no-bitwise\n\t\treturn (firstByte & 0xf0) === 0xb0;\n\t}\n\n\t/**\n\t * This method reads the first byte from the given blob and maps that byte to the compression algorithm.\n\t * @param blob - The maybe compressed blob.\n\t */\n\tprivate static readAlgorithmFromBlob(blob: ArrayBufferLike): number {\n\t\treturn !this.hasPrefix(blob)\n\t\t\t? SummaryCompressionAlgorithm.None\n\t\t\t: // eslint-disable-next-line no-bitwise\n\t\t\t IsoBuffer.from(blob)[0] & 0x0f;\n\t}\n\n\t/**\n\t * This method writes the given algorithm to the blob as the first byte.\n\t * @param blob - The blob to write the algorithm to.\n\t * @param algorithm - The algorithm to write.\n\t * @returns The blob with the algorithm as the first byte.\n\t */\n\tprivate static writeAlgorithmToBlob(blob: ArrayBufferLike, algorithm: number): ArrayBufferLike {\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tconst firstByte = IsoBuffer.from(blob)[0];\n\t\t\t// eslint-disable-next-line no-bitwise\n\t\t\tif ((firstByte & 0xf0) !== 0xb0) {\n\t\t\t\treturn blob;\n\t\t\t}\n\t\t}\n\t\tassert(algorithm < 0x10, 0x6f5 /* Algorithm should be less than 0x10 */);\n\t\tconst blobView = new Uint8Array(blob);\n\t\tconst blobLength = blobView.length;\n\t\tconst newBlob = new Uint8Array(blobLength + 1);\n\t\t// eslint-disable-next-line no-bitwise\n\t\tconst prefix = 0xb0 | algorithm;\n\t\tnewBlob[0] = prefix;\n\t\tnewBlob.set(blobView, 1);\n\t\treturn IsoBuffer.from(newBlob);\n\t}\n\n\t/**\n\t * This method removes the algorithm markup prefix from the blob (1 byte)\n\t * @param blob - The blob to remove the prefix from.\n\t * @returns The blob without the prefix.\n\t */\n\tprivate static removePrefixFromBlobIfPresent(blob: ArrayBufferLike): ArrayBufferLike {\n\t\tconst blobView = new Uint8Array(blob);\n\t\treturn this.hasPrefix(blob) ? IsoBuffer.from(blobView.subarray(1)) : blob;\n\t}\n\n\t/**\n\t * This method converts the given argument to Uint8Array. If the parameter is already Uint8Array,\n\t * it is just returned as is. If the parameter is string, it is converted to Uint8Array using\n\t * TextEncoder.\n\t * @param input - The input to convert to Uint8Array.\n\t * @returns The Uint8Array representation of the input.\n\t */\n\tprivate static toBinaryArray(input: string | Uint8Array): Uint8Array {\n\t\treturn typeof input === \"string\" ? new TextEncoder().encode(input) : input;\n\t}\n\n\t/**\n\t * This method encodes the blob inside the given summary object of the SummaryType.Blob type using the given config\n\t * containing the compression algorithm.\n\t * @param input - The summary object to encode.\n\t * @param config - The config containing the compression algorithm.\n\t * @returns The summary object with the encoded blob.\n\t */\n\tprivate static readonly blobEncoder = (\n\t\tinput: SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.toBinaryArray(summaryBlob.content);\n\t\t\tconst processed: ArrayBufferLike = DocumentStorageServiceCompressionAdapter.encodeBlob(\n\t\t\t\toriginal,\n\t\t\t\tconfig,\n\t\t\t);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method decodes the blob inside the given summary object of the SummaryType.Blob type.\n\t * @param input - The summary object to decode.\n\t * @returns The summary object with the decoded blob.\n\t */\n\tprivate static readonly blobDecoder = (input: SummaryObject): SummaryObject => {\n\t\tif (input.type === SummaryType.Blob) {\n\t\t\tconst summaryBlob: ISummaryBlob = input;\n\t\t\tconst original: Uint8Array = DocumentStorageServiceCompressionAdapter.toBinaryArray(\n\t\t\t\tsummaryBlob.content,\n\t\t\t);\n\t\t\tconst processed: ArrayBufferLike =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(original);\n\t\t\tconst newSummaryBlob = {\n\t\t\t\ttype: SummaryType.Blob,\n\t\t\t\tcontent: IsoBuffer.from(processed),\n\t\t\t};\n\t\t\treturn newSummaryBlob;\n\t\t} else {\n\t\t\treturn input;\n\t\t}\n\t};\n\n\t/**\n\t * This method encodes the given blob according to the given config.\n\t * @param file - The blob to encode.\n\t * @param config - The config to use for encoding.\n\t * @returns The encoded blob.\n\t */\n\tprivate static encodeBlob(\n\t\tfile: ArrayBufferLike,\n\t\tconfig: ICompressionStorageConfig,\n\t): ArrayBufferLike {\n\t\tlet maybeCompressed: ArrayBufferLike;\n\t\tlet algorithm = config.algorithm;\n\t\tif (new Uint8Array(file).length < config.minSizeToCompress) {\n\t\t\tmaybeCompressed = file;\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tmaybeCompressed = file;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tconst compressed = compress(file) as ArrayBufferLike;\n\t\t\tmaybeCompressed = compressed;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${config.algorithm}`);\n\t\t}\n\t\tmaybeCompressed = DocumentStorageServiceCompressionAdapter.writeAlgorithmToBlob(\n\t\t\tmaybeCompressed,\n\t\t\talgorithm,\n\t\t);\n\t\treturn maybeCompressed;\n\t}\n\n\t/**\n\t * This method decodes the given blob.\n\t * @param file - The blob to decode.\n\t * @returns The decoded blob.\n\t */\n\tprivate static decodeBlob(file: ArrayBufferLike): ArrayBufferLike {\n\t\tlet decompressed: ArrayBufferLike;\n\t\tlet originalBlob;\n\t\tlet algorithm;\n\t\tif (this.hasPrefix(file)) {\n\t\t\talgorithm = DocumentStorageServiceCompressionAdapter.readAlgorithmFromBlob(file);\n\t\t\toriginalBlob = this.removePrefixFromBlobIfPresent(file);\n\t\t} else {\n\t\t\talgorithm = SummaryCompressionAlgorithm.None;\n\t\t\toriginalBlob = file;\n\t\t}\n\t\tif (algorithm === SummaryCompressionAlgorithm.None) {\n\t\t\tdecompressed = originalBlob;\n\t\t} else if (algorithm === SummaryCompressionAlgorithm.LZ4) {\n\t\t\tdecompressed = decompress(originalBlob) as ArrayBufferLike;\n\t\t} else {\n\t\t\tthrow new Error(`Unknown Algorithm ${algorithm}`);\n\t\t}\n\t\treturn decompressed;\n\t}\n\n\t/**\n\t * This method traverses the SummaryObject recursively. If it finds the ISummaryBlob object,\n\t * it applies encoding/decoding on it according to the given isEncode flag.\n\t * @param isEncode - True if the encoding should be applied, false if the decoding should be applied.\n\t * @param input - The summary object to traverse.\n\t * @param encoder - The encoder function to use.\n\t * @param decoder - The decoder function to use.\n\t * @param config - The config to use for encoding.\n\t * @param context - The summary context.\n\t * @returns The summary object with the encoded/decoded blob.\n\t */\n\tprivate static recursivelyReplace(\n\t\tisEncode: boolean,\n\t\tinput: SummaryObject,\n\t\tencoder: (input: SummaryObject, config: ICompressionStorageConfig) => SummaryObject,\n\t\tdecoder: (input: SummaryObject) => SummaryObject,\n\t\tconfig: ICompressionStorageConfig,\n\t\tcontext?: ISummaryContext,\n\t): SummaryObject {\n\t\tassert(typeof input === \"object\", 0x6f6 /* input must be a non-null object */);\n\t\tconst maybeReplaced = isEncode ? encoder(input, config) : decoder(input);\n\n\t\tif (maybeReplaced !== input) {\n\t\t\treturn maybeReplaced;\n\t\t}\n\t\tlet clone: object | undefined;\n\t\tfor (const key of Object.keys(input)) {\n\t\t\tconst value = input[key];\n\n\t\t\tif (Boolean(value) && typeof value === \"object\") {\n\t\t\t\tconst replaced = this.recursivelyReplace(\n\t\t\t\t\tisEncode,\n\t\t\t\t\tvalue as SummaryObject,\n\t\t\t\t\tencoder,\n\t\t\t\t\tdecoder,\n\t\t\t\t\tconfig,\n\t\t\t\t\tcontext,\n\t\t\t\t);\n\t\t\t\tif (replaced !== value) {\n\t\t\t\t\tclone = clone ?? (Array.isArray(input) ? [...input] : { ...input });\n\t\t\t\t\tclone[key] = replaced;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn (clone ?? input) as SummaryObject;\n\t}\n\n\t/**\n\t * This method traverses the SummaryTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it returns the summary tree containing that blob.\n\t *\n\t * @param summary - The summary tree to traverse.\n\t * @returns The summary tree containing the metadata blob.\n\t */\n\tprivate static findMetadataHolderSummary(summary: ISummaryTree): ISummaryTree | undefined {\n\t\tassert(typeof summary === \"object\", 0x6f7 /* summary must be a non-null object */);\n\t\tfor (const key of Object.keys(summary.tree)) {\n\t\t\tconst value = summary.tree[key];\n\n\t\t\tif (Boolean(value) && value.type === SummaryType.Tree) {\n\t\t\t\tconst found = this.findMetadataHolderSummary(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (Boolean(value) && key === metadataBlobName && value.type === SummaryType.Blob) {\n\t\t\t\treturn summary;\n\t\t\t}\n\t\t}\n\t\treturn undefined;\n\t}\n\n\t/**\n\t * This method obtains the summary tree containing the metadata blob. It returns the content\n\t * of the tree atribute.\n\t * @param summary - The summary tree to traverse.\n\t * @returns The content of the tree attribute of the summary tree containing the metadata blob.\n\t */\n\tprivate static getMetadataHolderTree(summary: ISummaryTree) {\n\t\tconst metadataHolder = this.findMetadataHolderSummary(summary);\n\t\tassert(metadataHolder !== undefined, 0x6f8 /* metadataHolder must be a non-null object */);\n\t\tconst metadataHolderTree = metadataHolder.tree;\n\t\treturn metadataHolderTree;\n\t}\n\n\t/**\n\t * This method adds the compression markup blob to the nested summary tree containing the metadata blob.\n\t * @param summary - The top summary tree to put the compression markup blob into.\n\t */\n\tprivate static putCompressionMarkup(summary: ISummaryTree): void {\n\t\tconst metadataHolderTree =\n\t\t\tDocumentStorageServiceCompressionAdapter.getMetadataHolderTree(summary);\n\t\tmetadataHolderTree[blobHeadersBlobName] = {\n\t\t\ttype: 2,\n\t\t\tcontent: \"\",\n\t\t};\n\t}\n\n\t/**\n\t * This method traverses the SnapshotTree recursively. If it finds the ISummaryBlob object with the key '.metadata',\n\t * it checks, if the SummaryTree holder of that object also contains the compression markup blob. If it is found,\n\t * it returns true, otherwise false.\n\t * @param snapshot - The snapshot tree to traverse.\n\t * @returns True if the compression markup blob is found, otherwise false.\n\t */\n\tprivate static hasCompressionMarkup(snapshot: ISnapshotTree): boolean {\n\t\tassert(typeof snapshot === \"object\", 0x6f9 /* snapshot must be a non-null object */);\n\t\tfor (const key of Object.keys(snapshot.blobs)) {\n\t\t\tif (key === metadataBlobName) {\n\t\t\t\tconst value = snapshot.blobs[blobHeadersBlobName];\n\t\t\t\tif (value !== undefined) {\n\t\t\t\t\treturn true;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tfor (const key of Object.keys(snapshot.trees)) {\n\t\t\tconst value = snapshot[key] as ISnapshotTree;\n\t\t\tif (value !== undefined) {\n\t\t\t\tconst found = this.hasCompressionMarkup(value);\n\t\t\t\tif (found) {\n\t\t\t\t\treturn found;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * This method performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to compress.\n\t * @param config - The compression config.\n\t * @returns The compressed summary tree.\n\t */\n\tpublic static compressSummary(\n\t\tsummary: ISummaryTree,\n\t\tconfig: ICompressionStorageConfig,\n\t): ISummaryTree {\n\t\tthis.putCompressionMarkup(summary);\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\ttrue,\n\t\t\tsummary,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\tconfig,\n\t\t) as ISummaryTree;\n\t\t//\tconsole.log(`Miso summary-blob Summary Upload: ${JSON.stringify(prep).length}`);\n\t\treturn prep;\n\t}\n\n\t/**\n\t * This method read blob from the storage and decompresses it if it is compressed.\n\t * @param id - The id of the blob to read.\n\t * @returns The decompressed blob.\n\t */\n\tpublic override async readBlob(id: string): Promise<ArrayBufferLike> {\n\t\tconst originalBlob = await super.readBlob(id);\n\t\tif (!this._isCompressionEnabled) {\n\t\t\treturn originalBlob;\n\t\t} else {\n\t\t\tconst decompressedBlob =\n\t\t\t\tDocumentStorageServiceCompressionAdapter.decodeBlob(originalBlob);\n\t\t\t//\t\t\tconsole.log(`Miso summary-blob Blob read END : ${id} ${decompressedBlob.byteLength}`);\n\t\t\treturn decompressedBlob;\n\t\t}\n\t}\n\n\t/**\n\t * This method loads the snapshot tree from the server. It also checks, if the compression markup blob is present\n\t * and setups the compression flag accordingly. It also identifies the blobs that are not compressed and do not contain\n\t * algorithm byte prefix and store them.\n\t * @param version - The version of the snapshot tree to load.\n\t * @param scenarioName - The scenario name of the snapshot tree to load.\n\t * @returns The snapshot tree.\n\t */\n\tpublic override async getSnapshotTree(\n\t\tversion?: IVersion | undefined,\n\t\tscenarioName?: string | undefined,\n\t\t// eslint-disable-next-line @rushstack/no-new-null\n\t): Promise<ISnapshotTree | null> {\n\t\tconst snapshotTree = await super.getSnapshotTree(version, scenarioName);\n\t\tthis._isCompressionEnabled =\n\t\t\tsnapshotTree !== undefined &&\n\t\t\tsnapshotTree !== null &&\n\t\t\tDocumentStorageServiceCompressionAdapter.hasCompressionMarkup(snapshotTree);\n\t\treturn snapshotTree;\n\t}\n\n\t/**\n\t * This method uploads the summary to the storage. It performs compression of the blobs in the summary tree.\n\t * @param summary - The summary tree to upload.\n\t * @param context - The summary context.\n\t * @returns The ID of the uploaded summary.\n\t */\n\tpublic override async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst prep = DocumentStorageServiceCompressionAdapter.compressSummary(\n\t\t\tsummary,\n\t\t\tthis._config,\n\t\t);\n\t\treturn super.uploadSummaryWithContext(prep, context);\n\t}\n\n\t/**\n\t * This method downloads the summary from the storage and then applies decompression on the compressed blobs.\n\t * @param id - The ID of the summary to be downloaded\n\t * @returns The summary with decompressed blobs\n\t */\n\tpublic override async downloadSummary(id: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst summary = await super.downloadSummary(id);\n\t\treturn !this._isCompressionEnabled\n\t\t\t? summary\n\t\t\t: (DocumentStorageServiceCompressionAdapter.recursivelyReplace(\n\t\t\t\t\tfalse,\n\t\t\t\t\tsummary,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobEncoder,\n\t\t\t\t\tDocumentStorageServiceCompressionAdapter.blobDecoder,\n\t\t\t\t\tthis._config,\n\t\t\t ) as ISummaryTree);\n\t}\n}\n"]}
|
|
@@ -2,5 +2,5 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { DocumentStorageServiceCompressionAdapter, blobHeadersBlobName, } from "./documentStorageServiceSummaryBlobCompressionAdapter";
|
|
5
|
+
export { DocumentStorageServiceCompressionAdapter, blobHeadersBlobName, } from "./documentStorageServiceSummaryBlobCompressionAdapter.js";
|
|
6
6
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wCAAwC,EACxC,mBAAmB,GACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wCAAwC,EACxC,mBAAmB,GACnB,MAAM,0DAA0D,CAAC"}
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.blobHeadersBlobName = exports.DocumentStorageServiceCompressionAdapter = void 0;
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "DocumentStorageServiceCompressionAdapter", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "blobHeadersBlobName", { enumerable: true, get: function () { return
|
|
8
|
+
var documentStorageServiceSummaryBlobCompressionAdapter_js_1 = require("./documentStorageServiceSummaryBlobCompressionAdapter.js");
|
|
9
|
+
Object.defineProperty(exports, "DocumentStorageServiceCompressionAdapter", { enumerable: true, get: function () { return documentStorageServiceSummaryBlobCompressionAdapter_js_1.DocumentStorageServiceCompressionAdapter; } });
|
|
10
|
+
Object.defineProperty(exports, "blobHeadersBlobName", { enumerable: true, get: function () { return documentStorageServiceSummaryBlobCompressionAdapter_js_1.blobHeadersBlobName; } });
|
|
11
11
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/adapters/compression/summaryblob/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mIAGkE;AAFjE,kLAAA,wCAAwC,OAAA;AACxC,6JAAA,mBAAmB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tDocumentStorageServiceCompressionAdapter,\n\tblobHeadersBlobName,\n} from \"./documentStorageServiceSummaryBlobCompressionAdapter.js\";\n"]}
|
package/dist/adapters/index.d.ts
CHANGED
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
export { SummaryCompressionAlgorithm, ICompressionStorageConfig, DefaultCompressionStorageConfig, blobHeadersBlobName, } from "./compression";
|
|
6
|
-
export { applyStorageCompression } from "./predefinedAdapters";
|
|
5
|
+
export { SummaryCompressionAlgorithm, ICompressionStorageConfig, DefaultCompressionStorageConfig, blobHeadersBlobName, } from "./compression/index.js";
|
|
6
|
+
export { applyStorageCompression } from "./predefinedAdapters.js";
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,2BAA2B,EAC3B,yBAAyB,EACzB,+BAA+B,EAC/B,mBAAmB,GACnB,MAAM,wBAAwB,CAAC;AAEhC,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC"}
|
package/dist/adapters/index.js
CHANGED
|
@@ -5,10 +5,10 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.applyStorageCompression = exports.blobHeadersBlobName = exports.DefaultCompressionStorageConfig = exports.SummaryCompressionAlgorithm = void 0;
|
|
8
|
-
var
|
|
9
|
-
Object.defineProperty(exports, "SummaryCompressionAlgorithm", { enumerable: true, get: function () { return
|
|
10
|
-
Object.defineProperty(exports, "DefaultCompressionStorageConfig", { enumerable: true, get: function () { return
|
|
11
|
-
Object.defineProperty(exports, "blobHeadersBlobName", { enumerable: true, get: function () { return
|
|
12
|
-
var
|
|
13
|
-
Object.defineProperty(exports, "applyStorageCompression", { enumerable: true, get: function () { return
|
|
8
|
+
var index_js_1 = require("./compression/index.js");
|
|
9
|
+
Object.defineProperty(exports, "SummaryCompressionAlgorithm", { enumerable: true, get: function () { return index_js_1.SummaryCompressionAlgorithm; } });
|
|
10
|
+
Object.defineProperty(exports, "DefaultCompressionStorageConfig", { enumerable: true, get: function () { return index_js_1.DefaultCompressionStorageConfig; } });
|
|
11
|
+
Object.defineProperty(exports, "blobHeadersBlobName", { enumerable: true, get: function () { return index_js_1.blobHeadersBlobName; } });
|
|
12
|
+
var predefinedAdapters_js_1 = require("./predefinedAdapters.js");
|
|
13
|
+
Object.defineProperty(exports, "applyStorageCompression", { enumerable: true, get: function () { return predefinedAdapters_js_1.applyStorageCompression; } });
|
|
14
14
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/adapters/index.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,mDAKgC;AAJ/B,uHAAA,2BAA2B,OAAA;AAE3B,2HAAA,+BAA+B,OAAA;AAC/B,+GAAA,mBAAmB,OAAA;AAGpB,iEAAkE;AAAzD,gIAAA,uBAAuB,OAAA","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nexport {\n\tSummaryCompressionAlgorithm,\n\tICompressionStorageConfig,\n\tDefaultCompressionStorageConfig,\n\tblobHeadersBlobName,\n} from \"./compression/index.js\";\n\nexport { applyStorageCompression } from \"./predefinedAdapters.js\";\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IDocumentServiceFactory } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { ICompressionStorageConfig } from "./compression";
|
|
6
|
+
import { ICompressionStorageConfig } from "./compression/index.js";
|
|
7
7
|
/**
|
|
8
8
|
* This method optionally applies compression to the given document service factory. The compression
|
|
9
9
|
* must be enabled by setting the config to true or by passing a compression config object.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predefinedAdapters.d.ts","sourceRoot":"","sources":["../../src/adapters/predefinedAdapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAEN,yBAAyB,EAEzB,MAAM,
|
|
1
|
+
{"version":3,"file":"predefinedAdapters.d.ts","sourceRoot":"","sources":["../../src/adapters/predefinedAdapters.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EAAE,uBAAuB,EAAE,MAAM,oCAAoC,CAAC;AAC7E,OAAO,EAEN,yBAAyB,EAEzB,MAAM,wBAAwB,CAAC;AAEhC;;;;;;;GAOG;AACH,wBAAgB,uBAAuB,CACtC,sBAAsB,EAAE,uBAAuB,EAC/C,MAAM,CAAC,EAAE,yBAAyB,GAAG,OAAO,GAC1C,uBAAuB,CAgBzB;AAwBD;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,GAAG,GAAG,MAAM,IAAI,yBAAyB,CAKpF"}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.isCompressionConfig = exports.applyStorageCompression = void 0;
|
|
8
8
|
const core_utils_1 = require("@fluidframework/core-utils");
|
|
9
|
-
const
|
|
9
|
+
const index_js_1 = require("./compression/index.js");
|
|
10
10
|
/**
|
|
11
11
|
* This method optionally applies compression to the given document service factory. The compression
|
|
12
12
|
* must be enabled by setting the config to true or by passing a compression config object.
|
|
@@ -20,11 +20,11 @@ function applyStorageCompression(documentServiceFactory, config) {
|
|
|
20
20
|
return documentServiceFactory;
|
|
21
21
|
}
|
|
22
22
|
else if (config === true) {
|
|
23
|
-
return applyStorageCompressionInternal(
|
|
23
|
+
return applyStorageCompressionInternal(index_js_1.DocumentServiceFactoryCompressionAdapter, documentServiceFactory);
|
|
24
24
|
}
|
|
25
25
|
else {
|
|
26
26
|
(0, core_utils_1.assert)(isCompressionConfig(config), 0x6f4 /* Invalid compression config */);
|
|
27
|
-
return applyStorageCompressionInternal(
|
|
27
|
+
return applyStorageCompressionInternal(index_js_1.DocumentServiceFactoryCompressionAdapter, documentServiceFactory, config);
|
|
28
28
|
}
|
|
29
29
|
}
|
|
30
30
|
exports.applyStorageCompression = applyStorageCompression;
|
|
@@ -34,7 +34,7 @@ exports.applyStorageCompression = applyStorageCompression;
|
|
|
34
34
|
* @param config - The compression configuration.
|
|
35
35
|
* @returns The document service factory with compression applied.
|
|
36
36
|
*/
|
|
37
|
-
function applyStorageCompressionInternal(constructor, documentServiceFactory, config =
|
|
37
|
+
function applyStorageCompressionInternal(constructor, documentServiceFactory, config = index_js_1.DefaultCompressionStorageConfig) {
|
|
38
38
|
if (config.algorithm === undefined) {
|
|
39
39
|
return documentServiceFactory;
|
|
40
40
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"predefinedAdapters.js","sourceRoot":"","sources":["../../src/adapters/predefinedAdapters.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD
|
|
1
|
+
{"version":3,"file":"predefinedAdapters.js","sourceRoot":"","sources":["../../src/adapters/predefinedAdapters.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,2DAAoD;AAEpD,qDAIgC;AAEhC;;;;;;;GAOG;AACH,SAAgB,uBAAuB,CACtC,sBAA+C,EAC/C,MAA4C;IAE5C,IAAI,MAAM,KAAK,SAAS,IAAI,MAAM,KAAK,KAAK,EAAE;QAC7C,OAAO,sBAAsB,CAAC;KAC9B;SAAM,IAAI,MAAM,KAAK,IAAI,EAAE;QAC3B,OAAO,+BAA+B,CACrC,mDAAwC,EACxC,sBAAsB,CACtB,CAAC;KACF;SAAM;QACN,IAAA,mBAAM,EAAC,mBAAmB,CAAC,MAAM,CAAC,EAAE,KAAK,CAAC,gCAAgC,CAAC,CAAC;QAC5E,OAAO,+BAA+B,CACrC,mDAAwC,EACxC,sBAAsB,EACtB,MAAM,CACN,CAAC;KACF;AACF,CAAC;AAnBD,0DAmBC;AAED;;;;;GAKG;AACH,SAAS,+BAA+B,CACvC,WAK4B,EAC5B,sBAA+C,EAC/C,SAAoC,0CAA+B;IAEnE,IAAI,MAAM,CAAC,SAAS,KAAK,SAAS,EAAE;QACnC,OAAO,sBAAsB,CAAC;KAC9B;IACD,OAAO,IAAI,WAAW,CAAC,sBAAsB,EAAE,MAAM,CAAC,CAAC;AACxD,CAAC;AAED;;;GAGG;AACH,SAAgB,mBAAmB,CAAC,MAAW;IAC9C,OAAO,CACN,MAAM,KAAK,SAAS;QACpB,CAAC,MAAM,CAAC,SAAS,KAAK,SAAS,IAAI,MAAM,CAAC,iBAAiB,KAAK,SAAS,CAAC,CAC1E,CAAC;AACH,CAAC;AALD,kDAKC","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\";\nimport { IDocumentServiceFactory } from \"@fluidframework/driver-definitions\";\nimport {\n\tDocumentServiceFactoryCompressionAdapter,\n\tICompressionStorageConfig,\n\tDefaultCompressionStorageConfig,\n} from \"./compression/index.js\";\n\n/**\n * This method optionally applies compression to the given document service factory. The compression\n * must be enabled by setting the config to true or by passing a compression config object.\n * @param documentServiceFactory - The document service factory to apply compression to.\n * @param config - The compression configuration.\n * @returns The document service factory possibly with compression applied.\n * @internal\n */\nexport function applyStorageCompression(\n\tdocumentServiceFactory: IDocumentServiceFactory,\n\tconfig?: ICompressionStorageConfig | boolean,\n): IDocumentServiceFactory {\n\tif (config === undefined || config === false) {\n\t\treturn documentServiceFactory;\n\t} else if (config === true) {\n\t\treturn applyStorageCompressionInternal(\n\t\t\tDocumentServiceFactoryCompressionAdapter,\n\t\t\tdocumentServiceFactory,\n\t\t);\n\t} else {\n\t\tassert(isCompressionConfig(config), 0x6f4 /* Invalid compression config */);\n\t\treturn applyStorageCompressionInternal(\n\t\t\tDocumentServiceFactoryCompressionAdapter,\n\t\t\tdocumentServiceFactory,\n\t\t\tconfig,\n\t\t);\n\t}\n}\n\n/**\n * This method applies compression to the given document service factory.\n * @param documentServiceFactory - The document service factory to apply compression to.\n * @param config - The compression configuration.\n * @returns The document service factory with compression applied.\n */\nfunction applyStorageCompressionInternal(\n\tconstructor: new (\n\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\tdocumentServiceFactory: IDocumentServiceFactory,\n\t\t// eslint-disable-next-line @typescript-eslint/no-shadow\n\t\tconfig: ICompressionStorageConfig,\n\t) => IDocumentServiceFactory,\n\tdocumentServiceFactory: IDocumentServiceFactory,\n\tconfig: ICompressionStorageConfig = DefaultCompressionStorageConfig,\n): IDocumentServiceFactory {\n\tif (config.algorithm === undefined) {\n\t\treturn documentServiceFactory;\n\t}\n\treturn new constructor(documentServiceFactory, config);\n}\n\n/**\n * This method checks whether given objects contains\n * a properties expected for the interface ICompressionStorageConfig.\n */\nexport function isCompressionConfig(config: any): config is ICompressionStorageConfig {\n\treturn (\n\t\tconfig !== undefined &&\n\t\t(config.algorithm !== undefined || config.minSizeToCompress !== undefined)\n\t);\n}\n"]}
|
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
5
|
+
import { TypedEventEmitter } from "@fluid-internal/client-utils";
|
|
6
|
+
import { IDocumentDeltaConnection, IDocumentDeltaStorageService, IDocumentService, IDocumentServiceEvents, IDocumentStorageService, IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
6
7
|
import { IClient } from "@fluidframework/protocol-definitions";
|
|
7
8
|
/**
|
|
8
9
|
* This abstract class implements IDocumentService interface. It uses delegation pattern.
|
|
9
10
|
* It delegates all calls to IDocumentService implementation passed to constructor.
|
|
10
11
|
*/
|
|
11
|
-
export declare abstract class DocumentServiceProxy implements IDocumentService {
|
|
12
|
+
export declare abstract class DocumentServiceProxy extends TypedEventEmitter<IDocumentServiceEvents> implements IDocumentService {
|
|
12
13
|
private readonly _service;
|
|
13
14
|
constructor(_service: IDocumentService);
|
|
14
15
|
get service(): IDocumentService;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D;;;GAGG;AAEH,8BAAsB,
|
|
1
|
+
{"version":3,"file":"documentServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACjE,OAAO,EACN,wBAAwB,EACxB,4BAA4B,EAC5B,gBAAgB,EAChB,sBAAsB,EACtB,uBAAuB,EACvB,YAAY,EACZ,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,OAAO,EAAE,MAAM,sCAAsC,CAAC;AAE/D;;;GAGG;AAEH,8BAAsB,oBACrB,SAAQ,iBAAiB,CAAC,sBAAsB,CAChD,YAAW,gBAAgB;IAEf,OAAO,CAAC,QAAQ,CAAC,QAAQ;gBAAR,QAAQ,EAAE,gBAAgB;IAIvD,IAAW,OAAO,IAAI,gBAAgB,CAErC;IAEY,gBAAgB,IAAI,OAAO,CAAC,uBAAuB,CAAC;IAIpD,qBAAqB,IAAI,OAAO,CAAC,4BAA4B,CAAC;IAI9D,oBAAoB,CAAC,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,wBAAwB,CAAC;IAI9E,OAAO,CAAC,KAAK,CAAC,EAAE,GAAG,GAAG,IAAI;IAIjC,IAAW,WAAW,IAAI,YAAY,CAErC;CACD"}
|
|
@@ -5,12 +5,14 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.DocumentServiceProxy = void 0;
|
|
8
|
+
const client_utils_1 = require("@fluid-internal/client-utils");
|
|
8
9
|
/**
|
|
9
10
|
* This abstract class implements IDocumentService interface. It uses delegation pattern.
|
|
10
11
|
* It delegates all calls to IDocumentService implementation passed to constructor.
|
|
11
12
|
*/
|
|
12
|
-
class DocumentServiceProxy {
|
|
13
|
+
class DocumentServiceProxy extends client_utils_1.TypedEventEmitter {
|
|
13
14
|
constructor(_service) {
|
|
15
|
+
super();
|
|
14
16
|
this._service = _service;
|
|
15
17
|
}
|
|
16
18
|
get service() {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentServiceProxy.js","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"documentServiceProxy.js","sourceRoot":"","sources":["../src/documentServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAEH,+DAAiE;AAWjE;;;GAGG;AAEH,MAAsB,oBACrB,SAAQ,gCAAyC;IAGjD,YAA6B,QAA0B;QACtD,KAAK,EAAE,CAAC;QADoB,aAAQ,GAAR,QAAQ,CAAkB;IAEvD,CAAC;IAED,IAAW,OAAO;QACjB,OAAO,IAAI,CAAC,QAAQ,CAAC;IACtB,CAAC;IAEM,KAAK,CAAC,gBAAgB;QAC5B,OAAO,IAAI,CAAC,QAAQ,CAAC,gBAAgB,EAAE,CAAC;IACzC,CAAC;IAEM,KAAK,CAAC,qBAAqB;QACjC,OAAO,IAAI,CAAC,QAAQ,CAAC,qBAAqB,EAAE,CAAC;IAC9C,CAAC;IAEM,KAAK,CAAC,oBAAoB,CAAC,MAAe;QAChD,OAAO,IAAI,CAAC,QAAQ,CAAC,oBAAoB,CAAC,MAAM,CAAC,CAAC;IACnD,CAAC;IAEM,OAAO,CAAC,KAAW;QACzB,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAED,IAAW,WAAW;QACrB,OAAO,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC;IAClC,CAAC;CACD;AA/BD,oDA+BC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { TypedEventEmitter } from \"@fluid-internal/client-utils\";\nimport {\n\tIDocumentDeltaConnection,\n\tIDocumentDeltaStorageService,\n\tIDocumentService,\n\tIDocumentServiceEvents,\n\tIDocumentStorageService,\n\tIResolvedUrl,\n} from \"@fluidframework/driver-definitions\";\nimport { IClient } from \"@fluidframework/protocol-definitions\";\n\n/**\n * This abstract class implements IDocumentService interface. It uses delegation pattern.\n * It delegates all calls to IDocumentService implementation passed to constructor.\n */\n\nexport abstract class DocumentServiceProxy\n\textends TypedEventEmitter<IDocumentServiceEvents>\n\timplements IDocumentService\n{\n\tconstructor(private readonly _service: IDocumentService) {\n\t\tsuper();\n\t}\n\n\tpublic get service(): IDocumentService {\n\t\treturn this._service;\n\t}\n\n\tpublic async connectToStorage(): Promise<IDocumentStorageService> {\n\t\treturn this._service.connectToStorage();\n\t}\n\n\tpublic async connectToDeltaStorage(): Promise<IDocumentDeltaStorageService> {\n\t\treturn this._service.connectToDeltaStorage();\n\t}\n\n\tpublic async connectToDeltaStream(client: IClient): Promise<IDocumentDeltaConnection> {\n\t\treturn this._service.connectToDeltaStream(client);\n\t}\n\n\tpublic dispose(error?: any): void {\n\t\tthis._service.dispose(error);\n\t}\n\n\tpublic get resolvedUrl(): IResolvedUrl {\n\t\treturn this._service.resolvedUrl;\n\t}\n}\n"]}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { FetchSource, IDocumentStorageService, IDocumentStorageServicePolicies, ISnapshot, ISnapshotFetchOptions, ISummaryContext } from "@fluidframework/driver-definitions";
|
|
6
6
|
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
7
7
|
/**
|
|
8
8
|
* @internal
|
|
@@ -12,9 +12,9 @@ export declare class DocumentStorageServiceProxy implements IDocumentStorageServ
|
|
|
12
12
|
private _policies;
|
|
13
13
|
set policies(policies: IDocumentStorageServicePolicies | undefined);
|
|
14
14
|
get policies(): IDocumentStorageServicePolicies | undefined;
|
|
15
|
-
get repositoryUrl(): string;
|
|
16
15
|
constructor(internalStorageService: IDocumentStorageService);
|
|
17
16
|
getSnapshotTree(version?: IVersion, scenarioName?: string): Promise<ISnapshotTree | null>;
|
|
17
|
+
getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot>;
|
|
18
18
|
getVersions(versionId: string | null, count: number, scenarioName?: string, fetchSource?: FetchSource): Promise<IVersion[]>;
|
|
19
19
|
uploadSummaryWithContext(summary: ISummaryTree, context: ISummaryContext): Promise<string>;
|
|
20
20
|
downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.d.ts","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,WAAW,EACX,uBAAuB,EACvB,+BAA+B,EAC/B,SAAS,EACT,qBAAqB,EACrB,eAAe,EACf,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAG9C;;GAEG;AACH,qBAAa,2BAA4B,YAAW,uBAAuB;IAW9D,SAAS,CAAC,QAAQ,CAAC,sBAAsB,EAAE,uBAAuB;IAV9E,OAAO,CAAC,SAAS,CAA8C;IAE/D,IAAW,QAAQ,CAAC,QAAQ,EAAE,+BAA+B,GAAG,SAAS,EAExE;IAED,IAAW,QAAQ,IAJW,+BAA+B,GAAG,SAAS,CAMxE;gBAE8B,sBAAsB,EAAE,uBAAuB;IAEjE,eAAe,CAC3B,OAAO,CAAC,EAAE,QAAQ,EAClB,YAAY,CAAC,EAAE,MAAM,GACnB,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;IAInB,WAAW,CAAC,oBAAoB,CAAC,EAAE,qBAAqB,GAAG,OAAO,CAAC,SAAS,CAAC;IAS7E,WAAW,CACvB,SAAS,EAAE,MAAM,GAAG,IAAI,EACxB,KAAK,EAAE,MAAM,EACb,YAAY,CAAC,EAAE,MAAM,EACrB,WAAW,CAAC,EAAE,WAAW,GACvB,OAAO,CAAC,QAAQ,EAAE,CAAC;IAIT,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAIL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;IAI/D,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;CAG/D"}
|
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
*/
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
7
|
exports.DocumentStorageServiceProxy = void 0;
|
|
8
|
+
const telemetry_utils_1 = require("@fluidframework/telemetry-utils");
|
|
8
9
|
/**
|
|
9
10
|
* @internal
|
|
10
11
|
*/
|
|
@@ -15,15 +16,18 @@ class DocumentStorageServiceProxy {
|
|
|
15
16
|
get policies() {
|
|
16
17
|
return this._policies ?? this.internalStorageService.policies;
|
|
17
18
|
}
|
|
18
|
-
get repositoryUrl() {
|
|
19
|
-
return this.internalStorageService.repositoryUrl;
|
|
20
|
-
}
|
|
21
19
|
constructor(internalStorageService) {
|
|
22
20
|
this.internalStorageService = internalStorageService;
|
|
23
21
|
}
|
|
24
22
|
async getSnapshotTree(version, scenarioName) {
|
|
25
23
|
return this.internalStorageService.getSnapshotTree(version, scenarioName);
|
|
26
24
|
}
|
|
25
|
+
async getSnapshot(snapshotFetchOptions) {
|
|
26
|
+
if (this.internalStorageService.getSnapshot !== undefined) {
|
|
27
|
+
return this.internalStorageService.getSnapshot(snapshotFetchOptions);
|
|
28
|
+
}
|
|
29
|
+
throw new telemetry_utils_1.UsageError("getSnapshot api should exist on internal storage in documentStorageServiceProxy class");
|
|
30
|
+
}
|
|
27
31
|
async getVersions(versionId, count, scenarioName, fetchSource) {
|
|
28
32
|
return this.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource);
|
|
29
33
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;
|
|
1
|
+
{"version":3,"file":"documentStorageServiceProxy.js","sourceRoot":"","sources":["../src/documentStorageServiceProxy.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;AAiBH,qEAA6D;AAE7D;;GAEG;AACH,MAAa,2BAA2B;IAGvC,IAAW,QAAQ,CAAC,QAAqD;QACxE,IAAI,CAAC,SAAS,GAAG,QAAQ,CAAC;IAC3B,CAAC;IAED,IAAW,QAAQ;QAClB,OAAO,IAAI,CAAC,SAAS,IAAI,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC;IAC/D,CAAC;IAED,YAA+B,sBAA+C;QAA/C,2BAAsB,GAAtB,sBAAsB,CAAyB;IAAG,CAAC;IAE3E,KAAK,CAAC,eAAe,CAC3B,OAAkB,EAClB,YAAqB;QAErB,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC3E,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,oBAA4C;QACpE,IAAI,IAAI,CAAC,sBAAsB,CAAC,WAAW,KAAK,SAAS,EAAE;YAC1D,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,oBAAoB,CAAC,CAAC;SACrE;QACD,MAAM,IAAI,4BAAU,CACnB,uFAAuF,CACvF,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CACvB,SAAwB,EACxB,KAAa,EACb,YAAqB,EACrB,WAAyB;QAEzB,OAAO,IAAI,CAAC,sBAAsB,CAAC,WAAW,CAAC,SAAS,EAAE,KAAK,EAAE,YAAY,EAAE,WAAW,CAAC,CAAC;IAC7F,CAAC;IAEM,KAAK,CAAC,wBAAwB,CACpC,OAAqB,EACrB,OAAwB;QAExB,OAAO,IAAI,CAAC,sBAAsB,CAAC,wBAAwB,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IAC/E,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,MAAsB;QAClD,OAAO,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,MAAM,CAAC,CAAC;IAC5D,CAAC;IAEM,KAAK,CAAC,UAAU,CAAC,IAAqB;QAC5C,OAAO,IAAI,CAAC,sBAAsB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACrD,CAAC;IAEM,KAAK,CAAC,QAAQ,CAAC,MAAc;QACnC,OAAO,IAAI,CAAC,sBAAsB,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;IACrD,CAAC;CACD;AAxDD,kEAwDC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tFetchSource,\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISnapshot,\n\tISnapshotFetchOptions,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { UsageError } from \"@fluidframework/telemetry-utils\";\n\n/**\n * @internal\n */\nexport class DocumentStorageServiceProxy implements IDocumentStorageService {\n\tprivate _policies: IDocumentStorageServicePolicies | undefined;\n\n\tpublic set policies(policies: IDocumentStorageServicePolicies | undefined) {\n\t\tthis._policies = policies;\n\t}\n\n\tpublic get policies() {\n\t\treturn this._policies ?? this.internalStorageService.policies;\n\t}\n\n\tconstructor(protected readonly internalStorageService: IDocumentStorageService) {}\n\n\tpublic async getSnapshotTree(\n\t\tversion?: IVersion,\n\t\tscenarioName?: string,\n\t): Promise<ISnapshotTree | null> {\n\t\treturn this.internalStorageService.getSnapshotTree(version, scenarioName);\n\t}\n\n\tpublic async getSnapshot(snapshotFetchOptions?: ISnapshotFetchOptions): Promise<ISnapshot> {\n\t\tif (this.internalStorageService.getSnapshot !== undefined) {\n\t\t\treturn this.internalStorageService.getSnapshot(snapshotFetchOptions);\n\t\t}\n\t\tthrow new UsageError(\n\t\t\t\"getSnapshot api should exist on internal storage in documentStorageServiceProxy class\",\n\t\t);\n\t}\n\n\tpublic async getVersions(\n\t\tversionId: string | null,\n\t\tcount: number,\n\t\tscenarioName?: string,\n\t\tfetchSource?: FetchSource,\n\t): Promise<IVersion[]> {\n\t\treturn this.internalStorageService.getVersions(versionId, count, scenarioName, fetchSource);\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\treturn this.internalStorageService.uploadSummaryWithContext(summary, context);\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\treturn this.internalStorageService.downloadSummary(handle);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\treturn this.internalStorageService.createBlob(file);\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\treturn this.internalStorageService.readBlob(blobId);\n\t}\n}\n"]}
|
|
@@ -16,15 +16,17 @@ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
|
|
|
16
16
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
17
17
|
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
18
18
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISnapshot } from '@fluidframework/driver-definitions';
|
|
20
|
+
import { ISnapshotFetchOptions } from '@fluidframework/driver-definitions';
|
|
19
21
|
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
20
22
|
import { IStream } from '@fluidframework/driver-definitions';
|
|
21
23
|
import { IStreamResult } from '@fluidframework/driver-definitions';
|
|
22
24
|
import { ISummaryContext } from '@fluidframework/driver-definitions';
|
|
23
25
|
import { ISummaryHandle } from '@fluidframework/protocol-definitions';
|
|
24
26
|
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
25
|
-
import {
|
|
27
|
+
import { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
|
|
28
|
+
import { ITelemetryErrorEventExt } from '@fluidframework/telemetry-utils';
|
|
26
29
|
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
27
|
-
import { ITelemetryProperties } from '@fluidframework/core-interfaces';
|
|
28
30
|
import { IThrottlingWarning } from '@fluidframework/driver-definitions';
|
|
29
31
|
import { ITree } from '@fluidframework/protocol-definitions';
|
|
30
32
|
import { ITreeEntry } from '@fluidframework/protocol-definitions';
|
|
@@ -97,6 +99,8 @@ export declare interface ICompressionStorageConfig {
|
|
|
97
99
|
|
|
98
100
|
/* Excluded from this release type: isCombinedAppAndProtocolSummary */
|
|
99
101
|
|
|
102
|
+
/* Excluded from this release type: isInstanceOfISnapshot */
|
|
103
|
+
|
|
100
104
|
/* Excluded from this release type: isOnline */
|
|
101
105
|
|
|
102
106
|
/* Excluded from this release type: isRuntimeMessage */
|
|
@@ -16,15 +16,17 @@ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
|
|
|
16
16
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
17
17
|
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
18
18
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISnapshot } from '@fluidframework/driver-definitions';
|
|
20
|
+
import { ISnapshotFetchOptions } from '@fluidframework/driver-definitions';
|
|
19
21
|
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
20
22
|
import { IStream } from '@fluidframework/driver-definitions';
|
|
21
23
|
import { IStreamResult } from '@fluidframework/driver-definitions';
|
|
22
24
|
import { ISummaryContext } from '@fluidframework/driver-definitions';
|
|
23
25
|
import { ISummaryHandle } from '@fluidframework/protocol-definitions';
|
|
24
26
|
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
25
|
-
import {
|
|
27
|
+
import { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
|
|
28
|
+
import { ITelemetryErrorEventExt } from '@fluidframework/telemetry-utils';
|
|
26
29
|
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
27
|
-
import { ITelemetryProperties } from '@fluidframework/core-interfaces';
|
|
28
30
|
import { IThrottlingWarning } from '@fluidframework/driver-definitions';
|
|
29
31
|
import { ITree } from '@fluidframework/protocol-definitions';
|
|
30
32
|
import { ITreeEntry } from '@fluidframework/protocol-definitions';
|
|
@@ -111,6 +113,12 @@ export declare interface ICompressionStorageConfig {
|
|
|
111
113
|
|
|
112
114
|
/* Excluded from this release type: isCombinedAppAndProtocolSummary */
|
|
113
115
|
|
|
116
|
+
/* Excluded from this release type: isInstanceOfISnapshot */
|
|
117
|
+
|
|
118
|
+
/* Excluded from this release type: ISnapshot */
|
|
119
|
+
|
|
120
|
+
/* Excluded from this release type: ISnapshotFetchOptions */
|
|
121
|
+
|
|
114
122
|
/* Excluded from this release type: isOnline */
|
|
115
123
|
|
|
116
124
|
/* Excluded from this release type: isRuntimeMessage */
|
|
@@ -16,15 +16,17 @@ import { ILocationRedirectionError } from '@fluidframework/driver-definitions';
|
|
|
16
16
|
import { IRequest } from '@fluidframework/core-interfaces';
|
|
17
17
|
import { IResolvedUrl } from '@fluidframework/driver-definitions';
|
|
18
18
|
import { ISequencedDocumentMessage } from '@fluidframework/protocol-definitions';
|
|
19
|
+
import { ISnapshot } from '@fluidframework/driver-definitions';
|
|
20
|
+
import { ISnapshotFetchOptions } from '@fluidframework/driver-definitions';
|
|
19
21
|
import { ISnapshotTree } from '@fluidframework/protocol-definitions';
|
|
20
22
|
import { IStream } from '@fluidframework/driver-definitions';
|
|
21
23
|
import { IStreamResult } from '@fluidframework/driver-definitions';
|
|
22
24
|
import { ISummaryContext } from '@fluidframework/driver-definitions';
|
|
23
25
|
import { ISummaryHandle } from '@fluidframework/protocol-definitions';
|
|
24
26
|
import { ISummaryTree } from '@fluidframework/protocol-definitions';
|
|
25
|
-
import {
|
|
27
|
+
import { ITelemetryBaseProperties } from '@fluidframework/core-interfaces';
|
|
28
|
+
import { ITelemetryErrorEventExt } from '@fluidframework/telemetry-utils';
|
|
26
29
|
import { ITelemetryLoggerExt } from '@fluidframework/telemetry-utils';
|
|
27
|
-
import { ITelemetryProperties } from '@fluidframework/core-interfaces';
|
|
28
30
|
import { IThrottlingWarning } from '@fluidframework/driver-definitions';
|
|
29
31
|
import { ITree } from '@fluidframework/protocol-definitions';
|
|
30
32
|
import { ITreeEntry } from '@fluidframework/protocol-definitions';
|
|
@@ -111,6 +113,12 @@ export declare interface ICompressionStorageConfig {
|
|
|
111
113
|
|
|
112
114
|
/* Excluded from this release type: isCombinedAppAndProtocolSummary */
|
|
113
115
|
|
|
116
|
+
/* Excluded from this release type: isInstanceOfISnapshot */
|
|
117
|
+
|
|
118
|
+
/* Excluded from this release type: ISnapshot */
|
|
119
|
+
|
|
120
|
+
/* Excluded from this release type: ISnapshotFetchOptions */
|
|
121
|
+
|
|
114
122
|
/* Excluded from this release type: isOnline */
|
|
115
123
|
|
|
116
124
|
/* Excluded from this release type: isRuntimeMessage */
|