@fluidframework/routerlicious-driver 2.0.0-rc.2.0.2 → 2.0.0-rc.3.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/CHANGELOG.md +23 -0
- package/api-extractor-lint.json +1 -1
- package/api-extractor.json +1 -1
- package/api-report/routerlicious-driver.api.md +3 -3
- package/beta.d.ts +11 -0
- package/{lib/storageContracts.mjs → dist/axios.cjs} +3 -2
- package/dist/axios.cjs.map +1 -0
- package/dist/axios.d.cts +7 -0
- package/dist/axios.d.cts.map +1 -0
- package/dist/beta.d.ts +15 -0
- package/dist/cache.js +2 -2
- package/dist/cache.js.map +1 -1
- package/dist/defaultTokenProvider.d.ts +1 -1
- package/dist/defaultTokenProvider.d.ts.map +1 -1
- package/dist/defaultTokenProvider.js.map +1 -1
- package/dist/deltaStorageService.d.ts +3 -3
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/deltaStorageService.js +12 -12
- package/dist/deltaStorageService.js.map +1 -1
- package/dist/documentDeltaConnection.d.ts +4 -3
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/documentDeltaConnection.js +6 -6
- package/dist/documentDeltaConnection.js.map +1 -1
- package/dist/documentService.d.ts +7 -7
- package/dist/documentService.d.ts.map +1 -1
- package/dist/documentService.js +30 -31
- package/dist/documentService.js.map +1 -1
- package/dist/documentServiceFactory.d.ts +3 -3
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/documentServiceFactory.js +43 -43
- package/dist/documentServiceFactory.js.map +1 -1
- package/dist/documentStorageService.d.ts +8 -8
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/documentStorageService.js +9 -9
- package/dist/documentStorageService.js.map +1 -1
- package/dist/errorUtils.d.ts +4 -3
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/errorUtils.js +8 -9
- package/dist/errorUtils.js.map +1 -1
- package/dist/gitManager.d.ts +3 -3
- package/dist/gitManager.d.ts.map +1 -1
- package/dist/gitManager.js.map +1 -1
- package/dist/historian.d.ts +4 -4
- package/dist/historian.d.ts.map +1 -1
- package/dist/historian.js.map +1 -1
- package/dist/index.d.ts +6 -6
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -7
- package/dist/index.js.map +1 -1
- package/dist/legacy.d.ts +18 -0
- package/dist/mapWithExpiration.js +2 -2
- package/dist/mapWithExpiration.js.map +1 -1
- package/dist/nullBlobStorageService.d.ts +1 -1
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/nullBlobStorageService.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/public.d.ts +15 -0
- package/dist/r11sSnapshotParser.d.ts +1 -1
- package/dist/r11sSnapshotParser.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.js.map +1 -1
- package/dist/restWrapper.d.ts +4 -4
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapper.js +16 -16
- package/dist/restWrapper.js.map +1 -1
- package/dist/restWrapperBase.d.ts +2 -2
- package/dist/restWrapperBase.d.ts.map +1 -1
- package/dist/restWrapperBase.js.map +1 -1
- package/dist/retriableGitManager.d.ts +3 -3
- package/dist/retriableGitManager.d.ts.map +1 -1
- package/dist/retriableGitManager.js +2 -2
- package/dist/retriableGitManager.js.map +1 -1
- package/dist/routerliciousResolvedUrl.d.ts +1 -1
- package/dist/routerliciousResolvedUrl.d.ts.map +1 -1
- package/dist/routerliciousResolvedUrl.js.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.d.ts +6 -6
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/shreddedSummaryDocumentStorageService.js +13 -13
- package/dist/shreddedSummaryDocumentStorageService.js.map +1 -1
- package/dist/storageContracts.d.ts +2 -2
- package/dist/storageContracts.d.ts.map +1 -1
- package/dist/storageContracts.js.map +1 -1
- package/dist/summaryTreeUploadManager.d.ts +1 -1
- package/dist/summaryTreeUploadManager.d.ts.map +1 -1
- package/dist/summaryTreeUploadManager.js +6 -6
- package/dist/summaryTreeUploadManager.js.map +1 -1
- package/dist/treeUtils.d.ts +2 -2
- package/dist/treeUtils.d.ts.map +1 -1
- package/dist/treeUtils.js +4 -4
- package/dist/treeUtils.js.map +1 -1
- package/dist/urlUtils.d.ts +1 -1
- package/dist/urlUtils.d.ts.map +1 -1
- package/dist/urlUtils.js.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.d.ts +6 -6
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.js +25 -25
- package/dist/wholeSummaryDocumentStorageService.js.map +1 -1
- package/dist/wholeSummaryUploadManager.d.ts +1 -1
- package/dist/wholeSummaryUploadManager.d.ts.map +1 -1
- package/dist/wholeSummaryUploadManager.js.map +1 -1
- package/internal.d.ts +11 -0
- package/legacy.d.ts +11 -0
- package/lib/axios.cjs +7 -0
- package/lib/axios.cjs.map +1 -0
- package/lib/axios.d.cts +7 -0
- package/lib/axios.d.cts.map +1 -0
- package/lib/beta.d.ts +15 -0
- package/lib/{cache.d.mts → cache.d.ts} +1 -1
- package/lib/cache.d.ts.map +1 -0
- package/lib/{cache.mjs → cache.js} +2 -2
- package/lib/cache.js.map +1 -0
- package/lib/{contracts.d.mts → contracts.d.ts} +1 -1
- package/lib/contracts.d.ts.map +1 -0
- package/lib/{policies.mjs → contracts.js} +1 -1
- package/lib/contracts.js.map +1 -0
- package/lib/{createNewUtils.d.mts → createNewUtils.d.ts} +1 -1
- package/lib/createNewUtils.d.ts.map +1 -0
- package/lib/{createNewUtils.mjs → createNewUtils.js} +1 -1
- package/lib/createNewUtils.js.map +1 -0
- package/lib/{defaultTokenProvider.d.mts → defaultTokenProvider.d.ts} +2 -2
- package/lib/defaultTokenProvider.d.ts.map +1 -0
- package/lib/{defaultTokenProvider.mjs → defaultTokenProvider.js} +1 -1
- package/lib/defaultTokenProvider.js.map +1 -0
- package/lib/{definitions.d.mts → definitions.d.ts} +1 -1
- package/lib/definitions.d.ts.map +1 -0
- package/lib/{definitions.mjs → definitions.js} +1 -1
- package/lib/definitions.js.map +1 -0
- package/lib/{deltaStorageService.d.mts → deltaStorageService.d.ts} +4 -4
- package/lib/deltaStorageService.d.ts.map +1 -0
- package/lib/{deltaStorageService.mjs → deltaStorageService.js} +4 -4
- package/lib/deltaStorageService.js.map +1 -0
- package/lib/{documentDeltaConnection.d.mts → documentDeltaConnection.d.ts} +5 -4
- package/lib/documentDeltaConnection.d.ts.map +1 -0
- package/lib/{documentDeltaConnection.mjs → documentDeltaConnection.js} +4 -4
- package/lib/documentDeltaConnection.js.map +1 -0
- package/lib/{documentService.d.mts → documentService.d.ts} +8 -8
- package/lib/documentService.d.ts.map +1 -0
- package/lib/{documentService.mjs → documentService.js} +13 -14
- package/lib/documentService.js.map +1 -0
- package/lib/{documentServiceFactory.d.mts → documentServiceFactory.d.ts} +4 -4
- package/lib/documentServiceFactory.d.ts.map +1 -0
- package/lib/{documentServiceFactory.mjs → documentServiceFactory.js} +12 -12
- package/lib/documentServiceFactory.js.map +1 -0
- package/lib/{documentStorageService.d.mts → documentStorageService.d.ts} +9 -9
- package/lib/documentStorageService.d.ts.map +1 -0
- package/lib/{documentStorageService.mjs → documentStorageService.js} +5 -5
- package/lib/documentStorageService.js.map +1 -0
- package/lib/{errorUtils.d.mts → errorUtils.d.ts} +5 -4
- package/lib/errorUtils.d.ts.map +1 -0
- package/lib/{errorUtils.mjs → errorUtils.js} +4 -5
- package/lib/errorUtils.js.map +1 -0
- package/lib/{gitManager.d.mts → gitManager.d.ts} +4 -4
- package/lib/gitManager.d.ts.map +1 -0
- package/lib/{gitManager.mjs → gitManager.js} +1 -1
- package/lib/gitManager.js.map +1 -0
- package/lib/{historian.d.mts → historian.d.ts} +5 -5
- package/lib/historian.d.ts.map +1 -0
- package/lib/{historian.mjs → historian.js} +1 -1
- package/lib/historian.js.map +1 -0
- package/lib/{index.d.mts → index.d.ts} +7 -7
- package/lib/index.d.ts.map +1 -0
- package/lib/index.js +11 -0
- package/lib/index.js.map +1 -0
- package/lib/legacy.d.ts +18 -0
- package/lib/{mapWithExpiration.d.mts → mapWithExpiration.d.ts} +1 -1
- package/lib/mapWithExpiration.d.ts.map +1 -0
- package/lib/{mapWithExpiration.mjs → mapWithExpiration.js} +2 -2
- package/lib/mapWithExpiration.js.map +1 -0
- package/lib/{nullBlobStorageService.d.mts → nullBlobStorageService.d.ts} +2 -2
- package/lib/nullBlobStorageService.d.ts.map +1 -0
- package/lib/{nullBlobStorageService.mjs → nullBlobStorageService.js} +1 -1
- package/lib/nullBlobStorageService.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/{policies.d.mts → policies.d.ts} +1 -1
- package/lib/policies.d.ts.map +1 -0
- package/lib/{contracts.mjs → policies.js} +1 -1
- package/lib/policies.js.map +1 -0
- package/lib/public.d.ts +15 -0
- package/lib/{r11sSnapshotParser.d.mts → r11sSnapshotParser.d.ts} +2 -2
- package/lib/r11sSnapshotParser.d.ts.map +1 -0
- package/lib/{r11sSnapshotParser.mjs → r11sSnapshotParser.js} +1 -1
- package/lib/r11sSnapshotParser.js.map +1 -0
- package/lib/{restWrapper.d.mts → restWrapper.d.ts} +5 -5
- package/lib/restWrapper.d.ts.map +1 -0
- package/lib/{restWrapper.mjs → restWrapper.js} +8 -8
- package/lib/restWrapper.js.map +1 -0
- package/lib/{restWrapperBase.d.mts → restWrapperBase.d.ts} +3 -3
- package/lib/restWrapperBase.d.ts.map +1 -0
- package/lib/{restWrapperBase.mjs → restWrapperBase.js} +1 -1
- package/lib/restWrapperBase.js.map +1 -0
- package/lib/{retriableGitManager.d.mts → retriableGitManager.d.ts} +4 -4
- package/lib/retriableGitManager.d.ts.map +1 -0
- package/lib/{retriableGitManager.mjs → retriableGitManager.js} +2 -2
- package/lib/retriableGitManager.js.map +1 -0
- package/lib/{routerliciousResolvedUrl.d.mts → routerliciousResolvedUrl.d.ts} +2 -2
- package/lib/routerliciousResolvedUrl.d.ts.map +1 -0
- package/lib/{routerliciousResolvedUrl.mjs → routerliciousResolvedUrl.js} +1 -1
- package/lib/routerliciousResolvedUrl.js.map +1 -0
- package/lib/{shreddedSummaryDocumentStorageService.d.mts → shreddedSummaryDocumentStorageService.d.ts} +7 -7
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +1 -0
- package/lib/{shreddedSummaryDocumentStorageService.mjs → shreddedSummaryDocumentStorageService.js} +6 -6
- package/lib/shreddedSummaryDocumentStorageService.js.map +1 -0
- package/lib/{storageContracts.d.mts → storageContracts.d.ts} +3 -3
- package/lib/storageContracts.d.ts.map +1 -0
- package/lib/storageContracts.js +6 -0
- package/lib/storageContracts.js.map +1 -0
- package/lib/{summaryTreeUploadManager.d.mts → summaryTreeUploadManager.d.ts} +2 -2
- package/lib/summaryTreeUploadManager.d.ts.map +1 -0
- package/lib/{summaryTreeUploadManager.mjs → summaryTreeUploadManager.js} +3 -3
- package/lib/summaryTreeUploadManager.js.map +1 -0
- package/lib/{tokens.d.mts → tokens.d.ts} +1 -1
- package/lib/tokens.d.ts.map +1 -0
- package/lib/{tokens.mjs → tokens.js} +1 -1
- package/lib/tokens.js.map +1 -0
- package/lib/{treeUtils.d.mts → treeUtils.d.ts} +3 -3
- package/lib/treeUtils.d.ts.map +1 -0
- package/lib/{treeUtils.mjs → treeUtils.js} +2 -2
- package/lib/treeUtils.js.map +1 -0
- package/lib/{urlUtils.d.mts → urlUtils.d.ts} +2 -2
- package/lib/urlUtils.d.ts.map +1 -0
- package/lib/{urlUtils.mjs → urlUtils.js} +1 -1
- package/lib/urlUtils.js.map +1 -0
- package/lib/{wholeSummaryDocumentStorageService.d.mts → wholeSummaryDocumentStorageService.d.ts} +7 -7
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +1 -0
- package/lib/{wholeSummaryDocumentStorageService.mjs → wholeSummaryDocumentStorageService.js} +9 -9
- package/lib/wholeSummaryDocumentStorageService.js.map +1 -0
- package/lib/{wholeSummaryUploadManager.d.mts → wholeSummaryUploadManager.d.ts} +2 -2
- package/lib/wholeSummaryUploadManager.d.ts.map +1 -0
- package/lib/{wholeSummaryUploadManager.mjs → wholeSummaryUploadManager.js} +1 -1
- package/lib/wholeSummaryUploadManager.js.map +1 -0
- package/package.json +50 -68
- package/src/axios.cts +8 -0
- package/src/cache.ts +1 -1
- package/src/defaultTokenProvider.ts +1 -1
- package/src/deltaStorageService.ts +11 -9
- package/src/documentDeltaConnection.ts +7 -5
- package/src/documentService.ts +26 -20
- package/src/documentServiceFactory.ts +19 -18
- package/src/documentStorageService.ts +12 -11
- package/src/errorUtils.ts +9 -12
- package/src/gitManager.ts +4 -3
- package/src/historian.ts +5 -4
- package/src/index.ts +6 -6
- package/src/mapWithExpiration.ts +1 -1
- package/src/nullBlobStorageService.ts +4 -1
- package/src/packageVersion.ts +1 -1
- package/src/r11sSnapshotParser.ts +7 -2
- package/src/restWrapper.ts +15 -13
- package/src/restWrapperBase.ts +2 -2
- package/src/retriableGitManager.ts +5 -4
- package/src/routerliciousResolvedUrl.ts +1 -1
- package/src/shreddedSummaryDocumentStorageService.ts +17 -16
- package/src/storageContracts.ts +3 -2
- package/src/summaryTreeUploadManager.ts +4 -3
- package/src/treeUtils.ts +4 -3
- package/src/urlUtils.ts +1 -1
- package/src/wholeSummaryDocumentStorageService.ts +21 -20
- package/src/wholeSummaryUploadManager.ts +2 -1
- package/tsconfig.cjs.json +7 -0
- package/tsconfig.json +2 -5
- package/api-extractor-esm.json +0 -4
- package/dist/routerlicious-driver-alpha.d.ts +0 -113
- package/dist/routerlicious-driver-beta.d.ts +0 -97
- package/dist/routerlicious-driver-public.d.ts +0 -97
- package/dist/routerlicious-driver-untrimmed.d.ts +0 -260
- package/lib/cache.d.mts.map +0 -1
- package/lib/cache.mjs.map +0 -1
- package/lib/contracts.d.mts.map +0 -1
- package/lib/contracts.mjs.map +0 -1
- package/lib/createNewUtils.d.mts.map +0 -1
- package/lib/createNewUtils.mjs.map +0 -1
- package/lib/defaultTokenProvider.d.mts.map +0 -1
- package/lib/defaultTokenProvider.mjs.map +0 -1
- package/lib/definitions.d.mts.map +0 -1
- package/lib/definitions.mjs.map +0 -1
- package/lib/deltaStorageService.d.mts.map +0 -1
- package/lib/deltaStorageService.mjs.map +0 -1
- package/lib/documentDeltaConnection.d.mts.map +0 -1
- package/lib/documentDeltaConnection.mjs.map +0 -1
- package/lib/documentService.d.mts.map +0 -1
- package/lib/documentService.mjs.map +0 -1
- package/lib/documentServiceFactory.d.mts.map +0 -1
- package/lib/documentServiceFactory.mjs.map +0 -1
- package/lib/documentStorageService.d.mts.map +0 -1
- package/lib/documentStorageService.mjs.map +0 -1
- package/lib/errorUtils.d.mts.map +0 -1
- package/lib/errorUtils.mjs.map +0 -1
- package/lib/gitManager.d.mts.map +0 -1
- package/lib/gitManager.mjs.map +0 -1
- package/lib/historian.d.mts.map +0 -1
- package/lib/historian.mjs.map +0 -1
- package/lib/index.d.mts.map +0 -1
- package/lib/index.mjs +0 -8
- package/lib/index.mjs.map +0 -1
- package/lib/mapWithExpiration.d.mts.map +0 -1
- package/lib/mapWithExpiration.mjs.map +0 -1
- package/lib/nullBlobStorageService.d.mts.map +0 -1
- package/lib/nullBlobStorageService.mjs.map +0 -1
- package/lib/packageVersion.d.mts.map +0 -1
- package/lib/packageVersion.mjs.map +0 -1
- package/lib/policies.d.mts.map +0 -1
- package/lib/policies.mjs.map +0 -1
- package/lib/r11sSnapshotParser.d.mts.map +0 -1
- package/lib/r11sSnapshotParser.mjs.map +0 -1
- package/lib/restWrapper.d.mts.map +0 -1
- package/lib/restWrapper.mjs.map +0 -1
- package/lib/restWrapperBase.d.mts.map +0 -1
- package/lib/restWrapperBase.mjs.map +0 -1
- package/lib/retriableGitManager.d.mts.map +0 -1
- package/lib/retriableGitManager.mjs.map +0 -1
- package/lib/routerlicious-driver-alpha.d.mts +0 -113
- package/lib/routerlicious-driver-beta.d.mts +0 -97
- package/lib/routerlicious-driver-public.d.mts +0 -97
- package/lib/routerlicious-driver-untrimmed.d.mts +0 -260
- package/lib/routerliciousResolvedUrl.d.mts.map +0 -1
- package/lib/routerliciousResolvedUrl.mjs.map +0 -1
- package/lib/shreddedSummaryDocumentStorageService.d.mts.map +0 -1
- package/lib/shreddedSummaryDocumentStorageService.mjs.map +0 -1
- package/lib/storageContracts.d.mts.map +0 -1
- package/lib/storageContracts.mjs.map +0 -1
- package/lib/summaryTreeUploadManager.d.mts.map +0 -1
- package/lib/summaryTreeUploadManager.mjs.map +0 -1
- package/lib/tokens.d.mts.map +0 -1
- package/lib/tokens.mjs.map +0 -1
- package/lib/treeUtils.d.mts.map +0 -1
- package/lib/treeUtils.mjs.map +0 -1
- package/lib/urlUtils.d.mts.map +0 -1
- package/lib/urlUtils.mjs.map +0 -1
- package/lib/wholeSummaryDocumentStorageService.d.mts.map +0 -1
- package/lib/wholeSummaryDocumentStorageService.mjs.map +0 -1
- package/lib/wholeSummaryUploadManager.d.mts.map +0 -1
- package/lib/wholeSummaryUploadManager.mjs.map +0 -1
- /package/{dist → lib}/tsdoc-metadata.json +0 -0
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
import type * as git from "@fluidframework/gitresources";
|
|
6
6
|
import { IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
7
|
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
|
-
import {
|
|
9
|
-
import { IR11sResponse } from "./restWrapper.
|
|
10
|
-
import {
|
|
8
|
+
import { IWholeFlatSnapshot } from "./contracts.js";
|
|
9
|
+
import { IR11sResponse } from "./restWrapper.js";
|
|
10
|
+
import { IGitManager } from "./storageContracts.js";
|
|
11
11
|
export declare class RetriableGitManager implements IGitManager {
|
|
12
12
|
private readonly internalGitManager;
|
|
13
13
|
private readonly logger;
|
|
@@ -21,4 +21,4 @@ export declare class RetriableGitManager implements IGitManager {
|
|
|
21
21
|
getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
|
|
22
22
|
private runWithRetry;
|
|
23
23
|
}
|
|
24
|
-
//# sourceMappingURL=retriableGitManager.d.
|
|
24
|
+
//# sourceMappingURL=retriableGitManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retriableGitManager.d.ts","sourceRoot":"","sources":["../src/retriableGitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,KAAK,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACzD,OAAO,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,MAAM,uBAAuB,CAAC;AAEpD,qBAAa,mBAAoB,YAAW,WAAW;IAErD,OAAO,CAAC,QAAQ,CAAC,kBAAkB;IACnC,OAAO,CAAC,QAAQ,CAAC,MAAM;gBADN,kBAAkB,EAAE,WAAW,EAC/B,MAAM,EAAE,mBAAmB;IAGhC,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,cAAc,EAAE,CAAC,CAAC;IAOlC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAO5E,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAOvD,UAAU,CACtB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,GACd,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC;IAOrC,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAO/E,aAAa,CACzB,OAAO,EAAE,oBAAoB,GAC3B,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAOnC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;YAOnE,YAAY;CAQ1B"}
|
|
@@ -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 { runWithRetry } from "@fluidframework/driver-utils";
|
|
5
|
+
import { runWithRetry } from "@fluidframework/driver-utils/internal";
|
|
6
6
|
export class RetriableGitManager {
|
|
7
7
|
constructor(internalGitManager, logger) {
|
|
8
8
|
this.internalGitManager = internalGitManager;
|
|
@@ -33,4 +33,4 @@ export class RetriableGitManager {
|
|
|
33
33
|
return runWithRetry(api, callName, this.logger, {});
|
|
34
34
|
}
|
|
35
35
|
}
|
|
36
|
-
//# sourceMappingURL=retriableGitManager.
|
|
36
|
+
//# sourceMappingURL=retriableGitManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"retriableGitManager.js","sourceRoot":"","sources":["../src/retriableGitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,uCAAuC,CAAC;AAYrE,MAAM,OAAO,mBAAmB;IAC/B,YACkB,kBAA+B,EAC/B,MAA2B;QAD3B,uBAAkB,GAAlB,kBAAkB,CAAa;QAC/B,WAAM,GAAN,MAAM,CAAqB;IAC1C,CAAC;IAEG,KAA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I,CAAC,YAAY,CACvB,KAAK,IAAI,EAAE,CAAC,IAAI,CAAC,kBAAkB,CAAC,WAAW,CAAC,GAAG,CAAC,EACpD,uBAAuB,CACvB,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,YAAY,CAAI,GAAqB,EAAE,QAAgB;QACpE,OAAO,YAAY,CAClB,GAAG,EACH,QAAQ,EACR,IAAI,CAAC,MAAM,EACX,EAAE,CACF,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { runWithRetry } from \"@fluidframework/driver-utils/internal\";\nimport type * as git from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\n\nimport { IWholeFlatSnapshot } from \"./contracts.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { IGitManager } from \"./storageContracts.js\";\n\nexport class RetriableGitManager implements IGitManager {\n\tconstructor(\n\t\tprivate readonly internalGitManager: IGitManager,\n\t\tprivate readonly logger: ITelemetryLoggerExt,\n\t) {}\n\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<git.ICommitDetails[]>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getCommits(sha, count),\n\t\t\t\"gitManager_getCommits\",\n\t\t);\n\t}\n\n\tpublic async getTree(root: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getTree(root, recursive),\n\t\t\t\"gitManager_getTree\",\n\t\t);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getBlob(sha),\n\t\t\t\"gitManager_getBlob\",\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: string,\n\t): Promise<IR11sResponse<git.ICreateBlobResponse>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.createBlob(content, encoding),\n\t\t\t\"gitManager_createBlob\",\n\t\t);\n\t}\n\n\tpublic async createGitTree(params: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.createGitTree(params),\n\t\t\t\"gitManager_createGitTree\",\n\t\t);\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.createSummary(summary),\n\t\t\t\"gitManager_createSummary\",\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.runWithRetry(\n\t\t\tasync () => this.internalGitManager.getSnapshot(sha),\n\t\t\t\"gitManager_getSummary\",\n\t\t);\n\t}\n\n\tprivate async runWithRetry<T>(api: () => Promise<T>, callName: string): Promise<T> {\n\t\treturn runWithRetry(\n\t\t\tapi,\n\t\t\tcallName,\n\t\t\tthis.logger,\n\t\t\t{}, // progress\n\t\t);\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 type { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
5
|
+
import type { IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
/**
|
|
7
7
|
* Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.
|
|
8
8
|
*
|
|
@@ -31,4 +31,4 @@ export interface IRouterliciousResolvedUrl extends IResolvedUrl {
|
|
|
31
31
|
* @internal
|
|
32
32
|
*/
|
|
33
33
|
export declare const isRouterliciousResolvedUrl: (resolvedUrl: IResolvedUrl) => resolvedUrl is IRouterliciousResolvedUrl;
|
|
34
|
-
//# sourceMappingURL=routerliciousResolvedUrl.d.
|
|
34
|
+
//# sourceMappingURL=routerliciousResolvedUrl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerliciousResolvedUrl.d.ts","sourceRoot":"","sources":["../src/routerliciousResolvedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAEhF;;;;;;;;GAQG;AACH,MAAM,WAAW,yBAA0B,SAAQ,YAAY;IAC9D;;OAEG;IACH,wBAAwB,EAAE,IAAI,CAAC;IAC/B;;;;;;OAMG;IACH,iBAAiB,CAAC,EAAE,OAAO,CAAC;CAC5B;AAED;;;GAGG;AACH,eAAO,MAAM,0BAA0B,gBACzB,YAAY,6CAEmD,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"routerliciousResolvedUrl.js","sourceRoot":"","sources":["../src/routerliciousResolvedUrl.ts"],"names":[],"mappings":"AAAA;;;GAGG;AA4BH;;;GAGG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAG,CACzC,WAAyB,EACkB,EAAE,CAC5C,WAAyC,CAAC,wBAAwB,KAAK,IAAI,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport type { IResolvedUrl } from \"@fluidframework/driver-definitions/internal\";\n\n/**\n * Routerlicious extends the resolved url with additional properties to control Routerlicious-specific behaviors.\n *\n * @privateRemarks\n * {@link isRouterliciousResolvedUrl} can be used to detect whether an {@link @fluidframework/driver-definitions#IResolvedUrl}\n * is an IRouterliciousResolvedUrl.\n *\n * @alpha\n */\nexport interface IRouterliciousResolvedUrl extends IResolvedUrl {\n\t/**\n\t * A flag to facilitate type narrowing from {@link @fluidframework/driver-definitions#IResolvedUrl} to IRouterliciousResolvedUrl.\n\t */\n\trouterliciousResolvedUrl: true;\n\t/**\n\t * Controls whether a newly created container will be ephemeral, which means the service will not retain it\n\t * after the collaboration session ends. Only affects\n\t * {@link @fluidframework/driver-definitions#IDocumentServiceFactory.createContainer} requests.\n\t *\n\t * @defaultValue If left undefined, treated as `false`\n\t */\n\tcreateAsEphemeral?: boolean;\n}\n\n/**\n * Type guard to detect if an IResolvedUrl is an IRouterliciousResolvedUrl.\n * @internal\n */\nexport const isRouterliciousResolvedUrl = (\n\tresolvedUrl: IResolvedUrl,\n): resolvedUrl is IRouterliciousResolvedUrl =>\n\t(resolvedUrl as IRouterliciousResolvedUrl).routerliciousResolvedUrl === true;\n"]}
|
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { IDocumentStorageService, ISummaryContext, IDocumentStorageServicePolicies } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions/internal";
|
|
7
6
|
import { ICreateBlobResponse, ISnapshotTreeEx, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import {
|
|
9
|
-
import { ICache } from "./cache.
|
|
10
|
-
import { ISnapshotTreeVersion } from "./definitions.
|
|
11
|
-
import { GitManager } from "./gitManager.
|
|
7
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { ICache } from "./cache.js";
|
|
9
|
+
import { ISnapshotTreeVersion } from "./definitions.js";
|
|
10
|
+
import { GitManager } from "./gitManager.js";
|
|
11
|
+
import { IRouterliciousDriverPolicies } from "./policies.js";
|
|
12
12
|
/**
|
|
13
13
|
* Document access to underlying storage for routerlicious driver.
|
|
14
14
|
* Uploads summaries piece-by-piece traversing the tree recursively.
|
|
@@ -35,4 +35,4 @@ export declare class ShreddedSummaryDocumentStorageService implements IDocumentS
|
|
|
35
35
|
private getPreviousFullSnapshot;
|
|
36
36
|
private getCacheKey;
|
|
37
37
|
}
|
|
38
|
-
//# sourceMappingURL=shreddedSummaryDocumentStorageService.d.
|
|
38
|
+
//# sourceMappingURL=shreddedSummaryDocumentStorageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shreddedSummaryDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/shreddedSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAGH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,6CAA6C,CAAC;AAErD,OAAO,EACN,mBAAmB,EACnB,eAAe,EACf,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAOtE,OAAO,EAAE,MAAM,EAAiB,MAAM,YAAY,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,kBAAkB,CAAC;AACxD,OAAO,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAC7C,OAAO,EAAE,4BAA4B,EAAE,MAAM,eAAe,CAAC;AAO7D;;;;GAIG;AACH,qBAAa,qCAAsC,YAAW,uBAAuB;IAkBnF,SAAS,CAAC,QAAQ,CAAC,EAAE,EAAE,MAAM;IAC7B,SAAS,CAAC,QAAQ,CAAC,OAAO,EAAE,UAAU;IACtC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,mBAAmB;aAC9B,QAAQ,EAAE,+BAA+B;IAIzD,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAxBnC,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAoB;IAGvC,SAAS,CAAC,QAAQ,CAAC,aAAa,sBAA6B;IAC7D,OAAO,CAAC,QAAQ,CAAC,SAAS,CAAsC;IAChE,OAAO,CAAC,QAAQ,CAAC,iBAAiB,CAA2C;YAE/D,uBAAuB;gBAUjB,EAAE,EAAE,MAAM,EACV,OAAO,EAAE,UAAU,EACnB,MAAM,EAAE,mBAAmB,EAC9B,QAAQ,EAAE,+BAA+B,EACzD,cAAc,CAAC,EAAE,4BAA4B,EAC7C,SAAS,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,EACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAC/B,iBAAiB,GAAE,CACnC,YAAY,CAAC,EAAE,OAAO,KAClB,OAAO,CAAC,UAAU,CAA4B;IAYvC,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;IAqBzE,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC;IAyCpE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IA8BlD,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAqBL,eAAe,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAI9D,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAqB9D,uBAAuB;IAYrC,OAAO,CAAC,WAAW;CAGnB"}
|
package/lib/{shreddedSummaryDocumentStorageService.mjs → shreddedSummaryDocumentStorageService.js}
RENAMED
|
@@ -2,12 +2,12 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { stringToBuffer, Uint8ArrayToString } from "@fluid-internal/client-utils";
|
|
5
|
+
import { Uint8ArrayToString, stringToBuffer } from "@fluid-internal/client-utils";
|
|
7
6
|
import { buildGitTreeHierarchy } from "@fluidframework/protocol-base";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
7
|
+
import { PerformanceEvent, createChildMonitoringContext, } from "@fluidframework/telemetry-utils/internal";
|
|
8
|
+
import { InMemoryCache } from "./cache.js";
|
|
9
|
+
import { RetriableGitManager } from "./retriableGitManager.js";
|
|
10
|
+
import { SummaryTreeUploadManager } from "./summaryTreeUploadManager.js";
|
|
11
11
|
const isNode = typeof window === "undefined";
|
|
12
12
|
/**
|
|
13
13
|
* Document access to underlying storage for routerlicious driver.
|
|
@@ -150,4 +150,4 @@ export class ShreddedSummaryDocumentStorageService {
|
|
|
150
150
|
return `${this.id}:${blobId}`;
|
|
151
151
|
}
|
|
152
152
|
}
|
|
153
|
-
//# sourceMappingURL=shreddedSummaryDocumentStorageService.
|
|
153
|
+
//# sourceMappingURL=shreddedSummaryDocumentStorageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shreddedSummaryDocumentStorageService.js","sourceRoot":"","sources":["../src/shreddedSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAMlF,OAAO,EAAE,qBAAqB,EAAE,MAAM,+BAA+B,CAAC;AAStE,OAAO,EAEN,gBAAgB,EAChB,4BAA4B,GAC5B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAU,aAAa,EAAE,MAAM,YAAY,CAAC;AAInD,OAAO,EAAE,mBAAmB,EAAE,MAAM,0BAA0B,CAAC;AAE/D,OAAO,EAAE,wBAAwB,EAAE,MAAM,+BAA+B,CAAC;AAEzE,MAAM,MAAM,GAAG,OAAO,MAAM,KAAK,WAAW,CAAC;AAE7C;;;;GAIG;AACH,MAAM,OAAO,qCAAqC;IAQzC,KAAK,CAAC,uBAAuB;QACpC,MAAM,OAAO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YACC,SAAS,EAAE,YAAY;YACvB,IAAI,EAAE,cAAc,CAAC,MAAM;SAC3B,EACD,KAAK,EAAE,KAAK,EAAE,EAAE;YACf,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;YAC/C,MAAM,QAAQ,GAAG,MAAM,OAAO;iBAC5B,UAAU,CAAC,kBAAkB,CAAC,cAAc,EAAE,QAAQ,CAAC,EAAE,QAAQ,CAAC;iBAClE,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,GAAG,EAAE,CAAC,CAAC,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAC3D,KAAK,CAAC,GAAG,CAAC;gBACT,MAAM,EAAE,QAAQ,CAAC,EAAE;aACnB,CAAC,CAAC;YACH,OAAO,QAAQ,CAAC;QACjB,CAAC,CACD,CAAC;IACH,CAAC;IAEO,KAAK,CAAC,uBAAuB,CACpC,YAAoB;QAEpB,OAAO,YAAY;YAClB,CAAC,CAAC,IAAI,CAAC,WAAW,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,QAAQ,EAAE,EAAE;gBAC1D,mEAAmE;gBACnE,IAAI,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC;gBAC3B,OAAO,IAAI,CAAC,eAAe,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACzC,CAAC,CAAC;YACJ,CAAC,CAAC,SAAS,CAAC;IACd,CAAC;IAEO,WAAW,CAAC,MAAc;QACjC,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions/internal\";\nimport { buildGitTreeHierarchy } from \"@fluidframework/protocol-base\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTreeEx,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICache, InMemoryCache } from \"./cache.js\";\nimport { ISnapshotTreeVersion } from \"./definitions.js\";\nimport { GitManager } from \"./gitManager.js\";\nimport { IRouterliciousDriverPolicies } from \"./policies.js\";\nimport { RetriableGitManager } from \"./retriableGitManager.js\";\nimport { ISummaryUploadManager } from \"./storageContracts.js\";\nimport { SummaryTreeUploadManager } from \"./summaryTreeUploadManager.js\";\n\nconst isNode = typeof window === \"undefined\";\n\n/**\n * Document access to underlying storage for routerlicious driver.\n * Uploads summaries piece-by-piece traversing the tree recursively.\n * Downloads summaries piece-by-piece on-demand, or up-front when prefetch is enabled.\n */\nexport class ShreddedSummaryDocumentStorageService implements IDocumentStorageService {\n\tprivate readonly mc: MonitoringContext;\n\t// The values of this cache is useless. We only need the keys. So we are always putting\n\t// empty strings as values.\n\tprotected readonly blobsShaCache = new Map<string, string>();\n\tprivate readonly blobCache: ICache<ArrayBufferLike> | undefined;\n\tprivate readonly snapshotTreeCache: ICache<ISnapshotTreeVersion> | undefined;\n\n\tprivate async getSummaryUploadManager(): Promise<ISummaryUploadManager> {\n\t\tconst manager = await this.getStorageManager();\n\t\treturn new SummaryTreeUploadManager(\n\t\t\tnew RetriableGitManager(manager, this.logger),\n\t\t\tthis.blobsShaCache,\n\t\t\tthis.getPreviousFullSnapshot.bind(this),\n\t\t);\n\t}\n\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly manager: GitManager,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<ISnapshotTreeVersion>,\n\t\tprivate readonly getStorageManager: (\n\t\t\tdisableCache?: boolean,\n\t\t) => Promise<GitManager> = async () => this.manager,\n\t) {\n\t\tif (driverPolicies?.enableRestLess === true || isNode) {\n\t\t\tthis.blobCache = blobCache ?? new InMemoryCache();\n\t\t\tthis.snapshotTreeCache = snapshotTreeCache ?? new InMemoryCache();\n\t\t}\n\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger,\n\t\t});\n\t}\n\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getVersions\",\n\t\t\t\tversionId: id,\n\t\t\t\tcount,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\treturn (await manager.getCommits(id, count)).content;\n\t\t\t},\n\t\t);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTreeEx | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tconst cachedSnapshotTree = await this.snapshotTreeCache?.get(\n\t\t\tthis.getCacheKey(requestVersion.treeId),\n\t\t);\n\t\tif (cachedSnapshotTree) {\n\t\t\treturn cachedSnapshotTree.snapshotTree as ISnapshotTreeEx;\n\t\t}\n\n\t\tconst rawTree = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getSnapshotTree\",\n\t\t\t\ttreeId: requestVersion.treeId,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = (await manager.getTree(requestVersion!.treeId)).content;\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.tree.length,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t);\n\t\tconst tree = buildGitTreeHierarchy(rawTree, this.blobsShaCache, true);\n\t\tawait this.snapshotTreeCache?.put(this.getCacheKey(tree.id), {\n\t\t\tid: requestVersion.id,\n\t\t\tsnapshotTree: tree,\n\t\t});\n\t\treturn tree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst cachedBlob = await this.blobCache?.get(this.getCacheKey(blobId));\n\t\tif (cachedBlob) {\n\t\t\treturn cachedBlob;\n\t\t}\n\n\t\tconst value = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"readBlob\",\n\t\t\t\tblobId,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = (await manager.getBlob(blobId)).content;\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.size,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\tundefined, // workers\n\t\t\tundefined, // recordHeapSize\n\t\t\tthis.mc.config.getNumber(\"Fluid.Driver.ReadBlobTelemetrySampling\"),\n\t\t);\n\t\tthis.blobsShaCache.set(value.sha, \"\");\n\t\tconst bufferContent = stringToBuffer(value.content, value.encoding);\n\t\tawait this.blobCache?.put(this.getCacheKey(value.sha), bufferContent);\n\t\treturn bufferContent;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst summaryHandle = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"uploadSummaryWithContext\",\n\t\t\t\tproposalHandle: context.proposalHandle,\n\t\t\t\tackHandle: context.ackHandle,\n\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryUploadManager = await this.getSummaryUploadManager();\n\t\t\t\treturn summaryUploadManager.writeSummaryTree(\n\t\t\t\t\tsummary,\n\t\t\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\t\t\"channel\",\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t\treturn summaryHandle;\n\t}\n\n\tpublic async downloadSummary(handle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tthrow new Error(\"NOT IMPLEMENTED!\");\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"createBlob\",\n\t\t\t\tsize: uint8ArrayFile.length,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager\n\t\t\t\t\t.createBlob(Uint8ArrayToString(uint8ArrayFile, \"base64\"), \"base64\")\n\t\t\t\t\t.then((r) => ({ id: r.content.sha, url: r.content.url }));\n\t\t\t\tevent.end({\n\t\t\t\t\tblobId: response.id,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate async getPreviousFullSnapshot(\n\t\tparentHandle: string,\n\t): Promise<ISnapshotTreeEx | null | undefined> {\n\t\treturn parentHandle\n\t\t\t? this.getVersions(parentHandle, 1).then(async (versions) => {\n\t\t\t\t\t// Clear the cache as the getSnapshotTree call will fill the cache.\n\t\t\t\t\tthis.blobsShaCache.clear();\n\t\t\t\t\treturn this.getSnapshotTree(versions[0]);\n\t\t\t })\n\t\t\t: undefined;\n\t}\n\n\tprivate getCacheKey(blobId: string): string {\n\t\treturn `${this.id}:${blobId}`;\n\t}\n}\n"]}
|
|
@@ -5,8 +5,8 @@
|
|
|
5
5
|
import * as git from "@fluidframework/gitresources";
|
|
6
6
|
import * as api from "@fluidframework/protocol-definitions";
|
|
7
7
|
import { IWholeSummaryPayload, IWholeSummaryPayloadType, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { IWholeFlatSnapshot } from "./contracts.js";
|
|
9
|
+
import { IR11sResponse } from "./restWrapper.js";
|
|
10
10
|
/**
|
|
11
11
|
* Interface to a generic Git provider
|
|
12
12
|
*/
|
|
@@ -42,4 +42,4 @@ export interface ISummaryUploadManager {
|
|
|
42
42
|
*/
|
|
43
43
|
writeSummaryTree(summaryTree: api.ISummaryTree, parentHandle: string, summaryType: IWholeSummaryPayloadType, sequenceNumber?: number): Promise<string>;
|
|
44
44
|
}
|
|
45
|
-
//# sourceMappingURL=storageContracts.d.
|
|
45
|
+
//# sourceMappingURL=storageContracts.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageContracts.d.ts","sourceRoot":"","sources":["../src/storageContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,KAAK,GAAG,MAAM,8BAA8B,CAAC;AACpD,OAAO,KAAK,GAAG,MAAM,sCAAsC,CAAC;AAC5D,OAAO,EACN,oBAAoB,EACpB,wBAAwB,EACxB,qBAAqB,EACrB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AACpD,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,UAAU;IAC1B,OAAO,CAAC,GAAG,EAAE,MAA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AAM,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,mBAAmB,CAAC,CAAC,CAAC;IAC/F,aAAa,CAAC,MAAM,EAAE,GAAG,CAAC,iBAAiB,GAAG,OAAO,CAAC,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,CAAC;IAChF,aAAa,CACZ,OAAO,EAAE,oBAAoB,EAC7B,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC,CAAC;IACjD,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC,CAAC;CACrE;AAED;;GAEG;AACH,MAAM,WAAW,qBAAqB;IACrC;;;;;;;OAOG;IACH,gBAAgB,CACf,WAAW,EAAE,GAAG,CAAC,YAAY,EAC7B,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,wBAAwB,EACrC,cAAc,CAAC,EAAE,MAAM,GACrB,OAAO,CAAC,MAAM,CAAC,CAAC;CACnB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"storageContracts.js","sourceRoot":"","sources":["../src/storageContracts.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as git from \"@fluidframework/gitresources\";\nimport * as api from \"@fluidframework/protocol-definitions\";\nimport {\n\tIWholeSummaryPayload,\n\tIWholeSummaryPayloadType,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\n\nimport { IWholeFlatSnapshot } from \"./contracts.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\n\n/**\n * Interface to a generic Git provider\n */\nexport interface IHistorian {\n\tgetBlob(sha: string): Promise<IR11sResponse<git.IBlob>>;\n\tcreateBlob(blob: git.ICreateBlobParams): Promise<IR11sResponse<git.ICreateBlobResponse>>;\n\tgetCommits(sha: string, count: number): Promise<IR11sResponse<git.ICommitDetails[]>>;\n\tcreateTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>>;\n\tgetTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>>;\n\tcreateSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>>;\n\tgetSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;\n}\n\nexport interface IGitManager {\n\tgetCommits(sha: string, count: number): Promise<IR11sResponse<git.ICommitDetails[]>>;\n\tgetTree(root: string, recursive: boolean): Promise<IR11sResponse<git.ITree>>;\n\tgetBlob(sha: string): Promise<IR11sResponse<git.IBlob>>;\n\tcreateBlob(content: string, encoding: string): Promise<IR11sResponse<git.ICreateBlobResponse>>;\n\tcreateGitTree(params: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>>;\n\tcreateSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>>;\n\tgetSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;\n}\n\n/**\n * Uploads a summary to storage.\n */\nexport interface ISummaryUploadManager {\n\t/**\n\t * Writes summary tree to storage.\n\t * @param summaryTree - Summary tree to write to storage\n\t * @param parentHandle - Parent summary acked handle (if available from summary ack)\n\t * @param summaryType - type of summary being uploaded\n\t * @param sequenceNumber - optional reference sequence number of the summary\n\t * @returns Id of created tree as a string.\n\t */\n\twriteSummaryTree(\n\t\tsummaryTree: api.ISummaryTree,\n\t\tparentHandle: string,\n\t\tsummaryType: IWholeSummaryPayloadType,\n\t\tsequenceNumber?: number,\n\t): Promise<string>;\n}\n"]}
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import { ISnapshotTreeEx, ISummaryTree } from "@fluidframework/protocol-definitions";
|
|
6
6
|
import { IWholeSummaryPayloadType } from "@fluidframework/server-services-client";
|
|
7
|
-
import { IGitManager, ISummaryUploadManager } from "./storageContracts.
|
|
7
|
+
import { IGitManager, ISummaryUploadManager } from "./storageContracts.js";
|
|
8
8
|
/**
|
|
9
9
|
* Recursively writes summary tree as individual summary blobs.
|
|
10
10
|
*/
|
|
@@ -20,4 +20,4 @@ export declare class SummaryTreeUploadManager implements ISummaryUploadManager {
|
|
|
20
20
|
private getIdFromPath;
|
|
21
21
|
private getIdFromPathCore;
|
|
22
22
|
}
|
|
23
|
-
//# sourceMappingURL=summaryTreeUploadManager.d.
|
|
23
|
+
//# sourceMappingURL=summaryTreeUploadManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summaryTreeUploadManager.d.ts","sourceRoot":"","sources":["../src/summaryTreeUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAMH,OAAO,EACN,eAAe,EACf,YAAY,EAGZ,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC;AAElF,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;GAEG;AACH,qBAAa,wBAAyB,YAAW,qBAAqB;IAEpE,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,aAAa;IAC9B,OAAO,CAAC,QAAQ,CAAC,uBAAuB;gBAFvB,OAAO,EAAE,WAAW,EACpB,aAAa,EAAE,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,uBAAuB,EAAE,CACzC,YAAY,EAAE,MAAM,KAChB,OAAO,CAAC,eAAe,GAAG,IAAI,GAAG,SAAS,CAAC;IAGpC,gBAAgB,CAC5B,WAAW,EAAE,YAAY,EACzB,YAAY,EAAE,MAAM,EACpB,WAAW,EAAE,wBAAwB,EACrC,cAAc,CAAC,EAAE,MAAM,EACvB,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,MAAM,CAAC;YAKJ,oBAAoB;YAsBpB,sBAAsB;YA0BtB,gBAAgB;IAgB9B,OAAO,CAAC,aAAa;IAiBrB,OAAO,CAAC,iBAAiB;CAgCzB"}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { assert, unreachableCase } from "@fluidframework/core-utils";
|
|
5
|
+
import { IsoBuffer, Uint8ArrayToString, gitHashFile } from "@fluid-internal/client-utils";
|
|
6
|
+
import { assert, unreachableCase } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { getGitMode, getGitType } from "@fluidframework/protocol-base";
|
|
8
8
|
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
9
9
|
/**
|
|
@@ -103,4 +103,4 @@ export class SummaryTreeUploadManager {
|
|
|
103
103
|
return this.getIdFromPathCore(handleType, path.slice(1), previousSnapshot.trees[key]);
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
|
-
//# sourceMappingURL=summaryTreeUploadManager.
|
|
106
|
+
//# sourceMappingURL=summaryTreeUploadManager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"summaryTreeUploadManager.js","sourceRoot":"","sources":["../src/summaryTreeUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC1F,OAAO,EAAE,MAAM,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE9E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAIN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAK9C;;GAEG;AACH,MAAM,OAAO,wBAAwB;IACpC,YACkB,OAAoB,EACpB,aAAkC,EAClC,uBAE+B;QAJ/B,YAAO,GAAP,OAAO,CAAa;QACpB,kBA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CAAC;iBACb;gBACD,KAAK,WAAW,CAAC,IAAI,CAAC,CAAC;oBACtB,MAAM,KAAK,GAAG,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;oBAC9C,MAAM,CACL,CAAC,CAAC,KAAK,EACP,KAAK,CAAC,oEAAoE,CAC1E,CAAC;oBACF,OAAO,KAAK,CAAC;iBACb;gBACD;oBACC,MAAM,KAAK,CAAC,2CAA2C,UAAU,IAAI,CAAC,CAAC;aACxE;SACD;QACD,OAAO,IAAI,CAAC,iBAAiB,CAAC,UAAU,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,gBAAgB,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC;IACvF,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { IsoBuffer, Uint8ArrayToString, gitHashFile } from \"@fluid-internal/client-utils\";\nimport { assert, unreachableCase } from \"@fluidframework/core-utils/internal\";\nimport { ICreateTreeEntry } from \"@fluidframework/gitresources\";\nimport { getGitMode, getGitType } from \"@fluidframework/protocol-base\";\nimport {\n\tISnapshotTreeEx,\n\tISummaryTree,\n\tSummaryObject,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\nimport { IWholeSummaryPayloadType } from \"@fluidframework/server-services-client\";\n\nimport { IGitManager, ISummaryUploadManager } from \"./storageContracts.js\";\n\n/**\n * Recursively writes summary tree as individual summary blobs.\n */\nexport class SummaryTreeUploadManager implements ISummaryUploadManager {\n\tconstructor(\n\t\tprivate readonly manager: IGitManager,\n\t\tprivate readonly blobsShaCache: Map<string, string>,\n\t\tprivate readonly getPreviousFullSnapshot: (\n\t\t\tparentHandle: string,\n\t\t) => Promise<ISnapshotTreeEx | null | undefined>,\n\t) {}\n\n\tpublic async writeSummaryTree(\n\t\tsummaryTree: ISummaryTree,\n\t\tparentHandle: string,\n\t\tsummaryType: IWholeSummaryPayloadType,\n\t\tsequenceNumber?: number,\n\t\tinitial?: boolean,\n\t): Promise<string> {\n\t\tconst previousFullSnapshot = await this.getPreviousFullSnapshot(parentHandle);\n\t\treturn this.writeSummaryTreeCore(summaryTree, previousFullSnapshot ?? undefined);\n\t}\n\n\tprivate async writeSummaryTreeCore(\n\t\tsummaryTree: ISummaryTree,\n\t\tpreviousFullSnapshot: ISnapshotTreeEx | undefined,\n\t): Promise<string> {\n\t\tconst entries = await Promise.all(\n\t\t\tObject.keys(summaryTree.tree).map(async (key) => {\n\t\t\t\tconst entry = summaryTree.tree[key];\n\t\t\t\tconst pathHandle = await this.writeSummaryTreeObject(entry, previousFullSnapshot);\n\t\t\t\tconst treeEntry: ICreateTreeEntry = {\n\t\t\t\t\tmode: getGitMode(entry),\n\t\t\t\t\tpath: encodeURIComponent(key),\n\t\t\t\t\tsha: pathHandle,\n\t\t\t\t\ttype: getGitType(entry),\n\t\t\t\t};\n\t\t\t\treturn treeEntry;\n\t\t\t}),\n\t\t);\n\n\t\tconst treeHandle = (await this.manager.createGitTree({ tree: entries })).content;\n\t\treturn treeHandle.sha;\n\t}\n\n\tprivate async writeSummaryTreeObject(\n\t\tobject: SummaryObject,\n\t\tpreviousFullSnapshot: ISnapshotTreeEx | undefined,\n\t): Promise<string> {\n\t\tswitch (object.type) {\n\t\t\tcase SummaryType.Blob: {\n\t\t\t\treturn this.writeSummaryBlob(object.content);\n\t\t\t}\n\t\t\tcase SummaryType.Handle: {\n\t\t\t\tif (previousFullSnapshot === undefined) {\n\t\t\t\t\tthrow Error(\"Parent summary does not exist to reference by handle.\");\n\t\t\t\t}\n\t\t\t\treturn this.getIdFromPath(object.handleType, object.handle, previousFullSnapshot);\n\t\t\t}\n\t\t\tcase SummaryType.Tree: {\n\t\t\t\treturn this.writeSummaryTreeCore(object, previousFullSnapshot);\n\t\t\t}\n\t\t\tcase SummaryType.Attachment: {\n\t\t\t\treturn object.id;\n\t\t\t}\n\n\t\t\tdefault:\n\t\t\t\tunreachableCase(object, `Unknown type: ${(object as any).type}`);\n\t\t}\n\t}\n\n\tprivate async writeSummaryBlob(content: string | Uint8Array): Promise<string> {\n\t\tconst { parsedContent, encoding } =\n\t\t\ttypeof content === \"string\"\n\t\t\t\t? { parsedContent: content, encoding: \"utf-8\" }\n\t\t\t\t: { parsedContent: Uint8ArrayToString(content, \"base64\"), encoding: \"base64\" };\n\n\t\t// The gitHashFile would return the same hash as returned by the server as blob.sha\n\t\tconst hash = await gitHashFile(IsoBuffer.from(parsedContent, encoding));\n\t\tif (!this.blobsShaCache.has(hash)) {\n\t\t\tthis.blobsShaCache.set(hash, \"\");\n\t\t\tconst blob = (await this.manager.createBlob(parsedContent, encoding)).content;\n\t\t\tassert(hash === blob.sha, 0x0b6 /* \"Blob.sha and hash do not match!!\" */);\n\t\t}\n\t\treturn hash;\n\t}\n\n\tprivate getIdFromPath(\n\t\thandleType: SummaryType,\n\t\thandlePath: string,\n\t\tpreviousFullSnapshot: ISnapshotTreeEx,\n\t): string {\n\t\tconst path = handlePath.split(\"/\").map((part) => decodeURIComponent(part));\n\t\tif (path[0] === \"\") {\n\t\t\t// root of tree should be unnamed\n\t\t\tpath.shift();\n\t\t}\n\t\tif (path.length === 0) {\n\t\t\treturn previousFullSnapshot.id;\n\t\t}\n\n\t\treturn this.getIdFromPathCore(handleType, path, previousFullSnapshot);\n\t}\n\n\tprivate getIdFromPathCore(\n\t\thandleType: SummaryType,\n\t\tpath: string[],\n\t\t/** Previous snapshot, subtree relative to this path part */\n\t\tpreviousSnapshot: ISnapshotTreeEx,\n\t): string {\n\t\tassert(path.length > 0, 0x0b3 /* \"Expected at least 1 path part\" */);\n\t\tconst key = path[0];\n\t\tif (path.length === 1) {\n\t\t\tswitch (handleType) {\n\t\t\t\tcase SummaryType.Blob: {\n\t\t\t\t\tconst tryId = previousSnapshot.blobs[key];\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!tryId,\n\t\t\t\t\t\t0x0b4 /* \"Parent summary does not have blob handle for specified path.\" */,\n\t\t\t\t\t);\n\t\t\t\t\treturn tryId;\n\t\t\t\t}\n\t\t\t\tcase SummaryType.Tree: {\n\t\t\t\t\tconst tryId = previousSnapshot.trees[key]?.id;\n\t\t\t\t\tassert(\n\t\t\t\t\t\t!!tryId,\n\t\t\t\t\t\t0x0b5 /* \"Parent summary does not have tree handle for specified path.\" */,\n\t\t\t\t\t);\n\t\t\t\t\treturn tryId;\n\t\t\t\t}\n\t\t\t\tdefault:\n\t\t\t\t\tthrow Error(`Unexpected handle summary object type: \"${handleType}\".`);\n\t\t\t}\n\t\t}\n\t\treturn this.getIdFromPathCore(handleType, path.slice(1), previousSnapshot.trees[key]);\n\t}\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.d.ts","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,sCAAsC,CAAC;AAEpE;;;GAGG;AACH,MAAM,WAAW,aAAa;IAC7B;;;OAGG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY,CAAC;CAC3C;AAED;;GAEG;AACH,MAAM,WAAW,cAAc;IAC9B;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IAEZ;;;;OAIG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;CACpB;AAED;;;;GAIG;AACH,MAAM,WAAW,cAAc;IAC9B;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,CAAC,EAAE,MAAM,EACnB,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B;;;;;;;;;;;;OAYG;IACH,iBAAiB,CAChB,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,OAAO,CAAC,EAAE,OAAO,GACf,OAAO,CAAC,cAAc,CAAC,CAAC;IAE3B;;;;;;;;;;;;;;OAcG;IACH,0BAA0B,CAAC,CAAC,UAAU,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CACtF"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"tokens.js","sourceRoot":"","sources":["../src/tokens.ts"],"names":[],"mappings":"AAAA;;;GAGG","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITokenClaims } from \"@fluidframework/protocol-definitions\";\n\n/**\n * Abstracts the discovery of claims contained within a token.\n * @internal\n */\nexport interface ITokenService {\n\t/**\n\t * Extracts the {@link @fluidframework/protocol-definitions#ITokenClaims | token claims} from the provided\n\t * {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} string representation.\n\t */\n\textractClaims(token: string): ITokenClaims;\n}\n\n/**\n * @public\n */\nexport interface ITokenResponse {\n\t/**\n\t * {@link https://jwt.io/introduction/ | JSON Web Token (JWT)} value.\n\t */\n\tjwt: string;\n\n\t/**\n\t * A flag indicating whether token was obtained from local cache.\n\t *\n\t * @remarks `undefined` indicates that the source of the token could not be determined.\n\t */\n\tfromCache?: boolean;\n}\n\n/**\n * Abstracts the token fetching mechanism for a hosting application.\n * The hosting application is responsible for providing an implementation.\n * @public\n */\nexport interface ITokenProvider {\n\t/**\n\t * Fetches the orderer token from host.\n\t *\n\t * @param tenantId - Tenant ID.\n\t * @param documentId - Optional. Document ID is only required for document-scoped requests.\n\t * @param refresh - Optional flag indicating whether token fetch must bypass local cache.\n\t * This likely indicates that some previous request failed authorization due to an expired token,\n\t * and so a fresh token is required.\n\t *\n\t * Default: `false`.\n\t *\n\t * NOTE: This parameter will be made required in the future.\n\t */\n\tfetchOrdererToken(\n\t\ttenantId: string,\n\t\tdocumentId?: string,\n\t\trefresh?: boolean,\n\t): Promise<ITokenResponse>;\n\n\t/**\n\t * Fetches the storage token from host.\n\t *\n\t * @param tenantId - Tenant ID.\n\t * @param documentId - Document ID.\n\t * @param refresh - Optional flag indicating whether token fetch must bypass local cache.\n\t * This likely indicates that some previous request failed authorization due to an expired token,\n\t * and so a fresh token is required.\n\t *\n\t * Default: `false`.\n\t *\n\t * NOTE: This parameter will be made required in the future.\n\t */\n\tfetchStorageToken(\n\t\ttenantId: string,\n\t\tdocumentId: string,\n\t\trefresh?: boolean,\n\t): Promise<ITokenResponse>;\n\n\t/**\n\t * A callback triggered directly after creating the document. In this callback the client has the opportunity, to\n\t * verify against an authorization service, if the user who claims to create the document is the same user who\n\t * created it.\n\t *\n\t * @remarks Notes:\n\t *\n\t * * Using the callback may have performance impact on the document creation process.\n\t *\n\t * * Any exceptions thrown in the callback would fail the creation workflow.\n\t *\n\t * @param documentId - Document ID.\n\t * @param creationToken - A special token that doesn't provide any kind of access, but it has the user's payload\n\t * and document id. It can be used to validate the identity of the document creator.\n\t */\n\tdocumentPostCreateCallback?(documentId: string, creationToken: string): Promise<void>;\n}\n"]}
|
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { INormalizedWholeSnapshot } from "./contracts.
|
|
5
|
+
import { ISnapshotTree, ISummaryTree, SummaryType } from "@fluidframework/protocol-definitions";
|
|
6
|
+
import { INormalizedWholeSnapshot } from "./contracts.js";
|
|
7
7
|
/**
|
|
8
8
|
* Summary tree assembler props
|
|
9
9
|
*/
|
|
@@ -56,4 +56,4 @@ export declare function evalBlobsAndTrees(snapshot: INormalizedWholeSnapshot): {
|
|
|
56
56
|
encodedBlobsSize: number;
|
|
57
57
|
};
|
|
58
58
|
export declare function validateBlobsAndTrees(snapshot: ISnapshotTree): void;
|
|
59
|
-
//# sourceMappingURL=treeUtils.d.
|
|
59
|
+
//# sourceMappingURL=treeUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeUt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 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { IsoBuffer } from "@fluid-internal/client-utils";
|
|
6
|
-
import { assert } from "@fluidframework/core-utils";
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
7
|
import { SummaryType, } from "@fluidframework/protocol-definitions";
|
|
8
8
|
/**
|
|
9
9
|
* Summary tree assembler (without stats collection).
|
|
@@ -99,4 +99,4 @@ function countTreesInSnapshotTree(snapshotTree) {
|
|
|
99
99
|
}
|
|
100
100
|
return numTrees;
|
|
101
101
|
}
|
|
102
|
-
//# sourceMappingURL=treeUtils.
|
|
102
|
+
//# sourceMappingURL=treeUtils.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"treeUtils.js","sourceRoot":"","sources":["../src/treeUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,8BAA8B,CAAC;AACzD,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAIN,WAAW,GACX,MAAM,sCAAsC,CAAC;AAe9C;;GAEG;AACH,MAAM,OAAO,oBAAoB;IAIhC,YAA6B,KAAkC;QAAlC,UAAK,GAAL,KAAK,CAA6B;QAHvD,sBAAiB,GAAW,CAAC,CAAC;QACrB,gBAAW,GAAsC,EAAE,CAAC;IAEH,CAAC;IAEnE;;OAEG;IACH,IAAW,OAAO;QACjB,OAAO;YACN,IAAI,EAAE,WAAW,CAAC,IAAI;YACtB,IAAI,EAAE,EAAE,GAAG,IAAI,CAAC,WAAW,EAAE;YAC7B,YAAY,EAAE,IAAI,CAAC,KAAK,EAAE,YAAY;YACtC,OAAO,EAAE,IAAI,CAAC,KAAK,EAAE,OAAO;SAC5B,CAAC;IACH,CAAC;IAED;;OAEG;IACI,OAAO,CAAC,GAAW,EAAE,OAA4B;QACvD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,GAAG;YACvB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AK,CAAC,EAAE;QACzD,MAAM,OAAO,GAAG,oCAAoC,CAAC,IAAI,EAAE,KAAK,CAAC,CAAC;QAClE,SAAS,CAAC,OAAO,CAAC,GAAG,EAAE,OAAO,CAAC,CAAC;KAChC;IACD,OAAO,SAAS,CAAC,OAAO,CAAC;AAC1B,CAAC;AAED,MAAM,UAAU,iBAAiB,CAAC,QAAkC;IACnE,MAAM,KAAK,GAAG,wBAAwB,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC9D,MAAM,QAAQ,GAAG,QAAQ,CAAC,KAAK,CAAC,IAAI,CAAC;IACrC,IAAI,gBAAgB,GAAG,CAAC,CAAC;IACzB,KAAK,MAAM,CAAC,CAAC,EAAE,WAAW,CAAC,IAAI,QAAQ,CAAC,KAAK,EAAE;QAC9C,gBAAgB,IAAI,WAAW,CAAC,UAAU,CAAC;KAC3C;IACD,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,gBAAgB,EAAE,CAAC;AAC9C,CAAC;AAED,MAAM,UAAU,qBAAqB,CAAC,QAAuB;IAC5D,MAAM,CACL,QAAQ,CAAC,KAAK,KAAK,SAAS,EAC5B,KAAK,CAAC,oDAAoD,CAC1D,CAAC;IACF,MAAM,CACL,QAAQ,CAAC,KAAK,KAAK,SAAS,EAC5B,KAAK,CAAC,oDAAoD,CAC1D,CAAC;AACH,CAAC;AAED,SAAS,wBAAwB,CAAC,YAA2B;IAC5D,IAAI,QAAQ,GAAG,CAAC,CAAC;IACjB,KAAK,MAAM,CAAC,CAAC,EAAE,IAAI,CAAC,IAAI,MAAM,CAAC,OAAO,CAAC,YAAY,CAAC,KAAK,CAAC,EAAE;QAC3D,QAAQ,IAAI,CAAC,GAAG,wBAAwB,CAAC,IAAI,CAAC,CAAC;KAC/C;IACD,OAAO,QAAQ,CAAC;AACjB,CAAC","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/internal\";\nimport {\n\tISnapshotTree,\n\tISummaryTree,\n\tSummaryObject,\n\tSummaryType,\n} from \"@fluidframework/protocol-definitions\";\n\nimport { INormalizedWholeSnapshot } from \"./contracts.js\";\n\n/**\n * Summary tree assembler props\n */\nexport interface ISummaryTreeAssemblerProps {\n\t/**\n\t * Indicates that this tree is unreferenced. If this is not present, the tree is considered referenced.\n\t */\n\tunreferenced?: true;\n\tgroupId?: string;\n}\n\n/**\n * Summary tree assembler (without stats collection).\n */\nexport class SummaryTreeAssembler {\n\tprivate attachmentCounter: number = 0;\n\tprivate readonly summaryTree: { [path: string]: SummaryObject } = {};\n\n\tconstructor(private readonly props?: ISummaryTreeAssemblerProps) {}\n\n\t/**\n\t * Get final summary\n\t */\n\tpublic get summary(): ISummaryTree {\n\t\treturn {\n\t\t\ttype: SummaryType.Tree,\n\t\t\ttree: { ...this.summaryTree },\n\t\t\tunreferenced: this.props?.unreferenced,\n\t\t\tgroupId: this.props?.groupId,\n\t\t};\n\t}\n\n\t/**\n\t * Add blob to summary\n\t */\n\tpublic addBlob(key: string, content: string | Uint8Array): void {\n\t\tthis.summaryTree[key] = {\n\t\t\ttype: SummaryType.Blob,\n\t\t\tcontent,\n\t\t};\n\t}\n\n\t/**\n\t * Add handle to summary\n\t */\n\tpublic addHandle(\n\t\tkey: string,\n\t\thandleType: SummaryType.Tree | SummaryType.Blob | SummaryType.Attachment,\n\t\thandle: string,\n\t): void {\n\t\tthis.summaryTree[key] = {\n\t\t\ttype: SummaryType.Handle,\n\t\t\thandleType,\n\t\t\thandle,\n\t\t};\n\t}\n\n\t/**\n\t * Add tree to summary\n\t */\n\tpublic addTree(key: string, summary: ISummaryTree): void {\n\t\tthis.summaryTree[key] = summary;\n\t}\n\n\t/**\n\t * Add attachment to summary\n\t */\n\tpublic addAttachment(id: string) {\n\t\tthis.summaryTree[this.attachmentCounter++] = { id, type: SummaryType.Attachment };\n\t}\n}\n\n/**\n * Helper function that converts ISnapshotTree and blobs to ISummaryTree\n * @param snapshot - Source snapshot tree\n * @param blobs - Blobs cache\n * @returns Converted snapshot in ISummaryTree format\n */\nexport function convertSnapshotAndBlobsToSummaryTree(\n\tsnapshot: ISnapshotTree,\n\tblobs: Map<string, ArrayBuffer>,\n): ISummaryTree {\n\tconst assembler = new SummaryTreeAssembler({\n\t\tunreferenced: snapshot.unreferenced,\n\t\tgroupId: snapshot.groupId,\n\t});\n\tfor (const [path, id] of Object.entries(snapshot.blobs)) {\n\t\tconst blob = blobs.get(id);\n\t\tassert(blob !== undefined, 0x2dd /* \"Cannot find blob for a given id\" */);\n\t\tassembler.addBlob(path, IsoBuffer.from(blob).toString(\"utf-8\"));\n\t}\n\tfor (const [key, tree] of Object.entries(snapshot.trees)) {\n\t\tconst subtree = convertSnapshotAndBlobsToSummaryTree(tree, blobs);\n\t\tassembler.addTree(key, subtree);\n\t}\n\treturn assembler.summary;\n}\n\nexport function evalBlobsAndTrees(snapshot: INormalizedWholeSnapshot) {\n\tconst trees = countTreesInSnapshotTree(snapshot.snapshotTree);\n\tconst numBlobs = snapshot.blobs.size;\n\tlet encodedBlobsSize = 0;\n\tfor (const [_, blobContent] of snapshot.blobs) {\n\t\tencodedBlobsSize += blobContent.byteLength;\n\t}\n\treturn { trees, numBlobs, encodedBlobsSize };\n}\n\nexport function validateBlobsAndTrees(snapshot: ISnapshotTree) {\n\tassert(\n\t\tsnapshot.trees !== undefined,\n\t\t0x5d0 /* Returned r11s snapshot is malformed. No trees! */,\n\t);\n\tassert(\n\t\tsnapshot.blobs !== undefined,\n\t\t0x5d1 /* Returned r11s snapshot is malformed. No blobs! */,\n\t);\n}\n\nfunction countTreesInSnapshotTree(snapshotTree: ISnapshotTree): number {\n\tlet numTrees = 0;\n\tfor (const [_, tree] of Object.entries(snapshotTree.trees)) {\n\t\tnumTrees += 1 + countTreesInSnapshotTree(tree);\n\t}\n\treturn numTrees;\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 { IResolvedUrl } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { IResolvedUrl } from "@fluidframework/driver-definitions/internal";
|
|
6
6
|
import { ISession } from "@fluidframework/server-services-client";
|
|
7
7
|
/**
|
|
8
8
|
* Assume documentId is at end of url path.
|
|
@@ -12,4 +12,4 @@ import { ISession } from "@fluidframework/server-services-client";
|
|
|
12
12
|
*/
|
|
13
13
|
export declare const replaceDocumentIdInPath: (urlPath: string, documentId: string) => string;
|
|
14
14
|
export declare const getDiscoveredFluidResolvedUrl: (resolvedUrl: IResolvedUrl, session: ISession) => IResolvedUrl;
|
|
15
|
-
//# sourceMappingURL=urlUtils.d.
|
|
15
|
+
//# sourceMappingURL=urlUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlUtils.d.ts","sourceRoot":"","sources":["../src/urlUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,6CAA6C,CAAC;AAC3E,OAAO,EAAE,QAAQ,EAAE,MAAM,wCAAwC,CAAC;AAElE;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,YAAa,MAAM,cAAc,MAAM,KAAG,MACf,CAAC;AAEhE,eAAO,MAAM,6BAA6B,gBAC5B,YAAY,WAChB,QAAQ,KACf,YAuBF,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"urlUtils.js","sourceRoot":"","sources":["../src/urlUtils.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAG,CAAC,OAAe,EAAE,UAAkB,EAAU,EAAE,CACtF,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CA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.\n */\n\nimport { IResolvedUrl } from \"@fluidframework/driver-definitions/internal\";\nimport { ISession } from \"@fluidframework/server-services-client\";\n\n/**\n * Assume documentId is at end of url path.\n * This is true for Routerlicious' and Tinylicious' documentUrl and deltaStorageUrl.\n * Routerlicious and Tinylicious do not use documentId in storageUrl nor ordererUrl.\n * TODO: Ideally we would be able to regenerate the resolvedUrl, rather than patching the current one.\n */\nexport const replaceDocumentIdInPath = (urlPath: string, documentId: string): string =>\n\turlPath.split(\"/\").slice(0, -1).concat([documentId]).join(\"/\");\n\nexport const getDiscoveredFluidResolvedUrl = (\n\tresolvedUrl: IResolvedUrl,\n\tsession: ISession,\n): IResolvedUrl => {\n\tconst discoveredOrdererUrl = new URL(session.ordererUrl);\n\tconst deltaStorageUrl = new URL(resolvedUrl.endpoints.deltaStorageUrl);\n\tdeltaStorageUrl.host = discoveredOrdererUrl.host;\n\n\tconst discoveredStorageUrl = new URL(session.historianUrl);\n\tconst storageUrl = new URL(resolvedUrl.endpoints.storageUrl);\n\tstorageUrl.host = discoveredStorageUrl.host;\n\n\tconst parsedUrl = new URL(resolvedUrl.url);\n\tconst discoveredResolvedUrl: IResolvedUrl = {\n\t\tendpoints: {\n\t\t\tdeltaStorageUrl: deltaStorageUrl.toString(),\n\t\t\tordererUrl: session.ordererUrl,\n\t\t\tdeltaStreamUrl: session.deltaStreamUrl,\n\t\t\tstorageUrl: storageUrl.toString(),\n\t\t},\n\t\tid: resolvedUrl.id,\n\t\ttokens: resolvedUrl.tokens,\n\t\ttype: resolvedUrl.type,\n\t\turl: new URL(`https://${discoveredOrdererUrl.host}${parsedUrl.pathname}`).toString(),\n\t};\n\treturn discoveredResolvedUrl;\n};\n"]}
|
package/lib/{wholeSummaryDocumentStorageService.d.mts → wholeSummaryDocumentStorageService.d.ts}
RENAMED
|
@@ -2,13 +2,13 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import { IDocumentStorageService, ISummaryContext, IDocumentStorageServicePolicies } from "@fluidframework/driver-definitions";
|
|
5
|
+
import { IDocumentStorageService, IDocumentStorageServicePolicies, ISummaryContext } from "@fluidframework/driver-definitions/internal";
|
|
7
6
|
import { ICreateBlobResponse, ISnapshotTree, ISummaryHandle, ISummaryTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
7
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
8
|
+
import { ICache } from "./cache.js";
|
|
9
|
+
import { INormalizedWholeSnapshot } from "./contracts.js";
|
|
10
|
+
import { GitManager } from "./gitManager.js";
|
|
11
|
+
import { IRouterliciousDriverPolicies } from "./policies.js";
|
|
12
12
|
export declare class WholeSummaryDocumentStorageService implements IDocumentStorageService {
|
|
13
13
|
protected readonly id: string;
|
|
14
14
|
protected readonly manager: GitManager;
|
|
@@ -34,4 +34,4 @@ export declare class WholeSummaryDocumentStorageService implements IDocumentStor
|
|
|
34
34
|
private updateBlobsCache;
|
|
35
35
|
private getCacheKey;
|
|
36
36
|
}
|
|
37
|
-
//# sourceMappingURL=wholeSummaryDocumentStorageService.d.
|
|
37
|
+
//# sourceMappingURL=wholeSummaryDocumentStorageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wholeSummaryDocumentStorageService.d.ts","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,EACN,uBAAuB,EACvB,+BAA+B,EAC/B,eAAe,EACf,MAAM,6CAA6C,CAAC;AACrD,OAAO,EACN,mBAAmB,EACnB,aAAa,EACb,cAAc,EACd,YAAY,EACZ,QAAQ,EACR,MAAM,sCAAsC,CAAC;AAC9C,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AAOtE,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AAa,GAAG,IAAI,CAAC;IA+BlE,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC;IAgClD,wBAAwB,CACpC,OAAO,EAAE,YAAY,EACrB,OAAO,EAAE,eAAe,GACtB,OAAO,CAAC,MAAM,CAAC;IAqBL,eAAe,CAAC,aAAa,EAAE,cAAc,GAAG,OAAO,CAAC,YAAY,CAAC;IAwBrE,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,OAAO,CAAC,mBAAmB,CAAC;YAqB9D,iBAAiB;YA4CjB,sBAAsB;YAetB,gBAAgB;IAS9B,OAAO,CAAC,WAAW;CAGnB"}
|
package/lib/{wholeSummaryDocumentStorageService.mjs → wholeSummaryDocumentStorageService.js}
RENAMED
|
@@ -2,14 +2,14 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { InMemoryCache } from "./cache.
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
5
|
+
import { Uint8ArrayToString, performance, stringToBuffer } from "@fluid-internal/client-utils";
|
|
6
|
+
import { assert } from "@fluidframework/core-utils/internal";
|
|
7
|
+
import { getW3CData, promiseRaceWithWinner } from "@fluidframework/driver-base/internal";
|
|
8
|
+
import { PerformanceEvent, createChildMonitoringContext, } from "@fluidframework/telemetry-utils/internal";
|
|
9
|
+
import { InMemoryCache } from "./cache.js";
|
|
10
|
+
import { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from "./r11sSnapshotParser.js";
|
|
11
|
+
import { convertSnapshotAndBlobsToSummaryTree, evalBlobsAndTrees, validateBlobsAndTrees, } from "./treeUtils.js";
|
|
12
|
+
import { WholeSummaryUploadManager } from "./wholeSummaryUploadManager.js";
|
|
13
13
|
const latestSnapshotId = "latest";
|
|
14
14
|
export class WholeSummaryDocumentStorageService {
|
|
15
15
|
async getSummaryUploadManager() {
|
|
@@ -245,4 +245,4 @@ export class WholeSummaryDocumentStorageService {
|
|
|
245
245
|
return `${this.id}:${blobId}`;
|
|
246
246
|
}
|
|
247
247
|
}
|
|
248
|
-
//# sourceMappingURL=wholeSummaryDocumentStorageService.
|
|
248
|
+
//# sourceMappingURL=wholeSummaryDocumentStorageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wholeSummaryDocumentStorageService.js","sourceRoot":"","sources":["../src/wholeSummaryDocumentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAC/F,OAAO,EAAE,MAAM,EAAE,MAAM,qCAAqC,CAAC;AAC7D,OAAO,EAAE,UAAU,EAAE,qBAAqB,EAAE,MAAM,sCAAsC,CAAC;AAczF,OAAO,EAEN,gBAAgB,EAChB,4BAA4B,GAC5B,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAU,aAAa,EAAE,MAAM,YAAY,CAAC;AAInD,OAAO,EAAE,8CAA8C,EAAE,MAAM,yBAAyB,CAAC;AAGzF,OAAO,EACN,oCAAoC,EACpC,iBAAiB,EACjB,qBAAqB,GACrB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,yBAAyB,EAAE,MAAM,gCAAgC,CAAC;AAE3E,MAAM,gBAAgB,GAAW,QAAQ,CAAC;AAE1C,MAAM,OAAO,kCAAkC;IAItC,KAAK,CAAC,uBAAuB;QACpC,MAAM,OAAO,GAAG,MAAM,IAAI,CAAC,iBAAiB,EAAE,CAAC;QAC/C,OAAO,IAAI,yBAAyB,CAAC,OAAO,CAAC,CAAC;IAC/C,CAAC;IAED,YACoB,EAAU,EACV,OAAmB,EACnB,MAA2B,EAC9B,QAAyC,EACxC,cAA6C,EAC7C,YAAqC,IAAI,aAAa,EAAE,EACxD,o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AAsB,CACnC,sBAAgD;QAEhD,MAAM,UAAU,GAAG,sBAAsB,CAAC,EAAE,CAAC;QAC7C,MAAM,CAAC,UAAU,KAAK,SAAS,EAAE,KAAK,CAAC,uCAAuC,CAAC,CAAC;QAChF,MAAM,OAAO,GAAmB;YAC/B,IAAI,CAAC,iBAAiB,CAAC,GAAG,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,EAAE,sBAAsB,CAAC;YAChF,IAAI,CAAC,gBAAgB,CAAC,sBAAsB,CAAC,KAAK,CAAC;SACnD,CAAC;QAEF,MAAM,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;QAE3B,OAAO,UAAU,CAAC;IACnB,CAAC;IAEO,KAAK,CAAC,gBAAgB,CAAC,KAA+B;QAC7D,MAAM,cAAc,GAAoB,EAAE,CAAC;QAC3C,KAAK,CAAC,OAAO,CAAC,CAAC,KAAK,EAAE,EAAE,EAAE,EAAE;YAC3B,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,EAAE,CAAC,CAAC;YACtC,cAAc,CAAC,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,EAAE,KAAK,CAAC,CAAC,CAAC;QAC1D,CAAC,CAAC,CAAC;QACH,MAAM,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;IACnC,CAAC;IAEO,WAAW,CAAC,MAAc;QACjC,OAAO,GAAG,IAAI,CAAC,EAAE,IAAI,MAAM,EAAE,CAAC;IAC/B,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { Uint8ArrayToString, performance, stringToBuffer } from \"@fluid-internal/client-utils\";\nimport { assert } from \"@fluidframework/core-utils/internal\";\nimport { getW3CData, promiseRaceWithWinner } from \"@fluidframework/driver-base/internal\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tISummaryContext,\n} from \"@fluidframework/driver-definitions/internal\";\nimport {\n\tICreateBlobResponse,\n\tISnapshotTree,\n\tISummaryHandle,\n\tISummaryTree,\n\tIVersion,\n} from \"@fluidframework/protocol-definitions\";\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tMonitoringContext,\n\tPerformanceEvent,\n\tcreateChildMonitoringContext,\n} from \"@fluidframework/telemetry-utils/internal\";\n\nimport { ICache, InMemoryCache } from \"./cache.js\";\nimport { INormalizedWholeSnapshot, IWholeFlatSnapshot } from \"./contracts.js\";\nimport { GitManager } from \"./gitManager.js\";\nimport { IRouterliciousDriverPolicies } from \"./policies.js\";\nimport { convertWholeFlatSnapshotToSnapshotTreeAndBlobs } from \"./r11sSnapshotParser.js\";\nimport { IR11sResponse } from \"./restWrapper.js\";\nimport { ISummaryUploadManager } from \"./storageContracts.js\";\nimport {\n\tconvertSnapshotAndBlobsToSummaryTree,\n\tevalBlobsAndTrees,\n\tvalidateBlobsAndTrees,\n} from \"./treeUtils.js\";\nimport { WholeSummaryUploadManager } from \"./wholeSummaryUploadManager.js\";\n\nconst latestSnapshotId: string = \"latest\";\n\nexport class WholeSummaryDocumentStorageService implements IDocumentStorageService {\n\tprivate readonly mc: MonitoringContext;\n\tprivate firstVersionsCall: boolean = true;\n\n\tprivate async getSummaryUploadManager(): Promise<ISummaryUploadManager> {\n\t\tconst manager = await this.getStorageManager();\n\t\treturn new WholeSummaryUploadManager(manager);\n\t}\n\n\tconstructor(\n\t\tprotected readonly id: string,\n\t\tprotected readonly manager: GitManager,\n\t\tprotected readonly logger: ITelemetryLoggerExt,\n\t\tpublic readonly policies: IDocumentStorageServicePolicies,\n\t\tprivate readonly driverPolicies?: IRouterliciousDriverPolicies,\n\t\tprivate readonly blobCache: ICache<ArrayBufferLike> = new InMemoryCache(),\n\t\tprivate readonly snapshotTreeCache: ICache<INormalizedWholeSnapshot> = new InMemoryCache(),\n\t\tprivate readonly noCacheGitManager?: GitManager,\n\t\tprivate readonly getStorageManager: (\n\t\t\tdisableCache?: boolean,\n\t\t) => Promise<GitManager> = async (disableCache) =>\n\t\t\tdisableCache && this.noCacheGitManager !== undefined\n\t\t\t\t? this.noCacheGitManager\n\t\t\t\t: this.manager,\n\t) {\n\t\tthis.mc = createChildMonitoringContext({\n\t\t\tlogger,\n\t\t});\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getVersions(versionId: string | null, count: number): Promise<IVersion[]> {\n\t\tif (versionId !== this.id && versionId !== null) {\n\t\t\t// Blobs/Trees in this scenario will never have multiple versions, so return versionId as is\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: versionId,\n\t\t\t\t\ttreeId: undefined!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\t\t// If this is the first versions call for the document, we know we will want the latest summary.\n\t\t// Fetch latest summary, cache it, and return its id.\n\t\tif (this.firstVersionsCall && count === 1) {\n\t\t\tconst normalizedSnapshotContents = await PerformanceEvent.timedExecAsync(\n\t\t\t\tthis.logger,\n\t\t\t\t{\n\t\t\t\t\teventName: \"ObtainSnapshot\",\n\t\t\t\t\tversionId: versionId ?? undefined,\n\t\t\t\t\tcount,\n\t\t\t\t\tenableDiscovery: this.driverPolicies?.enableDiscovery,\n\t\t\t\t},\n\t\t\t\tasync (event) => {\n\t\t\t\t\tlet method: string;\n\t\t\t\t\tconst cachedSnapshotP = this.snapshotTreeCache.get(\n\t\t\t\t\t\tthis.getCacheKey(latestSnapshotId),\n\t\t\t\t\t);\n\n\t\t\t\t\tconst networkSnapshotP = !this.driverPolicies?.enableDiscovery\n\t\t\t\t\t\t? this.fetchSnapshotTree(latestSnapshotId, false, \"getVersions\")\n\t\t\t\t\t\t: this.fetchSnapshotTree(latestSnapshotId, true, \"getVersions\");\n\n\t\t\t\t\tconst promiseRaceWinner = await promiseRaceWithWinner([\n\t\t\t\t\t\tcachedSnapshotP.catch(() => undefined),\n\t\t\t\t\t\tnetworkSnapshotP.catch(() => undefined),\n\t\t\t\t\t]);\n\n\t\t\t\t\tlet retrievedSnapshot = promiseRaceWinner.value;\n\t\t\t\t\tmethod = promiseRaceWinner.index === 0 ? \"cache\" : \"network\";\n\n\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t// if network failed -> wait for cache ( then return network failure)\n\t\t\t\t\t\t// If cache returned empty or failed -> wait for network (success of failure)\n\t\t\t\t\t\tif (promiseRaceWinner.index === 1) {\n\t\t\t\t\t\t\tretrievedSnapshot = await cachedSnapshotP;\n\t\t\t\t\t\t\tmethod = \"cache\";\n\t\t\t\t\t\t}\n\t\t\t\t\t\tif (retrievedSnapshot === undefined) {\n\t\t\t\t\t\t\tretrievedSnapshot = await networkSnapshotP;\n\t\t\t\t\t\t\tmethod = \"network\";\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tevent.end({\n\t\t\t\t\t\tmethod,\n\t\t\t\t\t});\n\t\t\t\t\treturn retrievedSnapshot;\n\t\t\t\t},\n\t\t\t);\n\n\t\t\tconst _id = await this.initializeFromSnapshot(normalizedSnapshotContents);\n\t\t\tthis.firstVersionsCall = false;\n\t\t\treturn [\n\t\t\t\t{\n\t\t\t\t\tid: _id,\n\t\t\t\t\ttreeId: normalizedSnapshotContents.snapshotTree.id!,\n\t\t\t\t},\n\t\t\t];\n\t\t}\n\n\t\t// Otherwise, get the latest version of the document as normal.\n\t\tconst id = versionId ? versionId : this.id;\n\t\tconst commits = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getVersions\",\n\t\t\t\tversionId: id,\n\t\t\t\tcount,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\treturn (await manager.getCommits(id, count)).content;\n\t\t\t},\n\t\t);\n\t\treturn commits.map((commit) => ({\n\t\t\tdate: commit.commit.author.date,\n\t\t\tid: commit.sha,\n\t\t\ttreeId: commit.commit.tree.sha,\n\t\t}));\n\t}\n\n\t// eslint-disable-next-line @rushstack/no-new-null\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tlet requestVersion = version;\n\t\tif (!requestVersion) {\n\t\t\tconst versions = await this.getVersions(this.id, 1);\n\t\t\tif (versions.length === 0) {\n\t\t\t\treturn null;\n\t\t\t}\n\n\t\t\trequestVersion = versions[0];\n\t\t}\n\n\t\tlet normalizedWholeSnapshot = await this.snapshotTreeCache.get(\n\t\t\tthis.getCacheKey(requestVersion.id),\n\t\t);\n\t\tif (normalizedWholeSnapshot !== undefined) {\n\t\t\treturn normalizedWholeSnapshot.snapshotTree;\n\t\t}\n\n\t\tnormalizedWholeSnapshot = await this.fetchSnapshotTree(\n\t\t\trequestVersion.id,\n\t\t\tundefined,\n\t\t\t\"getSnapshotTree\",\n\t\t);\n\n\t\t// Currently retrieving blobs from network is not supported by AFR for WholeSummaryDocumentStorageService\n\t\t// Blobs are expected to be put in the cache\n\t\tawait this.updateBlobsCache(normalizedWholeSnapshot.blobs);\n\n\t\treturn normalizedWholeSnapshot.snapshotTree;\n\t}\n\n\tpublic async readBlob(blobId: string): Promise<ArrayBufferLike> {\n\t\tconst cachedBlob = await this.blobCache.get(this.getCacheKey(blobId));\n\t\tif (cachedBlob !== undefined) {\n\t\t\treturn cachedBlob;\n\t\t}\n\n\t\t// Note: AFR does not support readBlobs, but potentially other r11s like servers do\n\t\tconst blob = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"readBlob\",\n\t\t\t\tblobId,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = (await manager.getBlob(blobId)).content;\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.size,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t\tundefined, // workers\n\t\t\tundefined, // recordHeapSize\n\t\t\tthis.mc.config.getNumber(\"Fluid.Driver.ReadBlobTelemetrySampling\"),\n\t\t);\n\t\tconst bufferValue = stringToBuffer(blob.content, blob.encoding);\n\n\t\tawait this.blobCache.put(this.getCacheKey(blob.sha), bufferValue);\n\n\t\treturn bufferValue;\n\t}\n\n\tpublic async uploadSummaryWithContext(\n\t\tsummary: ISummaryTree,\n\t\tcontext: ISummaryContext,\n\t): Promise<string> {\n\t\tconst summaryHandle = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"uploadSummaryWithContext\",\n\t\t\t\tproposalHandle: context.proposalHandle,\n\t\t\t\tackHandle: context.ackHandle,\n\t\t\t\treferenceSequenceNumber: context.referenceSequenceNumber,\n\t\t\t},\n\t\t\tasync () => {\n\t\t\t\tconst summaryUploadManager = await this.getSummaryUploadManager();\n\t\t\t\treturn summaryUploadManager.writeSummaryTree(\n\t\t\t\t\tsummary,\n\t\t\t\t\tcontext.ackHandle ?? \"\",\n\t\t\t\t\t\"channel\",\n\t\t\t\t);\n\t\t\t},\n\t\t);\n\t\treturn summaryHandle;\n\t}\n\n\tpublic async downloadSummary(summaryHandle: ISummaryHandle): Promise<ISummaryTree> {\n\t\tconst wholeFlatSnapshot = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getWholeFlatSummary\",\n\t\t\t\ttreeId: summaryHandle.handle,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager.getSnapshot(summaryHandle.handle);\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.content.trees[0]?.entries.length,\n\t\t\t\t});\n\t\t\t\treturn response.content;\n\t\t\t},\n\t\t);\n\n\t\tconst { blobs, snapshotTree } = convertWholeFlatSnapshotToSnapshotTreeAndBlobs(\n\t\t\twholeFlatSnapshot,\n\t\t\t\"\",\n\t\t);\n\t\treturn convertSnapshotAndBlobsToSummaryTree(snapshotTree, blobs);\n\t}\n\n\tpublic async createBlob(file: ArrayBufferLike): Promise<ICreateBlobResponse> {\n\t\tconst uint8ArrayFile = new Uint8Array(file);\n\t\treturn PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"createBlob\",\n\t\t\t\tsize: uint8ArrayFile.length,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager();\n\t\t\t\tconst response = await manager\n\t\t\t\t\t.createBlob(Uint8ArrayToString(uint8ArrayFile, \"base64\"), \"base64\")\n\t\t\t\t\t.then((r) => ({ id: r.content.sha, url: r.content.url }));\n\t\t\t\tevent.end({\n\t\t\t\t\tblobId: response.id,\n\t\t\t\t});\n\t\t\t\treturn response;\n\t\t\t},\n\t\t);\n\t}\n\n\tprivate async fetchSnapshotTree(\n\t\tversionId: string,\n\t\tdisableCache?: boolean,\n\t\tscenarioName?: string,\n\t): Promise<INormalizedWholeSnapshot> {\n\t\tconst normalizedWholeSummary = await PerformanceEvent.timedExecAsync(\n\t\t\tthis.logger,\n\t\t\t{\n\t\t\t\teventName: \"getWholeFlatSummary\",\n\t\t\t\ttreeId: versionId,\n\t\t\t\tscenarioName,\n\t\t\t},\n\t\t\tasync (event) => {\n\t\t\t\tconst manager = await this.getStorageManager(disableCache);\n\t\t\t\tconst response: IR11sResponse<IWholeFlatSnapshot> =\n\t\t\t\t\tawait manager.getSnapshot(versionId);\n\t\t\t\tconst start = performance.now();\n\t\t\t\tconst snapshot: INormalizedWholeSnapshot =\n\t\t\t\t\tconvertWholeFlatSnapshotToSnapshotTreeAndBlobs(response.content);\n\t\t\t\tconst snapshotConversionTime = performance.now() - start;\n\t\t\t\tvalidateBlobsAndTrees(snapshot.snapshotTree);\n\t\t\t\tconst { trees, numBlobs, encodedBlobsSize } = evalBlobsAndTrees(snapshot);\n\n\t\t\t\tevent.end({\n\t\t\t\t\tsize: response.content.trees[0]?.entries.length,\n\t\t\t\t\ttrees,\n\t\t\t\t\tblobs: numBlobs,\n\t\t\t\t\tencodedBlobsSize,\n\t\t\t\t\tsequenceNumber: snapshot.sequenceNumber,\n\t\t\t\t\t...response.propsToLog,\n\t\t\t\t\tsnapshotConversionTime,\n\t\t\t\t\t...getW3CData(response.requestUrl, \"xmlhttprequest\"),\n\t\t\t\t});\n\t\t\t\treturn snapshot;\n\t\t\t},\n\t\t);\n\n\t\t// Also add the result into the cache.\n\t\tawait this.snapshotTreeCache\n\t\t\t.put(this.getCacheKey(versionId), normalizedWholeSummary)\n\t\t\t.catch(() => undefined);\n\t\treturn normalizedWholeSummary;\n\t}\n\n\tprivate async initializeFromSnapshot(\n\t\tnormalizedWholeSummary: INormalizedWholeSnapshot,\n\t): Promise<string> {\n\t\tconst snapshotId = normalizedWholeSummary.id;\n\t\tassert(snapshotId !== undefined, 0x275 /* \"Root tree should contain the id\" */);\n\t\tconst cachePs: Promise<any>[] = [\n\t\t\tthis.snapshotTreeCache.put(this.getCacheKey(snapshotId), normalizedWholeSummary),\n\t\t\tthis.updateBlobsCache(normalizedWholeSummary.blobs),\n\t\t];\n\n\t\tawait Promise.all(cachePs);\n\n\t\treturn snapshotId;\n\t}\n\n\tprivate async updateBlobsCache(blobs: Map<string, ArrayBuffer>): Promise<void> {\n\t\tconst blobCachePutPs: Promise<void>[] = [];\n\t\tblobs.forEach((value, id) => {\n\t\t\tconst cacheKey = this.getCacheKey(id);\n\t\t\tblobCachePutPs.push(this.blobCache.put(cacheKey, value));\n\t\t});\n\t\tawait Promise.all(blobCachePutPs);\n\t}\n\n\tprivate getCacheKey(blobId: string): string {\n\t\treturn `${this.id}:${blobId}`;\n\t}\n}\n"]}
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { ISummaryTree, IWholeSummaryPayloadType } from "@fluidframework/server-services-client";
|
|
6
|
-
import { IGitManager, ISummaryUploadManager } from "./storageContracts.
|
|
6
|
+
import { IGitManager, ISummaryUploadManager } from "./storageContracts.js";
|
|
7
7
|
/**
|
|
8
8
|
* Converts summary to snapshot tree and uploads with single snaphot tree payload.
|
|
9
9
|
*/
|
|
@@ -13,4 +13,4 @@ export declare class WholeSummaryUploadManager implements ISummaryUploadManager
|
|
|
13
13
|
writeSummaryTree(summaryTree: ISummaryTree, parentHandle: string | undefined, summaryType: IWholeSummaryPayloadType, sequenceNumber?: number, initial?: boolean): Promise<string>;
|
|
14
14
|
private writeSummaryTreeCore;
|
|
15
15
|
}
|
|
16
|
-
//# sourceMappingURL=wholeSummaryUploadManager.d.
|
|
16
|
+
//# sourceMappingURL=wholeSummaryUploadManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wholeSummaryUploadManager.d.ts","sourceRoot":"","sources":["../src/wholeSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EACN,YAAY,EAEZ,wBAAwB,EAExB,MAAM,wCAAwC,CAAC;AAEhD,OAAO,EAAE,WAAW,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE3E;;GAEG;AACH,qBAAa,yBAA0B,YAAW,qBAAqB;IAC1D,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,WAAW;IAEpC,gBAAgB,CAC5B,WAAW,EAAE,YAAY,EACzB,YAAY,EAAE,MAAM,GAAG,SAAS,EAChC,WAAW,EAAE,wBAAwB,EACrC,cAAc,GAAE,MAAU,EAC1B,OAAO,GAAE,OAAe,GACtB,OAAO,CAAC,MAAM,CAAC;YAcJ,oBAAoB;CAwBlC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"wholeSummaryUploadManager.js","sourceRoot":"","sources":["../src/wholeSummaryUploadManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAIN,oCAAoC,GACpC,MAAM,wCAAwC,CAAC;AAIhD;;GAEG;AACH,MAAM,OAAO,yBAAyB;IACrC,YAA6B,OAAoB;QAApB,YAAO,GAAP,OAAO,CAAa;IAAG,CAAC;IAE9C,KAAK,CAAC,gBAAgB,CAC5B,WAAyB,EACzB,YAAgC,EAChC,WAAqC,EACrC,iBAAyB,CAAC,EAC1B,UAAmB,KAAK;QAExB,MAAM,EAAE,GAAG,MAAM,IAAI,CAAC,oBAAoB,CACzC,YAAY,EACZ,WAAW,EACX,WAAW,EACX,cAAc,EACd,OAAO,CACP,CAAC;QACF,IAAI,CAAC,EAAE,EAAE;YACR,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;SAChD;QACD,OAAO,EAAE,CAAC;IACX,CAAC;IAEO,KAAK,CAAC,oBAAoB,CACjC,YAAgC,EAChC,IAAkB,EAClB,IAA8B,EAC9B,cAAsB,EACtB,OAAgB;QAEhB,MAAM,YAAY,GAAG,oCAAoC,CACxD,YAAY,EACZ,IAAI,EACJ,EAAE,EACF,IAAI,KAAK,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAChC,CAAC;QACF,MAAM,eAAe,GAAyB;YAC7C,OAAO,EAAE,YAAY,CAAC,OAAO,IAAI,EAAE;YACnC,OAAO,EAAE,EAAE;YACX,cAAc;YACd,IAAI;SACJ,CAAC;QAEF,OAAO,IAAI,CAAC,OAAO;aACjB,aAAa,CAAC,eAAe,EAAE,OAAO,CAAC;aACvC,IAAI,CAAC,CAAC,QAAQ,EAAE,EAAE,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tISummaryTree,\n\tIWholeSummaryPayload,\n\tIWholeSummaryPayloadType,\n\tconvertSummaryTreeToWholeSummaryTree,\n} from \"@fluidframework/server-services-client\";\n\nimport { IGitManager, ISummaryUploadManager } from \"./storageContracts.js\";\n\n/**\n * Converts summary to snapshot tree and uploads with single snaphot tree payload.\n */\nexport class WholeSummaryUploadManager implements ISummaryUploadManager {\n\tconstructor(private readonly manager: IGitManager) {}\n\n\tpublic async writeSummaryTree(\n\t\tsummaryTree: ISummaryTree,\n\t\tparentHandle: string | undefined,\n\t\tsummaryType: IWholeSummaryPayloadType,\n\t\tsequenceNumber: number = 0,\n\t\tinitial: boolean = false,\n\t): Promise<string> {\n\t\tconst id = await this.writeSummaryTreeCore(\n\t\t\tparentHandle,\n\t\t\tsummaryTree,\n\t\t\tsummaryType,\n\t\t\tsequenceNumber,\n\t\t\tinitial,\n\t\t);\n\t\tif (!id) {\n\t\t\tthrow new Error(`Failed to write summary tree`);\n\t\t}\n\t\treturn id;\n\t}\n\n\tprivate async writeSummaryTreeCore(\n\t\tparentHandle: string | undefined,\n\t\ttree: ISummaryTree,\n\t\ttype: IWholeSummaryPayloadType,\n\t\tsequenceNumber: number,\n\t\tinitial: boolean,\n\t): Promise<string> {\n\t\tconst snapshotTree = convertSummaryTreeToWholeSummaryTree(\n\t\t\tparentHandle,\n\t\t\ttree,\n\t\t\t\"\",\n\t\t\ttype === \"channel\" ? \".app\" : \"\",\n\t\t);\n\t\tconst snapshotPayload: IWholeSummaryPayload = {\n\t\t\tentries: snapshotTree.entries ?? [],\n\t\t\tmessage: \"\",\n\t\t\tsequenceNumber,\n\t\t\ttype,\n\t\t};\n\n\t\treturn this.manager\n\t\t\t.createSummary(snapshotPayload, initial)\n\t\t\t.then((response) => response.content.id);\n\t}\n}\n"]}
|