@fluidframework/routerlicious-driver 1.4.0-115997 → 2.0.0-dev-rc.1.0.0.224419
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +10 -12
- package/.mocharc.js +12 -0
- package/CHANGELOG.md +156 -0
- package/README.md +39 -1
- package/api-extractor-lint.json +4 -0
- package/api-extractor.json +2 -2
- package/api-report/routerlicious-driver.api.md +108 -0
- package/dist/cache.cjs +30 -0
- package/dist/cache.cjs.map +1 -0
- package/dist/cache.d.ts +7 -0
- package/dist/cache.d.ts.map +1 -1
- package/dist/{definitions.js → contracts.cjs} +1 -1
- package/dist/contracts.cjs.map +1 -0
- package/dist/contracts.d.ts +42 -0
- package/dist/contracts.d.ts.map +1 -0
- package/dist/{createNewUtils.js → createNewUtils.cjs} +7 -5
- package/dist/createNewUtils.cjs.map +1 -0
- package/dist/createNewUtils.d.ts +1 -1
- package/dist/createNewUtils.d.ts.map +1 -1
- package/dist/{defaultTokenProvider.js → defaultTokenProvider.cjs} +2 -1
- package/dist/defaultTokenProvider.cjs.map +1 -0
- package/dist/defaultTokenProvider.d.ts +1 -0
- package/dist/defaultTokenProvider.d.ts.map +1 -1
- package/dist/definitions.cjs +7 -0
- package/dist/definitions.cjs.map +1 -0
- package/dist/definitions.d.ts.map +1 -1
- package/dist/deltaStorageService.cjs +122 -0
- package/dist/deltaStorageService.cjs.map +1 -0
- package/dist/deltaStorageService.d.ts +7 -6
- package/dist/deltaStorageService.d.ts.map +1 -1
- package/dist/{documentDeltaConnection.js → documentDeltaConnection.cjs} +8 -13
- package/dist/documentDeltaConnection.cjs.map +1 -0
- package/dist/documentDeltaConnection.d.ts +3 -4
- package/dist/documentDeltaConnection.d.ts.map +1 -1
- package/dist/{documentService.js → documentService.cjs} +61 -64
- package/dist/documentService.cjs.map +1 -0
- package/dist/documentService.d.ts +12 -4
- package/dist/documentService.d.ts.map +1 -1
- package/dist/{documentServiceFactory.js → documentServiceFactory.cjs} +87 -33
- package/dist/documentServiceFactory.cjs.map +1 -0
- package/dist/documentServiceFactory.d.ts +5 -3
- package/dist/documentServiceFactory.d.ts.map +1 -1
- package/dist/{documentStorageService.js → documentStorageService.cjs} +18 -16
- package/dist/documentStorageService.cjs.map +1 -0
- package/dist/documentStorageService.d.ts +4 -3
- package/dist/documentStorageService.d.ts.map +1 -1
- package/dist/errorUtils.cjs +87 -0
- package/dist/errorUtils.cjs.map +1 -0
- package/dist/errorUtils.d.ts +56 -10
- package/dist/errorUtils.d.ts.map +1 -1
- package/dist/gitManager.cjs +46 -0
- package/dist/gitManager.cjs.map +1 -0
- package/dist/gitManager.d.ts +27 -0
- package/dist/gitManager.d.ts.map +1 -0
- package/dist/historian.cjs +72 -0
- package/dist/historian.cjs.map +1 -0
- package/dist/historian.d.ts +34 -0
- package/dist/historian.d.ts.map +1 -0
- package/dist/index.cjs +19 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +5 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/mapWithExpiration.cjs +105 -0
- package/dist/mapWithExpiration.cjs.map +1 -0
- package/dist/mapWithExpiration.d.ts +34 -0
- package/dist/mapWithExpiration.d.ts.map +1 -0
- package/dist/{nullBlobStorageService.js → nullBlobStorageService.cjs} +5 -5
- package/dist/nullBlobStorageService.cjs.map +1 -0
- package/dist/nullBlobStorageService.d.ts.map +1 -1
- package/dist/{packageVersion.js → packageVersion.cjs} +2 -2
- package/dist/packageVersion.cjs.map +1 -0
- package/dist/packageVersion.d.ts +1 -1
- package/dist/packageVersion.d.ts.map +1 -1
- package/dist/{policies.js → policies.cjs} +1 -1
- package/dist/policies.cjs.map +1 -0
- package/dist/policies.d.ts +22 -9
- package/dist/policies.d.ts.map +1 -1
- package/dist/r11sSnapshotParser.cjs +73 -0
- package/dist/r11sSnapshotParser.cjs.map +1 -0
- package/dist/r11sSnapshotParser.d.ts +14 -0
- package/dist/r11sSnapshotParser.d.ts.map +1 -0
- package/dist/restWrapper.cjs +249 -0
- package/dist/restWrapper.cjs.map +1 -0
- package/dist/restWrapper.d.ts +32 -12
- package/dist/restWrapper.d.ts.map +1 -1
- package/dist/restWrapperBase.cjs +89 -0
- package/dist/restWrapperBase.cjs.map +1 -0
- package/dist/restWrapperBase.d.ts +26 -0
- package/dist/restWrapperBase.d.ts.map +1 -0
- package/dist/retriableGitManager.cjs +40 -0
- package/dist/retriableGitManager.cjs.map +1 -0
- package/dist/retriableGitManager.d.ts +13 -23
- package/dist/retriableGitManager.d.ts.map +1 -1
- package/dist/routerlicious-driver-alpha.d.ts +92 -0
- package/dist/routerlicious-driver-beta.d.ts +98 -0
- package/dist/routerlicious-driver-public.d.ts +98 -0
- package/dist/routerlicious-driver-untrimmed.d.ts +261 -0
- package/dist/{shreddedSummaryDocumentStorageService.js → shreddedSummaryDocumentStorageService.cjs} +41 -34
- package/dist/shreddedSummaryDocumentStorageService.cjs.map +1 -0
- package/dist/shreddedSummaryDocumentStorageService.d.ts +6 -5
- package/dist/shreddedSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/storageContracts.cjs +7 -0
- package/dist/storageContracts.cjs.map +1 -0
- package/dist/storageContracts.d.ts +45 -0
- package/dist/storageContracts.d.ts.map +1 -0
- package/dist/summaryTreeUploadManager.cjs +110 -0
- package/dist/summaryTreeUploadManager.cjs.map +1 -0
- package/dist/summaryTreeUploadManager.d.ts +23 -0
- package/dist/summaryTreeUploadManager.d.ts.map +1 -0
- package/dist/{tokens.js → tokens.cjs} +1 -1
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.ts +34 -5
- package/dist/tokens.d.ts.map +1 -1
- package/dist/treeUtils.cjs +107 -0
- package/dist/treeUtils.cjs.map +1 -0
- package/dist/treeUtils.d.ts +58 -0
- package/dist/treeUtils.d.ts.map +1 -0
- package/dist/tsdoc-metadata.json +11 -0
- package/dist/{urlUtils.js → urlUtils.cjs} +21 -25
- package/dist/urlUtils.cjs.map +1 -0
- package/dist/urlUtils.d.ts +2 -2
- package/dist/urlUtils.d.ts.map +1 -1
- package/dist/wholeSummaryDocumentStorageService.cjs +253 -0
- package/dist/wholeSummaryDocumentStorageService.cjs.map +1 -0
- package/dist/wholeSummaryDocumentStorageService.d.ts +10 -8
- package/dist/wholeSummaryDocumentStorageService.d.ts.map +1 -1
- package/dist/wholeSummaryUploadManager.cjs +37 -0
- package/dist/wholeSummaryUploadManager.cjs.map +1 -0
- package/dist/wholeSummaryUploadManager.d.ts +16 -0
- package/dist/wholeSummaryUploadManager.d.ts.map +1 -0
- package/lib/{cache.d.ts → cache.d.mts} +7 -0
- package/lib/cache.d.mts.map +1 -0
- package/lib/cache.mjs +25 -0
- package/lib/cache.mjs.map +1 -0
- package/lib/contracts.d.mts +42 -0
- package/lib/contracts.d.mts.map +1 -0
- package/lib/{definitions.js → contracts.mjs} +1 -1
- package/lib/contracts.mjs.map +1 -0
- package/lib/{createNewUtils.d.ts → createNewUtils.d.mts} +1 -1
- package/lib/{createNewUtils.d.ts.map → createNewUtils.d.mts.map} +1 -1
- package/lib/{createNewUtils.js → createNewUtils.mjs} +7 -5
- package/lib/createNewUtils.mjs.map +1 -0
- package/lib/{defaultTokenProvider.d.ts → defaultTokenProvider.d.mts} +2 -1
- package/lib/defaultTokenProvider.d.mts.map +1 -0
- package/lib/{defaultTokenProvider.js → defaultTokenProvider.mjs} +2 -1
- package/lib/defaultTokenProvider.mjs.map +1 -0
- package/lib/definitions.d.mts.map +1 -0
- package/lib/definitions.mjs +6 -0
- package/{dist/definitions.js.map → lib/definitions.mjs.map} +1 -1
- package/lib/{deltaStorageService.d.ts → deltaStorageService.d.mts} +8 -7
- package/lib/deltaStorageService.d.mts.map +1 -0
- package/lib/deltaStorageService.mjs +117 -0
- package/lib/deltaStorageService.mjs.map +1 -0
- package/lib/{documentDeltaConnection.d.ts → documentDeltaConnection.d.mts} +3 -4
- package/lib/documentDeltaConnection.d.mts.map +1 -0
- package/lib/{documentDeltaConnection.js → documentDeltaConnection.mjs} +8 -13
- package/lib/documentDeltaConnection.mjs.map +1 -0
- package/lib/{documentService.d.ts → documentService.d.mts} +16 -8
- package/lib/documentService.d.mts.map +1 -0
- package/lib/{documentService.js → documentService.mjs} +60 -44
- package/lib/documentService.mjs.map +1 -0
- package/lib/{documentServiceFactory.d.ts → documentServiceFactory.d.mts} +7 -5
- package/lib/documentServiceFactory.d.mts.map +1 -0
- package/lib/{documentServiceFactory.js → documentServiceFactory.mjs} +88 -34
- package/lib/documentServiceFactory.mjs.map +1 -0
- package/lib/{documentStorageService.d.ts → documentStorageService.d.mts} +7 -6
- package/lib/documentStorageService.d.mts.map +1 -0
- package/lib/{documentStorageService.js → documentStorageService.mjs} +19 -17
- package/lib/documentStorageService.mjs.map +1 -0
- package/lib/errorUtils.d.mts +93 -0
- package/lib/errorUtils.d.mts.map +1 -0
- package/lib/errorUtils.mjs +81 -0
- package/lib/errorUtils.mjs.map +1 -0
- package/lib/gitManager.d.mts +27 -0
- package/lib/gitManager.d.mts.map +1 -0
- package/lib/gitManager.mjs +42 -0
- package/lib/gitManager.mjs.map +1 -0
- package/lib/historian.d.mts +34 -0
- package/lib/historian.d.mts.map +1 -0
- package/lib/historian.mjs +67 -0
- package/lib/historian.mjs.map +1 -0
- package/lib/index.d.mts +10 -0
- package/lib/index.d.mts.map +1 -0
- package/lib/index.mjs +8 -0
- package/lib/index.mjs.map +1 -0
- package/lib/mapWithExpiration.d.mts +34 -0
- package/lib/mapWithExpiration.d.mts.map +1 -0
- package/lib/mapWithExpiration.mjs +101 -0
- package/lib/mapWithExpiration.mjs.map +1 -0
- package/lib/nullBlobStorageService.d.mts.map +1 -0
- package/lib/{nullBlobStorageService.js → nullBlobStorageService.mjs} +5 -5
- package/lib/nullBlobStorageService.mjs.map +1 -0
- package/lib/{packageVersion.d.ts → packageVersion.d.mts} +1 -1
- package/lib/{packageVersion.d.ts.map → packageVersion.d.mts.map} +1 -1
- package/lib/{packageVersion.js → packageVersion.mjs} +2 -2
- package/lib/packageVersion.mjs.map +1 -0
- package/lib/{policies.d.ts → policies.d.mts} +22 -9
- package/lib/policies.d.mts.map +1 -0
- package/lib/{policies.js → policies.mjs} +1 -1
- package/lib/policies.mjs.map +1 -0
- package/lib/r11sSnapshotParser.d.mts +14 -0
- package/lib/r11sSnapshotParser.d.mts.map +1 -0
- package/lib/r11sSnapshotParser.mjs +69 -0
- package/lib/r11sSnapshotParser.mjs.map +1 -0
- package/lib/restWrapper.d.mts +53 -0
- package/lib/restWrapper.d.mts.map +1 -0
- package/lib/restWrapper.mjs +236 -0
- package/lib/restWrapper.mjs.map +1 -0
- package/lib/restWrapperBase.d.mts +26 -0
- package/lib/restWrapperBase.d.mts.map +1 -0
- package/lib/restWrapperBase.mjs +84 -0
- package/lib/restWrapperBase.mjs.map +1 -0
- package/lib/retriableGitManager.d.mts +24 -0
- package/lib/retriableGitManager.d.mts.map +1 -0
- package/lib/retriableGitManager.mjs +36 -0
- package/lib/retriableGitManager.mjs.map +1 -0
- package/lib/routerlicious-driver-alpha.d.mts +92 -0
- package/lib/routerlicious-driver-beta.d.mts +98 -0
- package/lib/routerlicious-driver-public.d.mts +98 -0
- package/lib/routerlicious-driver-untrimmed.d.mts +261 -0
- package/lib/{shreddedSummaryDocumentStorageService.d.ts → shreddedSummaryDocumentStorageService.d.mts} +9 -8
- package/lib/shreddedSummaryDocumentStorageService.d.mts.map +1 -0
- package/lib/{shreddedSummaryDocumentStorageService.js → shreddedSummaryDocumentStorageService.mjs} +41 -34
- package/lib/shreddedSummaryDocumentStorageService.mjs.map +1 -0
- package/lib/storageContracts.d.mts +45 -0
- package/lib/storageContracts.d.mts.map +1 -0
- package/lib/storageContracts.mjs +6 -0
- package/lib/storageContracts.mjs.map +1 -0
- package/lib/summaryTreeUploadManager.d.mts +23 -0
- package/lib/summaryTreeUploadManager.d.mts.map +1 -0
- package/lib/summaryTreeUploadManager.mjs +106 -0
- package/lib/summaryTreeUploadManager.mjs.map +1 -0
- package/lib/{tokens.d.ts → tokens.d.mts} +34 -5
- package/lib/tokens.d.mts.map +1 -0
- package/lib/{tokens.js → tokens.mjs} +1 -1
- package/lib/tokens.mjs.map +1 -0
- package/lib/treeUtils.d.mts +58 -0
- package/lib/treeUtils.d.mts.map +1 -0
- package/lib/treeUtils.mjs +100 -0
- package/lib/treeUtils.mjs.map +1 -0
- package/lib/{urlUtils.d.ts → urlUtils.d.mts} +2 -2
- package/lib/urlUtils.d.mts.map +1 -0
- package/lib/urlUtils.mjs +38 -0
- package/lib/urlUtils.mjs.map +1 -0
- package/lib/{wholeSummaryDocumentStorageService.d.ts → wholeSummaryDocumentStorageService.d.mts} +12 -10
- package/lib/wholeSummaryDocumentStorageService.d.mts.map +1 -0
- package/lib/wholeSummaryDocumentStorageService.mjs +249 -0
- package/lib/wholeSummaryDocumentStorageService.mjs.map +1 -0
- package/lib/wholeSummaryUploadManager.d.mts +16 -0
- package/lib/wholeSummaryUploadManager.d.mts.map +1 -0
- package/lib/wholeSummaryUploadManager.mjs +33 -0
- package/lib/wholeSummaryUploadManager.mjs.map +1 -0
- package/package.json +104 -68
- package/prettier.config.cjs +8 -0
- package/src/cache.ts +25 -9
- package/src/contracts.ts +60 -0
- package/src/createNewUtils.ts +26 -24
- package/src/defaultTokenProvider.ts +14 -15
- package/src/definitions.ts +2 -2
- package/src/deltaStorageService.ts +145 -91
- package/src/documentDeltaConnection.ts +54 -52
- package/src/documentService.ts +272 -242
- package/src/documentServiceFactory.ts +338 -237
- package/src/documentStorageService.ts +92 -84
- package/src/errorUtils.ts +117 -79
- package/src/gitManager.ts +67 -0
- package/src/historian.ts +121 -0
- package/src/index.ts +15 -8
- package/src/mapWithExpiration.ts +124 -0
- package/src/nullBlobStorageService.ts +24 -21
- package/src/packageVersion.ts +1 -1
- package/src/policies.ts +51 -38
- package/src/r11sSnapshotParser.ts +82 -0
- package/src/restWrapper.ts +400 -216
- package/src/restWrapperBase.ts +146 -0
- package/src/retriableGitManager.ts +76 -153
- package/src/shreddedSummaryDocumentStorageService.ts +214 -195
- package/src/storageContracts.ts +63 -0
- package/src/summaryTreeUploadManager.ts +155 -0
- package/src/tokens.ts +74 -39
- package/src/treeUtils.ts +138 -0
- package/src/urlUtils.ts +27 -28
- package/src/wholeSummaryDocumentStorageService.ts +352 -252
- package/src/wholeSummaryUploadManager.ts +64 -0
- package/tsc-multi.test.json +4 -0
- package/tsconfig.json +10 -13
- package/dist/cache.js +0 -20
- package/dist/cache.js.map +0 -1
- package/dist/createNewUtils.js.map +0 -1
- package/dist/defaultTokenProvider.js.map +0 -1
- package/dist/deltaStorageService.js +0 -82
- package/dist/deltaStorageService.js.map +0 -1
- package/dist/documentDeltaConnection.js.map +0 -1
- package/dist/documentService.js.map +0 -1
- package/dist/documentServiceFactory.js.map +0 -1
- package/dist/documentStorageService.js.map +0 -1
- package/dist/errorUtils.js +0 -56
- package/dist/errorUtils.js.map +0 -1
- package/dist/index.js +0 -25
- package/dist/index.js.map +0 -1
- package/dist/nullBlobStorageService.js.map +0 -1
- package/dist/packageVersion.js.map +0 -1
- package/dist/policies.js.map +0 -1
- package/dist/restWrapper.js +0 -153
- package/dist/restWrapper.js.map +0 -1
- package/dist/retriableGitManager.js +0 -76
- package/dist/retriableGitManager.js.map +0 -1
- package/dist/shreddedSummaryDocumentStorageService.js.map +0 -1
- package/dist/tokens.js.map +0 -1
- package/dist/urlUtils.js.map +0 -1
- package/dist/wholeSummaryDocumentStorageService.js +0 -191
- package/dist/wholeSummaryDocumentStorageService.js.map +0 -1
- package/lib/cache.d.ts.map +0 -1
- package/lib/cache.js +0 -16
- package/lib/cache.js.map +0 -1
- package/lib/createNewUtils.js.map +0 -1
- package/lib/defaultTokenProvider.d.ts.map +0 -1
- package/lib/defaultTokenProvider.js.map +0 -1
- package/lib/definitions.d.ts.map +0 -1
- package/lib/definitions.js.map +0 -1
- package/lib/deltaStorageService.d.ts.map +0 -1
- package/lib/deltaStorageService.js +0 -77
- package/lib/deltaStorageService.js.map +0 -1
- package/lib/documentDeltaConnection.d.ts.map +0 -1
- package/lib/documentDeltaConnection.js.map +0 -1
- package/lib/documentService.d.ts.map +0 -1
- package/lib/documentService.js.map +0 -1
- package/lib/documentServiceFactory.d.ts.map +0 -1
- package/lib/documentServiceFactory.js.map +0 -1
- package/lib/documentStorageService.d.ts.map +0 -1
- package/lib/documentStorageService.js.map +0 -1
- package/lib/errorUtils.d.ts +0 -47
- package/lib/errorUtils.d.ts.map +0 -1
- package/lib/errorUtils.js +0 -50
- package/lib/errorUtils.js.map +0 -1
- package/lib/index.d.ts +0 -13
- package/lib/index.d.ts.map +0 -1
- package/lib/index.js +0 -13
- package/lib/index.js.map +0 -1
- package/lib/nullBlobStorageService.d.ts.map +0 -1
- package/lib/nullBlobStorageService.js.map +0 -1
- package/lib/packageVersion.js.map +0 -1
- package/lib/policies.d.ts.map +0 -1
- package/lib/policies.js.map +0 -1
- package/lib/restWrapper.d.ts +0 -33
- package/lib/restWrapper.d.ts.map +0 -1
- package/lib/restWrapper.js +0 -144
- package/lib/restWrapper.js.map +0 -1
- package/lib/retriableGitManager.d.ts +0 -34
- package/lib/retriableGitManager.d.ts.map +0 -1
- package/lib/retriableGitManager.js +0 -72
- package/lib/retriableGitManager.js.map +0 -1
- package/lib/shreddedSummaryDocumentStorageService.d.ts.map +0 -1
- package/lib/shreddedSummaryDocumentStorageService.js.map +0 -1
- package/lib/tokens.d.ts.map +0 -1
- package/lib/tokens.js.map +0 -1
- package/lib/urlUtils.d.ts.map +0 -1
- package/lib/urlUtils.js +0 -42
- package/lib/urlUtils.js.map +0 -1
- package/lib/wholeSummaryDocumentStorageService.d.ts.map +0 -1
- package/lib/wholeSummaryDocumentStorageService.js +0 -187
- package/lib/wholeSummaryDocumentStorageService.js.map +0 -1
- package/tsconfig.esnext.json +0 -7
- /package/lib/{definitions.d.ts → definitions.d.mts} +0 -0
- /package/lib/{nullBlobStorageService.d.ts → nullBlobStorageService.d.mts} +0 -0
|
@@ -2,14 +2,15 @@
|
|
|
2
2
|
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
|
-
import
|
|
5
|
+
import { ITelemetryLoggerExt } from "@fluidframework/telemetry-utils";
|
|
6
6
|
import { IDocumentStorageServicePolicies } from "@fluidframework/driver-definitions";
|
|
7
7
|
import { ISnapshotTree, IVersion } from "@fluidframework/protocol-definitions";
|
|
8
|
-
import { GitManager } from "@fluidframework/server-services-client";
|
|
9
8
|
import { DocumentStorageServiceProxy } from "@fluidframework/driver-utils";
|
|
10
|
-
import { IRouterliciousDriverPolicies } from "./policies";
|
|
11
|
-
import { ICache } from "./cache";
|
|
12
|
-
import {
|
|
9
|
+
import { IRouterliciousDriverPolicies } from "./policies.mjs";
|
|
10
|
+
import { ICache } from "./cache.mjs";
|
|
11
|
+
import { GitManager } from "./gitManager.mjs";
|
|
12
|
+
import { ISnapshotTreeVersion } from "./definitions.mjs";
|
|
13
|
+
import { INormalizedWholeSnapshot } from "./contracts.mjs";
|
|
13
14
|
export declare class DocumentStorageService extends DocumentStorageServiceProxy {
|
|
14
15
|
readonly id: string;
|
|
15
16
|
manager: GitManager;
|
|
@@ -17,7 +18,7 @@ export declare class DocumentStorageService extends DocumentStorageServiceProxy
|
|
|
17
18
|
private _logTailSha;
|
|
18
19
|
get logTailSha(): string | undefined;
|
|
19
20
|
private static loadInternalDocumentStorageService;
|
|
20
|
-
constructor(id: string, manager: GitManager, logger:
|
|
21
|
+
constructor(id: string, manager: GitManager, logger: ITelemetryLoggerExt, policies: IDocumentStorageServicePolicies, driverPolicies?: IRouterliciousDriverPolicies, blobCache?: ICache<ArrayBufferLike>, snapshotTreeCache?: ICache<INormalizedWholeSnapshot>, shreddedSummaryTreeCache?: ICache<ISnapshotTreeVersion>, noCacheGitManager?: GitManager | undefined, getStorageManager?: (disableCache?: boolean) => Promise<GitManager>);
|
|
21
22
|
getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null>;
|
|
22
23
|
}
|
|
23
24
|
//# sourceMappingURL=documentStorageService.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentStorageService.d.ts","sourceRoot":"","sources":["../src/documentStorageService.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,mBAAmB,EAAE,MAAM,iCAAiC;OAC9D,EAEN,+BAA+B,EAE/B,MAAM,oCAAoC;OACpC,EAAE,aAAa,EAAE,QAAQ,EAAE,MAAM,sCAAsC;OACvE,EACN,2BAA2B,EAE3B,MAAM,8BAA8B;OAC9B,EAAE,4BAA4B,EAAE;OAChC,EAAE,MAAM,EAAE;OAGV,EAAE,UAAU,EAAE;OACd,EAAE,oBAAoB,EAAE;OACxB,EAAE,wBAAwB,EAAE;AAEnC,qBAAa,sBAAuB,SAAQ,2BAA2B;aAoDrD,EAAE,EAAE,MAAM;IACnB,OAAO,EAAE,UAAU;IAOnB,iBAAiB,CAAC;IA3D1B,OAAO,CAAC,WAAW,CAAiC;IAEpD,IAAW,UAAU,IAAI,MAAM,GAAG,SAAS,CAE1C;IAED,OAAO,CAAC,MAAM,CAAC,kCAAkC;gBA6ChC,EAAE,EAAE,MAAM,EACnB,OAAO,EAAE,UAAU,EAC1B,MAAM,EAAE,mBAAmB,EAC3B,QAAQ,EAAE,+BAA+B,EACzC,cAAc,CAAC,EAAE,4BAA4B,EAC7C,SAAS,CAAC,EAAE,MAAM,CAAC,eAAe,CAAC,EACnC,iBAAiB,CAAC,EAAE,MAAM,CAAC,wBAAwB,CAAC,EACpD,wBAAwB,CAAC,EAAE,MAAM,CAAC,oBAAoB,CAAC,EAChD,iBAAiB,CAAC,wBAAY,EACrC,iBAAiB,CAAC,EAAE,CAAC,YAAY,CAAC,EAAE,OAAO,KAAK,OAAO,CAAC,UAAU,CAAC;IAkBvD,eAAe,CAAC,OAAO,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC,aAAa,GAAG,IAAI,CAAC;CAQ/E"}
|
|
@@ -3,36 +3,38 @@
|
|
|
3
3
|
* Licensed under the MIT License.
|
|
4
4
|
*/
|
|
5
5
|
import { LoaderCachingPolicy, } from "@fluidframework/driver-definitions";
|
|
6
|
-
import { DocumentStorageServiceProxy, PrefetchDocumentStorageService } from "@fluidframework/driver-utils";
|
|
7
|
-
import { WholeSummaryDocumentStorageService } from "./wholeSummaryDocumentStorageService";
|
|
8
|
-
import { ShreddedSummaryDocumentStorageService } from "./shreddedSummaryDocumentStorageService";
|
|
6
|
+
import { DocumentStorageServiceProxy, PrefetchDocumentStorageService, } from "@fluidframework/driver-utils";
|
|
7
|
+
import { WholeSummaryDocumentStorageService } from "./wholeSummaryDocumentStorageService.mjs";
|
|
8
|
+
import { ShreddedSummaryDocumentStorageService } from "./shreddedSummaryDocumentStorageService.mjs";
|
|
9
9
|
export class DocumentStorageService extends DocumentStorageServiceProxy {
|
|
10
|
-
constructor(id, manager, logger, policies = {}, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager) {
|
|
11
|
-
super(DocumentStorageService.loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager));
|
|
12
|
-
this.id = id;
|
|
13
|
-
this.manager = manager;
|
|
14
|
-
this.noCacheGitManager = noCacheGitManager;
|
|
15
|
-
this._logTailSha = undefined;
|
|
16
|
-
}
|
|
17
10
|
get logTailSha() {
|
|
18
11
|
return this._logTailSha;
|
|
19
12
|
}
|
|
20
|
-
static loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager) {
|
|
21
|
-
const storageService =
|
|
22
|
-
new WholeSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager)
|
|
23
|
-
new ShreddedSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache,
|
|
13
|
+
static loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager) {
|
|
14
|
+
const storageService = driverPolicies?.enableWholeSummaryUpload
|
|
15
|
+
? new WholeSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, noCacheGitManager, getStorageManager)
|
|
16
|
+
: new ShreddedSummaryDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, shreddedSummaryTreeCache, getStorageManager);
|
|
24
17
|
// TODO: worth prefetching latest summary making version + snapshot call with WholeSummary storage?
|
|
25
|
-
if (!
|
|
18
|
+
if (!driverPolicies?.enableWholeSummaryUpload &&
|
|
19
|
+
policies.caching === LoaderCachingPolicy.Prefetch) {
|
|
26
20
|
return new PrefetchDocumentStorageService(storageService);
|
|
27
21
|
}
|
|
28
22
|
return storageService;
|
|
29
23
|
}
|
|
24
|
+
constructor(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager) {
|
|
25
|
+
super(DocumentStorageService.loadInternalDocumentStorageService(id, manager, logger, policies, driverPolicies, blobCache, snapshotTreeCache, shreddedSummaryTreeCache, noCacheGitManager, getStorageManager));
|
|
26
|
+
this.id = id;
|
|
27
|
+
this.manager = manager;
|
|
28
|
+
this.noCacheGitManager = noCacheGitManager;
|
|
29
|
+
this._logTailSha = undefined;
|
|
30
|
+
}
|
|
30
31
|
async getSnapshotTree(version) {
|
|
31
32
|
const tree = await this.internalStorageService.getSnapshotTree(version);
|
|
32
33
|
if (tree !== null) {
|
|
33
|
-
this._logTailSha =
|
|
34
|
+
this._logTailSha =
|
|
35
|
+
".logTail" in tree.trees ? tree.trees[".logTail"].blobs.logTail : undefined;
|
|
34
36
|
}
|
|
35
37
|
return tree;
|
|
36
38
|
}
|
|
37
39
|
}
|
|
38
|
-
//# sourceMappingURL=documentStorageService.
|
|
40
|
+
//# sourceMappingURL=documentStorageService.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"documentStorageService.mjs","source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,MAAM,EACN,QAAQ,EACR,cAAc,EACd,SAAS,EACT,iBAAiB,EACjB,wBAAwB,EACxB,iBAAiB,EACjB,iBAAiB,CACjB,CACD,CAAC;QAxBc,OAAE,GAAF,EAAE,CAAQ;QACnB,YAAO,GAAP,OAAO,CAAY;QAOnB,sBAAiB,GAAjB,iBAAiB,CAAa;QA3D9B,gBAAW,GAAuB,SAAS,CAAC;IA4EpD,CAAC;IAEM,KAAK,CAAC,eAAe,CAAC,OAAkB;QAC9C,MAAM,IAAI,GAAG,MAAM,IAAI,CAAC,sBAAsB,CAAC,eAAe,CAAC,OAAO,CAAC,CAAC;QACxE,IAAI,IAAI,KAAK,IAAI,EAAE;YAClB,IAAI,CAAC,WAAW;gBACf,UAAU,IAAI,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC;SAC7E;QACD,OAAO,IAAI,CAAC;IACb,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { ITelemetryLoggerExt } from \"@fluidframework/telemetry-utils\";\nimport {\n\tIDocumentStorageService,\n\tIDocumentStorageServicePolicies,\n\tLoaderCachingPolicy,\n} from \"@fluidframework/driver-definitions\";\nimport { ISnapshotTree, IVersion } from \"@fluidframework/protocol-definitions\";\nimport {\n\tDocumentStorageServiceProxy,\n\tPrefetchDocumentStorageService,\n} from \"@fluidframework/driver-utils\";\nimport { IRouterliciousDriverPolicies } from \"./policies\";\nimport { ICache } from \"./cache\";\nimport { WholeSummaryDocumentStorageService } from \"./wholeSummaryDocumentStorageService\";\nimport { ShreddedSummaryDocumentStorageService } from \"./shreddedSummaryDocumentStorageService\";\nimport { GitManager } from \"./gitManager\";\nimport { ISnapshotTreeVersion } from \"./definitions\";\nimport { INormalizedWholeSnapshot } from \"./contracts\";\n\nexport class DocumentStorageService extends DocumentStorageServiceProxy {\n\tprivate _logTailSha: string | undefined = undefined;\n\n\tpublic get logTailSha(): string | undefined {\n\t\treturn this._logTailSha;\n\t}\n\n\tprivate static loadInternalDocumentStorageService(\n\t\tid: string,\n\t\tmanager: GitManager,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tpolicies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<INormalizedWholeSnapshot>,\n\t\tshreddedSummaryTreeCache?: ICache<ISnapshotTreeVersion>,\n\t\tnoCacheGitManager?: GitManager,\n\t\tgetStorageManager?: (disableCache?: boolean) => Promise<GitManager>,\n\t): IDocumentStorageService {\n\t\tconst storageService = driverPolicies?.enableWholeSummaryUpload\n\t\t\t? new WholeSummaryDocumentStorageService(\n\t\t\t\t\tid,\n\t\t\t\t\tmanager,\n\t\t\t\t\tlogger,\n\t\t\t\t\tpolicies,\n\t\t\t\t\tdriverPolicies,\n\t\t\t\t\tblobCache,\n\t\t\t\t\tsnapshotTreeCache,\n\t\t\t\t\tnoCacheGitManager,\n\t\t\t\t\tgetStorageManager,\n\t\t\t )\n\t\t\t: new ShreddedSummaryDocumentStorageService(\n\t\t\t\t\tid,\n\t\t\t\t\tmanager,\n\t\t\t\t\tlogger,\n\t\t\t\t\tpolicies,\n\t\t\t\t\tdriverPolicies,\n\t\t\t\t\tblobCache,\n\t\t\t\t\tshreddedSummaryTreeCache,\n\t\t\t\t\tgetStorageManager,\n\t\t\t );\n\t\t// TODO: worth prefetching latest summary making version + snapshot call with WholeSummary storage?\n\t\tif (\n\t\t\t!driverPolicies?.enableWholeSummaryUpload &&\n\t\t\tpolicies.caching === LoaderCachingPolicy.Prefetch\n\t\t) {\n\t\t\treturn new PrefetchDocumentStorageService(storageService);\n\t\t}\n\t\treturn storageService;\n\t}\n\n\tconstructor(\n\t\tpublic readonly id: string,\n\t\tpublic manager: GitManager,\n\t\tlogger: ITelemetryLoggerExt,\n\t\tpolicies: IDocumentStorageServicePolicies,\n\t\tdriverPolicies?: IRouterliciousDriverPolicies,\n\t\tblobCache?: ICache<ArrayBufferLike>,\n\t\tsnapshotTreeCache?: ICache<INormalizedWholeSnapshot>,\n\t\tshreddedSummaryTreeCache?: ICache<ISnapshotTreeVersion>,\n\t\tpublic noCacheGitManager?: GitManager,\n\t\tgetStorageManager?: (disableCache?: boolean) => Promise<GitManager>,\n\t) {\n\t\tsuper(\n\t\t\tDocumentStorageService.loadInternalDocumentStorageService(\n\t\t\t\tid,\n\t\t\t\tmanager,\n\t\t\t\tlogger,\n\t\t\t\tpolicies,\n\t\t\t\tdriverPolicies,\n\t\t\t\tblobCache,\n\t\t\t\tsnapshotTreeCache,\n\t\t\t\tshreddedSummaryTreeCache,\n\t\t\t\tnoCacheGitManager,\n\t\t\t\tgetStorageManager,\n\t\t\t),\n\t\t);\n\t}\n\n\tpublic async getSnapshotTree(version?: IVersion): Promise<ISnapshotTree | null> {\n\t\tconst tree = await this.internalStorageService.getSnapshotTree(version);\n\t\tif (tree !== null) {\n\t\t\tthis._logTailSha =\n\t\t\t\t\".logTail\" in tree.trees ? tree.trees[\".logTail\"].blobs.logTail : undefined;\n\t\t}\n\t\treturn tree;\n\t}\n}\n"]}
|
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { DriverError, IDriverErrorBase } from "@fluidframework/driver-definitions";
|
|
6
|
+
import { IFluidErrorBase } from "@fluidframework/telemetry-utils";
|
|
7
|
+
/**
|
|
8
|
+
* Routerlicious Error types
|
|
9
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
12
|
+
export declare const RouterliciousErrorTypes: {
|
|
13
|
+
/**
|
|
14
|
+
* SSL Certificate Error.
|
|
15
|
+
*/
|
|
16
|
+
readonly sslCertError: "sslCertError";
|
|
17
|
+
readonly genericNetworkError: "genericNetworkError";
|
|
18
|
+
readonly authorizationError: "authorizationError";
|
|
19
|
+
readonly fileNotFoundOrAccessDeniedError: "fileNotFoundOrAccessDeniedError";
|
|
20
|
+
readonly offlineError: "offlineError";
|
|
21
|
+
readonly unsupportedClientProtocolVersion: "unsupportedClientProtocolVersion";
|
|
22
|
+
readonly writeError: "writeError";
|
|
23
|
+
readonly fetchFailure: "fetchFailure";
|
|
24
|
+
readonly fetchTokenError: "fetchTokenError";
|
|
25
|
+
readonly incorrectServerResponse: "incorrectServerResponse";
|
|
26
|
+
readonly fileOverwrittenInStorage: "fileOverwrittenInStorage";
|
|
27
|
+
readonly deltaStreamConnectionForbidden: "deltaStreamConnectionForbidden";
|
|
28
|
+
readonly locationRedirection: "locationRedirection";
|
|
29
|
+
readonly fluidInvalidSchema: "fluidInvalidSchema";
|
|
30
|
+
readonly fileIsLocked: "fileIsLocked";
|
|
31
|
+
readonly outOfStorageError: "outOfStorageError";
|
|
32
|
+
readonly genericError: "genericError";
|
|
33
|
+
readonly throttlingError: "throttlingError";
|
|
34
|
+
readonly usageError: "usageError";
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* @internal
|
|
38
|
+
*/
|
|
39
|
+
export type RouterliciousErrorTypes = (typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];
|
|
40
|
+
/**
|
|
41
|
+
* Routerlicious Error types
|
|
42
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
43
|
+
*
|
|
44
|
+
* @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
|
|
45
|
+
* @internal
|
|
46
|
+
*/
|
|
47
|
+
export declare enum RouterliciousErrorType {
|
|
48
|
+
/**
|
|
49
|
+
* File not found, or file deleted during session
|
|
50
|
+
*/
|
|
51
|
+
fileNotFoundOrAccessDeniedError = "fileNotFoundOrAccessDeniedError",
|
|
52
|
+
/**
|
|
53
|
+
* SSL Certificate Error.
|
|
54
|
+
*/
|
|
55
|
+
sslCertError = "sslCertError"
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Interface for error responses for the WebSocket connection
|
|
59
|
+
* Intended to be compatible with output from {@link NetworkError.toJSON}
|
|
60
|
+
*/
|
|
61
|
+
export interface IR11sSocketError {
|
|
62
|
+
/**
|
|
63
|
+
* An error code number for the error that occurred.
|
|
64
|
+
* It will be a valid HTTP status code.
|
|
65
|
+
*/
|
|
66
|
+
code: number;
|
|
67
|
+
/**
|
|
68
|
+
* A message about the error that occurred for debugging / logging purposes.
|
|
69
|
+
* This should not be displayed to the user directly.
|
|
70
|
+
*/
|
|
71
|
+
message: string;
|
|
72
|
+
/**
|
|
73
|
+
* Optional Retry-After time in seconds.
|
|
74
|
+
* The client should wait this many seconds before retrying its request.
|
|
75
|
+
*/
|
|
76
|
+
retryAfter?: number;
|
|
77
|
+
/**
|
|
78
|
+
* Optional Retry-After time in milliseconds.
|
|
79
|
+
* The client should wait this many milliseconds before retrying its request.
|
|
80
|
+
*/
|
|
81
|
+
retryAfterMs?: number;
|
|
82
|
+
}
|
|
83
|
+
export interface IR11sError extends Omit<IDriverErrorBase, "errorType"> {
|
|
84
|
+
readonly errorType: RouterliciousErrorType;
|
|
85
|
+
}
|
|
86
|
+
export type R11sError = DriverError | IR11sError;
|
|
87
|
+
export declare function createR11sNetworkError(errorMessage: string, statusCode: number, retryAfterMs?: number): IFluidErrorBase & R11sError;
|
|
88
|
+
export declare function throwR11sNetworkError(errorMessage: string, statusCode: number, retryAfterMs?: number): never;
|
|
89
|
+
/**
|
|
90
|
+
* Returns network error based on error object from R11s socket (IR11sSocketError)
|
|
91
|
+
*/
|
|
92
|
+
export declare function errorObjectFromSocketError(socketError: IR11sSocketError, handler: string): R11sError;
|
|
93
|
+
//# sourceMappingURL=errorUtils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errorUtils.d.ts","sour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 -0,0 +1,81 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import { DriverErrorTypes, } from "@fluidframework/driver-definitions";
|
|
6
|
+
import { NonRetryableError, GenericNetworkError, createGenericNetworkError, AuthorizationError, } from "@fluidframework/driver-utils";
|
|
7
|
+
import { pkgVersion as driverVersion } from "./packageVersion.mjs";
|
|
8
|
+
/**
|
|
9
|
+
* Routerlicious Error types
|
|
10
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
13
|
+
export const RouterliciousErrorTypes = {
|
|
14
|
+
// Inherit base driver error types
|
|
15
|
+
...DriverErrorTypes,
|
|
16
|
+
/**
|
|
17
|
+
* SSL Certificate Error.
|
|
18
|
+
*/
|
|
19
|
+
sslCertError: "sslCertError",
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Routerlicious Error types
|
|
23
|
+
* Different error types that may be thrown by the routerlicious driver
|
|
24
|
+
*
|
|
25
|
+
* @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.
|
|
26
|
+
* @internal
|
|
27
|
+
*/
|
|
28
|
+
export var RouterliciousErrorType;
|
|
29
|
+
(function (RouterliciousErrorType) {
|
|
30
|
+
/**
|
|
31
|
+
* File not found, or file deleted during session
|
|
32
|
+
*/
|
|
33
|
+
RouterliciousErrorType["fileNotFoundOrAccessDeniedError"] = "fileNotFoundOrAccessDeniedError";
|
|
34
|
+
/**
|
|
35
|
+
* SSL Certificate Error.
|
|
36
|
+
*/
|
|
37
|
+
RouterliciousErrorType["sslCertError"] = "sslCertError";
|
|
38
|
+
})(RouterliciousErrorType || (RouterliciousErrorType = {}));
|
|
39
|
+
export function createR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
40
|
+
let error;
|
|
41
|
+
const props = { statusCode, driverVersion };
|
|
42
|
+
switch (statusCode) {
|
|
43
|
+
case 401:
|
|
44
|
+
// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,
|
|
45
|
+
// so we treat repeat 401s the same as 403.
|
|
46
|
+
case 403:
|
|
47
|
+
error = new AuthorizationError(errorMessage, undefined, undefined, props);
|
|
48
|
+
break;
|
|
49
|
+
case 404:
|
|
50
|
+
const errorType = RouterliciousErrorType.fileNotFoundOrAccessDeniedError;
|
|
51
|
+
error = new NonRetryableError(errorMessage, errorType, props);
|
|
52
|
+
break;
|
|
53
|
+
case 429:
|
|
54
|
+
error = createGenericNetworkError(errorMessage, { canRetry: true, retryAfterMs }, props);
|
|
55
|
+
break;
|
|
56
|
+
case 500:
|
|
57
|
+
case 502:
|
|
58
|
+
error = new GenericNetworkError(errorMessage, true, props);
|
|
59
|
+
break;
|
|
60
|
+
default:
|
|
61
|
+
const retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };
|
|
62
|
+
error = createGenericNetworkError(errorMessage, retryInfo, props);
|
|
63
|
+
break;
|
|
64
|
+
}
|
|
65
|
+
error.addTelemetryProperties({ endpointReached: true });
|
|
66
|
+
return error;
|
|
67
|
+
}
|
|
68
|
+
export function throwR11sNetworkError(errorMessage, statusCode, retryAfterMs) {
|
|
69
|
+
const networkError = createR11sNetworkError(errorMessage, statusCode, retryAfterMs);
|
|
70
|
+
// eslint-disable-next-line @typescript-eslint/no-throw-literal
|
|
71
|
+
throw networkError;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Returns network error based on error object from R11s socket (IR11sSocketError)
|
|
75
|
+
*/
|
|
76
|
+
export function errorObjectFromSocketError(socketError, handler) {
|
|
77
|
+
// pre-0.58 error message prefix: R11sSocketError
|
|
78
|
+
const message = `R11s socket error (${handler}): ${socketError.message}`;
|
|
79
|
+
return createR11sNetworkError(message, socketError.code, socketError.retryAfterMs);
|
|
80
|
+
}
|
|
81
|
+
//# sourceMappingURL=errorUtils.mjs.map
|
|
@@ -0,0 +1 @@
|
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M;QACP,KAAK,GAAG,CAAC;QACT,KAAK,GAAG;YACP,KAAK,GAAG,IAAI,mBAAmB,CAAC,YAAY,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;YAC3D,MAAM;QACP;YACC,MAAM,SAAS,GAAG,EAAE,QAAQ,EAAE,YAAY,KAAK,SAAS,EAAE,YAAY,EAAE,CAAC;YACzE,KAAK,GAAG,yBAAyB,CAAC,YAAY,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;YAClE,MAAM;KACP;IACD,KAAK,CAAC,sBAAsB,CAAC,EAAE,eAAe,EAAE,IAAI,EAAE,CAAC,CAAC;IACxD,OAAO,KAAK,CAAC;AACd,CAAC;AAED,MAAM,UAAU,qBAAqB,CACpC,YAAoB,EACpB,UAAkB,EAClB,YAAqB;IAErB,MAAM,YAAY,GAAG,sBAAsB,CAAC,YAAY,EAAE,UAAU,EAAE,YAAY,CAAC,CAAC;IAEpF,+DAA+D;IAC/D,MAAM,YAAY,CAAC;AACpB,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,0BAA0B,CACzC,WAA6B,EAC7B,OAAe;IAEf,iDAAiD;IACjD,MAAM,OAAO,GAAG,sBAAsB,OAAO,MAAM,WAAW,CAAC,OAAO,EAAE,CAAC;IACzE,OAAO,sBAAsB,CAAC,OAAO,EAAE,WAAW,CAAC,IAAI,EAAE,WAAW,CAAC,YAAY,CAAC,CAAC;AACpF,CAAC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport {\n\tDriverError,\n\tIDriverErrorBase,\n\tDriverErrorTypes,\n} from \"@fluidframework/driver-definitions\";\nimport {\n\tNonRetryableError,\n\tGenericNetworkError,\n\tcreateGenericNetworkError,\n\tAuthorizationError,\n} from \"@fluidframework/driver-utils\";\nimport { IFluidErrorBase } from \"@fluidframework/telemetry-utils\";\nimport { pkgVersion as driverVersion } from \"./packageVersion\";\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n * @internal\n */\nexport const RouterliciousErrorTypes = {\n\t// Inherit base driver error types\n\t...DriverErrorTypes,\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError: \"sslCertError\",\n} as const;\n/**\n * @internal\n */\nexport type RouterliciousErrorTypes =\n\t(typeof RouterliciousErrorTypes)[keyof typeof RouterliciousErrorTypes];\n\n/**\n * Routerlicious Error types\n * Different error types that may be thrown by the routerlicious driver\n *\n * @deprecated Use {@link (RouterliciousErrorTypes:variable)} instead.\n * @internal\n */\nexport enum RouterliciousErrorType {\n\t/**\n\t * File not found, or file deleted during session\n\t */\n\tfileNotFoundOrAccessDeniedError = \"fileNotFoundOrAccessDeniedError\",\n\n\t/**\n\t * SSL Certificate Error.\n\t */\n\tsslCertError = \"sslCertError\",\n}\n\n/**\n * Interface for error responses for the WebSocket connection\n * Intended to be compatible with output from {@link NetworkError.toJSON}\n */\nexport interface IR11sSocketError {\n\t/**\n\t * An error code number for the error that occurred.\n\t * It will be a valid HTTP status code.\n\t */\n\tcode: number;\n\n\t/**\n\t * A message about the error that occurred for debugging / logging purposes.\n\t * This should not be displayed to the user directly.\n\t */\n\tmessage: string;\n\n\t/**\n\t * Optional Retry-After time in seconds.\n\t * The client should wait this many seconds before retrying its request.\n\t */\n\tretryAfter?: number;\n\n\t/**\n\t * Optional Retry-After time in milliseconds.\n\t * The client should wait this many milliseconds before retrying its request.\n\t */\n\tretryAfterMs?: number;\n}\n\nexport interface IR11sError extends Omit<IDriverErrorBase, \"errorType\"> {\n\treadonly errorType: RouterliciousErrorType;\n}\n\nexport type R11sError = DriverError | IR11sError;\n\nexport function createR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n): IFluidErrorBase & R11sError {\n\tlet error: IFluidErrorBase & R11sError;\n\tconst props = { statusCode, driverVersion };\n\tswitch (statusCode) {\n\t\tcase 401:\n\t\t// The first 401 is manually retried in RouterliciousRestWrapper with a refreshed token,\n\t\t// so we treat repeat 401s the same as 403.\n\t\tcase 403:\n\t\t\terror = new AuthorizationError(errorMessage, undefined, undefined, props);\n\t\t\tbreak;\n\t\tcase 404:\n\t\t\tconst errorType = RouterliciousErrorType.fileNotFoundOrAccessDeniedError;\n\t\t\terror = new NonRetryableError(errorMessage, errorType, props);\n\t\t\tbreak;\n\t\tcase 429:\n\t\t\terror = createGenericNetworkError(\n\t\t\t\terrorMessage,\n\t\t\t\t{ canRetry: true, retryAfterMs },\n\t\t\t\tprops,\n\t\t\t);\n\t\t\tbreak;\n\t\tcase 500:\n\t\tcase 502:\n\t\t\terror = new GenericNetworkError(errorMessage, true, props);\n\t\t\tbreak;\n\t\tdefault:\n\t\t\tconst retryInfo = { canRetry: retryAfterMs !== undefined, retryAfterMs };\n\t\t\terror = createGenericNetworkError(errorMessage, retryInfo, props);\n\t\t\tbreak;\n\t}\n\terror.addTelemetryProperties({ endpointReached: true });\n\treturn error;\n}\n\nexport function throwR11sNetworkError(\n\terrorMessage: string,\n\tstatusCode: number,\n\tretryAfterMs?: number,\n): never {\n\tconst networkError = createR11sNetworkError(errorMessage, statusCode, retryAfterMs);\n\n\t// eslint-disable-next-line @typescript-eslint/no-throw-literal\n\tthrow networkError;\n}\n\n/**\n * Returns network error based on error object from R11s socket (IR11sSocketError)\n */\nexport function errorObjectFromSocketError(\n\tsocketError: IR11sSocketError,\n\thandler: string,\n): R11sError {\n\t// pre-0.58 error message prefix: R11sSocketError\n\tconst message = `R11s socket error (${handler}): ${socketError.message}`;\n\treturn createR11sNetworkError(message, socketError.code, socketError.retryAfterMs);\n}\n"]}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import * as resources from "@fluidframework/gitresources";
|
|
6
|
+
import { IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
|
+
import { IGitManager, IHistorian } from "./storageContracts.mjs";
|
|
8
|
+
import { IR11sResponse } from "./restWrapper.mjs";
|
|
9
|
+
import { IWholeFlatSnapshot } from "./contracts.mjs";
|
|
10
|
+
export declare class GitManager implements IGitManager {
|
|
11
|
+
private readonly historian;
|
|
12
|
+
constructor(historian: IHistorian);
|
|
13
|
+
/**
|
|
14
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
15
|
+
*/
|
|
16
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<resources.ICommitDetails[]>>;
|
|
17
|
+
/**
|
|
18
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
19
|
+
*/
|
|
20
|
+
getTree(root: string, recursive?: boolean): Promise<IR11sResponse<resources.ITree>>;
|
|
21
|
+
getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>>;
|
|
22
|
+
createBlob(content: string, encoding: "utf-8" | "base64"): Promise<IR11sResponse<resources.ICreateBlobResponse>>;
|
|
23
|
+
createGitTree(params: resources.ICreateTreeParams): Promise<IR11sResponse<resources.ITree>>;
|
|
24
|
+
createSummary(summary: IWholeSummaryPayload, initial?: boolean): Promise<IR11sResponse<IWriteSummaryResponse>>;
|
|
25
|
+
getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=gitManager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitManager.d.ts","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,KAAK,SAAS,MAAM,8BAA8B;OAClD,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC;OACxC,EAAE,WAAW,EAAE,UAAU,EAAE;OAC3B,EAAE,aAAa,EAAE;OACjB,EAAE,kBAAkB,EAAE;AAE7B,qBAAa,UAAW,YAAW,WAAW;IACjC,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAAT,SAAS,EAAE,UAAU;IAElD;;OAEG;IACU,UAAU,CACtB,GAAG,EAAE,MAAM,EACX,KAAK,EAAE,MAAM,GACX,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,cAAc,EAAE,CAAC,CAAC;IAIrD;;OAEG;IACU,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,UAAO,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAIhF,OAAO,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAI7D,UAAU,CACtB,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,OAAO,GAAG,QAAQ,GAC1B,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAQ3C,aAAa,CACzB,MAAM,EAAE,SAAS,CAAC,iBAAiB,GACjC,OAAO,CAAC,aAAa,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;IAK7B,aAAa,CACzB,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE,OAAe,GACtB,OAAO,CAAC,aAAa,CAAC,qBAAqB,CAAC,CAAC;IAInC,WAAW,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC,kBAAkB,CAAC,CAAC;CAGjF"}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export class GitManager {
|
|
6
|
+
constructor(historian) {
|
|
7
|
+
this.historian = historian;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
11
|
+
*/
|
|
12
|
+
async getCommits(sha, count) {
|
|
13
|
+
return this.historian.getCommits(sha, count);
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Reads the object with the given ID. We defer to the client implementation to do the actual read.
|
|
17
|
+
*/
|
|
18
|
+
async getTree(root, recursive = true) {
|
|
19
|
+
return this.historian.getTree(root, recursive);
|
|
20
|
+
}
|
|
21
|
+
async getBlob(sha) {
|
|
22
|
+
return this.historian.getBlob(sha);
|
|
23
|
+
}
|
|
24
|
+
async createBlob(content, encoding) {
|
|
25
|
+
const blob = {
|
|
26
|
+
content,
|
|
27
|
+
encoding,
|
|
28
|
+
};
|
|
29
|
+
return this.historian.createBlob(blob);
|
|
30
|
+
}
|
|
31
|
+
async createGitTree(params) {
|
|
32
|
+
const treeP = this.historian.createTree(params);
|
|
33
|
+
return treeP;
|
|
34
|
+
}
|
|
35
|
+
async createSummary(summary, initial = false) {
|
|
36
|
+
return this.historian.createSummary(summary, initial);
|
|
37
|
+
}
|
|
38
|
+
async getSnapshot(sha) {
|
|
39
|
+
return this.historian.getSnapshot(sha);
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
//# sourceMappingURL=gitManager.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"gitManager.mjs","sourceRoot":"","sources":["../src/gitManager.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAWH,MAAM,OAAO,UAAU;IACtB,YAA6B,SAAqB;QAArB,cAAS,GAAT,SAAS,CAAY;IAAG,CAAC;IAEtD;;OAEG;IACI,KAAK,CAAC,UAAU,CACtB,GAAW,EACX,KAAa;QAEb,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAC9C,CAAC;IAED;;OAEG;IACI,KAAK,CAAC,OAAO,CAAC,IAAY,EAAE,SAAS,GAAG,IAAI;QAClD,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;IAChD,CAAC;IAEM,KAAK,CAAC,OAAO,CAAC,GAAW;QAC/B,OAAO,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;IACpC,CAAC;IAEM,KAAK,CAAC,UAAU,CACtB,OAAe,EACf,QAA4B;QAE5B,MAAM,IAAI,GAAgC;YACzC,OAAO;YACP,QAAQ;SACR,CAAC;QACF,OAAO,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACxC,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,MAAmC;QAEnC,MAAM,KAAK,GAAG,IAAI,CAAC,SAAS,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAChD,OAAO,KAAK,CAAC;IACd,CAAC;IAEM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,UAAmB,KAAK;QAExB,OAAO,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,OAAO,EAAE,OAAO,CAAC,CAAC;IACvD,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,SAAS,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;IACxC,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport * as resources from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { IGitManager, IHistorian } from \"./storageContracts\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport class GitManager implements IGitManager {\n\tconstructor(private readonly historian: IHistorian) {}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getCommits(\n\t\tsha: string,\n\t\tcount: number,\n\t): Promise<IR11sResponse<resources.ICommitDetails[]>> {\n\t\treturn this.historian.getCommits(sha, count);\n\t}\n\n\t/**\n\t * Reads the object with the given ID. We defer to the client implementation to do the actual read.\n\t */\n\tpublic async getTree(root: string, recursive = true): Promise<IR11sResponse<resources.ITree>> {\n\t\treturn this.historian.getTree(root, recursive);\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<resources.IBlob>> {\n\t\treturn this.historian.getBlob(sha);\n\t}\n\n\tpublic async createBlob(\n\t\tcontent: string,\n\t\tencoding: \"utf-8\" | \"base64\",\n\t): Promise<IR11sResponse<resources.ICreateBlobResponse>> {\n\t\tconst blob: resources.ICreateBlobParams = {\n\t\t\tcontent,\n\t\t\tencoding,\n\t\t};\n\t\treturn this.historian.createBlob(blob);\n\t}\n\n\tpublic async createGitTree(\n\t\tparams: resources.ICreateTreeParams,\n\t): Promise<IR11sResponse<resources.ITree>> {\n\t\tconst treeP = this.historian.createTree(params);\n\t\treturn treeP;\n\t}\n\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial: boolean = false,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.historian.createSummary(summary, initial);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.historian.getSnapshot(sha);\n\t}\n}\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
import * as git from "@fluidframework/gitresources";
|
|
6
|
+
import { IWholeSummaryPayload, IWriteSummaryResponse } from "@fluidframework/server-services-client";
|
|
7
|
+
import { RestWrapper } from "./restWrapperBase.mjs";
|
|
8
|
+
import { IR11sResponse } from "./restWrapper.mjs";
|
|
9
|
+
import { IHistorian } from "./storageContracts.mjs";
|
|
10
|
+
import { IWholeFlatSnapshot } from "./contracts.mjs";
|
|
11
|
+
export interface ICredentials {
|
|
12
|
+
user: string;
|
|
13
|
+
password: string;
|
|
14
|
+
}
|
|
15
|
+
export declare const getAuthorizationTokenFromCredentials: (credentials: ICredentials) => string;
|
|
16
|
+
/**
|
|
17
|
+
* Implementation of the IHistorian interface that calls out to a REST interface
|
|
18
|
+
*/
|
|
19
|
+
export declare class Historian implements IHistorian {
|
|
20
|
+
private readonly historianApi;
|
|
21
|
+
private readonly restWrapper;
|
|
22
|
+
private readonly defaultQueryString;
|
|
23
|
+
private readonly cacheBust;
|
|
24
|
+
constructor(historianApi: boolean, disableCache: boolean, restWrapper: RestWrapper);
|
|
25
|
+
getBlob(sha: string): Promise<IR11sResponse<git.IBlob>>;
|
|
26
|
+
createBlob(blob: git.ICreateBlobParams): Promise<IR11sResponse<git.ICreateBlobResponse>>;
|
|
27
|
+
getCommits(sha: string, count: number): Promise<IR11sResponse<git.ICommitDetails[]>>;
|
|
28
|
+
createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>>;
|
|
29
|
+
getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>>;
|
|
30
|
+
createSummary(summary: IWholeSummaryPayload, initial?: boolean): Promise<IR11sResponse<IWriteSummaryResponse>>;
|
|
31
|
+
getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>>;
|
|
32
|
+
private getQueryString;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=historian.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historian.d.ts","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,KAAK,GAAG,MAAM,8BAA8B;OAC5C,EACN,oBAAoB,EACpB,qBAAqB,EACrB,MAAM,wCAAwC;OACxC,EAAmB,WAAW,EAAE;OAChC,EAAE,aAAa,EAAE;OACjB,EAAE,UAAU,EAAE;OACd,EAAE,kBAAkB,EAAE;AAE7B,MAAM,WAAW,YAAY;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CACjB;AAED,eAAO,MAAM,oCAAoC,gBAAiB,YAAY,KAAG,MACN,CAAC;AAE5E;;GAEG;AACH,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Utf8ToBase64 } from "@fluid-internal/client-utils";
|
|
6
|
+
export const getAuthorizationTokenFromCredentials = (credentials) => `Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;
|
|
7
|
+
/**
|
|
8
|
+
* Implementation of the IHistorian interface that calls out to a REST interface
|
|
9
|
+
*/
|
|
10
|
+
export class Historian {
|
|
11
|
+
constructor(historianApi, disableCache, restWrapper) {
|
|
12
|
+
this.historianApi = historianApi;
|
|
13
|
+
this.restWrapper = restWrapper;
|
|
14
|
+
this.defaultQueryString = {};
|
|
15
|
+
if (disableCache && this.historianApi) {
|
|
16
|
+
this.defaultQueryString.disableCache = disableCache;
|
|
17
|
+
this.cacheBust = false;
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
this.cacheBust = disableCache;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
async getBlob(sha) {
|
|
24
|
+
return this.restWrapper.get(`/git/blobs/${encodeURIComponent(sha)}`, this.getQueryString());
|
|
25
|
+
}
|
|
26
|
+
async createBlob(blob) {
|
|
27
|
+
return this.restWrapper.post(`/git/blobs`, blob, this.getQueryString());
|
|
28
|
+
}
|
|
29
|
+
async getCommits(sha, count) {
|
|
30
|
+
return this.restWrapper
|
|
31
|
+
.get(`/commits`, this.getQueryString({ count, sha }))
|
|
32
|
+
.catch(async (error) => error.statusCode === 400 || error.statusCode === 404
|
|
33
|
+
? {
|
|
34
|
+
content: [],
|
|
35
|
+
headers: new Map(),
|
|
36
|
+
propsToLog: {},
|
|
37
|
+
requestUrl: "",
|
|
38
|
+
}
|
|
39
|
+
: Promise.reject(error));
|
|
40
|
+
}
|
|
41
|
+
async createTree(tree) {
|
|
42
|
+
return this.restWrapper.post(`/git/trees`, tree, this.getQueryString());
|
|
43
|
+
}
|
|
44
|
+
async getTree(sha, recursive) {
|
|
45
|
+
return this.restWrapper.get(`/git/trees/${encodeURIComponent(sha)}`, this.getQueryString({ recursive: recursive ? 1 : 0 }));
|
|
46
|
+
}
|
|
47
|
+
async createSummary(summary, initial) {
|
|
48
|
+
return this.restWrapper.post(`/git/summaries`, summary, this.getQueryString(initial !== undefined ? { initial } : undefined));
|
|
49
|
+
}
|
|
50
|
+
async getSnapshot(sha) {
|
|
51
|
+
return this.restWrapper.get(`/git/summaries/${sha}`, this.getQueryString());
|
|
52
|
+
}
|
|
53
|
+
getQueryString(queryString) {
|
|
54
|
+
if (this.cacheBust) {
|
|
55
|
+
return {
|
|
56
|
+
cacheBust: Date.now(),
|
|
57
|
+
...this.defaultQueryString,
|
|
58
|
+
...queryString,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
return {
|
|
62
|
+
...this.defaultQueryString,
|
|
63
|
+
...queryString,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=historian.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"historian.mjs","sourceRoot":"","sources":["../src/historian.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAEI,EAAE,gBAAgB,EAAE,MAAM,8BAA8B;AAgB/D,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,WAAyB,EAAU,EAAE,CACzF,SAAS,gBAAgB,CAAC,GAAG,WAAW,CAAC,IAAI,IAAI,WAAW,CAAC,QAAQ,EAAE,CAAC,EAAE,CAAC;AAE5E;;GAEG;AACH,MAAM,OAAO,SAAS;IAIrB,YACkB,YAAqB,EACtC,YAAqB,EACJ,WAAwB;QAFxB,iBAAY,GAAZ,YAAY,CAAS;QAErB,gBAAW,GAAX,WAAW,CAAa;QANzB,uBAAkB,GAAoB,EAAE,CAAC;QAQzD,IAAI,YAAY,IAAI,IAAI,CAAC,YAAY,EAAE;YACtC,IAAI,CAAC,kBAAkB,CAAC,YAAY,GAAG,YAAY,CAAC;YACpD,IAAI,CAAC,SAAS,GAAG,KAAK,CAAC;SACvB;aAAM;YACN,IAAI,CAAC,SAAS,GAAG,YAAY,CAAC;SAC9B;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C,CAAC,CAAC,CAAC,EAAE,CAAC,CACrD,CAAC;IACH,CAAC;IACM,KAAK,CAAC,aAAa,CACzB,OAA6B,EAC7B,OAAiB;QAEjB,OAAO,IAAI,CAAC,WAAW,CAAC,IAAI,CAC3B,gBAAgB,EAChB,OAAO,EACP,IAAI,CAAC,cAAc,CAAC,OAAO,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC,CACpE,CAAC;IACH,CAAC;IAEM,KAAK,CAAC,WAAW,CAAC,GAAW;QACnC,OAAO,IAAI,CAAC,WAAW,CAAC,GAAG,CAC1B,kBAAkB,GAAG,EAAE,EACvB,IAAI,CAAC,cAAc,EAAE,CACrB,CAAC;IACH,CAAC;IAEO,cAAc,CAAC,WAA6B;QACnD,IAAI,IAAI,CAAC,SAAS,EAAE;YACnB,OAAO;gBACN,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE;gBACrB,GAAG,IAAI,CAAC,kBAAkB;gBAC1B,GAAG,WAAW;aACd,CAAC;SACF;QACD,OAAO;YACN,GAAG,IAAI,CAAC,kBAAkB;YAC1B,GAAG,WAAW;SACd,CAAC;IACH,CAAC;CACD","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\nimport { fromUtf8ToBase64 } from \"@fluid-internal/client-utils\";\nimport * as git from \"@fluidframework/gitresources\";\nimport {\n\tIWholeSummaryPayload,\n\tIWriteSummaryResponse,\n} from \"@fluidframework/server-services-client\";\nimport { QueryStringType, RestWrapper } from \"./restWrapperBase\";\nimport { IR11sResponse } from \"./restWrapper\";\nimport { IHistorian } from \"./storageContracts\";\nimport { IWholeFlatSnapshot } from \"./contracts\";\n\nexport interface ICredentials {\n\tuser: string;\n\tpassword: string;\n}\n\nexport const getAuthorizationTokenFromCredentials = (credentials: ICredentials): string =>\n\t`Basic ${fromUtf8ToBase64(`${credentials.user}:${credentials.password}`)}`;\n\n/**\n * Implementation of the IHistorian interface that calls out to a REST interface\n */\nexport class Historian implements IHistorian {\n\tprivate readonly defaultQueryString: QueryStringType = {};\n\tprivate readonly cacheBust: boolean;\n\n\tconstructor(\n\t\tprivate readonly historianApi: boolean,\n\t\tdisableCache: boolean,\n\t\tprivate readonly restWrapper: RestWrapper,\n\t) {\n\t\tif (disableCache && this.historianApi) {\n\t\t\tthis.defaultQueryString.disableCache = disableCache;\n\t\t\tthis.cacheBust = false;\n\t\t} else {\n\t\t\tthis.cacheBust = disableCache;\n\t\t}\n\t}\n\n\tpublic async getBlob(sha: string): Promise<IR11sResponse<git.IBlob>> {\n\t\treturn this.restWrapper.get<git.IBlob>(\n\t\t\t`/git/blobs/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tpublic async createBlob(\n\t\tblob: git.ICreateBlobParams,\n\t): Promise<IR11sResponse<git.ICreateBlobResponse>> {\n\t\treturn this.restWrapper.post<git.ICreateBlobResponse>(\n\t\t\t`/git/blobs`,\n\t\t\tblob,\n\t\t\tthis.getQueryString(),\n\t\t);\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.restWrapper\n\t\t\t.get<git.ICommitDetails[]>(`/commits`, this.getQueryString({ count, sha }))\n\t\t\t.catch(async (error) =>\n\t\t\t\terror.statusCode === 400 || error.statusCode === 404\n\t\t\t\t\t? {\n\t\t\t\t\t\t\tcontent: [],\n\t\t\t\t\t\t\theaders: new Map(),\n\t\t\t\t\t\t\tpropsToLog: {},\n\t\t\t\t\t\t\trequestUrl: \"\",\n\t\t\t\t\t }\n\t\t\t\t\t: Promise.reject<IR11sResponse<git.ICommitDetails[]>>(error),\n\t\t\t);\n\t}\n\n\tpublic async createTree(tree: git.ICreateTreeParams): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.post<git.ITree>(`/git/trees`, tree, this.getQueryString());\n\t}\n\n\tpublic async getTree(sha: string, recursive: boolean): Promise<IR11sResponse<git.ITree>> {\n\t\treturn this.restWrapper.get<git.ITree>(\n\t\t\t`/git/trees/${encodeURIComponent(sha)}`,\n\t\t\tthis.getQueryString({ recursive: recursive ? 1 : 0 }),\n\t\t);\n\t}\n\tpublic async createSummary(\n\t\tsummary: IWholeSummaryPayload,\n\t\tinitial?: boolean,\n\t): Promise<IR11sResponse<IWriteSummaryResponse>> {\n\t\treturn this.restWrapper.post<IWriteSummaryResponse>(\n\t\t\t`/git/summaries`,\n\t\t\tsummary,\n\t\t\tthis.getQueryString(initial !== undefined ? { initial } : undefined),\n\t\t);\n\t}\n\n\tpublic async getSnapshot(sha: string): Promise<IR11sResponse<IWholeFlatSnapshot>> {\n\t\treturn this.restWrapper.get<IWholeFlatSnapshot>(\n\t\t\t`/git/summaries/${sha}`,\n\t\t\tthis.getQueryString(),\n\t\t);\n\t}\n\n\tprivate getQueryString(queryString?: QueryStringType): QueryStringType {\n\t\tif (this.cacheBust) {\n\t\t\treturn {\n\t\t\t\tcacheBust: Date.now(),\n\t\t\t\t...this.defaultQueryString,\n\t\t\t\t...queryString,\n\t\t\t};\n\t\t}\n\t\treturn {\n\t\t\t...this.defaultQueryString,\n\t\t\t...queryString,\n\t\t};\n\t}\n}\n"]}
|
package/lib/index.d.mts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { DefaultTokenProvider } from "./defaultTokenProvider.mjs";
|
|
6
|
+
export { ITokenProvider, ITokenResponse, ITokenService } from "./tokens.mjs";
|
|
7
|
+
export { RouterliciousErrorType, RouterliciousErrorTypes } from "./errorUtils.mjs";
|
|
8
|
+
export { DocumentPostCreateError, RouterliciousDocumentServiceFactory, } from "./documentServiceFactory.mjs";
|
|
9
|
+
export { IRouterliciousDriverPolicies } from "./policies.mjs";
|
|
10
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,oBAAoB,EAAE;OACxB,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE;OAGjD,EAAE,sBAAsB,EAAE,uBAAuB,EAAE;OAGnD,EACN,uBAAuB,EACvB,mCAAmC,GACnC;OAGM,EAAE,4BAA4B,EAAE"}
|
package/lib/index.mjs
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
export { DefaultTokenProvider } from "./defaultTokenProvider.mjs";
|
|
6
|
+
export { RouterliciousErrorType, RouterliciousErrorTypes } from "./errorUtils.mjs";
|
|
7
|
+
export { DocumentPostCreateError, RouterliciousDocumentServiceFactory, } from "./documentServiceFactory.mjs";
|
|
8
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.mjs","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;GAGG;OAGI,EAAE,oBAAoB,EAAE;OAIxB,EAAE,sBAAsB,EAAE,uBAAuB,EAAE;OAGnD,EACN,uBAAuB,EACvB,mCAAmC,GACnC","sourcesContent":["/*!\n * Copyright (c) Microsoft Corporation and contributors. All rights reserved.\n * Licensed under the MIT License.\n */\n\n// Tokens\nexport { DefaultTokenProvider } from \"./defaultTokenProvider\";\nexport { ITokenProvider, ITokenResponse, ITokenService } from \"./tokens\";\n\n// Errors\nexport { RouterliciousErrorType, RouterliciousErrorTypes } from \"./errorUtils\";\n\n// Factory\nexport {\n\tDocumentPostCreateError,\n\tRouterliciousDocumentServiceFactory,\n} from \"./documentServiceFactory\";\n\n// Configuration\nexport { IRouterliciousDriverPolicies } from \"./policies\";\n"]}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* Copyright (c) Microsoft Corporation and contributors. All rights reserved.
|
|
3
|
+
* Licensed under the MIT License.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* An extension of Map that expires (deletes) entries after a period of inactivity.
|
|
7
|
+
* The policy is based on the last time a key was written to.
|
|
8
|
+
*/
|
|
9
|
+
export declare class MapWithExpiration<TKey = any, TValue = any> extends Map<TKey, TValue> {
|
|
10
|
+
private readonly expiryMs;
|
|
11
|
+
/** Timestamps (as epoch ms numbers) of when each key was last refreshed */
|
|
12
|
+
private readonly lastRefreshedTimes;
|
|
13
|
+
constructor(expiryMs: number);
|
|
14
|
+
private refresh;
|
|
15
|
+
/**
|
|
16
|
+
* Returns true if the key is present and expired, false if it's not expired, and undefined if it's not found
|
|
17
|
+
* If cleanUp is passed as true, then delete any expired entry before returning.
|
|
18
|
+
*/
|
|
19
|
+
private checkExpiry;
|
|
20
|
+
private clearExpiredEntries;
|
|
21
|
+
get size(): number;
|
|
22
|
+
has(key: TKey): boolean;
|
|
23
|
+
get(key: TKey): TValue | undefined;
|
|
24
|
+
set(key: TKey, value: TValue): this;
|
|
25
|
+
delete(key: TKey): boolean;
|
|
26
|
+
clear(): void;
|
|
27
|
+
forEach(callbackfn: (value: TValue, key: TKey, map: Map<TKey, TValue>) => void, thisArg?: any): void;
|
|
28
|
+
entries(): IterableIterator<[TKey, TValue]>;
|
|
29
|
+
keys(): IterableIterator<TKey>;
|
|
30
|
+
values(): IterableIterator<TValue>;
|
|
31
|
+
[Symbol.iterator](): IterableIterator<[TKey, TValue]>;
|
|
32
|
+
valueOf(): Object;
|
|
33
|
+
}
|
|
34
|
+
//# sourceMappingURL=mapWithExpiration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mapWithExpiration.d.ts","sourceRoot":"","sources":["../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